summaryrefslogtreecommitdiffstats
path: root/third_party/aom
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/aom')
-rw-r--r--third_party/aom/CHANGELOG1
-rw-r--r--third_party/aom/CMakeLists.txt257
-rw-r--r--third_party/aom/README3
-rw-r--r--third_party/aom/aom/aom_decoder.h27
-rw-r--r--third_party/aom/aom/aomdx.h4
-rw-r--r--third_party/aom/aom/internal/aom_codec_internal.h20
-rw-r--r--third_party/aom/aom/src/aom_decoder.c11
-rw-r--r--third_party/aom/aom_dsp/aom_convolve.c267
-rw-r--r--third_party/aom/aom_dsp/aom_convolve.h5
-rw-r--r--third_party/aom/aom_dsp/aom_dsp.cmake84
-rw-r--r--third_party/aom/aom_dsp/aom_dsp.mk42
-rw-r--r--third_party/aom/aom_dsp/aom_dsp_common.h2
-rwxr-xr-xthird_party/aom/aom_dsp/aom_dsp_rtcd_defs.pl177
-rw-r--r--third_party/aom/aom_dsp/arm/avg_neon.c38
-rw-r--r--third_party/aom/aom_dsp/arm/bilinear_filter_media.asm240
-rw-r--r--third_party/aom/aom_dsp/arm/sad_media.asm98
-rw-r--r--third_party/aom/aom_dsp/arm/subpel_variance_media.c81
-rw-r--r--third_party/aom/aom_dsp/arm/variance_halfpixvar16x16_h_media.asm185
-rw-r--r--third_party/aom/aom_dsp/arm/variance_halfpixvar16x16_hv_media.asm225
-rw-r--r--third_party/aom/aom_dsp/arm/variance_halfpixvar16x16_v_media.asm187
-rw-r--r--third_party/aom/aom_dsp/arm/variance_media.asm361
-rw-r--r--third_party/aom/aom_dsp/avg.c42
-rw-r--r--third_party/aom/aom_dsp/binary_codes_reader.c53
-rw-r--r--third_party/aom/aom_dsp/binary_codes_reader.h34
-rw-r--r--third_party/aom/aom_dsp/bitreader.h62
-rw-r--r--third_party/aom/aom_dsp/bitreader_buffer.c2
-rw-r--r--third_party/aom/aom_dsp/bitwriter.h63
-rw-r--r--third_party/aom/aom_dsp/dkboolreader.c110
-rw-r--r--third_party/aom/aom_dsp/dkboolreader.h181
-rw-r--r--third_party/aom/aom_dsp/dkboolwriter.c44
-rw-r--r--third_party/aom/aom_dsp/dkboolwriter.h104
-rw-r--r--third_party/aom/aom_dsp/intrapred.c162
-rw-r--r--third_party/aom/aom_dsp/inv_txfm.c864
-rw-r--r--third_party/aom/aom_dsp/loopfilter.c110
-rw-r--r--third_party/aom/aom_dsp/mips/avg_msa.c57
-rw-r--r--third_party/aom/aom_dsp/prob.c17
-rw-r--r--third_party/aom/aom_dsp/prob.h12
-rw-r--r--third_party/aom/aom_dsp/sad.c54
-rw-r--r--third_party/aom/aom_dsp/simd/v64_intrinsics.h4
-rw-r--r--third_party/aom/aom_dsp/variance.c365
-rw-r--r--third_party/aom/aom_dsp/variance.h13
-rw-r--r--third_party/aom/aom_dsp/x86/aom_convolve_hip_sse2.c195
-rw-r--r--third_party/aom/aom_dsp/x86/aom_highbd_convolve_hip_ssse3.c203
-rw-r--r--third_party/aom/aom_dsp/x86/avg_intrin_sse2.c46
-rw-r--r--third_party/aom/aom_dsp/x86/highbd_convolve_avx2.c656
-rw-r--r--third_party/aom/aom_dsp/x86/inv_txfm_avx2.c1238
-rw-r--r--third_party/aom/aom_dsp/x86/inv_txfm_common_avx2.h80
-rw-r--r--third_party/aom/aom_dsp/x86/inv_txfm_sse2.c103
-rw-r--r--third_party/aom/aom_dsp/x86/masked_sad_intrin_ssse3.c498
-rw-r--r--third_party/aom/aom_dsp/x86/masked_variance_intrin_ssse3.c2799
-rw-r--r--third_party/aom/aom_dsp/x86/obmc_intrinsic_ssse3.h45
-rw-r--r--third_party/aom/aom_dsp/x86/obmc_sad_sse4.c1
-rw-r--r--third_party/aom/aom_dsp/x86/obmc_variance_sse4.c3
-rw-r--r--third_party/aom/aom_dsp/x86/synonyms.h28
-rw-r--r--third_party/aom/aom_dsp/x86/txfm_common_avx2.h44
-rw-r--r--third_party/aom/aom_mem/aom_mem.cmake5
-rw-r--r--third_party/aom/aom_mem/aom_mem.h19
-rw-r--r--third_party/aom/aom_ports/aom_ports.cmake5
-rw-r--r--third_party/aom/aom_ports/arm_cpudetect.c26
-rw-r--r--third_party/aom/aom_scale/aom_scale.cmake5
-rw-r--r--third_party/aom/aom_util/aom_util.cmake5
-rw-r--r--third_party/aom/aom_util/debug_util.c26
-rw-r--r--third_party/aom/aom_util/debug_util.h7
-rw-r--r--third_party/aom/aomdec.c40
-rw-r--r--third_party/aom/aomenc.c21
-rw-r--r--third_party/aom/av1/av1.cmake65
-rw-r--r--third_party/aom/av1/av1_common.mk6
-rw-r--r--third_party/aom/av1/av1_cx.mk7
-rw-r--r--third_party/aom/av1/av1_cx_iface.c10
-rw-r--r--third_party/aom/av1/av1_dx_iface.c11
-rw-r--r--third_party/aom/av1/common/alloccommon.c18
-rw-r--r--third_party/aom/av1/common/av1_fwd_txfm1d.c115
-rw-r--r--third_party/aom/av1/common/av1_fwd_txfm1d.h10
-rw-r--r--third_party/aom/av1/common/av1_fwd_txfm1d_cfg.h364
-rw-r--r--third_party/aom/av1/common/av1_fwd_txfm2d.c134
-rw-r--r--third_party/aom/av1/common/av1_fwd_txfm2d_cfg.h444
-rw-r--r--third_party/aom/av1/common/av1_inv_txfm1d.c124
-rw-r--r--third_party/aom/av1/common/av1_inv_txfm1d.h10
-rw-r--r--third_party/aom/av1/common/av1_inv_txfm1d_cfg.h362
-rw-r--r--third_party/aom/av1/common/av1_inv_txfm2d.c165
-rw-r--r--third_party/aom/av1/common/av1_inv_txfm2d_cfg.h447
-rw-r--r--third_party/aom/av1/common/av1_loopfilter.c341
-rw-r--r--third_party/aom/av1/common/av1_loopfilter.h4
-rwxr-xr-xthird_party/aom/av1/common/av1_rtcd_defs.pl20
-rw-r--r--third_party/aom/av1/common/av1_txfm.h49
-rw-r--r--third_party/aom/av1/common/blockd.c56
-rw-r--r--third_party/aom/av1/common/blockd.h206
-rw-r--r--third_party/aom/av1/common/cdef.c20
-rw-r--r--third_party/aom/av1/common/cfl.c91
-rw-r--r--third_party/aom/av1/common/cfl.h41
-rw-r--r--third_party/aom/av1/common/common_data.h312
-rw-r--r--third_party/aom/av1/common/convolve.c148
-rw-r--r--third_party/aom/av1/common/convolve.h23
-rw-r--r--third_party/aom/av1/common/debugmodes.c10
-rw-r--r--third_party/aom/av1/common/entropy.c722
-rw-r--r--third_party/aom/av1/common/entropy.h74
-rw-r--r--third_party/aom/av1/common/entropymode.c1945
-rw-r--r--third_party/aom/av1/common/entropymode.h61
-rw-r--r--third_party/aom/av1/common/entropymv.c61
-rw-r--r--third_party/aom/av1/common/entropymv.h8
-rw-r--r--third_party/aom/av1/common/enums.h66
-rw-r--r--third_party/aom/av1/common/filter.c64
-rw-r--r--third_party/aom/av1/common/filter.h9
-rw-r--r--third_party/aom/av1/common/idct.c1250
-rw-r--r--third_party/aom/av1/common/idct.h37
-rw-r--r--third_party/aom/av1/common/mv.h4
-rw-r--r--third_party/aom/av1/common/mvref_common.c78
-rw-r--r--third_party/aom/av1/common/mvref_common.h190
-rw-r--r--third_party/aom/av1/common/odintrin.h3
-rw-r--r--third_party/aom/av1/common/onyxc_int.h112
-rw-r--r--third_party/aom/av1/common/pred_common.c58
-rw-r--r--third_party/aom/av1/common/pred_common.h21
-rw-r--r--third_party/aom/av1/common/quant_common.c24063
-rw-r--r--third_party/aom/av1/common/quant_common.h14
-rw-r--r--third_party/aom/av1/common/reconinter.c496
-rw-r--r--third_party/aom/av1/common/reconinter.h189
-rw-r--r--third_party/aom/av1/common/reconintra.c481
-rw-r--r--third_party/aom/av1/common/reconintra.h50
-rw-r--r--third_party/aom/av1/common/resize.c193
-rw-r--r--third_party/aom/av1/common/resize.h9
-rw-r--r--third_party/aom/av1/common/restoration.c14
-rw-r--r--third_party/aom/av1/common/restoration.h7
-rw-r--r--third_party/aom/av1/common/scan.c106
-rw-r--r--third_party/aom/av1/common/seg_common.h2
-rw-r--r--third_party/aom/av1/common/thread_common.c12
-rw-r--r--third_party/aom/av1/common/tile_common.c15
-rw-r--r--third_party/aom/av1/common/tile_common.h2
-rw-r--r--third_party/aom/av1/common/txb_common.c2
-rw-r--r--third_party/aom/av1/common/txb_common.h276
-rw-r--r--third_party/aom/av1/common/warped_motion.c813
-rw-r--r--third_party/aom/av1/common/warped_motion.h53
-rw-r--r--third_party/aom/av1/common/x86/av1_convolve_ssse3.c15
-rw-r--r--third_party/aom/av1/common/x86/av1_fwd_txfm1d_sse4.c28
-rw-r--r--third_party/aom/av1/common/x86/av1_fwd_txfm2d_sse4.c26
-rw-r--r--third_party/aom/av1/common/x86/av1_highbd_convolve_sse4.c8
-rw-r--r--third_party/aom/av1/common/x86/highbd_inv_txfm_avx2.c222
-rw-r--r--third_party/aom/av1/common/x86/highbd_inv_txfm_sse4.c384
-rw-r--r--third_party/aom/av1/common/x86/highbd_txfm_utility_sse4.h11
-rw-r--r--third_party/aom/av1/common/x86/highbd_warp_plane_ssse3.c344
-rw-r--r--third_party/aom/av1/common/x86/hybrid_inv_txfm_avx2.c74
-rw-r--r--third_party/aom/av1/common/x86/idct_intrin_sse2.c8
-rw-r--r--third_party/aom/av1/common/x86/warp_plane_sse2.c369
-rw-r--r--third_party/aom/av1/common/x86/warp_plane_ssse3.c508
-rw-r--r--third_party/aom/av1/decoder/decodeframe.c610
-rw-r--r--third_party/aom/av1/decoder/decodemv.c650
-rw-r--r--third_party/aom/av1/decoder/decoder.c2
-rw-r--r--third_party/aom/av1/decoder/decoder.h2
-rw-r--r--third_party/aom/av1/decoder/decodetxb.c2
-rw-r--r--third_party/aom/av1/decoder/detokenize.c122
-rw-r--r--third_party/aom/av1/decoder/inspection.c13
-rw-r--r--third_party/aom/av1/decoder/inspection.h5
-rw-r--r--third_party/aom/av1/decoder/laplace_decoder.c4
-rw-r--r--third_party/aom/av1/encoder/aq_cyclicrefresh.c4
-rw-r--r--third_party/aom/av1/encoder/av1_quantize.c54
-rw-r--r--third_party/aom/av1/encoder/av1_quantize.h15
-rw-r--r--third_party/aom/av1/encoder/bitstream.c1134
-rw-r--r--third_party/aom/av1/encoder/block.h28
-rw-r--r--third_party/aom/av1/encoder/context_tree.h4
-rw-r--r--third_party/aom/av1/encoder/corner_match.c15
-rw-r--r--third_party/aom/av1/encoder/corner_match.h4
-rw-r--r--third_party/aom/av1/encoder/daala_compat_enc.c8
-rw-r--r--third_party/aom/av1/encoder/dct.c57
-rw-r--r--third_party/aom/av1/encoder/encodeframe.c1325
-rw-r--r--third_party/aom/av1/encoder/encodeframe.h9
-rw-r--r--third_party/aom/av1/encoder/encodemb.c701
-rw-r--r--third_party/aom/av1/encoder/encodemb.h20
-rw-r--r--third_party/aom/av1/encoder/encodemv.c124
-rw-r--r--third_party/aom/av1/encoder/encoder.c729
-rw-r--r--third_party/aom/av1/encoder/encoder.h114
-rw-r--r--third_party/aom/av1/encoder/encodetxb.c1149
-rw-r--r--third_party/aom/av1/encoder/encodetxb.h51
-rw-r--r--third_party/aom/av1/encoder/ethread.c53
-rw-r--r--third_party/aom/av1/encoder/firstpass.c60
-rw-r--r--third_party/aom/av1/encoder/firstpass.h15
-rw-r--r--third_party/aom/av1/encoder/global_motion.c34
-rw-r--r--third_party/aom/av1/encoder/global_motion.h15
-rw-r--r--third_party/aom/av1/encoder/hybrid_fwd_txfm.c52
-rw-r--r--third_party/aom/av1/encoder/mathutils.h354
-rw-r--r--third_party/aom/av1/encoder/mbgraph.c16
-rw-r--r--third_party/aom/av1/encoder/mcomp.c1067
-rw-r--r--third_party/aom/av1/encoder/mcomp.h49
-rw-r--r--third_party/aom/av1/encoder/palette.c107
-rw-r--r--third_party/aom/av1/encoder/palette.h22
-rw-r--r--third_party/aom/av1/encoder/pickrst.c692
-rw-r--r--third_party/aom/av1/encoder/pvq_encoder.c52
-rw-r--r--third_party/aom/av1/encoder/ransac.c335
-rw-r--r--third_party/aom/av1/encoder/ratectrl.c120
-rw-r--r--third_party/aom/av1/encoder/ratectrl.h29
-rw-r--r--third_party/aom/av1/encoder/rd.c146
-rw-r--r--third_party/aom/av1/encoder/rd.h15
-rw-r--r--third_party/aom/av1/encoder/rdopt.c3785
-rw-r--r--third_party/aom/av1/encoder/rdopt.h16
-rw-r--r--third_party/aom/av1/encoder/speed_features.c23
-rw-r--r--third_party/aom/av1/encoder/speed_features.h62
-rw-r--r--third_party/aom/av1/encoder/subexp.c77
-rw-r--r--third_party/aom/av1/encoder/subexp.h7
-rw-r--r--third_party/aom/av1/encoder/temporal_filter.c13
-rw-r--r--third_party/aom/av1/encoder/tokenize.c123
-rw-r--r--third_party/aom/av1/encoder/tokenize.h18
-rw-r--r--third_party/aom/av1/encoder/variance_tree.c61
-rw-r--r--third_party/aom/av1/encoder/variance_tree.h96
-rw-r--r--third_party/aom/av1/encoder/x86/av1_quantize_sse2.c93
-rw-r--r--third_party/aom/av1/encoder/x86/corner_match_sse4.c91
-rw-r--r--third_party/aom/av1/encoder/x86/highbd_fwd_txfm_sse4.c302
-rw-r--r--third_party/aom/av1/encoder/x86/hybrid_fwd_txfm_avx2.c180
-rw-r--r--third_party/aom/build/cmake/aom_config_defaults.cmake39
-rw-r--r--third_party/aom/build/cmake/aom_configure.cmake87
-rw-r--r--third_party/aom/build/cmake/aom_optimization.cmake10
-rw-r--r--third_party/aom/build/cmake/compiler_flags.cmake5
-rw-r--r--third_party/aom/build/cmake/compiler_tests.cmake5
-rw-r--r--third_party/aom/build/cmake/dist.cmake51
-rw-r--r--third_party/aom/build/cmake/generate_aom_config_templates.cmake22
-rw-r--r--third_party/aom/build/cmake/msvc_runtime.cmake4
-rw-r--r--third_party/aom/build/cmake/rtcd_config.cmake137
-rw-r--r--third_party/aom/build/cmake/toolchains/armv7-ios.cmake4
-rw-r--r--third_party/aom/build/cmake/toolchains/armv7s-ios.cmake4
-rw-r--r--third_party/aom/build/make/Android.mk7
-rw-r--r--third_party/aom/build/make/configure.sh34
-rwxr-xr-xthird_party/aom/build/make/rtcd.pl6
-rwxr-xr-xthird_party/aom/build/make/version.sh5
-rwxr-xr-xthird_party/aom/configure69
-rw-r--r--third_party/aom/docs.cmake228
-rw-r--r--third_party/aom/examples.mk46
-rw-r--r--third_party/aom/examples/inspect.c83
-rw-r--r--third_party/aom/examples/set_maps.c6
-rw-r--r--third_party/aom/libs.doxy_template35
-rw-r--r--third_party/aom/libs.mk20
-rw-r--r--third_party/aom/test/altref_test.cc2
-rw-r--r--third_party/aom/test/aq_segment_test.cc4
-rw-r--r--third_party/aom/test/av1_convolve_optimz_test.cc2
-rw-r--r--third_party/aom/test/av1_convolve_test.cc2
-rw-r--r--third_party/aom/test/av1_fht32x32_test.cc (renamed from third_party/aom/test/fht32x32_test.cc)2
-rw-r--r--third_party/aom/test/av1_fht64x64_test.cc108
-rw-r--r--third_party/aom/test/av1_fwd_txfm1d_test.cc4
-rw-r--r--third_party/aom/test/av1_fwd_txfm2d_test.cc8
-rw-r--r--third_party/aom/test/av1_inv_txfm2d_test.cc2
-rw-r--r--third_party/aom/test/av1_quantize_test.cc22
-rw-r--r--third_party/aom/test/av1_txfm_test.h4
-rw-r--r--third_party/aom/test/avg_test.cc97
-rw-r--r--third_party/aom/test/binary_codes_test.cc9
-rw-r--r--third_party/aom/test/boolcoder_test.cc11
-rw-r--r--third_party/aom/test/borders_test.cc4
-rw-r--r--third_party/aom/test/convolve_test.cc13
-rw-r--r--third_party/aom/test/corner_match_test.cc100
-rw-r--r--third_party/aom/test/cpu_speed_test.cc4
-rw-r--r--third_party/aom/test/datarate_test.cc2
-rw-r--r--third_party/aom/test/decode_test_driver.cc2
-rw-r--r--third_party/aom/test/error_resilience_test.cc9
-rw-r--r--third_party/aom/test/frame_size_tests.cc22
-rw-r--r--third_party/aom/test/hiprec_convolve_test.cc42
-rw-r--r--third_party/aom/test/hiprec_convolve_test_util.cc188
-rw-r--r--third_party/aom/test/hiprec_convolve_test_util.h89
-rw-r--r--third_party/aom/test/intrapred_test.cc174
-rw-r--r--third_party/aom/test/masked_sad_test.cc63
-rw-r--r--third_party/aom/test/masked_variance_test.cc594
-rw-r--r--third_party/aom/test/motion_vector_test.cc17
-rw-r--r--third_party/aom/test/partial_idct_test.cc30
-rw-r--r--third_party/aom/test/quantize_func_test.cc236
-rw-r--r--third_party/aom/test/sad_test.cc7
-rw-r--r--third_party/aom/test/simd_avx2_test.cc15
-rw-r--r--third_party/aom/test/simd_cmp_avx2.cc15
-rw-r--r--third_party/aom/test/simd_cmp_impl.h522
-rw-r--r--third_party/aom/test/simd_impl.h330
-rw-r--r--third_party/aom/test/superframe_test.cc11
-rw-r--r--third_party/aom/test/test-data.mk30
-rw-r--r--third_party/aom/test/test.cmake137
-rw-r--r--third_party/aom/test/test.mk73
-rw-r--r--third_party/aom/test/test_data_download_worker.cmake40
-rw-r--r--third_party/aom/test/test_data_util.cmake21
-rw-r--r--third_party/aom/test/test_intra_pred_speed.cc142
-rw-r--r--third_party/aom/test/test_runner.cmake20
-rw-r--r--third_party/aom/test/test_worker.cmake49
-rw-r--r--third_party/aom/test/variance_test.cc22
-rw-r--r--third_party/aom/test/warp_filter_test.cc13
-rw-r--r--third_party/aom/test/warp_filter_test_util.cc54
-rw-r--r--third_party/aom/test/warp_filter_test_util.h20
-rwxr-xr-xthird_party/aom/tools/build_inspector.sh2
-rw-r--r--third_party/aom/tools_common.c16
-rw-r--r--third_party/aom/tools_common.h4
279 files changed, 36561 insertions, 30826 deletions
diff --git a/third_party/aom/CHANGELOG b/third_party/aom/CHANGELOG
index dad0ea1d2..7510dc660 100644
--- a/third_party/aom/CHANGELOG
+++ b/third_party/aom/CHANGELOG
@@ -1,6 +1,7 @@
Next Release
- Incompatible changes:
The AV1 encoder's default keyframe interval changed to 128 from 9999.
+ Support for armv6 was removed.
2016-04-07 v0.1.0 "AOMedia Codec 1"
This release is the first Alliance for Open Media codec.
diff --git a/third_party/aom/CMakeLists.txt b/third_party/aom/CMakeLists.txt
index 4ba2d40aa..3b27de58f 100644
--- a/third_party/aom/CMakeLists.txt
+++ b/third_party/aom/CMakeLists.txt
@@ -9,6 +9,18 @@
## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
##
cmake_minimum_required(VERSION 3.5)
+
+if (NOT EMSCRIPTEN)
+ if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
+ set(CMAKE_BUILD_TYPE "RelWithDebInfo")
+ endif ()
+endif ()
+
+option(ENABLE_CCACHE "Enable ccache support." OFF)
+option(ENABLE_DISTCC "Enable distcc support." OFF)
+option(ENABLE_DOCS "Enable documentation generation (doxygen required)." ON)
+option(ENABLE_NASM "Use nasm instead of yasm for x86 assembly." OFF)
+
project(AOM C CXX)
set(AOM_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
@@ -114,15 +126,15 @@ set(AOM_COMMON_APP_UTIL_SOURCES
"${AOM_ROOT}/md5_utils.h"
"${AOM_ROOT}/tools_common.c"
"${AOM_ROOT}/tools_common.h"
- "${AOM_ROOT}/video_common.h")
+ "${AOM_ROOT}/video_common.h"
+ "${AOM_ROOT}/y4menc.c"
+ "${AOM_ROOT}/y4menc.h")
set(AOM_DECODER_APP_UTIL_SOURCES
"${AOM_ROOT}/ivfdec.c"
"${AOM_ROOT}/ivfdec.h"
"${AOM_ROOT}/video_reader.c"
- "${AOM_ROOT}/video_reader.h"
- "${AOM_ROOT}/y4menc.c"
- "${AOM_ROOT}/y4menc.h")
+ "${AOM_ROOT}/video_reader.h")
set(AOM_ENCODER_APP_UTIL_SOURCES
"${AOM_ROOT}/ivfenc.c"
@@ -190,88 +202,117 @@ foreach (aom_lib ${AOM_LIB_TARGETS})
add_dependencies(${aom_lib} aom_rtcd)
endif ()
endforeach ()
+
#
# Application and application support targets.
#
add_library(aom_common_app_util OBJECT ${AOM_COMMON_APP_UTIL_SOURCES})
-add_library(aom_decoder_app_util OBJECT ${AOM_DECODER_APP_UTIL_SOURCES})
-add_library(aom_encoder_app_util OBJECT ${AOM_ENCODER_APP_UTIL_SOURCES})
-add_executable(aom_cx_set_ref
- "${AOM_ROOT}/examples/aom_cx_set_ref.c"
- $<TARGET_OBJECTS:aom_common_app_util>
- $<TARGET_OBJECTS:aom_encoder_app_util>)
-add_executable(aomdec
+if (CONFIG_AV1_DECODER)
+ add_library(aom_decoder_app_util OBJECT ${AOM_DECODER_APP_UTIL_SOURCES})
+ add_executable(aomdec
"${AOM_ROOT}/aomdec.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_decoder_app_util>)
-add_executable(aomenc
- "${AOM_ROOT}/aomenc.c"
- $<TARGET_OBJECTS:aom_common_app_util>
- $<TARGET_OBJECTS:aom_encoder_app_util>
- $<TARGET_OBJECTS:aom_encoder_stats>)
+ if (CONFIG_ANALYZER)
+ add_executable(analyzer
+ "${AOM_ROOT}/examples/analyzer.cc"
+ $<TARGET_OBJECTS:aom_common_app_util>
+ $<TARGET_OBJECTS:aom_decoder_app_util>)
+ target_link_libraries(analyzer ${AOM_LIB_LINK_TYPE} ${wxWidgets_LIBRARIES})
+ set(AOM_APP_TARGETS ${AOM_APP_TARGETS} analyzer)
+ endif ()
-if (CONFIG_ANALYZER)
- add_executable(analyzer
- "${AOM_ROOT}/examples/analyzer.cc"
+ add_executable(decode_to_md5
+ "${AOM_ROOT}/examples/decode_to_md5.c"
+ $<TARGET_OBJECTS:aom_common_app_util>
+ $<TARGET_OBJECTS:aom_decoder_app_util>)
+ add_executable(decode_with_drops
+ "${AOM_ROOT}/examples/decode_with_drops.c"
+ $<TARGET_OBJECTS:aom_common_app_util>
+ $<TARGET_OBJECTS:aom_decoder_app_util>)
+ add_executable(simple_decoder
+ "${AOM_ROOT}/examples/simple_decoder.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_decoder_app_util>)
- target_link_libraries(analyzer PUBLIC ${wxWidgets_LIBRARIES})
- set(AOM_APP_TARGETS ${AOM_APP_TARGETS} analyzer)
-endif ()
-
-add_executable(decode_to_md5
- "${AOM_ROOT}/examples/decode_to_md5.c"
- $<TARGET_OBJECTS:aom_common_app_util>
- $<TARGET_OBJECTS:aom_decoder_app_util>)
-add_executable(decode_with_drops
- "${AOM_ROOT}/examples/decode_with_drops.c"
- $<TARGET_OBJECTS:aom_common_app_util>
- $<TARGET_OBJECTS:aom_decoder_app_util>)
+ if (CONFIG_INSPECTION)
+ add_executable(inspect
+ "${AOM_ROOT}/examples/inspect.c"
+ $<TARGET_OBJECTS:aom_common_app_util>
+ $<TARGET_OBJECTS:aom_decoder_app_util>)
+ set(AOM_DECODER_EXAMPLE_TARGETS ${AOM_DECODER_EXAMPLE_TARGETS} inspect)
+
+ if (EMSCRIPTEN)
+ add_preproc_definition(_POSIX_SOURCE)
+ add_compiler_flag_if_supported("-s TOTAL_MEMORY=134217728")
+ add_compiler_flag_if_supported("-s MODULARIZE=1")
+ add_compiler_flag_if_supported("-s EXPORT_NAME=\"\'DecoderModule\'\"")
+ add_compiler_flag_if_supported("--memory-init-file 0")
+ if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
+ # Default to -O3 when no build type specified.
+ add_compiler_flag_if_supported("-O3")
+ endif ()
+ em_link_post_js(inspect "${AOM_ROOT}/tools/inspect-post.js")
+ endif ()
+ endif ()
-add_executable(lossless_encoder
- "${AOM_ROOT}/examples/lossless_encoder.c"
- $<TARGET_OBJECTS:aom_common_app_util>
- $<TARGET_OBJECTS:aom_encoder_app_util>)
+ # Maintain lists of example and app targets.
+ set(AOM_DECODER_EXAMPLE_TARGETS ${AOM_DECODER_EXAMPLE_TARGETS}
+ decode_to_md5 decode_with_drops simple_decoder)
+ set(AOM_APP_TARGETS ${AOM_APP_TARGETS} aomdec ${AOM_DECODER_EXAMPLE_TARGETS})
+endif ()
-add_executable(set_maps
- "${AOM_ROOT}/examples/set_maps.c"
- $<TARGET_OBJECTS:aom_common_app_util>
- $<TARGET_OBJECTS:aom_encoder_app_util>)
-add_executable(simple_decoder
- "${AOM_ROOT}/examples/simple_decoder.c"
- $<TARGET_OBJECTS:aom_common_app_util>
- $<TARGET_OBJECTS:aom_decoder_app_util>)
+if (CONFIG_AV1_ENCODER)
+ add_library(aom_encoder_app_util OBJECT ${AOM_ENCODER_APP_UTIL_SOURCES})
+ add_executable(aomenc
+ "${AOM_ROOT}/aomenc.c"
+ $<TARGET_OBJECTS:aom_common_app_util>
+ $<TARGET_OBJECTS:aom_encoder_app_util>
+ $<TARGET_OBJECTS:aom_encoder_stats>)
+ add_executable(lossless_encoder
+ "${AOM_ROOT}/examples/lossless_encoder.c"
+ $<TARGET_OBJECTS:aom_common_app_util>
+ $<TARGET_OBJECTS:aom_encoder_app_util>)
+ add_executable(set_maps
+ "${AOM_ROOT}/examples/set_maps.c"
+ $<TARGET_OBJECTS:aom_common_app_util>
+ $<TARGET_OBJECTS:aom_encoder_app_util>)
+ add_executable(simple_encoder
+ "${AOM_ROOT}/examples/simple_encoder.c"
+ $<TARGET_OBJECTS:aom_common_app_util>
+ $<TARGET_OBJECTS:aom_encoder_app_util>)
+ add_executable(twopass_encoder
+ "${AOM_ROOT}/examples/twopass_encoder.c"
+ $<TARGET_OBJECTS:aom_common_app_util>
+ $<TARGET_OBJECTS:aom_encoder_app_util>)
-if (CONFIG_INSPECTION)
-add_executable(inspect
- "${AOM_ROOT}/examples/inspect.c"
- $<TARGET_OBJECTS:aom_common_app_util>
- $<TARGET_OBJECTS:aom_decoder_app_util>)
-set(AOM_APP_TARGETS ${AOM_APP_TARGETS} inspect)
+ # Add encoder apps and examples to target lists.
+ set(AOM_ENCODER_EXAMPLE_TARGETS
+ lossless_encoder set_maps simple_encoder twopass_encoder)
+ set(AOM_APP_TARGETS ${AOM_APP_TARGETS} aomenc ${AOM_ENCODER_EXAMPLE_TARGETS})
endif ()
-add_executable(simple_encoder
- "${AOM_ROOT}/examples/simple_encoder.c"
- $<TARGET_OBJECTS:aom_common_app_util>
- $<TARGET_OBJECTS:aom_encoder_app_util>)
-
-add_executable(twopass_encoder
- "${AOM_ROOT}/examples/twopass_encoder.c"
- $<TARGET_OBJECTS:aom_common_app_util>
- $<TARGET_OBJECTS:aom_encoder_app_util>)
+# Maintain a separate variable listing only the examples to facilitate
+# installation of example programs into an examples sub directory of
+# $AOM_DIST_DIR/bin when building the dist target.
+set(AOM_EXAMPLE_TARGETS
+ ${AOM_DECODER_EXAMPLE_TARGETS} ${AOM_ENCODER_EXAMPLE_TARGETS})
-# List of app targets.
-set(AOM_APP_TARGETS ${AOM_APP_TARGETS} aom_cx_set_ref aomdec aomenc
- decode_to_md5 decode_with_drops lossless_encoder set_maps simple_decoder
- simple_encoder twopass_encoder)
+if (CONFIG_AV1_DECODER AND CONFIG_AV1_ENCODER)
+ add_executable(aom_cx_set_ref
+ "${AOM_ROOT}/examples/aom_cx_set_ref.c"
+ $<TARGET_OBJECTS:aom_common_app_util>
+ $<TARGET_OBJECTS:aom_encoder_app_util>)
+ set(AOM_EXAMPLE_TARGETS ${AOM_EXAMPLE_TARGETS} aom_cx_set_ref)
+ set(AOM_APP_TARGETS ${AOM_APP_TARGETS} aom_cx_set_ref)
+endif ()
foreach (aom_app ${AOM_APP_TARGETS})
- target_link_libraries(${aom_app} PUBLIC aom)
+ target_link_libraries(${aom_app} ${AOM_LIB_LINK_TYPE} aom)
endforeach ()
if (CONFIG_LIBYUV)
@@ -297,8 +338,13 @@ if (CONFIG_WEBM_IO)
endif ()
# Add to existing targets.
- target_sources(aom_decoder_app_util PUBLIC ${AOM_WEBM_DECODER_SOURCES})
- target_sources(aom_encoder_app_util PUBLIC ${AOM_WEBM_ENCODER_SOURCES})
+ if (CONFIG_AV1_DECODER)
+ target_sources(aom_decoder_app_util PUBLIC ${AOM_WEBM_DECODER_SOURCES})
+ endif ()
+
+ if (CONFIG_AV1_ENCODER)
+ target_sources(aom_encoder_app_util PUBLIC ${AOM_WEBM_ENCODER_SOURCES})
+ endif ()
foreach (aom_app ${AOM_APP_TARGETS})
target_sources(${aom_app} PUBLIC $<TARGET_OBJECTS:webm>)
@@ -314,7 +360,7 @@ endif ()
if (HAVE_PTHREAD_H AND CONFIG_MULTITHREAD)
find_package(Threads)
foreach (app_target ${AOM_APP_TARGETS})
- target_link_libraries(${app_target} PUBLIC Threads::Threads)
+ target_link_libraries(${app_target} ${AOM_LIB_LINK_TYPE} Threads::Threads)
endforeach ()
endif ()
@@ -337,23 +383,90 @@ if (XCODE)
endif ()
endif ()
+if ("${CMAKE_GENERATOR}" MATCHES "Makefiles$" )
+ # Users of the configure build expect the example targets to be built in the
+ # examples sub directory of the configured build directory after running make.
+ file(MAKE_DIRECTORY "${AOM_CONFIG_DIR}/examples")
+ set_target_properties(${AOM_EXAMPLE_TARGETS} PROPERTIES
+ RUNTIME_OUTPUT_DIRECTORY "${AOM_CONFIG_DIR}/examples")
+endif ()
+
+# Aomedia documentation rule.
+if (ENABLE_DOCS)
+ include(FindDoxygen)
+ if (DOXYGEN_FOUND)
+ include("${AOM_ROOT}/docs.cmake")
+ setup_documentation_targets()
+ else ()
+ message("--- Cannot find doxygen, ENABLE_DOCS turned off.")
+ set(ENABLE_DOCS OFF)
+ endif ()
+endif ()
+
# Aomedia install rule.
-# TODO(tomfinegan): Add the missing pkg-config related bits.
set(AOM_INSTALL_INCS
"${AOM_ROOT}/aom/aom.h"
- "${AOM_ROOT}/aom/aomcx.h"
- "${AOM_ROOT}/aom/aomdx.h"
"${AOM_ROOT}/aom/aom_codec.h"
"${AOM_ROOT}/aom/aom_frame_buffer.h"
"${AOM_ROOT}/aom/aom_image.h"
"${AOM_ROOT}/aom/aom_integer.h"
- "${AOM_ROOT}/aom/aom_decoder.h"
- "${AOM_ROOT}/aom/aom_encoder.h"
"${AOM_ROOT}/aom/aom.h")
-set(AOM_INSTALL_BINS aomdec aomenc)
+
+if (CONFIG_AV1_DECODER)
+ set(AOM_INSTALL_BINS ${AOM_INSTALL_BINS} aomdec)
+ set(AOM_INSTALL_INCS
+ ${AOM_INSTALL_INCS}
+ "${AOM_ROOT}/aom/aom_decoder.h"
+ "${AOM_ROOT}/aom/aomdx.h")
+endif ()
+
+if (CONFIG_AV1_ENCODER)
+ set(AOM_INSTALL_INCS
+ ${AOM_INSTALL_INCS}
+ "${AOM_ROOT}/aom/aomcx.h"
+ "${AOM_ROOT}/aom/aom_encoder.h")
+ set(AOM_INSTALL_BINS ${AOM_INSTALL_BINS} aomenc)
+endif ()
+
set(AOM_INSTALL_LIBS aom)
install(FILES ${AOM_INSTALL_INCS}
DESTINATION "${CMAKE_INSTALL_PREFIX}/include/aom")
+install(FILES "${AOM_CONFIG_DIR}/aom.pc"
+ DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
install(TARGETS ${AOM_INSTALL_LIBS} DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
install(TARGETS ${AOM_INSTALL_BINS} DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
+
+# Aomedia dist rule.
+if (CONFIG_AV1_DECODER)
+ set(AOM_DIST_APPS ${AOM_DIST_APPS} $<TARGET_FILE:aomdec>)
+endif ()
+if (CONFIG_AV1_ENCODER)
+ set(AOM_DIST_APPS ${AOM_DIST_APPS} $<TARGET_FILE:aomenc>)
+endif ()
+
+foreach (example ${AOM_EXAMPLE_TARGETS})
+ list(APPEND AOM_DIST_EXAMPLES $<TARGET_FILE:${example}>)
+endforeach ()
+
+if (NOT AOM_DIST_DIR)
+ set(AOM_DIST_DIR "${AOM_CONFIG_DIR}/dist")
+endif ()
+
+add_custom_target(dist
+ COMMAND ${CMAKE_COMMAND}
+ -DAOM_ROOT=${AOM_ROOT}
+ -DAOM_CONFIG_DIR=${AOM_CONFIG_DIR}
+ -DAOM_DIST_DIR=${AOM_DIST_DIR}
+ -DAOM_DIST_APPS="${AOM_DIST_APPS}"
+ -DAOM_DIST_EXAMPLES="${AOM_DIST_EXAMPLES}"
+ -DAOM_DIST_INCLUDES="${AOM_INSTALL_INCS}"
+ -DAOM_DIST_LIBS=$<TARGET_FILE:aom>
+ -DENABLE_DOCS=${ENABLE_DOCS}
+ -P "${AOM_ROOT}/build/cmake/dist.cmake"
+ DEPENDS ${AOM_INSTALL_BINS} ${AOM_INSTALL_LIBS}
+ ${AOM_INSTALL_INCS} ${AOM_EXAMPLE_TARGETS})
+
+if (ENABLE_DOCS)
+ add_dependencies(dist docs)
+endif ()
diff --git a/third_party/aom/README b/third_party/aom/README
index 9aa30daa1..82d3b36cc 100644
--- a/third_party/aom/README
+++ b/third_party/aom/README
@@ -47,9 +47,6 @@ COMPILING THE APPLICATIONS/LIBRARIES:
--help output of the configure script. As of this writing, the list of
available targets is:
- armv6-linux-rvct
- armv6-linux-gcc
- armv6-none-rvct
arm64-darwin-gcc
armv7-android-gcc
armv7-darwin-gcc
diff --git a/third_party/aom/aom/aom_decoder.h b/third_party/aom/aom/aom_decoder.h
index e6f05048a..c90cbb113 100644
--- a/third_party/aom/aom/aom_decoder.h
+++ b/third_party/aom/aom/aom_decoder.h
@@ -84,11 +84,9 @@ extern "C" {
/*!\brief Stream properties
*
* This structure is used to query or set properties of the decoded
- * stream. Algorithms may extend this structure with data specific
- * to their bitstream by setting the sz member appropriately.
+ * stream.
*/
typedef struct aom_codec_stream_info {
- unsigned int sz; /**< Size of this structure */
unsigned int w; /**< Width (or 0 for unknown/default) */
unsigned int h; /**< Height (or 0 for unknown/default) */
unsigned int is_kf; /**< Current frame is a keyframe */
@@ -154,13 +152,15 @@ aom_codec_err_t aom_codec_dec_init_ver(aom_codec_ctx_t *ctx,
* \param[in] iface Pointer to the algorithm interface
* \param[in] data Pointer to a block of data to parse
* \param[in] data_sz Size of the data buffer
- * \param[in,out] si Pointer to stream info to update. The size member
- * \ref MUST be properly initialized, but \ref MAY be
- * clobbered by the algorithm. This parameter \ref MAY
- * be NULL.
+ * \param[in,out] si Pointer to stream info to update.
*
* \retval #AOM_CODEC_OK
- * Bitstream is parsable and stream information updated
+ * Bitstream is parsable and stream information updated.
+ * \retval #AOM_CODEC_INVALID_PARAM
+ * One of the arguments is invalid, for example a NULL pointer.
+ * \retval #AOM_CODEC_UNSUP_BITSTREAM
+ * The decoder didn't recognize the coded data, or the
+ * buffer was too short.
*/
aom_codec_err_t aom_codec_peek_stream_info(aom_codec_iface_t *iface,
const uint8_t *data,
@@ -172,13 +172,14 @@ aom_codec_err_t aom_codec_peek_stream_info(aom_codec_iface_t *iface,
* Returns information about the stream that has been parsed during decoding.
*
* \param[in] ctx Pointer to this instance's context
- * \param[in,out] si Pointer to stream info to update. The size member
- * \ref MUST be properly initialized, but \ref MAY be
- * clobbered by the algorithm. This parameter \ref MAY
- * be NULL.
+ * \param[in,out] si Pointer to stream info to update.
*
* \retval #AOM_CODEC_OK
- * Bitstream is parsable and stream information updated
+ * Bitstream is parsable and stream information updated.
+ * \retval #AOM_CODEC_INVALID_PARAM
+ * One of the arguments is invalid, for example a NULL pointer.
+ * \retval #AOM_CODEC_UNSUP_BITSTREAM
+ * The decoder couldn't parse the submitted data.
*/
aom_codec_err_t aom_codec_get_stream_info(aom_codec_ctx_t *ctx,
aom_codec_stream_info_t *si);
diff --git a/third_party/aom/aom/aomdx.h b/third_party/aom/aom/aomdx.h
index 99f50c17e..4ca1c7285 100644
--- a/third_party/aom/aom/aomdx.h
+++ b/third_party/aom/aom/aomdx.h
@@ -37,13 +37,17 @@ extern aom_codec_iface_t aom_codec_av1_dx_algo;
extern aom_codec_iface_t *aom_codec_av1_dx(void);
/*!@} - end algorithm interface member group*/
+#ifndef AOM_ACCOUNTING_H_
/** Data structure that stores bit accounting for debug
*/
typedef struct Accounting Accounting;
+#endif
+#ifndef AOM_INSPECTION_H_
/** Callback that inspects decoder frame data.
*/
typedef void (*aom_inspect_cb)(void *decoder, void *ctx);
+#endif
/*!\brief Structure to hold inspection callback and context.
*
diff --git a/third_party/aom/aom/internal/aom_codec_internal.h b/third_party/aom/aom/internal/aom_codec_internal.h
index 7f9df7a72..5aacef7ad 100644
--- a/third_party/aom/aom/internal/aom_codec_internal.h
+++ b/third_party/aom/aom/internal/aom_codec_internal.h
@@ -43,7 +43,6 @@
*/
#ifndef AOM_INTERNAL_AOM_CODEC_INTERNAL_H_
#define AOM_INTERNAL_AOM_CODEC_INTERNAL_H_
-#include "./aom_config.h"
#include "../aom_decoder.h"
#include "../aom_encoder.h"
#include <stdarg.h>
@@ -441,25 +440,6 @@ void aom_internal_error(struct aom_internal_error_info *info,
...) CLANG_ANALYZER_NORETURN;
void aom_merge_corrupted_flag(int *corrupted, int value);
-
-#if CONFIG_DEBUG
-#define AOM_CHECK_MEM_ERROR(error_info, lval, expr) \
- do { \
- lval = (expr); \
- if (!lval) \
- aom_internal_error(error_info, AOM_CODEC_MEM_ERROR, \
- "Failed to allocate " #lval " at %s:%d", __FILE__, \
- __LINE__); \
- } while (0)
-#else
-#define AOM_CHECK_MEM_ERROR(error_info, lval, expr) \
- do { \
- lval = (expr); \
- if (!lval) \
- aom_internal_error(error_info, AOM_CODEC_MEM_ERROR, \
- "Failed to allocate " #lval); \
- } while (0)
-#endif
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/third_party/aom/aom/src/aom_decoder.c b/third_party/aom/aom/src/aom_decoder.c
index c6cec6d79..57a9a25d2 100644
--- a/third_party/aom/aom/src/aom_decoder.c
+++ b/third_party/aom/aom/src/aom_decoder.c
@@ -69,10 +69,9 @@ aom_codec_err_t aom_codec_peek_stream_info(aom_codec_iface_t *iface,
aom_codec_stream_info_t *si) {
aom_codec_err_t res;
- if (!iface || !data || !data_sz || !si ||
- si->sz < sizeof(aom_codec_stream_info_t))
+ if (!iface || !data || !data_sz || !si) {
res = AOM_CODEC_INVALID_PARAM;
- else {
+ } else {
/* Set default/unknown values */
si->w = 0;
si->h = 0;
@@ -87,11 +86,11 @@ aom_codec_err_t aom_codec_get_stream_info(aom_codec_ctx_t *ctx,
aom_codec_stream_info_t *si) {
aom_codec_err_t res;
- if (!ctx || !si || si->sz < sizeof(aom_codec_stream_info_t))
+ if (!ctx || !si) {
res = AOM_CODEC_INVALID_PARAM;
- else if (!ctx->iface || !ctx->priv)
+ } else if (!ctx->iface || !ctx->priv) {
res = AOM_CODEC_ERROR;
- else {
+ } else {
/* Set default/unknown values */
si->w = 0;
si->h = 0;
diff --git a/third_party/aom/aom_dsp/aom_convolve.c b/third_party/aom/aom_dsp/aom_convolve.c
index 74f4c00fb..4dac6aacc 100644
--- a/third_party/aom/aom_dsp/aom_convolve.c
+++ b/third_party/aom/aom_dsp/aom_convolve.c
@@ -337,14 +337,14 @@ static void convolve_add_src_horiz(const uint8_t *src, ptrdiff_t src_stride,
uint8_t *dst, ptrdiff_t dst_stride,
const InterpKernel *x_filters, int x0_q4,
int x_step_q4, int w, int h) {
- int x, y;
+ int x, y, k;
src -= SUBPEL_TAPS / 2 - 1;
for (y = 0; y < h; ++y) {
int x_q4 = x0_q4;
for (x = 0; x < w; ++x) {
const uint8_t *const src_x = &src[x_q4 >> SUBPEL_BITS];
const int16_t *const x_filter = x_filters[x_q4 & SUBPEL_MASK];
- int k, sum = 0;
+ int sum = 0;
for (k = 0; k < SUBPEL_TAPS; ++k) sum += src_x[k] * x_filter[k];
dst[x] = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS) +
src_x[SUBPEL_TAPS / 2 - 1]);
@@ -359,7 +359,7 @@ static void convolve_add_src_vert(const uint8_t *src, ptrdiff_t src_stride,
uint8_t *dst, ptrdiff_t dst_stride,
const InterpKernel *y_filters, int y0_q4,
int y_step_q4, int w, int h) {
- int x, y;
+ int x, y, k;
src -= src_stride * (SUBPEL_TAPS / 2 - 1);
for (x = 0; x < w; ++x) {
@@ -367,7 +367,7 @@ static void convolve_add_src_vert(const uint8_t *src, ptrdiff_t src_stride,
for (y = 0; y < h; ++y) {
const unsigned char *src_y = &src[(y_q4 >> SUBPEL_BITS) * src_stride];
const int16_t *const y_filter = y_filters[y_q4 & SUBPEL_MASK];
- int k, sum = 0;
+ int sum = 0;
for (k = 0; k < SUBPEL_TAPS; ++k)
sum += src_y[k * src_stride] * y_filter[k];
dst[y * dst_stride] =
@@ -446,6 +446,127 @@ void aom_convolve8_add_src_c(const uint8_t *src, ptrdiff_t src_stride,
convolve_add_src(src, src_stride, dst, dst_stride, filters_x, x0_q4,
x_step_q4, filters_y, y0_q4, y_step_q4, w, h);
}
+
+static void convolve_add_src_horiz_hip(const uint8_t *src, ptrdiff_t src_stride,
+ uint16_t *dst, ptrdiff_t dst_stride,
+ const InterpKernel *x_filters, int x0_q4,
+ int x_step_q4, int w, int h) {
+ const int bd = 8;
+ int x, y, k;
+ src -= SUBPEL_TAPS / 2 - 1;
+ for (y = 0; y < h; ++y) {
+ int x_q4 = x0_q4;
+ for (x = 0; x < w; ++x) {
+ const uint8_t *const src_x = &src[x_q4 >> SUBPEL_BITS];
+ const int16_t *const x_filter = x_filters[x_q4 & SUBPEL_MASK];
+ int sum = ((int)src_x[SUBPEL_TAPS / 2 - 1] << FILTER_BITS) +
+ (1 << (bd + FILTER_BITS - 1));
+ for (k = 0; k < SUBPEL_TAPS; ++k) sum += src_x[k] * x_filter[k];
+ dst[x] =
+ (uint16_t)clamp(ROUND_POWER_OF_TWO(sum, FILTER_BITS - EXTRAPREC_BITS),
+ 0, EXTRAPREC_CLAMP_LIMIT(bd) - 1);
+ x_q4 += x_step_q4;
+ }
+ src += src_stride;
+ dst += dst_stride;
+ }
+}
+
+static void convolve_add_src_vert_hip(const uint16_t *src, ptrdiff_t src_stride,
+ uint8_t *dst, ptrdiff_t dst_stride,
+ const InterpKernel *y_filters, int y0_q4,
+ int y_step_q4, int w, int h) {
+ const int bd = 8;
+ int x, y, k;
+ src -= src_stride * (SUBPEL_TAPS / 2 - 1);
+
+ for (x = 0; x < w; ++x) {
+ int y_q4 = y0_q4;
+ for (y = 0; y < h; ++y) {
+ const uint16_t *src_y = &src[(y_q4 >> SUBPEL_BITS) * src_stride];
+ const int16_t *const y_filter = y_filters[y_q4 & SUBPEL_MASK];
+ int sum =
+ ((int)src_y[(SUBPEL_TAPS / 2 - 1) * src_stride] << FILTER_BITS) -
+ (1 << (bd + FILTER_BITS + EXTRAPREC_BITS - 1));
+ for (k = 0; k < SUBPEL_TAPS; ++k)
+ sum += src_y[k * src_stride] * y_filter[k];
+ dst[y * dst_stride] =
+ clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS + EXTRAPREC_BITS));
+ y_q4 += y_step_q4;
+ }
+ ++src;
+ ++dst;
+ }
+}
+
+static void convolve_add_src_hip(const uint8_t *src, ptrdiff_t src_stride,
+ uint8_t *dst, ptrdiff_t dst_stride,
+ const InterpKernel *const x_filters, int x0_q4,
+ int x_step_q4,
+ const InterpKernel *const y_filters, int y0_q4,
+ int y_step_q4, int w, int h) {
+ uint16_t temp[MAX_EXT_SIZE * MAX_SB_SIZE];
+ int intermediate_height =
+ (((h - 1) * y_step_q4 + y0_q4) >> SUBPEL_BITS) + SUBPEL_TAPS;
+
+ assert(w <= MAX_SB_SIZE);
+ assert(h <= MAX_SB_SIZE);
+
+ assert(y_step_q4 <= 32);
+ assert(x_step_q4 <= 32);
+
+ convolve_add_src_horiz_hip(src - src_stride * (SUBPEL_TAPS / 2 - 1),
+ src_stride, temp, MAX_SB_SIZE, x_filters, x0_q4,
+ x_step_q4, w, intermediate_height);
+ convolve_add_src_vert_hip(temp + MAX_SB_SIZE * (SUBPEL_TAPS / 2 - 1),
+ MAX_SB_SIZE, dst, dst_stride, y_filters, y0_q4,
+ y_step_q4, w, h);
+}
+
+void aom_convolve8_add_src_horiz_hip_c(const uint8_t *src, ptrdiff_t src_stride,
+ uint16_t *dst, ptrdiff_t dst_stride,
+ const int16_t *filter_x, int x_step_q4,
+ const int16_t *filter_y, int y_step_q4,
+ int w, int h) {
+ const InterpKernel *const filters_x = get_filter_base(filter_x);
+ const int x0_q4 = get_filter_offset(filter_x, filters_x);
+
+ (void)filter_y;
+ (void)y_step_q4;
+
+ convolve_add_src_horiz_hip(src, src_stride, dst, dst_stride, filters_x, x0_q4,
+ x_step_q4, w, h);
+}
+
+void aom_convolve8_add_src_vert_hip_c(const uint16_t *src, ptrdiff_t src_stride,
+ uint8_t *dst, ptrdiff_t dst_stride,
+ const int16_t *filter_x, int x_step_q4,
+ const int16_t *filter_y, int y_step_q4,
+ int w, int h) {
+ const InterpKernel *const filters_y = get_filter_base(filter_y);
+ const int y0_q4 = get_filter_offset(filter_y, filters_y);
+
+ (void)filter_x;
+ (void)x_step_q4;
+
+ convolve_add_src_vert_hip(src, src_stride, dst, dst_stride, filters_y, y0_q4,
+ y_step_q4, w, h);
+}
+
+void aom_convolve8_add_src_hip_c(const uint8_t *src, ptrdiff_t src_stride,
+ uint8_t *dst, ptrdiff_t dst_stride,
+ const int16_t *filter_x, int x_step_q4,
+ const int16_t *filter_y, int y_step_q4, int w,
+ int h) {
+ const InterpKernel *const filters_x = get_filter_base(filter_x);
+ const int x0_q4 = get_filter_offset(filter_x, filters_x);
+
+ const InterpKernel *const filters_y = get_filter_base(filter_y);
+ const int y0_q4 = get_filter_offset(filter_y, filters_y);
+
+ convolve_add_src_hip(src, src_stride, dst, dst_stride, filters_x, x0_q4,
+ x_step_q4, filters_y, y0_q4, y_step_q4, w, h);
+}
#endif // CONFIG_LOOP_RESTORATION
#if CONFIG_HIGHBITDEPTH
@@ -721,7 +842,7 @@ static void highbd_convolve_add_src_horiz(const uint8_t *src8,
const InterpKernel *x_filters,
int x0_q4, int x_step_q4, int w,
int h, int bd) {
- int x, y;
+ int x, y, k;
uint16_t *src = CONVERT_TO_SHORTPTR(src8);
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
src -= SUBPEL_TAPS / 2 - 1;
@@ -730,7 +851,7 @@ static void highbd_convolve_add_src_horiz(const uint8_t *src8,
for (x = 0; x < w; ++x) {
const uint16_t *const src_x = &src[x_q4 >> SUBPEL_BITS];
const int16_t *const x_filter = x_filters[x_q4 & SUBPEL_MASK];
- int k, sum = 0;
+ int sum = 0;
for (k = 0; k < SUBPEL_TAPS; ++k) sum += src_x[k] * x_filter[k];
dst[x] = clip_pixel_highbd(
ROUND_POWER_OF_TWO(sum, FILTER_BITS) + src_x[SUBPEL_TAPS / 2 - 1],
@@ -748,7 +869,7 @@ static void highbd_convolve_add_src_vert(const uint8_t *src8,
const InterpKernel *y_filters,
int y0_q4, int y_step_q4, int w, int h,
int bd) {
- int x, y;
+ int x, y, k;
uint16_t *src = CONVERT_TO_SHORTPTR(src8);
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
src -= src_stride * (SUBPEL_TAPS / 2 - 1);
@@ -757,7 +878,7 @@ static void highbd_convolve_add_src_vert(const uint8_t *src8,
for (y = 0; y < h; ++y) {
const uint16_t *src_y = &src[(y_q4 >> SUBPEL_BITS) * src_stride];
const int16_t *const y_filter = y_filters[y_q4 & SUBPEL_MASK];
- int k, sum = 0;
+ int sum = 0;
for (k = 0; k < SUBPEL_TAPS; ++k)
sum += src_y[k * src_stride] * y_filter[k];
dst[y * dst_stride] =
@@ -850,5 +971,135 @@ void aom_highbd_convolve8_add_src_c(const uint8_t *src, ptrdiff_t src_stride,
highbd_convolve_add_src(src, src_stride, dst, dst_stride, filters_x, x0_q4,
x_step_q4, filters_y, y0_q4, y_step_q4, w, h, bd);
}
+
+static void highbd_convolve_add_src_horiz_hip(
+ const uint8_t *src8, ptrdiff_t src_stride, uint16_t *dst,
+ ptrdiff_t dst_stride, const InterpKernel *x_filters, int x0_q4,
+ int x_step_q4, int w, int h, int bd) {
+ const int extraprec_clamp_limit = EXTRAPREC_CLAMP_LIMIT(bd);
+ int x, y, k;
+ uint16_t *src = CONVERT_TO_SHORTPTR(src8);
+ src -= SUBPEL_TAPS / 2 - 1;
+ for (y = 0; y < h; ++y) {
+ int x_q4 = x0_q4;
+ for (x = 0; x < w; ++x) {
+ const uint16_t *const src_x = &src[x_q4 >> SUBPEL_BITS];
+ const int16_t *const x_filter = x_filters[x_q4 & SUBPEL_MASK];
+ int sum = ((int)src_x[SUBPEL_TAPS / 2 - 1] << FILTER_BITS) +
+ (1 << (bd + FILTER_BITS - 1));
+ for (k = 0; k < SUBPEL_TAPS; ++k) sum += src_x[k] * x_filter[k];
+ dst[x] =
+ (uint16_t)clamp(ROUND_POWER_OF_TWO(sum, FILTER_BITS - EXTRAPREC_BITS),
+ 0, extraprec_clamp_limit - 1);
+ x_q4 += x_step_q4;
+ }
+ src += src_stride;
+ dst += dst_stride;
+ }
+}
+
+static void highbd_convolve_add_src_vert_hip(
+ const uint16_t *src, ptrdiff_t src_stride, uint8_t *dst8,
+ ptrdiff_t dst_stride, const InterpKernel *y_filters, int y0_q4,
+ int y_step_q4, int w, int h, int bd) {
+ int x, y, k;
+ uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
+ src -= src_stride * (SUBPEL_TAPS / 2 - 1);
+ for (x = 0; x < w; ++x) {
+ int y_q4 = y0_q4;
+ for (y = 0; y < h; ++y) {
+ const uint16_t *src_y = &src[(y_q4 >> SUBPEL_BITS) * src_stride];
+ const int16_t *const y_filter = y_filters[y_q4 & SUBPEL_MASK];
+ int sum =
+ ((int)src_y[(SUBPEL_TAPS / 2 - 1) * src_stride] << FILTER_BITS) -
+ (1 << (bd + FILTER_BITS + EXTRAPREC_BITS - 1));
+ for (k = 0; k < SUBPEL_TAPS; ++k)
+ sum += src_y[k * src_stride] * y_filter[k];
+ dst[y * dst_stride] = clip_pixel_highbd(
+ ROUND_POWER_OF_TWO(sum, FILTER_BITS + EXTRAPREC_BITS), bd);
+ y_q4 += y_step_q4;
+ }
+ ++src;
+ ++dst;
+ }
+}
+
+static void highbd_convolve_add_src_hip(
+ const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
+ ptrdiff_t dst_stride, const InterpKernel *const x_filters, int x0_q4,
+ int x_step_q4, const InterpKernel *const y_filters, int y0_q4,
+ int y_step_q4, int w, int h, int bd) {
+ // Note: Fixed size intermediate buffer, temp, places limits on parameters.
+ // 2d filtering proceeds in 2 steps:
+ // (1) Interpolate horizontally into an intermediate buffer, temp.
+ // (2) Interpolate temp vertically to derive the sub-pixel result.
+ // Deriving the maximum number of rows in the temp buffer (135):
+ // --Smallest scaling factor is x1/2 ==> y_step_q4 = 32 (Normative).
+ // --Largest block size is 64x64 pixels.
+ // --64 rows in the downscaled frame span a distance of (64 - 1) * 32 in the
+ // original frame (in 1/16th pixel units).
+ // --Must round-up because block may be located at sub-pixel position.
+ // --Require an additional SUBPEL_TAPS rows for the 8-tap filter tails.
+ // --((64 - 1) * 32 + 15) >> 4 + 8 = 135.
+ uint16_t temp[MAX_EXT_SIZE * MAX_SB_SIZE];
+ int intermediate_height =
+ (((h - 1) * y_step_q4 + y0_q4) >> SUBPEL_BITS) + SUBPEL_TAPS;
+
+ assert(w <= MAX_SB_SIZE);
+ assert(h <= MAX_SB_SIZE);
+ assert(y_step_q4 <= 32);
+ assert(x_step_q4 <= 32);
+
+ highbd_convolve_add_src_horiz_hip(
+ src - src_stride * (SUBPEL_TAPS / 2 - 1), src_stride, temp, MAX_SB_SIZE,
+ x_filters, x0_q4, x_step_q4, w, intermediate_height, bd);
+ highbd_convolve_add_src_vert_hip(temp + MAX_SB_SIZE * (SUBPEL_TAPS / 2 - 1),
+ MAX_SB_SIZE, dst, dst_stride, y_filters,
+ y0_q4, y_step_q4, w, h, bd);
+}
+
+void aom_highbd_convolve8_add_src_horiz_hip_c(
+ const uint8_t *src, ptrdiff_t src_stride, uint16_t *dst,
+ ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4,
+ const int16_t *filter_y, int y_step_q4, int w, int h, int bd) {
+ const InterpKernel *const filters_x = get_filter_base(filter_x);
+ const int x0_q4 = get_filter_offset(filter_x, filters_x);
+ (void)filter_y;
+ (void)y_step_q4;
+
+ highbd_convolve_add_src_horiz_hip(src, src_stride, dst, dst_stride, filters_x,
+ x0_q4, x_step_q4, w, h, bd);
+}
+
+void aom_highbd_convolve8_add_src_vert_hip_c(
+ const uint16_t *src, ptrdiff_t src_stride, uint8_t *dst,
+ ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4,
+ const int16_t *filter_y, int y_step_q4, int w, int h, int bd) {
+ const InterpKernel *const filters_y = get_filter_base(filter_y);
+ const int y0_q4 = get_filter_offset(filter_y, filters_y);
+ (void)filter_x;
+ (void)x_step_q4;
+
+ highbd_convolve_add_src_vert_hip(src, src_stride, dst, dst_stride, filters_y,
+ y0_q4, y_step_q4, w, h, bd);
+}
+
+void aom_highbd_convolve8_add_src_hip_c(const uint8_t *src,
+ ptrdiff_t src_stride, uint8_t *dst,
+ ptrdiff_t dst_stride,
+ const int16_t *filter_x, int x_step_q4,
+ const int16_t *filter_y, int y_step_q4,
+ int w, int h, int bd) {
+ const InterpKernel *const filters_x = get_filter_base(filter_x);
+ const int x0_q4 = get_filter_offset(filter_x, filters_x);
+
+ const InterpKernel *const filters_y = get_filter_base(filter_y);
+ const int y0_q4 = get_filter_offset(filter_y, filters_y);
+
+ highbd_convolve_add_src_hip(src, src_stride, dst, dst_stride, filters_x,
+ x0_q4, x_step_q4, filters_y, y0_q4, y_step_q4, w,
+ h, bd);
+}
+
#endif // CONFIG_LOOP_RESTORATION
#endif // CONFIG_HIGHBITDEPTH
diff --git a/third_party/aom/aom_dsp/aom_convolve.h b/third_party/aom/aom_dsp/aom_convolve.h
index d0de6c5d2..c7943dced 100644
--- a/third_party/aom/aom_dsp/aom_convolve.h
+++ b/third_party/aom/aom_dsp/aom_convolve.h
@@ -36,6 +36,11 @@ extern "C" {
#define MAX_EXT_SIZE 135
#endif // CONFIG_AV1 && CONFIG_EXT_PARTITION
+#if CONFIG_AV1 && CONFIG_LOOP_RESTORATION
+#define EXTRAPREC_BITS 2
+#define EXTRAPREC_CLAMP_LIMIT(bd) (1 << ((bd) + 1 + EXTRAPREC_BITS))
+#endif
+
typedef void (*convolve_fn_t)(const uint8_t *src, ptrdiff_t src_stride,
uint8_t *dst, ptrdiff_t dst_stride,
const int16_t *filter_x, int x_step_q4,
diff --git a/third_party/aom/aom_dsp/aom_dsp.cmake b/third_party/aom/aom_dsp/aom_dsp.cmake
index f00348cbc..5a49ae817 100644
--- a/third_party/aom/aom_dsp/aom_dsp.cmake
+++ b/third_party/aom/aom_dsp/aom_dsp.cmake
@@ -8,6 +8,9 @@
## Media Patent License 1.0 was not distributed with this source code in the
## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
##
+if (NOT AOM_AOM_DSP_AOM_DSP_CMAKE_)
+set(AOM_AOM_DSP_AOM_DSP_CMAKE_ 1)
+
set(AOM_DSP_COMMON_SOURCES
"${AOM_ROOT}/aom_dsp/aom_convolve.c"
"${AOM_ROOT}/aom_dsp/aom_convolve.h"
@@ -23,7 +26,6 @@ set(AOM_DSP_COMMON_SOURCES
"${AOM_ROOT}/aom_dsp/loopfilter.c"
"${AOM_ROOT}/aom_dsp/prob.c"
"${AOM_ROOT}/aom_dsp/prob.h"
- "${AOM_ROOT}/aom_dsp/sad.c"
"${AOM_ROOT}/aom_dsp/simd/v128_intrinsics.h"
"${AOM_ROOT}/aom_dsp/simd/v128_intrinsics_c.h"
"${AOM_ROOT}/aom_dsp/simd/v256_intrinsics.h"
@@ -62,8 +64,10 @@ set(AOM_DSP_COMMON_INTRIN_SSE4_1
set(AOM_DSP_COMMON_INTRIN_AVX2
"${AOM_ROOT}/aom_dsp/x86/aom_subpixel_8t_intrin_avx2.c"
- "${AOM_ROOT}/aom_dsp/x86/fwd_txfm_avx2.c"
- "${AOM_ROOT}/aom_dsp/x86/loopfilter_avx2.c")
+ "${AOM_ROOT}/aom_dsp/x86/loopfilter_avx2.c"
+ "${AOM_ROOT}/aom_dsp/x86/inv_txfm_avx2.c"
+ "${AOM_ROOT}/aom_dsp/x86/inv_txfm_common_avx2.h"
+ "${AOM_ROOT}/aom_dsp/x86/txfm_common_avx2.h")
set(AOM_DSP_COMMON_ASM_NEON
"${AOM_ROOT}/aom_dsp/arm/aom_convolve8_avg_neon_asm.asm"
@@ -175,6 +179,8 @@ set(AOM_DSP_COMMON_INTRIN_MSA
if (CONFIG_HIGHBITDEPTH)
set(AOM_DSP_COMMON_ASM_SSE2
${AOM_DSP_COMMON_ASM_SSE2}
+ "${AOM_ROOT}/aom_dsp/x86/aom_high_subpixel_8t_sse2.asm"
+ "${AOM_ROOT}/aom_dsp/x86/aom_high_subpixel_bilinear_sse2.asm"
"${AOM_ROOT}/aom_dsp/x86/highbd_intrapred_sse2.asm")
set(AOM_DSP_COMMON_INTRIN_SSE2
@@ -198,7 +204,7 @@ if (CONFIG_ANS)
set(AOM_DSP_COMMON_SOURCES
${AOM_DSP_COMMON_SOURCES}
"${AOM_ROOT}/aom_dsp/ans.h")
-elseif (CONFIG_DAALA_EC)
+else ()
set(AOM_DSP_COMMON_SOURCES
${AOM_DSP_COMMON_SOURCES}
"${AOM_ROOT}/aom_dsp/entcode.c"
@@ -221,7 +227,7 @@ if (CONFIG_AV1)
"${AOM_ROOT}/aom_dsp/x86/inv_txfm_sse2.h")
endif ()
-if (CONFIG_DECODERS)
+if (CONFIG_AV1_DECODER)
set(AOM_DSP_DECODER_SOURCES
"${AOM_ROOT}/aom_dsp/binary_codes_reader.c"
"${AOM_ROOT}/aom_dsp/binary_codes_reader.h"
@@ -233,22 +239,17 @@ if (CONFIG_DECODERS)
set(AOM_DSP_DECODER_SOURCES
${AOM_DSP_DECODER_SOURCES}
"${AOM_ROOT}/aom_dsp/ansreader.h")
- elseif (CONFIG_DAALA_EC)
+ else ()
set(AOM_DSP_DECODER_SOURCES
${AOM_DSP_DECODER_SOURCES}
"${AOM_ROOT}/aom_dsp/daalaboolreader.c"
"${AOM_ROOT}/aom_dsp/daalaboolreader.h"
"${AOM_ROOT}/aom_dsp/entdec.c"
"${AOM_ROOT}/aom_dsp/entdec.h")
- else ()
- set(AOM_DSP_DECODER_SOURCES
- ${AOM_DSP_DECODER_SOURCES}
- "${AOM_ROOT}/aom_dsp/dkboolreader.c"
- "${AOM_ROOT}/aom_dsp/dkboolreader.h")
endif ()
endif ()
-if (CONFIG_ENCODERS)
+if (CONFIG_AV1_ENCODER)
set(AOM_DSP_ENCODER_SOURCES
"${AOM_ROOT}/aom_dsp/binary_codes_writer.c"
"${AOM_ROOT}/aom_dsp/binary_codes_writer.h"
@@ -257,6 +258,7 @@ if (CONFIG_ENCODERS)
"${AOM_ROOT}/aom_dsp/bitwriter_buffer.h"
"${AOM_ROOT}/aom_dsp/psnr.c"
"${AOM_ROOT}/aom_dsp/psnr.h"
+ "${AOM_ROOT}/aom_dsp/sad.c"
"${AOM_ROOT}/aom_dsp/variance.c"
"${AOM_ROOT}/aom_dsp/variance.h")
@@ -282,6 +284,9 @@ if (CONFIG_ENCODERS)
set(AOM_DSP_ENCODER_ASM_SSE4_1 "${AOM_ROOT}/aom_dsp/x86/sad_sse4.asm")
set(AOM_DSP_ENCODER_INTRIN_AVX2
+ "${AOM_ROOT}/aom_dsp/x86/fwd_dct32x32_impl_avx2.h"
+ "${AOM_ROOT}/aom_dsp/x86/fwd_txfm_avx2.c"
+ "${AOM_ROOT}/aom_dsp/x86/fwd_txfm_avx2.h"
"${AOM_ROOT}/aom_dsp/x86/sad4d_avx2.c"
"${AOM_ROOT}/aom_dsp/x86/sad_avx2.c"
"${AOM_ROOT}/aom_dsp/x86/sad_impl_avx2.c"
@@ -310,11 +315,6 @@ if (CONFIG_ENCODERS)
"${AOM_ROOT}/aom_dsp/x86/variance_sse2.c"
"${AOM_ROOT}/aom_dsp/x86/sum_squares_sse2.c")
- set(AOM_DSP_ENCODER_INTRIN_SSSE3
- ${AOM_DSP_ENCODER_INTRIN_SSSE3}
- "${AOM_ROOT}/aom_dsp/x86/masked_sad_intrin_ssse3.c"
- "${AOM_ROOT}/aom_dsp/x86/masked_variance_intrin_ssse3.c")
-
set(AOM_DSP_ENCODER_ASM_SSSE3_X86_64
${AOM_DSP_ENCODER_ASM_SSSE3_X86_64}
"${AOM_ROOT}/aom_dsp/x86/avg_ssse3_x86_64.asm"
@@ -325,7 +325,6 @@ if (CONFIG_ENCODERS)
"${AOM_ROOT}/aom_dsp/x86/quantize_avx_x86_64.asm")
set(AOM_DSP_ENCODER_INTRIN_MSA
- "${AOM_ROOT}/aom_dsp/mips/avg_msa.c"
"${AOM_ROOT}/aom_dsp/mips/sad_msa.c"
"${AOM_ROOT}/aom_dsp/mips/subtract_msa.c"
"${AOM_ROOT}/aom_dsp/mips/variance_msa.c"
@@ -345,9 +344,7 @@ if (CONFIG_ENCODERS)
"${AOM_ROOT}/aom_dsp/x86/highbd_sad4d_sse2.asm"
"${AOM_ROOT}/aom_dsp/x86/highbd_sad_sse2.asm"
"${AOM_ROOT}/aom_dsp/x86/highbd_subpel_variance_impl_sse2.asm"
- "${AOM_ROOT}/aom_dsp/x86/highbd_variance_impl_sse2.asm"
- "${AOM_ROOT}/aom_dsp/x86/aom_high_subpixel_8t_sse2.asm"
- "${AOM_ROOT}/aom_dsp/x86/aom_high_subpixel_bilinear_sse2.asm")
+ "${AOM_ROOT}/aom_dsp/x86/highbd_variance_impl_sse2.asm")
set(AOM_DSP_ENCODER_INTRIN_SSE2
${AOM_DSP_ENCODER_INTRIN_SSE2}
@@ -368,18 +365,13 @@ if (CONFIG_ENCODERS)
"${AOM_ROOT}/aom_dsp/answriter.h"
"${AOM_ROOT}/aom_dsp/buf_ans.c"
"${AOM_ROOT}/aom_dsp/buf_ans.h")
- elseif (CONFIG_DAALA_EC)
+ else ()
set(AOM_DSP_ENCODER_SOURCES
${AOM_DSP_ENCODER_SOURCES}
"${AOM_ROOT}/aom_dsp/daalaboolwriter.c"
"${AOM_ROOT}/aom_dsp/daalaboolwriter.h"
"${AOM_ROOT}/aom_dsp/entenc.c"
"${AOM_ROOT}/aom_dsp/entenc.h")
- else ()
- set(AOM_DSP_ENCODER_SOURCES
- ${AOM_DSP_ENCODER_SOURCES}
- "${AOM_ROOT}/aom_dsp/dkboolwriter.c"
- "${AOM_ROOT}/aom_dsp/dkboolwriter.h")
endif ()
if (CONFIG_INTERNAL_STATS)
@@ -392,6 +384,18 @@ if (CONFIG_ENCODERS)
endif ()
endif ()
+if (CONFIG_LOOP_RESTORATION)
+ set(AOM_DSP_COMMON_INTRIN_SSE2
+ ${AOM_DSP_COMMON_INTRIN_SSE2}
+ "${AOM_ROOT}/aom_dsp/x86/aom_convolve_hip_sse2.c")
+
+ if (CONFIG_HIGHBITDEPTH)
+ set(AOM_DSP_COMMON_INTRIN_SSSE3
+ ${AOM_DSP_COMMON_INTRIN_SSSE3}
+ "${AOM_ROOT}/aom_dsp/x86/aom_highbd_convolve_hip_ssse3.c")
+ endif ()
+endif ()
+
if (CONFIG_MOTION_VAR)
set(AOM_DSP_ENCODER_INTRIN_SSE4_1
${AOM_DSP_ENCODER_INTRIN_SSE4_1}
@@ -406,13 +410,13 @@ function (setup_aom_dsp_targets)
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_dsp_common)
target_sources(aom PUBLIC $<TARGET_OBJECTS:aom_dsp_common>)
- if (CONFIG_DECODERS)
+ if (CONFIG_AV1_DECODER)
add_library(aom_dsp_decoder OBJECT ${AOM_DSP_DECODER_SOURCES})
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_dsp_decoder)
target_sources(aom PUBLIC $<TARGET_OBJECTS:aom_dsp_decoder>)
endif ()
- if (CONFIG_ENCODERS)
+ if (CONFIG_AV1_ENCODER)
add_library(aom_dsp_encoder OBJECT ${AOM_DSP_ENCODER_SOURCES})
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_dsp_encoder)
target_sources(aom PUBLIC $<TARGET_OBJECTS:aom_dsp_encoder>)
@@ -422,14 +426,14 @@ function (setup_aom_dsp_targets)
add_asm_library("aom_dsp_common_sse2" "AOM_DSP_COMMON_ASM_SSE2" "aom")
add_intrinsics_object_library("-msse2" "sse2" "aom_dsp_common"
"AOM_DSP_COMMON_INTRIN_SSE2")
- if (CONFIG_ENCODERS)
+ if (CONFIG_AV1_ENCODER)
add_asm_library("aom_dsp_encoder_sse2" "AOM_DSP_ENCODER_ASM_SSE2" "aom")
add_intrinsics_object_library("-msse2" "sse2" "aom_dsp_encoder"
"AOM_DSP_ENCODER_INTRIN_SSE2")
endif()
endif ()
- if (HAVE_SSE3 AND CONFIG_ENCODERS)
+ if (HAVE_SSE3 AND CONFIG_AV1_ENCODER)
add_asm_library("aom_dsp_encoder_sse3" "AOM_DSP_ENCODER_INTRIN_SSE3" "aom")
endif ()
@@ -438,21 +442,19 @@ function (setup_aom_dsp_targets)
add_intrinsics_object_library("-mssse3" "ssse3" "aom_dsp_common"
"AOM_DSP_COMMON_INTRIN_SSSE3")
- if (CONFIG_ENCODERS)
+ if (CONFIG_AV1_ENCODER)
if ("${AOM_TARGET_CPU}" STREQUAL "x86_64")
list(APPEND AOM_DSP_ENCODER_ASM_SSSE3
${AOM_DSP_ENCODER_ASM_SSSE3_X86_64})
endif ()
add_asm_library("aom_dsp_encoder_ssse3" "AOM_DSP_ENCODER_ASM_SSSE3" "aom")
- add_intrinsics_object_library("-mssse3" "ssse3" "aom_dsp_encoder"
- "AOM_DSP_ENCODER_INTRIN_SSSE3")
endif ()
endif ()
if (HAVE_SSE4_1)
add_intrinsics_object_library("-msse4.1" "sse4_1" "aom_dsp_common"
"AOM_DSP_COMMON_INTRIN_SSE4_1")
- if (CONFIG_ENCODERS)
+ if (CONFIG_AV1_ENCODER)
if (AOM_DSP_ENCODER_INTRIN_SSE4_1)
add_intrinsics_object_library("-msse4.1" "sse4_1" "aom_dsp_encoder"
"AOM_DSP_ENCODER_INTRIN_SSE4_1")
@@ -463,14 +465,16 @@ function (setup_aom_dsp_targets)
endif ()
if (HAVE_AVX AND "${AOM_TARGET_CPU}" STREQUAL "x86_64")
- add_asm_library("aom_dsp_encoder_avx" "AOM_DSP_ENCODER_AVX_ASM_X86_64"
- "aom")
+ if (CONFIG_AV1_ENCODER)
+ add_asm_library("aom_dsp_encoder_avx" "AOM_DSP_ENCODER_AVX_ASM_X86_64"
+ "aom")
+ endif ()
endif ()
if (HAVE_AVX2)
add_intrinsics_object_library("-mavx2" "avx2" "aom_dsp_common"
"AOM_DSP_COMMON_INTRIN_AVX2")
- if (CONFIG_ENCODERS)
+ if (CONFIG_AV1_ENCODER)
add_intrinsics_object_library("-mavx2" "avx2" "aom_dsp_encoder"
"AOM_DSP_ENCODER_INTRIN_AVX2")
endif ()
@@ -497,7 +501,7 @@ function (setup_aom_dsp_targets)
if (HAVE_MSA)
add_intrinsics_object_library("" "msa" "aom_dsp_common"
"AOM_DSP_COMMON_INTRIN_MSA")
- if (CONFIG_ENCODERS)
+ if (CONFIG_AV1_ENCODER)
add_intrinsics_object_library("" "msa" "aom_dsp_encoder"
"AOM_DSP_ENCODER_INTRIN_MSA")
endif ()
@@ -507,3 +511,5 @@ function (setup_aom_dsp_targets)
# $AOM_LIB_TARGETS.
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} PARENT_SCOPE)
endfunction ()
+
+endif () # AOM_AOM_DSP_AOM_DSP_CMAKE_
diff --git a/third_party/aom/aom_dsp/aom_dsp.mk b/third_party/aom/aom_dsp/aom_dsp.mk
index 8c7241b83..6e2d5630e 100644
--- a/third_party/aom/aom_dsp/aom_dsp.mk
+++ b/third_party/aom/aom_dsp/aom_dsp.mk
@@ -22,19 +22,16 @@ DSP_SRCS-yes += prob.h
DSP_SRCS-yes += prob.c
DSP_SRCS-$(CONFIG_ANS) += ans.h
-ifeq ($(CONFIG_ENCODERS),yes)
+ifeq ($(CONFIG_AV1_ENCODER),yes)
ifeq ($(CONFIG_ANS),yes)
DSP_SRCS-yes += answriter.h
DSP_SRCS-yes += buf_ans.h
DSP_SRCS-yes += buf_ans.c
-else ifeq ($(CONFIG_DAALA_EC),yes)
+else
DSP_SRCS-yes += entenc.c
DSP_SRCS-yes += entenc.h
DSP_SRCS-yes += daalaboolwriter.c
DSP_SRCS-yes += daalaboolwriter.h
-else
-DSP_SRCS-yes += dkboolwriter.h
-DSP_SRCS-yes += dkboolwriter.c
endif
DSP_SRCS-yes += bitwriter.h
DSP_SRCS-yes += bitwriter_buffer.c
@@ -49,17 +46,14 @@ DSP_SRCS-$(CONFIG_INTERNAL_STATS) += psnrhvs.c
DSP_SRCS-$(CONFIG_INTERNAL_STATS) += fastssim.c
endif
-ifeq ($(CONFIG_DECODERS),yes)
+ifeq ($(CONFIG_AV1_DECODER),yes)
ifeq ($(CONFIG_ANS),yes)
DSP_SRCS-yes += ansreader.h
-else ifeq ($(CONFIG_DAALA_EC),yes)
+else
DSP_SRCS-yes += entdec.c
DSP_SRCS-yes += entdec.h
DSP_SRCS-yes += daalaboolreader.c
DSP_SRCS-yes += daalaboolreader.h
-else
-DSP_SRCS-yes += dkboolreader.h
-DSP_SRCS-yes += dkboolreader.c
endif
DSP_SRCS-yes += bitreader.h
DSP_SRCS-yes += bitreader_buffer.c
@@ -71,7 +65,7 @@ endif
# intra predictions
DSP_SRCS-yes += intrapred.c
-ifeq ($(CONFIG_DAALA_EC),yes)
+ifneq ($(CONFIG_ANS),yes)
DSP_SRCS-yes += entcode.c
DSP_SRCS-yes += entcode.h
endif
@@ -205,6 +199,7 @@ endif # CONFIG_HIGHBITDEPTH
DSP_SRCS-yes += txfm_common.h
DSP_SRCS-yes += x86/txfm_common_intrin.h
DSP_SRCS-$(HAVE_SSE2) += x86/txfm_common_sse2.h
+DSP_SRCS-$(HAVE_SSSE3) += x86/obmc_intrinsic_ssse3.h
DSP_SRCS-$(HAVE_MSA) += mips/txfm_macros_msa.h
# forward transform
@@ -239,6 +234,8 @@ DSP_SRCS-$(HAVE_SSE2) += x86/inv_txfm_sse2.h
DSP_SRCS-$(HAVE_SSE2) += x86/inv_txfm_sse2.c
DSP_SRCS-$(HAVE_SSE2) += x86/inv_wht_sse2.asm
DSP_SRCS-$(HAVE_SSSE3) += x86/inv_txfm_ssse3.c
+DSP_SRCS-$(HAVE_AVX2) += x86/inv_txfm_common_avx2.h
+DSP_SRCS-$(HAVE_AVX2) += x86/inv_txfm_avx2.c
ifeq ($(HAVE_NEON_ASM),yes)
DSP_SRCS-yes += arm/save_reg_neon$(ASM)
@@ -278,6 +275,13 @@ DSP_SRCS-$(HAVE_DSPR2) += mips/itrans16_dspr2.c
DSP_SRCS-$(HAVE_DSPR2) += mips/itrans32_dspr2.c
DSP_SRCS-$(HAVE_DSPR2) += mips/itrans32_cols_dspr2.c
endif # CONFIG_HIGHBITDEPTH
+
+ifeq ($(CONFIG_LOOP_RESTORATION),yes)
+DSP_SRCS-$(HAVE_SSE2) += x86/aom_convolve_hip_sse2.c
+ifeq ($(CONFIG_HIGHBITDEPTH),yes)
+DSP_SRCS-$(HAVE_SSSE3) += x86/aom_highbd_convolve_hip_ssse3.c
+endif
+endif # CONFIG_LOOP_RESTORATION
endif # CONFIG_AV1
# quantization
@@ -298,7 +302,6 @@ endif
DSP_SRCS-yes += avg.c
DSP_SRCS-$(HAVE_SSE2) += x86/avg_intrin_sse2.c
DSP_SRCS-$(HAVE_NEON) += arm/avg_neon.c
-DSP_SRCS-$(HAVE_MSA) += mips/avg_msa.c
DSP_SRCS-$(HAVE_NEON) += arm/hadamard_neon.c
ifeq ($(ARCH_X86_64),yes)
DSP_SRCS-$(HAVE_SSSE3) += x86/avg_ssse3_x86_64.asm
@@ -317,11 +320,10 @@ DSP_SRCS-yes += sum_squares.c
DSP_SRCS-$(HAVE_SSE2) += x86/sum_squares_sse2.c
endif # CONFIG_AV1_ENCODER
-ifeq ($(CONFIG_ENCODERS),yes)
+ifeq ($(CONFIG_AV1_ENCODER),yes)
DSP_SRCS-yes += sad.c
DSP_SRCS-yes += subtract.c
-DSP_SRCS-$(HAVE_MEDIA) += arm/sad_media$(ASM)
DSP_SRCS-$(HAVE_NEON) += arm/sad4d_neon.c
DSP_SRCS-$(HAVE_NEON) += arm/sad_neon.c
DSP_SRCS-$(HAVE_NEON) += arm/subtract_neon.c
@@ -364,18 +366,12 @@ DSP_SRCS-$(HAVE_SSE2) += x86/highbd_sad4d_sse2.asm
DSP_SRCS-$(HAVE_SSE2) += x86/highbd_sad_sse2.asm
endif # CONFIG_HIGHBITDEPTH
-endif # CONFIG_ENCODERS
+endif # CONFIG_AV1_ENCODER
-ifneq ($(filter yes,$(CONFIG_ENCODERS)),)
+ifneq ($(filter yes,$(CONFIG_AV1_ENCODER)),)
DSP_SRCS-yes += variance.c
DSP_SRCS-yes += variance.h
-DSP_SRCS-$(HAVE_MEDIA) += arm/bilinear_filter_media$(ASM)
-DSP_SRCS-$(HAVE_MEDIA) += arm/subpel_variance_media.c
-DSP_SRCS-$(HAVE_MEDIA) += arm/variance_halfpixvar16x16_h_media$(ASM)
-DSP_SRCS-$(HAVE_MEDIA) += arm/variance_halfpixvar16x16_hv_media$(ASM)
-DSP_SRCS-$(HAVE_MEDIA) += arm/variance_halfpixvar16x16_v_media$(ASM)
-DSP_SRCS-$(HAVE_MEDIA) += arm/variance_media$(ASM)
DSP_SRCS-$(HAVE_NEON) += arm/subpel_variance_neon.c
DSP_SRCS-$(HAVE_NEON) += arm/variance_neon.c
@@ -402,7 +398,7 @@ DSP_SRCS-$(HAVE_SSE4_1) += x86/highbd_variance_sse4.c
DSP_SRCS-$(HAVE_SSE2) += x86/highbd_variance_impl_sse2.asm
DSP_SRCS-$(HAVE_SSE2) += x86/highbd_subpel_variance_impl_sse2.asm
endif # CONFIG_HIGHBITDEPTH
-endif # CONFIG_ENCODERS
+endif # CONFIG_AV1_ENCODER
DSP_SRCS-no += $(DSP_SRCS_REMOVE-yes)
diff --git a/third_party/aom/aom_dsp/aom_dsp_common.h b/third_party/aom/aom_dsp/aom_dsp_common.h
index 47ffbeb6c..82f9a95e9 100644
--- a/third_party/aom/aom_dsp/aom_dsp_common.h
+++ b/third_party/aom/aom_dsp/aom_dsp_common.h
@@ -31,6 +31,8 @@ extern "C" {
#define AOMMIN(x, y) (((x) < (y)) ? (x) : (y))
#define AOMMAX(x, y) (((x) > (y)) ? (x) : (y))
+#define NELEMENTS(x) (sizeof((x)) / sizeof((x)[0]))
+
#define IMPLIES(a, b) (!(a) || (b)) // Logical 'a implies b' (or 'a -> b')
#define IS_POWER_OF_TWO(x) (((x) & ((x)-1)) == 0)
diff --git a/third_party/aom/aom_dsp/aom_dsp_rtcd_defs.pl b/third_party/aom/aom_dsp/aom_dsp_rtcd_defs.pl
index b4ef0d92f..8047cbc09 100755
--- a/third_party/aom/aom_dsp/aom_dsp_rtcd_defs.pl
+++ b/third_party/aom/aom_dsp/aom_dsp_rtcd_defs.pl
@@ -49,6 +49,9 @@ if (aom_config("CONFIG_TX64X64") eq "yes") {
@pred_names = qw/dc dc_top dc_left dc_128 v h d207e d63e d45e d117 d135 d153/;
if (aom_config("CONFIG_ALT_INTRA") eq "yes") {
push @pred_names, qw/paeth smooth/;
+ if (aom_config("CONFIG_SMOOTH_HV") eq "yes") {
+ push @pred_names, qw/smooth_v smooth_h/;
+ }
} else {
push @pred_names, 'tm';
}
@@ -168,10 +171,14 @@ if (aom_config("CONFIG_LOOP_RESTORATION") eq "yes") {
add_proto qw/void aom_convolve8_add_src/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
add_proto qw/void aom_convolve8_add_src_horiz/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
add_proto qw/void aom_convolve8_add_src_vert/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
+ add_proto qw/void aom_convolve8_add_src_hip/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
+ add_proto qw/void aom_convolve8_add_src_horiz_hip/, "const uint8_t *src, ptrdiff_t src_stride, uint16_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
+ add_proto qw/void aom_convolve8_add_src_vert_hip/, "const uint16_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
specialize qw/aom_convolve8_add_src ssse3/;
specialize qw/aom_convolve8_add_src_horiz ssse3/;
specialize qw/aom_convolve8_add_src_vert ssse3/;
+ specialize qw/aom_convolve8_add_src_hip sse2/;
} # CONFIG_LOOP_RESTORATION
# TODO(any): These need to be extended to up to 128x128 block sizes
@@ -215,8 +222,12 @@ if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
add_proto qw/void aom_highbd_convolve8_add_src/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
add_proto qw/void aom_highbd_convolve8_add_src_horiz/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
add_proto qw/void aom_highbd_convolve8_add_src_vert/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
+ add_proto qw/void aom_highbd_convolve8_add_src_hip/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
+ add_proto qw/void aom_highbd_convolve8_add_src_horiz_hip/, "const uint8_t *src, ptrdiff_t src_stride, uint16_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
+ add_proto qw/void aom_highbd_convolve8_add_src_vert_hip/, "const uint16_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
specialize qw/aom_highbd_convolve8_add_src/, "$sse2_x86_64";
+ specialize qw/aom_highbd_convolve8_add_src_hip ssse3/;
# The _horiz/_vert functions are currently unused, so we don't bother
# specialising them.
} # CONFIG_LOOP_RESTORATION
@@ -434,29 +445,30 @@ if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
specialize qw/aom_idct8x8_1_add sse2/;
add_proto qw/void aom_idct16x16_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
- specialize qw/aom_idct16x16_256_add sse2/;
+ specialize qw/aom_idct16x16_256_add sse2 avx2/;
add_proto qw/void aom_idct16x16_38_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
+ specialize qw/aom_idct16x16_38_add avx2/;
add_proto qw/void aom_idct16x16_10_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
- specialize qw/aom_idct16x16_10_add sse2/;
+ specialize qw/aom_idct16x16_10_add sse2 avx2/;
add_proto qw/void aom_idct16x16_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
- specialize qw/aom_idct16x16_1_add sse2/;
+ specialize qw/aom_idct16x16_1_add sse2 avx2/;
add_proto qw/void aom_idct32x32_1024_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
- specialize qw/aom_idct32x32_1024_add sse2 ssse3/;
+ specialize qw/aom_idct32x32_1024_add sse2 ssse3 avx2/;
add_proto qw/void aom_idct32x32_135_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
- specialize qw/aom_idct32x32_135_add sse2 ssse3/;
+ specialize qw/aom_idct32x32_135_add sse2 ssse3 avx2/;
# Need to add 135 eob idct32x32 implementations.
$aom_idct32x32_135_add_sse2=aom_idct32x32_1024_add_sse2;
add_proto qw/void aom_idct32x32_34_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
- specialize qw/aom_idct32x32_34_add sse2 ssse3/;
+ specialize qw/aom_idct32x32_34_add sse2 ssse3 avx2/;
add_proto qw/void aom_idct32x32_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
- specialize qw/aom_idct32x32_1_add sse2/;
+ specialize qw/aom_idct32x32_1_add sse2 avx2/;
add_proto qw/void aom_highbd_idct4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
specialize qw/aom_highbd_idct4x4_16_add sse2/;
@@ -479,21 +491,22 @@ if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
specialize qw/aom_idct8x8_12_add sse2 ssse3 neon dspr2 msa/;
add_proto qw/void aom_idct16x16_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
- specialize qw/aom_idct16x16_1_add sse2 neon dspr2 msa/;
+ specialize qw/aom_idct16x16_1_add sse2 avx2 neon dspr2 msa/;
add_proto qw/void aom_idct16x16_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
- specialize qw/aom_idct16x16_256_add sse2 neon dspr2 msa/;
+ specialize qw/aom_idct16x16_256_add sse2 avx2 neon dspr2 msa/;
add_proto qw/void aom_idct16x16_38_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
+ specialize qw/aom_idct16x16_38_add avx2/;
add_proto qw/void aom_idct16x16_10_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
- specialize qw/aom_idct16x16_10_add sse2 neon dspr2 msa/;
+ specialize qw/aom_idct16x16_10_add sse2 avx2 neon dspr2 msa/;
add_proto qw/void aom_idct32x32_1024_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
- specialize qw/aom_idct32x32_1024_add sse2 ssse3 neon dspr2 msa/;
+ specialize qw/aom_idct32x32_1024_add sse2 ssse3 avx2 neon dspr2 msa/;
add_proto qw/void aom_idct32x32_135_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
- specialize qw/aom_idct32x32_135_add sse2 ssse3 neon dspr2 msa/;
+ specialize qw/aom_idct32x32_135_add sse2 ssse3 avx2 neon dspr2 msa/;
# Need to add 135 eob idct32x32 implementations.
$aom_idct32x32_135_add_sse2=aom_idct32x32_1024_add_sse2;
$aom_idct32x32_135_add_neon=aom_idct32x32_1024_add_neon;
@@ -501,12 +514,12 @@ if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
$aom_idct32x32_135_add_msa=aom_idct32x32_1024_add_msa;
add_proto qw/void aom_idct32x32_34_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
- specialize qw/aom_idct32x32_34_add sse2 ssse3 neon dspr2 msa/;
+ specialize qw/aom_idct32x32_34_add sse2 ssse3 avx2 neon dspr2 msa/;
# Need to add 34 eob idct32x32 neon implementation.
$aom_idct32x32_34_add_neon=aom_idct32x32_1024_add_neon;
add_proto qw/void aom_idct32x32_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
- specialize qw/aom_idct32x32_1_add sse2 neon dspr2 msa/;
+ specialize qw/aom_idct32x32_1_add sse2 avx2 neon dspr2 msa/;
add_proto qw/void aom_iwht4x4_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/aom_iwht4x4_1_add msa/;
@@ -578,7 +591,7 @@ if (aom_config("CONFIG_AV1") eq "yes") {
}
} # CONFIG_AV1
-if (aom_config("CONFIG_ENCODERS") eq "yes") {
+if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
#
# Block subtraction
#
@@ -604,13 +617,8 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
#
# Avg
#
- add_proto qw/unsigned int aom_avg_8x8/, "const uint8_t *, int p";
specialize qw/aom_avg_8x8 sse2 neon msa/;
- add_proto qw/unsigned int aom_avg_4x4/, "const uint8_t *, int p";
- specialize qw/aom_avg_4x4 sse2 neon msa/;
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
- add_proto qw/unsigned int aom_highbd_avg_8x8/, "const uint8_t *, int p";
- add_proto qw/unsigned int aom_highbd_avg_4x4/, "const uint8_t *, int p";
add_proto qw/void aom_highbd_subtract_block/, "int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride, int bd";
specialize qw/aom_highbd_subtract_block sse2/;
}
@@ -652,22 +660,22 @@ foreach (@block_sizes) {
add_proto qw/unsigned int/, "aom_sad${w}x${h}_avg", "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
}
-specialize qw/aom_sad128x128 avx2 sse2/;
-specialize qw/aom_sad128x64 avx2 sse2/;
-specialize qw/aom_sad64x128 avx2 sse2/;
-specialize qw/aom_sad64x64 avx2 neon msa sse2/;
-specialize qw/aom_sad64x32 avx2 msa sse2/;
-specialize qw/aom_sad32x64 avx2 msa sse2/;
-specialize qw/aom_sad32x32 avx2 neon msa sse2/;
-specialize qw/aom_sad32x16 avx2 msa sse2/;
-specialize qw/aom_sad16x32 msa sse2/;
-specialize qw/aom_sad16x16 media neon msa sse2/;
-specialize qw/aom_sad16x8 neon msa sse2/;
-specialize qw/aom_sad8x16 neon msa sse2/;
-specialize qw/aom_sad8x8 neon msa sse2/;
-specialize qw/aom_sad8x4 msa sse2/;
-specialize qw/aom_sad4x8 msa sse2/;
-specialize qw/aom_sad4x4 neon msa sse2/;
+specialize qw/aom_sad128x128 avx2 sse2/;
+specialize qw/aom_sad128x64 avx2 sse2/;
+specialize qw/aom_sad64x128 avx2 sse2/;
+specialize qw/aom_sad64x64 avx2 neon msa sse2/;
+specialize qw/aom_sad64x32 avx2 msa sse2/;
+specialize qw/aom_sad32x64 avx2 msa sse2/;
+specialize qw/aom_sad32x32 avx2 neon msa sse2/;
+specialize qw/aom_sad32x16 avx2 msa sse2/;
+specialize qw/aom_sad16x32 msa sse2/;
+specialize qw/aom_sad16x16 neon msa sse2/;
+specialize qw/aom_sad16x8 neon msa sse2/;
+specialize qw/aom_sad8x16 neon msa sse2/;
+specialize qw/aom_sad8x8 neon msa sse2/;
+specialize qw/aom_sad8x4 msa sse2/;
+specialize qw/aom_sad4x8 msa sse2/;
+specialize qw/aom_sad4x4 neon msa sse2/;
specialize qw/aom_sad128x128_avg avx2 sse2/;
specialize qw/aom_sad128x64_avg avx2 sse2/;
@@ -727,14 +735,14 @@ if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
if (aom_config("CONFIG_EXT_INTER") eq "yes") {
foreach (@block_sizes) {
($w, $h) = @$_;
- add_proto qw/unsigned int/, "aom_masked_sad${w}x${h}", "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *mask, int mask_stride";
+ add_proto qw/unsigned int/, "aom_masked_sad${w}x${h}", "const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride, const uint8_t *second_pred, const uint8_t *msk, int msk_stride, int invert_mask";
specialize "aom_masked_sad${w}x${h}", qw/ssse3/;
}
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
foreach (@block_sizes) {
($w, $h) = @$_;
- add_proto qw/unsigned int/, "aom_highbd_masked_sad${w}x${h}", "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *mask, int mask_stride";
+ add_proto qw/unsigned int/, "aom_highbd_masked_sad${w}x${h}", "const uint8_t *src8, int src_stride, const uint8_t *ref8, int ref_stride, const uint8_t *second_pred8, const uint8_t *msk, int msk_stride, int invert_mask";
specialize "aom_highbd_masked_sad${w}x${h}", qw/ssse3/;
}
}
@@ -876,9 +884,9 @@ if (aom_config("CONFIG_INTERNAL_STATS") eq "yes") {
add_proto qw/void aom_highbd_ssim_parms_8x8/, "const uint16_t *s, int sp, const uint16_t *r, int rp, uint32_t *sum_s, uint32_t *sum_r, uint32_t *sum_sq_s, uint32_t *sum_sq_r, uint32_t *sum_sxr";
}
}
-} # CONFIG_ENCODERS
+} # CONFIG_AV1_ENCODER
-if (aom_config("CONFIG_ENCODERS") eq "yes") {
+if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
#
# Specialty Variance
@@ -896,10 +904,10 @@ add_proto qw/unsigned int aom_mse16x8/, "const uint8_t *src_ptr, int source_str
add_proto qw/unsigned int aom_mse8x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
add_proto qw/unsigned int aom_mse8x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
-specialize qw/aom_mse16x16 sse2 avx2 media neon msa/;
-specialize qw/aom_mse16x8 sse2 msa/;
-specialize qw/aom_mse8x16 sse2 msa/;
-specialize qw/aom_mse8x8 sse2 msa/;
+specialize qw/aom_mse16x16 sse2 avx2 neon msa/;
+specialize qw/aom_mse16x8 sse2 msa/;
+specialize qw/aom_mse8x16 sse2 msa/;
+specialize qw/aom_mse8x8 sse2 msa/;
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
foreach $bd (8, 10, 12) {
@@ -956,33 +964,33 @@ foreach (@block_sizes) {
add_proto qw/uint32_t/, "aom_sub_pixel_avg_variance${w}x${h}", "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
}
-specialize qw/aom_variance64x64 sse2 avx2 neon msa/;
-specialize qw/aom_variance64x32 sse2 avx2 neon msa/;
-specialize qw/aom_variance32x64 sse2 neon msa/;
-specialize qw/aom_variance32x32 sse2 avx2 neon msa/;
-specialize qw/aom_variance32x16 sse2 avx2 msa/;
-specialize qw/aom_variance16x32 sse2 msa/;
-specialize qw/aom_variance16x16 sse2 avx2 media neon msa/;
-specialize qw/aom_variance16x8 sse2 neon msa/;
-specialize qw/aom_variance8x16 sse2 neon msa/;
-specialize qw/aom_variance8x8 sse2 media neon msa/;
-specialize qw/aom_variance8x4 sse2 msa/;
-specialize qw/aom_variance4x8 sse2 msa/;
-specialize qw/aom_variance4x4 sse2 msa/;
-
-specialize qw/aom_sub_pixel_variance64x64 avx2 neon msa sse2 ssse3/;
-specialize qw/aom_sub_pixel_variance64x32 msa sse2 ssse3/;
-specialize qw/aom_sub_pixel_variance32x64 msa sse2 ssse3/;
-specialize qw/aom_sub_pixel_variance32x32 avx2 neon msa sse2 ssse3/;
-specialize qw/aom_sub_pixel_variance32x16 msa sse2 ssse3/;
-specialize qw/aom_sub_pixel_variance16x32 msa sse2 ssse3/;
-specialize qw/aom_sub_pixel_variance16x16 media neon msa sse2 ssse3/;
-specialize qw/aom_sub_pixel_variance16x8 msa sse2 ssse3/;
-specialize qw/aom_sub_pixel_variance8x16 msa sse2 ssse3/;
-specialize qw/aom_sub_pixel_variance8x8 media neon msa sse2 ssse3/;
-specialize qw/aom_sub_pixel_variance8x4 msa sse2 ssse3/;
-specialize qw/aom_sub_pixel_variance4x8 msa sse2 ssse3/;
-specialize qw/aom_sub_pixel_variance4x4 msa sse2 ssse3/;
+specialize qw/aom_variance64x64 sse2 avx2 neon msa/;
+specialize qw/aom_variance64x32 sse2 avx2 neon msa/;
+specialize qw/aom_variance32x64 sse2 neon msa/;
+specialize qw/aom_variance32x32 sse2 avx2 neon msa/;
+specialize qw/aom_variance32x16 sse2 avx2 msa/;
+specialize qw/aom_variance16x32 sse2 msa/;
+specialize qw/aom_variance16x16 sse2 avx2 neon msa/;
+specialize qw/aom_variance16x8 sse2 neon msa/;
+specialize qw/aom_variance8x16 sse2 neon msa/;
+specialize qw/aom_variance8x8 sse2 neon msa/;
+specialize qw/aom_variance8x4 sse2 msa/;
+specialize qw/aom_variance4x8 sse2 msa/;
+specialize qw/aom_variance4x4 sse2 msa/;
+
+specialize qw/aom_sub_pixel_variance64x64 avx2 neon msa sse2 ssse3/;
+specialize qw/aom_sub_pixel_variance64x32 msa sse2 ssse3/;
+specialize qw/aom_sub_pixel_variance32x64 msa sse2 ssse3/;
+specialize qw/aom_sub_pixel_variance32x32 avx2 neon msa sse2 ssse3/;
+specialize qw/aom_sub_pixel_variance32x16 msa sse2 ssse3/;
+specialize qw/aom_sub_pixel_variance16x32 msa sse2 ssse3/;
+specialize qw/aom_sub_pixel_variance16x16 neon msa sse2 ssse3/;
+specialize qw/aom_sub_pixel_variance16x8 msa sse2 ssse3/;
+specialize qw/aom_sub_pixel_variance8x16 msa sse2 ssse3/;
+specialize qw/aom_sub_pixel_variance8x8 neon msa sse2 ssse3/;
+specialize qw/aom_sub_pixel_variance8x4 msa sse2 ssse3/;
+specialize qw/aom_sub_pixel_variance4x8 msa sse2 ssse3/;
+specialize qw/aom_sub_pixel_variance4x4 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_avg_variance64x64 avx2 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_avg_variance64x32 msa sse2 ssse3/;
@@ -1034,19 +1042,15 @@ if (aom_config("CONFIG_EXT_INTER") eq "yes") {
#
foreach (@block_sizes) {
($w, $h) = @$_;
- add_proto qw/unsigned int/, "aom_masked_variance${w}x${h}", "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *mask, int mask_stride, unsigned int *sse";
- add_proto qw/unsigned int/, "aom_masked_sub_pixel_variance${w}x${h}", "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, const uint8_t *mask, int mask_stride, unsigned int *sse";
- specialize "aom_masked_variance${w}x${h}", qw/ssse3/;
+ add_proto qw/unsigned int/, "aom_masked_sub_pixel_variance${w}x${h}", "const uint8_t *src, int src_stride, int xoffset, int yoffset, const uint8_t *ref, int ref_stride, const uint8_t *second_pred, const uint8_t *msk, int msk_stride, int invert_mask, unsigned int *sse";
specialize "aom_masked_sub_pixel_variance${w}x${h}", qw/ssse3/;
}
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
- foreach $bd ("_", "_10_", "_12_") {
+ foreach $bd ("_8_", "_10_", "_12_") {
foreach (@block_sizes) {
($w, $h) = @$_;
- add_proto qw/unsigned int/, "aom_highbd${bd}masked_variance${w}x${h}", "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *mask, int mask_stride, unsigned int *sse";
- add_proto qw/unsigned int/, "aom_highbd${bd}masked_sub_pixel_variance${w}x${h}", "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, const uint8_t *m, int m_stride, unsigned int *sse";
- specialize "aom_highbd${bd}masked_variance${w}x${h}", qw/ssse3/;
+ add_proto qw/unsigned int/, "aom_highbd${bd}masked_sub_pixel_variance${w}x${h}", "const uint8_t *src, int src_stride, int xoffset, int yoffset, const uint8_t *ref, int ref_stride, const uint8_t *second_pred, const uint8_t *msk, int msk_stride, int invert_mask, unsigned int *sse";
specialize "aom_highbd${bd}masked_sub_pixel_variance${w}x${h}", qw/ssse3/;
}
}
@@ -1119,13 +1123,13 @@ add_proto qw/uint32_t aom_sub_pixel_avg_variance4x4/, "const uint8_t *src_ptr, i
# Specialty Subpixel
#
add_proto qw/uint32_t aom_variance_halfpixvar16x16_h/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, uint32_t *sse";
- specialize qw/aom_variance_halfpixvar16x16_h sse2 media/;
+ specialize qw/aom_variance_halfpixvar16x16_h sse2/;
add_proto qw/uint32_t aom_variance_halfpixvar16x16_v/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, uint32_t *sse";
- specialize qw/aom_variance_halfpixvar16x16_v sse2 media/;
+ specialize qw/aom_variance_halfpixvar16x16_v sse2/;
add_proto qw/uint32_t aom_variance_halfpixvar16x16_hv/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, uint32_t *sse";
- specialize qw/aom_variance_halfpixvar16x16_hv sse2 media/;
+ specialize qw/aom_variance_halfpixvar16x16_hv sse2/;
#
# Comp Avg
@@ -1490,6 +1494,15 @@ if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
} # CONFIG_HIGHBITDEPTH
-} # CONFIG_ENCODERS
+if (aom_config("CONFIG_EXT_INTER") eq "yes") {
+ add_proto qw/void aom_comp_mask_pred/, "uint8_t *comp_pred, const uint8_t *pred, int width, int height, const uint8_t *ref, int ref_stride, const uint8_t *mask, int mask_stride, int invert_mask";
+ add_proto qw/void aom_comp_mask_upsampled_pred/, "uint8_t *comp_pred, const uint8_t *pred, int width, int height, const uint8_t *ref, int ref_stride, const uint8_t *mask, int mask_stride, int invert_mask";
+ if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
+ add_proto qw/void aom_highbd_comp_mask_pred/, "uint16_t *comp_pred, const uint8_t *pred8, int width, int height, const uint8_t *ref8, int ref_stride, const uint8_t *mask, int mask_stride, int invert_mask";
+ add_proto qw/void aom_highbd_comp_mask_upsampled_pred/, "uint16_t *comp_pred, const uint8_t *pred8, int width, int height, const uint8_t *ref8, int ref_stride, const uint8_t *mask, int mask_stride, int invert_mask";
+ }
+}
+
+} # CONFIG_AV1_ENCODER
1;
diff --git a/third_party/aom/aom_dsp/arm/avg_neon.c b/third_party/aom/aom_dsp/arm/avg_neon.c
index e730ccbcc..6ff760017 100644
--- a/third_party/aom/aom_dsp/arm/avg_neon.c
+++ b/third_party/aom/aom_dsp/arm/avg_neon.c
@@ -25,44 +25,6 @@ static INLINE unsigned int horizontal_add_u16x8(const uint16x8_t v_16x8) {
return vget_lane_u32(c, 0);
}
-unsigned int aom_avg_4x4_neon(const uint8_t *s, int p) {
- uint16x8_t v_sum;
- uint32x2_t v_s0 = vdup_n_u32(0);
- uint32x2_t v_s1 = vdup_n_u32(0);
- v_s0 = vld1_lane_u32((const uint32_t *)s, v_s0, 0);
- v_s0 = vld1_lane_u32((const uint32_t *)(s + p), v_s0, 1);
- v_s1 = vld1_lane_u32((const uint32_t *)(s + 2 * p), v_s1, 0);
- v_s1 = vld1_lane_u32((const uint32_t *)(s + 3 * p), v_s1, 1);
- v_sum = vaddl_u8(vreinterpret_u8_u32(v_s0), vreinterpret_u8_u32(v_s1));
- return (horizontal_add_u16x8(v_sum) + 8) >> 4;
-}
-
-unsigned int aom_avg_8x8_neon(const uint8_t *s, int p) {
- uint8x8_t v_s0 = vld1_u8(s);
- const uint8x8_t v_s1 = vld1_u8(s + p);
- uint16x8_t v_sum = vaddl_u8(v_s0, v_s1);
-
- v_s0 = vld1_u8(s + 2 * p);
- v_sum = vaddw_u8(v_sum, v_s0);
-
- v_s0 = vld1_u8(s + 3 * p);
- v_sum = vaddw_u8(v_sum, v_s0);
-
- v_s0 = vld1_u8(s + 4 * p);
- v_sum = vaddw_u8(v_sum, v_s0);
-
- v_s0 = vld1_u8(s + 5 * p);
- v_sum = vaddw_u8(v_sum, v_s0);
-
- v_s0 = vld1_u8(s + 6 * p);
- v_sum = vaddw_u8(v_sum, v_s0);
-
- v_s0 = vld1_u8(s + 7 * p);
- v_sum = vaddw_u8(v_sum, v_s0);
-
- return (horizontal_add_u16x8(v_sum) + 32) >> 6;
-}
-
// coeff: 16 bits, dynamic range [-32640, 32640].
// length: value range {16, 64, 256, 1024}.
int aom_satd_neon(const int16_t *coeff, int length) {
diff --git a/third_party/aom/aom_dsp/arm/bilinear_filter_media.asm b/third_party/aom/aom_dsp/arm/bilinear_filter_media.asm
deleted file mode 100644
index 17b7d25f9..000000000
--- a/third_party/aom/aom_dsp/arm/bilinear_filter_media.asm
+++ /dev/null
@@ -1,240 +0,0 @@
-;
-; Copyright (c) 2016, Alliance for Open Media. All rights reserved
-;
-; This source code is subject to the terms of the BSD 2 Clause License and
-; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
-; was not distributed with this source code in the LICENSE file, you can
-; obtain it at www.aomedia.org/license/software. If the Alliance for Open
-; Media Patent License 1.0 was not distributed with this source code in the
-; PATENTS file, you can obtain it at www.aomedia.org/license/patent.
-;
-
-;
-
-
- EXPORT |aom_filter_block2d_bil_first_pass_media|
- EXPORT |aom_filter_block2d_bil_second_pass_media|
-
- AREA |.text|, CODE, READONLY ; name this block of code
-
-;-------------------------------------
-; r0 unsigned char *src_ptr,
-; r1 unsigned short *dst_ptr,
-; r2 unsigned int src_pitch,
-; r3 unsigned int height,
-; stack unsigned int width,
-; stack const short *aom_filter
-;-------------------------------------
-; The output is transposed stroed in output array to make it easy for second pass filtering.
-|aom_filter_block2d_bil_first_pass_media| PROC
- stmdb sp!, {r4 - r11, lr}
-
- ldr r11, [sp, #40] ; aom_filter address
- ldr r4, [sp, #36] ; width
-
- mov r12, r3 ; outer-loop counter
-
- add r7, r2, r4 ; preload next row
- pld [r0, r7]
-
- sub r2, r2, r4 ; src increment for height loop
-
- ldr r5, [r11] ; load up filter coefficients
-
- mov r3, r3, lsl #1 ; height*2
- add r3, r3, #2 ; plus 2 to make output buffer 4-bit aligned since height is actually (height+1)
-
- mov r11, r1 ; save dst_ptr for each row
-
- cmp r5, #128 ; if filter coef = 128, then skip the filter
- beq bil_null_1st_filter
-
-|bil_height_loop_1st_v6|
- ldrb r6, [r0] ; load source data
- ldrb r7, [r0, #1]
- ldrb r8, [r0, #2]
- mov lr, r4, lsr #2 ; 4-in-parellel loop counter
-
-|bil_width_loop_1st_v6|
- ldrb r9, [r0, #3]
- ldrb r10, [r0, #4]
-
- pkhbt r6, r6, r7, lsl #16 ; src[1] | src[0]
- pkhbt r7, r7, r8, lsl #16 ; src[2] | src[1]
-
- smuad r6, r6, r5 ; apply the filter
- pkhbt r8, r8, r9, lsl #16 ; src[3] | src[2]
- smuad r7, r7, r5
- pkhbt r9, r9, r10, lsl #16 ; src[4] | src[3]
-
- smuad r8, r8, r5
- smuad r9, r9, r5
-
- add r0, r0, #4
- subs lr, lr, #1
-
- add r6, r6, #0x40 ; round_shift_and_clamp
- add r7, r7, #0x40
- usat r6, #16, r6, asr #7
- usat r7, #16, r7, asr #7
-
- strh r6, [r1], r3 ; result is transposed and stored
-
- add r8, r8, #0x40 ; round_shift_and_clamp
- strh r7, [r1], r3
- add r9, r9, #0x40
- usat r8, #16, r8, asr #7
- usat r9, #16, r9, asr #7
-
- strh r8, [r1], r3 ; result is transposed and stored
-
- ldrneb r6, [r0] ; load source data
- strh r9, [r1], r3
-
- ldrneb r7, [r0, #1]
- ldrneb r8, [r0, #2]
-
- bne bil_width_loop_1st_v6
-
- add r0, r0, r2 ; move to next input row
- subs r12, r12, #1
-
- add r9, r2, r4, lsl #1 ; adding back block width
- pld [r0, r9] ; preload next row
-
- add r11, r11, #2 ; move over to next column
- mov r1, r11
-
- bne bil_height_loop_1st_v6
-
- ldmia sp!, {r4 - r11, pc}
-
-|bil_null_1st_filter|
-|bil_height_loop_null_1st|
- mov lr, r4, lsr #2 ; loop counter
-
-|bil_width_loop_null_1st|
- ldrb r6, [r0] ; load data
- ldrb r7, [r0, #1]
- ldrb r8, [r0, #2]
- ldrb r9, [r0, #3]
-
- strh r6, [r1], r3 ; store it to immediate buffer
- add r0, r0, #4
- strh r7, [r1], r3
- subs lr, lr, #1
- strh r8, [r1], r3
- strh r9, [r1], r3
-
- bne bil_width_loop_null_1st
-
- subs r12, r12, #1
- add r0, r0, r2 ; move to next input line
- add r11, r11, #2 ; move over to next column
- mov r1, r11
-
- bne bil_height_loop_null_1st
-
- ldmia sp!, {r4 - r11, pc}
-
- ENDP ; |aom_filter_block2d_bil_first_pass_media|
-
-
-;---------------------------------
-; r0 unsigned short *src_ptr,
-; r1 unsigned char *dst_ptr,
-; r2 int dst_pitch,
-; r3 unsigned int height,
-; stack unsigned int width,
-; stack const short *aom_filter
-;---------------------------------
-|aom_filter_block2d_bil_second_pass_media| PROC
- stmdb sp!, {r4 - r11, lr}
-
- ldr r11, [sp, #40] ; aom_filter address
- ldr r4, [sp, #36] ; width
-
- ldr r5, [r11] ; load up filter coefficients
- mov r12, r4 ; outer-loop counter = width, since we work on transposed data matrix
- mov r11, r1
-
- cmp r5, #128 ; if filter coef = 128, then skip the filter
- beq bil_null_2nd_filter
-
-|bil_height_loop_2nd|
- ldr r6, [r0] ; load the data
- ldr r8, [r0, #4]
- ldrh r10, [r0, #8]
- mov lr, r3, lsr #2 ; loop counter
-
-|bil_width_loop_2nd|
- pkhtb r7, r6, r8 ; src[1] | src[2]
- pkhtb r9, r8, r10 ; src[3] | src[4]
-
- smuad r6, r6, r5 ; apply filter
- smuad r8, r8, r5 ; apply filter
-
- subs lr, lr, #1
-
- smuadx r7, r7, r5 ; apply filter
- smuadx r9, r9, r5 ; apply filter
-
- add r0, r0, #8
-
- add r6, r6, #0x40 ; round_shift_and_clamp
- add r7, r7, #0x40
- usat r6, #8, r6, asr #7
- usat r7, #8, r7, asr #7
- strb r6, [r1], r2 ; the result is transposed back and stored
-
- add r8, r8, #0x40 ; round_shift_and_clamp
- strb r7, [r1], r2
- add r9, r9, #0x40
- usat r8, #8, r8, asr #7
- usat r9, #8, r9, asr #7
- strb r8, [r1], r2 ; the result is transposed back and stored
-
- ldrne r6, [r0] ; load data
- strb r9, [r1], r2
- ldrne r8, [r0, #4]
- ldrneh r10, [r0, #8]
-
- bne bil_width_loop_2nd
-
- subs r12, r12, #1
- add r0, r0, #4 ; update src for next row
- add r11, r11, #1
- mov r1, r11
-
- bne bil_height_loop_2nd
- ldmia sp!, {r4 - r11, pc}
-
-|bil_null_2nd_filter|
-|bil_height_loop_null_2nd|
- mov lr, r3, lsr #2
-
-|bil_width_loop_null_2nd|
- ldr r6, [r0], #4 ; load data
- subs lr, lr, #1
- ldr r8, [r0], #4
-
- strb r6, [r1], r2 ; store data
- mov r7, r6, lsr #16
- strb r7, [r1], r2
- mov r9, r8, lsr #16
- strb r8, [r1], r2
- strb r9, [r1], r2
-
- bne bil_width_loop_null_2nd
-
- subs r12, r12, #1
- add r0, r0, #4
- add r11, r11, #1
- mov r1, r11
-
- bne bil_height_loop_null_2nd
-
- ldmia sp!, {r4 - r11, pc}
- ENDP ; |aom_filter_block2d_second_pass_media|
-
- END
diff --git a/third_party/aom/aom_dsp/arm/sad_media.asm b/third_party/aom/aom_dsp/arm/sad_media.asm
deleted file mode 100644
index 49ddb6764..000000000
--- a/third_party/aom/aom_dsp/arm/sad_media.asm
+++ /dev/null
@@ -1,98 +0,0 @@
-;
-; Copyright (c) 2016, Alliance for Open Media. All rights reserved
-;
-; This source code is subject to the terms of the BSD 2 Clause License and
-; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
-; was not distributed with this source code in the LICENSE file, you can
-; obtain it at www.aomedia.org/license/software. If the Alliance for Open
-; Media Patent License 1.0 was not distributed with this source code in the
-; PATENTS file, you can obtain it at www.aomedia.org/license/patent.
-;
-
-;
-
-
- EXPORT |aom_sad16x16_media|
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-; r0 const unsigned char *src_ptr
-; r1 int src_stride
-; r2 const unsigned char *ref_ptr
-; r3 int ref_stride
-|aom_sad16x16_media| PROC
- stmfd sp!, {r4-r12, lr}
-
- pld [r0, r1, lsl #0]
- pld [r2, r3, lsl #0]
- pld [r0, r1, lsl #1]
- pld [r2, r3, lsl #1]
-
- mov r4, #0 ; sad = 0;
- mov r5, #8 ; loop count
-
-loop
- ; 1st row
- ldr r6, [r0, #0x0] ; load 4 src pixels (1A)
- ldr r8, [r2, #0x0] ; load 4 ref pixels (1A)
- ldr r7, [r0, #0x4] ; load 4 src pixels (1A)
- ldr r9, [r2, #0x4] ; load 4 ref pixels (1A)
- ldr r10, [r0, #0x8] ; load 4 src pixels (1B)
- ldr r11, [r0, #0xC] ; load 4 src pixels (1B)
-
- usada8 r4, r8, r6, r4 ; calculate sad for 4 pixels
- usad8 r8, r7, r9 ; calculate sad for 4 pixels
-
- ldr r12, [r2, #0x8] ; load 4 ref pixels (1B)
- ldr lr, [r2, #0xC] ; load 4 ref pixels (1B)
-
- add r0, r0, r1 ; set src pointer to next row
- add r2, r2, r3 ; set dst pointer to next row
-
- pld [r0, r1, lsl #1]
- pld [r2, r3, lsl #1]
-
- usada8 r4, r10, r12, r4 ; calculate sad for 4 pixels
- usada8 r8, r11, lr, r8 ; calculate sad for 4 pixels
-
- ldr r6, [r0, #0x0] ; load 4 src pixels (2A)
- ldr r7, [r0, #0x4] ; load 4 src pixels (2A)
- add r4, r4, r8 ; add partial sad values
-
- ; 2nd row
- ldr r8, [r2, #0x0] ; load 4 ref pixels (2A)
- ldr r9, [r2, #0x4] ; load 4 ref pixels (2A)
- ldr r10, [r0, #0x8] ; load 4 src pixels (2B)
- ldr r11, [r0, #0xC] ; load 4 src pixels (2B)
-
- usada8 r4, r6, r8, r4 ; calculate sad for 4 pixels
- usad8 r8, r7, r9 ; calculate sad for 4 pixels
-
- ldr r12, [r2, #0x8] ; load 4 ref pixels (2B)
- ldr lr, [r2, #0xC] ; load 4 ref pixels (2B)
-
- add r0, r0, r1 ; set src pointer to next row
- add r2, r2, r3 ; set dst pointer to next row
-
- usada8 r4, r10, r12, r4 ; calculate sad for 4 pixels
- usada8 r8, r11, lr, r8 ; calculate sad for 4 pixels
-
- pld [r0, r1, lsl #1]
- pld [r2, r3, lsl #1]
-
- subs r5, r5, #1 ; decrement loop counter
- add r4, r4, r8 ; add partial sad values
-
- bne loop
-
- mov r0, r4 ; return sad
- ldmfd sp!, {r4-r12, pc}
-
- ENDP
-
- END
-
diff --git a/third_party/aom/aom_dsp/arm/subpel_variance_media.c b/third_party/aom/aom_dsp/arm/subpel_variance_media.c
deleted file mode 100644
index 46ec028d3..000000000
--- a/third_party/aom/aom_dsp/arm/subpel_variance_media.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved
- *
- * This source code is subject to the terms of the BSD 2 Clause License and
- * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
- * was not distributed with this source code in the LICENSE file, you can
- * obtain it at www.aomedia.org/license/software. If the Alliance for Open
- * Media Patent License 1.0 was not distributed with this source code in the
- * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
- */
-
-#include "./aom_config.h"
-#include "./aom_dsp_rtcd.h"
-#include "aom/aom_integer.h"
-#include "aom_ports/mem.h"
-
-#if HAVE_MEDIA
-static const int16_t bilinear_filters_media[8][2] = { { 128, 0 }, { 112, 16 },
- { 96, 32 }, { 80, 48 },
- { 64, 64 }, { 48, 80 },
- { 32, 96 }, { 16, 112 } };
-
-extern void aom_filter_block2d_bil_first_pass_media(
- const uint8_t *src_ptr, uint16_t *dst_ptr, uint32_t src_pitch,
- uint32_t height, uint32_t width, const int16_t *filter);
-
-extern void aom_filter_block2d_bil_second_pass_media(
- const uint16_t *src_ptr, uint8_t *dst_ptr, int32_t src_pitch,
- uint32_t height, uint32_t width, const int16_t *filter);
-
-unsigned int aom_sub_pixel_variance8x8_media(
- const uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset,
- const uint8_t *dst_ptr, int dst_pixels_per_line, unsigned int *sse) {
- uint16_t first_pass[10 * 8];
- uint8_t second_pass[8 * 8];
- const int16_t *HFilter, *VFilter;
-
- HFilter = bilinear_filters_media[xoffset];
- VFilter = bilinear_filters_media[yoffset];
-
- aom_filter_block2d_bil_first_pass_media(src_ptr, first_pass,
- src_pixels_per_line, 9, 8, HFilter);
- aom_filter_block2d_bil_second_pass_media(first_pass, second_pass, 8, 8, 8,
- VFilter);
-
- return aom_variance8x8_media(second_pass, 8, dst_ptr, dst_pixels_per_line,
- sse);
-}
-
-unsigned int aom_sub_pixel_variance16x16_media(
- const uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset,
- const uint8_t *dst_ptr, int dst_pixels_per_line, unsigned int *sse) {
- uint16_t first_pass[36 * 16];
- uint8_t second_pass[20 * 16];
- const int16_t *HFilter, *VFilter;
- unsigned int var;
-
- if (xoffset == 4 && yoffset == 0) {
- var = aom_variance_halfpixvar16x16_h_media(
- src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse);
- } else if (xoffset == 0 && yoffset == 4) {
- var = aom_variance_halfpixvar16x16_v_media(
- src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse);
- } else if (xoffset == 4 && yoffset == 4) {
- var = aom_variance_halfpixvar16x16_hv_media(
- src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse);
- } else {
- HFilter = bilinear_filters_media[xoffset];
- VFilter = bilinear_filters_media[yoffset];
-
- aom_filter_block2d_bil_first_pass_media(
- src_ptr, first_pass, src_pixels_per_line, 17, 16, HFilter);
- aom_filter_block2d_bil_second_pass_media(first_pass, second_pass, 16, 16,
- 16, VFilter);
-
- var = aom_variance16x16_media(second_pass, 16, dst_ptr, dst_pixels_per_line,
- sse);
- }
- return var;
-}
-#endif // HAVE_MEDIA
diff --git a/third_party/aom/aom_dsp/arm/variance_halfpixvar16x16_h_media.asm b/third_party/aom/aom_dsp/arm/variance_halfpixvar16x16_h_media.asm
deleted file mode 100644
index 1e5c9178e..000000000
--- a/third_party/aom/aom_dsp/arm/variance_halfpixvar16x16_h_media.asm
+++ /dev/null
@@ -1,185 +0,0 @@
-;
-; Copyright (c) 2016, Alliance for Open Media. All rights reserved
-;
-; This source code is subject to the terms of the BSD 2 Clause License and
-; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
-; was not distributed with this source code in the LICENSE file, you can
-; obtain it at www.aomedia.org/license/software. If the Alliance for Open
-; Media Patent License 1.0 was not distributed with this source code in the
-; PATENTS file, you can obtain it at www.aomedia.org/license/patent.
-;
-
-;
-
-
- EXPORT |aom_variance_halfpixvar16x16_h_media|
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-; r0 unsigned char *src_ptr
-; r1 int source_stride
-; r2 unsigned char *ref_ptr
-; r3 int recon_stride
-; stack unsigned int *sse
-|aom_variance_halfpixvar16x16_h_media| PROC
-
- stmfd sp!, {r4-r12, lr}
-
- pld [r0, r1, lsl #0]
- pld [r2, r3, lsl #0]
-
- mov r8, #0 ; initialize sum = 0
- ldr r10, c80808080
- mov r11, #0 ; initialize sse = 0
- mov r12, #16 ; set loop counter to 16 (=block height)
- mov lr, #0 ; constant zero
-loop
- ; 1st 4 pixels
- ldr r4, [r0, #0] ; load 4 src pixels
- ldr r6, [r0, #1] ; load 4 src pixels with 1 byte offset
- ldr r5, [r2, #0] ; load 4 ref pixels
-
- ; bilinear interpolation
- mvn r6, r6
- uhsub8 r4, r4, r6
- eor r4, r4, r10
-
- usub8 r6, r4, r5 ; calculate difference
- pld [r0, r1, lsl #1]
- sel r7, r6, lr ; select bytes with positive difference
- usub8 r6, r5, r4 ; calculate difference with reversed operands
- pld [r2, r3, lsl #1]
- sel r6, r6, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r4, r7, lr ; calculate sum of positive differences
- usad8 r5, r6, lr ; calculate sum of negative differences
- orr r6, r6, r7 ; differences of all 4 pixels
- ; calculate total sum
- adds r8, r8, r4 ; add positive differences to sum
- subs r8, r8, r5 ; subtract negative differences from sum
-
- ; calculate sse
- uxtb16 r5, r6 ; byte (two pixels) to halfwords
- uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
- smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
-
- ; 2nd 4 pixels
- ldr r4, [r0, #4] ; load 4 src pixels
- ldr r6, [r0, #5] ; load 4 src pixels with 1 byte offset
- ldr r5, [r2, #4] ; load 4 ref pixels
-
- ; bilinear interpolation
- mvn r6, r6
- uhsub8 r4, r4, r6
- eor r4, r4, r10
-
- smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
-
- usub8 r6, r4, r5 ; calculate difference
- sel r7, r6, lr ; select bytes with positive difference
- usub8 r6, r5, r4 ; calculate difference with reversed operands
- sel r6, r6, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r4, r7, lr ; calculate sum of positive differences
- usad8 r5, r6, lr ; calculate sum of negative differences
- orr r6, r6, r7 ; differences of all 4 pixels
-
- ; calculate total sum
- add r8, r8, r4 ; add positive differences to sum
- sub r8, r8, r5 ; subtract negative differences from sum
-
- ; calculate sse
- uxtb16 r5, r6 ; byte (two pixels) to halfwords
- uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
- smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
-
- ; 3rd 4 pixels
- ldr r4, [r0, #8] ; load 4 src pixels
- ldr r6, [r0, #9] ; load 4 src pixels with 1 byte offset
- ldr r5, [r2, #8] ; load 4 ref pixels
-
- ; bilinear interpolation
- mvn r6, r6
- uhsub8 r4, r4, r6
- eor r4, r4, r10
-
- smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
-
- usub8 r6, r4, r5 ; calculate difference
- sel r7, r6, lr ; select bytes with positive difference
- usub8 r6, r5, r4 ; calculate difference with reversed operands
- sel r6, r6, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r4, r7, lr ; calculate sum of positive differences
- usad8 r5, r6, lr ; calculate sum of negative differences
- orr r6, r6, r7 ; differences of all 4 pixels
-
- ; calculate total sum
- add r8, r8, r4 ; add positive differences to sum
- sub r8, r8, r5 ; subtract negative differences from sum
-
- ; calculate sse
- uxtb16 r5, r6 ; byte (two pixels) to halfwords
- uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
- smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
-
- ; 4th 4 pixels
- ldr r4, [r0, #12] ; load 4 src pixels
- ldr r6, [r0, #13] ; load 4 src pixels with 1 byte offset
- ldr r5, [r2, #12] ; load 4 ref pixels
-
- ; bilinear interpolation
- mvn r6, r6
- uhsub8 r4, r4, r6
- eor r4, r4, r10
-
- smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
-
- usub8 r6, r4, r5 ; calculate difference
- add r0, r0, r1 ; set src_ptr to next row
- sel r7, r6, lr ; select bytes with positive difference
- usub8 r6, r5, r4 ; calculate difference with reversed operands
- add r2, r2, r3 ; set dst_ptr to next row
- sel r6, r6, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r4, r7, lr ; calculate sum of positive differences
- usad8 r5, r6, lr ; calculate sum of negative differences
- orr r6, r6, r7 ; differences of all 4 pixels
-
- ; calculate total sum
- add r8, r8, r4 ; add positive differences to sum
- sub r8, r8, r5 ; subtract negative differences from sum
-
- ; calculate sse
- uxtb16 r5, r6 ; byte (two pixels) to halfwords
- uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
- smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
- smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
-
- subs r12, r12, #1
-
- bne loop
-
- ; return stuff
- ldr r6, [sp, #40] ; get address of sse
- mul r0, r8, r8 ; sum * sum
- str r11, [r6] ; store sse
- sub r0, r11, r0, lsr #8 ; return (sse - ((sum * sum) >> 8))
-
- ldmfd sp!, {r4-r12, pc}
-
- ENDP
-
-c80808080
- DCD 0x80808080
-
- END
-
diff --git a/third_party/aom/aom_dsp/arm/variance_halfpixvar16x16_hv_media.asm b/third_party/aom/aom_dsp/arm/variance_halfpixvar16x16_hv_media.asm
deleted file mode 100644
index 9e0af830e..000000000
--- a/third_party/aom/aom_dsp/arm/variance_halfpixvar16x16_hv_media.asm
+++ /dev/null
@@ -1,225 +0,0 @@
-;
-; Copyright (c) 2016, Alliance for Open Media. All rights reserved
-;
-; This source code is subject to the terms of the BSD 2 Clause License and
-; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
-; was not distributed with this source code in the LICENSE file, you can
-; obtain it at www.aomedia.org/license/software. If the Alliance for Open
-; Media Patent License 1.0 was not distributed with this source code in the
-; PATENTS file, you can obtain it at www.aomedia.org/license/patent.
-;
-
-;
-
-
- EXPORT |aom_variance_halfpixvar16x16_hv_media|
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-; r0 unsigned char *src_ptr
-; r1 int source_stride
-; r2 unsigned char *ref_ptr
-; r3 int recon_stride
-; stack unsigned int *sse
-|aom_variance_halfpixvar16x16_hv_media| PROC
-
- stmfd sp!, {r4-r12, lr}
-
- pld [r0, r1, lsl #0]
- pld [r2, r3, lsl #0]
-
- mov r8, #0 ; initialize sum = 0
- ldr r10, c80808080
- mov r11, #0 ; initialize sse = 0
- mov r12, #16 ; set loop counter to 16 (=block height)
- mov lr, #0 ; constant zero
-loop
- add r9, r0, r1 ; pointer to pixels on the next row
- ; 1st 4 pixels
- ldr r4, [r0, #0] ; load source pixels a, row N
- ldr r6, [r0, #1] ; load source pixels b, row N
- ldr r5, [r9, #0] ; load source pixels c, row N+1
- ldr r7, [r9, #1] ; load source pixels d, row N+1
-
- ; x = (a + b + 1) >> 1, interpolate pixels horizontally on row N
- mvn r6, r6
- uhsub8 r4, r4, r6
- eor r4, r4, r10
- ; y = (c + d + 1) >> 1, interpolate pixels horizontally on row N+1
- mvn r7, r7
- uhsub8 r5, r5, r7
- eor r5, r5, r10
- ; z = (x + y + 1) >> 1, interpolate half pixel values vertically
- mvn r5, r5
- uhsub8 r4, r4, r5
- ldr r5, [r2, #0] ; load 4 ref pixels
- eor r4, r4, r10
-
- usub8 r6, r4, r5 ; calculate difference
- pld [r0, r1, lsl #1]
- sel r7, r6, lr ; select bytes with positive difference
- usub8 r6, r5, r4 ; calculate difference with reversed operands
- pld [r2, r3, lsl #1]
- sel r6, r6, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r4, r7, lr ; calculate sum of positive differences
- usad8 r5, r6, lr ; calculate sum of negative differences
- orr r6, r6, r7 ; differences of all 4 pixels
- ; calculate total sum
- adds r8, r8, r4 ; add positive differences to sum
- subs r8, r8, r5 ; subtract negative differences from sum
-
- ; calculate sse
- uxtb16 r5, r6 ; byte (two pixels) to halfwords
- uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
- smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
-
- ; 2nd 4 pixels
- ldr r4, [r0, #4] ; load source pixels a, row N
- ldr r6, [r0, #5] ; load source pixels b, row N
- ldr r5, [r9, #4] ; load source pixels c, row N+1
-
- smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
-
- ldr r7, [r9, #5] ; load source pixels d, row N+1
-
- ; x = (a + b + 1) >> 1, interpolate pixels horizontally on row N
- mvn r6, r6
- uhsub8 r4, r4, r6
- eor r4, r4, r10
- ; y = (c + d + 1) >> 1, interpolate pixels horizontally on row N+1
- mvn r7, r7
- uhsub8 r5, r5, r7
- eor r5, r5, r10
- ; z = (x + y + 1) >> 1, interpolate half pixel values vertically
- mvn r5, r5
- uhsub8 r4, r4, r5
- ldr r5, [r2, #4] ; load 4 ref pixels
- eor r4, r4, r10
-
- usub8 r6, r4, r5 ; calculate difference
- sel r7, r6, lr ; select bytes with positive difference
- usub8 r6, r5, r4 ; calculate difference with reversed operands
- sel r6, r6, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r4, r7, lr ; calculate sum of positive differences
- usad8 r5, r6, lr ; calculate sum of negative differences
- orr r6, r6, r7 ; differences of all 4 pixels
-
- ; calculate total sum
- add r8, r8, r4 ; add positive differences to sum
- sub r8, r8, r5 ; subtract negative differences from sum
-
- ; calculate sse
- uxtb16 r5, r6 ; byte (two pixels) to halfwords
- uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
- smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
-
- ; 3rd 4 pixels
- ldr r4, [r0, #8] ; load source pixels a, row N
- ldr r6, [r0, #9] ; load source pixels b, row N
- ldr r5, [r9, #8] ; load source pixels c, row N+1
-
- smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
-
- ldr r7, [r9, #9] ; load source pixels d, row N+1
-
- ; x = (a + b + 1) >> 1, interpolate pixels horizontally on row N
- mvn r6, r6
- uhsub8 r4, r4, r6
- eor r4, r4, r10
- ; y = (c + d + 1) >> 1, interpolate pixels horizontally on row N+1
- mvn r7, r7
- uhsub8 r5, r5, r7
- eor r5, r5, r10
- ; z = (x + y + 1) >> 1, interpolate half pixel values vertically
- mvn r5, r5
- uhsub8 r4, r4, r5
- ldr r5, [r2, #8] ; load 4 ref pixels
- eor r4, r4, r10
-
- usub8 r6, r4, r5 ; calculate difference
- sel r7, r6, lr ; select bytes with positive difference
- usub8 r6, r5, r4 ; calculate difference with reversed operands
- sel r6, r6, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r4, r7, lr ; calculate sum of positive differences
- usad8 r5, r6, lr ; calculate sum of negative differences
- orr r6, r6, r7 ; differences of all 4 pixels
-
- ; calculate total sum
- add r8, r8, r4 ; add positive differences to sum
- sub r8, r8, r5 ; subtract negative differences from sum
-
- ; calculate sse
- uxtb16 r5, r6 ; byte (two pixels) to halfwords
- uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
- smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
-
- ; 4th 4 pixels
- ldr r4, [r0, #12] ; load source pixels a, row N
- ldr r6, [r0, #13] ; load source pixels b, row N
- ldr r5, [r9, #12] ; load source pixels c, row N+1
- smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
- ldr r7, [r9, #13] ; load source pixels d, row N+1
-
- ; x = (a + b + 1) >> 1, interpolate pixels horizontally on row N
- mvn r6, r6
- uhsub8 r4, r4, r6
- eor r4, r4, r10
- ; y = (c + d + 1) >> 1, interpolate pixels horizontally on row N+1
- mvn r7, r7
- uhsub8 r5, r5, r7
- eor r5, r5, r10
- ; z = (x + y + 1) >> 1, interpolate half pixel values vertically
- mvn r5, r5
- uhsub8 r4, r4, r5
- ldr r5, [r2, #12] ; load 4 ref pixels
- eor r4, r4, r10
-
- usub8 r6, r4, r5 ; calculate difference
- add r0, r0, r1 ; set src_ptr to next row
- sel r7, r6, lr ; select bytes with positive difference
- usub8 r6, r5, r4 ; calculate difference with reversed operands
- add r2, r2, r3 ; set dst_ptr to next row
- sel r6, r6, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r4, r7, lr ; calculate sum of positive differences
- usad8 r5, r6, lr ; calculate sum of negative differences
- orr r6, r6, r7 ; differences of all 4 pixels
-
- ; calculate total sum
- add r8, r8, r4 ; add positive differences to sum
- sub r8, r8, r5 ; subtract negative differences from sum
-
- ; calculate sse
- uxtb16 r5, r6 ; byte (two pixels) to halfwords
- uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
- smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
- subs r12, r12, #1
- smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
-
- bne loop
-
- ; return stuff
- ldr r6, [sp, #40] ; get address of sse
- mul r0, r8, r8 ; sum * sum
- str r11, [r6] ; store sse
- sub r0, r11, r0, lsr #8 ; return (sse - ((sum * sum) >> 8))
-
- ldmfd sp!, {r4-r12, pc}
-
- ENDP
-
-c80808080
- DCD 0x80808080
-
- END
diff --git a/third_party/aom/aom_dsp/arm/variance_halfpixvar16x16_v_media.asm b/third_party/aom/aom_dsp/arm/variance_halfpixvar16x16_v_media.asm
deleted file mode 100644
index 545b68179..000000000
--- a/third_party/aom/aom_dsp/arm/variance_halfpixvar16x16_v_media.asm
+++ /dev/null
@@ -1,187 +0,0 @@
-;
-; Copyright (c) 2016, Alliance for Open Media. All rights reserved
-;
-; This source code is subject to the terms of the BSD 2 Clause License and
-; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
-; was not distributed with this source code in the LICENSE file, you can
-; obtain it at www.aomedia.org/license/software. If the Alliance for Open
-; Media Patent License 1.0 was not distributed with this source code in the
-; PATENTS file, you can obtain it at www.aomedia.org/license/patent.
-;
-
-;
-
-
- EXPORT |aom_variance_halfpixvar16x16_v_media|
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-; r0 unsigned char *src_ptr
-; r1 int source_stride
-; r2 unsigned char *ref_ptr
-; r3 int recon_stride
-; stack unsigned int *sse
-|aom_variance_halfpixvar16x16_v_media| PROC
-
- stmfd sp!, {r4-r12, lr}
-
- pld [r0, r1, lsl #0]
- pld [r2, r3, lsl #0]
-
- mov r8, #0 ; initialize sum = 0
- ldr r10, c80808080
- mov r11, #0 ; initialize sse = 0
- mov r12, #16 ; set loop counter to 16 (=block height)
- mov lr, #0 ; constant zero
-loop
- add r9, r0, r1 ; set src pointer to next row
- ; 1st 4 pixels
- ldr r4, [r0, #0] ; load 4 src pixels
- ldr r6, [r9, #0] ; load 4 src pixels from next row
- ldr r5, [r2, #0] ; load 4 ref pixels
-
- ; bilinear interpolation
- mvn r6, r6
- uhsub8 r4, r4, r6
- eor r4, r4, r10
-
- usub8 r6, r4, r5 ; calculate difference
- pld [r0, r1, lsl #1]
- sel r7, r6, lr ; select bytes with positive difference
- usub8 r6, r5, r4 ; calculate difference with reversed operands
- pld [r2, r3, lsl #1]
- sel r6, r6, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r4, r7, lr ; calculate sum of positive differences
- usad8 r5, r6, lr ; calculate sum of negative differences
- orr r6, r6, r7 ; differences of all 4 pixels
- ; calculate total sum
- adds r8, r8, r4 ; add positive differences to sum
- subs r8, r8, r5 ; subtract negative differences from sum
-
- ; calculate sse
- uxtb16 r5, r6 ; byte (two pixels) to halfwords
- uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
- smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
-
- ; 2nd 4 pixels
- ldr r4, [r0, #4] ; load 4 src pixels
- ldr r6, [r9, #4] ; load 4 src pixels from next row
- ldr r5, [r2, #4] ; load 4 ref pixels
-
- ; bilinear interpolation
- mvn r6, r6
- uhsub8 r4, r4, r6
- eor r4, r4, r10
-
- smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
-
- usub8 r6, r4, r5 ; calculate difference
- sel r7, r6, lr ; select bytes with positive difference
- usub8 r6, r5, r4 ; calculate difference with reversed operands
- sel r6, r6, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r4, r7, lr ; calculate sum of positive differences
- usad8 r5, r6, lr ; calculate sum of negative differences
- orr r6, r6, r7 ; differences of all 4 pixels
-
- ; calculate total sum
- add r8, r8, r4 ; add positive differences to sum
- sub r8, r8, r5 ; subtract negative differences from sum
-
- ; calculate sse
- uxtb16 r5, r6 ; byte (two pixels) to halfwords
- uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
- smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
-
- ; 3rd 4 pixels
- ldr r4, [r0, #8] ; load 4 src pixels
- ldr r6, [r9, #8] ; load 4 src pixels from next row
- ldr r5, [r2, #8] ; load 4 ref pixels
-
- ; bilinear interpolation
- mvn r6, r6
- uhsub8 r4, r4, r6
- eor r4, r4, r10
-
- smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
-
- usub8 r6, r4, r5 ; calculate difference
- sel r7, r6, lr ; select bytes with positive difference
- usub8 r6, r5, r4 ; calculate difference with reversed operands
- sel r6, r6, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r4, r7, lr ; calculate sum of positive differences
- usad8 r5, r6, lr ; calculate sum of negative differences
- orr r6, r6, r7 ; differences of all 4 pixels
-
- ; calculate total sum
- add r8, r8, r4 ; add positive differences to sum
- sub r8, r8, r5 ; subtract negative differences from sum
-
- ; calculate sse
- uxtb16 r5, r6 ; byte (two pixels) to halfwords
- uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
- smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
-
- ; 4th 4 pixels
- ldr r4, [r0, #12] ; load 4 src pixels
- ldr r6, [r9, #12] ; load 4 src pixels from next row
- ldr r5, [r2, #12] ; load 4 ref pixels
-
- ; bilinear interpolation
- mvn r6, r6
- uhsub8 r4, r4, r6
- eor r4, r4, r10
-
- smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
-
- usub8 r6, r4, r5 ; calculate difference
- add r0, r0, r1 ; set src_ptr to next row
- sel r7, r6, lr ; select bytes with positive difference
- usub8 r6, r5, r4 ; calculate difference with reversed operands
- add r2, r2, r3 ; set dst_ptr to next row
- sel r6, r6, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r4, r7, lr ; calculate sum of positive differences
- usad8 r5, r6, lr ; calculate sum of negative differences
- orr r6, r6, r7 ; differences of all 4 pixels
-
- ; calculate total sum
- add r8, r8, r4 ; add positive differences to sum
- sub r8, r8, r5 ; subtract negative differences from sum
-
- ; calculate sse
- uxtb16 r5, r6 ; byte (two pixels) to halfwords
- uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
- smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
- smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
-
-
- subs r12, r12, #1
-
- bne loop
-
- ; return stuff
- ldr r6, [sp, #40] ; get address of sse
- mul r0, r8, r8 ; sum * sum
- str r11, [r6] ; store sse
- sub r0, r11, r0, lsr #8 ; return (sse - ((sum * sum) >> 8))
-
- ldmfd sp!, {r4-r12, pc}
-
- ENDP
-
-c80808080
- DCD 0x80808080
-
- END
-
diff --git a/third_party/aom/aom_dsp/arm/variance_media.asm b/third_party/aom/aom_dsp/arm/variance_media.asm
deleted file mode 100644
index fdc311a81..000000000
--- a/third_party/aom/aom_dsp/arm/variance_media.asm
+++ /dev/null
@@ -1,361 +0,0 @@
-;
-; Copyright (c) 2016, Alliance for Open Media. All rights reserved
-;
-; This source code is subject to the terms of the BSD 2 Clause License and
-; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
-; was not distributed with this source code in the LICENSE file, you can
-; obtain it at www.aomedia.org/license/software. If the Alliance for Open
-; Media Patent License 1.0 was not distributed with this source code in the
-; PATENTS file, you can obtain it at www.aomedia.org/license/patent.
-;
-
-;
-
-
- EXPORT |aom_variance16x16_media|
- EXPORT |aom_variance8x8_media|
- EXPORT |aom_mse16x16_media|
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-; r0 unsigned char *src_ptr
-; r1 int source_stride
-; r2 unsigned char *ref_ptr
-; r3 int recon_stride
-; stack unsigned int *sse
-|aom_variance16x16_media| PROC
-
- stmfd sp!, {r4-r12, lr}
-
- pld [r0, r1, lsl #0]
- pld [r2, r3, lsl #0]
-
- mov r8, #0 ; initialize sum = 0
- mov r11, #0 ; initialize sse = 0
- mov r12, #16 ; set loop counter to 16 (=block height)
-
-loop16x16
- ; 1st 4 pixels
- ldr r4, [r0, #0] ; load 4 src pixels
- ldr r5, [r2, #0] ; load 4 ref pixels
-
- mov lr, #0 ; constant zero
-
- usub8 r6, r4, r5 ; calculate difference
- pld [r0, r1, lsl #1]
- sel r7, r6, lr ; select bytes with positive difference
- usub8 r9, r5, r4 ; calculate difference with reversed operands
- pld [r2, r3, lsl #1]
- sel r6, r9, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r4, r7, lr ; calculate sum of positive differences
- usad8 r5, r6, lr ; calculate sum of negative differences
- orr r6, r6, r7 ; differences of all 4 pixels
- ; calculate total sum
- adds r8, r8, r4 ; add positive differences to sum
- subs r8, r8, r5 ; subtract negative differences from sum
-
- ; calculate sse
- uxtb16 r5, r6 ; byte (two pixels) to halfwords
- uxtb16 r10, r6, ror #8 ; another two pixels to halfwords
- smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
-
- ; 2nd 4 pixels
- ldr r4, [r0, #4] ; load 4 src pixels
- ldr r5, [r2, #4] ; load 4 ref pixels
- smlad r11, r10, r10, r11 ; dual signed multiply, add and accumulate (2)
-
- usub8 r6, r4, r5 ; calculate difference
- sel r7, r6, lr ; select bytes with positive difference
- usub8 r9, r5, r4 ; calculate difference with reversed operands
- sel r6, r9, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r4, r7, lr ; calculate sum of positive differences
- usad8 r5, r6, lr ; calculate sum of negative differences
- orr r6, r6, r7 ; differences of all 4 pixels
-
- ; calculate total sum
- add r8, r8, r4 ; add positive differences to sum
- sub r8, r8, r5 ; subtract negative differences from sum
-
- ; calculate sse
- uxtb16 r5, r6 ; byte (two pixels) to halfwords
- uxtb16 r10, r6, ror #8 ; another two pixels to halfwords
- smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
-
- ; 3rd 4 pixels
- ldr r4, [r0, #8] ; load 4 src pixels
- ldr r5, [r2, #8] ; load 4 ref pixels
- smlad r11, r10, r10, r11 ; dual signed multiply, add and accumulate (2)
-
- usub8 r6, r4, r5 ; calculate difference
- sel r7, r6, lr ; select bytes with positive difference
- usub8 r9, r5, r4 ; calculate difference with reversed operands
- sel r6, r9, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r4, r7, lr ; calculate sum of positive differences
- usad8 r5, r6, lr ; calculate sum of negative differences
- orr r6, r6, r7 ; differences of all 4 pixels
-
- ; calculate total sum
- add r8, r8, r4 ; add positive differences to sum
- sub r8, r8, r5 ; subtract negative differences from sum
-
- ; calculate sse
- uxtb16 r5, r6 ; byte (two pixels) to halfwords
- uxtb16 r10, r6, ror #8 ; another two pixels to halfwords
- smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
-
- ; 4th 4 pixels
- ldr r4, [r0, #12] ; load 4 src pixels
- ldr r5, [r2, #12] ; load 4 ref pixels
- smlad r11, r10, r10, r11 ; dual signed multiply, add and accumulate (2)
-
- usub8 r6, r4, r5 ; calculate difference
- add r0, r0, r1 ; set src_ptr to next row
- sel r7, r6, lr ; select bytes with positive difference
- usub8 r9, r5, r4 ; calculate difference with reversed operands
- add r2, r2, r3 ; set dst_ptr to next row
- sel r6, r9, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r4, r7, lr ; calculate sum of positive differences
- usad8 r5, r6, lr ; calculate sum of negative differences
- orr r6, r6, r7 ; differences of all 4 pixels
-
- ; calculate total sum
- add r8, r8, r4 ; add positive differences to sum
- sub r8, r8, r5 ; subtract negative differences from sum
-
- ; calculate sse
- uxtb16 r5, r6 ; byte (two pixels) to halfwords
- uxtb16 r10, r6, ror #8 ; another two pixels to halfwords
- smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
- smlad r11, r10, r10, r11 ; dual signed multiply, add and accumulate (2)
-
-
- subs r12, r12, #1
-
- bne loop16x16
-
- ; return stuff
- ldr r6, [sp, #40] ; get address of sse
- mul r0, r8, r8 ; sum * sum
- str r11, [r6] ; store sse
- sub r0, r11, r0, lsr #8 ; return (sse - ((sum * sum) >> 8))
-
- ldmfd sp!, {r4-r12, pc}
-
- ENDP
-
-; r0 unsigned char *src_ptr
-; r1 int source_stride
-; r2 unsigned char *ref_ptr
-; r3 int recon_stride
-; stack unsigned int *sse
-|aom_variance8x8_media| PROC
-
- push {r4-r10, lr}
-
- pld [r0, r1, lsl #0]
- pld [r2, r3, lsl #0]
-
- mov r12, #8 ; set loop counter to 8 (=block height)
- mov r4, #0 ; initialize sum = 0
- mov r5, #0 ; initialize sse = 0
-
-loop8x8
- ; 1st 4 pixels
- ldr r6, [r0, #0x0] ; load 4 src pixels
- ldr r7, [r2, #0x0] ; load 4 ref pixels
-
- mov lr, #0 ; constant zero
-
- usub8 r8, r6, r7 ; calculate difference
- pld [r0, r1, lsl #1]
- sel r10, r8, lr ; select bytes with positive difference
- usub8 r9, r7, r6 ; calculate difference with reversed operands
- pld [r2, r3, lsl #1]
- sel r8, r9, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r6, r10, lr ; calculate sum of positive differences
- usad8 r7, r8, lr ; calculate sum of negative differences
- orr r8, r8, r10 ; differences of all 4 pixels
- ; calculate total sum
- add r4, r4, r6 ; add positive differences to sum
- sub r4, r4, r7 ; subtract negative differences from sum
-
- ; calculate sse
- uxtb16 r7, r8 ; byte (two pixels) to halfwords
- uxtb16 r10, r8, ror #8 ; another two pixels to halfwords
- smlad r5, r7, r7, r5 ; dual signed multiply, add and accumulate (1)
-
- ; 2nd 4 pixels
- ldr r6, [r0, #0x4] ; load 4 src pixels
- ldr r7, [r2, #0x4] ; load 4 ref pixels
- smlad r5, r10, r10, r5 ; dual signed multiply, add and accumulate (2)
-
- usub8 r8, r6, r7 ; calculate difference
- add r0, r0, r1 ; set src_ptr to next row
- sel r10, r8, lr ; select bytes with positive difference
- usub8 r9, r7, r6 ; calculate difference with reversed operands
- add r2, r2, r3 ; set dst_ptr to next row
- sel r8, r9, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r6, r10, lr ; calculate sum of positive differences
- usad8 r7, r8, lr ; calculate sum of negative differences
- orr r8, r8, r10 ; differences of all 4 pixels
-
- ; calculate total sum
- add r4, r4, r6 ; add positive differences to sum
- sub r4, r4, r7 ; subtract negative differences from sum
-
- ; calculate sse
- uxtb16 r7, r8 ; byte (two pixels) to halfwords
- uxtb16 r10, r8, ror #8 ; another two pixels to halfwords
- smlad r5, r7, r7, r5 ; dual signed multiply, add and accumulate (1)
- subs r12, r12, #1 ; next row
- smlad r5, r10, r10, r5 ; dual signed multiply, add and accumulate (2)
-
- bne loop8x8
-
- ; return stuff
- ldr r8, [sp, #32] ; get address of sse
- mul r1, r4, r4 ; sum * sum
- str r5, [r8] ; store sse
- sub r0, r5, r1, ASR #6 ; return (sse - ((sum * sum) >> 6))
-
- pop {r4-r10, pc}
-
- ENDP
-
-; r0 unsigned char *src_ptr
-; r1 int source_stride
-; r2 unsigned char *ref_ptr
-; r3 int recon_stride
-; stack unsigned int *sse
-;
-;note: Based on aom_variance16x16_media. In this function, sum is never used.
-; So, we can remove this part of calculation.
-
-|aom_mse16x16_media| PROC
-
- push {r4-r9, lr}
-
- pld [r0, r1, lsl #0]
- pld [r2, r3, lsl #0]
-
- mov r12, #16 ; set loop counter to 16 (=block height)
- mov r4, #0 ; initialize sse = 0
-
-loopmse
- ; 1st 4 pixels
- ldr r5, [r0, #0x0] ; load 4 src pixels
- ldr r6, [r2, #0x0] ; load 4 ref pixels
-
- mov lr, #0 ; constant zero
-
- usub8 r8, r5, r6 ; calculate difference
- pld [r0, r1, lsl #1]
- sel r7, r8, lr ; select bytes with positive difference
- usub8 r9, r6, r5 ; calculate difference with reversed operands
- pld [r2, r3, lsl #1]
- sel r8, r9, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r5, r7, lr ; calculate sum of positive differences
- usad8 r6, r8, lr ; calculate sum of negative differences
- orr r8, r8, r7 ; differences of all 4 pixels
-
- ldr r5, [r0, #0x4] ; load 4 src pixels
-
- ; calculate sse
- uxtb16 r6, r8 ; byte (two pixels) to halfwords
- uxtb16 r7, r8, ror #8 ; another two pixels to halfwords
- smlad r4, r6, r6, r4 ; dual signed multiply, add and accumulate (1)
-
- ; 2nd 4 pixels
- ldr r6, [r2, #0x4] ; load 4 ref pixels
- smlad r4, r7, r7, r4 ; dual signed multiply, add and accumulate (2)
-
- usub8 r8, r5, r6 ; calculate difference
- sel r7, r8, lr ; select bytes with positive difference
- usub8 r9, r6, r5 ; calculate difference with reversed operands
- sel r8, r9, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r5, r7, lr ; calculate sum of positive differences
- usad8 r6, r8, lr ; calculate sum of negative differences
- orr r8, r8, r7 ; differences of all 4 pixels
- ldr r5, [r0, #0x8] ; load 4 src pixels
- ; calculate sse
- uxtb16 r6, r8 ; byte (two pixels) to halfwords
- uxtb16 r7, r8, ror #8 ; another two pixels to halfwords
- smlad r4, r6, r6, r4 ; dual signed multiply, add and accumulate (1)
-
- ; 3rd 4 pixels
- ldr r6, [r2, #0x8] ; load 4 ref pixels
- smlad r4, r7, r7, r4 ; dual signed multiply, add and accumulate (2)
-
- usub8 r8, r5, r6 ; calculate difference
- sel r7, r8, lr ; select bytes with positive difference
- usub8 r9, r6, r5 ; calculate difference with reversed operands
- sel r8, r9, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r5, r7, lr ; calculate sum of positive differences
- usad8 r6, r8, lr ; calculate sum of negative differences
- orr r8, r8, r7 ; differences of all 4 pixels
-
- ldr r5, [r0, #0xc] ; load 4 src pixels
-
- ; calculate sse
- uxtb16 r6, r8 ; byte (two pixels) to halfwords
- uxtb16 r7, r8, ror #8 ; another two pixels to halfwords
- smlad r4, r6, r6, r4 ; dual signed multiply, add and accumulate (1)
-
- ; 4th 4 pixels
- ldr r6, [r2, #0xc] ; load 4 ref pixels
- smlad r4, r7, r7, r4 ; dual signed multiply, add and accumulate (2)
-
- usub8 r8, r5, r6 ; calculate difference
- add r0, r0, r1 ; set src_ptr to next row
- sel r7, r8, lr ; select bytes with positive difference
- usub8 r9, r6, r5 ; calculate difference with reversed operands
- add r2, r2, r3 ; set dst_ptr to next row
- sel r8, r9, lr ; select bytes with negative difference
-
- ; calculate partial sums
- usad8 r5, r7, lr ; calculate sum of positive differences
- usad8 r6, r8, lr ; calculate sum of negative differences
- orr r8, r8, r7 ; differences of all 4 pixels
-
- subs r12, r12, #1 ; next row
-
- ; calculate sse
- uxtb16 r6, r8 ; byte (two pixels) to halfwords
- uxtb16 r7, r8, ror #8 ; another two pixels to halfwords
- smlad r4, r6, r6, r4 ; dual signed multiply, add and accumulate (1)
- smlad r4, r7, r7, r4 ; dual signed multiply, add and accumulate (2)
-
- bne loopmse
-
- ; return stuff
- ldr r1, [sp, #28] ; get address of sse
- mov r0, r4 ; return sse
- str r4, [r1] ; store sse
-
- pop {r4-r9, pc}
-
- ENDP
-
- END
diff --git a/third_party/aom/aom_dsp/avg.c b/third_party/aom/aom_dsp/avg.c
index eb6059705..f732224fd 100644
--- a/third_party/aom/aom_dsp/avg.c
+++ b/third_party/aom/aom_dsp/avg.c
@@ -13,26 +13,6 @@
#include "./aom_dsp_rtcd.h"
#include "aom_ports/mem.h"
-unsigned int aom_avg_8x8_c(const uint8_t *src, int stride) {
- int i, j;
- int sum = 0;
- for (i = 0; i < 8; ++i, src += stride)
- for (j = 0; j < 8; sum += src[j], ++j) {
- }
-
- return ROUND_POWER_OF_TWO(sum, 6);
-}
-
-unsigned int aom_avg_4x4_c(const uint8_t *src, int stride) {
- int i, j;
- int sum = 0;
- for (i = 0; i < 4; ++i, src += stride)
- for (j = 0; j < 4; sum += src[j], ++j) {
- }
-
- return ROUND_POWER_OF_TWO(sum, 4);
-}
-
// src_diff: first pass, 9 bit, dynamic range [-255, 255]
// second pass, 12 bit, dynamic range [-2040, 2040]
static void hadamard_col8(const int16_t *src_diff, int src_stride,
@@ -192,28 +172,6 @@ void aom_minmax_8x8_c(const uint8_t *src, int src_stride, const uint8_t *ref,
}
#if CONFIG_HIGHBITDEPTH
-unsigned int aom_highbd_avg_8x8_c(const uint8_t *src, int stride) {
- int i, j;
- int sum = 0;
- const uint16_t *s = CONVERT_TO_SHORTPTR(src);
- for (i = 0; i < 8; ++i, s += stride)
- for (j = 0; j < 8; sum += s[j], ++j) {
- }
-
- return ROUND_POWER_OF_TWO(sum, 6);
-}
-
-unsigned int aom_highbd_avg_4x4_c(const uint8_t *src, int stride) {
- int i, j;
- int sum = 0;
- const uint16_t *s = CONVERT_TO_SHORTPTR(src);
- for (i = 0; i < 4; ++i, s += stride)
- for (j = 0; j < 4; sum += s[j], ++j) {
- }
-
- return ROUND_POWER_OF_TWO(sum, 4);
-}
-
void aom_highbd_minmax_8x8_c(const uint8_t *s8, int p, const uint8_t *d8,
int dp, int *min, int *max) {
int i, j;
diff --git a/third_party/aom/aom_dsp/binary_codes_reader.c b/third_party/aom/aom_dsp/binary_codes_reader.c
index 96c4cb436..bf304dada 100644
--- a/third_party/aom/aom_dsp/binary_codes_reader.c
+++ b/third_party/aom/aom_dsp/binary_codes_reader.c
@@ -9,7 +9,7 @@
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
-#include "aom_dsp/bitreader.h"
+#include "aom_dsp/binary_codes_reader.h"
#include "av1/common/common.h"
@@ -33,26 +33,28 @@ static uint16_t inv_recenter_finite_nonneg(uint16_t n, uint16_t r, uint16_t v) {
}
}
-int16_t aom_read_primitive_symmetric(aom_reader *r, unsigned int mag_bits) {
- if (aom_read_bit(r, NULL)) {
- int s = aom_read_bit(r, NULL);
- int16_t x = aom_read_literal(r, mag_bits, NULL) + 1;
+int16_t aom_read_primitive_symmetric_(aom_reader *r,
+ unsigned int mag_bits ACCT_STR_PARAM) {
+ if (aom_read_bit(r, ACCT_STR_NAME)) {
+ int s = aom_read_bit(r, ACCT_STR_NAME);
+ int16_t x = aom_read_literal(r, mag_bits, ACCT_STR_NAME) + 1;
return (s > 0 ? -x : x);
} else {
return 0;
}
}
-uint16_t aom_read_primitive_quniform(aom_reader *r, uint16_t n) {
+uint16_t aom_read_primitive_quniform_(aom_reader *r,
+ uint16_t n ACCT_STR_PARAM) {
if (n <= 1) return 0;
const int l = get_msb(n - 1) + 1;
const int m = (1 << l) - n;
- const int v = aom_read_literal(r, l - 1, NULL);
- return v < m ? v : (v << 1) - m + aom_read_bit(r, NULL);
+ const int v = aom_read_literal(r, l - 1, ACCT_STR_NAME);
+ return v < m ? v : (v << 1) - m + aom_read_bit(r, ACCT_STR_NAME);
}
-uint16_t aom_read_primitive_refbilevel(aom_reader *r, uint16_t n, uint16_t p,
- uint16_t ref) {
+uint16_t aom_read_primitive_refbilevel_(aom_reader *r, uint16_t n, uint16_t p,
+ uint16_t ref ACCT_STR_PARAM) {
if (n <= 1) return 0;
assert(p > 0 && p <= n);
assert(ref < n);
@@ -64,10 +66,10 @@ uint16_t aom_read_primitive_refbilevel(aom_reader *r, uint16_t n, uint16_t p,
lolimit = n - p;
}
int v;
- if (aom_read_bit(r, NULL)) {
- v = aom_read_primitive_quniform(r, p) + lolimit;
+ if (aom_read_bit(r, ACCT_STR_NAME)) {
+ v = aom_read_primitive_quniform(r, p, ACCT_STR_NAME) + lolimit;
} else {
- v = aom_read_primitive_quniform(r, n - p);
+ v = aom_read_primitive_quniform(r, n - p, ACCT_STR_NAME);
if (v >= lolimit) v += p;
}
return v;
@@ -75,7 +77,8 @@ uint16_t aom_read_primitive_refbilevel(aom_reader *r, uint16_t n, uint16_t p,
// Decode finite subexponential code that for a symbol v in [0, n-1] with
// parameter k
-uint16_t aom_read_primitive_subexpfin(aom_reader *r, uint16_t n, uint16_t k) {
+uint16_t aom_read_primitive_subexpfin_(aom_reader *r, uint16_t n,
+ uint16_t k ACCT_STR_PARAM) {
int i = 0;
int mk = 0;
uint16_t v;
@@ -83,14 +86,14 @@ uint16_t aom_read_primitive_subexpfin(aom_reader *r, uint16_t n, uint16_t k) {
int b = (i ? k + i - 1 : k);
int a = (1 << b);
if (n <= mk + 3 * a) {
- v = aom_read_primitive_quniform(r, n - mk) + mk;
+ v = aom_read_primitive_quniform(r, n - mk, ACCT_STR_NAME) + mk;
break;
} else {
- if (aom_read_bit(r, NULL)) {
+ if (aom_read_bit(r, ACCT_STR_NAME)) {
i = i + 1;
mk += a;
} else {
- v = aom_read_literal(r, b, NULL) + mk;
+ v = aom_read_literal(r, b, ACCT_STR_NAME) + mk;
break;
}
}
@@ -101,17 +104,19 @@ uint16_t aom_read_primitive_subexpfin(aom_reader *r, uint16_t n, uint16_t k) {
// Decode finite subexponential code that for a symbol v in [0, n-1] with
// parameter k
// based on a reference ref also in [0, n-1].
-uint16_t aom_read_primitive_refsubexpfin(aom_reader *r, uint16_t n, uint16_t k,
- uint16_t ref) {
- return inv_recenter_finite_nonneg(n, ref,
- aom_read_primitive_subexpfin(r, n, k));
+uint16_t aom_read_primitive_refsubexpfin_(aom_reader *r, uint16_t n, uint16_t k,
+ uint16_t ref ACCT_STR_PARAM) {
+ return inv_recenter_finite_nonneg(
+ n, ref, aom_read_primitive_subexpfin(r, n, k, ACCT_STR_NAME));
}
// Decode finite subexponential code that for a symbol v in [-(n-1), n-1] with
// parameter k based on a reference ref also in [-(n-1), n-1].
-int16_t aom_read_signed_primitive_refsubexpfin(aom_reader *r, uint16_t n,
- uint16_t k, int16_t ref) {
+int16_t aom_read_signed_primitive_refsubexpfin_(aom_reader *r, uint16_t n,
+ uint16_t k,
+ int16_t ref ACCT_STR_PARAM) {
ref += n - 1;
const uint16_t scaled_n = (n << 1) - 1;
- return aom_read_primitive_refsubexpfin(r, scaled_n, k, ref) - n + 1;
+ return aom_read_primitive_refsubexpfin(r, scaled_n, k, ref, ACCT_STR_NAME) -
+ n + 1;
}
diff --git a/third_party/aom/aom_dsp/binary_codes_reader.h b/third_party/aom/aom_dsp/binary_codes_reader.h
index 738d91da8..1540cf46b 100644
--- a/third_party/aom/aom_dsp/binary_codes_reader.h
+++ b/third_party/aom/aom_dsp/binary_codes_reader.h
@@ -21,16 +21,32 @@ extern "C" {
#include "aom/aom_integer.h"
#include "aom_dsp/bitreader.h"
-int16_t aom_read_primitive_symmetric(aom_reader *r, unsigned int mag_bits);
+#define aom_read_primitive_symmetric(r, n, ACCT_STR_NAME) \
+ aom_read_primitive_symmetric_(r, n ACCT_STR_ARG(ACCT_STR_NAME))
+#define aom_read_primitive_quniform(r, n, ACCT_STR_NAME) \
+ aom_read_primitive_quniform_(r, n ACCT_STR_ARG(ACCT_STR_NAME))
+#define aom_read_primitive_refbilevel(r, n, p, ref, ACCT_STR_NAME) \
+ aom_read_primitive_refbilevel_(r, n, p, ref ACCT_STR_ARG(ACCT_STR_NAME))
+#define aom_read_primitive_subexpfin(r, n, k, ACCT_STR_NAME) \
+ aom_read_primitive_subexpfin_(r, n, k ACCT_STR_ARG(ACCT_STR_NAME))
+#define aom_read_primitive_refsubexpfin(r, n, k, ref, ACCT_STR_NAME) \
+ aom_read_primitive_refsubexpfin_(r, n, k, ref ACCT_STR_ARG(ACCT_STR_NAME))
+#define aom_read_signed_primitive_refsubexpfin(r, n, k, ref, ACCT_STR_NAME) \
+ aom_read_signed_primitive_refsubexpfin_(r, n, k, \
+ ref ACCT_STR_ARG(ACCT_STR_NAME))
-uint16_t aom_read_primitive_quniform(aom_reader *r, uint16_t n);
-uint16_t aom_read_primitive_refbilevel(aom_reader *r, uint16_t n, uint16_t p,
- uint16_t ref);
-uint16_t aom_read_primitive_subexpfin(aom_reader *r, uint16_t n, uint16_t k);
-uint16_t aom_read_primitive_refsubexpfin(aom_reader *r, uint16_t n, uint16_t k,
- uint16_t ref);
-int16_t aom_read_signed_primitive_refsubexpfin(aom_reader *r, uint16_t n,
- uint16_t k, int16_t ref);
+int16_t aom_read_primitive_symmetric_(aom_reader *r,
+ unsigned int mag_bits ACCT_STR_PARAM);
+uint16_t aom_read_primitive_quniform_(aom_reader *r, uint16_t n ACCT_STR_PARAM);
+uint16_t aom_read_primitive_refbilevel_(aom_reader *r, uint16_t n, uint16_t p,
+ uint16_t ref ACCT_STR_PARAM);
+uint16_t aom_read_primitive_subexpfin_(aom_reader *r, uint16_t n,
+ uint16_t k ACCT_STR_PARAM);
+uint16_t aom_read_primitive_refsubexpfin_(aom_reader *r, uint16_t n, uint16_t k,
+ uint16_t ref ACCT_STR_PARAM);
+int16_t aom_read_signed_primitive_refsubexpfin_(aom_reader *r, uint16_t n,
+ uint16_t k,
+ int16_t ref ACCT_STR_PARAM);
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/third_party/aom/aom_dsp/bitreader.h b/third_party/aom/aom_dsp/bitreader.h
index 9cd34dd48..5bad70cb3 100644
--- a/third_party/aom/aom_dsp/bitreader.h
+++ b/third_party/aom/aom_dsp/bitreader.h
@@ -16,18 +16,13 @@
#include <limits.h>
#include "./aom_config.h"
-#if CONFIG_EC_ADAPT && !CONFIG_EC_MULTISYMBOL
-#error "CONFIG_EC_ADAPT is enabled without enabling CONFIG_EC_MULTISYMBOL."
-#endif
#include "aom/aomdx.h"
#include "aom/aom_integer.h"
#if CONFIG_ANS
#include "aom_dsp/ansreader.h"
-#elif CONFIG_DAALA_EC
-#include "aom_dsp/daalaboolreader.h"
#else
-#include "aom_dsp/dkboolreader.h"
+#include "aom_dsp/daalaboolreader.h"
#endif
#include "aom_dsp/prob.h"
#include "av1/common/odintrin.h"
@@ -61,26 +56,20 @@ extern "C" {
#if CONFIG_ANS
typedef struct AnsDecoder aom_reader;
-#elif CONFIG_DAALA_EC
-typedef struct daala_reader aom_reader;
#else
-typedef struct aom_dk_reader aom_reader;
+typedef struct daala_reader aom_reader;
#endif
static INLINE int aom_reader_init(aom_reader *r, const uint8_t *buffer,
size_t size, aom_decrypt_cb decrypt_cb,
void *decrypt_state) {
-#if CONFIG_ANS
(void)decrypt_cb;
(void)decrypt_state;
+#if CONFIG_ANS
if (size > INT_MAX) return 1;
return ans_read_init(r, buffer, (int)size);
-#elif CONFIG_DAALA_EC
- (void)decrypt_cb;
- (void)decrypt_state;
- return aom_daala_reader_init(r, buffer, (int)size);
#else
- return aom_dk_reader_init(r, buffer, size, decrypt_cb, decrypt_state);
+ return aom_daala_reader_init(r, buffer, (int)size);
#endif
}
@@ -89,20 +78,16 @@ static INLINE const uint8_t *aom_reader_find_end(aom_reader *r) {
(void)r;
assert(0 && "Use the raw buffer size with ANS");
return NULL;
-#elif CONFIG_DAALA_EC
- return aom_daala_reader_find_end(r);
#else
- return aom_dk_reader_find_end(r);
+ return aom_daala_reader_find_end(r);
#endif
}
static INLINE int aom_reader_has_error(aom_reader *r) {
#if CONFIG_ANS
return ans_reader_has_error(r);
-#elif CONFIG_DAALA_EC
- return aom_daala_reader_has_error(r);
#else
- return aom_dk_reader_has_error(r);
+ return aom_daala_reader_has_error(r);
#endif
}
@@ -112,10 +97,8 @@ static INLINE uint32_t aom_reader_tell(const aom_reader *r) {
(void)r;
assert(0 && "aom_reader_tell() is unimplemented for ANS");
return 0;
-#elif CONFIG_DAALA_EC
- return aom_daala_reader_tell(r);
#else
- return aom_dk_reader_tell(r);
+ return aom_daala_reader_tell(r);
#endif
}
@@ -125,10 +108,8 @@ static INLINE uint32_t aom_reader_tell_frac(const aom_reader *r) {
(void)r;
assert(0 && "aom_reader_tell_frac() is unimplemented for ANS");
return 0;
-#elif CONFIG_DAALA_EC
- return aom_daala_reader_tell_frac(r);
#else
- return aom_dk_reader_tell_frac(r);
+ return aom_daala_reader_tell_frac(r);
#endif
}
@@ -155,10 +136,8 @@ static INLINE int aom_read_(aom_reader *r, int prob ACCT_STR_PARAM) {
int ret;
#if CONFIG_ANS
ret = rabs_read(r, prob);
-#elif CONFIG_DAALA_EC
- ret = aom_daala_read(r, prob);
#else
- ret = aom_dk_read(r, prob);
+ ret = aom_daala_read(r, prob);
#endif
#if CONFIG_ACCOUNTING
if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME);
@@ -171,7 +150,7 @@ static INLINE int aom_read_bit_(aom_reader *r ACCT_STR_PARAM) {
int ret;
#if CONFIG_ANS
ret = rabs_read_bit(r); // Non trivial optimization at half probability
-#elif CONFIG_DAALA_EC && CONFIG_RAWBITS
+#elif CONFIG_RAWBITS
// Note this uses raw bits and is not the same as aom_daala_read(r, 128);
// Calls to this function are omitted from raw symbol accounting.
ret = aom_daala_read_bit(r);
@@ -194,28 +173,14 @@ static INLINE int aom_read_literal_(aom_reader *r, int bits ACCT_STR_PARAM) {
return literal;
}
-static INLINE int aom_read_tree_as_bits(aom_reader *r,
- const aom_tree_index *tree,
- const aom_prob *probs) {
- aom_tree_index i = 0;
-
- while ((i = tree[i + aom_read(r, probs[i >> 1], NULL)]) > 0) continue;
- return -i;
-}
-
-#if CONFIG_EC_MULTISYMBOL
static INLINE int aom_read_cdf_(aom_reader *r, const aom_cdf_prob *cdf,
int nsymbs ACCT_STR_PARAM) {
int ret;
#if CONFIG_ANS
(void)nsymbs;
ret = rans_read(r, cdf);
-#elif CONFIG_DAALA_EC
- ret = daala_read_symbol(r, cdf, nsymbs);
#else
-#error \
- "CONFIG_EC_MULTISYMBOL is selected without a valid backing entropy " \
- "coder. Enable daala_ec or ans for a valid configuration."
+ ret = daala_read_symbol(r, cdf, nsymbs);
#endif
#if CONFIG_ACCOUNTING
@@ -253,16 +218,11 @@ static INLINE int aom_read_tree_as_cdf(aom_reader *r,
} while (i > 0);
return -i;
}
-#endif // CONFIG_EC_MULTISYMBOL
static INLINE int aom_read_tree_(aom_reader *r, const aom_tree_index *tree,
const aom_prob *probs ACCT_STR_PARAM) {
int ret;
-#if CONFIG_EC_MULTISYMBOL
ret = aom_read_tree_as_cdf(r, tree, probs);
-#else
- ret = aom_read_tree_as_bits(r, tree, probs);
-#endif
#if CONFIG_ACCOUNTING
if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME);
#endif
diff --git a/third_party/aom/aom_dsp/bitreader_buffer.c b/third_party/aom/aom_dsp/bitreader_buffer.c
index 009682b4c..e51b1cc3a 100644
--- a/third_party/aom/aom_dsp/bitreader_buffer.c
+++ b/third_party/aom/aom_dsp/bitreader_buffer.c
@@ -24,7 +24,7 @@ int aom_rb_read_bit(struct aom_read_bit_buffer *rb) {
rb->bit_offset = off + 1;
return bit;
} else {
- rb->error_handler(rb->error_handler_data);
+ if (rb->error_handler) rb->error_handler(rb->error_handler_data);
return 0;
}
}
diff --git a/third_party/aom/aom_dsp/bitwriter.h b/third_party/aom/aom_dsp/bitwriter.h
index 6e3fac260..588e47bf3 100644
--- a/third_party/aom/aom_dsp/bitwriter.h
+++ b/third_party/aom/aom_dsp/bitwriter.h
@@ -14,16 +14,11 @@
#include <assert.h>
#include "./aom_config.h"
-#if CONFIG_EC_ADAPT && !CONFIG_EC_MULTISYMBOL
-#error "CONFIG_EC_ADAPT is enabled without enabling CONFIG_EC_MULTISYMBOL"
-#endif
#if CONFIG_ANS
#include "aom_dsp/buf_ans.h"
-#elif CONFIG_DAALA_EC
-#include "aom_dsp/daalaboolwriter.h"
#else
-#include "aom_dsp/dkboolwriter.h"
+#include "aom_dsp/daalaboolwriter.h"
#endif
#include "aom_dsp/prob.h"
@@ -38,10 +33,8 @@ extern "C" {
#if CONFIG_ANS
typedef struct BufAnsCoder aom_writer;
-#elif CONFIG_DAALA_EC
-typedef struct daala_writer aom_writer;
#else
-typedef struct aom_dk_writer aom_writer;
+typedef struct daala_writer aom_writer;
#endif
typedef struct TOKEN_STATS {
@@ -72,10 +65,8 @@ static INLINE void aom_start_encode(aom_writer *bc, uint8_t *buffer) {
(void)bc;
(void)buffer;
assert(0 && "buf_ans requires a more complicated startup procedure");
-#elif CONFIG_DAALA_EC
- aom_daala_start_encode(bc, buffer);
#else
- aom_dk_start_encode(bc, buffer);
+ aom_daala_start_encode(bc, buffer);
#endif
}
@@ -83,20 +74,16 @@ static INLINE void aom_stop_encode(aom_writer *bc) {
#if CONFIG_ANS
(void)bc;
assert(0 && "buf_ans requires a more complicated shutdown procedure");
-#elif CONFIG_DAALA_EC
- aom_daala_stop_encode(bc);
#else
- aom_dk_stop_encode(bc);
+ aom_daala_stop_encode(bc);
#endif
}
static INLINE void aom_write(aom_writer *br, int bit, int probability) {
#if CONFIG_ANS
buf_rabs_write(br, bit, probability);
-#elif CONFIG_DAALA_EC
- aom_daala_write(br, bit, probability);
#else
- aom_dk_write(br, bit, probability);
+ aom_daala_write(br, bit, probability);
#endif
}
@@ -113,7 +100,7 @@ static INLINE void aom_write_record(aom_writer *br, int bit, int probability,
static INLINE void aom_write_bit(aom_writer *w, int bit) {
#if CONFIG_ANS
buf_rabs_write_bit(w, bit);
-#elif CONFIG_DAALA_EC && CONFIG_RAWBITS
+#elif CONFIG_RAWBITS
// Note this uses raw bits and is not the same as aom_daala_write(r, 128);
aom_daala_write_bit(w, bit);
#else
@@ -137,28 +124,6 @@ static INLINE void aom_write_literal(aom_writer *w, int data, int bits) {
for (bit = bits - 1; bit >= 0; bit--) aom_write_bit(w, 1 & (data >> bit));
}
-static INLINE void aom_write_tree_as_bits(aom_writer *w,
- const aom_tree_index *tr,
- const aom_prob *probs, int bits,
- int len, aom_tree_index i) {
- do {
- const int bit = (bits >> --len) & 1;
- aom_write(w, bit, probs[i >> 1]);
- i = tr[i + bit];
- } while (len);
-}
-
-static INLINE void aom_write_tree_as_bits_record(
- aom_writer *w, const aom_tree_index *tr, const aom_prob *probs, int bits,
- int len, aom_tree_index i, TOKEN_STATS *token_stats) {
- do {
- const int bit = (bits >> --len) & 1;
- aom_write_record(w, bit, probs[i >> 1], token_stats);
- i = tr[i + bit];
- } while (len);
-}
-
-#if CONFIG_EC_MULTISYMBOL
static INLINE void aom_write_cdf(aom_writer *w, int symb,
const aom_cdf_prob *cdf, int nsymbs) {
#if CONFIG_ANS
@@ -167,12 +132,8 @@ static INLINE void aom_write_cdf(aom_writer *w, int symb,
const aom_cdf_prob cum_prob = symb > 0 ? cdf[symb - 1] : 0;
const aom_cdf_prob prob = cdf[symb] - cum_prob;
buf_rans_write(w, cum_prob, prob);
-#elif CONFIG_DAALA_EC
- daala_write_symbol(w, symb, cdf, nsymbs);
#else
-#error \
- "CONFIG_EC_MULTISYMBOL is selected without a valid backing entropy " \
- "coder. Enable daala_ec or ans for a valid configuration."
+ daala_write_symbol(w, symb, cdf, nsymbs);
#endif
}
@@ -223,16 +184,10 @@ static INLINE void aom_write_tree_as_cdf(aom_writer *w,
} while (len);
}
-#endif // CONFIG_EC_MULTISYMBOL
-
static INLINE void aom_write_tree(aom_writer *w, const aom_tree_index *tree,
const aom_prob *probs, int bits, int len,
aom_tree_index i) {
-#if CONFIG_EC_MULTISYMBOL
aom_write_tree_as_cdf(w, tree, probs, bits, len, i);
-#else
- aom_write_tree_as_bits(w, tree, probs, bits, len, i);
-#endif
}
static INLINE void aom_write_tree_record(aom_writer *w,
@@ -240,12 +195,8 @@ static INLINE void aom_write_tree_record(aom_writer *w,
const aom_prob *probs, int bits,
int len, aom_tree_index i,
TOKEN_STATS *token_stats) {
-#if CONFIG_EC_MULTISYMBOL
(void)token_stats;
aom_write_tree_as_cdf(w, tree, probs, bits, len, i);
-#else
- aom_write_tree_as_bits_record(w, tree, probs, bits, len, i, token_stats);
-#endif
}
#ifdef __cplusplus
diff --git a/third_party/aom/aom_dsp/dkboolreader.c b/third_party/aom/aom_dsp/dkboolreader.c
deleted file mode 100644
index 288d5f1ce..000000000
--- a/third_party/aom/aom_dsp/dkboolreader.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved
- *
- * This source code is subject to the terms of the BSD 2 Clause License and
- * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
- * was not distributed with this source code in the LICENSE file, you can
- * obtain it at www.aomedia.org/license/software. If the Alliance for Open
- * Media Patent License 1.0 was not distributed with this source code in the
- * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
- */
-
-#include <stdlib.h>
-
-#include "./aom_config.h"
-
-#include "aom_dsp/dkboolreader.h"
-#include "aom_dsp/prob.h"
-#include "aom_dsp/aom_dsp_common.h"
-#include "aom_ports/mem.h"
-#include "aom_mem/aom_mem.h"
-#include "aom_util/endian_inl.h"
-
-static INLINE int aom_dk_read_bit(struct aom_dk_reader *r) {
- return aom_dk_read(r, 128); // aom_prob_half
-}
-
-int aom_dk_reader_init(struct aom_dk_reader *r, const uint8_t *buffer,
- size_t size, aom_decrypt_cb decrypt_cb,
- void *decrypt_state) {
- if (size && !buffer) {
- return 1;
- } else {
- r->buffer_end = buffer + size;
- r->buffer_start = r->buffer = buffer;
- r->value = 0;
- r->count = -8;
- r->range = 255;
- r->decrypt_cb = decrypt_cb;
- r->decrypt_state = decrypt_state;
- aom_dk_reader_fill(r);
-#if CONFIG_ACCOUNTING
- r->accounting = NULL;
-#endif
- return aom_dk_read_bit(r) != 0; // marker bit
- }
-}
-
-void aom_dk_reader_fill(struct aom_dk_reader *r) {
- const uint8_t *const buffer_end = r->buffer_end;
- const uint8_t *buffer = r->buffer;
- const uint8_t *buffer_start = buffer;
- BD_VALUE value = r->value;
- int count = r->count;
- const size_t bytes_left = buffer_end - buffer;
- const size_t bits_left = bytes_left * CHAR_BIT;
- int shift = BD_VALUE_SIZE - CHAR_BIT - (count + CHAR_BIT);
-
- if (r->decrypt_cb) {
- size_t n = AOMMIN(sizeof(r->clear_buffer), bytes_left);
- r->decrypt_cb(r->decrypt_state, buffer, r->clear_buffer, (int)n);
- buffer = r->clear_buffer;
- buffer_start = r->clear_buffer;
- }
- if (bits_left > BD_VALUE_SIZE) {
- const int bits = (shift & 0xfffffff8) + CHAR_BIT;
- BD_VALUE nv;
- BD_VALUE big_endian_values;
- memcpy(&big_endian_values, buffer, sizeof(BD_VALUE));
-#if SIZE_MAX == 0xffffffffffffffffULL
- big_endian_values = HToBE64(big_endian_values);
-#else
- big_endian_values = HToBE32(big_endian_values);
-#endif
- nv = big_endian_values >> (BD_VALUE_SIZE - bits);
- count += bits;
- buffer += (bits >> 3);
- value = r->value | (nv << (shift & 0x7));
- } else {
- const int bits_over = (int)(shift + CHAR_BIT - (int)bits_left);
- int loop_end = 0;
- if (bits_over >= 0) {
- count += LOTS_OF_BITS;
- loop_end = bits_over;
- }
-
- if (bits_over < 0 || bits_left) {
- while (shift >= loop_end) {
- count += CHAR_BIT;
- value |= (BD_VALUE)*buffer++ << shift;
- shift -= CHAR_BIT;
- }
- }
- }
-
- // NOTE: Variable 'buffer' may not relate to 'r->buffer' after decryption,
- // so we increase 'r->buffer' by the amount that 'buffer' moved, rather than
- // assign 'buffer' to 'r->buffer'.
- r->buffer += buffer - buffer_start;
- r->value = value;
- r->count = count;
-}
-
-const uint8_t *aom_dk_reader_find_end(struct aom_dk_reader *r) {
- // Find the end of the coded buffer
- while (r->count > CHAR_BIT && r->count < BD_VALUE_SIZE) {
- r->count -= CHAR_BIT;
- r->buffer--;
- }
- return r->buffer;
-}
diff --git a/third_party/aom/aom_dsp/dkboolreader.h b/third_party/aom/aom_dsp/dkboolreader.h
deleted file mode 100644
index f0bc84381..000000000
--- a/third_party/aom/aom_dsp/dkboolreader.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved
- *
- * This source code is subject to the terms of the BSD 2 Clause License and
- * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
- * was not distributed with this source code in the LICENSE file, you can
- * obtain it at www.aomedia.org/license/software. If the Alliance for Open
- * Media Patent License 1.0 was not distributed with this source code in the
- * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
- */
-
-#ifndef AOM_DSP_DKBOOLREADER_H_
-#define AOM_DSP_DKBOOLREADER_H_
-
-#include <assert.h>
-#include <stddef.h>
-#include <limits.h>
-
-#include "./aom_config.h"
-#if CONFIG_BITSTREAM_DEBUG
-#include <assert.h>
-#include <stdio.h>
-#include "aom_util/debug_util.h"
-#endif // CONFIG_BITSTREAM_DEBUG
-
-#include "aom_ports/mem.h"
-#include "aom/aomdx.h"
-#include "aom/aom_integer.h"
-#include "aom_dsp/prob.h"
-#if CONFIG_ACCOUNTING
-#include "av1/decoder/accounting.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef size_t BD_VALUE;
-
-#define BD_VALUE_SIZE ((int)sizeof(BD_VALUE) * CHAR_BIT)
-
-// This is meant to be a large, positive constant that can still be efficiently
-// loaded as an immediate (on platforms like ARM, for example).
-// Even relatively modest values like 100 would work fine.
-#define LOTS_OF_BITS 0x40000000
-
-struct aom_dk_reader {
- // Be careful when reordering this struct, it may impact the cache negatively.
- BD_VALUE value;
- unsigned int range;
- int count;
- const uint8_t *buffer_start;
- const uint8_t *buffer_end;
- const uint8_t *buffer;
- aom_decrypt_cb decrypt_cb;
- void *decrypt_state;
- uint8_t clear_buffer[sizeof(BD_VALUE) + 1];
-#if CONFIG_ACCOUNTING
- Accounting *accounting;
-#endif
-};
-
-int aom_dk_reader_init(struct aom_dk_reader *r, const uint8_t *buffer,
- size_t size, aom_decrypt_cb decrypt_cb,
- void *decrypt_state);
-
-void aom_dk_reader_fill(struct aom_dk_reader *r);
-
-const uint8_t *aom_dk_reader_find_end(struct aom_dk_reader *r);
-
-static INLINE uint32_t aom_dk_reader_tell(const struct aom_dk_reader *r) {
- const uint32_t bits_read =
- (uint32_t)((r->buffer - r->buffer_start) * CHAR_BIT);
- const int count =
- (r->count < LOTS_OF_BITS) ? r->count : r->count - LOTS_OF_BITS;
- assert(r->buffer >= r->buffer_start);
- return bits_read - (count + CHAR_BIT);
-}
-
-/*The resolution of fractional-precision bit usage measurements, i.e.,
- 3 => 1/8th bits.*/
-#define DK_BITRES (3)
-
-static INLINE uint32_t aom_dk_reader_tell_frac(const struct aom_dk_reader *r) {
- uint32_t num_bits;
- uint32_t range;
- int l;
- int i;
- num_bits = aom_dk_reader_tell(r) << DK_BITRES;
- range = r->range;
- l = 0;
- for (i = DK_BITRES; i-- > 0;) {
- int b;
- range = range * range >> 7;
- b = (int)(range >> 8);
- l = l << 1 | b;
- range >>= b;
- }
- return num_bits - l;
-}
-
-static INLINE int aom_dk_reader_has_error(struct aom_dk_reader *r) {
- // Check if we have reached the end of the buffer.
- //
- // Variable 'count' stores the number of bits in the 'value' buffer, minus
- // 8. The top byte is part of the algorithm, and the remainder is buffered
- // to be shifted into it. So if count == 8, the top 16 bits of 'value' are
- // occupied, 8 for the algorithm and 8 in the buffer.
- //
- // When reading a byte from the user's buffer, count is filled with 8 and
- // one byte is filled into the value buffer. When we reach the end of the
- // data, count is additionally filled with LOTS_OF_BITS. So when
- // count == LOTS_OF_BITS - 1, the user's data has been exhausted.
- //
- // 1 if we have tried to decode bits after the end of stream was encountered.
- // 0 No error.
- return r->count > BD_VALUE_SIZE && r->count < LOTS_OF_BITS;
-}
-
-static INLINE int aom_dk_read(struct aom_dk_reader *r, int prob) {
- unsigned int bit = 0;
- BD_VALUE value;
- BD_VALUE bigsplit;
- int count;
- unsigned int range;
- unsigned int split = (r->range * prob + (256 - prob)) >> CHAR_BIT;
-
- if (r->count < 0) aom_dk_reader_fill(r);
-
- value = r->value;
- count = r->count;
-
- bigsplit = (BD_VALUE)split << (BD_VALUE_SIZE - CHAR_BIT);
-
- range = split;
-
- if (value >= bigsplit) {
- range = r->range - split;
- value = value - bigsplit;
- bit = 1;
- }
-
- {
- register int shift = aom_norm[range];
- range <<= shift;
- value <<= shift;
- count -= shift;
- }
- r->value = value;
- r->count = count;
- r->range = range;
-
-#if CONFIG_BITSTREAM_DEBUG
- {
- int ref_bit, ref_prob;
- const int queue_r = bitstream_queue_get_read();
- const int frame_idx = bitstream_queue_get_frame_read();
- bitstream_queue_pop(&ref_bit, &ref_prob);
- if (prob != ref_prob) {
- fprintf(
- stderr,
- "\n *** prob error, frame_idx_r %d prob %d ref_prob %d queue_r %d\n",
- frame_idx, prob, ref_prob, queue_r);
- assert(0);
- }
- if ((int)bit != ref_bit) {
- fprintf(stderr, "\n *** bit error, frame_idx_r %d bit %d ref_bit %d\n",
- frame_idx, bit, ref_bit);
- assert(0);
- }
- }
-#endif // CONFIG_BITSTREAM_DEBUG
-
- return bit;
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // AOM_DSP_DKBOOLREADER_H_
diff --git a/third_party/aom/aom_dsp/dkboolwriter.c b/third_party/aom/aom_dsp/dkboolwriter.c
deleted file mode 100644
index fc98e7c9b..000000000
--- a/third_party/aom/aom_dsp/dkboolwriter.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved
- *
- * This source code is subject to the terms of the BSD 2 Clause License and
- * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
- * was not distributed with this source code in the LICENSE file, you can
- * obtain it at www.aomedia.org/license/software. If the Alliance for Open
- * Media Patent License 1.0 was not distributed with this source code in the
- * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
- */
-
-#include <assert.h>
-
-#include "./dkboolwriter.h"
-
-static INLINE void aom_dk_write_bit(aom_dk_writer *w, int bit) {
- aom_dk_write(w, bit, 128); // aom_prob_half
-}
-
-void aom_dk_start_encode(aom_dk_writer *br, uint8_t *source) {
- br->lowvalue = 0;
- br->range = 255;
- br->count = -24;
- br->buffer = source;
- br->pos = 0;
- aom_dk_write_bit(br, 0);
-}
-
-void aom_dk_stop_encode(aom_dk_writer *br) {
- int i;
-
-#if CONFIG_BITSTREAM_DEBUG
- bitstream_queue_set_skip_write(1);
-#endif // CONFIG_BITSTREAM_DEBUG
-
- for (i = 0; i < 32; i++) aom_dk_write_bit(br, 0);
-
-#if CONFIG_BITSTREAM_DEBUG
- bitstream_queue_set_skip_write(0);
-#endif // CONFIG_BITSTREAM_DEBUG
-
- // Ensure there's no ambigous collision with any index marker bytes
- if ((br->buffer[br->pos - 1] & 0xe0) == 0xc0) br->buffer[br->pos++] = 0;
-}
diff --git a/third_party/aom/aom_dsp/dkboolwriter.h b/third_party/aom/aom_dsp/dkboolwriter.h
deleted file mode 100644
index 835436885..000000000
--- a/third_party/aom/aom_dsp/dkboolwriter.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved
- *
- * This source code is subject to the terms of the BSD 2 Clause License and
- * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
- * was not distributed with this source code in the LICENSE file, you can
- * obtain it at www.aomedia.org/license/software. If the Alliance for Open
- * Media Patent License 1.0 was not distributed with this source code in the
- * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
- */
-
-#ifndef AOM_DSP_DKBOOLWRITER_H_
-#define AOM_DSP_DKBOOLWRITER_H_
-
-#include "./aom_config.h"
-
-#if CONFIG_BITSTREAM_DEBUG
-#include <stdio.h>
-#include "aom_util/debug_util.h"
-#endif // CONFIG_BITSTREAM_DEBUG
-
-#include "aom_dsp/prob.h"
-#include "aom_ports/mem.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct aom_dk_writer {
- unsigned int lowvalue;
- unsigned int range;
- int count;
- unsigned int pos;
- uint8_t *buffer;
-} aom_dk_writer;
-
-void aom_dk_start_encode(aom_dk_writer *bc, uint8_t *buffer);
-void aom_dk_stop_encode(aom_dk_writer *bc);
-
-static INLINE void aom_dk_write(aom_dk_writer *br, int bit, int probability) {
- unsigned int split;
- int count = br->count;
- unsigned int range = br->range;
- unsigned int lowvalue = br->lowvalue;
- register int shift;
-
-#if CONFIG_BITSTREAM_DEBUG
- // int queue_r = 0;
- // int frame_idx_r = 0;
- // int queue_w = bitstream_queue_get_write();
- // int frame_idx_w = bitstream_queue_get_frame_write();
- // if (frame_idx_w == frame_idx_r && queue_w == queue_r) {
- // fprintf(stderr, "\n *** bitstream queue at frame_idx_w %d queue_w %d\n",
- // frame_idx_w, queue_w);
- // }
- bitstream_queue_push(bit, probability);
-#endif // CONFIG_BITSTREAM_DEBUG
-
- split = 1 + (((range - 1) * probability) >> 8);
-
- range = split;
-
- if (bit) {
- lowvalue += split;
- range = br->range - split;
- }
-
- shift = aom_norm[range];
-
- range <<= shift;
- count += shift;
-
- if (count >= 0) {
- int offset = shift - count;
-
- if ((lowvalue << (offset - 1)) & 0x80000000) {
- int x = br->pos - 1;
-
- while (x >= 0 && br->buffer[x] == 0xff) {
- br->buffer[x] = 0;
- x--;
- }
-
- br->buffer[x] += 1;
- }
-
- br->buffer[br->pos++] = (lowvalue >> (24 - offset));
- lowvalue <<= offset;
- shift = count;
- lowvalue &= 0xffffff;
- count -= 8;
- }
-
- lowvalue <<= shift;
- br->count = count;
- br->lowvalue = lowvalue;
- br->range = range;
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // AOM_DSP_DKBOOLWRITER_H_
diff --git a/third_party/aom/aom_dsp/intrapred.c b/third_party/aom/aom_dsp/intrapred.c
index 1f0870b64..370d0374b 100644
--- a/third_party/aom/aom_dsp/intrapred.c
+++ b/third_party/aom/aom_dsp/intrapred.c
@@ -208,33 +208,30 @@ static const int sm_weight_log2_scale = 8;
#if CONFIG_TX64X64
// max(block_size_wide[BLOCK_LARGEST], block_size_high[BLOCK_LARGEST])
#define MAX_BLOCK_DIM 64
-#define NUM_BLOCK_DIMS 6 // log2(MAX_BLOCK_DIM)
#else
#define MAX_BLOCK_DIM 32
-#define NUM_BLOCK_DIMS 5
#endif // CONFIG_TX64X64
-static const uint8_t sm_weight_arrays[NUM_BLOCK_DIMS][MAX_BLOCK_DIM] = {
+static const uint8_t sm_weight_arrays[2 * MAX_BLOCK_DIM] = {
+ // Unused, because we always offset by bs, which is at least 2.
+ 0, 0,
// bs = 2
- { 255, 128 },
+ 255, 128,
// bs = 4
- { 255, 149, 85, 64 },
+ 255, 149, 85, 64,
// bs = 8
- { 255, 197, 146, 105, 73, 50, 37, 32 },
+ 255, 197, 146, 105, 73, 50, 37, 32,
// bs = 16
- { 255, 225, 196, 170, 145, 123, 102, 84, 68, 54, 43, 33, 26, 20, 17, 16 },
+ 255, 225, 196, 170, 145, 123, 102, 84, 68, 54, 43, 33, 26, 20, 17, 16,
// bs = 32
- {
- 255, 240, 225, 210, 196, 182, 169, 157, 145, 133, 122,
- 111, 101, 92, 83, 74, 66, 59, 52, 45, 39, 34,
- 29, 25, 21, 17, 14, 12, 10, 9, 8, 8 },
+ 255, 240, 225, 210, 196, 182, 169, 157, 145, 133, 122, 111, 101, 92, 83, 74,
+ 66, 59, 52, 45, 39, 34, 29, 25, 21, 17, 14, 12, 10, 9, 8, 8,
#if CONFIG_TX64X64
// bs = 64
- { 255, 248, 240, 233, 225, 218, 210, 203, 196, 189, 182, 176, 169,
- 163, 156, 150, 144, 138, 133, 127, 121, 116, 111, 106, 101, 96,
- 91, 86, 82, 77, 73, 69, 65, 61, 57, 54, 50, 47, 44,
- 41, 38, 35, 32, 29, 27, 25, 22, 20, 18, 16, 15, 13,
- 12, 10, 9, 8, 7, 6, 6, 5, 5, 4, 4, 4 },
+ 255, 248, 240, 233, 225, 218, 210, 203, 196, 189, 182, 176, 169, 163, 156,
+ 150, 144, 138, 133, 127, 121, 116, 111, 106, 101, 96, 91, 86, 82, 77, 73, 69,
+ 65, 61, 57, 54, 50, 47, 44, 41, 38, 35, 32, 29, 27, 25, 22, 20, 18, 16, 15,
+ 13, 12, 10, 9, 8, 7, 6, 6, 5, 5, 4, 4, 4,
#endif // CONFIG_TX64X64
};
@@ -250,10 +247,7 @@ static INLINE void smooth_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
const uint8_t *above, const uint8_t *left) {
const uint8_t below_pred = left[bs - 1]; // estimated by bottom-left pixel
const uint8_t right_pred = above[bs - 1]; // estimated by top-right pixel
- const int arr_index = get_msb(bs) - 1;
- assert(arr_index >= 0);
- assert(arr_index < NUM_BLOCK_DIMS);
- const uint8_t *const sm_weights = sm_weight_arrays[arr_index];
+ const uint8_t *const sm_weights = sm_weight_arrays + bs;
// scale = 2 * 2^sm_weight_log2_scale
const int log2_scale = 1 + sm_weight_log2_scale;
const uint16_t scale = (1 << sm_weight_log2_scale);
@@ -277,6 +271,64 @@ static INLINE void smooth_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
}
}
+#if CONFIG_SMOOTH_HV
+static INLINE void smooth_v_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
+ const uint8_t *above,
+ const uint8_t *left) {
+ const uint8_t below_pred = left[bs - 1]; // estimated by bottom-left pixel
+ const uint8_t *const sm_weights = sm_weight_arrays + bs;
+ // scale = 2^sm_weight_log2_scale
+ const int log2_scale = sm_weight_log2_scale;
+ const uint16_t scale = (1 << sm_weight_log2_scale);
+ sm_weights_sanity_checks(sm_weights, scale, log2_scale + sizeof(*dst));
+
+ int r;
+ for (r = 0; r < bs; r++) {
+ int c;
+ for (c = 0; c < bs; ++c) {
+ const uint8_t pixels[] = { above[c], below_pred };
+ const uint8_t weights[] = { sm_weights[r], scale - sm_weights[r] };
+ uint32_t this_pred = 0;
+ assert(scale >= sm_weights[r]);
+ int i;
+ for (i = 0; i < 2; ++i) {
+ this_pred += weights[i] * pixels[i];
+ }
+ dst[c] = clip_pixel(divide_round(this_pred, log2_scale));
+ }
+ dst += stride;
+ }
+}
+
+static INLINE void smooth_h_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
+ const uint8_t *above,
+ const uint8_t *left) {
+ const uint8_t right_pred = above[bs - 1]; // estimated by top-right pixel
+ const uint8_t *const sm_weights = sm_weight_arrays + bs;
+ // scale = 2^sm_weight_log2_scale
+ const int log2_scale = sm_weight_log2_scale;
+ const uint16_t scale = (1 << sm_weight_log2_scale);
+ sm_weights_sanity_checks(sm_weights, scale, log2_scale + sizeof(*dst));
+
+ int r;
+ for (r = 0; r < bs; r++) {
+ int c;
+ for (c = 0; c < bs; ++c) {
+ const uint8_t pixels[] = { left[r], right_pred };
+ const uint8_t weights[] = { sm_weights[c], scale - sm_weights[c] };
+ uint32_t this_pred = 0;
+ assert(scale >= sm_weights[c]);
+ int i;
+ for (i = 0; i < 2; ++i) {
+ this_pred += weights[i] * pixels[i];
+ }
+ dst[c] = clip_pixel(divide_round(this_pred, log2_scale));
+ }
+ dst += stride;
+ }
+}
+#endif // CONFIG_SMOOTH_HV
+
#else
static INLINE void tm_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
@@ -743,10 +795,7 @@ static INLINE void highbd_smooth_predictor(uint16_t *dst, ptrdiff_t stride,
const uint16_t *left, int bd) {
const uint16_t below_pred = left[bs - 1]; // estimated by bottom-left pixel
const uint16_t right_pred = above[bs - 1]; // estimated by top-right pixel
- const int arr_index = get_msb(bs) - 1;
- assert(arr_index >= 0);
- assert(arr_index < NUM_BLOCK_DIMS);
- const uint8_t *const sm_weights = sm_weight_arrays[arr_index];
+ const uint8_t *const sm_weights = sm_weight_arrays + bs;
// scale = 2 * 2^sm_weight_log2_scale
const int log2_scale = 1 + sm_weight_log2_scale;
const uint16_t scale = (1 << sm_weight_log2_scale);
@@ -770,6 +819,64 @@ static INLINE void highbd_smooth_predictor(uint16_t *dst, ptrdiff_t stride,
}
}
+#if CONFIG_SMOOTH_HV
+static INLINE void highbd_smooth_v_predictor(uint16_t *dst, ptrdiff_t stride,
+ int bs, const uint16_t *above,
+ const uint16_t *left, int bd) {
+ const uint16_t below_pred = left[bs - 1]; // estimated by bottom-left pixel
+ const uint8_t *const sm_weights = sm_weight_arrays + bs;
+ // scale = 2^sm_weight_log2_scale
+ const int log2_scale = sm_weight_log2_scale;
+ const uint16_t scale = (1 << sm_weight_log2_scale);
+ sm_weights_sanity_checks(sm_weights, scale, log2_scale + sizeof(*dst));
+
+ int r;
+ for (r = 0; r < bs; r++) {
+ int c;
+ for (c = 0; c < bs; ++c) {
+ const uint16_t pixels[] = { above[c], below_pred };
+ const uint8_t weights[] = { sm_weights[r], scale - sm_weights[r] };
+ uint32_t this_pred = 0;
+ assert(scale >= sm_weights[r]);
+ int i;
+ for (i = 0; i < 2; ++i) {
+ this_pred += weights[i] * pixels[i];
+ }
+ dst[c] = clip_pixel_highbd(divide_round(this_pred, log2_scale), bd);
+ }
+ dst += stride;
+ }
+}
+
+static INLINE void highbd_smooth_h_predictor(uint16_t *dst, ptrdiff_t stride,
+ int bs, const uint16_t *above,
+ const uint16_t *left, int bd) {
+ const uint16_t right_pred = above[bs - 1]; // estimated by top-right pixel
+ const uint8_t *const sm_weights = sm_weight_arrays + bs;
+ // scale = 2^sm_weight_log2_scale
+ const int log2_scale = sm_weight_log2_scale;
+ const uint16_t scale = (1 << sm_weight_log2_scale);
+ sm_weights_sanity_checks(sm_weights, scale, log2_scale + sizeof(*dst));
+
+ int r;
+ for (r = 0; r < bs; r++) {
+ int c;
+ for (c = 0; c < bs; ++c) {
+ const uint16_t pixels[] = { left[r], right_pred };
+ const uint8_t weights[] = { sm_weights[c], scale - sm_weights[c] };
+ uint32_t this_pred = 0;
+ assert(scale >= sm_weights[c]);
+ int i;
+ for (i = 0; i < 2; ++i) {
+ this_pred += weights[i] * pixels[i];
+ }
+ dst[c] = clip_pixel_highbd(divide_round(this_pred, log2_scale), bd);
+ }
+ dst += stride;
+ }
+}
+#endif
+
#else
static INLINE void highbd_tm_predictor(uint16_t *dst, ptrdiff_t stride, int bs,
const uint16_t *above,
@@ -879,6 +986,7 @@ static INLINE void highbd_dc_predictor(uint16_t *dst, ptrdiff_t stride, int bs,
intra_pred_sized(type, 16) \
intra_pred_sized(type, 32) \
intra_pred_sized(type, 64) \
+ intra_pred_highbd_sized(type, 2) \
intra_pred_highbd_sized(type, 4) \
intra_pred_highbd_sized(type, 8) \
intra_pred_highbd_sized(type, 16) \
@@ -958,8 +1066,12 @@ intra_pred_above_4x4(d153)
intra_pred_allsizes(v)
intra_pred_allsizes(h)
#if CONFIG_ALT_INTRA
-intra_pred_allsizes(paeth)
intra_pred_allsizes(smooth)
+#if CONFIG_SMOOTH_HV
+intra_pred_allsizes(smooth_v)
+intra_pred_allsizes(smooth_h)
+#endif // CONFIG_SMOOTH_HV
+intra_pred_allsizes(paeth)
#else
intra_pred_allsizes(tm)
#endif // CONFIG_ALT_INTRA
diff --git a/third_party/aom/aom_dsp/inv_txfm.c b/third_party/aom/aom_dsp/inv_txfm.c
index bb995856a..6e7d8c928 100644
--- a/third_party/aom/aom_dsp/inv_txfm.c
+++ b/third_party/aom/aom_dsp/inv_txfm.c
@@ -1442,4 +1442,868 @@ void aom_highbd_idct4x4_1_add_c(const tran_low_t *input, uint8_t *dest8,
}
}
+void aom_highbd_idct8_c(const tran_low_t *input, tran_low_t *output, int bd) {
+ tran_low_t step1[8], step2[8];
+ tran_high_t temp1, temp2;
+ // stage 1
+ step1[0] = input[0];
+ step1[2] = input[4];
+ step1[1] = input[2];
+ step1[3] = input[6];
+ temp1 = input[1] * cospi_28_64 - input[7] * cospi_4_64;
+ temp2 = input[1] * cospi_4_64 + input[7] * cospi_28_64;
+ step1[4] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[7] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ temp1 = input[5] * cospi_12_64 - input[3] * cospi_20_64;
+ temp2 = input[5] * cospi_20_64 + input[3] * cospi_12_64;
+ step1[5] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[6] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+
+ // stage 2 & stage 3 - even half
+ aom_highbd_idct4_c(step1, step1, bd);
+
+ // stage 2 - odd half
+ step2[4] = HIGHBD_WRAPLOW(step1[4] + step1[5], bd);
+ step2[5] = HIGHBD_WRAPLOW(step1[4] - step1[5], bd);
+ step2[6] = HIGHBD_WRAPLOW(-step1[6] + step1[7], bd);
+ step2[7] = HIGHBD_WRAPLOW(step1[6] + step1[7], bd);
+
+ // stage 3 - odd half
+ step1[4] = step2[4];
+ temp1 = (step2[6] - step2[5]) * cospi_16_64;
+ temp2 = (step2[5] + step2[6]) * cospi_16_64;
+ step1[5] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[6] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ step1[7] = step2[7];
+
+ // stage 4
+ output[0] = HIGHBD_WRAPLOW(step1[0] + step1[7], bd);
+ output[1] = HIGHBD_WRAPLOW(step1[1] + step1[6], bd);
+ output[2] = HIGHBD_WRAPLOW(step1[2] + step1[5], bd);
+ output[3] = HIGHBD_WRAPLOW(step1[3] + step1[4], bd);
+ output[4] = HIGHBD_WRAPLOW(step1[3] - step1[4], bd);
+ output[5] = HIGHBD_WRAPLOW(step1[2] - step1[5], bd);
+ output[6] = HIGHBD_WRAPLOW(step1[1] - step1[6], bd);
+ output[7] = HIGHBD_WRAPLOW(step1[0] - step1[7], bd);
+}
+
+void aom_highbd_iadst4_c(const tran_low_t *input, tran_low_t *output, int bd) {
+ tran_high_t s0, s1, s2, s3, s4, s5, s6, s7;
+
+ tran_low_t x0 = input[0];
+ tran_low_t x1 = input[1];
+ tran_low_t x2 = input[2];
+ tran_low_t x3 = input[3];
+ (void)bd;
+
+ if (!(x0 | x1 | x2 | x3)) {
+ memset(output, 0, 4 * sizeof(*output));
+ return;
+ }
+
+ s0 = sinpi_1_9 * x0;
+ s1 = sinpi_2_9 * x0;
+ s2 = sinpi_3_9 * x1;
+ s3 = sinpi_4_9 * x2;
+ s4 = sinpi_1_9 * x2;
+ s5 = sinpi_2_9 * x3;
+ s6 = sinpi_4_9 * x3;
+ s7 = (tran_high_t)HIGHBD_WRAPLOW(x0 - x2 + x3, bd);
+
+ s0 = s0 + s3 + s5;
+ s1 = s1 - s4 - s6;
+ s3 = s2;
+ s2 = sinpi_3_9 * s7;
+
+ // 1-D transform scaling factor is sqrt(2).
+ // The overall dynamic range is 14b (input) + 14b (multiplication scaling)
+ // + 1b (addition) = 29b.
+ // Hence the output bit depth is 15b.
+ output[0] = HIGHBD_WRAPLOW(dct_const_round_shift(s0 + s3), bd);
+ output[1] = HIGHBD_WRAPLOW(dct_const_round_shift(s1 + s3), bd);
+ output[2] = HIGHBD_WRAPLOW(dct_const_round_shift(s2), bd);
+ output[3] = HIGHBD_WRAPLOW(dct_const_round_shift(s0 + s1 - s3), bd);
+}
+
+void aom_highbd_iadst8_c(const tran_low_t *input, tran_low_t *output, int bd) {
+ tran_high_t s0, s1, s2, s3, s4, s5, s6, s7;
+
+ tran_low_t x0 = input[7];
+ tran_low_t x1 = input[0];
+ tran_low_t x2 = input[5];
+ tran_low_t x3 = input[2];
+ tran_low_t x4 = input[3];
+ tran_low_t x5 = input[4];
+ tran_low_t x6 = input[1];
+ tran_low_t x7 = input[6];
+ (void)bd;
+
+ if (!(x0 | x1 | x2 | x3 | x4 | x5 | x6 | x7)) {
+ memset(output, 0, 8 * sizeof(*output));
+ return;
+ }
+
+ // stage 1
+ s0 = cospi_2_64 * x0 + cospi_30_64 * x1;
+ s1 = cospi_30_64 * x0 - cospi_2_64 * x1;
+ s2 = cospi_10_64 * x2 + cospi_22_64 * x3;
+ s3 = cospi_22_64 * x2 - cospi_10_64 * x3;
+ s4 = cospi_18_64 * x4 + cospi_14_64 * x5;
+ s5 = cospi_14_64 * x4 - cospi_18_64 * x5;
+ s6 = cospi_26_64 * x6 + cospi_6_64 * x7;
+ s7 = cospi_6_64 * x6 - cospi_26_64 * x7;
+
+ x0 = HIGHBD_WRAPLOW(dct_const_round_shift(s0 + s4), bd);
+ x1 = HIGHBD_WRAPLOW(dct_const_round_shift(s1 + s5), bd);
+ x2 = HIGHBD_WRAPLOW(dct_const_round_shift(s2 + s6), bd);
+ x3 = HIGHBD_WRAPLOW(dct_const_round_shift(s3 + s7), bd);
+ x4 = HIGHBD_WRAPLOW(dct_const_round_shift(s0 - s4), bd);
+ x5 = HIGHBD_WRAPLOW(dct_const_round_shift(s1 - s5), bd);
+ x6 = HIGHBD_WRAPLOW(dct_const_round_shift(s2 - s6), bd);
+ x7 = HIGHBD_WRAPLOW(dct_const_round_shift(s3 - s7), bd);
+
+ // stage 2
+ s0 = x0;
+ s1 = x1;
+ s2 = x2;
+ s3 = x3;
+ s4 = cospi_8_64 * x4 + cospi_24_64 * x5;
+ s5 = cospi_24_64 * x4 - cospi_8_64 * x5;
+ s6 = -cospi_24_64 * x6 + cospi_8_64 * x7;
+ s7 = cospi_8_64 * x6 + cospi_24_64 * x7;
+
+ x0 = HIGHBD_WRAPLOW(s0 + s2, bd);
+ x1 = HIGHBD_WRAPLOW(s1 + s3, bd);
+ x2 = HIGHBD_WRAPLOW(s0 - s2, bd);
+ x3 = HIGHBD_WRAPLOW(s1 - s3, bd);
+ x4 = HIGHBD_WRAPLOW(dct_const_round_shift(s4 + s6), bd);
+ x5 = HIGHBD_WRAPLOW(dct_const_round_shift(s5 + s7), bd);
+ x6 = HIGHBD_WRAPLOW(dct_const_round_shift(s4 - s6), bd);
+ x7 = HIGHBD_WRAPLOW(dct_const_round_shift(s5 - s7), bd);
+
+ // stage 3
+ s2 = cospi_16_64 * (x2 + x3);
+ s3 = cospi_16_64 * (x2 - x3);
+ s6 = cospi_16_64 * (x6 + x7);
+ s7 = cospi_16_64 * (x6 - x7);
+
+ x2 = HIGHBD_WRAPLOW(dct_const_round_shift(s2), bd);
+ x3 = HIGHBD_WRAPLOW(dct_const_round_shift(s3), bd);
+ x6 = HIGHBD_WRAPLOW(dct_const_round_shift(s6), bd);
+ x7 = HIGHBD_WRAPLOW(dct_const_round_shift(s7), bd);
+
+ output[0] = HIGHBD_WRAPLOW(x0, bd);
+ output[1] = HIGHBD_WRAPLOW(-x4, bd);
+ output[2] = HIGHBD_WRAPLOW(x6, bd);
+ output[3] = HIGHBD_WRAPLOW(-x2, bd);
+ output[4] = HIGHBD_WRAPLOW(x3, bd);
+ output[5] = HIGHBD_WRAPLOW(-x7, bd);
+ output[6] = HIGHBD_WRAPLOW(x5, bd);
+ output[7] = HIGHBD_WRAPLOW(-x1, bd);
+}
+
+void aom_highbd_idct16_c(const tran_low_t *input, tran_low_t *output, int bd) {
+ tran_low_t step1[16], step2[16];
+ tran_high_t temp1, temp2;
+ (void)bd;
+
+ // stage 1
+ step1[0] = input[0 / 2];
+ step1[1] = input[16 / 2];
+ step1[2] = input[8 / 2];
+ step1[3] = input[24 / 2];
+ step1[4] = input[4 / 2];
+ step1[5] = input[20 / 2];
+ step1[6] = input[12 / 2];
+ step1[7] = input[28 / 2];
+ step1[8] = input[2 / 2];
+ step1[9] = input[18 / 2];
+ step1[10] = input[10 / 2];
+ step1[11] = input[26 / 2];
+ step1[12] = input[6 / 2];
+ step1[13] = input[22 / 2];
+ step1[14] = input[14 / 2];
+ step1[15] = input[30 / 2];
+
+ // stage 2
+ step2[0] = step1[0];
+ step2[1] = step1[1];
+ step2[2] = step1[2];
+ step2[3] = step1[3];
+ step2[4] = step1[4];
+ step2[5] = step1[5];
+ step2[6] = step1[6];
+ step2[7] = step1[7];
+
+ temp1 = step1[8] * cospi_30_64 - step1[15] * cospi_2_64;
+ temp2 = step1[8] * cospi_2_64 + step1[15] * cospi_30_64;
+ step2[8] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step2[15] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+
+ temp1 = step1[9] * cospi_14_64 - step1[14] * cospi_18_64;
+ temp2 = step1[9] * cospi_18_64 + step1[14] * cospi_14_64;
+ step2[9] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step2[14] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+
+ temp1 = step1[10] * cospi_22_64 - step1[13] * cospi_10_64;
+ temp2 = step1[10] * cospi_10_64 + step1[13] * cospi_22_64;
+ step2[10] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step2[13] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+
+ temp1 = step1[11] * cospi_6_64 - step1[12] * cospi_26_64;
+ temp2 = step1[11] * cospi_26_64 + step1[12] * cospi_6_64;
+ step2[11] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step2[12] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+
+ // stage 3
+ step1[0] = step2[0];
+ step1[1] = step2[1];
+ step1[2] = step2[2];
+ step1[3] = step2[3];
+
+ temp1 = step2[4] * cospi_28_64 - step2[7] * cospi_4_64;
+ temp2 = step2[4] * cospi_4_64 + step2[7] * cospi_28_64;
+ step1[4] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[7] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ temp1 = step2[5] * cospi_12_64 - step2[6] * cospi_20_64;
+ temp2 = step2[5] * cospi_20_64 + step2[6] * cospi_12_64;
+ step1[5] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[6] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+
+ step1[8] = HIGHBD_WRAPLOW(step2[8] + step2[9], bd);
+ step1[9] = HIGHBD_WRAPLOW(step2[8] - step2[9], bd);
+ step1[10] = HIGHBD_WRAPLOW(-step2[10] + step2[11], bd);
+ step1[11] = HIGHBD_WRAPLOW(step2[10] + step2[11], bd);
+ step1[12] = HIGHBD_WRAPLOW(step2[12] + step2[13], bd);
+ step1[13] = HIGHBD_WRAPLOW(step2[12] - step2[13], bd);
+ step1[14] = HIGHBD_WRAPLOW(-step2[14] + step2[15], bd);
+ step1[15] = HIGHBD_WRAPLOW(step2[14] + step2[15], bd);
+
+ // stage 4
+ temp1 = (step1[0] + step1[1]) * cospi_16_64;
+ temp2 = (step1[0] - step1[1]) * cospi_16_64;
+ step2[0] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step2[1] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ temp1 = step1[2] * cospi_24_64 - step1[3] * cospi_8_64;
+ temp2 = step1[2] * cospi_8_64 + step1[3] * cospi_24_64;
+ step2[2] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step2[3] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ step2[4] = HIGHBD_WRAPLOW(step1[4] + step1[5], bd);
+ step2[5] = HIGHBD_WRAPLOW(step1[4] - step1[5], bd);
+ step2[6] = HIGHBD_WRAPLOW(-step1[6] + step1[7], bd);
+ step2[7] = HIGHBD_WRAPLOW(step1[6] + step1[7], bd);
+
+ step2[8] = step1[8];
+ step2[15] = step1[15];
+ temp1 = -step1[9] * cospi_8_64 + step1[14] * cospi_24_64;
+ temp2 = step1[9] * cospi_24_64 + step1[14] * cospi_8_64;
+ step2[9] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step2[14] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ temp1 = -step1[10] * cospi_24_64 - step1[13] * cospi_8_64;
+ temp2 = -step1[10] * cospi_8_64 + step1[13] * cospi_24_64;
+ step2[10] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step2[13] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ step2[11] = step1[11];
+ step2[12] = step1[12];
+
+ // stage 5
+ step1[0] = HIGHBD_WRAPLOW(step2[0] + step2[3], bd);
+ step1[1] = HIGHBD_WRAPLOW(step2[1] + step2[2], bd);
+ step1[2] = HIGHBD_WRAPLOW(step2[1] - step2[2], bd);
+ step1[3] = HIGHBD_WRAPLOW(step2[0] - step2[3], bd);
+ step1[4] = step2[4];
+ temp1 = (step2[6] - step2[5]) * cospi_16_64;
+ temp2 = (step2[5] + step2[6]) * cospi_16_64;
+ step1[5] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[6] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ step1[7] = step2[7];
+
+ step1[8] = HIGHBD_WRAPLOW(step2[8] + step2[11], bd);
+ step1[9] = HIGHBD_WRAPLOW(step2[9] + step2[10], bd);
+ step1[10] = HIGHBD_WRAPLOW(step2[9] - step2[10], bd);
+ step1[11] = HIGHBD_WRAPLOW(step2[8] - step2[11], bd);
+ step1[12] = HIGHBD_WRAPLOW(-step2[12] + step2[15], bd);
+ step1[13] = HIGHBD_WRAPLOW(-step2[13] + step2[14], bd);
+ step1[14] = HIGHBD_WRAPLOW(step2[13] + step2[14], bd);
+ step1[15] = HIGHBD_WRAPLOW(step2[12] + step2[15], bd);
+
+ // stage 6
+ step2[0] = HIGHBD_WRAPLOW(step1[0] + step1[7], bd);
+ step2[1] = HIGHBD_WRAPLOW(step1[1] + step1[6], bd);
+ step2[2] = HIGHBD_WRAPLOW(step1[2] + step1[5], bd);
+ step2[3] = HIGHBD_WRAPLOW(step1[3] + step1[4], bd);
+ step2[4] = HIGHBD_WRAPLOW(step1[3] - step1[4], bd);
+ step2[5] = HIGHBD_WRAPLOW(step1[2] - step1[5], bd);
+ step2[6] = HIGHBD_WRAPLOW(step1[1] - step1[6], bd);
+ step2[7] = HIGHBD_WRAPLOW(step1[0] - step1[7], bd);
+ step2[8] = step1[8];
+ step2[9] = step1[9];
+ temp1 = (-step1[10] + step1[13]) * cospi_16_64;
+ temp2 = (step1[10] + step1[13]) * cospi_16_64;
+ step2[10] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step2[13] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ temp1 = (-step1[11] + step1[12]) * cospi_16_64;
+ temp2 = (step1[11] + step1[12]) * cospi_16_64;
+ step2[11] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step2[12] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ step2[14] = step1[14];
+ step2[15] = step1[15];
+
+ // stage 7
+ output[0] = HIGHBD_WRAPLOW(step2[0] + step2[15], bd);
+ output[1] = HIGHBD_WRAPLOW(step2[1] + step2[14], bd);
+ output[2] = HIGHBD_WRAPLOW(step2[2] + step2[13], bd);
+ output[3] = HIGHBD_WRAPLOW(step2[3] + step2[12], bd);
+ output[4] = HIGHBD_WRAPLOW(step2[4] + step2[11], bd);
+ output[5] = HIGHBD_WRAPLOW(step2[5] + step2[10], bd);
+ output[6] = HIGHBD_WRAPLOW(step2[6] + step2[9], bd);
+ output[7] = HIGHBD_WRAPLOW(step2[7] + step2[8], bd);
+ output[8] = HIGHBD_WRAPLOW(step2[7] - step2[8], bd);
+ output[9] = HIGHBD_WRAPLOW(step2[6] - step2[9], bd);
+ output[10] = HIGHBD_WRAPLOW(step2[5] - step2[10], bd);
+ output[11] = HIGHBD_WRAPLOW(step2[4] - step2[11], bd);
+ output[12] = HIGHBD_WRAPLOW(step2[3] - step2[12], bd);
+ output[13] = HIGHBD_WRAPLOW(step2[2] - step2[13], bd);
+ output[14] = HIGHBD_WRAPLOW(step2[1] - step2[14], bd);
+ output[15] = HIGHBD_WRAPLOW(step2[0] - step2[15], bd);
+}
+
+void aom_highbd_iadst16_c(const tran_low_t *input, tran_low_t *output, int bd) {
+ tran_high_t s0, s1, s2, s3, s4, s5, s6, s7, s8;
+ tran_high_t s9, s10, s11, s12, s13, s14, s15;
+
+ tran_low_t x0 = input[15];
+ tran_low_t x1 = input[0];
+ tran_low_t x2 = input[13];
+ tran_low_t x3 = input[2];
+ tran_low_t x4 = input[11];
+ tran_low_t x5 = input[4];
+ tran_low_t x6 = input[9];
+ tran_low_t x7 = input[6];
+ tran_low_t x8 = input[7];
+ tran_low_t x9 = input[8];
+ tran_low_t x10 = input[5];
+ tran_low_t x11 = input[10];
+ tran_low_t x12 = input[3];
+ tran_low_t x13 = input[12];
+ tran_low_t x14 = input[1];
+ tran_low_t x15 = input[14];
+ (void)bd;
+
+ if (!(x0 | x1 | x2 | x3 | x4 | x5 | x6 | x7 | x8 | x9 | x10 | x11 | x12 |
+ x13 | x14 | x15)) {
+ memset(output, 0, 16 * sizeof(*output));
+ return;
+ }
+
+ // stage 1
+ s0 = x0 * cospi_1_64 + x1 * cospi_31_64;
+ s1 = x0 * cospi_31_64 - x1 * cospi_1_64;
+ s2 = x2 * cospi_5_64 + x3 * cospi_27_64;
+ s3 = x2 * cospi_27_64 - x3 * cospi_5_64;
+ s4 = x4 * cospi_9_64 + x5 * cospi_23_64;
+ s5 = x4 * cospi_23_64 - x5 * cospi_9_64;
+ s6 = x6 * cospi_13_64 + x7 * cospi_19_64;
+ s7 = x6 * cospi_19_64 - x7 * cospi_13_64;
+ s8 = x8 * cospi_17_64 + x9 * cospi_15_64;
+ s9 = x8 * cospi_15_64 - x9 * cospi_17_64;
+ s10 = x10 * cospi_21_64 + x11 * cospi_11_64;
+ s11 = x10 * cospi_11_64 - x11 * cospi_21_64;
+ s12 = x12 * cospi_25_64 + x13 * cospi_7_64;
+ s13 = x12 * cospi_7_64 - x13 * cospi_25_64;
+ s14 = x14 * cospi_29_64 + x15 * cospi_3_64;
+ s15 = x14 * cospi_3_64 - x15 * cospi_29_64;
+
+ x0 = HIGHBD_WRAPLOW(dct_const_round_shift(s0 + s8), bd);
+ x1 = HIGHBD_WRAPLOW(dct_const_round_shift(s1 + s9), bd);
+ x2 = HIGHBD_WRAPLOW(dct_const_round_shift(s2 + s10), bd);
+ x3 = HIGHBD_WRAPLOW(dct_const_round_shift(s3 + s11), bd);
+ x4 = HIGHBD_WRAPLOW(dct_const_round_shift(s4 + s12), bd);
+ x5 = HIGHBD_WRAPLOW(dct_const_round_shift(s5 + s13), bd);
+ x6 = HIGHBD_WRAPLOW(dct_const_round_shift(s6 + s14), bd);
+ x7 = HIGHBD_WRAPLOW(dct_const_round_shift(s7 + s15), bd);
+ x8 = HIGHBD_WRAPLOW(dct_const_round_shift(s0 - s8), bd);
+ x9 = HIGHBD_WRAPLOW(dct_const_round_shift(s1 - s9), bd);
+ x10 = HIGHBD_WRAPLOW(dct_const_round_shift(s2 - s10), bd);
+ x11 = HIGHBD_WRAPLOW(dct_const_round_shift(s3 - s11), bd);
+ x12 = HIGHBD_WRAPLOW(dct_const_round_shift(s4 - s12), bd);
+ x13 = HIGHBD_WRAPLOW(dct_const_round_shift(s5 - s13), bd);
+ x14 = HIGHBD_WRAPLOW(dct_const_round_shift(s6 - s14), bd);
+ x15 = HIGHBD_WRAPLOW(dct_const_round_shift(s7 - s15), bd);
+
+ // stage 2
+ s0 = x0;
+ s1 = x1;
+ s2 = x2;
+ s3 = x3;
+ s4 = x4;
+ s5 = x5;
+ s6 = x6;
+ s7 = x7;
+ s8 = x8 * cospi_4_64 + x9 * cospi_28_64;
+ s9 = x8 * cospi_28_64 - x9 * cospi_4_64;
+ s10 = x10 * cospi_20_64 + x11 * cospi_12_64;
+ s11 = x10 * cospi_12_64 - x11 * cospi_20_64;
+ s12 = -x12 * cospi_28_64 + x13 * cospi_4_64;
+ s13 = x12 * cospi_4_64 + x13 * cospi_28_64;
+ s14 = -x14 * cospi_12_64 + x15 * cospi_20_64;
+ s15 = x14 * cospi_20_64 + x15 * cospi_12_64;
+
+ x0 = HIGHBD_WRAPLOW(s0 + s4, bd);
+ x1 = HIGHBD_WRAPLOW(s1 + s5, bd);
+ x2 = HIGHBD_WRAPLOW(s2 + s6, bd);
+ x3 = HIGHBD_WRAPLOW(s3 + s7, bd);
+ x4 = HIGHBD_WRAPLOW(s0 - s4, bd);
+ x5 = HIGHBD_WRAPLOW(s1 - s5, bd);
+ x6 = HIGHBD_WRAPLOW(s2 - s6, bd);
+ x7 = HIGHBD_WRAPLOW(s3 - s7, bd);
+ x8 = HIGHBD_WRAPLOW(dct_const_round_shift(s8 + s12), bd);
+ x9 = HIGHBD_WRAPLOW(dct_const_round_shift(s9 + s13), bd);
+ x10 = HIGHBD_WRAPLOW(dct_const_round_shift(s10 + s14), bd);
+ x11 = HIGHBD_WRAPLOW(dct_const_round_shift(s11 + s15), bd);
+ x12 = HIGHBD_WRAPLOW(dct_const_round_shift(s8 - s12), bd);
+ x13 = HIGHBD_WRAPLOW(dct_const_round_shift(s9 - s13), bd);
+ x14 = HIGHBD_WRAPLOW(dct_const_round_shift(s10 - s14), bd);
+ x15 = HIGHBD_WRAPLOW(dct_const_round_shift(s11 - s15), bd);
+
+ // stage 3
+ s0 = x0;
+ s1 = x1;
+ s2 = x2;
+ s3 = x3;
+ s4 = x4 * cospi_8_64 + x5 * cospi_24_64;
+ s5 = x4 * cospi_24_64 - x5 * cospi_8_64;
+ s6 = -x6 * cospi_24_64 + x7 * cospi_8_64;
+ s7 = x6 * cospi_8_64 + x7 * cospi_24_64;
+ s8 = x8;
+ s9 = x9;
+ s10 = x10;
+ s11 = x11;
+ s12 = x12 * cospi_8_64 + x13 * cospi_24_64;
+ s13 = x12 * cospi_24_64 - x13 * cospi_8_64;
+ s14 = -x14 * cospi_24_64 + x15 * cospi_8_64;
+ s15 = x14 * cospi_8_64 + x15 * cospi_24_64;
+
+ x0 = HIGHBD_WRAPLOW(s0 + s2, bd);
+ x1 = HIGHBD_WRAPLOW(s1 + s3, bd);
+ x2 = HIGHBD_WRAPLOW(s0 - s2, bd);
+ x3 = HIGHBD_WRAPLOW(s1 - s3, bd);
+ x4 = HIGHBD_WRAPLOW(dct_const_round_shift(s4 + s6), bd);
+ x5 = HIGHBD_WRAPLOW(dct_const_round_shift(s5 + s7), bd);
+ x6 = HIGHBD_WRAPLOW(dct_const_round_shift(s4 - s6), bd);
+ x7 = HIGHBD_WRAPLOW(dct_const_round_shift(s5 - s7), bd);
+ x8 = HIGHBD_WRAPLOW(s8 + s10, bd);
+ x9 = HIGHBD_WRAPLOW(s9 + s11, bd);
+ x10 = HIGHBD_WRAPLOW(s8 - s10, bd);
+ x11 = HIGHBD_WRAPLOW(s9 - s11, bd);
+ x12 = HIGHBD_WRAPLOW(dct_const_round_shift(s12 + s14), bd);
+ x13 = HIGHBD_WRAPLOW(dct_const_round_shift(s13 + s15), bd);
+ x14 = HIGHBD_WRAPLOW(dct_const_round_shift(s12 - s14), bd);
+ x15 = HIGHBD_WRAPLOW(dct_const_round_shift(s13 - s15), bd);
+
+ // stage 4
+ s2 = (-cospi_16_64) * (x2 + x3);
+ s3 = cospi_16_64 * (x2 - x3);
+ s6 = cospi_16_64 * (x6 + x7);
+ s7 = cospi_16_64 * (-x6 + x7);
+ s10 = cospi_16_64 * (x10 + x11);
+ s11 = cospi_16_64 * (-x10 + x11);
+ s14 = (-cospi_16_64) * (x14 + x15);
+ s15 = cospi_16_64 * (x14 - x15);
+
+ x2 = HIGHBD_WRAPLOW(dct_const_round_shift(s2), bd);
+ x3 = HIGHBD_WRAPLOW(dct_const_round_shift(s3), bd);
+ x6 = HIGHBD_WRAPLOW(dct_const_round_shift(s6), bd);
+ x7 = HIGHBD_WRAPLOW(dct_const_round_shift(s7), bd);
+ x10 = HIGHBD_WRAPLOW(dct_const_round_shift(s10), bd);
+ x11 = HIGHBD_WRAPLOW(dct_const_round_shift(s11), bd);
+ x14 = HIGHBD_WRAPLOW(dct_const_round_shift(s14), bd);
+ x15 = HIGHBD_WRAPLOW(dct_const_round_shift(s15), bd);
+
+ output[0] = HIGHBD_WRAPLOW(x0, bd);
+ output[1] = HIGHBD_WRAPLOW(-x8, bd);
+ output[2] = HIGHBD_WRAPLOW(x12, bd);
+ output[3] = HIGHBD_WRAPLOW(-x4, bd);
+ output[4] = HIGHBD_WRAPLOW(x6, bd);
+ output[5] = HIGHBD_WRAPLOW(x14, bd);
+ output[6] = HIGHBD_WRAPLOW(x10, bd);
+ output[7] = HIGHBD_WRAPLOW(x2, bd);
+ output[8] = HIGHBD_WRAPLOW(x3, bd);
+ output[9] = HIGHBD_WRAPLOW(x11, bd);
+ output[10] = HIGHBD_WRAPLOW(x15, bd);
+ output[11] = HIGHBD_WRAPLOW(x7, bd);
+ output[12] = HIGHBD_WRAPLOW(x5, bd);
+ output[13] = HIGHBD_WRAPLOW(-x13, bd);
+ output[14] = HIGHBD_WRAPLOW(x9, bd);
+ output[15] = HIGHBD_WRAPLOW(-x1, bd);
+}
+
+void aom_highbd_idct32_c(const tran_low_t *input, tran_low_t *output, int bd) {
+ tran_low_t step1[32], step2[32];
+ tran_high_t temp1, temp2;
+ (void)bd;
+
+ // stage 1
+ step1[0] = input[0];
+ step1[1] = input[16];
+ step1[2] = input[8];
+ step1[3] = input[24];
+ step1[4] = input[4];
+ step1[5] = input[20];
+ step1[6] = input[12];
+ step1[7] = input[28];
+ step1[8] = input[2];
+ step1[9] = input[18];
+ step1[10] = input[10];
+ step1[11] = input[26];
+ step1[12] = input[6];
+ step1[13] = input[22];
+ step1[14] = input[14];
+ step1[15] = input[30];
+
+ temp1 = input[1] * cospi_31_64 - input[31] * cospi_1_64;
+ temp2 = input[1] * cospi_1_64 + input[31] * cospi_31_64;
+ step1[16] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[31] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+
+ temp1 = input[17] * cospi_15_64 - input[15] * cospi_17_64;
+ temp2 = input[17] * cospi_17_64 + input[15] * cospi_15_64;
+ step1[17] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[30] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+
+ temp1 = input[9] * cospi_23_64 - input[23] * cospi_9_64;
+ temp2 = input[9] * cospi_9_64 + input[23] * cospi_23_64;
+ step1[18] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[29] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+
+ temp1 = input[25] * cospi_7_64 - input[7] * cospi_25_64;
+ temp2 = input[25] * cospi_25_64 + input[7] * cospi_7_64;
+ step1[19] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[28] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+
+ temp1 = input[5] * cospi_27_64 - input[27] * cospi_5_64;
+ temp2 = input[5] * cospi_5_64 + input[27] * cospi_27_64;
+ step1[20] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[27] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+
+ temp1 = input[21] * cospi_11_64 - input[11] * cospi_21_64;
+ temp2 = input[21] * cospi_21_64 + input[11] * cospi_11_64;
+ step1[21] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[26] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+
+ temp1 = input[13] * cospi_19_64 - input[19] * cospi_13_64;
+ temp2 = input[13] * cospi_13_64 + input[19] * cospi_19_64;
+ step1[22] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[25] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+
+ temp1 = input[29] * cospi_3_64 - input[3] * cospi_29_64;
+ temp2 = input[29] * cospi_29_64 + input[3] * cospi_3_64;
+ step1[23] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[24] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+
+ // stage 2
+ step2[0] = step1[0];
+ step2[1] = step1[1];
+ step2[2] = step1[2];
+ step2[3] = step1[3];
+ step2[4] = step1[4];
+ step2[5] = step1[5];
+ step2[6] = step1[6];
+ step2[7] = step1[7];
+
+ temp1 = step1[8] * cospi_30_64 - step1[15] * cospi_2_64;
+ temp2 = step1[8] * cospi_2_64 + step1[15] * cospi_30_64;
+ step2[8] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step2[15] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+
+ temp1 = step1[9] * cospi_14_64 - step1[14] * cospi_18_64;
+ temp2 = step1[9] * cospi_18_64 + step1[14] * cospi_14_64;
+ step2[9] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step2[14] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+
+ temp1 = step1[10] * cospi_22_64 - step1[13] * cospi_10_64;
+ temp2 = step1[10] * cospi_10_64 + step1[13] * cospi_22_64;
+ step2[10] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step2[13] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+
+ temp1 = step1[11] * cospi_6_64 - step1[12] * cospi_26_64;
+ temp2 = step1[11] * cospi_26_64 + step1[12] * cospi_6_64;
+ step2[11] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step2[12] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+
+ step2[16] = HIGHBD_WRAPLOW(step1[16] + step1[17], bd);
+ step2[17] = HIGHBD_WRAPLOW(step1[16] - step1[17], bd);
+ step2[18] = HIGHBD_WRAPLOW(-step1[18] + step1[19], bd);
+ step2[19] = HIGHBD_WRAPLOW(step1[18] + step1[19], bd);
+ step2[20] = HIGHBD_WRAPLOW(step1[20] + step1[21], bd);
+ step2[21] = HIGHBD_WRAPLOW(step1[20] - step1[21], bd);
+ step2[22] = HIGHBD_WRAPLOW(-step1[22] + step1[23], bd);
+ step2[23] = HIGHBD_WRAPLOW(step1[22] + step1[23], bd);
+ step2[24] = HIGHBD_WRAPLOW(step1[24] + step1[25], bd);
+ step2[25] = HIGHBD_WRAPLOW(step1[24] - step1[25], bd);
+ step2[26] = HIGHBD_WRAPLOW(-step1[26] + step1[27], bd);
+ step2[27] = HIGHBD_WRAPLOW(step1[26] + step1[27], bd);
+ step2[28] = HIGHBD_WRAPLOW(step1[28] + step1[29], bd);
+ step2[29] = HIGHBD_WRAPLOW(step1[28] - step1[29], bd);
+ step2[30] = HIGHBD_WRAPLOW(-step1[30] + step1[31], bd);
+ step2[31] = HIGHBD_WRAPLOW(step1[30] + step1[31], bd);
+
+ // stage 3
+ step1[0] = step2[0];
+ step1[1] = step2[1];
+ step1[2] = step2[2];
+ step1[3] = step2[3];
+
+ temp1 = step2[4] * cospi_28_64 - step2[7] * cospi_4_64;
+ temp2 = step2[4] * cospi_4_64 + step2[7] * cospi_28_64;
+ step1[4] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[7] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ temp1 = step2[5] * cospi_12_64 - step2[6] * cospi_20_64;
+ temp2 = step2[5] * cospi_20_64 + step2[6] * cospi_12_64;
+ step1[5] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[6] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+
+ step1[8] = HIGHBD_WRAPLOW(step2[8] + step2[9], bd);
+ step1[9] = HIGHBD_WRAPLOW(step2[8] - step2[9], bd);
+ step1[10] = HIGHBD_WRAPLOW(-step2[10] + step2[11], bd);
+ step1[11] = HIGHBD_WRAPLOW(step2[10] + step2[11], bd);
+ step1[12] = HIGHBD_WRAPLOW(step2[12] + step2[13], bd);
+ step1[13] = HIGHBD_WRAPLOW(step2[12] - step2[13], bd);
+ step1[14] = HIGHBD_WRAPLOW(-step2[14] + step2[15], bd);
+ step1[15] = HIGHBD_WRAPLOW(step2[14] + step2[15], bd);
+
+ step1[16] = step2[16];
+ step1[31] = step2[31];
+ temp1 = -step2[17] * cospi_4_64 + step2[30] * cospi_28_64;
+ temp2 = step2[17] * cospi_28_64 + step2[30] * cospi_4_64;
+ step1[17] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[30] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ temp1 = -step2[18] * cospi_28_64 - step2[29] * cospi_4_64;
+ temp2 = -step2[18] * cospi_4_64 + step2[29] * cospi_28_64;
+ step1[18] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[29] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ step1[19] = step2[19];
+ step1[20] = step2[20];
+ temp1 = -step2[21] * cospi_20_64 + step2[26] * cospi_12_64;
+ temp2 = step2[21] * cospi_12_64 + step2[26] * cospi_20_64;
+ step1[21] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[26] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ temp1 = -step2[22] * cospi_12_64 - step2[25] * cospi_20_64;
+ temp2 = -step2[22] * cospi_20_64 + step2[25] * cospi_12_64;
+ step1[22] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[25] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ step1[23] = step2[23];
+ step1[24] = step2[24];
+ step1[27] = step2[27];
+ step1[28] = step2[28];
+
+ // stage 4
+ temp1 = (step1[0] + step1[1]) * cospi_16_64;
+ temp2 = (step1[0] - step1[1]) * cospi_16_64;
+ step2[0] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step2[1] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ temp1 = step1[2] * cospi_24_64 - step1[3] * cospi_8_64;
+ temp2 = step1[2] * cospi_8_64 + step1[3] * cospi_24_64;
+ step2[2] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step2[3] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ step2[4] = HIGHBD_WRAPLOW(step1[4] + step1[5], bd);
+ step2[5] = HIGHBD_WRAPLOW(step1[4] - step1[5], bd);
+ step2[6] = HIGHBD_WRAPLOW(-step1[6] + step1[7], bd);
+ step2[7] = HIGHBD_WRAPLOW(step1[6] + step1[7], bd);
+
+ step2[8] = step1[8];
+ step2[15] = step1[15];
+ temp1 = -step1[9] * cospi_8_64 + step1[14] * cospi_24_64;
+ temp2 = step1[9] * cospi_24_64 + step1[14] * cospi_8_64;
+ step2[9] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step2[14] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ temp1 = -step1[10] * cospi_24_64 - step1[13] * cospi_8_64;
+ temp2 = -step1[10] * cospi_8_64 + step1[13] * cospi_24_64;
+ step2[10] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step2[13] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ step2[11] = step1[11];
+ step2[12] = step1[12];
+
+ step2[16] = HIGHBD_WRAPLOW(step1[16] + step1[19], bd);
+ step2[17] = HIGHBD_WRAPLOW(step1[17] + step1[18], bd);
+ step2[18] = HIGHBD_WRAPLOW(step1[17] - step1[18], bd);
+ step2[19] = HIGHBD_WRAPLOW(step1[16] - step1[19], bd);
+ step2[20] = HIGHBD_WRAPLOW(-step1[20] + step1[23], bd);
+ step2[21] = HIGHBD_WRAPLOW(-step1[21] + step1[22], bd);
+ step2[22] = HIGHBD_WRAPLOW(step1[21] + step1[22], bd);
+ step2[23] = HIGHBD_WRAPLOW(step1[20] + step1[23], bd);
+
+ step2[24] = HIGHBD_WRAPLOW(step1[24] + step1[27], bd);
+ step2[25] = HIGHBD_WRAPLOW(step1[25] + step1[26], bd);
+ step2[26] = HIGHBD_WRAPLOW(step1[25] - step1[26], bd);
+ step2[27] = HIGHBD_WRAPLOW(step1[24] - step1[27], bd);
+ step2[28] = HIGHBD_WRAPLOW(-step1[28] + step1[31], bd);
+ step2[29] = HIGHBD_WRAPLOW(-step1[29] + step1[30], bd);
+ step2[30] = HIGHBD_WRAPLOW(step1[29] + step1[30], bd);
+ step2[31] = HIGHBD_WRAPLOW(step1[28] + step1[31], bd);
+
+ // stage 5
+ step1[0] = HIGHBD_WRAPLOW(step2[0] + step2[3], bd);
+ step1[1] = HIGHBD_WRAPLOW(step2[1] + step2[2], bd);
+ step1[2] = HIGHBD_WRAPLOW(step2[1] - step2[2], bd);
+ step1[3] = HIGHBD_WRAPLOW(step2[0] - step2[3], bd);
+ step1[4] = step2[4];
+ temp1 = (step2[6] - step2[5]) * cospi_16_64;
+ temp2 = (step2[5] + step2[6]) * cospi_16_64;
+ step1[5] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[6] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ step1[7] = step2[7];
+
+ step1[8] = HIGHBD_WRAPLOW(step2[8] + step2[11], bd);
+ step1[9] = HIGHBD_WRAPLOW(step2[9] + step2[10], bd);
+ step1[10] = HIGHBD_WRAPLOW(step2[9] - step2[10], bd);
+ step1[11] = HIGHBD_WRAPLOW(step2[8] - step2[11], bd);
+ step1[12] = HIGHBD_WRAPLOW(-step2[12] + step2[15], bd);
+ step1[13] = HIGHBD_WRAPLOW(-step2[13] + step2[14], bd);
+ step1[14] = HIGHBD_WRAPLOW(step2[13] + step2[14], bd);
+ step1[15] = HIGHBD_WRAPLOW(step2[12] + step2[15], bd);
+
+ step1[16] = step2[16];
+ step1[17] = step2[17];
+ temp1 = -step2[18] * cospi_8_64 + step2[29] * cospi_24_64;
+ temp2 = step2[18] * cospi_24_64 + step2[29] * cospi_8_64;
+ step1[18] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[29] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ temp1 = -step2[19] * cospi_8_64 + step2[28] * cospi_24_64;
+ temp2 = step2[19] * cospi_24_64 + step2[28] * cospi_8_64;
+ step1[19] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[28] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ temp1 = -step2[20] * cospi_24_64 - step2[27] * cospi_8_64;
+ temp2 = -step2[20] * cospi_8_64 + step2[27] * cospi_24_64;
+ step1[20] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[27] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ temp1 = -step2[21] * cospi_24_64 - step2[26] * cospi_8_64;
+ temp2 = -step2[21] * cospi_8_64 + step2[26] * cospi_24_64;
+ step1[21] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[26] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ step1[22] = step2[22];
+ step1[23] = step2[23];
+ step1[24] = step2[24];
+ step1[25] = step2[25];
+ step1[30] = step2[30];
+ step1[31] = step2[31];
+
+ // stage 6
+ step2[0] = HIGHBD_WRAPLOW(step1[0] + step1[7], bd);
+ step2[1] = HIGHBD_WRAPLOW(step1[1] + step1[6], bd);
+ step2[2] = HIGHBD_WRAPLOW(step1[2] + step1[5], bd);
+ step2[3] = HIGHBD_WRAPLOW(step1[3] + step1[4], bd);
+ step2[4] = HIGHBD_WRAPLOW(step1[3] - step1[4], bd);
+ step2[5] = HIGHBD_WRAPLOW(step1[2] - step1[5], bd);
+ step2[6] = HIGHBD_WRAPLOW(step1[1] - step1[6], bd);
+ step2[7] = HIGHBD_WRAPLOW(step1[0] - step1[7], bd);
+ step2[8] = step1[8];
+ step2[9] = step1[9];
+ temp1 = (-step1[10] + step1[13]) * cospi_16_64;
+ temp2 = (step1[10] + step1[13]) * cospi_16_64;
+ step2[10] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step2[13] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ temp1 = (-step1[11] + step1[12]) * cospi_16_64;
+ temp2 = (step1[11] + step1[12]) * cospi_16_64;
+ step2[11] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step2[12] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ step2[14] = step1[14];
+ step2[15] = step1[15];
+
+ step2[16] = HIGHBD_WRAPLOW(step1[16] + step1[23], bd);
+ step2[17] = HIGHBD_WRAPLOW(step1[17] + step1[22], bd);
+ step2[18] = HIGHBD_WRAPLOW(step1[18] + step1[21], bd);
+ step2[19] = HIGHBD_WRAPLOW(step1[19] + step1[20], bd);
+ step2[20] = HIGHBD_WRAPLOW(step1[19] - step1[20], bd);
+ step2[21] = HIGHBD_WRAPLOW(step1[18] - step1[21], bd);
+ step2[22] = HIGHBD_WRAPLOW(step1[17] - step1[22], bd);
+ step2[23] = HIGHBD_WRAPLOW(step1[16] - step1[23], bd);
+
+ step2[24] = HIGHBD_WRAPLOW(-step1[24] + step1[31], bd);
+ step2[25] = HIGHBD_WRAPLOW(-step1[25] + step1[30], bd);
+ step2[26] = HIGHBD_WRAPLOW(-step1[26] + step1[29], bd);
+ step2[27] = HIGHBD_WRAPLOW(-step1[27] + step1[28], bd);
+ step2[28] = HIGHBD_WRAPLOW(step1[27] + step1[28], bd);
+ step2[29] = HIGHBD_WRAPLOW(step1[26] + step1[29], bd);
+ step2[30] = HIGHBD_WRAPLOW(step1[25] + step1[30], bd);
+ step2[31] = HIGHBD_WRAPLOW(step1[24] + step1[31], bd);
+
+ // stage 7
+ step1[0] = HIGHBD_WRAPLOW(step2[0] + step2[15], bd);
+ step1[1] = HIGHBD_WRAPLOW(step2[1] + step2[14], bd);
+ step1[2] = HIGHBD_WRAPLOW(step2[2] + step2[13], bd);
+ step1[3] = HIGHBD_WRAPLOW(step2[3] + step2[12], bd);
+ step1[4] = HIGHBD_WRAPLOW(step2[4] + step2[11], bd);
+ step1[5] = HIGHBD_WRAPLOW(step2[5] + step2[10], bd);
+ step1[6] = HIGHBD_WRAPLOW(step2[6] + step2[9], bd);
+ step1[7] = HIGHBD_WRAPLOW(step2[7] + step2[8], bd);
+ step1[8] = HIGHBD_WRAPLOW(step2[7] - step2[8], bd);
+ step1[9] = HIGHBD_WRAPLOW(step2[6] - step2[9], bd);
+ step1[10] = HIGHBD_WRAPLOW(step2[5] - step2[10], bd);
+ step1[11] = HIGHBD_WRAPLOW(step2[4] - step2[11], bd);
+ step1[12] = HIGHBD_WRAPLOW(step2[3] - step2[12], bd);
+ step1[13] = HIGHBD_WRAPLOW(step2[2] - step2[13], bd);
+ step1[14] = HIGHBD_WRAPLOW(step2[1] - step2[14], bd);
+ step1[15] = HIGHBD_WRAPLOW(step2[0] - step2[15], bd);
+
+ step1[16] = step2[16];
+ step1[17] = step2[17];
+ step1[18] = step2[18];
+ step1[19] = step2[19];
+ temp1 = (-step2[20] + step2[27]) * cospi_16_64;
+ temp2 = (step2[20] + step2[27]) * cospi_16_64;
+ step1[20] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[27] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ temp1 = (-step2[21] + step2[26]) * cospi_16_64;
+ temp2 = (step2[21] + step2[26]) * cospi_16_64;
+ step1[21] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[26] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ temp1 = (-step2[22] + step2[25]) * cospi_16_64;
+ temp2 = (step2[22] + step2[25]) * cospi_16_64;
+ step1[22] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[25] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ temp1 = (-step2[23] + step2[24]) * cospi_16_64;
+ temp2 = (step2[23] + step2[24]) * cospi_16_64;
+ step1[23] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
+ step1[24] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
+ step1[28] = step2[28];
+ step1[29] = step2[29];
+ step1[30] = step2[30];
+ step1[31] = step2[31];
+
+ // final stage
+ output[0] = HIGHBD_WRAPLOW(step1[0] + step1[31], bd);
+ output[1] = HIGHBD_WRAPLOW(step1[1] + step1[30], bd);
+ output[2] = HIGHBD_WRAPLOW(step1[2] + step1[29], bd);
+ output[3] = HIGHBD_WRAPLOW(step1[3] + step1[28], bd);
+ output[4] = HIGHBD_WRAPLOW(step1[4] + step1[27], bd);
+ output[5] = HIGHBD_WRAPLOW(step1[5] + step1[26], bd);
+ output[6] = HIGHBD_WRAPLOW(step1[6] + step1[25], bd);
+ output[7] = HIGHBD_WRAPLOW(step1[7] + step1[24], bd);
+ output[8] = HIGHBD_WRAPLOW(step1[8] + step1[23], bd);
+ output[9] = HIGHBD_WRAPLOW(step1[9] + step1[22], bd);
+ output[10] = HIGHBD_WRAPLOW(step1[10] + step1[21], bd);
+ output[11] = HIGHBD_WRAPLOW(step1[11] + step1[20], bd);
+ output[12] = HIGHBD_WRAPLOW(step1[12] + step1[19], bd);
+ output[13] = HIGHBD_WRAPLOW(step1[13] + step1[18], bd);
+ output[14] = HIGHBD_WRAPLOW(step1[14] + step1[17], bd);
+ output[15] = HIGHBD_WRAPLOW(step1[15] + step1[16], bd);
+ output[16] = HIGHBD_WRAPLOW(step1[15] - step1[16], bd);
+ output[17] = HIGHBD_WRAPLOW(step1[14] - step1[17], bd);
+ output[18] = HIGHBD_WRAPLOW(step1[13] - step1[18], bd);
+ output[19] = HIGHBD_WRAPLOW(step1[12] - step1[19], bd);
+ output[20] = HIGHBD_WRAPLOW(step1[11] - step1[20], bd);
+ output[21] = HIGHBD_WRAPLOW(step1[10] - step1[21], bd);
+ output[22] = HIGHBD_WRAPLOW(step1[9] - step1[22], bd);
+ output[23] = HIGHBD_WRAPLOW(step1[8] - step1[23], bd);
+ output[24] = HIGHBD_WRAPLOW(step1[7] - step1[24], bd);
+ output[25] = HIGHBD_WRAPLOW(step1[6] - step1[25], bd);
+ output[26] = HIGHBD_WRAPLOW(step1[5] - step1[26], bd);
+ output[27] = HIGHBD_WRAPLOW(step1[4] - step1[27], bd);
+ output[28] = HIGHBD_WRAPLOW(step1[3] - step1[28], bd);
+ output[29] = HIGHBD_WRAPLOW(step1[2] - step1[29], bd);
+ output[30] = HIGHBD_WRAPLOW(step1[1] - step1[30], bd);
+ output[31] = HIGHBD_WRAPLOW(step1[0] - step1[31], bd);
+}
+
#endif // CONFIG_HIGHBITDEPTH
diff --git a/third_party/aom/aom_dsp/loopfilter.c b/third_party/aom/aom_dsp/loopfilter.c
index e2e839219..7ea1e6b89 100644
--- a/third_party/aom/aom_dsp/loopfilter.c
+++ b/third_party/aom/aom_dsp/loopfilter.c
@@ -149,10 +149,15 @@ void aom_lpf_horizontal_4_c(uint8_t *s, int p /* pitch */,
const uint8_t *blimit, const uint8_t *limit,
const uint8_t *thresh) {
int i;
+#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
+ int count = 4;
+#else
+ int count = 8;
+#endif
// loop filter designed to work using chars so that we can make maximum use
// of 8 bit simd instructions.
- for (i = 0; i < 8; ++i) {
+ for (i = 0; i < count; ++i) {
#if !CONFIG_PARALLEL_DEBLOCKING
const uint8_t p3 = s[-4 * p], p2 = s[-3 * p], p1 = s[-2 * p], p0 = s[-p];
const uint8_t q0 = s[0 * p], q1 = s[1 * p], q2 = s[2 * p], q3 = s[3 * p];
@@ -179,10 +184,15 @@ void aom_lpf_horizontal_4_dual_c(uint8_t *s, int p, const uint8_t *blimit0,
void aom_lpf_vertical_4_c(uint8_t *s, int pitch, const uint8_t *blimit,
const uint8_t *limit, const uint8_t *thresh) {
int i;
+#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
+ int count = 4;
+#else
+ int count = 8;
+#endif
// loop filter designed to work using chars so that we can make maximum use
// of 8 bit simd instructions.
- for (i = 0; i < 8; ++i) {
+ for (i = 0; i < count; ++i) {
#if !CONFIG_PARALLEL_DEBLOCKING
const uint8_t p3 = s[-4], p2 = s[-3], p1 = s[-2], p0 = s[-1];
const uint8_t q0 = s[0], q1 = s[1], q2 = s[2], q3 = s[3];
@@ -206,7 +216,7 @@ void aom_lpf_vertical_4_dual_c(uint8_t *s, int pitch, const uint8_t *blimit0,
aom_lpf_vertical_4_c(s + 8 * pitch, pitch, blimit1, limit1, thresh1);
}
-static INLINE void filter8(int8_t mask, uint8_t thresh, uint8_t flat,
+static INLINE void filter8(int8_t mask, uint8_t thresh, int8_t flat,
uint8_t *op3, uint8_t *op2, uint8_t *op1,
uint8_t *op0, uint8_t *oq0, uint8_t *oq1,
uint8_t *oq2, uint8_t *oq3) {
@@ -229,10 +239,15 @@ static INLINE void filter8(int8_t mask, uint8_t thresh, uint8_t flat,
void aom_lpf_horizontal_8_c(uint8_t *s, int p, const uint8_t *blimit,
const uint8_t *limit, const uint8_t *thresh) {
int i;
+#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
+ int count = 4;
+#else
+ int count = 8;
+#endif
// loop filter designed to work using chars so that we can make maximum use
// of 8 bit simd instructions.
- for (i = 0; i < 8; ++i) {
+ for (i = 0; i < count; ++i) {
const uint8_t p3 = s[-4 * p], p2 = s[-3 * p], p1 = s[-2 * p], p0 = s[-p];
const uint8_t q0 = s[0 * p], q1 = s[1 * p], q2 = s[2 * p], q3 = s[3 * p];
@@ -256,8 +271,13 @@ void aom_lpf_horizontal_8_dual_c(uint8_t *s, int p, const uint8_t *blimit0,
void aom_lpf_vertical_8_c(uint8_t *s, int pitch, const uint8_t *blimit,
const uint8_t *limit, const uint8_t *thresh) {
int i;
+#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
+ int count = 4;
+#else
+ int count = 8;
+#endif
- for (i = 0; i < 8; ++i) {
+ for (i = 0; i < count; ++i) {
const uint8_t p3 = s[-4], p2 = s[-3], p1 = s[-2], p0 = s[-1];
const uint8_t q0 = s[0], q1 = s[1], q2 = s[2], q3 = s[3];
const int8_t mask =
@@ -278,8 +298,8 @@ void aom_lpf_vertical_8_dual_c(uint8_t *s, int pitch, const uint8_t *blimit0,
}
#if PARALLEL_DEBLOCKING_11_TAP
-static INLINE void filter12(int8_t mask, uint8_t thresh, uint8_t flat,
- uint8_t flat2, uint8_t *op5, uint8_t *op4,
+static INLINE void filter12(int8_t mask, uint8_t thresh, int8_t flat,
+ int8_t flat2, uint8_t *op5, uint8_t *op4,
uint8_t *op3, uint8_t *op2, uint8_t *op1,
uint8_t *op0, uint8_t *oq0, uint8_t *oq1,
uint8_t *oq2, uint8_t *oq3, uint8_t *oq4,
@@ -308,8 +328,8 @@ static INLINE void filter12(int8_t mask, uint8_t thresh, uint8_t flat,
#endif
#if PARALLEL_DEBLOCKING_9_TAP
-static INLINE void filter10(int8_t mask, uint8_t thresh, uint8_t flat,
- uint8_t flat2, uint8_t *op4, uint8_t *op3,
+static INLINE void filter10(int8_t mask, uint8_t thresh, int8_t flat,
+ int8_t flat2, uint8_t *op4, uint8_t *op3,
uint8_t *op2, uint8_t *op1, uint8_t *op0,
uint8_t *oq0, uint8_t *oq1, uint8_t *oq2,
uint8_t *oq3, uint8_t *oq4) {
@@ -332,8 +352,8 @@ static INLINE void filter10(int8_t mask, uint8_t thresh, uint8_t flat,
}
#endif
-static INLINE void filter16(int8_t mask, uint8_t thresh, uint8_t flat,
- uint8_t flat2, uint8_t *op7, uint8_t *op6,
+static INLINE void filter16(int8_t mask, uint8_t thresh, int8_t flat,
+ int8_t flat2, uint8_t *op7, uint8_t *op6,
uint8_t *op5, uint8_t *op4, uint8_t *op3,
uint8_t *op2, uint8_t *op1, uint8_t *op0,
uint8_t *oq0, uint8_t *oq1, uint8_t *oq2,
@@ -390,10 +410,15 @@ static void mb_lpf_horizontal_edge_w(uint8_t *s, int p, const uint8_t *blimit,
const uint8_t *limit,
const uint8_t *thresh, int count) {
int i;
+#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
+ int step = 4;
+#else
+ int step = 8;
+#endif
// loop filter designed to work using chars so that we can make maximum use
// of 8 bit simd instructions.
- for (i = 0; i < 8 * count; ++i) {
+ for (i = 0; i < step * count; ++i) {
const uint8_t p7 = s[-8 * p], p6 = s[-7 * p], p5 = s[-6 * p],
p4 = s[-5 * p], p3 = s[-4 * p], p2 = s[-3 * p],
p1 = s[-2 * p], p0 = s[-p];
@@ -436,7 +461,11 @@ void aom_lpf_horizontal_edge_8_c(uint8_t *s, int p, const uint8_t *blimit,
void aom_lpf_horizontal_edge_16_c(uint8_t *s, int p, const uint8_t *blimit,
const uint8_t *limit, const uint8_t *thresh) {
+#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
+ mb_lpf_horizontal_edge_w(s, p, blimit, limit, thresh, 1);
+#else
mb_lpf_horizontal_edge_w(s, p, blimit, limit, thresh, 2);
+#endif
}
static void mb_lpf_vertical_edge_w(uint8_t *s, int p, const uint8_t *blimit,
@@ -478,7 +507,11 @@ static void mb_lpf_vertical_edge_w(uint8_t *s, int p, const uint8_t *blimit,
void aom_lpf_vertical_16_c(uint8_t *s, int p, const uint8_t *blimit,
const uint8_t *limit, const uint8_t *thresh) {
+#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
+ mb_lpf_vertical_edge_w(s, p, blimit, limit, thresh, 4);
+#else
mb_lpf_vertical_edge_w(s, p, blimit, limit, thresh, 8);
+#endif
}
void aom_lpf_vertical_16_dual_c(uint8_t *s, int p, const uint8_t *blimit,
@@ -596,10 +629,15 @@ void aom_highbd_lpf_horizontal_4_c(uint16_t *s, int p /* pitch */,
const uint8_t *blimit, const uint8_t *limit,
const uint8_t *thresh, int bd) {
int i;
+#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
+ int count = 4;
+#else
+ int count = 8;
+#endif
// loop filter designed to work using chars so that we can make maximum use
// of 8 bit simd instructions.
- for (i = 0; i < 8; ++i) {
+ for (i = 0; i < count; ++i) {
#if !CONFIG_PARALLEL_DEBLOCKING
const uint16_t p3 = s[-4 * p];
const uint16_t p2 = s[-3 * p];
@@ -636,10 +674,15 @@ void aom_highbd_lpf_vertical_4_c(uint16_t *s, int pitch, const uint8_t *blimit,
const uint8_t *limit, const uint8_t *thresh,
int bd) {
int i;
+#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
+ int count = 4;
+#else
+ int count = 8;
+#endif
// loop filter designed to work using chars so that we can make maximum use
// of 8 bit simd instructions.
- for (i = 0; i < 8; ++i) {
+ for (i = 0; i < count; ++i) {
#if !CONFIG_PARALLEL_DEBLOCKING
const uint16_t p3 = s[-4], p2 = s[-3], p1 = s[-2], p0 = s[-1];
const uint16_t q0 = s[0], q1 = s[1], q2 = s[2], q3 = s[3];
@@ -665,7 +708,7 @@ void aom_highbd_lpf_vertical_4_dual_c(
bd);
}
-static INLINE void highbd_filter8(int8_t mask, uint8_t thresh, uint8_t flat,
+static INLINE void highbd_filter8(int8_t mask, uint8_t thresh, int8_t flat,
uint16_t *op3, uint16_t *op2, uint16_t *op1,
uint16_t *op0, uint16_t *oq0, uint16_t *oq1,
uint16_t *oq2, uint16_t *oq3, int bd) {
@@ -689,10 +732,15 @@ void aom_highbd_lpf_horizontal_8_c(uint16_t *s, int p, const uint8_t *blimit,
const uint8_t *limit, const uint8_t *thresh,
int bd) {
int i;
+#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
+ int count = 4;
+#else
+ int count = 8;
+#endif
// loop filter designed to work using chars so that we can make maximum use
// of 8 bit simd instructions.
- for (i = 0; i < 8; ++i) {
+ for (i = 0; i < count; ++i) {
const uint16_t p3 = s[-4 * p], p2 = s[-3 * p], p1 = s[-2 * p], p0 = s[-p];
const uint16_t q0 = s[0 * p], q1 = s[1 * p], q2 = s[2 * p], q3 = s[3 * p];
@@ -718,8 +766,13 @@ void aom_highbd_lpf_vertical_8_c(uint16_t *s, int pitch, const uint8_t *blimit,
const uint8_t *limit, const uint8_t *thresh,
int bd) {
int i;
+#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
+ int count = 4;
+#else
+ int count = 8;
+#endif
- for (i = 0; i < 8; ++i) {
+ for (i = 0; i < count; ++i) {
const uint16_t p3 = s[-4], p2 = s[-3], p1 = s[-2], p0 = s[-1];
const uint16_t q0 = s[0], q1 = s[1], q2 = s[2], q3 = s[3];
const int8_t mask =
@@ -741,8 +794,8 @@ void aom_highbd_lpf_vertical_8_dual_c(
bd);
}
-static INLINE void highbd_filter16(int8_t mask, uint8_t thresh, uint8_t flat,
- uint8_t flat2, uint16_t *op7, uint16_t *op6,
+static INLINE void highbd_filter16(int8_t mask, uint8_t thresh, int8_t flat,
+ int8_t flat2, uint16_t *op7, uint16_t *op6,
uint16_t *op5, uint16_t *op4, uint16_t *op3,
uint16_t *op2, uint16_t *op1, uint16_t *op0,
uint16_t *oq0, uint16_t *oq1, uint16_t *oq2,
@@ -813,10 +866,15 @@ static void highbd_mb_lpf_horizontal_edge_w(uint16_t *s, int p,
const uint8_t *thresh, int count,
int bd) {
int i;
+#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
+ int step = 4;
+#else
+ int step = 8;
+#endif
// loop filter designed to work using chars so that we can make maximum use
// of 8 bit simd instructions.
- for (i = 0; i < 8 * count; ++i) {
+ for (i = 0; i < step * count; ++i) {
const uint16_t p3 = s[-4 * p];
const uint16_t p2 = s[-3 * p];
const uint16_t p1 = s[-2 * p];
@@ -852,7 +910,11 @@ void aom_highbd_lpf_horizontal_edge_16_c(uint16_t *s, int p,
const uint8_t *blimit,
const uint8_t *limit,
const uint8_t *thresh, int bd) {
+#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
+ highbd_mb_lpf_horizontal_edge_w(s, p, blimit, limit, thresh, 1, bd);
+#else
highbd_mb_lpf_horizontal_edge_w(s, p, blimit, limit, thresh, 2, bd);
+#endif
}
static void highbd_mb_lpf_vertical_edge_w(uint16_t *s, int p,
@@ -888,13 +950,21 @@ static void highbd_mb_lpf_vertical_edge_w(uint16_t *s, int p,
void aom_highbd_lpf_vertical_16_c(uint16_t *s, int p, const uint8_t *blimit,
const uint8_t *limit, const uint8_t *thresh,
int bd) {
+#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
+ highbd_mb_lpf_vertical_edge_w(s, p, blimit, limit, thresh, 4, bd);
+#else
highbd_mb_lpf_vertical_edge_w(s, p, blimit, limit, thresh, 8, bd);
+#endif
}
void aom_highbd_lpf_vertical_16_dual_c(uint16_t *s, int p,
const uint8_t *blimit,
const uint8_t *limit,
const uint8_t *thresh, int bd) {
+#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
+ highbd_mb_lpf_vertical_edge_w(s, p, blimit, limit, thresh, 8, bd);
+#else
highbd_mb_lpf_vertical_edge_w(s, p, blimit, limit, thresh, 16, bd);
+#endif
}
#endif // CONFIG_HIGHBITDEPTH
diff --git a/third_party/aom/aom_dsp/mips/avg_msa.c b/third_party/aom/aom_dsp/mips/avg_msa.c
deleted file mode 100644
index 0e1728155..000000000
--- a/third_party/aom/aom_dsp/mips/avg_msa.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved
- *
- * This source code is subject to the terms of the BSD 2 Clause License and
- * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
- * was not distributed with this source code in the LICENSE file, you can
- * obtain it at www.aomedia.org/license/software. If the Alliance for Open
- * Media Patent License 1.0 was not distributed with this source code in the
- * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
- */
-
-#include "./aom_dsp_rtcd.h"
-#include "aom_dsp/mips/macros_msa.h"
-
-uint32_t aom_avg_8x8_msa(const uint8_t *src, int32_t src_stride) {
- uint32_t sum_out;
- v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
- v8u16 sum0, sum1, sum2, sum3, sum4, sum5, sum6, sum7;
- v4u32 sum = { 0 };
-
- LD_UB8(src, src_stride, src0, src1, src2, src3, src4, src5, src6, src7);
- HADD_UB4_UH(src0, src1, src2, src3, sum0, sum1, sum2, sum3);
- HADD_UB4_UH(src4, src5, src6, src7, sum4, sum5, sum6, sum7);
- ADD4(sum0, sum1, sum2, sum3, sum4, sum5, sum6, sum7, sum0, sum2, sum4, sum6);
- ADD2(sum0, sum2, sum4, sum6, sum0, sum4);
- sum0 += sum4;
-
- sum = __msa_hadd_u_w(sum0, sum0);
- sum0 = (v8u16)__msa_pckev_h((v8i16)sum, (v8i16)sum);
- sum = __msa_hadd_u_w(sum0, sum0);
- sum = (v4u32)__msa_srari_w((v4i32)sum, 6);
- sum_out = __msa_copy_u_w((v4i32)sum, 0);
-
- return sum_out;
-}
-
-uint32_t aom_avg_4x4_msa(const uint8_t *src, int32_t src_stride) {
- uint32_t sum_out;
- uint32_t src0, src1, src2, src3;
- v16u8 vec = { 0 };
- v8u16 sum0;
- v4u32 sum1;
- v2u64 sum2;
-
- LW4(src, src_stride, src0, src1, src2, src3);
- INSERT_W4_UB(src0, src1, src2, src3, vec);
-
- sum0 = __msa_hadd_u_h(vec, vec);
- sum1 = __msa_hadd_u_w(sum0, sum0);
- sum0 = (v8u16)__msa_pckev_h((v8i16)sum1, (v8i16)sum1);
- sum1 = __msa_hadd_u_w(sum0, sum0);
- sum2 = __msa_hadd_u_d(sum1, sum1);
- sum1 = (v4u32)__msa_srari_w((v4i32)sum2, 4);
- sum_out = __msa_copy_u_w((v4i32)sum1, 0);
-
- return sum_out;
-}
diff --git a/third_party/aom/aom_dsp/prob.c b/third_party/aom/aom_dsp/prob.c
index c60bfdac5..eefe7521f 100644
--- a/third_party/aom/aom_dsp/prob.c
+++ b/third_party/aom/aom_dsp/prob.c
@@ -11,25 +11,10 @@
#include "./aom_config.h"
-#if CONFIG_EC_MULTISYMBOL
#include <string.h>
-#endif
#include "aom_dsp/prob.h"
-const uint8_t aom_norm[256] = {
- 0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
static unsigned int tree_merge_probs_impl(unsigned int i,
const aom_tree_index *tree,
const aom_prob *pre_probs,
@@ -53,7 +38,6 @@ void aom_tree_merge_probs(const aom_tree_index *tree, const aom_prob *pre_probs,
tree_merge_probs_impl(0, tree, pre_probs, counts, probs);
}
-#if CONFIG_EC_MULTISYMBOL
typedef struct tree_node tree_node;
struct tree_node {
@@ -233,4 +217,3 @@ void av1_indices_from_tree(int *ind, int *inv, const aom_tree_index *tree) {
int stack_index = 0;
tree_to_index(&stack_index, ind, inv, tree, 0, 0);
}
-#endif
diff --git a/third_party/aom/aom_dsp/prob.h b/third_party/aom/aom_dsp/prob.h
index 808592923..ec6654ab7 100644
--- a/third_party/aom/aom_dsp/prob.h
+++ b/third_party/aom/aom_dsp/prob.h
@@ -20,7 +20,7 @@
#include "aom_ports/bitops.h"
#include "aom_ports/mem.h"
-#if CONFIG_DAALA_EC
+#if !CONFIG_ANS
#include "aom_dsp/entcode.h"
#endif
@@ -33,14 +33,12 @@ typedef uint8_t aom_prob;
// TODO(negge): Rename this aom_prob once we remove vpxbool.
typedef uint16_t aom_cdf_prob;
-#if CONFIG_EC_MULTISYMBOL
#define CDF_SIZE(x) ((x) + 1)
-#endif
#define CDF_PROB_BITS 15
#define CDF_PROB_TOP (1 << CDF_PROB_BITS)
-#if CONFIG_DAALA_EC
+#if !CONFIG_ANS
#define AOM_ICDF OD_ICDF
#else
#define AOM_ICDF(x) (x)
@@ -117,7 +115,6 @@ static INLINE aom_prob mode_mv_merge_probs(aom_prob pre_prob,
void aom_tree_merge_probs(const aom_tree_index *tree, const aom_prob *pre_probs,
const unsigned int *counts, aom_prob *probs);
-#if CONFIG_EC_MULTISYMBOL
int tree_to_cdf(const aom_tree_index *tree, const aom_prob *probs,
aom_tree_index root, aom_cdf_prob *cdf, aom_tree_index *ind,
int *pth, int *len);
@@ -150,9 +147,6 @@ static INLINE void av1_tree_to_cdf(const aom_tree_index *tree,
} while (0)
void av1_indices_from_tree(int *ind, int *inv, const aom_tree_index *tree);
-#endif
-
-DECLARE_ALIGNED(16, extern const uint8_t, aom_norm[256]);
#if CONFIG_EC_ADAPT
static INLINE void update_cdf(aom_cdf_prob *cdf, int val, int nsymbs) {
@@ -165,7 +159,7 @@ static INLINE void update_cdf(aom_cdf_prob *cdf, int val, int nsymbs) {
tmp = AOM_ICDF(tmp0);
diff = ((CDF_PROB_TOP - (nsymbs << rate2)) >> rate) << rate;
// Single loop (faster)
-#if CONFIG_DAALA_EC && CONFIG_EC_SMALLMUL
+#if !CONFIG_ANS && CONFIG_EC_SMALLMUL
for (i = 0; i < nsymbs - 1; ++i, tmp -= tmp0) {
tmp -= (i == val ? diff : 0);
cdf[i] += ((tmp - cdf[i]) >> rate);
diff --git a/third_party/aom/aom_dsp/sad.c b/third_party/aom/aom_dsp/sad.c
index 3e1070519..2cc172ba5 100644
--- a/third_party/aom/aom_dsp/sad.c
+++ b/third_party/aom/aom_dsp/sad.c
@@ -16,6 +16,7 @@
#include "aom/aom_integer.h"
#include "aom_ports/mem.h"
+#include "aom_dsp/blend.h"
/* Sum the difference between every corresponding element of the buffers. */
static INLINE unsigned int sad(const uint8_t *a, int a_stride, const uint8_t *b,
@@ -311,15 +312,20 @@ highbd_sadMxNx4D(4, 4)
#if CONFIG_AV1 && CONFIG_EXT_INTER
static INLINE
- unsigned int masked_sad(const uint8_t *a, int a_stride, const uint8_t *b,
+ unsigned int masked_sad(const uint8_t *src, int src_stride,
+ const uint8_t *a, int a_stride, const uint8_t *b,
int b_stride, const uint8_t *m, int m_stride,
int width, int height) {
int y, x;
unsigned int sad = 0;
for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) sad += m[x] * abs(a[x] - b[x]);
+ for (x = 0; x < width; x++) {
+ const uint8_t pred = AOM_BLEND_A64(m[x], a[x], b[x]);
+ sad += abs(pred - src[x]);
+ }
+ src += src_stride;
a += a_stride;
b += b_stride;
m += m_stride;
@@ -329,12 +335,17 @@ highbd_sadMxNx4D(4, 4)
return sad;
}
-#define MASKSADMxN(m, n) \
- unsigned int aom_masked_sad##m##x##n##_c( \
- const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride, \
- const uint8_t *msk, int msk_stride) { \
- return masked_sad(src, src_stride, ref, ref_stride, msk, msk_stride, m, \
- n); \
+#define MASKSADMxN(m, n) \
+ unsigned int aom_masked_sad##m##x##n##_c( \
+ const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride, \
+ const uint8_t *second_pred, const uint8_t *msk, int msk_stride, \
+ int invert_mask) { \
+ if (!invert_mask) \
+ return masked_sad(src, src_stride, ref, ref_stride, second_pred, m, msk, \
+ msk_stride, m, n); \
+ else \
+ return masked_sad(src, src_stride, second_pred, m, ref, ref_stride, msk, \
+ msk_stride, m, n); \
}
/* clang-format off */
@@ -360,18 +371,24 @@ MASKSADMxN(4, 4)
#if CONFIG_HIGHBITDEPTH
static INLINE
- unsigned int highbd_masked_sad(const uint8_t *a8, int a_stride,
+ unsigned int highbd_masked_sad(const uint8_t *src8, int src_stride,
+ const uint8_t *a8, int a_stride,
const uint8_t *b8, int b_stride,
const uint8_t *m, int m_stride, int width,
int height) {
int y, x;
unsigned int sad = 0;
+ const uint16_t *src = CONVERT_TO_SHORTPTR(src8);
const uint16_t *a = CONVERT_TO_SHORTPTR(a8);
const uint16_t *b = CONVERT_TO_SHORTPTR(b8);
for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) sad += m[x] * abs(a[x] - b[x]);
+ for (x = 0; x < width; x++) {
+ const uint16_t pred = AOM_BLEND_A64(m[x], a[x], b[x]);
+ sad += abs(pred - src[x]);
+ }
+ src += src_stride;
a += a_stride;
b += b_stride;
m += m_stride;
@@ -381,12 +398,17 @@ MASKSADMxN(4, 4)
return sad;
}
-#define HIGHBD_MASKSADMXN(m, n) \
- unsigned int aom_highbd_masked_sad##m##x##n##_c( \
- const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride, \
- const uint8_t *msk, int msk_stride) { \
- return highbd_masked_sad(src, src_stride, ref, ref_stride, msk, \
- msk_stride, m, n); \
+#define HIGHBD_MASKSADMXN(m, n) \
+ unsigned int aom_highbd_masked_sad##m##x##n##_c( \
+ const uint8_t *src8, int src_stride, const uint8_t *ref8, \
+ int ref_stride, const uint8_t *second_pred8, const uint8_t *msk, \
+ int msk_stride, int invert_mask) { \
+ if (!invert_mask) \
+ return highbd_masked_sad(src8, src_stride, ref8, ref_stride, \
+ second_pred8, m, msk, msk_stride, m, n); \
+ else \
+ return highbd_masked_sad(src8, src_stride, second_pred8, m, ref8, \
+ ref_stride, msk, msk_stride, m, n); \
}
#if CONFIG_EXT_PARTITION
diff --git a/third_party/aom/aom_dsp/simd/v64_intrinsics.h b/third_party/aom/aom_dsp/simd/v64_intrinsics.h
index ee2b683a4..5c0042d8c 100644
--- a/third_party/aom/aom_dsp/simd/v64_intrinsics.h
+++ b/third_party/aom/aom_dsp/simd/v64_intrinsics.h
@@ -60,7 +60,9 @@ SIMD_INLINE void v64_store_aligned(void *p, v64 a) {
c_v64_store_aligned(p, a);
}
-SIMD_INLINE v64 v64_align(v64 a, v64 b, c) { return c_v64_align(a, b, c); }
+SIMD_INLINE v64 v64_align(v64 a, v64 b, unsigned int c) {
+ return c_v64_align(a, b, c);
+}
SIMD_INLINE v64 v64_zero() { return c_v64_zero(); }
SIMD_INLINE v64 v64_dup_8(uint8_t x) { return c_v64_dup_8(x); }
diff --git a/third_party/aom/aom_dsp/variance.c b/third_party/aom/aom_dsp/variance.c
index 9fc0db783..79677c92f 100644
--- a/third_party/aom/aom_dsp/variance.c
+++ b/third_party/aom/aom_dsp/variance.c
@@ -18,6 +18,7 @@
#include "aom_dsp/variance.h"
#include "aom_dsp/aom_filter.h"
+#include "aom_dsp/blend.h"
uint32_t aom_get4x4sse_cs_c(const uint8_t *a, int a_stride, const uint8_t *b,
int b_stride) {
@@ -672,297 +673,215 @@ void aom_highbd_comp_avg_upsampled_pred_c(uint16_t *comp_pred,
#endif // CONFIG_HIGHBITDEPTH
#if CONFIG_AV1 && CONFIG_EXT_INTER
-void masked_variance(const uint8_t *a, int a_stride, const uint8_t *b,
- int b_stride, const uint8_t *m, int m_stride, int w, int h,
- unsigned int *sse, int *sum) {
+void aom_comp_mask_pred_c(uint8_t *comp_pred, const uint8_t *pred, int width,
+ int height, const uint8_t *ref, int ref_stride,
+ const uint8_t *mask, int mask_stride,
+ int invert_mask) {
int i, j;
- int64_t sum64 = 0;
- uint64_t sse64 = 0;
-
- for (i = 0; i < h; i++) {
- for (j = 0; j < w; j++) {
- const int diff = (a[j] - b[j]) * (m[j]);
- sum64 += diff;
- sse64 += diff * diff;
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; ++j) {
+ if (!invert_mask)
+ comp_pred[j] = AOM_BLEND_A64(mask[j], ref[j], pred[j]);
+ else
+ comp_pred[j] = AOM_BLEND_A64(mask[j], pred[j], ref[j]);
}
-
- a += a_stride;
- b += b_stride;
- m += m_stride;
+ comp_pred += width;
+ pred += width;
+ ref += ref_stride;
+ mask += mask_stride;
}
- sum64 = (sum64 >= 0) ? sum64 : -sum64;
- *sum = (int)ROUND_POWER_OF_TWO(sum64, 6);
- *sse = (uint32_t)ROUND_POWER_OF_TWO(sse64, 12);
}
-#define MASK_VAR(W, H) \
- unsigned int aom_masked_variance##W##x##H##_c( \
- const uint8_t *a, int a_stride, const uint8_t *b, int b_stride, \
- const uint8_t *m, int m_stride, unsigned int *sse) { \
- int sum; \
- masked_variance(a, a_stride, b, b_stride, m, m_stride, W, H, sse, &sum); \
- return *sse - (unsigned int)(((int64_t)sum * sum) / (W * H)); \
+void aom_comp_mask_upsampled_pred_c(uint8_t *comp_pred, const uint8_t *pred,
+ int width, int height, const uint8_t *ref,
+ int ref_stride, const uint8_t *mask,
+ int mask_stride, int invert_mask) {
+ int i, j;
+ int stride = ref_stride << 3;
+
+ for (i = 0; i < height; i++) {
+ for (j = 0; j < width; j++) {
+ if (!invert_mask)
+ comp_pred[j] = AOM_BLEND_A64(mask[j], ref[(j << 3)], pred[j]);
+ else
+ comp_pred[j] = AOM_BLEND_A64(mask[j], pred[j], ref[(j << 3)]);
+ }
+ comp_pred += width;
+ pred += width;
+ ref += stride;
+ mask += mask_stride;
}
+}
#define MASK_SUBPIX_VAR(W, H) \
unsigned int aom_masked_sub_pixel_variance##W##x##H##_c( \
const uint8_t *src, int src_stride, int xoffset, int yoffset, \
- const uint8_t *dst, int dst_stride, const uint8_t *msk, int msk_stride, \
+ const uint8_t *ref, int ref_stride, const uint8_t *second_pred, \
+ const uint8_t *msk, int msk_stride, int invert_mask, \
unsigned int *sse) { \
uint16_t fdata3[(H + 1) * W]; \
uint8_t temp2[H * W]; \
+ DECLARE_ALIGNED(16, uint8_t, temp3[H * W]); \
\
var_filter_block2d_bil_first_pass(src, fdata3, src_stride, 1, H + 1, W, \
bilinear_filters_2t[xoffset]); \
var_filter_block2d_bil_second_pass(fdata3, temp2, W, W, H, W, \
bilinear_filters_2t[yoffset]); \
\
- return aom_masked_variance##W##x##H##_c(temp2, W, dst, dst_stride, msk, \
- msk_stride, sse); \
+ aom_comp_mask_pred_c(temp3, second_pred, W, H, temp2, W, msk, msk_stride, \
+ invert_mask); \
+ return aom_variance##W##x##H##_c(temp3, W, ref, ref_stride, sse); \
}
-MASK_VAR(4, 4)
MASK_SUBPIX_VAR(4, 4)
-
-MASK_VAR(4, 8)
MASK_SUBPIX_VAR(4, 8)
-
-MASK_VAR(8, 4)
MASK_SUBPIX_VAR(8, 4)
-
-MASK_VAR(8, 8)
MASK_SUBPIX_VAR(8, 8)
-
-MASK_VAR(8, 16)
MASK_SUBPIX_VAR(8, 16)
-
-MASK_VAR(16, 8)
MASK_SUBPIX_VAR(16, 8)
-
-MASK_VAR(16, 16)
MASK_SUBPIX_VAR(16, 16)
-
-MASK_VAR(16, 32)
MASK_SUBPIX_VAR(16, 32)
-
-MASK_VAR(32, 16)
MASK_SUBPIX_VAR(32, 16)
-
-MASK_VAR(32, 32)
MASK_SUBPIX_VAR(32, 32)
-
-MASK_VAR(32, 64)
MASK_SUBPIX_VAR(32, 64)
-
-MASK_VAR(64, 32)
MASK_SUBPIX_VAR(64, 32)
-
-MASK_VAR(64, 64)
MASK_SUBPIX_VAR(64, 64)
-
#if CONFIG_EXT_PARTITION
-MASK_VAR(64, 128)
MASK_SUBPIX_VAR(64, 128)
-
-MASK_VAR(128, 64)
MASK_SUBPIX_VAR(128, 64)
-
-MASK_VAR(128, 128)
MASK_SUBPIX_VAR(128, 128)
#endif // CONFIG_EXT_PARTITION
#if CONFIG_HIGHBITDEPTH
-void highbd_masked_variance64(const uint8_t *a8, int a_stride,
- const uint8_t *b8, int b_stride, const uint8_t *m,
- int m_stride, int w, int h, uint64_t *sse,
- int64_t *sum) {
+void aom_highbd_comp_mask_pred_c(uint16_t *comp_pred, const uint8_t *pred8,
+ int width, int height, const uint8_t *ref8,
+ int ref_stride, const uint8_t *mask,
+ int mask_stride, int invert_mask) {
int i, j;
- uint16_t *a = CONVERT_TO_SHORTPTR(a8);
- uint16_t *b = CONVERT_TO_SHORTPTR(b8);
-
- *sum = 0;
- *sse = 0;
-
- for (i = 0; i < h; i++) {
- for (j = 0; j < w; j++) {
- const int diff = (a[j] - b[j]) * (m[j]);
- *sum += (int64_t)diff;
- *sse += (int64_t)diff * diff;
+ uint16_t *pred = CONVERT_TO_SHORTPTR(pred8);
+ uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; ++j) {
+ if (!invert_mask)
+ comp_pred[j] = AOM_BLEND_A64(mask[j], ref[j], pred[j]);
+ else
+ comp_pred[j] = AOM_BLEND_A64(mask[j], pred[j], ref[j]);
}
-
- a += a_stride;
- b += b_stride;
- m += m_stride;
+ comp_pred += width;
+ pred += width;
+ ref += ref_stride;
+ mask += mask_stride;
}
- *sum = (*sum >= 0) ? *sum : -*sum;
- *sum = ROUND_POWER_OF_TWO(*sum, 6);
- *sse = ROUND_POWER_OF_TWO(*sse, 12);
}
-void highbd_masked_variance(const uint8_t *a8, int a_stride, const uint8_t *b8,
- int b_stride, const uint8_t *m, int m_stride, int w,
- int h, unsigned int *sse, int *sum) {
- int64_t sum64;
- uint64_t sse64;
- highbd_masked_variance64(a8, a_stride, b8, b_stride, m, m_stride, w, h,
- &sse64, &sum64);
- *sum = (int)sum64;
- *sse = (unsigned int)sse64;
-}
-
-void highbd_10_masked_variance(const uint8_t *a8, int a_stride,
- const uint8_t *b8, int b_stride,
- const uint8_t *m, int m_stride, int w, int h,
- unsigned int *sse, int *sum) {
- int64_t sum64;
- uint64_t sse64;
- highbd_masked_variance64(a8, a_stride, b8, b_stride, m, m_stride, w, h,
- &sse64, &sum64);
- *sum = (int)ROUND_POWER_OF_TWO(sum64, 2);
- *sse = (unsigned int)ROUND_POWER_OF_TWO(sse64, 4);
-}
-
-void highbd_12_masked_variance(const uint8_t *a8, int a_stride,
- const uint8_t *b8, int b_stride,
- const uint8_t *m, int m_stride, int w, int h,
- unsigned int *sse, int *sum) {
- int64_t sum64;
- uint64_t sse64;
- highbd_masked_variance64(a8, a_stride, b8, b_stride, m, m_stride, w, h,
- &sse64, &sum64);
- *sum = (int)ROUND_POWER_OF_TWO(sum64, 4);
- *sse = (unsigned int)ROUND_POWER_OF_TWO(sse64, 8);
-}
+void aom_highbd_comp_mask_upsampled_pred_c(uint16_t *comp_pred,
+ const uint8_t *pred8, int width,
+ int height, const uint8_t *ref8,
+ int ref_stride, const uint8_t *mask,
+ int mask_stride, int invert_mask) {
+ int i, j;
+ int stride = ref_stride << 3;
-#define HIGHBD_MASK_VAR(W, H) \
- unsigned int aom_highbd_masked_variance##W##x##H##_c( \
- const uint8_t *a, int a_stride, const uint8_t *b, int b_stride, \
- const uint8_t *m, int m_stride, unsigned int *sse) { \
- int sum; \
- highbd_masked_variance(a, a_stride, b, b_stride, m, m_stride, W, H, sse, \
- &sum); \
- return *sse - (unsigned int)(((int64_t)sum * sum) / (W * H)); \
- } \
- \
- unsigned int aom_highbd_10_masked_variance##W##x##H##_c( \
- const uint8_t *a, int a_stride, const uint8_t *b, int b_stride, \
- const uint8_t *m, int m_stride, unsigned int *sse) { \
- int sum; \
- int64_t var; \
- highbd_10_masked_variance(a, a_stride, b, b_stride, m, m_stride, W, H, \
- sse, &sum); \
- var = (int64_t)(*sse) - (((int64_t)sum * sum) / (W * H)); \
- return (var >= 0) ? (uint32_t)var : 0; \
- } \
- \
- unsigned int aom_highbd_12_masked_variance##W##x##H##_c( \
- const uint8_t *a, int a_stride, const uint8_t *b, int b_stride, \
- const uint8_t *m, int m_stride, unsigned int *sse) { \
- int sum; \
- int64_t var; \
- highbd_12_masked_variance(a, a_stride, b, b_stride, m, m_stride, W, H, \
- sse, &sum); \
- var = (int64_t)(*sse) - (((int64_t)sum * sum) / (W * H)); \
- return (var >= 0) ? (uint32_t)var : 0; \
+ uint16_t *pred = CONVERT_TO_SHORTPTR(pred8);
+ uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; ++j) {
+ if (!invert_mask)
+ comp_pred[j] = AOM_BLEND_A64(mask[j], ref[j << 3], pred[j]);
+ else
+ comp_pred[j] = AOM_BLEND_A64(mask[j], pred[j], ref[j << 3]);
+ }
+ comp_pred += width;
+ pred += width;
+ ref += stride;
+ mask += mask_stride;
}
+}
-#define HIGHBD_MASK_SUBPIX_VAR(W, H) \
- unsigned int aom_highbd_masked_sub_pixel_variance##W##x##H##_c( \
- const uint8_t *src, int src_stride, int xoffset, int yoffset, \
- const uint8_t *dst, int dst_stride, const uint8_t *msk, int msk_stride, \
- unsigned int *sse) { \
- uint16_t fdata3[(H + 1) * W]; \
- uint16_t temp2[H * W]; \
- \
- aom_highbd_var_filter_block2d_bil_first_pass( \
- src, fdata3, src_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]); \
- aom_highbd_var_filter_block2d_bil_second_pass( \
- fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]); \
- \
- return aom_highbd_masked_variance##W##x##H##_c( \
- CONVERT_TO_BYTEPTR(temp2), W, dst, dst_stride, msk, msk_stride, sse); \
- } \
- \
- unsigned int aom_highbd_10_masked_sub_pixel_variance##W##x##H##_c( \
- const uint8_t *src, int src_stride, int xoffset, int yoffset, \
- const uint8_t *dst, int dst_stride, const uint8_t *msk, int msk_stride, \
- unsigned int *sse) { \
- uint16_t fdata3[(H + 1) * W]; \
- uint16_t temp2[H * W]; \
- \
- aom_highbd_var_filter_block2d_bil_first_pass( \
- src, fdata3, src_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]); \
- aom_highbd_var_filter_block2d_bil_second_pass( \
- fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]); \
- \
- return aom_highbd_10_masked_variance##W##x##H##_c( \
- CONVERT_TO_BYTEPTR(temp2), W, dst, dst_stride, msk, msk_stride, sse); \
- } \
- \
- unsigned int aom_highbd_12_masked_sub_pixel_variance##W##x##H##_c( \
- const uint8_t *src, int src_stride, int xoffset, int yoffset, \
- const uint8_t *dst, int dst_stride, const uint8_t *msk, int msk_stride, \
- unsigned int *sse) { \
- uint16_t fdata3[(H + 1) * W]; \
- uint16_t temp2[H * W]; \
- \
- aom_highbd_var_filter_block2d_bil_first_pass( \
- src, fdata3, src_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]); \
- aom_highbd_var_filter_block2d_bil_second_pass( \
- fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]); \
- \
- return aom_highbd_12_masked_variance##W##x##H##_c( \
- CONVERT_TO_BYTEPTR(temp2), W, dst, dst_stride, msk, msk_stride, sse); \
+#define HIGHBD_MASK_SUBPIX_VAR(W, H) \
+ unsigned int aom_highbd_8_masked_sub_pixel_variance##W##x##H##_c( \
+ const uint8_t *src, int src_stride, int xoffset, int yoffset, \
+ const uint8_t *ref, int ref_stride, const uint8_t *second_pred, \
+ const uint8_t *msk, int msk_stride, int invert_mask, \
+ unsigned int *sse) { \
+ uint16_t fdata3[(H + 1) * W]; \
+ uint16_t temp2[H * W]; \
+ DECLARE_ALIGNED(16, uint16_t, temp3[H * W]); \
+ \
+ aom_highbd_var_filter_block2d_bil_first_pass( \
+ src, fdata3, src_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]); \
+ aom_highbd_var_filter_block2d_bil_second_pass( \
+ fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]); \
+ \
+ aom_highbd_comp_mask_pred_c(temp3, second_pred, W, H, \
+ CONVERT_TO_BYTEPTR(temp2), W, msk, msk_stride, \
+ invert_mask); \
+ \
+ return aom_highbd_8_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp3), W, \
+ ref, ref_stride, sse); \
+ } \
+ \
+ unsigned int aom_highbd_10_masked_sub_pixel_variance##W##x##H##_c( \
+ const uint8_t *src, int src_stride, int xoffset, int yoffset, \
+ const uint8_t *ref, int ref_stride, const uint8_t *second_pred, \
+ const uint8_t *msk, int msk_stride, int invert_mask, \
+ unsigned int *sse) { \
+ uint16_t fdata3[(H + 1) * W]; \
+ uint16_t temp2[H * W]; \
+ DECLARE_ALIGNED(16, uint16_t, temp3[H * W]); \
+ \
+ aom_highbd_var_filter_block2d_bil_first_pass( \
+ src, fdata3, src_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]); \
+ aom_highbd_var_filter_block2d_bil_second_pass( \
+ fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]); \
+ \
+ aom_highbd_comp_mask_pred_c(temp3, second_pred, W, H, \
+ CONVERT_TO_BYTEPTR(temp2), W, msk, msk_stride, \
+ invert_mask); \
+ \
+ return aom_highbd_10_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp3), W, \
+ ref, ref_stride, sse); \
+ } \
+ \
+ unsigned int aom_highbd_12_masked_sub_pixel_variance##W##x##H##_c( \
+ const uint8_t *src, int src_stride, int xoffset, int yoffset, \
+ const uint8_t *ref, int ref_stride, const uint8_t *second_pred, \
+ const uint8_t *msk, int msk_stride, int invert_mask, \
+ unsigned int *sse) { \
+ uint16_t fdata3[(H + 1) * W]; \
+ uint16_t temp2[H * W]; \
+ DECLARE_ALIGNED(16, uint16_t, temp3[H * W]); \
+ \
+ aom_highbd_var_filter_block2d_bil_first_pass( \
+ src, fdata3, src_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]); \
+ aom_highbd_var_filter_block2d_bil_second_pass( \
+ fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]); \
+ \
+ aom_highbd_comp_mask_pred_c(temp3, second_pred, W, H, \
+ CONVERT_TO_BYTEPTR(temp2), W, msk, msk_stride, \
+ invert_mask); \
+ \
+ return aom_highbd_12_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp3), W, \
+ ref, ref_stride, sse); \
}
-HIGHBD_MASK_VAR(4, 4)
HIGHBD_MASK_SUBPIX_VAR(4, 4)
-
-HIGHBD_MASK_VAR(4, 8)
HIGHBD_MASK_SUBPIX_VAR(4, 8)
-
-HIGHBD_MASK_VAR(8, 4)
HIGHBD_MASK_SUBPIX_VAR(8, 4)
-
-HIGHBD_MASK_VAR(8, 8)
HIGHBD_MASK_SUBPIX_VAR(8, 8)
-
-HIGHBD_MASK_VAR(8, 16)
HIGHBD_MASK_SUBPIX_VAR(8, 16)
-
-HIGHBD_MASK_VAR(16, 8)
HIGHBD_MASK_SUBPIX_VAR(16, 8)
-
-HIGHBD_MASK_VAR(16, 16)
HIGHBD_MASK_SUBPIX_VAR(16, 16)
-
-HIGHBD_MASK_VAR(16, 32)
HIGHBD_MASK_SUBPIX_VAR(16, 32)
-
-HIGHBD_MASK_VAR(32, 16)
HIGHBD_MASK_SUBPIX_VAR(32, 16)
-
-HIGHBD_MASK_VAR(32, 32)
HIGHBD_MASK_SUBPIX_VAR(32, 32)
-
-HIGHBD_MASK_VAR(32, 64)
HIGHBD_MASK_SUBPIX_VAR(32, 64)
-
-HIGHBD_MASK_VAR(64, 32)
HIGHBD_MASK_SUBPIX_VAR(64, 32)
-
-HIGHBD_MASK_VAR(64, 64)
HIGHBD_MASK_SUBPIX_VAR(64, 64)
-
#if CONFIG_EXT_PARTITION
-HIGHBD_MASK_VAR(64, 128)
HIGHBD_MASK_SUBPIX_VAR(64, 128)
-
-HIGHBD_MASK_VAR(128, 64)
HIGHBD_MASK_SUBPIX_VAR(128, 64)
-
-HIGHBD_MASK_VAR(128, 128)
HIGHBD_MASK_SUBPIX_VAR(128, 128)
#endif // CONFIG_EXT_PARTITION
#endif // CONFIG_HIGHBITDEPTH
diff --git a/third_party/aom/aom_dsp/variance.h b/third_party/aom/aom_dsp/variance.h
index 7c925cfac..20f0895cb 100644
--- a/third_party/aom/aom_dsp/variance.h
+++ b/third_party/aom/aom_dsp/variance.h
@@ -57,15 +57,13 @@ typedef unsigned int (*aom_subp_avg_variance_fn_t)(
#if CONFIG_AV1 && CONFIG_EXT_INTER
typedef unsigned int (*aom_masked_sad_fn_t)(const uint8_t *src, int src_stride,
const uint8_t *ref, int ref_stride,
- const uint8_t *msk_ptr,
- int msk_stride);
-typedef unsigned int (*aom_masked_variance_fn_t)(
- const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride,
- const uint8_t *msk, int msk_stride, unsigned int *sse);
+ const uint8_t *second_pred,
+ const uint8_t *msk, int msk_stride,
+ int invert_mask);
typedef unsigned int (*aom_masked_subpixvariance_fn_t)(
const uint8_t *src, int src_stride, int xoffset, int yoffset,
- const uint8_t *ref, int ref_stride, const uint8_t *msk, int msk_stride,
- unsigned int *sse);
+ const uint8_t *ref, int ref_stride, const uint8_t *second_pred,
+ const uint8_t *msk, int msk_stride, int invert_mask, unsigned int *sse);
#endif // CONFIG_AV1 && CONFIG_EXT_INTER
#if CONFIG_AV1 && CONFIG_MOTION_VAR
@@ -94,7 +92,6 @@ typedef struct aom_variance_vtable {
aom_sad_multi_d_fn_t sdx4df;
#if CONFIG_EXT_INTER
aom_masked_sad_fn_t msdf;
- aom_masked_variance_fn_t mvf;
aom_masked_subpixvariance_fn_t msvf;
#endif // CONFIG_EXT_INTER
#if CONFIG_MOTION_VAR
diff --git a/third_party/aom/aom_dsp/x86/aom_convolve_hip_sse2.c b/third_party/aom/aom_dsp/x86/aom_convolve_hip_sse2.c
new file mode 100644
index 000000000..14352895d
--- /dev/null
+++ b/third_party/aom/aom_dsp/x86/aom_convolve_hip_sse2.c
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2016, Alliance for Open Media. All rights reserved
+ *
+ * This source code is subject to the terms of the BSD 2 Clause License and
+ * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
+ * was not distributed with this source code in the LICENSE file, you can
+ * obtain it at www.aomedia.org/license/software. If the Alliance for Open
+ * Media Patent License 1.0 was not distributed with this source code in the
+ * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
+ */
+
+#include <emmintrin.h>
+#include <assert.h>
+
+#include "./aom_dsp_rtcd.h"
+#include "aom_dsp/aom_convolve.h"
+#include "aom_dsp/aom_dsp_common.h"
+#include "aom_dsp/aom_filter.h"
+
+void aom_convolve8_add_src_hip_sse2(const uint8_t *src, ptrdiff_t src_stride,
+ uint8_t *dst, ptrdiff_t dst_stride,
+ const int16_t *filter_x, int x_step_q4,
+ const int16_t *filter_y, int y_step_q4,
+ int w, int h) {
+ const int bd = 8;
+ assert(x_step_q4 == 16 && y_step_q4 == 16);
+ assert(!(w & 7));
+ (void)x_step_q4;
+ (void)y_step_q4;
+
+ uint16_t temp[(MAX_SB_SIZE + SUBPEL_TAPS - 1) * MAX_SB_SIZE];
+ int intermediate_height = h + SUBPEL_TAPS - 1;
+ int i, j;
+ const int center_tap = ((SUBPEL_TAPS - 1) / 2);
+ const uint8_t *const src_ptr = src - center_tap * src_stride - center_tap;
+
+ const __m128i zero = _mm_setzero_si128();
+ // Add an offset to account for the "add_src" part of the convolve function.
+ const __m128i offset = _mm_insert_epi16(zero, 1 << FILTER_BITS, 3);
+
+ /* Horizontal filter */
+ {
+ const __m128i coeffs_x =
+ _mm_add_epi16(_mm_loadu_si128((__m128i *)filter_x), offset);
+
+ // coeffs 0 1 0 1 2 3 2 3
+ const __m128i tmp_0 = _mm_unpacklo_epi32(coeffs_x, coeffs_x);
+ // coeffs 4 5 4 5 6 7 6 7
+ const __m128i tmp_1 = _mm_unpackhi_epi32(coeffs_x, coeffs_x);
+
+ // coeffs 0 1 0 1 0 1 0 1
+ const __m128i coeff_01 = _mm_unpacklo_epi64(tmp_0, tmp_0);
+ // coeffs 2 3 2 3 2 3 2 3
+ const __m128i coeff_23 = _mm_unpackhi_epi64(tmp_0, tmp_0);
+ // coeffs 4 5 4 5 4 5 4 5
+ const __m128i coeff_45 = _mm_unpacklo_epi64(tmp_1, tmp_1);
+ // coeffs 6 7 6 7 6 7 6 7
+ const __m128i coeff_67 = _mm_unpackhi_epi64(tmp_1, tmp_1);
+
+ const __m128i round_const =
+ _mm_set1_epi32((1 << (FILTER_BITS - EXTRAPREC_BITS - 1)) +
+ (1 << (bd + FILTER_BITS - 1)));
+
+ for (i = 0; i < intermediate_height; ++i) {
+ for (j = 0; j < w; j += 8) {
+ const __m128i data =
+ _mm_loadu_si128((__m128i *)&src_ptr[i * src_stride + j]);
+
+ // Filter even-index pixels
+ const __m128i src_0 = _mm_unpacklo_epi8(data, zero);
+ const __m128i res_0 = _mm_madd_epi16(src_0, coeff_01);
+ const __m128i src_2 = _mm_unpacklo_epi8(_mm_srli_si128(data, 2), zero);
+ const __m128i res_2 = _mm_madd_epi16(src_2, coeff_23);
+ const __m128i src_4 = _mm_unpacklo_epi8(_mm_srli_si128(data, 4), zero);
+ const __m128i res_4 = _mm_madd_epi16(src_4, coeff_45);
+ const __m128i src_6 = _mm_unpacklo_epi8(_mm_srli_si128(data, 6), zero);
+ const __m128i res_6 = _mm_madd_epi16(src_6, coeff_67);
+
+ __m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_4),
+ _mm_add_epi32(res_2, res_6));
+ res_even = _mm_srai_epi32(_mm_add_epi32(res_even, round_const),
+ FILTER_BITS - EXTRAPREC_BITS);
+
+ // Filter odd-index pixels
+ const __m128i src_1 = _mm_unpacklo_epi8(_mm_srli_si128(data, 1), zero);
+ const __m128i res_1 = _mm_madd_epi16(src_1, coeff_01);
+ const __m128i src_3 = _mm_unpacklo_epi8(_mm_srli_si128(data, 3), zero);
+ const __m128i res_3 = _mm_madd_epi16(src_3, coeff_23);
+ const __m128i src_5 = _mm_unpacklo_epi8(_mm_srli_si128(data, 5), zero);
+ const __m128i res_5 = _mm_madd_epi16(src_5, coeff_45);
+ const __m128i src_7 = _mm_unpacklo_epi8(_mm_srli_si128(data, 7), zero);
+ const __m128i res_7 = _mm_madd_epi16(src_7, coeff_67);
+
+ __m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_5),
+ _mm_add_epi32(res_3, res_7));
+ res_odd = _mm_srai_epi32(_mm_add_epi32(res_odd, round_const),
+ FILTER_BITS - EXTRAPREC_BITS);
+
+ // Pack in the column order 0, 2, 4, 6, 1, 3, 5, 7
+ __m128i res = _mm_packs_epi32(res_even, res_odd);
+ res = _mm_min_epi16(_mm_max_epi16(res, zero),
+ _mm_set1_epi16(EXTRAPREC_CLAMP_LIMIT(bd) - 1));
+ _mm_storeu_si128((__m128i *)&temp[i * MAX_SB_SIZE + j], res);
+ }
+ }
+ }
+
+ /* Vertical filter */
+ {
+ const __m128i coeffs_y =
+ _mm_add_epi16(_mm_loadu_si128((__m128i *)filter_y), offset);
+
+ // coeffs 0 1 0 1 2 3 2 3
+ const __m128i tmp_0 = _mm_unpacklo_epi32(coeffs_y, coeffs_y);
+ // coeffs 4 5 4 5 6 7 6 7
+ const __m128i tmp_1 = _mm_unpackhi_epi32(coeffs_y, coeffs_y);
+
+ // coeffs 0 1 0 1 0 1 0 1
+ const __m128i coeff_01 = _mm_unpacklo_epi64(tmp_0, tmp_0);
+ // coeffs 2 3 2 3 2 3 2 3
+ const __m128i coeff_23 = _mm_unpackhi_epi64(tmp_0, tmp_0);
+ // coeffs 4 5 4 5 4 5 4 5
+ const __m128i coeff_45 = _mm_unpacklo_epi64(tmp_1, tmp_1);
+ // coeffs 6 7 6 7 6 7 6 7
+ const __m128i coeff_67 = _mm_unpackhi_epi64(tmp_1, tmp_1);
+
+ const __m128i round_const =
+ _mm_set1_epi32((1 << (FILTER_BITS + EXTRAPREC_BITS - 1)) -
+ (1 << (bd + FILTER_BITS + EXTRAPREC_BITS - 1)));
+
+ for (i = 0; i < h; ++i) {
+ for (j = 0; j < w; j += 8) {
+ // Filter even-index pixels
+ const uint16_t *data = &temp[i * MAX_SB_SIZE + j];
+ const __m128i src_0 =
+ _mm_unpacklo_epi16(*(__m128i *)(data + 0 * MAX_SB_SIZE),
+ *(__m128i *)(data + 1 * MAX_SB_SIZE));
+ const __m128i src_2 =
+ _mm_unpacklo_epi16(*(__m128i *)(data + 2 * MAX_SB_SIZE),
+ *(__m128i *)(data + 3 * MAX_SB_SIZE));
+ const __m128i src_4 =
+ _mm_unpacklo_epi16(*(__m128i *)(data + 4 * MAX_SB_SIZE),
+ *(__m128i *)(data + 5 * MAX_SB_SIZE));
+ const __m128i src_6 =
+ _mm_unpacklo_epi16(*(__m128i *)(data + 6 * MAX_SB_SIZE),
+ *(__m128i *)(data + 7 * MAX_SB_SIZE));
+
+ const __m128i res_0 = _mm_madd_epi16(src_0, coeff_01);
+ const __m128i res_2 = _mm_madd_epi16(src_2, coeff_23);
+ const __m128i res_4 = _mm_madd_epi16(src_4, coeff_45);
+ const __m128i res_6 = _mm_madd_epi16(src_6, coeff_67);
+
+ const __m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_2),
+ _mm_add_epi32(res_4, res_6));
+
+ // Filter odd-index pixels
+ const __m128i src_1 =
+ _mm_unpackhi_epi16(*(__m128i *)(data + 0 * MAX_SB_SIZE),
+ *(__m128i *)(data + 1 * MAX_SB_SIZE));
+ const __m128i src_3 =
+ _mm_unpackhi_epi16(*(__m128i *)(data + 2 * MAX_SB_SIZE),
+ *(__m128i *)(data + 3 * MAX_SB_SIZE));
+ const __m128i src_5 =
+ _mm_unpackhi_epi16(*(__m128i *)(data + 4 * MAX_SB_SIZE),
+ *(__m128i *)(data + 5 * MAX_SB_SIZE));
+ const __m128i src_7 =
+ _mm_unpackhi_epi16(*(__m128i *)(data + 6 * MAX_SB_SIZE),
+ *(__m128i *)(data + 7 * MAX_SB_SIZE));
+
+ const __m128i res_1 = _mm_madd_epi16(src_1, coeff_01);
+ const __m128i res_3 = _mm_madd_epi16(src_3, coeff_23);
+ const __m128i res_5 = _mm_madd_epi16(src_5, coeff_45);
+ const __m128i res_7 = _mm_madd_epi16(src_7, coeff_67);
+
+ const __m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_3),
+ _mm_add_epi32(res_5, res_7));
+
+ // Rearrange pixels back into the order 0 ... 7
+ const __m128i res_lo = _mm_unpacklo_epi32(res_even, res_odd);
+ const __m128i res_hi = _mm_unpackhi_epi32(res_even, res_odd);
+
+ const __m128i res_lo_round = _mm_srai_epi32(
+ _mm_add_epi32(res_lo, round_const), FILTER_BITS + EXTRAPREC_BITS);
+ const __m128i res_hi_round = _mm_srai_epi32(
+ _mm_add_epi32(res_hi, round_const), FILTER_BITS + EXTRAPREC_BITS);
+
+ const __m128i res_16bit = _mm_packs_epi32(res_lo_round, res_hi_round);
+ __m128i res_8bit = _mm_packus_epi16(res_16bit, res_16bit);
+
+ __m128i *const p = (__m128i *)&dst[i * dst_stride + j];
+ _mm_storel_epi64(p, res_8bit);
+ }
+ }
+ }
+}
diff --git a/third_party/aom/aom_dsp/x86/aom_highbd_convolve_hip_ssse3.c b/third_party/aom/aom_dsp/x86/aom_highbd_convolve_hip_ssse3.c
new file mode 100644
index 000000000..74ce80e50
--- /dev/null
+++ b/third_party/aom/aom_dsp/x86/aom_highbd_convolve_hip_ssse3.c
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2016, Alliance for Open Media. All rights reserved
+ *
+ * This source code is subject to the terms of the BSD 2 Clause License and
+ * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
+ * was not distributed with this source code in the LICENSE file, you can
+ * obtain it at www.aomedia.org/license/software. If the Alliance for Open
+ * Media Patent License 1.0 was not distributed with this source code in the
+ * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
+ */
+
+#include <tmmintrin.h>
+#include <assert.h>
+
+#include "./aom_dsp_rtcd.h"
+#include "aom_dsp/aom_convolve.h"
+#include "aom_dsp/aom_dsp_common.h"
+#include "aom_dsp/aom_filter.h"
+
+#if EXTRAPREC_BITS > 2
+#error "Highbd high-prec convolve filter only supports EXTRAPREC_BITS <= 2"
+#error "(need to use 32-bit intermediates for EXTRAPREC_BITS > 2)"
+#endif
+
+void aom_highbd_convolve8_add_src_hip_ssse3(
+ const uint8_t *src8, ptrdiff_t src_stride, uint8_t *dst8,
+ ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4,
+ const int16_t *filter_y, int y_step_q4, int w, int h, int bd) {
+ assert(x_step_q4 == 16 && y_step_q4 == 16);
+ assert(!(w & 7));
+ (void)x_step_q4;
+ (void)y_step_q4;
+
+ const uint16_t *const src = CONVERT_TO_SHORTPTR(src8);
+ uint16_t *const dst = CONVERT_TO_SHORTPTR(dst8);
+
+ uint16_t temp[(MAX_SB_SIZE + SUBPEL_TAPS - 1) * MAX_SB_SIZE];
+ int intermediate_height = h + SUBPEL_TAPS - 1;
+ int i, j;
+ const int center_tap = ((SUBPEL_TAPS - 1) / 2);
+ const uint16_t *const src_ptr = src - center_tap * src_stride - center_tap;
+
+ const __m128i zero = _mm_setzero_si128();
+ // Add an offset to account for the "add_src" part of the convolve function.
+ const __m128i offset = _mm_insert_epi16(zero, 1 << FILTER_BITS, 3);
+
+ /* Horizontal filter */
+ {
+ const __m128i coeffs_x =
+ _mm_add_epi16(_mm_loadu_si128((__m128i *)filter_x), offset);
+
+ // coeffs 0 1 0 1 2 3 2 3
+ const __m128i tmp_0 = _mm_unpacklo_epi32(coeffs_x, coeffs_x);
+ // coeffs 4 5 4 5 6 7 6 7
+ const __m128i tmp_1 = _mm_unpackhi_epi32(coeffs_x, coeffs_x);
+
+ // coeffs 0 1 0 1 0 1 0 1
+ const __m128i coeff_01 = _mm_unpacklo_epi64(tmp_0, tmp_0);
+ // coeffs 2 3 2 3 2 3 2 3
+ const __m128i coeff_23 = _mm_unpackhi_epi64(tmp_0, tmp_0);
+ // coeffs 4 5 4 5 4 5 4 5
+ const __m128i coeff_45 = _mm_unpacklo_epi64(tmp_1, tmp_1);
+ // coeffs 6 7 6 7 6 7 6 7
+ const __m128i coeff_67 = _mm_unpackhi_epi64(tmp_1, tmp_1);
+
+ const __m128i round_const =
+ _mm_set1_epi32((1 << (FILTER_BITS - EXTRAPREC_BITS - 1)) +
+ (1 << (bd + FILTER_BITS - 1)));
+
+ for (i = 0; i < intermediate_height; ++i) {
+ for (j = 0; j < w; j += 8) {
+ const __m128i data =
+ _mm_loadu_si128((__m128i *)&src_ptr[i * src_stride + j]);
+ const __m128i data2 =
+ _mm_loadu_si128((__m128i *)&src_ptr[i * src_stride + j + 8]);
+
+ // Filter even-index pixels
+ const __m128i res_0 = _mm_madd_epi16(data, coeff_01);
+ const __m128i res_2 =
+ _mm_madd_epi16(_mm_alignr_epi8(data2, data, 4), coeff_23);
+ const __m128i res_4 =
+ _mm_madd_epi16(_mm_alignr_epi8(data2, data, 8), coeff_45);
+ const __m128i res_6 =
+ _mm_madd_epi16(_mm_alignr_epi8(data2, data, 12), coeff_67);
+
+ __m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_4),
+ _mm_add_epi32(res_2, res_6));
+ res_even = _mm_srai_epi32(_mm_add_epi32(res_even, round_const),
+ FILTER_BITS - EXTRAPREC_BITS);
+
+ // Filter odd-index pixels
+ const __m128i res_1 =
+ _mm_madd_epi16(_mm_alignr_epi8(data2, data, 2), coeff_01);
+ const __m128i res_3 =
+ _mm_madd_epi16(_mm_alignr_epi8(data2, data, 6), coeff_23);
+ const __m128i res_5 =
+ _mm_madd_epi16(_mm_alignr_epi8(data2, data, 10), coeff_45);
+ const __m128i res_7 =
+ _mm_madd_epi16(_mm_alignr_epi8(data2, data, 14), coeff_67);
+
+ __m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_5),
+ _mm_add_epi32(res_3, res_7));
+ res_odd = _mm_srai_epi32(_mm_add_epi32(res_odd, round_const),
+ FILTER_BITS - EXTRAPREC_BITS);
+
+ // Pack in the column order 0, 2, 4, 6, 1, 3, 5, 7
+ const __m128i maxval = _mm_set1_epi16((EXTRAPREC_CLAMP_LIMIT(bd)) - 1);
+ __m128i res = _mm_packs_epi32(res_even, res_odd);
+ res = _mm_min_epi16(_mm_max_epi16(res, zero), maxval);
+ _mm_storeu_si128((__m128i *)&temp[i * MAX_SB_SIZE + j], res);
+ }
+ }
+ }
+
+ /* Vertical filter */
+ {
+ const __m128i coeffs_y =
+ _mm_add_epi16(_mm_loadu_si128((__m128i *)filter_y), offset);
+
+ // coeffs 0 1 0 1 2 3 2 3
+ const __m128i tmp_0 = _mm_unpacklo_epi32(coeffs_y, coeffs_y);
+ // coeffs 4 5 4 5 6 7 6 7
+ const __m128i tmp_1 = _mm_unpackhi_epi32(coeffs_y, coeffs_y);
+
+ // coeffs 0 1 0 1 0 1 0 1
+ const __m128i coeff_01 = _mm_unpacklo_epi64(tmp_0, tmp_0);
+ // coeffs 2 3 2 3 2 3 2 3
+ const __m128i coeff_23 = _mm_unpackhi_epi64(tmp_0, tmp_0);
+ // coeffs 4 5 4 5 4 5 4 5
+ const __m128i coeff_45 = _mm_unpacklo_epi64(tmp_1, tmp_1);
+ // coeffs 6 7 6 7 6 7 6 7
+ const __m128i coeff_67 = _mm_unpackhi_epi64(tmp_1, tmp_1);
+
+ const __m128i round_const =
+ _mm_set1_epi32((1 << (FILTER_BITS + EXTRAPREC_BITS - 1)) -
+ (1 << (bd + FILTER_BITS + EXTRAPREC_BITS - 1)));
+
+ for (i = 0; i < h; ++i) {
+ for (j = 0; j < w; j += 8) {
+ // Filter even-index pixels
+ const uint16_t *data = &temp[i * MAX_SB_SIZE + j];
+ const __m128i src_0 =
+ _mm_unpacklo_epi16(*(__m128i *)(data + 0 * MAX_SB_SIZE),
+ *(__m128i *)(data + 1 * MAX_SB_SIZE));
+ const __m128i src_2 =
+ _mm_unpacklo_epi16(*(__m128i *)(data + 2 * MAX_SB_SIZE),
+ *(__m128i *)(data + 3 * MAX_SB_SIZE));
+ const __m128i src_4 =
+ _mm_unpacklo_epi16(*(__m128i *)(data + 4 * MAX_SB_SIZE),
+ *(__m128i *)(data + 5 * MAX_SB_SIZE));
+ const __m128i src_6 =
+ _mm_unpacklo_epi16(*(__m128i *)(data + 6 * MAX_SB_SIZE),
+ *(__m128i *)(data + 7 * MAX_SB_SIZE));
+
+ const __m128i res_0 = _mm_madd_epi16(src_0, coeff_01);
+ const __m128i res_2 = _mm_madd_epi16(src_2, coeff_23);
+ const __m128i res_4 = _mm_madd_epi16(src_4, coeff_45);
+ const __m128i res_6 = _mm_madd_epi16(src_6, coeff_67);
+
+ const __m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_2),
+ _mm_add_epi32(res_4, res_6));
+
+ // Filter odd-index pixels
+ const __m128i src_1 =
+ _mm_unpackhi_epi16(*(__m128i *)(data + 0 * MAX_SB_SIZE),
+ *(__m128i *)(data + 1 * MAX_SB_SIZE));
+ const __m128i src_3 =
+ _mm_unpackhi_epi16(*(__m128i *)(data + 2 * MAX_SB_SIZE),
+ *(__m128i *)(data + 3 * MAX_SB_SIZE));
+ const __m128i src_5 =
+ _mm_unpackhi_epi16(*(__m128i *)(data + 4 * MAX_SB_SIZE),
+ *(__m128i *)(data + 5 * MAX_SB_SIZE));
+ const __m128i src_7 =
+ _mm_unpackhi_epi16(*(__m128i *)(data + 6 * MAX_SB_SIZE),
+ *(__m128i *)(data + 7 * MAX_SB_SIZE));
+
+ const __m128i res_1 = _mm_madd_epi16(src_1, coeff_01);
+ const __m128i res_3 = _mm_madd_epi16(src_3, coeff_23);
+ const __m128i res_5 = _mm_madd_epi16(src_5, coeff_45);
+ const __m128i res_7 = _mm_madd_epi16(src_7, coeff_67);
+
+ const __m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_3),
+ _mm_add_epi32(res_5, res_7));
+
+ // Rearrange pixels back into the order 0 ... 7
+ const __m128i res_lo = _mm_unpacklo_epi32(res_even, res_odd);
+ const __m128i res_hi = _mm_unpackhi_epi32(res_even, res_odd);
+
+ const __m128i res_lo_round = _mm_srai_epi32(
+ _mm_add_epi32(res_lo, round_const), FILTER_BITS + EXTRAPREC_BITS);
+ const __m128i res_hi_round = _mm_srai_epi32(
+ _mm_add_epi32(res_hi, round_const), FILTER_BITS + EXTRAPREC_BITS);
+
+ const __m128i maxval = _mm_set1_epi16((1 << bd) - 1);
+ __m128i res_16bit = _mm_packs_epi32(res_lo_round, res_hi_round);
+ res_16bit = _mm_min_epi16(_mm_max_epi16(res_16bit, zero), maxval);
+
+ __m128i *const p = (__m128i *)&dst[i * dst_stride + j];
+ _mm_storeu_si128(p, res_16bit);
+ }
+ }
+ }
+}
diff --git a/third_party/aom/aom_dsp/x86/avg_intrin_sse2.c b/third_party/aom/aom_dsp/x86/avg_intrin_sse2.c
index bcdc20f63..1a6457402 100644
--- a/third_party/aom/aom_dsp/x86/avg_intrin_sse2.c
+++ b/third_party/aom/aom_dsp/x86/avg_intrin_sse2.c
@@ -94,52 +94,6 @@ void aom_minmax_8x8_sse2(const uint8_t *s, int p, const uint8_t *d, int dp,
*min = _mm_extract_epi16(minabsdiff, 0);
}
-unsigned int aom_avg_8x8_sse2(const uint8_t *s, int p) {
- __m128i s0, s1, u0;
- unsigned int avg = 0;
- u0 = _mm_setzero_si128();
- s0 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i *)(s)), u0);
- s1 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i *)(s + p)), u0);
- s0 = _mm_adds_epu16(s0, s1);
- s1 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i *)(s + 2 * p)), u0);
- s0 = _mm_adds_epu16(s0, s1);
- s1 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i *)(s + 3 * p)), u0);
- s0 = _mm_adds_epu16(s0, s1);
- s1 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i *)(s + 4 * p)), u0);
- s0 = _mm_adds_epu16(s0, s1);
- s1 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i *)(s + 5 * p)), u0);
- s0 = _mm_adds_epu16(s0, s1);
- s1 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i *)(s + 6 * p)), u0);
- s0 = _mm_adds_epu16(s0, s1);
- s1 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i *)(s + 7 * p)), u0);
- s0 = _mm_adds_epu16(s0, s1);
-
- s0 = _mm_adds_epu16(s0, _mm_srli_si128(s0, 8));
- s0 = _mm_adds_epu16(s0, _mm_srli_epi64(s0, 32));
- s0 = _mm_adds_epu16(s0, _mm_srli_epi64(s0, 16));
- avg = _mm_extract_epi16(s0, 0);
- return (avg + 32) >> 6;
-}
-
-unsigned int aom_avg_4x4_sse2(const uint8_t *s, int p) {
- __m128i s0, s1, u0;
- unsigned int avg = 0;
-
- u0 = _mm_setzero_si128();
- s0 = _mm_unpacklo_epi8(xx_loadl_32(s), u0);
- s1 = _mm_unpacklo_epi8(xx_loadl_32(s + p), u0);
- s0 = _mm_adds_epu16(s0, s1);
- s1 = _mm_unpacklo_epi8(xx_loadl_32(s + 2 * p), u0);
- s0 = _mm_adds_epu16(s0, s1);
- s1 = _mm_unpacklo_epi8(xx_loadl_32(s + 3 * p), u0);
- s0 = _mm_adds_epu16(s0, s1);
-
- s0 = _mm_adds_epu16(s0, _mm_srli_si128(s0, 4));
- s0 = _mm_adds_epu16(s0, _mm_srli_epi64(s0, 16));
- avg = _mm_extract_epi16(s0, 0);
- return (avg + 8) >> 4;
-}
-
static void hadamard_col8_sse2(__m128i *in, int iter) {
__m128i a0 = in[0];
__m128i a1 = in[1];
diff --git a/third_party/aom/aom_dsp/x86/highbd_convolve_avx2.c b/third_party/aom/aom_dsp/x86/highbd_convolve_avx2.c
index 7d96e26ae..133640eb7 100644
--- a/third_party/aom/aom_dsp/x86/highbd_convolve_avx2.c
+++ b/third_party/aom/aom_dsp/x86/highbd_convolve_avx2.c
@@ -14,30 +14,6 @@
#include "./aom_dsp_rtcd.h"
#include "aom_dsp/x86/convolve.h"
-#define CONV8_ROUNDING_BITS (7)
-
-static const uint8_t signal_pattern_0[32] = { 0, 1, 2, 3, 2, 3, 4, 5, 4, 5, 6,
- 7, 6, 7, 8, 9, 0, 1, 2, 3, 2, 3,
- 4, 5, 4, 5, 6, 7, 6, 7, 8, 9 };
-
-static const uint8_t signal_pattern_1[32] = { 4, 5, 6, 7, 6, 7, 8, 9,
- 8, 9, 10, 11, 10, 11, 12, 13,
- 4, 5, 6, 7, 6, 7, 8, 9,
- 8, 9, 10, 11, 10, 11, 12, 13 };
-
-static const uint8_t signal_pattern_2[32] = { 6, 7, 8, 9, 8, 9, 10, 11,
- 10, 11, 12, 13, 12, 13, 14, 15,
- 6, 7, 8, 9, 8, 9, 10, 11,
- 10, 11, 12, 13, 12, 13, 14, 15 };
-
-static const uint32_t signal_index[8] = { 2, 3, 4, 5, 2, 3, 4, 5 };
-
-typedef enum { PACK_8x1, PACK_8x2, PACK_16x1 } PixelPackFormat;
-
-typedef void (*WritePixels)(const __m256i *y0, const __m256i *y1,
- const __m256i *mask, uint16_t *dst,
- ptrdiff_t pitch);
-
// -----------------------------------------------------------------------------
// Copy and average
@@ -217,6 +193,27 @@ void aom_highbd_convolve_avg_avx2(const uint8_t *src8, ptrdiff_t src_stride,
}
// -----------------------------------------------------------------------------
+// Horizontal and vertical filtering
+
+#define CONV8_ROUNDING_BITS (7)
+
+static const uint8_t signal_pattern_0[32] = { 0, 1, 2, 3, 2, 3, 4, 5, 4, 5, 6,
+ 7, 6, 7, 8, 9, 0, 1, 2, 3, 2, 3,
+ 4, 5, 4, 5, 6, 7, 6, 7, 8, 9 };
+
+static const uint8_t signal_pattern_1[32] = { 4, 5, 6, 7, 6, 7, 8, 9,
+ 8, 9, 10, 11, 10, 11, 12, 13,
+ 4, 5, 6, 7, 6, 7, 8, 9,
+ 8, 9, 10, 11, 10, 11, 12, 13 };
+
+static const uint8_t signal_pattern_2[32] = { 6, 7, 8, 9, 8, 9, 10, 11,
+ 10, 11, 12, 13, 12, 13, 14, 15,
+ 6, 7, 8, 9, 8, 9, 10, 11,
+ 10, 11, 12, 13, 12, 13, 14, 15 };
+
+static const uint32_t signal_index[8] = { 2, 3, 4, 5, 2, 3, 4, 5 };
+
+// -----------------------------------------------------------------------------
// Horizontal Filtering
static INLINE void pack_pixels(const __m256i *s, __m256i *p /*p[4]*/) {
@@ -248,52 +245,30 @@ static INLINE void pack_16_pixels(const __m256i *s0, const __m256i *s1,
x[7] = _mm256_permute2x128_si256(pp[1], pp[5], 0x31);
}
-static INLINE void pack_pixels_with_format(const uint16_t *src,
- PixelPackFormat fmt,
- ptrdiff_t stride, __m256i *x) {
- switch (fmt) {
- case PACK_8x1: {
- __m256i pp[8];
- __m256i s0;
- s0 = _mm256_loadu_si256((const __m256i *)src);
- pack_pixels(&s0, pp);
- x[0] = _mm256_permute2x128_si256(pp[0], pp[2], 0x30);
- x[1] = _mm256_permute2x128_si256(pp[1], pp[3], 0x30);
- x[2] = _mm256_permute2x128_si256(pp[2], pp[0], 0x30);
- x[3] = _mm256_permute2x128_si256(pp[3], pp[1], 0x30);
- break;
- }
- case PACK_8x2: {
- __m256i s0, s1;
- s0 = _mm256_loadu_si256((const __m256i *)src);
- s1 = _mm256_loadu_si256((const __m256i *)(src + stride));
- pack_16_pixels(&s0, &s1, x);
- break;
- }
- case PACK_16x1: {
- __m256i s0, s1;
- s0 = _mm256_loadu_si256((const __m256i *)src);
- s1 = _mm256_loadu_si256((const __m256i *)(src + 8));
- pack_16_pixels(&s0, &s1, x);
- break;
- }
- default: { assert(0); }
- }
-}
-
-static INLINE void pack_8x1_pixels(const uint16_t *src, const ptrdiff_t pitch,
- __m256i *x /*x[4]*/) {
- pack_pixels_with_format(src, PACK_8x1, pitch, x);
+static INLINE void pack_8x1_pixels(const uint16_t *src, __m256i *x) {
+ __m256i pp[8];
+ __m256i s0;
+ s0 = _mm256_loadu_si256((const __m256i *)src);
+ pack_pixels(&s0, pp);
+ x[0] = _mm256_permute2x128_si256(pp[0], pp[2], 0x30);
+ x[1] = _mm256_permute2x128_si256(pp[1], pp[3], 0x30);
+ x[2] = _mm256_permute2x128_si256(pp[2], pp[0], 0x30);
+ x[3] = _mm256_permute2x128_si256(pp[3], pp[1], 0x30);
}
-static INLINE void pack_8x2_pixels(const uint16_t *src, const ptrdiff_t pitch,
- __m256i *x /*x[8]*/) {
- pack_pixels_with_format(src, PACK_8x2, pitch, x);
+static INLINE void pack_8x2_pixels(const uint16_t *src, ptrdiff_t stride,
+ __m256i *x) {
+ __m256i s0, s1;
+ s0 = _mm256_loadu_si256((const __m256i *)src);
+ s1 = _mm256_loadu_si256((const __m256i *)(src + stride));
+ pack_16_pixels(&s0, &s1, x);
}
-static INLINE void pack_16x1_pixels(const uint16_t *src, const ptrdiff_t pitch,
- __m256i *x /*x[8]*/) {
- pack_pixels_with_format(src, PACK_16x1, pitch, x);
+static INLINE void pack_16x1_pixels(const uint16_t *src, __m256i *x) {
+ __m256i s0, s1;
+ s0 = _mm256_loadu_si256((const __m256i *)src);
+ s1 = _mm256_loadu_si256((const __m256i *)(src + 8));
+ pack_16_pixels(&s0, &s1, x);
}
// Note:
@@ -323,51 +298,49 @@ static INLINE void filter_8x1_pixels(const __m256i *sig /*sig[4]*/,
a0 = _mm256_madd_epi16(fil[1], sig[1]);
a1 = _mm256_madd_epi16(fil[2], sig[2]);
- const __m256i min = _mm256_min_epi32(a0, a1);
- a = _mm256_add_epi32(a, min);
-
- const __m256i max = _mm256_max_epi32(a0, a1);
- a = _mm256_add_epi32(a, max);
-
- const __m256i rounding = _mm256_set1_epi32(1 << (CONV8_ROUNDING_BITS - 1));
- a = _mm256_add_epi32(a, rounding);
- *y = _mm256_srai_epi32(a, CONV8_ROUNDING_BITS);
+ {
+ const __m256i min = _mm256_min_epi32(a0, a1);
+ a = _mm256_add_epi32(a, min);
+ }
+ {
+ const __m256i max = _mm256_max_epi32(a0, a1);
+ a = _mm256_add_epi32(a, max);
+ }
+ {
+ const __m256i rounding = _mm256_set1_epi32(1 << (CONV8_ROUNDING_BITS - 1));
+ a = _mm256_add_epi32(a, rounding);
+ *y = _mm256_srai_epi32(a, CONV8_ROUNDING_BITS);
+ }
}
-static void write_8x1_pixels(const __m256i *y, const __m256i *z,
- const __m256i *mask, uint16_t *dst,
- ptrdiff_t pitch) {
+static INLINE void store_8x1_pixels(const __m256i *y, const __m256i *mask,
+ uint16_t *dst) {
const __m128i a0 = _mm256_castsi256_si128(*y);
const __m128i a1 = _mm256_extractf128_si256(*y, 1);
__m128i res = _mm_packus_epi32(a0, a1);
- (void)z;
- (void)pitch;
res = _mm_min_epi16(res, _mm256_castsi256_si128(*mask));
_mm_storeu_si128((__m128i *)dst, res);
}
-static void write_8x2_pixels(const __m256i *y0, const __m256i *y1,
- const __m256i *mask, uint16_t *dst,
- ptrdiff_t pitch) {
+static INLINE void store_8x2_pixels(const __m256i *y0, const __m256i *y1,
+ const __m256i *mask, uint16_t *dst,
+ ptrdiff_t pitch) {
__m256i a = _mm256_packus_epi32(*y0, *y1);
a = _mm256_min_epi16(a, *mask);
_mm_storeu_si128((__m128i *)dst, _mm256_castsi256_si128(a));
_mm_storeu_si128((__m128i *)(dst + pitch), _mm256_extractf128_si256(a, 1));
}
-static void write_16x1_pixels(const __m256i *y0, const __m256i *y1,
- const __m256i *mask, uint16_t *dst,
- ptrdiff_t dst_pitch) {
- (void)dst_pitch;
+static INLINE void store_16x1_pixels(const __m256i *y0, const __m256i *y1,
+ const __m256i *mask, uint16_t *dst) {
__m256i a = _mm256_packus_epi32(*y0, *y1);
a = _mm256_min_epi16(a, *mask);
_mm256_storeu_si256((__m256i *)dst, a);
}
-static void filter_block_width8_horiz(
- const uint16_t *src_ptr, ptrdiff_t src_pitch, const WritePixels write_8x1,
- const WritePixels write_8x2, uint16_t *dst_ptr, ptrdiff_t dst_pitch,
- uint32_t height, const int16_t *filter, int bd) {
+static void aom_highbd_filter_block1d8_h8_avx2(
+ const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
+ ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
__m256i signal[8], res0, res1;
const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
@@ -379,32 +352,22 @@ static void filter_block_width8_horiz(
pack_8x2_pixels(src_ptr, src_pitch, signal);
filter_8x1_pixels(signal, ff, &res0);
filter_8x1_pixels(&signal[4], ff, &res1);
- write_8x2(&res0, &res1, &max, dst_ptr, dst_pitch);
+ store_8x2_pixels(&res0, &res1, &max, dst_ptr, dst_pitch);
height -= 2;
src_ptr += src_pitch << 1;
dst_ptr += dst_pitch << 1;
} while (height > 1);
if (height > 0) {
- pack_8x1_pixels(src_ptr, src_pitch, signal);
+ pack_8x1_pixels(src_ptr, signal);
filter_8x1_pixels(signal, ff, &res0);
- write_8x1(&res0, &res1, &max, dst_ptr, dst_pitch);
+ store_8x1_pixels(&res0, &max, dst_ptr);
}
}
-static void aom_highbd_filter_block1d8_h8_avx2(
- const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
+static void aom_highbd_filter_block1d16_h8_avx2(
+ const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
- filter_block_width8_horiz(src, src_pitch, write_8x1_pixels, write_8x2_pixels,
- dst, dst_pitch, height, filter, bd);
-}
-
-static void filter_block_width16_horiz(const uint16_t *src_ptr,
- ptrdiff_t src_pitch,
- const WritePixels write_16x1,
- uint16_t *dst_ptr, ptrdiff_t dst_pitch,
- uint32_t height, const int16_t *filter,
- int bd) {
__m256i signal[8], res0, res1;
const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
@@ -413,23 +376,17 @@ static void filter_block_width16_horiz(const uint16_t *src_ptr,
src_ptr -= 3;
do {
- pack_16x1_pixels(src_ptr, src_pitch, signal);
+ pack_16x1_pixels(src_ptr, signal);
filter_8x1_pixels(signal, ff, &res0);
filter_8x1_pixels(&signal[4], ff, &res1);
- write_16x1(&res0, &res1, &max, dst_ptr, dst_pitch);
+ store_16x1_pixels(&res0, &res1, &max, dst_ptr);
height -= 1;
src_ptr += src_pitch;
dst_ptr += dst_pitch;
} while (height > 0);
}
-static void aom_highbd_filter_block1d16_h8_avx2(
- const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
- ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
- filter_block_width16_horiz(src, src_pitch, write_16x1_pixels, dst, dst_pitch,
- height, filter, bd);
-}
-
+// -----------------------------------------------------------------------------
// 2-tap horizontal filtering
static INLINE void pack_2t_filter(const int16_t *filter, __m256i *f) {
@@ -493,16 +450,6 @@ static INLINE void filter_16_2t_pixels(const __m256i *sig, const __m256i *f,
*y1 = _mm256_srai_epi32(x1, CONV8_ROUNDING_BITS);
}
-static INLINE void filter_8x2_2t_pixels(const __m256i *sig, const __m256i *f,
- __m256i *y0, __m256i *y1) {
- filter_16_2t_pixels(sig, f, y0, y1);
-}
-
-static INLINE void filter_16x1_2t_pixels(const __m256i *sig, const __m256i *f,
- __m256i *y0, __m256i *y1) {
- filter_16_2t_pixels(sig, f, y0, y1);
-}
-
static INLINE void filter_8x1_2t_pixels(const __m256i *sig, const __m256i *f,
__m256i *y0) {
const __m256i rounding = _mm256_set1_epi32(1 << (CONV8_ROUNDING_BITS - 1));
@@ -511,10 +458,9 @@ static INLINE void filter_8x1_2t_pixels(const __m256i *sig, const __m256i *f,
*y0 = _mm256_srai_epi32(x0, CONV8_ROUNDING_BITS);
}
-static void filter_block_width8_2t_horiz(
- const uint16_t *src_ptr, ptrdiff_t src_pitch, const WritePixels write_8x1,
- const WritePixels write_8x2, uint16_t *dst_ptr, ptrdiff_t dst_pitch,
- uint32_t height, const int16_t *filter, int bd) {
+static void aom_highbd_filter_block1d8_h2_avx2(
+ const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
+ ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
__m256i signal[2], res0, res1;
const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
@@ -524,8 +470,8 @@ static void filter_block_width8_2t_horiz(
src_ptr -= 3;
do {
pack_8x2_2t_pixels(src_ptr, src_pitch, signal);
- filter_8x2_2t_pixels(signal, &ff, &res0, &res1);
- write_8x2(&res0, &res1, &max, dst_ptr, dst_pitch);
+ filter_16_2t_pixels(signal, &ff, &res0, &res1);
+ store_8x2_pixels(&res0, &res1, &max, dst_ptr, dst_pitch);
height -= 2;
src_ptr += src_pitch << 1;
dst_ptr += dst_pitch << 1;
@@ -534,24 +480,13 @@ static void filter_block_width8_2t_horiz(
if (height > 0) {
pack_8x1_2t_pixels(src_ptr, signal);
filter_8x1_2t_pixels(signal, &ff, &res0);
- write_8x1(&res0, &res1, &max, dst_ptr, dst_pitch);
+ store_8x1_pixels(&res0, &max, dst_ptr);
}
}
-static void aom_highbd_filter_block1d8_h2_avx2(
- const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
+static void aom_highbd_filter_block1d16_h2_avx2(
+ const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
- filter_block_width8_2t_horiz(src, src_pitch, write_8x1_pixels,
- write_8x2_pixels, dst, dst_pitch, height, filter,
- bd);
-}
-
-static void filter_block_width16_2t_horiz(const uint16_t *src_ptr,
- ptrdiff_t src_pitch,
- const WritePixels write_16x1,
- uint16_t *dst_ptr,
- ptrdiff_t dst_pitch, uint32_t height,
- const int16_t *filter, int bd) {
__m256i signal[2], res0, res1;
const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
@@ -561,21 +496,15 @@ static void filter_block_width16_2t_horiz(const uint16_t *src_ptr,
src_ptr -= 3;
do {
pack_16x1_2t_pixels(src_ptr, signal);
- filter_16x1_2t_pixels(signal, &ff, &res0, &res1);
- write_16x1(&res0, &res1, &max, dst_ptr, dst_pitch);
+ filter_16_2t_pixels(signal, &ff, &res0, &res1);
+ store_16x1_pixels(&res0, &res1, &max, dst_ptr);
height -= 1;
src_ptr += src_pitch;
dst_ptr += dst_pitch;
} while (height > 0);
}
-static void aom_highbd_filter_block1d16_h2_avx2(
- const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
- ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
- filter_block_width16_2t_horiz(src, src_pitch, write_16x1_pixels, dst,
- dst_pitch, height, filter, bd);
-}
-
+// -----------------------------------------------------------------------------
// Vertical Filtering
static void pack_8x9_init(const uint16_t *src, ptrdiff_t pitch, __m256i *sig) {
@@ -638,22 +567,9 @@ static INLINE void update_pixels(__m256i *sig) {
}
}
-static INLINE void write_8x1_pixels_ver(const __m256i *y0, const __m256i *y1,
- const __m256i *mask, uint16_t *dst,
- ptrdiff_t pitch) {
- (void)pitch;
- const __m128i v0 = _mm256_castsi256_si128(*y0);
- const __m128i v1 = _mm256_castsi256_si128(*y1);
- __m128i p = _mm_packus_epi32(v0, v1);
- p = _mm_min_epi16(p, _mm256_castsi256_si128(*mask));
- _mm_storeu_si128((__m128i *)dst, p);
-}
-
-static void filter_block_width8_vert(const uint16_t *src_ptr,
- ptrdiff_t src_pitch, WritePixels write_8x1,
- WritePixels write_8x2, uint16_t *dst_ptr,
- ptrdiff_t dst_pitch, uint32_t height,
- const int16_t *filter, int bd) {
+static void aom_highbd_filter_block1d8_v8_avx2(
+ const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
+ ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
__m256i signal[9], res0, res1;
const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
@@ -666,27 +582,13 @@ static void filter_block_width8_vert(const uint16_t *src_ptr,
pack_8x9_pixels(src_ptr, src_pitch, signal);
filter_8x9_pixels(signal, ff, &res0, &res1);
- write_8x2(&res0, &res1, &max, dst_ptr, dst_pitch);
+ store_8x2_pixels(&res0, &res1, &max, dst_ptr, dst_pitch);
update_pixels(signal);
src_ptr += src_pitch << 1;
dst_ptr += dst_pitch << 1;
height -= 2;
- } while (height > 1);
-
- if (height > 0) {
- pack_8x9_pixels(src_ptr, src_pitch, signal);
- filter_8x9_pixels(signal, ff, &res0, &res1);
- write_8x1(&res0, &res1, &max, dst_ptr, dst_pitch);
- }
-}
-
-static void aom_highbd_filter_block1d8_v8_avx2(
- const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
- ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
- filter_block_width8_vert(src, src_pitch, write_8x1_pixels_ver,
- write_8x2_pixels, dst, dst_pitch, height, filter,
- bd);
+ } while (height > 0);
}
static void pack_16x9_init(const uint16_t *src, ptrdiff_t pitch, __m256i *sig) {
@@ -770,13 +672,15 @@ static INLINE void filter_16x9_pixels(const __m256i *sig, const __m256i *f,
filter_8x1_pixels(&sig[i << 2], f, &res[i]);
}
- const __m256i l0l1 = _mm256_packus_epi32(res[0], res[1]);
- const __m256i h0h1 = _mm256_packus_epi32(res[2], res[3]);
- *y0 = _mm256_permute2x128_si256(l0l1, h0h1, 0x20);
- *y1 = _mm256_permute2x128_si256(l0l1, h0h1, 0x31);
+ {
+ const __m256i l0l1 = _mm256_packus_epi32(res[0], res[1]);
+ const __m256i h0h1 = _mm256_packus_epi32(res[2], res[3]);
+ *y0 = _mm256_permute2x128_si256(l0l1, h0h1, 0x20);
+ *y1 = _mm256_permute2x128_si256(l0l1, h0h1, 0x31);
+ }
}
-static INLINE void write_16x2_pixels(const __m256i *y0, const __m256i *y1,
+static INLINE void store_16x2_pixels(const __m256i *y0, const __m256i *y1,
const __m256i *mask, uint16_t *dst,
ptrdiff_t pitch) {
__m256i p = _mm256_min_epi16(*y0, *mask);
@@ -785,26 +689,14 @@ static INLINE void write_16x2_pixels(const __m256i *y0, const __m256i *y1,
_mm256_storeu_si256((__m256i *)(dst + pitch), p);
}
-static INLINE void write_16x1_pixels_ver(const __m256i *y0, const __m256i *y1,
- const __m256i *mask, uint16_t *dst,
- ptrdiff_t pitch) {
- (void)y1;
- (void)pitch;
- const __m256i p = _mm256_min_epi16(*y0, *mask);
- _mm256_storeu_si256((__m256i *)dst, p);
-}
-
static void update_16x9_pixels(__m256i *sig) {
update_pixels(&sig[0]);
update_pixels(&sig[8]);
}
-static void filter_block_width16_vert(const uint16_t *src_ptr,
- ptrdiff_t src_pitch,
- WritePixels write_16x1,
- WritePixels write_16x2, uint16_t *dst_ptr,
- ptrdiff_t dst_pitch, uint32_t height,
- const int16_t *filter, int bd) {
+static void aom_highbd_filter_block1d16_v8_avx2(
+ const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
+ ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
__m256i signal[17], res0, res1;
const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
@@ -816,29 +708,16 @@ static void filter_block_width16_vert(const uint16_t *src_ptr,
do {
pack_16x9_pixels(src_ptr, src_pitch, signal);
filter_16x9_pixels(signal, ff, &res0, &res1);
- write_16x2(&res0, &res1, &max, dst_ptr, dst_pitch);
+ store_16x2_pixels(&res0, &res1, &max, dst_ptr, dst_pitch);
update_16x9_pixels(signal);
src_ptr += src_pitch << 1;
dst_ptr += dst_pitch << 1;
height -= 2;
- } while (height > 1);
-
- if (height > 0) {
- pack_16x9_pixels(src_ptr, src_pitch, signal);
- filter_16x9_pixels(signal, ff, &res0, &res1);
- write_16x1(&res0, &res1, &max, dst_ptr, dst_pitch);
- }
-}
-
-static void aom_highbd_filter_block1d16_v8_avx2(
- const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
- ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
- filter_block_width16_vert(src, src_pitch, write_16x1_pixels_ver,
- write_16x2_pixels, dst, dst_pitch, height, filter,
- bd);
+ } while (height > 0);
}
+// -----------------------------------------------------------------------------
// 2-tap vertical filtering
static void pack_16x2_init(const uint16_t *src, __m256i *sig) {
@@ -859,12 +738,9 @@ static INLINE void filter_16x2_2t_pixels(const __m256i *sig, const __m256i *f,
filter_16_2t_pixels(sig, f, y0, y1);
}
-static void filter_block_width16_2t_vert(const uint16_t *src_ptr,
- ptrdiff_t src_pitch,
- WritePixels write_16x1,
- uint16_t *dst_ptr, ptrdiff_t dst_pitch,
- uint32_t height, const int16_t *filter,
- int bd) {
+static void aom_highbd_filter_block1d16_v2_avx2(
+ const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
+ ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
__m256i signal[3], res0, res1;
const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
__m256i ff;
@@ -875,7 +751,7 @@ static void filter_block_width16_2t_vert(const uint16_t *src_ptr,
do {
pack_16x2_2t_pixels(src_ptr, src_pitch, signal);
filter_16x2_2t_pixels(signal, &ff, &res0, &res1);
- write_16x1(&res0, &res1, &max, dst_ptr, dst_pitch);
+ store_16x1_pixels(&res0, &res1, &max, dst_ptr);
src_ptr += src_pitch;
dst_ptr += dst_pitch;
@@ -883,13 +759,6 @@ static void filter_block_width16_2t_vert(const uint16_t *src_ptr,
} while (height > 0);
}
-static void aom_highbd_filter_block1d16_v2_avx2(
- const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
- ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
- filter_block_width16_2t_vert(src, src_pitch, write_16x1_pixels, dst,
- dst_pitch, height, filter, bd);
-}
-
static INLINE void pack_8x1_2t_filter(const int16_t *filter, __m128i *f) {
const __m128i h = _mm_loadu_si128((const __m128i *)filter);
const __m128i p = _mm_set1_epi32(0x09080706);
@@ -920,22 +789,16 @@ static INLINE void filter_8_2t_pixels(const __m128i *sig, const __m128i *f,
*y1 = _mm_srai_epi32(x1, CONV8_ROUNDING_BITS);
}
-static void write_8x1_2t_pixels_ver(const __m128i *y0, const __m128i *y1,
- const __m128i *mask, uint16_t *dst) {
+static INLINE void store_8x1_2t_pixels_ver(const __m128i *y0, const __m128i *y1,
+ const __m128i *mask, uint16_t *dst) {
__m128i res = _mm_packus_epi32(*y0, *y1);
res = _mm_min_epi16(res, *mask);
_mm_storeu_si128((__m128i *)dst, res);
}
-typedef void (*Write8Pixels)(const __m128i *y0, const __m128i *y1,
- const __m128i *mask, uint16_t *dst);
-
-static void filter_block_width8_2t_vert(const uint16_t *src_ptr,
- ptrdiff_t src_pitch,
- Write8Pixels write_8x1,
- uint16_t *dst_ptr, ptrdiff_t dst_pitch,
- uint32_t height, const int16_t *filter,
- int bd) {
+static void aom_highbd_filter_block1d8_v2_avx2(
+ const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
+ ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
__m128i signal[3], res0, res1;
const __m128i max = _mm_set1_epi16((1 << bd) - 1);
__m128i ff;
@@ -946,7 +809,7 @@ static void filter_block_width8_2t_vert(const uint16_t *src_ptr,
do {
pack_8x2_2t_pixels_ver(src_ptr, src_pitch, signal);
filter_8_2t_pixels(signal, &ff, &res0, &res1);
- write_8x1(&res0, &res1, &max, dst_ptr);
+ store_8x1_2t_pixels_ver(&res0, &res1, &max, dst_ptr);
src_ptr += src_pitch;
dst_ptr += dst_pitch;
@@ -954,20 +817,10 @@ static void filter_block_width8_2t_vert(const uint16_t *src_ptr,
} while (height > 0);
}
-static void aom_highbd_filter_block1d8_v2_avx2(
- const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
- ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
- filter_block_width8_2t_vert(src, src_pitch, write_8x1_2t_pixels_ver, dst,
- dst_pitch, height, filter, bd);
-}
-
// Calculation with averaging the input pixels
-static void write_8x1_avg_pixels(const __m256i *y0, const __m256i *y1,
- const __m256i *mask, uint16_t *dst,
- ptrdiff_t pitch) {
- (void)y1;
- (void)pitch;
+static INLINE void store_8x1_avg_pixels(const __m256i *y0, const __m256i *mask,
+ uint16_t *dst) {
const __m128i a0 = _mm256_castsi256_si128(*y0);
const __m128i a1 = _mm256_extractf128_si256(*y0, 1);
__m128i res = _mm_packus_epi32(a0, a1);
@@ -977,9 +830,9 @@ static void write_8x1_avg_pixels(const __m256i *y0, const __m256i *y1,
_mm_storeu_si128((__m128i *)dst, res);
}
-static void write_8x2_avg_pixels(const __m256i *y0, const __m256i *y1,
- const __m256i *mask, uint16_t *dst,
- ptrdiff_t pitch) {
+static INLINE void store_8x2_avg_pixels(const __m256i *y0, const __m256i *y1,
+ const __m256i *mask, uint16_t *dst,
+ ptrdiff_t pitch) {
__m256i a = _mm256_packus_epi32(*y0, *y1);
const __m128i pix0 = _mm_loadu_si128((const __m128i *)dst);
const __m128i pix1 = _mm_loadu_si128((const __m128i *)(dst + pitch));
@@ -991,10 +844,8 @@ static void write_8x2_avg_pixels(const __m256i *y0, const __m256i *y1,
_mm_storeu_si128((__m128i *)(dst + pitch), _mm256_extractf128_si256(a, 1));
}
-static void write_16x1_avg_pixels(const __m256i *y0, const __m256i *y1,
- const __m256i *mask, uint16_t *dst,
- ptrdiff_t pitch) {
- (void)pitch;
+static INLINE void store_16x1_avg_pixels(const __m256i *y0, const __m256i *y1,
+ const __m256i *mask, uint16_t *dst) {
__m256i a = _mm256_packus_epi32(*y0, *y1);
const __m256i pix = _mm256_loadu_si256((const __m256i *)dst);
a = _mm256_min_epi16(a, *mask);
@@ -1002,21 +853,7 @@ static void write_16x1_avg_pixels(const __m256i *y0, const __m256i *y1,
_mm256_storeu_si256((__m256i *)dst, a);
}
-static INLINE void write_8x1_avg_pixels_ver(const __m256i *y0,
- const __m256i *y1,
- const __m256i *mask, uint16_t *dst,
- ptrdiff_t pitch) {
- (void)pitch;
- const __m128i v0 = _mm256_castsi256_si128(*y0);
- const __m128i v1 = _mm256_castsi256_si128(*y1);
- __m128i p = _mm_packus_epi32(v0, v1);
- const __m128i pix = _mm_loadu_si128((const __m128i *)dst);
- p = _mm_min_epi16(p, _mm256_castsi256_si128(*mask));
- p = _mm_avg_epu16(p, pix);
- _mm_storeu_si128((__m128i *)dst, p);
-}
-
-static INLINE void write_16x2_avg_pixels(const __m256i *y0, const __m256i *y1,
+static INLINE void store_16x2_avg_pixels(const __m256i *y0, const __m256i *y1,
const __m256i *mask, uint16_t *dst,
ptrdiff_t pitch) {
const __m256i pix0 = _mm256_loadu_si256((const __m256i *)dst);
@@ -1030,20 +867,10 @@ static INLINE void write_16x2_avg_pixels(const __m256i *y0, const __m256i *y1,
_mm256_storeu_si256((__m256i *)(dst + pitch), p);
}
-static INLINE void write_16x1_avg_pixels_ver(const __m256i *y0,
- const __m256i *y1,
- const __m256i *mask, uint16_t *dst,
- ptrdiff_t pitch) {
- (void)y1;
- (void)pitch;
- __m256i p = _mm256_min_epi16(*y0, *mask);
- const __m256i pix = _mm256_loadu_si256((const __m256i *)dst);
- p = _mm256_avg_epu16(p, pix);
- _mm256_storeu_si256((__m256i *)dst, p);
-}
-
-static void write_8x1_2t_avg_pixels_ver(const __m128i *y0, const __m128i *y1,
- const __m128i *mask, uint16_t *dst) {
+static INLINE void store_8x1_2t_avg_pixels_ver(const __m128i *y0,
+ const __m128i *y1,
+ const __m128i *mask,
+ uint16_t *dst) {
__m128i res = _mm_packus_epi32(*y0, *y1);
const __m128i pix = _mm_loadu_si128((const __m128i *)dst);
res = _mm_min_epi16(res, *mask);
@@ -1052,96 +879,229 @@ static void write_8x1_2t_avg_pixels_ver(const __m128i *y0, const __m128i *y1,
}
static void aom_highbd_filter_block1d8_h8_avg_avx2(
- const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
+ const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
- filter_block_width8_horiz(src, src_pitch, write_8x1_avg_pixels,
- write_8x2_avg_pixels, dst, dst_pitch, height,
- filter, bd);
+ __m256i signal[8], res0, res1;
+ const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
+
+ __m256i ff[4];
+ pack_filters(filter, ff);
+
+ src_ptr -= 3;
+ do {
+ pack_8x2_pixels(src_ptr, src_pitch, signal);
+ filter_8x1_pixels(signal, ff, &res0);
+ filter_8x1_pixels(&signal[4], ff, &res1);
+ store_8x2_avg_pixels(&res0, &res1, &max, dst_ptr, dst_pitch);
+ height -= 2;
+ src_ptr += src_pitch << 1;
+ dst_ptr += dst_pitch << 1;
+ } while (height > 1);
+
+ if (height > 0) {
+ pack_8x1_pixels(src_ptr, signal);
+ filter_8x1_pixels(signal, ff, &res0);
+ store_8x1_avg_pixels(&res0, &max, dst_ptr);
+ }
}
static void aom_highbd_filter_block1d16_h8_avg_avx2(
- const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
+ const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
- filter_block_width16_horiz(src, src_pitch, write_16x1_avg_pixels, dst,
- dst_pitch, height, filter, bd);
+ __m256i signal[8], res0, res1;
+ const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
+
+ __m256i ff[4];
+ pack_filters(filter, ff);
+
+ src_ptr -= 3;
+ do {
+ pack_16x1_pixels(src_ptr, signal);
+ filter_8x1_pixels(signal, ff, &res0);
+ filter_8x1_pixels(&signal[4], ff, &res1);
+ store_16x1_avg_pixels(&res0, &res1, &max, dst_ptr);
+ height -= 1;
+ src_ptr += src_pitch;
+ dst_ptr += dst_pitch;
+ } while (height > 0);
}
static void aom_highbd_filter_block1d8_v8_avg_avx2(
- const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
+ const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
- filter_block_width8_vert(src, src_pitch, write_8x1_avg_pixels_ver,
- write_8x2_avg_pixels, dst, dst_pitch, height, filter,
- bd);
+ __m256i signal[9], res0, res1;
+ const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
+
+ __m256i ff[4];
+ pack_filters(filter, ff);
+
+ pack_8x9_init(src_ptr, src_pitch, signal);
+
+ do {
+ pack_8x9_pixels(src_ptr, src_pitch, signal);
+
+ filter_8x9_pixels(signal, ff, &res0, &res1);
+ store_8x2_avg_pixels(&res0, &res1, &max, dst_ptr, dst_pitch);
+ update_pixels(signal);
+
+ src_ptr += src_pitch << 1;
+ dst_ptr += dst_pitch << 1;
+ height -= 2;
+ } while (height > 0);
}
static void aom_highbd_filter_block1d16_v8_avg_avx2(
- const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
+ const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
- filter_block_width16_vert(src, src_pitch, write_16x1_avg_pixels_ver,
- write_16x2_avg_pixels, dst, dst_pitch, height,
- filter, bd);
-}
+ __m256i signal[17], res0, res1;
+ const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
+
+ __m256i ff[4];
+ pack_filters(filter, ff);
+
+ pack_16x9_init(src_ptr, src_pitch, signal);
+
+ do {
+ pack_16x9_pixels(src_ptr, src_pitch, signal);
+ filter_16x9_pixels(signal, ff, &res0, &res1);
+ store_16x2_avg_pixels(&res0, &res1, &max, dst_ptr, dst_pitch);
+ update_16x9_pixels(signal);
-// 2-tap averaging
+ src_ptr += src_pitch << 1;
+ dst_ptr += dst_pitch << 1;
+ height -= 2;
+ } while (height > 0);
+}
static void aom_highbd_filter_block1d8_h2_avg_avx2(
- const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
+ const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
- filter_block_width8_2t_horiz(src, src_pitch, write_8x1_avg_pixels,
- write_8x2_avg_pixels, dst, dst_pitch, height,
- filter, bd);
+ __m256i signal[2], res0, res1;
+ const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
+
+ __m256i ff;
+ pack_2t_filter(filter, &ff);
+
+ src_ptr -= 3;
+ do {
+ pack_8x2_2t_pixels(src_ptr, src_pitch, signal);
+ filter_16_2t_pixels(signal, &ff, &res0, &res1);
+ store_8x2_avg_pixels(&res0, &res1, &max, dst_ptr, dst_pitch);
+ height -= 2;
+ src_ptr += src_pitch << 1;
+ dst_ptr += dst_pitch << 1;
+ } while (height > 1);
+
+ if (height > 0) {
+ pack_8x1_2t_pixels(src_ptr, signal);
+ filter_8x1_2t_pixels(signal, &ff, &res0);
+ store_8x1_avg_pixels(&res0, &max, dst_ptr);
+ }
}
static void aom_highbd_filter_block1d16_h2_avg_avx2(
- const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
+ const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
- filter_block_width16_2t_horiz(src, src_pitch, write_16x1_avg_pixels, dst,
- dst_pitch, height, filter, bd);
+ __m256i signal[2], res0, res1;
+ const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
+
+ __m256i ff;
+ pack_2t_filter(filter, &ff);
+
+ src_ptr -= 3;
+ do {
+ pack_16x1_2t_pixels(src_ptr, signal);
+ filter_16_2t_pixels(signal, &ff, &res0, &res1);
+ store_16x1_avg_pixels(&res0, &res1, &max, dst_ptr);
+ height -= 1;
+ src_ptr += src_pitch;
+ dst_ptr += dst_pitch;
+ } while (height > 0);
}
static void aom_highbd_filter_block1d16_v2_avg_avx2(
- const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
+ const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
- filter_block_width16_2t_vert(src, src_pitch, write_16x1_avg_pixels, dst,
- dst_pitch, height, filter, bd);
+ __m256i signal[3], res0, res1;
+ const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
+ __m256i ff;
+
+ pack_2t_filter(filter, &ff);
+ pack_16x2_init(src_ptr, signal);
+
+ do {
+ pack_16x2_2t_pixels(src_ptr, src_pitch, signal);
+ filter_16x2_2t_pixels(signal, &ff, &res0, &res1);
+ store_16x1_avg_pixels(&res0, &res1, &max, dst_ptr);
+
+ src_ptr += src_pitch;
+ dst_ptr += dst_pitch;
+ height -= 1;
+ } while (height > 0);
}
static void aom_highbd_filter_block1d8_v2_avg_avx2(
- const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
+ const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
- filter_block_width8_2t_vert(src, src_pitch, write_8x1_2t_avg_pixels_ver, dst,
- dst_pitch, height, filter, bd);
-}
+ __m128i signal[3], res0, res1;
+ const __m128i max = _mm_set1_epi16((1 << bd) - 1);
+ __m128i ff;
-typedef void HbdFilter1dFunc(const uint16_t *, ptrdiff_t, uint16_t *, ptrdiff_t,
- uint32_t, const int16_t *, int);
+ pack_8x1_2t_filter(filter, &ff);
+ pack_8x2_init(src_ptr, signal);
-#define HIGHBD_FUNC(width, dir, avg, opt) \
- aom_highbd_filter_block1d##width##_##dir##_##avg##opt
+ do {
+ pack_8x2_2t_pixels_ver(src_ptr, src_pitch, signal);
+ filter_8_2t_pixels(signal, &ff, &res0, &res1);
+ store_8x1_2t_avg_pixels_ver(&res0, &res1, &max, dst_ptr);
-HbdFilter1dFunc HIGHBD_FUNC(4, h8, , sse2);
-HbdFilter1dFunc HIGHBD_FUNC(4, h2, , sse2);
-HbdFilter1dFunc HIGHBD_FUNC(4, v8, , sse2);
-HbdFilter1dFunc HIGHBD_FUNC(4, v2, , sse2);
+ src_ptr += src_pitch;
+ dst_ptr += dst_pitch;
+ height -= 1;
+ } while (height > 0);
+}
-#define aom_highbd_filter_block1d4_h8_avx2 HIGHBD_FUNC(4, h8, , sse2)
-#define aom_highbd_filter_block1d4_h2_avx2 HIGHBD_FUNC(4, h2, , sse2)
-#define aom_highbd_filter_block1d4_v8_avx2 HIGHBD_FUNC(4, v8, , sse2)
-#define aom_highbd_filter_block1d4_v2_avx2 HIGHBD_FUNC(4, v2, , sse2)
+void aom_highbd_filter_block1d4_h8_sse2(const uint16_t *, ptrdiff_t, uint16_t *,
+ ptrdiff_t, uint32_t, const int16_t *,
+ int);
+void aom_highbd_filter_block1d4_h2_sse2(const uint16_t *, ptrdiff_t, uint16_t *,
+ ptrdiff_t, uint32_t, const int16_t *,
+ int);
+void aom_highbd_filter_block1d4_v8_sse2(const uint16_t *, ptrdiff_t, uint16_t *,
+ ptrdiff_t, uint32_t, const int16_t *,
+ int);
+void aom_highbd_filter_block1d4_v2_sse2(const uint16_t *, ptrdiff_t, uint16_t *,
+ ptrdiff_t, uint32_t, const int16_t *,
+ int);
+#define aom_highbd_filter_block1d4_h8_avx2 aom_highbd_filter_block1d4_h8_sse2
+#define aom_highbd_filter_block1d4_h2_avx2 aom_highbd_filter_block1d4_h2_sse2
+#define aom_highbd_filter_block1d4_v8_avx2 aom_highbd_filter_block1d4_v8_sse2
+#define aom_highbd_filter_block1d4_v2_avx2 aom_highbd_filter_block1d4_v2_sse2
HIGH_FUN_CONV_1D(horiz, x_step_q4, filter_x, h, src, , avx2);
HIGH_FUN_CONV_1D(vert, y_step_q4, filter_y, v, src - src_stride * 3, , avx2);
HIGH_FUN_CONV_2D(, avx2);
-HbdFilter1dFunc HIGHBD_FUNC(4, h8, avg_, sse2);
-HbdFilter1dFunc HIGHBD_FUNC(4, h2, avg_, sse2);
-HbdFilter1dFunc HIGHBD_FUNC(4, v8, avg_, sse2);
-HbdFilter1dFunc HIGHBD_FUNC(4, v2, avg_, sse2);
-
-#define aom_highbd_filter_block1d4_h8_avg_avx2 HIGHBD_FUNC(4, h8, avg_, sse2)
-#define aom_highbd_filter_block1d4_h2_avg_avx2 HIGHBD_FUNC(4, h2, avg_, sse2)
-#define aom_highbd_filter_block1d4_v8_avg_avx2 HIGHBD_FUNC(4, v8, avg_, sse2)
-#define aom_highbd_filter_block1d4_v2_avg_avx2 HIGHBD_FUNC(4, v2, avg_, sse2)
+void aom_highbd_filter_block1d4_h8_avg_sse2(const uint16_t *, ptrdiff_t,
+ uint16_t *, ptrdiff_t, uint32_t,
+ const int16_t *, int);
+void aom_highbd_filter_block1d4_h2_avg_sse2(const uint16_t *, ptrdiff_t,
+ uint16_t *, ptrdiff_t, uint32_t,
+ const int16_t *, int);
+void aom_highbd_filter_block1d4_v8_avg_sse2(const uint16_t *, ptrdiff_t,
+ uint16_t *, ptrdiff_t, uint32_t,
+ const int16_t *, int);
+void aom_highbd_filter_block1d4_v2_avg_sse2(const uint16_t *, ptrdiff_t,
+ uint16_t *, ptrdiff_t, uint32_t,
+ const int16_t *, int);
+#define aom_highbd_filter_block1d4_h8_avg_avx2 \
+ aom_highbd_filter_block1d4_h8_avg_sse2
+#define aom_highbd_filter_block1d4_h2_avg_avx2 \
+ aom_highbd_filter_block1d4_h2_avg_sse2
+#define aom_highbd_filter_block1d4_v8_avg_avx2 \
+ aom_highbd_filter_block1d4_v8_avg_sse2
+#define aom_highbd_filter_block1d4_v2_avg_avx2 \
+ aom_highbd_filter_block1d4_v2_avg_sse2
HIGH_FUN_CONV_1D(avg_horiz, x_step_q4, filter_x, h, src, avg_, avx2);
HIGH_FUN_CONV_1D(avg_vert, y_step_q4, filter_y, v, src - src_stride * 3, avg_,
diff --git a/third_party/aom/aom_dsp/x86/inv_txfm_avx2.c b/third_party/aom/aom_dsp/x86/inv_txfm_avx2.c
new file mode 100644
index 000000000..a9d6a127c
--- /dev/null
+++ b/third_party/aom/aom_dsp/x86/inv_txfm_avx2.c
@@ -0,0 +1,1238 @@
+/*
+ * 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.
+ */
+
+#include <immintrin.h>
+
+#include "./aom_dsp_rtcd.h"
+#include "aom_dsp/inv_txfm.h"
+#include "aom_dsp/x86/inv_txfm_common_avx2.h"
+#include "aom_dsp/x86/txfm_common_avx2.h"
+
+void aom_idct16x16_256_add_avx2(const tran_low_t *input, uint8_t *dest,
+ int stride) {
+ __m256i in[16];
+ load_buffer_16x16(input, in);
+ mm256_transpose_16x16(in, in);
+ av1_idct16_avx2(in);
+ mm256_transpose_16x16(in, in);
+ av1_idct16_avx2(in);
+ store_buffer_16xN(in, stride, dest, 16);
+}
+
+static INLINE void transpose_col_to_row_nz4x4(__m256i *in /*in[4]*/) {
+ const __m256i u0 = _mm256_unpacklo_epi16(in[0], in[1]);
+ const __m256i u1 = _mm256_unpacklo_epi16(in[2], in[3]);
+ const __m256i v0 = _mm256_unpacklo_epi32(u0, u1);
+ const __m256i v1 = _mm256_unpackhi_epi32(u0, u1);
+ in[0] = _mm256_permute4x64_epi64(v0, 0xA8);
+ in[1] = _mm256_permute4x64_epi64(v0, 0xA9);
+ in[2] = _mm256_permute4x64_epi64(v1, 0xA8);
+ in[3] = _mm256_permute4x64_epi64(v1, 0xA9);
+}
+
+#define MM256_SHUFFLE_EPI64(x0, x1, imm8) \
+ _mm256_castpd_si256(_mm256_shuffle_pd(_mm256_castsi256_pd(x0), \
+ _mm256_castsi256_pd(x1), imm8))
+
+static INLINE void transpose_col_to_row_nz4x16(__m256i *in /*in[16]*/) {
+ int i;
+ for (i = 0; i < 16; i += 4) {
+ transpose_col_to_row_nz4x4(&in[i]);
+ }
+
+ for (i = 0; i < 4; ++i) {
+ in[i] = MM256_SHUFFLE_EPI64(in[i], in[i + 4], 0);
+ in[i + 8] = MM256_SHUFFLE_EPI64(in[i + 8], in[i + 12], 0);
+ }
+
+ for (i = 0; i < 4; ++i) {
+ in[i] = _mm256_permute2x128_si256(in[i], in[i + 8], 0x20);
+ }
+}
+
+// Coefficients 0-7 before the final butterfly
+static INLINE void idct16_10_first_half(const __m256i *in, __m256i *out) {
+ const __m256i c2p28 = pair256_set_epi16(2 * cospi_28_64, 2 * cospi_28_64);
+ const __m256i c2p04 = pair256_set_epi16(2 * cospi_4_64, 2 * cospi_4_64);
+ const __m256i v4 = _mm256_mulhrs_epi16(in[2], c2p28);
+ const __m256i v7 = _mm256_mulhrs_epi16(in[2], c2p04);
+
+ const __m256i c2p16 = pair256_set_epi16(2 * cospi_16_64, 2 * cospi_16_64);
+ const __m256i v0 = _mm256_mulhrs_epi16(in[0], c2p16);
+ const __m256i v1 = v0;
+
+ const __m256i cospi_p16_p16 = _mm256_set1_epi16((int16_t)cospi_16_64);
+ const __m256i cospi_p16_m16 = pair256_set_epi16(cospi_16_64, -cospi_16_64);
+ __m256i v5, v6;
+ unpack_butter_fly(&v7, &v4, &cospi_p16_m16, &cospi_p16_p16, &v5, &v6);
+
+ out[0] = _mm256_add_epi16(v0, v7);
+ out[1] = _mm256_add_epi16(v1, v6);
+ out[2] = _mm256_add_epi16(v1, v5);
+ out[3] = _mm256_add_epi16(v0, v4);
+ out[4] = _mm256_sub_epi16(v0, v4);
+ out[5] = _mm256_sub_epi16(v1, v5);
+ out[6] = _mm256_sub_epi16(v1, v6);
+ out[7] = _mm256_sub_epi16(v0, v7);
+}
+
+// Coefficients 8-15 before the final butterfly
+static INLINE void idct16_10_second_half(const __m256i *in, __m256i *out) {
+ const __m256i c2p30 = pair256_set_epi16(2 * cospi_30_64, 2 * cospi_30_64);
+ const __m256i c2p02 = pair256_set_epi16(2 * cospi_2_64, 2 * cospi_2_64);
+ const __m256i t0 = _mm256_mulhrs_epi16(in[1], c2p30);
+ const __m256i t7 = _mm256_mulhrs_epi16(in[1], c2p02);
+
+ const __m256i c2m26 = pair256_set_epi16(-2 * cospi_26_64, -2 * cospi_26_64);
+ const __m256i c2p06 = pair256_set_epi16(2 * cospi_6_64, 2 * cospi_6_64);
+ const __m256i t3 = _mm256_mulhrs_epi16(in[3], c2m26);
+ const __m256i t4 = _mm256_mulhrs_epi16(in[3], c2p06);
+
+ const __m256i cospi_m08_p24 = pair256_set_epi16(-cospi_8_64, cospi_24_64);
+ const __m256i cospi_p24_p08 = pair256_set_epi16(cospi_24_64, cospi_8_64);
+ const __m256i cospi_m24_m08 = pair256_set_epi16(-cospi_24_64, -cospi_8_64);
+
+ __m256i t1, t2, t5, t6;
+ unpack_butter_fly(&t0, &t7, &cospi_m08_p24, &cospi_p24_p08, &t1, &t6);
+ unpack_butter_fly(&t3, &t4, &cospi_m24_m08, &cospi_m08_p24, &t2, &t5);
+
+ out[0] = _mm256_add_epi16(t0, t3);
+ out[1] = _mm256_add_epi16(t1, t2);
+ out[6] = _mm256_add_epi16(t6, t5);
+ out[7] = _mm256_add_epi16(t7, t4);
+
+ const __m256i v2 = _mm256_sub_epi16(t1, t2);
+ const __m256i v3 = _mm256_sub_epi16(t0, t3);
+ const __m256i v4 = _mm256_sub_epi16(t7, t4);
+ const __m256i v5 = _mm256_sub_epi16(t6, t5);
+ const __m256i cospi_p16_p16 = _mm256_set1_epi16((int16_t)cospi_16_64);
+ const __m256i cospi_p16_m16 = pair256_set_epi16(cospi_16_64, -cospi_16_64);
+ unpack_butter_fly(&v5, &v2, &cospi_p16_m16, &cospi_p16_p16, &out[2], &out[5]);
+ unpack_butter_fly(&v4, &v3, &cospi_p16_m16, &cospi_p16_p16, &out[3], &out[4]);
+}
+
+static INLINE void add_sub_butterfly(const __m256i *in, __m256i *out,
+ int size) {
+ int i = 0;
+ const int num = size >> 1;
+ const int bound = size - 1;
+ while (i < num) {
+ out[i] = _mm256_add_epi16(in[i], in[bound - i]);
+ out[bound - i] = _mm256_sub_epi16(in[i], in[bound - i]);
+ i++;
+ }
+}
+
+static INLINE void idct16_10(__m256i *in /*in[16]*/) {
+ __m256i out[16];
+ idct16_10_first_half(in, out);
+ idct16_10_second_half(in, &out[8]);
+ add_sub_butterfly(out, in, 16);
+}
+
+void aom_idct16x16_10_add_avx2(const tran_low_t *input, uint8_t *dest,
+ int stride) {
+ __m256i in[16];
+
+ load_coeff(input, &in[0]);
+ load_coeff(input + 16, &in[1]);
+ load_coeff(input + 32, &in[2]);
+ load_coeff(input + 48, &in[3]);
+
+ transpose_col_to_row_nz4x4(in);
+ idct16_10(in);
+
+ transpose_col_to_row_nz4x16(in);
+ idct16_10(in);
+
+ store_buffer_16xN(in, stride, dest, 16);
+}
+
+// Note:
+// For 16x16 int16_t matrix
+// transpose first 8 columns into first 8 rows.
+// Since only upper-left 8x8 are non-zero, the input are first 8 rows (in[8]).
+// After transposing, the 8 row vectors are in in[8].
+void transpose_col_to_row_nz8x8(__m256i *in /*in[8]*/) {
+ __m256i u0 = _mm256_unpacklo_epi16(in[0], in[1]);
+ __m256i u1 = _mm256_unpackhi_epi16(in[0], in[1]);
+ __m256i u2 = _mm256_unpacklo_epi16(in[2], in[3]);
+ __m256i u3 = _mm256_unpackhi_epi16(in[2], in[3]);
+
+ const __m256i v0 = _mm256_unpacklo_epi32(u0, u2);
+ const __m256i v1 = _mm256_unpackhi_epi32(u0, u2);
+ const __m256i v2 = _mm256_unpacklo_epi32(u1, u3);
+ const __m256i v3 = _mm256_unpackhi_epi32(u1, u3);
+
+ u0 = _mm256_unpacklo_epi16(in[4], in[5]);
+ u1 = _mm256_unpackhi_epi16(in[4], in[5]);
+ u2 = _mm256_unpacklo_epi16(in[6], in[7]);
+ u3 = _mm256_unpackhi_epi16(in[6], in[7]);
+
+ const __m256i v4 = _mm256_unpacklo_epi32(u0, u2);
+ const __m256i v5 = _mm256_unpackhi_epi32(u0, u2);
+ const __m256i v6 = _mm256_unpacklo_epi32(u1, u3);
+ const __m256i v7 = _mm256_unpackhi_epi32(u1, u3);
+
+ in[0] = MM256_SHUFFLE_EPI64(v0, v4, 0);
+ in[1] = MM256_SHUFFLE_EPI64(v0, v4, 3);
+ in[2] = MM256_SHUFFLE_EPI64(v1, v5, 0);
+ in[3] = MM256_SHUFFLE_EPI64(v1, v5, 3);
+ in[4] = MM256_SHUFFLE_EPI64(v2, v6, 0);
+ in[5] = MM256_SHUFFLE_EPI64(v2, v6, 3);
+ in[6] = MM256_SHUFFLE_EPI64(v3, v7, 0);
+ in[7] = MM256_SHUFFLE_EPI64(v3, v7, 3);
+}
+
+// Note:
+// For 16x16 int16_t matrix
+// transpose first 8 columns into first 8 rows.
+// Since only matrix left 8x16 are non-zero, the input are total 16 rows
+// (in[16]).
+// After transposing, the 8 row vectors are in in[8]. All else are zero.
+static INLINE void transpose_col_to_row_nz8x16(__m256i *in /*in[16]*/) {
+ transpose_col_to_row_nz8x8(in);
+ transpose_col_to_row_nz8x8(&in[8]);
+
+ int i;
+ for (i = 0; i < 8; ++i) {
+ in[i] = _mm256_permute2x128_si256(in[i], in[i + 8], 0x20);
+ }
+}
+
+static INLINE void idct16_38_first_half(const __m256i *in, __m256i *out) {
+ const __m256i c2p28 = pair256_set_epi16(2 * cospi_28_64, 2 * cospi_28_64);
+ const __m256i c2p04 = pair256_set_epi16(2 * cospi_4_64, 2 * cospi_4_64);
+ __m256i t4 = _mm256_mulhrs_epi16(in[2], c2p28);
+ __m256i t7 = _mm256_mulhrs_epi16(in[2], c2p04);
+
+ const __m256i c2m20 = pair256_set_epi16(-2 * cospi_20_64, -2 * cospi_20_64);
+ const __m256i c2p12 = pair256_set_epi16(2 * cospi_12_64, 2 * cospi_12_64);
+ __m256i t5 = _mm256_mulhrs_epi16(in[6], c2m20);
+ __m256i t6 = _mm256_mulhrs_epi16(in[6], c2p12);
+
+ const __m256i c2p16 = pair256_set_epi16(2 * cospi_16_64, 2 * cospi_16_64);
+ const __m256i c2p24 = pair256_set_epi16(2 * cospi_24_64, 2 * cospi_24_64);
+ const __m256i c2p08 = pair256_set_epi16(2 * cospi_8_64, 2 * cospi_8_64);
+ const __m256i u0 = _mm256_mulhrs_epi16(in[0], c2p16);
+ const __m256i u1 = _mm256_mulhrs_epi16(in[0], c2p16);
+ const __m256i u2 = _mm256_mulhrs_epi16(in[4], c2p24);
+ const __m256i u3 = _mm256_mulhrs_epi16(in[4], c2p08);
+
+ const __m256i u4 = _mm256_add_epi16(t4, t5);
+ const __m256i u5 = _mm256_sub_epi16(t4, t5);
+ const __m256i u6 = _mm256_sub_epi16(t7, t6);
+ const __m256i u7 = _mm256_add_epi16(t7, t6);
+
+ const __m256i t0 = _mm256_add_epi16(u0, u3);
+ const __m256i t1 = _mm256_add_epi16(u1, u2);
+ const __m256i t2 = _mm256_sub_epi16(u1, u2);
+ const __m256i t3 = _mm256_sub_epi16(u0, u3);
+
+ t4 = u4;
+ t7 = u7;
+
+ const __m256i cospi_p16_p16 = _mm256_set1_epi16((int16_t)cospi_16_64);
+ const __m256i cospi_p16_m16 = pair256_set_epi16(cospi_16_64, -cospi_16_64);
+ unpack_butter_fly(&u6, &u5, &cospi_p16_m16, &cospi_p16_p16, &t5, &t6);
+
+ out[0] = _mm256_add_epi16(t0, t7);
+ out[1] = _mm256_add_epi16(t1, t6);
+ out[2] = _mm256_add_epi16(t2, t5);
+ out[3] = _mm256_add_epi16(t3, t4);
+ out[4] = _mm256_sub_epi16(t3, t4);
+ out[5] = _mm256_sub_epi16(t2, t5);
+ out[6] = _mm256_sub_epi16(t1, t6);
+ out[7] = _mm256_sub_epi16(t0, t7);
+}
+
+static INLINE void idct16_38_second_half(const __m256i *in, __m256i *out) {
+ const __m256i c2p30 = pair256_set_epi16(2 * cospi_30_64, 2 * cospi_30_64);
+ const __m256i c2p02 = pair256_set_epi16(2 * cospi_2_64, 2 * cospi_2_64);
+ __m256i t0 = _mm256_mulhrs_epi16(in[1], c2p30);
+ __m256i t7 = _mm256_mulhrs_epi16(in[1], c2p02);
+
+ const __m256i c2m18 = pair256_set_epi16(-2 * cospi_18_64, -2 * cospi_18_64);
+ const __m256i c2p14 = pair256_set_epi16(2 * cospi_14_64, 2 * cospi_14_64);
+ __m256i t1 = _mm256_mulhrs_epi16(in[7], c2m18);
+ __m256i t6 = _mm256_mulhrs_epi16(in[7], c2p14);
+
+ const __m256i c2p22 = pair256_set_epi16(2 * cospi_22_64, 2 * cospi_22_64);
+ const __m256i c2p10 = pair256_set_epi16(2 * cospi_10_64, 2 * cospi_10_64);
+ __m256i t2 = _mm256_mulhrs_epi16(in[5], c2p22);
+ __m256i t5 = _mm256_mulhrs_epi16(in[5], c2p10);
+
+ const __m256i c2m26 = pair256_set_epi16(-2 * cospi_26_64, -2 * cospi_26_64);
+ const __m256i c2p06 = pair256_set_epi16(2 * cospi_6_64, 2 * cospi_6_64);
+ __m256i t3 = _mm256_mulhrs_epi16(in[3], c2m26);
+ __m256i t4 = _mm256_mulhrs_epi16(in[3], c2p06);
+
+ __m256i v0, v1, v2, v3, v4, v5, v6, v7;
+ v0 = _mm256_add_epi16(t0, t1);
+ v1 = _mm256_sub_epi16(t0, t1);
+ v2 = _mm256_sub_epi16(t3, t2);
+ v3 = _mm256_add_epi16(t2, t3);
+ v4 = _mm256_add_epi16(t4, t5);
+ v5 = _mm256_sub_epi16(t4, t5);
+ v6 = _mm256_sub_epi16(t7, t6);
+ v7 = _mm256_add_epi16(t6, t7);
+
+ t0 = v0;
+ t7 = v7;
+ t3 = v3;
+ t4 = v4;
+ const __m256i cospi_m08_p24 = pair256_set_epi16(-cospi_8_64, cospi_24_64);
+ const __m256i cospi_p24_p08 = pair256_set_epi16(cospi_24_64, cospi_8_64);
+ const __m256i cospi_m24_m08 = pair256_set_epi16(-cospi_24_64, -cospi_8_64);
+ unpack_butter_fly(&v1, &v6, &cospi_m08_p24, &cospi_p24_p08, &t1, &t6);
+ unpack_butter_fly(&v2, &v5, &cospi_m24_m08, &cospi_m08_p24, &t2, &t5);
+
+ v0 = _mm256_add_epi16(t0, t3);
+ v1 = _mm256_add_epi16(t1, t2);
+ v2 = _mm256_sub_epi16(t1, t2);
+ v3 = _mm256_sub_epi16(t0, t3);
+ v4 = _mm256_sub_epi16(t7, t4);
+ v5 = _mm256_sub_epi16(t6, t5);
+ v6 = _mm256_add_epi16(t6, t5);
+ v7 = _mm256_add_epi16(t7, t4);
+
+ // stage 6, (8-15)
+ out[0] = v0;
+ out[1] = v1;
+ out[6] = v6;
+ out[7] = v7;
+ const __m256i cospi_p16_p16 = _mm256_set1_epi16((int16_t)cospi_16_64);
+ const __m256i cospi_p16_m16 = pair256_set_epi16(cospi_16_64, -cospi_16_64);
+ unpack_butter_fly(&v5, &v2, &cospi_p16_m16, &cospi_p16_p16, &out[2], &out[5]);
+ unpack_butter_fly(&v4, &v3, &cospi_p16_m16, &cospi_p16_p16, &out[3], &out[4]);
+}
+
+static INLINE void idct16_38(__m256i *in /*in[16]*/) {
+ __m256i out[16];
+ idct16_38_first_half(in, out);
+ idct16_38_second_half(in, &out[8]);
+ add_sub_butterfly(out, in, 16);
+}
+
+void aom_idct16x16_38_add_avx2(const tran_low_t *input, uint8_t *dest,
+ int stride) {
+ __m256i in[16];
+
+ int i;
+ for (i = 0; i < 8; ++i) {
+ load_coeff(input + (i << 4), &in[i]);
+ }
+
+ transpose_col_to_row_nz8x8(in);
+ idct16_38(in);
+
+ transpose_col_to_row_nz8x16(in);
+ idct16_38(in);
+
+ store_buffer_16xN(in, stride, dest, 16);
+}
+
+static INLINE int calculate_dc(const tran_low_t *input) {
+ int dc = (int)dct_const_round_shift(input[0] * cospi_16_64);
+ dc = (int)dct_const_round_shift(dc * cospi_16_64);
+ dc = ROUND_POWER_OF_TWO(dc, IDCT_ROUNDING_POS);
+ return dc;
+}
+
+void aom_idct16x16_1_add_avx2(const tran_low_t *input, uint8_t *dest,
+ int stride) {
+ const int dc = calculate_dc(input);
+ if (dc == 0) return;
+
+ const __m256i dc_value = _mm256_set1_epi16(dc);
+
+ int i;
+ for (i = 0; i < 16; ++i) {
+ recon_and_store(&dc_value, dest);
+ dest += stride;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// 32x32 partial IDCT
+
+void aom_idct32x32_1_add_avx2(const tran_low_t *input, uint8_t *dest,
+ int stride) {
+ const int dc = calculate_dc(input);
+ if (dc == 0) return;
+
+ const __m256i dc_value = _mm256_set1_epi16(dc);
+
+ int i;
+ for (i = 0; i < 32; ++i) {
+ recon_and_store(&dc_value, dest);
+ recon_and_store(&dc_value, dest + 16);
+ dest += stride;
+ }
+}
+
+static void load_buffer_32x16(const tran_low_t *input, __m256i *in /*in[32]*/) {
+ int i;
+ for (i = 0; i < 16; ++i) {
+ load_coeff(input, &in[i]);
+ load_coeff(input + 16, &in[i + 16]);
+ input += 32;
+ }
+}
+
+// Note:
+// We extend SSSE3 operations to AVX2. Instead of operating on __m128i, we
+// operate coefficients on __m256i. Our operation capacity doubles for each
+// instruction.
+#define BUTTERFLY_PAIR(x0, x1, co0, co1) \
+ do { \
+ tmp0 = _mm256_madd_epi16(x0, co0); \
+ tmp1 = _mm256_madd_epi16(x1, co0); \
+ tmp2 = _mm256_madd_epi16(x0, co1); \
+ tmp3 = _mm256_madd_epi16(x1, co1); \
+ tmp0 = _mm256_add_epi32(tmp0, rounding); \
+ tmp1 = _mm256_add_epi32(tmp1, rounding); \
+ tmp2 = _mm256_add_epi32(tmp2, rounding); \
+ tmp3 = _mm256_add_epi32(tmp3, rounding); \
+ tmp0 = _mm256_srai_epi32(tmp0, DCT_CONST_BITS); \
+ tmp1 = _mm256_srai_epi32(tmp1, DCT_CONST_BITS); \
+ tmp2 = _mm256_srai_epi32(tmp2, DCT_CONST_BITS); \
+ tmp3 = _mm256_srai_epi32(tmp3, DCT_CONST_BITS); \
+ } while (0)
+
+static INLINE void butterfly(const __m256i *x0, const __m256i *x1,
+ const __m256i *c0, const __m256i *c1, __m256i *y0,
+ __m256i *y1) {
+ __m256i tmp0, tmp1, tmp2, tmp3, u0, u1;
+ const __m256i rounding = _mm256_set1_epi32(DCT_CONST_ROUNDING);
+
+ u0 = _mm256_unpacklo_epi16(*x0, *x1);
+ u1 = _mm256_unpackhi_epi16(*x0, *x1);
+ BUTTERFLY_PAIR(u0, u1, *c0, *c1);
+ *y0 = _mm256_packs_epi32(tmp0, tmp1);
+ *y1 = _mm256_packs_epi32(tmp2, tmp3);
+}
+
+static INLINE void butterfly_self(__m256i *x0, __m256i *x1, const __m256i *c0,
+ const __m256i *c1) {
+ __m256i tmp0, tmp1, tmp2, tmp3, u0, u1;
+ const __m256i rounding = _mm256_set1_epi32(DCT_CONST_ROUNDING);
+
+ u0 = _mm256_unpacklo_epi16(*x0, *x1);
+ u1 = _mm256_unpackhi_epi16(*x0, *x1);
+ BUTTERFLY_PAIR(u0, u1, *c0, *c1);
+ *x0 = _mm256_packs_epi32(tmp0, tmp1);
+ *x1 = _mm256_packs_epi32(tmp2, tmp3);
+}
+
+// For each 16x32 block __m256i in[32],
+// Input with index, 2, 6, 10, 14, 18, 22, 26, 30
+// output pixels: 8-15 in __m256i in[32]
+static void idct32_full_16x32_quarter_2(const __m256i *in /*in[32]*/,
+ __m256i *out /*out[16]*/) {
+ __m256i u8, u9, u10, u11, u12, u13, u14, u15; // stp2_
+ __m256i v8, v9, v10, v11, v12, v13, v14, v15; // stp1_
+
+ {
+ const __m256i stg2_0 = pair256_set_epi16(cospi_30_64, -cospi_2_64);
+ const __m256i stg2_1 = pair256_set_epi16(cospi_2_64, cospi_30_64);
+ const __m256i stg2_2 = pair256_set_epi16(cospi_14_64, -cospi_18_64);
+ const __m256i stg2_3 = pair256_set_epi16(cospi_18_64, cospi_14_64);
+ butterfly(&in[2], &in[30], &stg2_0, &stg2_1, &u8, &u15);
+ butterfly(&in[18], &in[14], &stg2_2, &stg2_3, &u9, &u14);
+ }
+
+ v8 = _mm256_add_epi16(u8, u9);
+ v9 = _mm256_sub_epi16(u8, u9);
+ v14 = _mm256_sub_epi16(u15, u14);
+ v15 = _mm256_add_epi16(u15, u14);
+
+ {
+ const __m256i stg2_4 = pair256_set_epi16(cospi_22_64, -cospi_10_64);
+ const __m256i stg2_5 = pair256_set_epi16(cospi_10_64, cospi_22_64);
+ const __m256i stg2_6 = pair256_set_epi16(cospi_6_64, -cospi_26_64);
+ const __m256i stg2_7 = pair256_set_epi16(cospi_26_64, cospi_6_64);
+ butterfly(&in[10], &in[22], &stg2_4, &stg2_5, &u10, &u13);
+ butterfly(&in[26], &in[6], &stg2_6, &stg2_7, &u11, &u12);
+ }
+
+ v10 = _mm256_sub_epi16(u11, u10);
+ v11 = _mm256_add_epi16(u11, u10);
+ v12 = _mm256_add_epi16(u12, u13);
+ v13 = _mm256_sub_epi16(u12, u13);
+
+ {
+ const __m256i stg4_4 = pair256_set_epi16(-cospi_8_64, cospi_24_64);
+ const __m256i stg4_5 = pair256_set_epi16(cospi_24_64, cospi_8_64);
+ const __m256i stg4_6 = pair256_set_epi16(-cospi_24_64, -cospi_8_64);
+ butterfly_self(&v9, &v14, &stg4_4, &stg4_5);
+ butterfly_self(&v10, &v13, &stg4_6, &stg4_4);
+ }
+
+ out[0] = _mm256_add_epi16(v8, v11);
+ out[1] = _mm256_add_epi16(v9, v10);
+ out[6] = _mm256_add_epi16(v14, v13);
+ out[7] = _mm256_add_epi16(v15, v12);
+
+ out[2] = _mm256_sub_epi16(v9, v10);
+ out[3] = _mm256_sub_epi16(v8, v11);
+ out[4] = _mm256_sub_epi16(v15, v12);
+ out[5] = _mm256_sub_epi16(v14, v13);
+
+ {
+ const __m256i stg4_0 = pair256_set_epi16(cospi_16_64, cospi_16_64);
+ const __m256i stg6_0 = pair256_set_epi16(-cospi_16_64, cospi_16_64);
+ butterfly_self(&out[2], &out[5], &stg6_0, &stg4_0);
+ butterfly_self(&out[3], &out[4], &stg6_0, &stg4_0);
+ }
+}
+
+// For each 8x32 block __m256i in[32],
+// Input with index, 0, 4, 8, 12, 16, 20, 24, 28
+// output pixels: 0-7 in __m256i in[32]
+static void idct32_full_16x32_quarter_1(const __m256i *in /*in[32]*/,
+ __m256i *out /*out[8]*/) {
+ __m256i u0, u1, u2, u3, u4, u5, u6, u7; // stp1_
+ __m256i v0, v1, v2, v3, v4, v5, v6, v7; // stp2_
+
+ {
+ const __m256i stg3_0 = pair256_set_epi16(cospi_28_64, -cospi_4_64);
+ const __m256i stg3_1 = pair256_set_epi16(cospi_4_64, cospi_28_64);
+ const __m256i stg3_2 = pair256_set_epi16(cospi_12_64, -cospi_20_64);
+ const __m256i stg3_3 = pair256_set_epi16(cospi_20_64, cospi_12_64);
+ butterfly(&in[4], &in[28], &stg3_0, &stg3_1, &u4, &u7);
+ butterfly(&in[20], &in[12], &stg3_2, &stg3_3, &u5, &u6);
+ }
+
+ v4 = _mm256_add_epi16(u4, u5);
+ v5 = _mm256_sub_epi16(u4, u5);
+ v6 = _mm256_sub_epi16(u7, u6);
+ v7 = _mm256_add_epi16(u7, u6);
+
+ {
+ const __m256i stg4_0 = pair256_set_epi16(cospi_16_64, cospi_16_64);
+ const __m256i stg4_1 = pair256_set_epi16(cospi_16_64, -cospi_16_64);
+ const __m256i stg4_2 = pair256_set_epi16(cospi_24_64, -cospi_8_64);
+ const __m256i stg4_3 = pair256_set_epi16(cospi_8_64, cospi_24_64);
+ butterfly(&v6, &v5, &stg4_1, &stg4_0, &v5, &v6);
+
+ butterfly(&in[0], &in[16], &stg4_0, &stg4_1, &u0, &u1);
+ butterfly(&in[8], &in[24], &stg4_2, &stg4_3, &u2, &u3);
+ }
+
+ v0 = _mm256_add_epi16(u0, u3);
+ v1 = _mm256_add_epi16(u1, u2);
+ v2 = _mm256_sub_epi16(u1, u2);
+ v3 = _mm256_sub_epi16(u0, u3);
+
+ out[0] = _mm256_add_epi16(v0, v7);
+ out[1] = _mm256_add_epi16(v1, v6);
+ out[2] = _mm256_add_epi16(v2, v5);
+ out[3] = _mm256_add_epi16(v3, v4);
+ out[4] = _mm256_sub_epi16(v3, v4);
+ out[5] = _mm256_sub_epi16(v2, v5);
+ out[6] = _mm256_sub_epi16(v1, v6);
+ out[7] = _mm256_sub_epi16(v0, v7);
+}
+
+// For each 8x32 block __m256i in[32],
+// Input with odd index,
+// 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31
+// output pixels: 16-23, 24-31 in __m256i in[32]
+// We avoid hide an offset, 16, inside this function. So we output 0-15 into
+// array out[16]
+static void idct32_full_16x32_quarter_3_4(const __m256i *in /*in[32]*/,
+ __m256i *out /*out[16]*/) {
+ __m256i v16, v17, v18, v19, v20, v21, v22, v23;
+ __m256i v24, v25, v26, v27, v28, v29, v30, v31;
+ __m256i u16, u17, u18, u19, u20, u21, u22, u23;
+ __m256i u24, u25, u26, u27, u28, u29, u30, u31;
+
+ {
+ const __m256i stg1_0 = pair256_set_epi16(cospi_31_64, -cospi_1_64);
+ const __m256i stg1_1 = pair256_set_epi16(cospi_1_64, cospi_31_64);
+ const __m256i stg1_2 = pair256_set_epi16(cospi_15_64, -cospi_17_64);
+ const __m256i stg1_3 = pair256_set_epi16(cospi_17_64, cospi_15_64);
+ const __m256i stg1_4 = pair256_set_epi16(cospi_23_64, -cospi_9_64);
+ const __m256i stg1_5 = pair256_set_epi16(cospi_9_64, cospi_23_64);
+ const __m256i stg1_6 = pair256_set_epi16(cospi_7_64, -cospi_25_64);
+ const __m256i stg1_7 = pair256_set_epi16(cospi_25_64, cospi_7_64);
+ const __m256i stg1_8 = pair256_set_epi16(cospi_27_64, -cospi_5_64);
+ const __m256i stg1_9 = pair256_set_epi16(cospi_5_64, cospi_27_64);
+ const __m256i stg1_10 = pair256_set_epi16(cospi_11_64, -cospi_21_64);
+ const __m256i stg1_11 = pair256_set_epi16(cospi_21_64, cospi_11_64);
+ const __m256i stg1_12 = pair256_set_epi16(cospi_19_64, -cospi_13_64);
+ const __m256i stg1_13 = pair256_set_epi16(cospi_13_64, cospi_19_64);
+ const __m256i stg1_14 = pair256_set_epi16(cospi_3_64, -cospi_29_64);
+ const __m256i stg1_15 = pair256_set_epi16(cospi_29_64, cospi_3_64);
+ butterfly(&in[1], &in[31], &stg1_0, &stg1_1, &u16, &u31);
+ butterfly(&in[17], &in[15], &stg1_2, &stg1_3, &u17, &u30);
+ butterfly(&in[9], &in[23], &stg1_4, &stg1_5, &u18, &u29);
+ butterfly(&in[25], &in[7], &stg1_6, &stg1_7, &u19, &u28);
+
+ butterfly(&in[5], &in[27], &stg1_8, &stg1_9, &u20, &u27);
+ butterfly(&in[21], &in[11], &stg1_10, &stg1_11, &u21, &u26);
+
+ butterfly(&in[13], &in[19], &stg1_12, &stg1_13, &u22, &u25);
+ butterfly(&in[29], &in[3], &stg1_14, &stg1_15, &u23, &u24);
+ }
+
+ v16 = _mm256_add_epi16(u16, u17);
+ v17 = _mm256_sub_epi16(u16, u17);
+ v18 = _mm256_sub_epi16(u19, u18);
+ v19 = _mm256_add_epi16(u19, u18);
+
+ v20 = _mm256_add_epi16(u20, u21);
+ v21 = _mm256_sub_epi16(u20, u21);
+ v22 = _mm256_sub_epi16(u23, u22);
+ v23 = _mm256_add_epi16(u23, u22);
+
+ v24 = _mm256_add_epi16(u24, u25);
+ v25 = _mm256_sub_epi16(u24, u25);
+ v26 = _mm256_sub_epi16(u27, u26);
+ v27 = _mm256_add_epi16(u27, u26);
+
+ v28 = _mm256_add_epi16(u28, u29);
+ v29 = _mm256_sub_epi16(u28, u29);
+ v30 = _mm256_sub_epi16(u31, u30);
+ v31 = _mm256_add_epi16(u31, u30);
+
+ {
+ const __m256i stg3_4 = pair256_set_epi16(-cospi_4_64, cospi_28_64);
+ const __m256i stg3_5 = pair256_set_epi16(cospi_28_64, cospi_4_64);
+ const __m256i stg3_6 = pair256_set_epi16(-cospi_28_64, -cospi_4_64);
+ const __m256i stg3_8 = pair256_set_epi16(-cospi_20_64, cospi_12_64);
+ const __m256i stg3_9 = pair256_set_epi16(cospi_12_64, cospi_20_64);
+ const __m256i stg3_10 = pair256_set_epi16(-cospi_12_64, -cospi_20_64);
+ butterfly_self(&v17, &v30, &stg3_4, &stg3_5);
+ butterfly_self(&v18, &v29, &stg3_6, &stg3_4);
+ butterfly_self(&v21, &v26, &stg3_8, &stg3_9);
+ butterfly_self(&v22, &v25, &stg3_10, &stg3_8);
+ }
+
+ u16 = _mm256_add_epi16(v16, v19);
+ u17 = _mm256_add_epi16(v17, v18);
+ u18 = _mm256_sub_epi16(v17, v18);
+ u19 = _mm256_sub_epi16(v16, v19);
+ u20 = _mm256_sub_epi16(v23, v20);
+ u21 = _mm256_sub_epi16(v22, v21);
+ u22 = _mm256_add_epi16(v22, v21);
+ u23 = _mm256_add_epi16(v23, v20);
+
+ u24 = _mm256_add_epi16(v24, v27);
+ u25 = _mm256_add_epi16(v25, v26);
+ u26 = _mm256_sub_epi16(v25, v26);
+ u27 = _mm256_sub_epi16(v24, v27);
+
+ u28 = _mm256_sub_epi16(v31, v28);
+ u29 = _mm256_sub_epi16(v30, v29);
+ u30 = _mm256_add_epi16(v29, v30);
+ u31 = _mm256_add_epi16(v28, v31);
+
+ {
+ const __m256i stg4_4 = pair256_set_epi16(-cospi_8_64, cospi_24_64);
+ const __m256i stg4_5 = pair256_set_epi16(cospi_24_64, cospi_8_64);
+ const __m256i stg4_6 = pair256_set_epi16(-cospi_24_64, -cospi_8_64);
+ butterfly_self(&u18, &u29, &stg4_4, &stg4_5);
+ butterfly_self(&u19, &u28, &stg4_4, &stg4_5);
+ butterfly_self(&u20, &u27, &stg4_6, &stg4_4);
+ butterfly_self(&u21, &u26, &stg4_6, &stg4_4);
+ }
+
+ out[0] = _mm256_add_epi16(u16, u23);
+ out[1] = _mm256_add_epi16(u17, u22);
+ out[2] = _mm256_add_epi16(u18, u21);
+ out[3] = _mm256_add_epi16(u19, u20);
+ out[4] = _mm256_sub_epi16(u19, u20);
+ out[5] = _mm256_sub_epi16(u18, u21);
+ out[6] = _mm256_sub_epi16(u17, u22);
+ out[7] = _mm256_sub_epi16(u16, u23);
+
+ out[8] = _mm256_sub_epi16(u31, u24);
+ out[9] = _mm256_sub_epi16(u30, u25);
+ out[10] = _mm256_sub_epi16(u29, u26);
+ out[11] = _mm256_sub_epi16(u28, u27);
+ out[12] = _mm256_add_epi16(u27, u28);
+ out[13] = _mm256_add_epi16(u26, u29);
+ out[14] = _mm256_add_epi16(u25, u30);
+ out[15] = _mm256_add_epi16(u24, u31);
+
+ {
+ const __m256i stg4_0 = pair256_set_epi16(cospi_16_64, cospi_16_64);
+ const __m256i stg6_0 = pair256_set_epi16(-cospi_16_64, cospi_16_64);
+ butterfly_self(&out[4], &out[11], &stg6_0, &stg4_0);
+ butterfly_self(&out[5], &out[10], &stg6_0, &stg4_0);
+ butterfly_self(&out[6], &out[9], &stg6_0, &stg4_0);
+ butterfly_self(&out[7], &out[8], &stg6_0, &stg4_0);
+ }
+}
+
+static void idct32_full_16x32_quarter_1_2(const __m256i *in /*in[32]*/,
+ __m256i *out /*out[32]*/) {
+ __m256i temp[16];
+ idct32_full_16x32_quarter_1(in, temp);
+ idct32_full_16x32_quarter_2(in, &temp[8]);
+ add_sub_butterfly(temp, out, 16);
+}
+
+static void idct32_16x32(const __m256i *in /*in[32]*/,
+ __m256i *out /*out[32]*/) {
+ __m256i temp[32];
+ idct32_full_16x32_quarter_1_2(in, temp);
+ idct32_full_16x32_quarter_3_4(in, &temp[16]);
+ add_sub_butterfly(temp, out, 32);
+}
+
+void aom_idct32x32_1024_add_avx2(const tran_low_t *input, uint8_t *dest,
+ int stride) {
+ __m256i col[64], in[32];
+ int i;
+
+ for (i = 0; i < 2; ++i) {
+ load_buffer_32x16(input, in);
+ input += 32 << 4;
+
+ mm256_transpose_16x16(in, in);
+ mm256_transpose_16x16(&in[16], &in[16]);
+ idct32_16x32(in, col + (i << 5));
+ }
+
+ for (i = 0; i < 2; ++i) {
+ int j = i << 4;
+ mm256_transpose_16x16(col + j, in);
+ mm256_transpose_16x16(col + j + 32, &in[16]);
+ idct32_16x32(in, in);
+ store_buffer_16xN(in, stride, dest, 32);
+ dest += 16;
+ }
+}
+
+// Group the coefficient calculation into smaller functions
+// to prevent stack spillover:
+// quarter_1: 0-7
+// quarter_2: 8-15
+// quarter_3_4: 16-23, 24-31
+static void idct32_16x32_135_quarter_1(const __m256i *in /*in[16]*/,
+ __m256i *out /*out[8]*/) {
+ __m256i u0, u1, u2, u3, u4, u5, u6, u7;
+ __m256i v0, v1, v2, v3, v4, v5, v6, v7;
+
+ {
+ const __m256i stk4_0 = pair256_set_epi16(2 * cospi_16_64, 2 * cospi_16_64);
+ const __m256i stk4_2 = pair256_set_epi16(2 * cospi_24_64, 2 * cospi_24_64);
+ const __m256i stk4_3 = pair256_set_epi16(2 * cospi_8_64, 2 * cospi_8_64);
+ u0 = _mm256_mulhrs_epi16(in[0], stk4_0);
+ u2 = _mm256_mulhrs_epi16(in[8], stk4_2);
+ u3 = _mm256_mulhrs_epi16(in[8], stk4_3);
+ u1 = u0;
+ }
+
+ v0 = _mm256_add_epi16(u0, u3);
+ v1 = _mm256_add_epi16(u1, u2);
+ v2 = _mm256_sub_epi16(u1, u2);
+ v3 = _mm256_sub_epi16(u0, u3);
+
+ {
+ const __m256i stk3_0 = pair256_set_epi16(2 * cospi_28_64, 2 * cospi_28_64);
+ const __m256i stk3_1 = pair256_set_epi16(2 * cospi_4_64, 2 * cospi_4_64);
+ const __m256i stk3_2 =
+ pair256_set_epi16(-2 * cospi_20_64, -2 * cospi_20_64);
+ const __m256i stk3_3 = pair256_set_epi16(2 * cospi_12_64, 2 * cospi_12_64);
+ u4 = _mm256_mulhrs_epi16(in[4], stk3_0);
+ u7 = _mm256_mulhrs_epi16(in[4], stk3_1);
+ u5 = _mm256_mulhrs_epi16(in[12], stk3_2);
+ u6 = _mm256_mulhrs_epi16(in[12], stk3_3);
+ }
+
+ v4 = _mm256_add_epi16(u4, u5);
+ v5 = _mm256_sub_epi16(u4, u5);
+ v6 = _mm256_sub_epi16(u7, u6);
+ v7 = _mm256_add_epi16(u7, u6);
+
+ {
+ const __m256i stg4_0 = pair256_set_epi16(cospi_16_64, cospi_16_64);
+ const __m256i stg4_1 = pair256_set_epi16(cospi_16_64, -cospi_16_64);
+ butterfly(&v6, &v5, &stg4_1, &stg4_0, &v5, &v6);
+ }
+
+ out[0] = _mm256_add_epi16(v0, v7);
+ out[1] = _mm256_add_epi16(v1, v6);
+ out[2] = _mm256_add_epi16(v2, v5);
+ out[3] = _mm256_add_epi16(v3, v4);
+ out[4] = _mm256_sub_epi16(v3, v4);
+ out[5] = _mm256_sub_epi16(v2, v5);
+ out[6] = _mm256_sub_epi16(v1, v6);
+ out[7] = _mm256_sub_epi16(v0, v7);
+}
+
+static void idct32_16x32_135_quarter_2(const __m256i *in /*in[16]*/,
+ __m256i *out /*out[8]*/) {
+ __m256i u8, u9, u10, u11, u12, u13, u14, u15;
+ __m256i v8, v9, v10, v11, v12, v13, v14, v15;
+
+ {
+ const __m256i stk2_0 = pair256_set_epi16(2 * cospi_30_64, 2 * cospi_30_64);
+ const __m256i stk2_1 = pair256_set_epi16(2 * cospi_2_64, 2 * cospi_2_64);
+ const __m256i stk2_2 =
+ pair256_set_epi16(-2 * cospi_18_64, -2 * cospi_18_64);
+ const __m256i stk2_3 = pair256_set_epi16(2 * cospi_14_64, 2 * cospi_14_64);
+ const __m256i stk2_4 = pair256_set_epi16(2 * cospi_22_64, 2 * cospi_22_64);
+ const __m256i stk2_5 = pair256_set_epi16(2 * cospi_10_64, 2 * cospi_10_64);
+ const __m256i stk2_6 =
+ pair256_set_epi16(-2 * cospi_26_64, -2 * cospi_26_64);
+ const __m256i stk2_7 = pair256_set_epi16(2 * cospi_6_64, 2 * cospi_6_64);
+ u8 = _mm256_mulhrs_epi16(in[2], stk2_0);
+ u15 = _mm256_mulhrs_epi16(in[2], stk2_1);
+ u9 = _mm256_mulhrs_epi16(in[14], stk2_2);
+ u14 = _mm256_mulhrs_epi16(in[14], stk2_3);
+ u10 = _mm256_mulhrs_epi16(in[10], stk2_4);
+ u13 = _mm256_mulhrs_epi16(in[10], stk2_5);
+ u11 = _mm256_mulhrs_epi16(in[6], stk2_6);
+ u12 = _mm256_mulhrs_epi16(in[6], stk2_7);
+ }
+
+ v8 = _mm256_add_epi16(u8, u9);
+ v9 = _mm256_sub_epi16(u8, u9);
+ v10 = _mm256_sub_epi16(u11, u10);
+ v11 = _mm256_add_epi16(u11, u10);
+ v12 = _mm256_add_epi16(u12, u13);
+ v13 = _mm256_sub_epi16(u12, u13);
+ v14 = _mm256_sub_epi16(u15, u14);
+ v15 = _mm256_add_epi16(u15, u14);
+
+ {
+ const __m256i stg4_4 = pair256_set_epi16(-cospi_8_64, cospi_24_64);
+ const __m256i stg4_5 = pair256_set_epi16(cospi_24_64, cospi_8_64);
+ const __m256i stg4_6 = pair256_set_epi16(-cospi_24_64, -cospi_8_64);
+ butterfly_self(&v9, &v14, &stg4_4, &stg4_5);
+ butterfly_self(&v10, &v13, &stg4_6, &stg4_4);
+ }
+
+ out[0] = _mm256_add_epi16(v8, v11);
+ out[1] = _mm256_add_epi16(v9, v10);
+ out[2] = _mm256_sub_epi16(v9, v10);
+ out[3] = _mm256_sub_epi16(v8, v11);
+ out[4] = _mm256_sub_epi16(v15, v12);
+ out[5] = _mm256_sub_epi16(v14, v13);
+ out[6] = _mm256_add_epi16(v14, v13);
+ out[7] = _mm256_add_epi16(v15, v12);
+
+ {
+ const __m256i stg4_0 = pair256_set_epi16(cospi_16_64, cospi_16_64);
+ const __m256i stg6_0 = pair256_set_epi16(-cospi_16_64, cospi_16_64);
+ butterfly_self(&out[2], &out[5], &stg6_0, &stg4_0);
+ butterfly_self(&out[3], &out[4], &stg6_0, &stg4_0);
+ }
+}
+
+// 8x32 block even indexed 8 inputs of in[16],
+// output first half 16 to out[32]
+static void idct32_16x32_quarter_1_2(const __m256i *in /*in[16]*/,
+ __m256i *out /*out[32]*/) {
+ __m256i temp[16];
+ idct32_16x32_135_quarter_1(in, temp);
+ idct32_16x32_135_quarter_2(in, &temp[8]);
+ add_sub_butterfly(temp, out, 16);
+}
+
+// 8x32 block odd indexed 8 inputs of in[16],
+// output second half 16 to out[32]
+static void idct32_16x32_quarter_3_4(const __m256i *in /*in[16]*/,
+ __m256i *out /*out[32]*/) {
+ __m256i v16, v17, v18, v19, v20, v21, v22, v23;
+ __m256i v24, v25, v26, v27, v28, v29, v30, v31;
+ __m256i u16, u17, u18, u19, u20, u21, u22, u23;
+ __m256i u24, u25, u26, u27, u28, u29, u30, u31;
+
+ {
+ const __m256i stk1_0 = pair256_set_epi16(2 * cospi_31_64, 2 * cospi_31_64);
+ const __m256i stk1_1 = pair256_set_epi16(2 * cospi_1_64, 2 * cospi_1_64);
+ const __m256i stk1_2 =
+ pair256_set_epi16(-2 * cospi_17_64, -2 * cospi_17_64);
+ const __m256i stk1_3 = pair256_set_epi16(2 * cospi_15_64, 2 * cospi_15_64);
+
+ const __m256i stk1_4 = pair256_set_epi16(2 * cospi_23_64, 2 * cospi_23_64);
+ const __m256i stk1_5 = pair256_set_epi16(2 * cospi_9_64, 2 * cospi_9_64);
+ const __m256i stk1_6 =
+ pair256_set_epi16(-2 * cospi_25_64, -2 * cospi_25_64);
+ const __m256i stk1_7 = pair256_set_epi16(2 * cospi_7_64, 2 * cospi_7_64);
+ const __m256i stk1_8 = pair256_set_epi16(2 * cospi_27_64, 2 * cospi_27_64);
+ const __m256i stk1_9 = pair256_set_epi16(2 * cospi_5_64, 2 * cospi_5_64);
+ const __m256i stk1_10 =
+ pair256_set_epi16(-2 * cospi_21_64, -2 * cospi_21_64);
+ const __m256i stk1_11 = pair256_set_epi16(2 * cospi_11_64, 2 * cospi_11_64);
+
+ const __m256i stk1_12 = pair256_set_epi16(2 * cospi_19_64, 2 * cospi_19_64);
+ const __m256i stk1_13 = pair256_set_epi16(2 * cospi_13_64, 2 * cospi_13_64);
+ const __m256i stk1_14 =
+ pair256_set_epi16(-2 * cospi_29_64, -2 * cospi_29_64);
+ const __m256i stk1_15 = pair256_set_epi16(2 * cospi_3_64, 2 * cospi_3_64);
+ u16 = _mm256_mulhrs_epi16(in[1], stk1_0);
+ u31 = _mm256_mulhrs_epi16(in[1], stk1_1);
+ u17 = _mm256_mulhrs_epi16(in[15], stk1_2);
+ u30 = _mm256_mulhrs_epi16(in[15], stk1_3);
+
+ u18 = _mm256_mulhrs_epi16(in[9], stk1_4);
+ u29 = _mm256_mulhrs_epi16(in[9], stk1_5);
+ u19 = _mm256_mulhrs_epi16(in[7], stk1_6);
+ u28 = _mm256_mulhrs_epi16(in[7], stk1_7);
+
+ u20 = _mm256_mulhrs_epi16(in[5], stk1_8);
+ u27 = _mm256_mulhrs_epi16(in[5], stk1_9);
+ u21 = _mm256_mulhrs_epi16(in[11], stk1_10);
+ u26 = _mm256_mulhrs_epi16(in[11], stk1_11);
+
+ u22 = _mm256_mulhrs_epi16(in[13], stk1_12);
+ u25 = _mm256_mulhrs_epi16(in[13], stk1_13);
+ u23 = _mm256_mulhrs_epi16(in[3], stk1_14);
+ u24 = _mm256_mulhrs_epi16(in[3], stk1_15);
+ }
+
+ v16 = _mm256_add_epi16(u16, u17);
+ v17 = _mm256_sub_epi16(u16, u17);
+ v18 = _mm256_sub_epi16(u19, u18);
+ v19 = _mm256_add_epi16(u19, u18);
+
+ v20 = _mm256_add_epi16(u20, u21);
+ v21 = _mm256_sub_epi16(u20, u21);
+ v22 = _mm256_sub_epi16(u23, u22);
+ v23 = _mm256_add_epi16(u23, u22);
+
+ v24 = _mm256_add_epi16(u24, u25);
+ v25 = _mm256_sub_epi16(u24, u25);
+ v26 = _mm256_sub_epi16(u27, u26);
+ v27 = _mm256_add_epi16(u27, u26);
+
+ v28 = _mm256_add_epi16(u28, u29);
+ v29 = _mm256_sub_epi16(u28, u29);
+ v30 = _mm256_sub_epi16(u31, u30);
+ v31 = _mm256_add_epi16(u31, u30);
+
+ {
+ const __m256i stg3_4 = pair256_set_epi16(-cospi_4_64, cospi_28_64);
+ const __m256i stg3_5 = pair256_set_epi16(cospi_28_64, cospi_4_64);
+ const __m256i stg3_6 = pair256_set_epi16(-cospi_28_64, -cospi_4_64);
+ const __m256i stg3_8 = pair256_set_epi16(-cospi_20_64, cospi_12_64);
+ const __m256i stg3_9 = pair256_set_epi16(cospi_12_64, cospi_20_64);
+ const __m256i stg3_10 = pair256_set_epi16(-cospi_12_64, -cospi_20_64);
+
+ butterfly_self(&v17, &v30, &stg3_4, &stg3_5);
+ butterfly_self(&v18, &v29, &stg3_6, &stg3_4);
+ butterfly_self(&v21, &v26, &stg3_8, &stg3_9);
+ butterfly_self(&v22, &v25, &stg3_10, &stg3_8);
+ }
+
+ u16 = _mm256_add_epi16(v16, v19);
+ u17 = _mm256_add_epi16(v17, v18);
+ u18 = _mm256_sub_epi16(v17, v18);
+ u19 = _mm256_sub_epi16(v16, v19);
+ u20 = _mm256_sub_epi16(v23, v20);
+ u21 = _mm256_sub_epi16(v22, v21);
+ u22 = _mm256_add_epi16(v22, v21);
+ u23 = _mm256_add_epi16(v23, v20);
+
+ u24 = _mm256_add_epi16(v24, v27);
+ u25 = _mm256_add_epi16(v25, v26);
+ u26 = _mm256_sub_epi16(v25, v26);
+ u27 = _mm256_sub_epi16(v24, v27);
+ u28 = _mm256_sub_epi16(v31, v28);
+ u29 = _mm256_sub_epi16(v30, v29);
+ u30 = _mm256_add_epi16(v29, v30);
+ u31 = _mm256_add_epi16(v28, v31);
+
+ {
+ const __m256i stg4_4 = pair256_set_epi16(-cospi_8_64, cospi_24_64);
+ const __m256i stg4_5 = pair256_set_epi16(cospi_24_64, cospi_8_64);
+ const __m256i stg4_6 = pair256_set_epi16(-cospi_24_64, -cospi_8_64);
+ butterfly_self(&u18, &u29, &stg4_4, &stg4_5);
+ butterfly_self(&u19, &u28, &stg4_4, &stg4_5);
+ butterfly_self(&u20, &u27, &stg4_6, &stg4_4);
+ butterfly_self(&u21, &u26, &stg4_6, &stg4_4);
+ }
+
+ out[0] = _mm256_add_epi16(u16, u23);
+ out[1] = _mm256_add_epi16(u17, u22);
+ out[2] = _mm256_add_epi16(u18, u21);
+ out[3] = _mm256_add_epi16(u19, u20);
+ v20 = _mm256_sub_epi16(u19, u20);
+ v21 = _mm256_sub_epi16(u18, u21);
+ v22 = _mm256_sub_epi16(u17, u22);
+ v23 = _mm256_sub_epi16(u16, u23);
+
+ v24 = _mm256_sub_epi16(u31, u24);
+ v25 = _mm256_sub_epi16(u30, u25);
+ v26 = _mm256_sub_epi16(u29, u26);
+ v27 = _mm256_sub_epi16(u28, u27);
+ out[12] = _mm256_add_epi16(u27, u28);
+ out[13] = _mm256_add_epi16(u26, u29);
+ out[14] = _mm256_add_epi16(u25, u30);
+ out[15] = _mm256_add_epi16(u24, u31);
+
+ {
+ const __m256i stg4_0 = pair256_set_epi16(cospi_16_64, cospi_16_64);
+ const __m256i stg6_0 = pair256_set_epi16(-cospi_16_64, cospi_16_64);
+ butterfly(&v20, &v27, &stg6_0, &stg4_0, &out[4], &out[11]);
+ butterfly(&v21, &v26, &stg6_0, &stg4_0, &out[5], &out[10]);
+ butterfly(&v22, &v25, &stg6_0, &stg4_0, &out[6], &out[9]);
+ butterfly(&v23, &v24, &stg6_0, &stg4_0, &out[7], &out[8]);
+ }
+}
+
+// 16x16 block input __m256i in[32], output 16x32 __m256i in[32]
+static void idct32_16x32_135(__m256i *in /*in[32]*/) {
+ __m256i out[32];
+ idct32_16x32_quarter_1_2(in, out);
+ idct32_16x32_quarter_3_4(in, &out[16]);
+ add_sub_butterfly(out, in, 32);
+}
+
+static INLINE void load_buffer_from_32x32(const tran_low_t *coeff, __m256i *in,
+ int size) {
+ int i = 0;
+ while (i < size) {
+ load_coeff(coeff + (i << 5), &in[i]);
+ i += 1;
+ }
+}
+
+static INLINE void zero_buffer(__m256i *in, int num) {
+ int i;
+ for (i = 0; i < num; ++i) {
+ in[i] = _mm256_setzero_si256();
+ }
+}
+
+// Only upper-left 16x16 has non-zero coeff
+void aom_idct32x32_135_add_avx2(const tran_low_t *input, uint8_t *dest,
+ int stride) {
+ __m256i in[32];
+ zero_buffer(in, 32);
+ load_buffer_from_32x32(input, in, 16);
+ mm256_transpose_16x16(in, in);
+ idct32_16x32_135(in);
+
+ __m256i out[32];
+ mm256_transpose_16x16(in, out);
+ idct32_16x32_135(out);
+ store_buffer_16xN(out, stride, dest, 32);
+ mm256_transpose_16x16(&in[16], in);
+ idct32_16x32_135(in);
+ store_buffer_16xN(in, stride, dest + 16, 32);
+}
+
+static void idct32_34_first_half(const __m256i *in, __m256i *stp1) {
+ const __m256i stk2_0 = pair256_set_epi16(2 * cospi_30_64, 2 * cospi_30_64);
+ const __m256i stk2_1 = pair256_set_epi16(2 * cospi_2_64, 2 * cospi_2_64);
+ const __m256i stk2_6 = pair256_set_epi16(-2 * cospi_26_64, -2 * cospi_26_64);
+ const __m256i stk2_7 = pair256_set_epi16(2 * cospi_6_64, 2 * cospi_6_64);
+
+ const __m256i stk3_0 = pair256_set_epi16(2 * cospi_28_64, 2 * cospi_28_64);
+ const __m256i stk3_1 = pair256_set_epi16(2 * cospi_4_64, 2 * cospi_4_64);
+
+ const __m256i stg4_0 = pair256_set_epi16(cospi_16_64, cospi_16_64);
+ const __m256i stk4_0 = pair256_set_epi16(2 * cospi_16_64, 2 * cospi_16_64);
+ const __m256i stg4_1 = pair256_set_epi16(cospi_16_64, -cospi_16_64);
+ const __m256i stg4_4 = pair256_set_epi16(-cospi_8_64, cospi_24_64);
+ const __m256i stg4_5 = pair256_set_epi16(cospi_24_64, cospi_8_64);
+ const __m256i stg4_6 = pair256_set_epi16(-cospi_24_64, -cospi_8_64);
+
+ const __m256i stg6_0 = pair256_set_epi16(-cospi_16_64, cospi_16_64);
+ __m256i u0, u1, u2, u3, u4, u5, u6, u7;
+ __m256i x0, x1, x4, x5, x6, x7;
+ __m256i v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15;
+
+ // phase 1
+
+ // 0, 15
+ u2 = _mm256_mulhrs_epi16(in[2], stk2_1); // stp2_15
+ u3 = _mm256_mulhrs_epi16(in[6], stk2_7); // stp2_12
+ v15 = _mm256_add_epi16(u2, u3);
+ // in[0], in[4]
+ x0 = _mm256_mulhrs_epi16(in[0], stk4_0); // stp1[0]
+ x7 = _mm256_mulhrs_epi16(in[4], stk3_1); // stp1[7]
+ v0 = _mm256_add_epi16(x0, x7); // stp2_0
+ stp1[0] = _mm256_add_epi16(v0, v15);
+ stp1[15] = _mm256_sub_epi16(v0, v15);
+
+ // in[2], in[6]
+ u0 = _mm256_mulhrs_epi16(in[2], stk2_0); // stp2_8
+ u1 = _mm256_mulhrs_epi16(in[6], stk2_6); // stp2_11
+ butterfly(&u0, &u2, &stg4_4, &stg4_5, &u4, &u5); // stp2_9, stp2_14
+ butterfly(&u1, &u3, &stg4_6, &stg4_4, &u6, &u7); // stp2_10, stp2_13
+
+ v8 = _mm256_add_epi16(u0, u1);
+ v9 = _mm256_add_epi16(u4, u6);
+ v10 = _mm256_sub_epi16(u4, u6);
+ v11 = _mm256_sub_epi16(u0, u1);
+ v12 = _mm256_sub_epi16(u2, u3);
+ v13 = _mm256_sub_epi16(u5, u7);
+ v14 = _mm256_add_epi16(u5, u7);
+
+ butterfly_self(&v10, &v13, &stg6_0, &stg4_0);
+ butterfly_self(&v11, &v12, &stg6_0, &stg4_0);
+
+ // 1, 14
+ x1 = _mm256_mulhrs_epi16(in[0], stk4_0); // stp1[1], stk4_1 = stk4_0
+ // stp1[2] = stp1[0], stp1[3] = stp1[1]
+ x4 = _mm256_mulhrs_epi16(in[4], stk3_0); // stp1[4]
+ butterfly(&x7, &x4, &stg4_1, &stg4_0, &x5, &x6);
+ v1 = _mm256_add_epi16(x1, x6); // stp2_1
+ v2 = _mm256_add_epi16(x0, x5); // stp2_2
+ stp1[1] = _mm256_add_epi16(v1, v14);
+ stp1[14] = _mm256_sub_epi16(v1, v14);
+
+ stp1[2] = _mm256_add_epi16(v2, v13);
+ stp1[13] = _mm256_sub_epi16(v2, v13);
+
+ v3 = _mm256_add_epi16(x1, x4); // stp2_3
+ v4 = _mm256_sub_epi16(x1, x4); // stp2_4
+
+ v5 = _mm256_sub_epi16(x0, x5); // stp2_5
+
+ v6 = _mm256_sub_epi16(x1, x6); // stp2_6
+ v7 = _mm256_sub_epi16(x0, x7); // stp2_7
+ stp1[3] = _mm256_add_epi16(v3, v12);
+ stp1[12] = _mm256_sub_epi16(v3, v12);
+
+ stp1[6] = _mm256_add_epi16(v6, v9);
+ stp1[9] = _mm256_sub_epi16(v6, v9);
+
+ stp1[7] = _mm256_add_epi16(v7, v8);
+ stp1[8] = _mm256_sub_epi16(v7, v8);
+
+ stp1[4] = _mm256_add_epi16(v4, v11);
+ stp1[11] = _mm256_sub_epi16(v4, v11);
+
+ stp1[5] = _mm256_add_epi16(v5, v10);
+ stp1[10] = _mm256_sub_epi16(v5, v10);
+}
+
+static void idct32_34_second_half(const __m256i *in, __m256i *stp1) {
+ const __m256i stk1_0 = pair256_set_epi16(2 * cospi_31_64, 2 * cospi_31_64);
+ const __m256i stk1_1 = pair256_set_epi16(2 * cospi_1_64, 2 * cospi_1_64);
+ const __m256i stk1_6 = pair256_set_epi16(-2 * cospi_25_64, -2 * cospi_25_64);
+ const __m256i stk1_7 = pair256_set_epi16(2 * cospi_7_64, 2 * cospi_7_64);
+ const __m256i stk1_8 = pair256_set_epi16(2 * cospi_27_64, 2 * cospi_27_64);
+ const __m256i stk1_9 = pair256_set_epi16(2 * cospi_5_64, 2 * cospi_5_64);
+ const __m256i stk1_14 = pair256_set_epi16(-2 * cospi_29_64, -2 * cospi_29_64);
+ const __m256i stk1_15 = pair256_set_epi16(2 * cospi_3_64, 2 * cospi_3_64);
+ const __m256i stg3_4 = pair256_set_epi16(-cospi_4_64, cospi_28_64);
+ const __m256i stg3_5 = pair256_set_epi16(cospi_28_64, cospi_4_64);
+ const __m256i stg3_6 = pair256_set_epi16(-cospi_28_64, -cospi_4_64);
+ const __m256i stg3_8 = pair256_set_epi16(-cospi_20_64, cospi_12_64);
+ const __m256i stg3_9 = pair256_set_epi16(cospi_12_64, cospi_20_64);
+ const __m256i stg3_10 = pair256_set_epi16(-cospi_12_64, -cospi_20_64);
+
+ const __m256i stg4_0 = pair256_set_epi16(cospi_16_64, cospi_16_64);
+ const __m256i stg4_4 = pair256_set_epi16(-cospi_8_64, cospi_24_64);
+ const __m256i stg4_5 = pair256_set_epi16(cospi_24_64, cospi_8_64);
+ const __m256i stg4_6 = pair256_set_epi16(-cospi_24_64, -cospi_8_64);
+
+ const __m256i stg6_0 = pair256_set_epi16(-cospi_16_64, cospi_16_64);
+ __m256i v16, v17, v18, v19, v20, v21, v22, v23;
+ __m256i v24, v25, v26, v27, v28, v29, v30, v31;
+ __m256i u16, u17, u18, u19, u20, u21, u22, u23;
+ __m256i u24, u25, u26, u27, u28, u29, u30, u31;
+
+ v16 = _mm256_mulhrs_epi16(in[1], stk1_0);
+ v31 = _mm256_mulhrs_epi16(in[1], stk1_1);
+
+ v19 = _mm256_mulhrs_epi16(in[7], stk1_6);
+ v28 = _mm256_mulhrs_epi16(in[7], stk1_7);
+
+ v20 = _mm256_mulhrs_epi16(in[5], stk1_8);
+ v27 = _mm256_mulhrs_epi16(in[5], stk1_9);
+
+ v23 = _mm256_mulhrs_epi16(in[3], stk1_14);
+ v24 = _mm256_mulhrs_epi16(in[3], stk1_15);
+
+ butterfly(&v16, &v31, &stg3_4, &stg3_5, &v17, &v30);
+ butterfly(&v19, &v28, &stg3_6, &stg3_4, &v18, &v29);
+ butterfly(&v20, &v27, &stg3_8, &stg3_9, &v21, &v26);
+ butterfly(&v23, &v24, &stg3_10, &stg3_8, &v22, &v25);
+
+ u16 = _mm256_add_epi16(v16, v19);
+ u17 = _mm256_add_epi16(v17, v18);
+ u18 = _mm256_sub_epi16(v17, v18);
+ u19 = _mm256_sub_epi16(v16, v19);
+ u20 = _mm256_sub_epi16(v23, v20);
+ u21 = _mm256_sub_epi16(v22, v21);
+ u22 = _mm256_add_epi16(v22, v21);
+ u23 = _mm256_add_epi16(v23, v20);
+ u24 = _mm256_add_epi16(v24, v27);
+ u27 = _mm256_sub_epi16(v24, v27);
+ u25 = _mm256_add_epi16(v25, v26);
+ u26 = _mm256_sub_epi16(v25, v26);
+ u28 = _mm256_sub_epi16(v31, v28);
+ u31 = _mm256_add_epi16(v28, v31);
+ u29 = _mm256_sub_epi16(v30, v29);
+ u30 = _mm256_add_epi16(v29, v30);
+
+ butterfly_self(&u18, &u29, &stg4_4, &stg4_5);
+ butterfly_self(&u19, &u28, &stg4_4, &stg4_5);
+ butterfly_self(&u20, &u27, &stg4_6, &stg4_4);
+ butterfly_self(&u21, &u26, &stg4_6, &stg4_4);
+
+ stp1[0] = _mm256_add_epi16(u16, u23);
+ stp1[7] = _mm256_sub_epi16(u16, u23);
+
+ stp1[1] = _mm256_add_epi16(u17, u22);
+ stp1[6] = _mm256_sub_epi16(u17, u22);
+
+ stp1[2] = _mm256_add_epi16(u18, u21);
+ stp1[5] = _mm256_sub_epi16(u18, u21);
+
+ stp1[3] = _mm256_add_epi16(u19, u20);
+ stp1[4] = _mm256_sub_epi16(u19, u20);
+
+ stp1[8] = _mm256_sub_epi16(u31, u24);
+ stp1[15] = _mm256_add_epi16(u24, u31);
+
+ stp1[9] = _mm256_sub_epi16(u30, u25);
+ stp1[14] = _mm256_add_epi16(u25, u30);
+
+ stp1[10] = _mm256_sub_epi16(u29, u26);
+ stp1[13] = _mm256_add_epi16(u26, u29);
+
+ stp1[11] = _mm256_sub_epi16(u28, u27);
+ stp1[12] = _mm256_add_epi16(u27, u28);
+
+ butterfly_self(&stp1[4], &stp1[11], &stg6_0, &stg4_0);
+ butterfly_self(&stp1[5], &stp1[10], &stg6_0, &stg4_0);
+ butterfly_self(&stp1[6], &stp1[9], &stg6_0, &stg4_0);
+ butterfly_self(&stp1[7], &stp1[8], &stg6_0, &stg4_0);
+}
+
+// 16x16 block input __m256i in[32], output 16x32 __m256i in[32]
+static void idct32_16x32_34(__m256i *in /*in[32]*/) {
+ __m256i out[32];
+ idct32_34_first_half(in, out);
+ idct32_34_second_half(in, &out[16]);
+ add_sub_butterfly(out, in, 32);
+}
+
+// Only upper-left 8x8 has non-zero coeff
+void aom_idct32x32_34_add_avx2(const tran_low_t *input, uint8_t *dest,
+ int stride) {
+ __m256i in[32];
+ zero_buffer(in, 32);
+ load_buffer_from_32x32(input, in, 8);
+ mm256_transpose_16x16(in, in);
+ idct32_16x32_34(in);
+
+ __m256i out[32];
+ mm256_transpose_16x16(in, out);
+ idct32_16x32_34(out);
+ store_buffer_16xN(out, stride, dest, 32);
+ mm256_transpose_16x16(&in[16], in);
+ idct32_16x32_34(in);
+ store_buffer_16xN(in, stride, dest + 16, 32);
+}
diff --git a/third_party/aom/aom_dsp/x86/inv_txfm_common_avx2.h b/third_party/aom/aom_dsp/x86/inv_txfm_common_avx2.h
new file mode 100644
index 000000000..4238e651b
--- /dev/null
+++ b/third_party/aom/aom_dsp/x86/inv_txfm_common_avx2.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2017, Alliance for Open Media. All rights reserved
+ *
+ * This source code is subject to the terms of the BSD 2 Clause License and
+ * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
+ * was not distributed with this source code in the LICENSE file, you can
+ * obtain it at www.aomedia.org/license/software. If the Alliance for Open
+ * Media Patent License 1.0 was not distributed with this source code in the
+ * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
+ */
+
+#ifndef AOM_DSP_X86_INV_TXFM_COMMON_AVX2_H
+#define AOM_DSP_X86_INV_TXFM_COMMON_AVX2_H
+
+#include <immintrin.h>
+
+#include "aom_dsp/txfm_common.h"
+#include "aom_dsp/x86/txfm_common_avx2.h"
+
+static INLINE void load_coeff(const tran_low_t *coeff, __m256i *in) {
+#if CONFIG_HIGHBITDEPTH
+ *in = _mm256_setr_epi16(
+ (int16_t)coeff[0], (int16_t)coeff[1], (int16_t)coeff[2],
+ (int16_t)coeff[3], (int16_t)coeff[4], (int16_t)coeff[5],
+ (int16_t)coeff[6], (int16_t)coeff[7], (int16_t)coeff[8],
+ (int16_t)coeff[9], (int16_t)coeff[10], (int16_t)coeff[11],
+ (int16_t)coeff[12], (int16_t)coeff[13], (int16_t)coeff[14],
+ (int16_t)coeff[15]);
+#else
+ *in = _mm256_loadu_si256((const __m256i *)coeff);
+#endif
+}
+
+static INLINE void load_buffer_16x16(const tran_low_t *coeff, __m256i *in) {
+ int i = 0;
+ while (i < 16) {
+ load_coeff(coeff + (i << 4), &in[i]);
+ i += 1;
+ }
+}
+
+static INLINE void recon_and_store(const __m256i *res, uint8_t *output) {
+ const __m128i zero = _mm_setzero_si128();
+ __m128i x = _mm_loadu_si128((__m128i const *)output);
+ __m128i p0 = _mm_unpacklo_epi8(x, zero);
+ __m128i p1 = _mm_unpackhi_epi8(x, zero);
+
+ p0 = _mm_add_epi16(p0, _mm256_castsi256_si128(*res));
+ p1 = _mm_add_epi16(p1, _mm256_extractf128_si256(*res, 1));
+ x = _mm_packus_epi16(p0, p1);
+ _mm_storeu_si128((__m128i *)output, x);
+}
+
+#define IDCT_ROUNDING_POS (6)
+static INLINE void store_buffer_16xN(__m256i *in, const int stride,
+ uint8_t *output, int num) {
+ const __m256i rounding = _mm256_set1_epi16(1 << (IDCT_ROUNDING_POS - 1));
+ int i = 0;
+
+ while (i < num) {
+ in[i] = _mm256_adds_epi16(in[i], rounding);
+ in[i] = _mm256_srai_epi16(in[i], IDCT_ROUNDING_POS);
+ recon_and_store(&in[i], output + i * stride);
+ i += 1;
+ }
+}
+
+static INLINE void unpack_butter_fly(const __m256i *a0, const __m256i *a1,
+ const __m256i *c0, const __m256i *c1,
+ __m256i *b0, __m256i *b1) {
+ __m256i x0, x1;
+ x0 = _mm256_unpacklo_epi16(*a0, *a1);
+ x1 = _mm256_unpackhi_epi16(*a0, *a1);
+ *b0 = butter_fly(&x0, &x1, c0);
+ *b1 = butter_fly(&x0, &x1, c1);
+}
+
+void av1_idct16_avx2(__m256i *in);
+
+#endif // AOM_DSP_X86_INV_TXFM_COMMON_AVX2_H
diff --git a/third_party/aom/aom_dsp/x86/inv_txfm_sse2.c b/third_party/aom/aom_dsp/x86/inv_txfm_sse2.c
index 5795a1845..be200df4c 100644
--- a/third_party/aom/aom_dsp/x86/inv_txfm_sse2.c
+++ b/third_party/aom/aom_dsp/x86/inv_txfm_sse2.c
@@ -3628,4 +3628,107 @@ void aom_highbd_idct4x4_16_add_sse2(const tran_low_t *input, uint8_t *dest8,
}
}
+void aom_highbd_idct8x8_10_add_sse2(const tran_low_t *input, uint8_t *dest8,
+ int stride, int bd) {
+ tran_low_t out[8 * 8] = { 0 };
+ tran_low_t *outptr = out;
+ int i, j, test;
+ __m128i inptr[8];
+ __m128i min_input, max_input, temp1, temp2, sign_bits;
+ uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
+ const __m128i zero = _mm_set1_epi16(0);
+ const __m128i sixteen = _mm_set1_epi16(16);
+ const __m128i max = _mm_set1_epi16(6201);
+ const __m128i min = _mm_set1_epi16(-6201);
+ int optimised_cols = 0;
+
+ // Load input into __m128i & pack to 16 bits
+ for (i = 0; i < 8; i++) {
+ temp1 = _mm_loadu_si128((const __m128i *)(input + 8 * i));
+ temp2 = _mm_loadu_si128((const __m128i *)(input + 8 * i + 4));
+ inptr[i] = _mm_packs_epi32(temp1, temp2);
+ }
+
+ // Find the min & max for the row transform
+ // only first 4 row has non-zero coefs
+ max_input = _mm_max_epi16(inptr[0], inptr[1]);
+ min_input = _mm_min_epi16(inptr[0], inptr[1]);
+ for (i = 2; i < 4; i++) {
+ max_input = _mm_max_epi16(max_input, inptr[i]);
+ min_input = _mm_min_epi16(min_input, inptr[i]);
+ }
+ max_input = _mm_cmpgt_epi16(max_input, max);
+ min_input = _mm_cmplt_epi16(min_input, min);
+ temp1 = _mm_or_si128(max_input, min_input);
+ test = _mm_movemask_epi8(temp1);
+
+ if (!test) {
+ // Do the row transform
+ aom_idct8_sse2(inptr);
+
+ // Find the min & max for the column transform
+ // N.B. Only first 4 cols contain non-zero coeffs
+ max_input = _mm_max_epi16(inptr[0], inptr[1]);
+ min_input = _mm_min_epi16(inptr[0], inptr[1]);
+ for (i = 2; i < 8; i++) {
+ max_input = _mm_max_epi16(max_input, inptr[i]);
+ min_input = _mm_min_epi16(min_input, inptr[i]);
+ }
+ max_input = _mm_cmpgt_epi16(max_input, max);
+ min_input = _mm_cmplt_epi16(min_input, min);
+ temp1 = _mm_or_si128(max_input, min_input);
+ test = _mm_movemask_epi8(temp1);
+
+ if (test) {
+ // Use fact only first 4 rows contain non-zero coeffs
+ array_transpose_4X8(inptr, inptr);
+ for (i = 0; i < 4; i++) {
+ sign_bits = _mm_cmplt_epi16(inptr[i], zero);
+ temp1 = _mm_unpackhi_epi16(inptr[i], sign_bits);
+ temp2 = _mm_unpacklo_epi16(inptr[i], sign_bits);
+ _mm_storeu_si128((__m128i *)(outptr + 4 * (2 * i + 1)), temp1);
+ _mm_storeu_si128((__m128i *)(outptr + 4 * (2 * i)), temp2);
+ }
+ } else {
+ // Set to use the optimised transform for the column
+ optimised_cols = 1;
+ }
+ } else {
+ // Run the un-optimised row transform
+ for (i = 0; i < 4; ++i) {
+ aom_highbd_idct8_c(input, outptr, bd);
+ input += 8;
+ outptr += 8;
+ }
+ }
+
+ if (optimised_cols) {
+ aom_idct8_sse2(inptr);
+
+ // Final round & shift and Reconstruction and Store
+ {
+ __m128i d[8];
+ for (i = 0; i < 8; i++) {
+ inptr[i] = _mm_add_epi16(inptr[i], sixteen);
+ d[i] = _mm_loadu_si128((const __m128i *)(dest + stride * i));
+ inptr[i] = _mm_srai_epi16(inptr[i], 5);
+ d[i] = clamp_high_sse2(_mm_adds_epi16(d[i], inptr[i]), bd);
+ // Store
+ _mm_storeu_si128((__m128i *)(dest + stride * i), d[i]);
+ }
+ }
+ } else {
+ // Run the un-optimised column transform
+ tran_low_t temp_in[8], temp_out[8];
+ for (i = 0; i < 8; ++i) {
+ for (j = 0; j < 8; ++j) temp_in[j] = out[j * 8 + i];
+ aom_highbd_idct8_c(temp_in, temp_out, bd);
+ for (j = 0; j < 8; ++j) {
+ dest[j * stride + i] = highbd_clip_pixel_add(
+ dest[j * stride + i], ROUND_POWER_OF_TWO(temp_out[j], 5), bd);
+ }
+ }
+ }
+}
+
#endif // CONFIG_HIGHBITDEPTH
diff --git a/third_party/aom/aom_dsp/x86/masked_sad_intrin_ssse3.c b/third_party/aom/aom_dsp/x86/masked_sad_intrin_ssse3.c
index 5166e9e0a..9d16a3e84 100644
--- a/third_party/aom/aom_dsp/x86/masked_sad_intrin_ssse3.c
+++ b/third_party/aom/aom_dsp/x86/masked_sad_intrin_ssse3.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved
+ * Copyright (c) 2017, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@@ -9,49 +9,70 @@
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
-#include <stdlib.h>
-#include <emmintrin.h>
+#include <stdio.h>
#include <tmmintrin.h>
-#include "aom_ports/mem.h"
#include "./aom_config.h"
+#include "./aom_dsp_rtcd.h"
+#include "aom_dsp/blend.h"
#include "aom/aom_integer.h"
+#include "aom_dsp/x86/synonyms.h"
-static INLINE __m128i width8_load_2rows(const uint8_t *ptr, int stride) {
- __m128i temp1 = _mm_loadl_epi64((const __m128i *)ptr);
- __m128i temp2 = _mm_loadl_epi64((const __m128i *)(ptr + stride));
- return _mm_unpacklo_epi64(temp1, temp2);
-}
-
-static INLINE __m128i width4_load_4rows(const uint8_t *ptr, int stride) {
- __m128i temp1 = _mm_cvtsi32_si128(*(const uint32_t *)ptr);
- __m128i temp2 = _mm_cvtsi32_si128(*(const uint32_t *)(ptr + stride));
- __m128i temp3 = _mm_unpacklo_epi32(temp1, temp2);
- temp1 = _mm_cvtsi32_si128(*(const uint32_t *)(ptr + stride * 2));
- temp2 = _mm_cvtsi32_si128(*(const uint32_t *)(ptr + stride * 3));
- temp1 = _mm_unpacklo_epi32(temp1, temp2);
- return _mm_unpacklo_epi64(temp3, temp1);
-}
-
-static INLINE unsigned int masked_sad_ssse3(const uint8_t *a_ptr, int a_stride,
+// For width a multiple of 16
+static INLINE unsigned int masked_sad_ssse3(const uint8_t *src_ptr,
+ int src_stride,
+ const uint8_t *a_ptr, int a_stride,
const uint8_t *b_ptr, int b_stride,
const uint8_t *m_ptr, int m_stride,
int width, int height);
static INLINE unsigned int masked_sad8xh_ssse3(
- const uint8_t *a_ptr, int a_stride, const uint8_t *b_ptr, int b_stride,
- const uint8_t *m_ptr, int m_stride, int height);
+ const uint8_t *src_ptr, int src_stride, const uint8_t *a_ptr, int a_stride,
+ const uint8_t *b_ptr, int b_stride, const uint8_t *m_ptr, int m_stride,
+ int height);
static INLINE unsigned int masked_sad4xh_ssse3(
- const uint8_t *a_ptr, int a_stride, const uint8_t *b_ptr, int b_stride,
- const uint8_t *m_ptr, int m_stride, int height);
-
-#define MASKSADMXN_SSSE3(m, n) \
- unsigned int aom_masked_sad##m##x##n##_ssse3( \
- const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride, \
- const uint8_t *msk, int msk_stride) { \
- return masked_sad_ssse3(src, src_stride, ref, ref_stride, msk, msk_stride, \
- m, n); \
+ const uint8_t *src_ptr, int src_stride, const uint8_t *a_ptr, int a_stride,
+ const uint8_t *b_ptr, int b_stride, const uint8_t *m_ptr, int m_stride,
+ int height);
+
+#define MASKSADMXN_SSSE3(m, n) \
+ unsigned int aom_masked_sad##m##x##n##_ssse3( \
+ const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride, \
+ const uint8_t *second_pred, const uint8_t *msk, int msk_stride, \
+ int invert_mask) { \
+ if (!invert_mask) \
+ return masked_sad_ssse3(src, src_stride, ref, ref_stride, second_pred, \
+ m, msk, msk_stride, m, n); \
+ else \
+ return masked_sad_ssse3(src, src_stride, second_pred, m, ref, \
+ ref_stride, msk, msk_stride, m, n); \
+ }
+
+#define MASKSAD8XN_SSSE3(n) \
+ unsigned int aom_masked_sad8x##n##_ssse3( \
+ const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride, \
+ const uint8_t *second_pred, const uint8_t *msk, int msk_stride, \
+ int invert_mask) { \
+ if (!invert_mask) \
+ return masked_sad8xh_ssse3(src, src_stride, ref, ref_stride, \
+ second_pred, 8, msk, msk_stride, n); \
+ else \
+ return masked_sad8xh_ssse3(src, src_stride, second_pred, 8, ref, \
+ ref_stride, msk, msk_stride, n); \
+ }
+
+#define MASKSAD4XN_SSSE3(n) \
+ unsigned int aom_masked_sad4x##n##_ssse3( \
+ const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride, \
+ const uint8_t *second_pred, const uint8_t *msk, int msk_stride, \
+ int invert_mask) { \
+ if (!invert_mask) \
+ return masked_sad4xh_ssse3(src, src_stride, ref, ref_stride, \
+ second_pred, 4, msk, msk_stride, n); \
+ else \
+ return masked_sad4xh_ssse3(src, src_stride, second_pred, 4, ref, \
+ ref_stride, msk, msk_stride, n); \
}
#if CONFIG_EXT_PARTITION
@@ -67,165 +88,181 @@ MASKSADMXN_SSSE3(32, 16)
MASKSADMXN_SSSE3(16, 32)
MASKSADMXN_SSSE3(16, 16)
MASKSADMXN_SSSE3(16, 8)
-
-#define MASKSAD8XN_SSSE3(n) \
- unsigned int aom_masked_sad8x##n##_ssse3( \
- const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride, \
- const uint8_t *msk, int msk_stride) { \
- return masked_sad8xh_ssse3(src, src_stride, ref, ref_stride, msk, \
- msk_stride, n); \
- }
-
MASKSAD8XN_SSSE3(16)
MASKSAD8XN_SSSE3(8)
MASKSAD8XN_SSSE3(4)
-
-#define MASKSAD4XN_SSSE3(n) \
- unsigned int aom_masked_sad4x##n##_ssse3( \
- const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride, \
- const uint8_t *msk, int msk_stride) { \
- return masked_sad4xh_ssse3(src, src_stride, ref, ref_stride, msk, \
- msk_stride, n); \
- }
-
MASKSAD4XN_SSSE3(8)
MASKSAD4XN_SSSE3(4)
-// For width a multiple of 16
-// Assumes values in m are <=64
-static INLINE unsigned int masked_sad_ssse3(const uint8_t *a_ptr, int a_stride,
+static INLINE unsigned int masked_sad_ssse3(const uint8_t *src_ptr,
+ int src_stride,
+ const uint8_t *a_ptr, int a_stride,
const uint8_t *b_ptr, int b_stride,
const uint8_t *m_ptr, int m_stride,
int width, int height) {
- int y, x;
- __m128i a, b, m, temp1, temp2;
+ int x, y;
__m128i res = _mm_setzero_si128();
- __m128i one = _mm_set1_epi16(1);
- // For each row
+ const __m128i mask_max = _mm_set1_epi8((1 << AOM_BLEND_A64_ROUND_BITS));
+
for (y = 0; y < height; y++) {
- // Covering the full width
for (x = 0; x < width; x += 16) {
- // Load a, b, m in xmm registers
- a = _mm_loadu_si128((const __m128i *)(a_ptr + x));
- b = _mm_loadu_si128((const __m128i *)(b_ptr + x));
- m = _mm_loadu_si128((const __m128i *)(m_ptr + x));
-
- // Calculate the difference between a & b
- temp1 = _mm_subs_epu8(a, b);
- temp2 = _mm_subs_epu8(b, a);
- temp1 = _mm_or_si128(temp1, temp2);
-
- // Multiply by m and add together
- temp2 = _mm_maddubs_epi16(temp1, m);
- // Pad out row result to 32 bit integers & add to running total
- res = _mm_add_epi32(res, _mm_madd_epi16(temp2, one));
+ const __m128i src = _mm_loadu_si128((const __m128i *)&src_ptr[x]);
+ const __m128i a = _mm_loadu_si128((const __m128i *)&a_ptr[x]);
+ const __m128i b = _mm_loadu_si128((const __m128i *)&b_ptr[x]);
+ const __m128i m = _mm_loadu_si128((const __m128i *)&m_ptr[x]);
+ const __m128i m_inv = _mm_sub_epi8(mask_max, m);
+
+ // Calculate 16 predicted pixels.
+ // Note that the maximum value of any entry of 'pred_l' or 'pred_r'
+ // is 64 * 255, so we have plenty of space to add rounding constants.
+ const __m128i data_l = _mm_unpacklo_epi8(a, b);
+ const __m128i mask_l = _mm_unpacklo_epi8(m, m_inv);
+ __m128i pred_l = _mm_maddubs_epi16(data_l, mask_l);
+ pred_l = xx_roundn_epu16(pred_l, AOM_BLEND_A64_ROUND_BITS);
+
+ const __m128i data_r = _mm_unpackhi_epi8(a, b);
+ const __m128i mask_r = _mm_unpackhi_epi8(m, m_inv);
+ __m128i pred_r = _mm_maddubs_epi16(data_r, mask_r);
+ pred_r = xx_roundn_epu16(pred_r, AOM_BLEND_A64_ROUND_BITS);
+
+ const __m128i pred = _mm_packus_epi16(pred_l, pred_r);
+ res = _mm_add_epi32(res, _mm_sad_epu8(pred, src));
}
- // Move onto the next row
+
+ src_ptr += src_stride;
a_ptr += a_stride;
b_ptr += b_stride;
m_ptr += m_stride;
}
- res = _mm_hadd_epi32(res, _mm_setzero_si128());
- res = _mm_hadd_epi32(res, _mm_setzero_si128());
- // sad = (sad + 31) >> 6;
- return (_mm_cvtsi128_si32(res) + 31) >> 6;
+ // At this point, we have two 32-bit partial SADs in lanes 0 and 2 of 'res'.
+ int32_t sad =
+ _mm_cvtsi128_si32(res) + _mm_cvtsi128_si32(_mm_srli_si128(res, 8));
+ return (sad + 31) >> 6;
}
static INLINE unsigned int masked_sad8xh_ssse3(
- const uint8_t *a_ptr, int a_stride, const uint8_t *b_ptr, int b_stride,
- const uint8_t *m_ptr, int m_stride, int height) {
+ const uint8_t *src_ptr, int src_stride, const uint8_t *a_ptr, int a_stride,
+ const uint8_t *b_ptr, int b_stride, const uint8_t *m_ptr, int m_stride,
+ int height) {
int y;
- __m128i a, b, m, temp1, temp2, row_res;
__m128i res = _mm_setzero_si128();
- __m128i one = _mm_set1_epi16(1);
- // Add the masked SAD for 2 rows at a time
- for (y = 0; y < height; y += 2) {
- // Load a, b, m in xmm registers
- a = width8_load_2rows(a_ptr, a_stride);
- b = width8_load_2rows(b_ptr, b_stride);
- m = width8_load_2rows(m_ptr, m_stride);
-
- // Calculate the difference between a & b
- temp1 = _mm_subs_epu8(a, b);
- temp2 = _mm_subs_epu8(b, a);
- temp1 = _mm_or_si128(temp1, temp2);
-
- // Multiply by m and add together
- row_res = _mm_maddubs_epi16(temp1, m);
-
- // Pad out row result to 32 bit integers & add to running total
- res = _mm_add_epi32(res, _mm_madd_epi16(row_res, one));
+ const __m128i mask_max = _mm_set1_epi8((1 << AOM_BLEND_A64_ROUND_BITS));
- // Move onto the next rows
+ for (y = 0; y < height; y += 2) {
+ const __m128i src = _mm_unpacklo_epi64(
+ _mm_loadl_epi64((const __m128i *)src_ptr),
+ _mm_loadl_epi64((const __m128i *)&src_ptr[src_stride]));
+ const __m128i a0 = _mm_loadl_epi64((const __m128i *)a_ptr);
+ const __m128i a1 = _mm_loadl_epi64((const __m128i *)&a_ptr[a_stride]);
+ const __m128i b0 = _mm_loadl_epi64((const __m128i *)b_ptr);
+ const __m128i b1 = _mm_loadl_epi64((const __m128i *)&b_ptr[b_stride]);
+ const __m128i m =
+ _mm_unpacklo_epi64(_mm_loadl_epi64((const __m128i *)m_ptr),
+ _mm_loadl_epi64((const __m128i *)&m_ptr[m_stride]));
+ const __m128i m_inv = _mm_sub_epi8(mask_max, m);
+
+ const __m128i data_l = _mm_unpacklo_epi8(a0, b0);
+ const __m128i mask_l = _mm_unpacklo_epi8(m, m_inv);
+ __m128i pred_l = _mm_maddubs_epi16(data_l, mask_l);
+ pred_l = xx_roundn_epu16(pred_l, AOM_BLEND_A64_ROUND_BITS);
+
+ const __m128i data_r = _mm_unpacklo_epi8(a1, b1);
+ const __m128i mask_r = _mm_unpackhi_epi8(m, m_inv);
+ __m128i pred_r = _mm_maddubs_epi16(data_r, mask_r);
+ pred_r = xx_roundn_epu16(pred_r, AOM_BLEND_A64_ROUND_BITS);
+
+ const __m128i pred = _mm_packus_epi16(pred_l, pred_r);
+ res = _mm_add_epi32(res, _mm_sad_epu8(pred, src));
+
+ src_ptr += src_stride * 2;
a_ptr += a_stride * 2;
b_ptr += b_stride * 2;
m_ptr += m_stride * 2;
}
- res = _mm_hadd_epi32(res, _mm_setzero_si128());
- res = _mm_hadd_epi32(res, _mm_setzero_si128());
- // sad = (sad + 31) >> 6;
- return (_mm_cvtsi128_si32(res) + 31) >> 6;
+ int32_t sad =
+ _mm_cvtsi128_si32(res) + _mm_cvtsi128_si32(_mm_srli_si128(res, 8));
+ return (sad + 31) >> 6;
}
static INLINE unsigned int masked_sad4xh_ssse3(
- const uint8_t *a_ptr, int a_stride, const uint8_t *b_ptr, int b_stride,
- const uint8_t *m_ptr, int m_stride, int height) {
+ const uint8_t *src_ptr, int src_stride, const uint8_t *a_ptr, int a_stride,
+ const uint8_t *b_ptr, int b_stride, const uint8_t *m_ptr, int m_stride,
+ int height) {
int y;
- __m128i a, b, m, temp1, temp2, row_res;
__m128i res = _mm_setzero_si128();
- __m128i one = _mm_set1_epi16(1);
- // Add the masked SAD for 4 rows at a time
- for (y = 0; y < height; y += 4) {
- // Load a, b, m in xmm registers
- a = width4_load_4rows(a_ptr, a_stride);
- b = width4_load_4rows(b_ptr, b_stride);
- m = width4_load_4rows(m_ptr, m_stride);
-
- // Calculate the difference between a & b
- temp1 = _mm_subs_epu8(a, b);
- temp2 = _mm_subs_epu8(b, a);
- temp1 = _mm_or_si128(temp1, temp2);
-
- // Multiply by m and add together
- row_res = _mm_maddubs_epi16(temp1, m);
-
- // Pad out row result to 32 bit integers & add to running total
- res = _mm_add_epi32(res, _mm_madd_epi16(row_res, one));
-
- // Move onto the next rows
- a_ptr += a_stride * 4;
- b_ptr += b_stride * 4;
- m_ptr += m_stride * 4;
+ const __m128i mask_max = _mm_set1_epi8((1 << AOM_BLEND_A64_ROUND_BITS));
+
+ for (y = 0; y < height; y += 2) {
+ // Load two rows at a time, this seems to be a bit faster
+ // than four rows at a time in this case.
+ const __m128i src = _mm_unpacklo_epi32(
+ _mm_cvtsi32_si128(*(uint32_t *)src_ptr),
+ _mm_cvtsi32_si128(*(uint32_t *)&src_ptr[src_stride]));
+ const __m128i a =
+ _mm_unpacklo_epi32(_mm_cvtsi32_si128(*(uint32_t *)a_ptr),
+ _mm_cvtsi32_si128(*(uint32_t *)&a_ptr[a_stride]));
+ const __m128i b =
+ _mm_unpacklo_epi32(_mm_cvtsi32_si128(*(uint32_t *)b_ptr),
+ _mm_cvtsi32_si128(*(uint32_t *)&b_ptr[b_stride]));
+ const __m128i m =
+ _mm_unpacklo_epi32(_mm_cvtsi32_si128(*(uint32_t *)m_ptr),
+ _mm_cvtsi32_si128(*(uint32_t *)&m_ptr[m_stride]));
+ const __m128i m_inv = _mm_sub_epi8(mask_max, m);
+
+ const __m128i data = _mm_unpacklo_epi8(a, b);
+ const __m128i mask = _mm_unpacklo_epi8(m, m_inv);
+ __m128i pred_16bit = _mm_maddubs_epi16(data, mask);
+ pred_16bit = xx_roundn_epu16(pred_16bit, AOM_BLEND_A64_ROUND_BITS);
+
+ const __m128i pred = _mm_packus_epi16(pred_16bit, _mm_setzero_si128());
+ res = _mm_add_epi32(res, _mm_sad_epu8(pred, src));
+
+ src_ptr += src_stride * 2;
+ a_ptr += a_stride * 2;
+ b_ptr += b_stride * 2;
+ m_ptr += m_stride * 2;
}
- // Pad out row result to 32 bit integers & add to running total
- res = _mm_hadd_epi32(res, _mm_setzero_si128());
- res = _mm_hadd_epi32(res, _mm_setzero_si128());
- // sad = (sad + 31) >> 6;
- return (_mm_cvtsi128_si32(res) + 31) >> 6;
+ // At this point, the SAD is stored in lane 0 of 'res'
+ int32_t sad = _mm_cvtsi128_si32(res);
+ return (sad + 31) >> 6;
}
#if CONFIG_HIGHBITDEPTH
-static INLINE __m128i highbd_width4_load_2rows(const uint16_t *ptr,
- int stride) {
- __m128i temp1 = _mm_loadl_epi64((const __m128i *)ptr);
- __m128i temp2 = _mm_loadl_epi64((const __m128i *)(ptr + stride));
- return _mm_unpacklo_epi64(temp1, temp2);
-}
-
+// For width a multiple of 8
static INLINE unsigned int highbd_masked_sad_ssse3(
- const uint8_t *a8_ptr, int a_stride, const uint8_t *b8_ptr, int b_stride,
- const uint8_t *m_ptr, int m_stride, int width, int height);
+ const uint8_t *src8, int src_stride, const uint8_t *a8, int a_stride,
+ const uint8_t *b8, int b_stride, const uint8_t *m_ptr, int m_stride,
+ int width, int height);
static INLINE unsigned int highbd_masked_sad4xh_ssse3(
- const uint8_t *a8_ptr, int a_stride, const uint8_t *b8_ptr, int b_stride,
- const uint8_t *m_ptr, int m_stride, int height);
+ const uint8_t *src8, int src_stride, const uint8_t *a8, int a_stride,
+ const uint8_t *b8, int b_stride, const uint8_t *m_ptr, int m_stride,
+ int height);
#define HIGHBD_MASKSADMXN_SSSE3(m, n) \
unsigned int aom_highbd_masked_sad##m##x##n##_ssse3( \
- const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride, \
- const uint8_t *msk, int msk_stride) { \
- return highbd_masked_sad_ssse3(src, src_stride, ref, ref_stride, msk, \
- msk_stride, m, n); \
+ const uint8_t *src8, int src_stride, const uint8_t *ref8, \
+ int ref_stride, const uint8_t *second_pred8, const uint8_t *msk, \
+ int msk_stride, int invert_mask) { \
+ if (!invert_mask) \
+ return highbd_masked_sad_ssse3(src8, src_stride, ref8, ref_stride, \
+ second_pred8, m, msk, msk_stride, m, n); \
+ else \
+ return highbd_masked_sad_ssse3(src8, src_stride, second_pred8, m, ref8, \
+ ref_stride, msk, msk_stride, m, n); \
+ }
+
+#define HIGHBD_MASKSAD4XN_SSSE3(n) \
+ unsigned int aom_highbd_masked_sad4x##n##_ssse3( \
+ const uint8_t *src8, int src_stride, const uint8_t *ref8, \
+ int ref_stride, const uint8_t *second_pred8, const uint8_t *msk, \
+ int msk_stride, int invert_mask) { \
+ if (!invert_mask) \
+ return highbd_masked_sad4xh_ssse3(src8, src_stride, ref8, ref_stride, \
+ second_pred8, 4, msk, msk_stride, n); \
+ else \
+ return highbd_masked_sad4xh_ssse3(src8, src_stride, second_pred8, 4, \
+ ref8, ref_stride, msk, msk_stride, n); \
}
#if CONFIG_EXT_PARTITION
@@ -244,91 +281,124 @@ HIGHBD_MASKSADMXN_SSSE3(16, 8)
HIGHBD_MASKSADMXN_SSSE3(8, 16)
HIGHBD_MASKSADMXN_SSSE3(8, 8)
HIGHBD_MASKSADMXN_SSSE3(8, 4)
-
-#define HIGHBD_MASKSAD4XN_SSSE3(n) \
- unsigned int aom_highbd_masked_sad4x##n##_ssse3( \
- const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride, \
- const uint8_t *msk, int msk_stride) { \
- return highbd_masked_sad4xh_ssse3(src, src_stride, ref, ref_stride, msk, \
- msk_stride, n); \
- }
-
HIGHBD_MASKSAD4XN_SSSE3(8)
HIGHBD_MASKSAD4XN_SSSE3(4)
-// For width a multiple of 8
-// Assumes values in m are <=64
static INLINE unsigned int highbd_masked_sad_ssse3(
- const uint8_t *a8_ptr, int a_stride, const uint8_t *b8_ptr, int b_stride,
- const uint8_t *m_ptr, int m_stride, int width, int height) {
- int y, x;
- __m128i a, b, m, temp1, temp2;
- const uint16_t *a_ptr = CONVERT_TO_SHORTPTR(a8_ptr);
- const uint16_t *b_ptr = CONVERT_TO_SHORTPTR(b8_ptr);
+ const uint8_t *src8, int src_stride, const uint8_t *a8, int a_stride,
+ const uint8_t *b8, int b_stride, const uint8_t *m_ptr, int m_stride,
+ int width, int height) {
+ const uint16_t *src_ptr = CONVERT_TO_SHORTPTR(src8);
+ const uint16_t *a_ptr = CONVERT_TO_SHORTPTR(a8);
+ const uint16_t *b_ptr = CONVERT_TO_SHORTPTR(b8);
+ int x, y;
__m128i res = _mm_setzero_si128();
- // For each row
+ const __m128i mask_max = _mm_set1_epi16((1 << AOM_BLEND_A64_ROUND_BITS));
+ const __m128i round_const =
+ _mm_set1_epi32((1 << AOM_BLEND_A64_ROUND_BITS) >> 1);
+ const __m128i one = _mm_set1_epi16(1);
+
for (y = 0; y < height; y++) {
- // Covering the full width
for (x = 0; x < width; x += 8) {
- // Load a, b, m in xmm registers
- a = _mm_loadu_si128((const __m128i *)(a_ptr + x));
- b = _mm_loadu_si128((const __m128i *)(b_ptr + x));
- m = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i *)(m_ptr + x)),
- _mm_setzero_si128());
-
- // Calculate the difference between a & b
- temp1 = _mm_subs_epu16(a, b);
- temp2 = _mm_subs_epu16(b, a);
- temp1 = _mm_or_si128(temp1, temp2);
-
- // Add result of multiplying by m and add pairs together to running total
- res = _mm_add_epi32(res, _mm_madd_epi16(temp1, m));
+ const __m128i src = _mm_loadu_si128((const __m128i *)&src_ptr[x]);
+ const __m128i a = _mm_loadu_si128((const __m128i *)&a_ptr[x]);
+ const __m128i b = _mm_loadu_si128((const __m128i *)&b_ptr[x]);
+ // Zero-extend mask to 16 bits
+ const __m128i m = _mm_unpacklo_epi8(
+ _mm_loadl_epi64((const __m128i *)&m_ptr[x]), _mm_setzero_si128());
+ const __m128i m_inv = _mm_sub_epi16(mask_max, m);
+
+ const __m128i data_l = _mm_unpacklo_epi16(a, b);
+ const __m128i mask_l = _mm_unpacklo_epi16(m, m_inv);
+ __m128i pred_l = _mm_madd_epi16(data_l, mask_l);
+ pred_l = _mm_srai_epi32(_mm_add_epi32(pred_l, round_const),
+ AOM_BLEND_A64_ROUND_BITS);
+
+ const __m128i data_r = _mm_unpackhi_epi16(a, b);
+ const __m128i mask_r = _mm_unpackhi_epi16(m, m_inv);
+ __m128i pred_r = _mm_madd_epi16(data_r, mask_r);
+ pred_r = _mm_srai_epi32(_mm_add_epi32(pred_r, round_const),
+ AOM_BLEND_A64_ROUND_BITS);
+
+ // Note: the maximum value in pred_l/r is (2^bd)-1 < 2^15,
+ // so it is safe to do signed saturation here.
+ const __m128i pred = _mm_packs_epi32(pred_l, pred_r);
+ // There is no 16-bit SAD instruction, so we have to synthesize
+ // an 8-element SAD. We do this by storing 4 32-bit partial SADs,
+ // and accumulating them at the end
+ const __m128i diff = _mm_abs_epi16(_mm_sub_epi16(pred, src));
+ res = _mm_add_epi32(res, _mm_madd_epi16(diff, one));
}
- // Move onto the next row
+
+ src_ptr += src_stride;
a_ptr += a_stride;
b_ptr += b_stride;
m_ptr += m_stride;
}
- res = _mm_hadd_epi32(res, _mm_setzero_si128());
- res = _mm_hadd_epi32(res, _mm_setzero_si128());
- // sad = (sad + 31) >> 6;
- return (_mm_cvtsi128_si32(res) + 31) >> 6;
+ // At this point, we have four 32-bit partial SADs stored in 'res'.
+ res = _mm_hadd_epi32(res, res);
+ res = _mm_hadd_epi32(res, res);
+ int sad = _mm_cvtsi128_si32(res);
+ return (sad + 31) >> 6;
}
static INLINE unsigned int highbd_masked_sad4xh_ssse3(
- const uint8_t *a8_ptr, int a_stride, const uint8_t *b8_ptr, int b_stride,
- const uint8_t *m_ptr, int m_stride, int height) {
+ const uint8_t *src8, int src_stride, const uint8_t *a8, int a_stride,
+ const uint8_t *b8, int b_stride, const uint8_t *m_ptr, int m_stride,
+ int height) {
+ const uint16_t *src_ptr = CONVERT_TO_SHORTPTR(src8);
+ const uint16_t *a_ptr = CONVERT_TO_SHORTPTR(a8);
+ const uint16_t *b_ptr = CONVERT_TO_SHORTPTR(b8);
int y;
- __m128i a, b, m, temp1, temp2;
- const uint16_t *a_ptr = CONVERT_TO_SHORTPTR(a8_ptr);
- const uint16_t *b_ptr = CONVERT_TO_SHORTPTR(b8_ptr);
__m128i res = _mm_setzero_si128();
- // Add the masked SAD for 2 rows at a time
+ const __m128i mask_max = _mm_set1_epi16((1 << AOM_BLEND_A64_ROUND_BITS));
+ const __m128i round_const =
+ _mm_set1_epi32((1 << AOM_BLEND_A64_ROUND_BITS) >> 1);
+ const __m128i one = _mm_set1_epi16(1);
+
for (y = 0; y < height; y += 2) {
- // Load a, b, m in xmm registers
- a = highbd_width4_load_2rows(a_ptr, a_stride);
- b = highbd_width4_load_2rows(b_ptr, b_stride);
- temp1 = _mm_loadl_epi64((const __m128i *)m_ptr);
- temp2 = _mm_loadl_epi64((const __m128i *)(m_ptr + m_stride));
- m = _mm_unpacklo_epi8(_mm_unpacklo_epi32(temp1, temp2),
- _mm_setzero_si128());
-
- // Calculate the difference between a & b
- temp1 = _mm_subs_epu16(a, b);
- temp2 = _mm_subs_epu16(b, a);
- temp1 = _mm_or_si128(temp1, temp2);
-
- // Multiply by m and add together
- res = _mm_add_epi32(res, _mm_madd_epi16(temp1, m));
-
- // Move onto the next rows
+ const __m128i src = _mm_unpacklo_epi64(
+ _mm_loadl_epi64((const __m128i *)src_ptr),
+ _mm_loadl_epi64((const __m128i *)&src_ptr[src_stride]));
+ const __m128i a =
+ _mm_unpacklo_epi64(_mm_loadl_epi64((const __m128i *)a_ptr),
+ _mm_loadl_epi64((const __m128i *)&a_ptr[a_stride]));
+ const __m128i b =
+ _mm_unpacklo_epi64(_mm_loadl_epi64((const __m128i *)b_ptr),
+ _mm_loadl_epi64((const __m128i *)&b_ptr[b_stride]));
+ // Zero-extend mask to 16 bits
+ const __m128i m = _mm_unpacklo_epi8(
+ _mm_unpacklo_epi32(
+ _mm_cvtsi32_si128(*(const uint32_t *)m_ptr),
+ _mm_cvtsi32_si128(*(const uint32_t *)&m_ptr[m_stride])),
+ _mm_setzero_si128());
+ const __m128i m_inv = _mm_sub_epi16(mask_max, m);
+
+ const __m128i data_l = _mm_unpacklo_epi16(a, b);
+ const __m128i mask_l = _mm_unpacklo_epi16(m, m_inv);
+ __m128i pred_l = _mm_madd_epi16(data_l, mask_l);
+ pred_l = _mm_srai_epi32(_mm_add_epi32(pred_l, round_const),
+ AOM_BLEND_A64_ROUND_BITS);
+
+ const __m128i data_r = _mm_unpackhi_epi16(a, b);
+ const __m128i mask_r = _mm_unpackhi_epi16(m, m_inv);
+ __m128i pred_r = _mm_madd_epi16(data_r, mask_r);
+ pred_r = _mm_srai_epi32(_mm_add_epi32(pred_r, round_const),
+ AOM_BLEND_A64_ROUND_BITS);
+
+ const __m128i pred = _mm_packs_epi32(pred_l, pred_r);
+ const __m128i diff = _mm_abs_epi16(_mm_sub_epi16(pred, src));
+ res = _mm_add_epi32(res, _mm_madd_epi16(diff, one));
+
+ src_ptr += src_stride * 2;
a_ptr += a_stride * 2;
b_ptr += b_stride * 2;
m_ptr += m_stride * 2;
}
- res = _mm_hadd_epi32(res, _mm_setzero_si128());
- res = _mm_hadd_epi32(res, _mm_setzero_si128());
- // sad = (sad + 31) >> 6;
- return (_mm_cvtsi128_si32(res) + 31) >> 6;
+ res = _mm_hadd_epi32(res, res);
+ res = _mm_hadd_epi32(res, res);
+ int sad = _mm_cvtsi128_si32(res);
+ return (sad + 31) >> 6;
}
-#endif // CONFIG_HIGHBITDEPTH
+
+#endif
diff --git a/third_party/aom/aom_dsp/x86/masked_variance_intrin_ssse3.c b/third_party/aom/aom_dsp/x86/masked_variance_intrin_ssse3.c
index fe14597f6..be9d437d2 100644
--- a/third_party/aom/aom_dsp/x86/masked_variance_intrin_ssse3.c
+++ b/third_party/aom/aom_dsp/x86/masked_variance_intrin_ssse3.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved
+ * Copyright (c) 2017, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@@ -9,1940 +9,1003 @@
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
-#include <assert.h>
#include <stdlib.h>
-#include <emmintrin.h>
+#include <string.h>
#include <tmmintrin.h>
#include "./aom_config.h"
+#include "./aom_dsp_rtcd.h"
+#include "aom_dsp/blend.h"
#include "aom/aom_integer.h"
#include "aom_ports/mem.h"
#include "aom_dsp/aom_filter.h"
-
-// Half pixel shift
-#define HALF_PIXEL_OFFSET (BIL_SUBPEL_SHIFTS / 2)
-
-/*****************************************************************************
- * Horizontal additions
- *****************************************************************************/
-
-static INLINE int32_t hsum_epi32_si32(__m128i v_d) {
- v_d = _mm_hadd_epi32(v_d, v_d);
- v_d = _mm_hadd_epi32(v_d, v_d);
- return _mm_cvtsi128_si32(v_d);
-}
-
-static INLINE int64_t hsum_epi64_si64(__m128i v_q) {
- v_q = _mm_add_epi64(v_q, _mm_srli_si128(v_q, 8));
-#if ARCH_X86_64
- return _mm_cvtsi128_si64(v_q);
-#else
- {
- int64_t tmp;
- _mm_storel_epi64((__m128i *)&tmp, v_q);
- return tmp;
- }
-#endif
-}
-
-#if CONFIG_HIGHBITDEPTH
-static INLINE int64_t hsum_epi32_si64(__m128i v_d) {
- const __m128i v_sign_d = _mm_cmplt_epi32(v_d, _mm_setzero_si128());
- const __m128i v_0_q = _mm_unpacklo_epi32(v_d, v_sign_d);
- const __m128i v_1_q = _mm_unpackhi_epi32(v_d, v_sign_d);
- return hsum_epi64_si64(_mm_add_epi64(v_0_q, v_1_q));
-}
-#endif // CONFIG_HIGHBITDEPTH
-
-static INLINE uint32_t calc_masked_variance(__m128i v_sum_d, __m128i v_sse_q,
- uint32_t *sse, int w, int h) {
- int64_t sum64;
- uint64_t sse64;
-
- // Horizontal sum
- sum64 = hsum_epi32_si32(v_sum_d);
- sse64 = hsum_epi64_si64(v_sse_q);
-
- sum64 = (sum64 >= 0) ? sum64 : -sum64;
-
- // Round
- sum64 = ROUND_POWER_OF_TWO(sum64, 6);
- sse64 = ROUND_POWER_OF_TWO(sse64, 12);
-
- // Store the SSE
- *sse = (uint32_t)sse64;
- // Compute the variance
- return *sse - (uint32_t)((sum64 * sum64) / (w * h));
-}
-
-/*****************************************************************************
- * n*16 Wide versions
- *****************************************************************************/
-
-static INLINE unsigned int masked_variancewxh_ssse3(
- const uint8_t *a, int a_stride, const uint8_t *b, int b_stride,
- const uint8_t *m, int m_stride, int w, int h, unsigned int *sse) {
- int ii, jj;
-
- const __m128i v_zero = _mm_setzero_si128();
-
- __m128i v_sum_d = _mm_setzero_si128();
- __m128i v_sse_q = _mm_setzero_si128();
-
- assert((w % 16) == 0);
-
- for (ii = 0; ii < h; ii++) {
- for (jj = 0; jj < w; jj += 16) {
- // Load inputs - 8 bits
- const __m128i v_a_b = _mm_loadu_si128((const __m128i *)(a + jj));
- const __m128i v_b_b = _mm_loadu_si128((const __m128i *)(b + jj));
- const __m128i v_m_b = _mm_loadu_si128((const __m128i *)(m + jj));
-
- // Unpack to 16 bits - still containing max 8 bits
- const __m128i v_a0_w = _mm_unpacklo_epi8(v_a_b, v_zero);
- const __m128i v_b0_w = _mm_unpacklo_epi8(v_b_b, v_zero);
- const __m128i v_m0_w = _mm_unpacklo_epi8(v_m_b, v_zero);
- const __m128i v_a1_w = _mm_unpackhi_epi8(v_a_b, v_zero);
- const __m128i v_b1_w = _mm_unpackhi_epi8(v_b_b, v_zero);
- const __m128i v_m1_w = _mm_unpackhi_epi8(v_m_b, v_zero);
-
- // Difference: [-255, 255]
- const __m128i v_d0_w = _mm_sub_epi16(v_a0_w, v_b0_w);
- const __m128i v_d1_w = _mm_sub_epi16(v_a1_w, v_b1_w);
-
- // Error - [-255, 255] * [0, 64] = [0xc040, 0x3fc0] => fits in 15 bits
- const __m128i v_e0_w = _mm_mullo_epi16(v_d0_w, v_m0_w);
- const __m128i v_e0_d = _mm_madd_epi16(v_d0_w, v_m0_w);
- const __m128i v_e1_w = _mm_mullo_epi16(v_d1_w, v_m1_w);
- const __m128i v_e1_d = _mm_madd_epi16(v_d1_w, v_m1_w);
-
- // Squared error - using madd it's max (15 bits * 15 bits) * 2 = 31 bits
- const __m128i v_se0_d = _mm_madd_epi16(v_e0_w, v_e0_w);
- const __m128i v_se1_d = _mm_madd_epi16(v_e1_w, v_e1_w);
-
- // Sum of v_se{0,1}_d - 31 bits + 31 bits = 32 bits
- const __m128i v_se_d = _mm_add_epi32(v_se0_d, v_se1_d);
-
- // Unpack Squared error to 64 bits
- const __m128i v_se_lo_q = _mm_unpacklo_epi32(v_se_d, v_zero);
- const __m128i v_se_hi_q = _mm_unpackhi_epi32(v_se_d, v_zero);
-
- // Accumulate
- v_sum_d = _mm_add_epi32(v_sum_d, v_e0_d);
- v_sum_d = _mm_add_epi32(v_sum_d, v_e1_d);
- v_sse_q = _mm_add_epi64(v_sse_q, v_se_lo_q);
- v_sse_q = _mm_add_epi64(v_sse_q, v_se_hi_q);
- }
-
- // Move on to next row
- a += a_stride;
- b += b_stride;
- m += m_stride;
- }
-
- return calc_masked_variance(v_sum_d, v_sse_q, sse, w, h);
-}
-
-#define MASKED_VARWXH(W, H) \
- unsigned int aom_masked_variance##W##x##H##_ssse3( \
- const uint8_t *a, int a_stride, const uint8_t *b, int b_stride, \
- const uint8_t *m, int m_stride, unsigned int *sse) { \
- return masked_variancewxh_ssse3(a, a_stride, b, b_stride, m, m_stride, W, \
- H, sse); \
+#include "aom_dsp/x86/synonyms.h"
+
+// For width a multiple of 16
+static void bilinear_filter(const uint8_t *src, int src_stride, int xoffset,
+ int yoffset, uint8_t *dst, int w, int h);
+
+static void bilinear_filter8xh(const uint8_t *src, int src_stride, int xoffset,
+ int yoffset, uint8_t *dst, int h);
+
+static void bilinear_filter4xh(const uint8_t *src, int src_stride, int xoffset,
+ int yoffset, uint8_t *dst, int h);
+
+// For width a multiple of 16
+static void masked_variance(const uint8_t *src_ptr, int src_stride,
+ const uint8_t *a_ptr, int a_stride,
+ const uint8_t *b_ptr, int b_stride,
+ const uint8_t *m_ptr, int m_stride, int width,
+ int height, unsigned int *sse, int *sum_);
+
+static void masked_variance8xh(const uint8_t *src_ptr, int src_stride,
+ const uint8_t *a_ptr, const uint8_t *b_ptr,
+ const uint8_t *m_ptr, int m_stride, int height,
+ unsigned int *sse, int *sum_);
+
+static void masked_variance4xh(const uint8_t *src_ptr, int src_stride,
+ const uint8_t *a_ptr, const uint8_t *b_ptr,
+ const uint8_t *m_ptr, int m_stride, int height,
+ unsigned int *sse, int *sum_);
+
+#define MASK_SUBPIX_VAR_SSSE3(W, H) \
+ unsigned int aom_masked_sub_pixel_variance##W##x##H##_ssse3( \
+ const uint8_t *src, int src_stride, int xoffset, int yoffset, \
+ const uint8_t *ref, int ref_stride, const uint8_t *second_pred, \
+ const uint8_t *msk, int msk_stride, int invert_mask, \
+ unsigned int *sse) { \
+ int sum; \
+ uint8_t temp[(H + 1) * W]; \
+ \
+ bilinear_filter(src, src_stride, xoffset, yoffset, temp, W, H); \
+ \
+ if (!invert_mask) \
+ masked_variance(ref, ref_stride, temp, W, second_pred, W, msk, \
+ msk_stride, W, H, sse, &sum); \
+ else \
+ masked_variance(ref, ref_stride, second_pred, W, temp, W, msk, \
+ msk_stride, W, H, sse, &sum); \
+ return *sse - (uint32_t)(((int64_t)sum * sum) / (W * H)); \
+ }
+
+#define MASK_SUBPIX_VAR8XH_SSSE3(H) \
+ unsigned int aom_masked_sub_pixel_variance8x##H##_ssse3( \
+ const uint8_t *src, int src_stride, int xoffset, int yoffset, \
+ const uint8_t *ref, int ref_stride, const uint8_t *second_pred, \
+ const uint8_t *msk, int msk_stride, int invert_mask, \
+ unsigned int *sse) { \
+ int sum; \
+ uint8_t temp[(H + 1) * 8]; \
+ \
+ bilinear_filter8xh(src, src_stride, xoffset, yoffset, temp, H); \
+ \
+ if (!invert_mask) \
+ masked_variance8xh(ref, ref_stride, temp, second_pred, msk, msk_stride, \
+ H, sse, &sum); \
+ else \
+ masked_variance8xh(ref, ref_stride, second_pred, temp, msk, msk_stride, \
+ H, sse, &sum); \
+ return *sse - (uint32_t)(((int64_t)sum * sum) / (8 * H)); \
+ }
+
+#define MASK_SUBPIX_VAR4XH_SSSE3(H) \
+ unsigned int aom_masked_sub_pixel_variance4x##H##_ssse3( \
+ const uint8_t *src, int src_stride, int xoffset, int yoffset, \
+ const uint8_t *ref, int ref_stride, const uint8_t *second_pred, \
+ const uint8_t *msk, int msk_stride, int invert_mask, \
+ unsigned int *sse) { \
+ int sum; \
+ uint8_t temp[(H + 1) * 4]; \
+ \
+ bilinear_filter4xh(src, src_stride, xoffset, yoffset, temp, H); \
+ \
+ if (!invert_mask) \
+ masked_variance4xh(ref, ref_stride, temp, second_pred, msk, msk_stride, \
+ H, sse, &sum); \
+ else \
+ masked_variance4xh(ref, ref_stride, second_pred, temp, msk, msk_stride, \
+ H, sse, &sum); \
+ return *sse - (uint32_t)(((int64_t)sum * sum) / (4 * H)); \
}
-MASKED_VARWXH(16, 8)
-MASKED_VARWXH(16, 16)
-MASKED_VARWXH(16, 32)
-MASKED_VARWXH(32, 16)
-MASKED_VARWXH(32, 32)
-MASKED_VARWXH(32, 64)
-MASKED_VARWXH(64, 32)
-MASKED_VARWXH(64, 64)
#if CONFIG_EXT_PARTITION
-MASKED_VARWXH(64, 128)
-MASKED_VARWXH(128, 64)
-MASKED_VARWXH(128, 128)
-#endif // CONFIG_EXT_PARTITION
-
-/*****************************************************************************
- * 8 Wide versions
- *****************************************************************************/
-
-static INLINE unsigned int masked_variance8xh_ssse3(
- const uint8_t *a, int a_stride, const uint8_t *b, int b_stride,
- const uint8_t *m, int m_stride, int h, unsigned int *sse) {
- int ii;
-
- const __m128i v_zero = _mm_setzero_si128();
-
- __m128i v_sum_d = _mm_setzero_si128();
- __m128i v_sse_q = _mm_setzero_si128();
-
- for (ii = 0; ii < h; ii++) {
- // Load inputs - 8 bits
- const __m128i v_a_b = _mm_loadl_epi64((const __m128i *)a);
- const __m128i v_b_b = _mm_loadl_epi64((const __m128i *)b);
- const __m128i v_m_b = _mm_loadl_epi64((const __m128i *)m);
-
- // Unpack to 16 bits - still containing max 8 bits
- const __m128i v_a_w = _mm_unpacklo_epi8(v_a_b, v_zero);
- const __m128i v_b_w = _mm_unpacklo_epi8(v_b_b, v_zero);
- const __m128i v_m_w = _mm_unpacklo_epi8(v_m_b, v_zero);
-
- // Difference: [-255, 255]
- const __m128i v_d_w = _mm_sub_epi16(v_a_w, v_b_w);
-
- // Error - [-255, 255] * [0, 64] = [0xc040, 0x3fc0] => fits in 15 bits
- const __m128i v_e_w = _mm_mullo_epi16(v_d_w, v_m_w);
- const __m128i v_e_d = _mm_madd_epi16(v_d_w, v_m_w);
-
- // Squared error - using madd it's max (15 bits * 15 bits) * 2 = 31 bits
- const __m128i v_se_d = _mm_madd_epi16(v_e_w, v_e_w);
-
- // Unpack Squared error to 64 bits
- const __m128i v_se_lo_q = _mm_unpacklo_epi32(v_se_d, v_zero);
- const __m128i v_se_hi_q = _mm_unpackhi_epi32(v_se_d, v_zero);
-
- // Accumulate
- v_sum_d = _mm_add_epi32(v_sum_d, v_e_d);
- v_sse_q = _mm_add_epi64(v_sse_q, v_se_lo_q);
- v_sse_q = _mm_add_epi64(v_sse_q, v_se_hi_q);
-
- // Move on to next row
- a += a_stride;
- b += b_stride;
- m += m_stride;
- }
-
- return calc_masked_variance(v_sum_d, v_sse_q, sse, 8, h);
-}
-
-#define MASKED_VAR8XH(H) \
- unsigned int aom_masked_variance8x##H##_ssse3( \
- const uint8_t *a, int a_stride, const uint8_t *b, int b_stride, \
- const uint8_t *m, int m_stride, unsigned int *sse) { \
- return masked_variance8xh_ssse3(a, a_stride, b, b_stride, m, m_stride, H, \
- sse); \
- }
-
-MASKED_VAR8XH(4)
-MASKED_VAR8XH(8)
-MASKED_VAR8XH(16)
-
-/*****************************************************************************
- * 4 Wide versions
- *****************************************************************************/
-
-static INLINE unsigned int masked_variance4xh_ssse3(
- const uint8_t *a, int a_stride, const uint8_t *b, int b_stride,
- const uint8_t *m, int m_stride, int h, unsigned int *sse) {
- int ii;
-
- const __m128i v_zero = _mm_setzero_si128();
-
- __m128i v_sum_d = _mm_setzero_si128();
- __m128i v_sse_q = _mm_setzero_si128();
-
- assert((h % 2) == 0);
-
- for (ii = 0; ii < h / 2; ii++) {
- // Load 2 input rows - 8 bits
- const __m128i v_a0_b = _mm_cvtsi32_si128(*(const uint32_t *)a);
- const __m128i v_b0_b = _mm_cvtsi32_si128(*(const uint32_t *)b);
- const __m128i v_m0_b = _mm_cvtsi32_si128(*(const uint32_t *)m);
- const __m128i v_a1_b = _mm_cvtsi32_si128(*(const uint32_t *)(a + a_stride));
- const __m128i v_b1_b = _mm_cvtsi32_si128(*(const uint32_t *)(b + b_stride));
- const __m128i v_m1_b = _mm_cvtsi32_si128(*(const uint32_t *)(m + m_stride));
-
- // Interleave 2 rows into a single register
- const __m128i v_a_b = _mm_unpacklo_epi32(v_a0_b, v_a1_b);
- const __m128i v_b_b = _mm_unpacklo_epi32(v_b0_b, v_b1_b);
- const __m128i v_m_b = _mm_unpacklo_epi32(v_m0_b, v_m1_b);
-
- // Unpack to 16 bits - still containing max 8 bits
- const __m128i v_a_w = _mm_unpacklo_epi8(v_a_b, v_zero);
- const __m128i v_b_w = _mm_unpacklo_epi8(v_b_b, v_zero);
- const __m128i v_m_w = _mm_unpacklo_epi8(v_m_b, v_zero);
-
- // Difference: [-255, 255]
- const __m128i v_d_w = _mm_sub_epi16(v_a_w, v_b_w);
-
- // Error - [-255, 255] * [0, 64] = [0xc040, 0x3fc0] => fits in 15 bits
- const __m128i v_e_w = _mm_mullo_epi16(v_d_w, v_m_w);
- const __m128i v_e_d = _mm_madd_epi16(v_d_w, v_m_w);
-
- // Squared error - using madd it's max (15 bits * 15 bits) * 2 = 31 bits
- const __m128i v_se_d = _mm_madd_epi16(v_e_w, v_e_w);
-
- // Unpack Squared error to 64 bits
- const __m128i v_se_lo_q = _mm_unpacklo_epi32(v_se_d, v_zero);
- const __m128i v_se_hi_q = _mm_unpackhi_epi32(v_se_d, v_zero);
-
- // Accumulate
- v_sum_d = _mm_add_epi32(v_sum_d, v_e_d);
- v_sse_q = _mm_add_epi64(v_sse_q, v_se_lo_q);
- v_sse_q = _mm_add_epi64(v_sse_q, v_se_hi_q);
-
- // Move on to next 2 row
- a += a_stride * 2;
- b += b_stride * 2;
- m += m_stride * 2;
- }
-
- return calc_masked_variance(v_sum_d, v_sse_q, sse, 4, h);
-}
-
-#define MASKED_VAR4XH(H) \
- unsigned int aom_masked_variance4x##H##_ssse3( \
- const uint8_t *a, int a_stride, const uint8_t *b, int b_stride, \
- const uint8_t *m, int m_stride, unsigned int *sse) { \
- return masked_variance4xh_ssse3(a, a_stride, b, b_stride, m, m_stride, H, \
- sse); \
- }
-
-MASKED_VAR4XH(4)
-MASKED_VAR4XH(8)
-
-#if CONFIG_HIGHBITDEPTH
-
-// Main calculation for n*8 wide blocks
-static INLINE void highbd_masked_variance64_ssse3(
- const uint16_t *a, int a_stride, const uint16_t *b, int b_stride,
- const uint8_t *m, int m_stride, int w, int h, int64_t *sum, uint64_t *sse) {
- int ii, jj;
-
- const __m128i v_zero = _mm_setzero_si128();
-
- __m128i v_sum_d = _mm_setzero_si128();
- __m128i v_sse_q = _mm_setzero_si128();
-
- assert((w % 8) == 0);
-
- for (ii = 0; ii < h; ii++) {
- for (jj = 0; jj < w; jj += 8) {
- // Load inputs - 8 bits
- const __m128i v_a_w = _mm_loadu_si128((const __m128i *)(a + jj));
- const __m128i v_b_w = _mm_loadu_si128((const __m128i *)(b + jj));
- const __m128i v_m_b = _mm_loadl_epi64((const __m128i *)(m + jj));
-
- // Unpack m to 16 bits - still containing max 8 bits
- const __m128i v_m_w = _mm_unpacklo_epi8(v_m_b, v_zero);
-
- // Difference: [-4095, 4095]
- const __m128i v_d_w = _mm_sub_epi16(v_a_w, v_b_w);
-
- // Error - [-4095, 4095] * [0, 64] => sum of 2 of these fits in 19 bits
- const __m128i v_e_d = _mm_madd_epi16(v_d_w, v_m_w);
-
- // Squared error - max (18 bits * 18 bits) = 36 bits (no sign bit)
- const __m128i v_absd_w = _mm_abs_epi16(v_d_w);
- const __m128i v_dlo_d = _mm_unpacklo_epi16(v_absd_w, v_zero);
- const __m128i v_mlo_d = _mm_unpacklo_epi16(v_m_w, v_zero);
- const __m128i v_elo_d = _mm_madd_epi16(v_dlo_d, v_mlo_d);
- const __m128i v_dhi_d = _mm_unpackhi_epi16(v_absd_w, v_zero);
- const __m128i v_mhi_d = _mm_unpackhi_epi16(v_m_w, v_zero);
- const __m128i v_ehi_d = _mm_madd_epi16(v_dhi_d, v_mhi_d);
- // Square and sum the errors -> 36bits * 4 = 38bits
- __m128i v_se0_q, v_se1_q, v_se2_q, v_se3_q, v_se_q, v_elo1_d, v_ehi3_d;
- v_se0_q = _mm_mul_epu32(v_elo_d, v_elo_d);
- v_elo1_d = _mm_srli_si128(v_elo_d, 4);
- v_se1_q = _mm_mul_epu32(v_elo1_d, v_elo1_d);
- v_se0_q = _mm_add_epi64(v_se0_q, v_se1_q);
- v_se2_q = _mm_mul_epu32(v_ehi_d, v_ehi_d);
- v_ehi3_d = _mm_srli_si128(v_ehi_d, 4);
- v_se3_q = _mm_mul_epu32(v_ehi3_d, v_ehi3_d);
- v_se1_q = _mm_add_epi64(v_se2_q, v_se3_q);
- v_se_q = _mm_add_epi64(v_se0_q, v_se1_q);
-
- // Accumulate
- v_sum_d = _mm_add_epi32(v_sum_d, v_e_d);
- v_sse_q = _mm_add_epi64(v_sse_q, v_se_q);
- }
-
- // Move on to next row
- a += a_stride;
- b += b_stride;
- m += m_stride;
- }
-
- // Horizontal sum
- *sum = hsum_epi32_si64(v_sum_d);
- *sse = hsum_epi64_si64(v_sse_q);
-
- // Round
- *sum = (*sum >= 0) ? *sum : -*sum;
- *sum = ROUND_POWER_OF_TWO(*sum, 6);
- *sse = ROUND_POWER_OF_TWO(*sse, 12);
-}
-
-// Main calculation for 4 wide blocks
-static INLINE void highbd_masked_variance64_4wide_ssse3(
- const uint16_t *a, int a_stride, const uint16_t *b, int b_stride,
- const uint8_t *m, int m_stride, int h, int64_t *sum, uint64_t *sse) {
- int ii;
-
- const __m128i v_zero = _mm_setzero_si128();
-
- __m128i v_sum_d = _mm_setzero_si128();
- __m128i v_sse_q = _mm_setzero_si128();
-
- assert((h % 2) == 0);
-
- for (ii = 0; ii < h / 2; ii++) {
- // Load 2 input rows - 8 bits
- const __m128i v_a0_w = _mm_loadl_epi64((const __m128i *)a);
- const __m128i v_b0_w = _mm_loadl_epi64((const __m128i *)b);
- const __m128i v_m0_b = _mm_cvtsi32_si128(*(const uint32_t *)m);
- const __m128i v_a1_w = _mm_loadl_epi64((const __m128i *)(a + a_stride));
- const __m128i v_b1_w = _mm_loadl_epi64((const __m128i *)(b + b_stride));
- const __m128i v_m1_b = _mm_cvtsi32_si128(*(const uint32_t *)(m + m_stride));
-
- // Interleave 2 rows into a single register
- const __m128i v_a_w = _mm_unpacklo_epi64(v_a0_w, v_a1_w);
- const __m128i v_b_w = _mm_unpacklo_epi64(v_b0_w, v_b1_w);
- const __m128i v_m_b = _mm_unpacklo_epi32(v_m0_b, v_m1_b);
-
- // Unpack to 16 bits - still containing max 8 bits
- const __m128i v_m_w = _mm_unpacklo_epi8(v_m_b, v_zero);
-
- // Difference: [-4095, 4095]
- const __m128i v_d_w = _mm_sub_epi16(v_a_w, v_b_w);
-
- // Error - [-4095, 4095] * [0, 64] => fits in 19 bits (incld sign bit)
- const __m128i v_e_d = _mm_madd_epi16(v_d_w, v_m_w);
-
- // Squared error - max (18 bits * 18 bits) = 36 bits (no sign bit)
- const __m128i v_absd_w = _mm_abs_epi16(v_d_w);
- const __m128i v_dlo_d = _mm_unpacklo_epi16(v_absd_w, v_zero);
- const __m128i v_mlo_d = _mm_unpacklo_epi16(v_m_w, v_zero);
- const __m128i v_elo_d = _mm_madd_epi16(v_dlo_d, v_mlo_d);
- const __m128i v_dhi_d = _mm_unpackhi_epi16(v_absd_w, v_zero);
- const __m128i v_mhi_d = _mm_unpackhi_epi16(v_m_w, v_zero);
- const __m128i v_ehi_d = _mm_madd_epi16(v_dhi_d, v_mhi_d);
- // Square and sum the errors -> 36bits * 4 = 38bits
- __m128i v_se0_q, v_se1_q, v_se2_q, v_se3_q, v_se_q, v_elo1_d, v_ehi3_d;
- v_se0_q = _mm_mul_epu32(v_elo_d, v_elo_d);
- v_elo1_d = _mm_srli_si128(v_elo_d, 4);
- v_se1_q = _mm_mul_epu32(v_elo1_d, v_elo1_d);
- v_se0_q = _mm_add_epi64(v_se0_q, v_se1_q);
- v_se2_q = _mm_mul_epu32(v_ehi_d, v_ehi_d);
- v_ehi3_d = _mm_srli_si128(v_ehi_d, 4);
- v_se3_q = _mm_mul_epu32(v_ehi3_d, v_ehi3_d);
- v_se1_q = _mm_add_epi64(v_se2_q, v_se3_q);
- v_se_q = _mm_add_epi64(v_se0_q, v_se1_q);
-
- // Accumulate
- v_sum_d = _mm_add_epi32(v_sum_d, v_e_d);
- v_sse_q = _mm_add_epi64(v_sse_q, v_se_q);
-
- // Move on to next row
- a += a_stride * 2;
- b += b_stride * 2;
- m += m_stride * 2;
- }
-
- // Horizontal sum
- *sum = hsum_epi32_si32(v_sum_d);
- *sse = hsum_epi64_si64(v_sse_q);
-
- // Round
- *sum = (*sum >= 0) ? *sum : -*sum;
- *sum = ROUND_POWER_OF_TWO(*sum, 6);
- *sse = ROUND_POWER_OF_TWO(*sse, 12);
-}
-
-static INLINE unsigned int highbd_masked_variancewxh_ssse3(
- const uint16_t *a, int a_stride, const uint16_t *b, int b_stride,
- const uint8_t *m, int m_stride, int w, int h, unsigned int *sse) {
- uint64_t sse64;
- int64_t sum64;
-
- if (w == 4)
- highbd_masked_variance64_4wide_ssse3(a, a_stride, b, b_stride, m, m_stride,
- h, &sum64, &sse64);
- else
- highbd_masked_variance64_ssse3(a, a_stride, b, b_stride, m, m_stride, w, h,
- &sum64, &sse64);
-
- // Store the SSE
- *sse = (uint32_t)sse64;
- // Compute and return variance
- return *sse - (uint32_t)((sum64 * sum64) / (w * h));
-}
-
-static INLINE unsigned int highbd_10_masked_variancewxh_ssse3(
- const uint16_t *a, int a_stride, const uint16_t *b, int b_stride,
- const uint8_t *m, int m_stride, int w, int h, unsigned int *sse) {
- uint64_t sse64;
- int64_t sum64;
-
- if (w == 4)
- highbd_masked_variance64_4wide_ssse3(a, a_stride, b, b_stride, m, m_stride,
- h, &sum64, &sse64);
- else
- highbd_masked_variance64_ssse3(a, a_stride, b, b_stride, m, m_stride, w, h,
- &sum64, &sse64);
-
- // Normalise
- sum64 = ROUND_POWER_OF_TWO(sum64, 2);
- sse64 = ROUND_POWER_OF_TWO(sse64, 4);
-
- // Store the SSE
- *sse = (uint32_t)sse64;
- // Compute and return variance
- return *sse - (uint32_t)((sum64 * sum64) / (w * h));
-}
-
-static INLINE unsigned int highbd_12_masked_variancewxh_ssse3(
- const uint16_t *a, int a_stride, const uint16_t *b, int b_stride,
- const uint8_t *m, int m_stride, int w, int h, unsigned int *sse) {
- uint64_t sse64;
- int64_t sum64;
-
- if (w == 4)
- highbd_masked_variance64_4wide_ssse3(a, a_stride, b, b_stride, m, m_stride,
- h, &sum64, &sse64);
- else
- highbd_masked_variance64_ssse3(a, a_stride, b, b_stride, m, m_stride, w, h,
- &sum64, &sse64);
-
- sum64 = ROUND_POWER_OF_TWO(sum64, 4);
- sse64 = ROUND_POWER_OF_TWO(sse64, 8);
-
- // Store the SSE
- *sse = (uint32_t)sse64;
- // Compute and return variance
- return *sse - (uint32_t)((sum64 * sum64) / (w * h));
-}
-
-#define HIGHBD_MASKED_VARWXH(W, H) \
- unsigned int aom_highbd_masked_variance##W##x##H##_ssse3( \
- const uint8_t *a8, int a_stride, const uint8_t *b8, int b_stride, \
- const uint8_t *m, int m_stride, unsigned int *sse) { \
- uint16_t *a = CONVERT_TO_SHORTPTR(a8); \
- uint16_t *b = CONVERT_TO_SHORTPTR(b8); \
- return highbd_masked_variancewxh_ssse3(a, a_stride, b, b_stride, m, \
- m_stride, W, H, sse); \
- } \
- \
- unsigned int aom_highbd_10_masked_variance##W##x##H##_ssse3( \
- const uint8_t *a8, int a_stride, const uint8_t *b8, int b_stride, \
- const uint8_t *m, int m_stride, unsigned int *sse) { \
- uint16_t *a = CONVERT_TO_SHORTPTR(a8); \
- uint16_t *b = CONVERT_TO_SHORTPTR(b8); \
- return highbd_10_masked_variancewxh_ssse3(a, a_stride, b, b_stride, m, \
- m_stride, W, H, sse); \
- } \
- \
- unsigned int aom_highbd_12_masked_variance##W##x##H##_ssse3( \
- const uint8_t *a8, int a_stride, const uint8_t *b8, int b_stride, \
- const uint8_t *m, int m_stride, unsigned int *sse) { \
- uint16_t *a = CONVERT_TO_SHORTPTR(a8); \
- uint16_t *b = CONVERT_TO_SHORTPTR(b8); \
- return highbd_12_masked_variancewxh_ssse3(a, a_stride, b, b_stride, m, \
- m_stride, W, H, sse); \
- }
-
-HIGHBD_MASKED_VARWXH(4, 4)
-HIGHBD_MASKED_VARWXH(4, 8)
-HIGHBD_MASKED_VARWXH(8, 4)
-HIGHBD_MASKED_VARWXH(8, 8)
-HIGHBD_MASKED_VARWXH(8, 16)
-HIGHBD_MASKED_VARWXH(16, 8)
-HIGHBD_MASKED_VARWXH(16, 16)
-HIGHBD_MASKED_VARWXH(16, 32)
-HIGHBD_MASKED_VARWXH(32, 16)
-HIGHBD_MASKED_VARWXH(32, 32)
-HIGHBD_MASKED_VARWXH(32, 64)
-HIGHBD_MASKED_VARWXH(64, 32)
-HIGHBD_MASKED_VARWXH(64, 64)
-#if CONFIG_EXT_PARTITION
-HIGHBD_MASKED_VARWXH(64, 128)
-HIGHBD_MASKED_VARWXH(128, 64)
-HIGHBD_MASKED_VARWXH(128, 128)
-#endif // CONFIG_EXT_PARTITION
-
+MASK_SUBPIX_VAR_SSSE3(128, 128)
+MASK_SUBPIX_VAR_SSSE3(128, 64)
+MASK_SUBPIX_VAR_SSSE3(64, 128)
#endif
-
-//////////////////////////////////////////////////////////////////////////////
-// Sub pixel versions
-//////////////////////////////////////////////////////////////////////////////
-
-typedef __m128i (*filter_fn_t)(__m128i v_a_b, __m128i v_b_b,
- __m128i v_filter_b);
-
-static INLINE __m128i apply_filter_avg(const __m128i v_a_b, const __m128i v_b_b,
- const __m128i v_filter_b) {
- (void)v_filter_b;
- return _mm_avg_epu8(v_a_b, v_b_b);
-}
-
-static INLINE __m128i apply_filter(const __m128i v_a_b, const __m128i v_b_b,
- const __m128i v_filter_b) {
- const __m128i v_rounding_w = _mm_set1_epi16(1 << (FILTER_BITS - 1));
- __m128i v_input_lo_b = _mm_unpacklo_epi8(v_a_b, v_b_b);
- __m128i v_input_hi_b = _mm_unpackhi_epi8(v_a_b, v_b_b);
- __m128i v_temp0_w = _mm_maddubs_epi16(v_input_lo_b, v_filter_b);
- __m128i v_temp1_w = _mm_maddubs_epi16(v_input_hi_b, v_filter_b);
- __m128i v_res_lo_w =
- _mm_srai_epi16(_mm_add_epi16(v_temp0_w, v_rounding_w), FILTER_BITS);
- __m128i v_res_hi_w =
- _mm_srai_epi16(_mm_add_epi16(v_temp1_w, v_rounding_w), FILTER_BITS);
- return _mm_packus_epi16(v_res_lo_w, v_res_hi_w);
-}
-
-// Apply the filter to the contents of the lower half of a and b
-static INLINE void apply_filter_lo(const __m128i v_a_lo_b,
- const __m128i v_b_lo_b,
- const __m128i v_filter_b, __m128i *v_res_w) {
- const __m128i v_rounding_w = _mm_set1_epi16(1 << (FILTER_BITS - 1));
- __m128i v_input_b = _mm_unpacklo_epi8(v_a_lo_b, v_b_lo_b);
- __m128i v_temp0_w = _mm_maddubs_epi16(v_input_b, v_filter_b);
- *v_res_w =
- _mm_srai_epi16(_mm_add_epi16(v_temp0_w, v_rounding_w), FILTER_BITS);
-}
-
-static void sum_and_sse(const __m128i v_a_b, const __m128i v_b_b,
- const __m128i v_m_b, __m128i *v_sum_d,
- __m128i *v_sse_q) {
- const __m128i v_zero = _mm_setzero_si128();
- // Unpack to 16 bits - still containing max 8 bits
- const __m128i v_a0_w = _mm_unpacklo_epi8(v_a_b, v_zero);
- const __m128i v_b0_w = _mm_unpacklo_epi8(v_b_b, v_zero);
- const __m128i v_m0_w = _mm_unpacklo_epi8(v_m_b, v_zero);
- const __m128i v_a1_w = _mm_unpackhi_epi8(v_a_b, v_zero);
- const __m128i v_b1_w = _mm_unpackhi_epi8(v_b_b, v_zero);
- const __m128i v_m1_w = _mm_unpackhi_epi8(v_m_b, v_zero);
-
- // Difference: [-255, 255]
- const __m128i v_d0_w = _mm_sub_epi16(v_a0_w, v_b0_w);
- const __m128i v_d1_w = _mm_sub_epi16(v_a1_w, v_b1_w);
-
- // Error - [-255, 255] * [0, 64] = [0xc040, 0x3fc0] => fits in 15 bits
- const __m128i v_e0_w = _mm_mullo_epi16(v_d0_w, v_m0_w);
- const __m128i v_e0_d = _mm_madd_epi16(v_d0_w, v_m0_w);
- const __m128i v_e1_w = _mm_mullo_epi16(v_d1_w, v_m1_w);
- const __m128i v_e1_d = _mm_madd_epi16(v_d1_w, v_m1_w);
-
- // Squared error - using madd it's max (15 bits * 15 bits) * 2 = 31 bits
- const __m128i v_se0_d = _mm_madd_epi16(v_e0_w, v_e0_w);
- const __m128i v_se1_d = _mm_madd_epi16(v_e1_w, v_e1_w);
-
- // Sum of v_se{0,1}_d - 31 bits + 31 bits = 32 bits
- const __m128i v_se_d = _mm_add_epi32(v_se0_d, v_se1_d);
-
- // Unpack Squared error to 64 bits
- const __m128i v_se_lo_q = _mm_unpacklo_epi32(v_se_d, v_zero);
- const __m128i v_se_hi_q = _mm_unpackhi_epi32(v_se_d, v_zero);
-
- // Accumulate
- *v_sum_d = _mm_add_epi32(*v_sum_d, v_e0_d);
- *v_sum_d = _mm_add_epi32(*v_sum_d, v_e1_d);
- *v_sse_q = _mm_add_epi64(*v_sse_q, v_se_lo_q);
- *v_sse_q = _mm_add_epi64(*v_sse_q, v_se_hi_q);
-}
-
-// Functions for width (W) >= 16
-unsigned int aom_masked_subpel_varWxH_xzero(const uint8_t *src, int src_stride,
- int yoffset, const uint8_t *dst,
- int dst_stride, const uint8_t *msk,
- int msk_stride, unsigned int *sse,
- int w, int h,
- filter_fn_t filter_fn) {
+MASK_SUBPIX_VAR_SSSE3(64, 64)
+MASK_SUBPIX_VAR_SSSE3(64, 32)
+MASK_SUBPIX_VAR_SSSE3(32, 64)
+MASK_SUBPIX_VAR_SSSE3(32, 32)
+MASK_SUBPIX_VAR_SSSE3(32, 16)
+MASK_SUBPIX_VAR_SSSE3(16, 32)
+MASK_SUBPIX_VAR_SSSE3(16, 16)
+MASK_SUBPIX_VAR_SSSE3(16, 8)
+MASK_SUBPIX_VAR8XH_SSSE3(16)
+MASK_SUBPIX_VAR8XH_SSSE3(8)
+MASK_SUBPIX_VAR8XH_SSSE3(4)
+MASK_SUBPIX_VAR4XH_SSSE3(8)
+MASK_SUBPIX_VAR4XH_SSSE3(4)
+
+static INLINE __m128i filter_block(const __m128i a, const __m128i b,
+ const __m128i filter) {
+ __m128i v0 = _mm_unpacklo_epi8(a, b);
+ v0 = _mm_maddubs_epi16(v0, filter);
+ v0 = xx_roundn_epu16(v0, FILTER_BITS);
+
+ __m128i v1 = _mm_unpackhi_epi8(a, b);
+ v1 = _mm_maddubs_epi16(v1, filter);
+ v1 = xx_roundn_epu16(v1, FILTER_BITS);
+
+ return _mm_packus_epi16(v0, v1);
+}
+
+static void bilinear_filter(const uint8_t *src, int src_stride, int xoffset,
+ int yoffset, uint8_t *dst, int w, int h) {
int i, j;
- __m128i v_src0_b, v_src1_b, v_res_b, v_dst_b, v_msk_b;
- __m128i v_sum_d = _mm_setzero_si128();
- __m128i v_sse_q = _mm_setzero_si128();
- const __m128i v_filter_b = _mm_set1_epi16(
- (bilinear_filters_2t[yoffset][1] << 8) + bilinear_filters_2t[yoffset][0]);
- assert(yoffset < BIL_SUBPEL_SHIFTS);
- for (j = 0; j < w; j += 16) {
- // Load the first row ready
- v_src0_b = _mm_loadu_si128((const __m128i *)(src + j));
- // Process 2 rows at a time
- for (i = 0; i < h; i += 2) {
- // Load the next row apply the filter
- v_src1_b = _mm_loadu_si128((const __m128i *)(src + j + src_stride));
- v_res_b = filter_fn(v_src0_b, v_src1_b, v_filter_b);
- // Load the dst and msk for the variance calculation
- v_dst_b = _mm_loadu_si128((const __m128i *)(dst + j));
- v_msk_b = _mm_loadu_si128((const __m128i *)(msk + j));
- sum_and_sse(v_res_b, v_dst_b, v_msk_b, &v_sum_d, &v_sse_q);
-
- // Load the next row apply the filter
- v_src0_b = _mm_loadu_si128((const __m128i *)(src + j + src_stride * 2));
- v_res_b = filter_fn(v_src1_b, v_src0_b, v_filter_b);
- // Load the dst and msk for the variance calculation
- v_dst_b = _mm_loadu_si128((const __m128i *)(dst + j + dst_stride));
- v_msk_b = _mm_loadu_si128((const __m128i *)(msk + j + msk_stride));
- sum_and_sse(v_res_b, v_dst_b, v_msk_b, &v_sum_d, &v_sse_q);
- // Move onto the next block of rows
- src += src_stride * 2;
- dst += dst_stride * 2;
- msk += msk_stride * 2;
+ // Horizontal filter
+ if (xoffset == 0) {
+ uint8_t *b = dst;
+ for (i = 0; i < h + 1; ++i) {
+ for (j = 0; j < w; j += 16) {
+ __m128i x = _mm_loadu_si128((__m128i *)&src[j]);
+ _mm_storeu_si128((__m128i *)&b[j], x);
+ }
+ src += src_stride;
+ b += w;
}
- // Reset to the top of the block
- src -= src_stride * h;
- dst -= dst_stride * h;
- msk -= msk_stride * h;
- }
- return calc_masked_variance(v_sum_d, v_sse_q, sse, w, h);
-}
-unsigned int aom_masked_subpel_varWxH_yzero(const uint8_t *src, int src_stride,
- int xoffset, const uint8_t *dst,
- int dst_stride, const uint8_t *msk,
- int msk_stride, unsigned int *sse,
- int w, int h,
- filter_fn_t filter_fn) {
- int i, j;
- __m128i v_src0_b, v_src1_b, v_res_b, v_dst_b, v_msk_b;
- __m128i v_sum_d = _mm_setzero_si128();
- __m128i v_sse_q = _mm_setzero_si128();
- const __m128i v_filter_b = _mm_set1_epi16(
- (bilinear_filters_2t[xoffset][1] << 8) + bilinear_filters_2t[xoffset][0]);
- assert(xoffset < BIL_SUBPEL_SHIFTS);
- for (i = 0; i < h; i++) {
- for (j = 0; j < w; j += 16) {
- // Load this row and one below & apply the filter to them
- v_src0_b = _mm_loadu_si128((const __m128i *)(src + j));
- v_src1_b = _mm_loadu_si128((const __m128i *)(src + j + 1));
- v_res_b = filter_fn(v_src0_b, v_src1_b, v_filter_b);
-
- // Load the dst and msk for the variance calculation
- v_dst_b = _mm_loadu_si128((const __m128i *)(dst + j));
- v_msk_b = _mm_loadu_si128((const __m128i *)(msk + j));
- sum_and_sse(v_res_b, v_dst_b, v_msk_b, &v_sum_d, &v_sse_q);
+ } else if (xoffset == 4) {
+ uint8_t *b = dst;
+ for (i = 0; i < h + 1; ++i) {
+ for (j = 0; j < w; j += 16) {
+ __m128i x = _mm_loadu_si128((__m128i *)&src[j]);
+ __m128i y = _mm_loadu_si128((__m128i *)&src[j + 16]);
+ __m128i z = _mm_alignr_epi8(y, x, 1);
+ _mm_storeu_si128((__m128i *)&b[j], _mm_avg_epu8(x, z));
+ }
+ src += src_stride;
+ b += w;
}
- src += src_stride;
- dst += dst_stride;
- msk += msk_stride;
- }
- return calc_masked_variance(v_sum_d, v_sse_q, sse, w, h);
-}
-unsigned int aom_masked_subpel_varWxH_xnonzero_ynonzero(
- const uint8_t *src, int src_stride, int xoffset, int yoffset,
- const uint8_t *dst, int dst_stride, const uint8_t *msk, int msk_stride,
- unsigned int *sse, int w, int h, filter_fn_t xfilter_fn,
- filter_fn_t yfilter_fn) {
- int i, j;
- __m128i v_src0_b, v_src1_b, v_src2_b, v_src3_b;
- __m128i v_filtered0_b, v_filtered1_b, v_res_b, v_dst_b, v_msk_b;
- __m128i v_sum_d = _mm_setzero_si128();
- __m128i v_sse_q = _mm_setzero_si128();
- const __m128i v_filterx_b = _mm_set1_epi16(
- (bilinear_filters_2t[xoffset][1] << 8) + bilinear_filters_2t[xoffset][0]);
- const __m128i v_filtery_b = _mm_set1_epi16(
- (bilinear_filters_2t[yoffset][1] << 8) + bilinear_filters_2t[yoffset][0]);
- assert(yoffset < BIL_SUBPEL_SHIFTS);
- assert(xoffset < BIL_SUBPEL_SHIFTS);
- for (j = 0; j < w; j += 16) {
- // Load the first row ready
- v_src0_b = _mm_loadu_si128((const __m128i *)(src + j));
- v_src1_b = _mm_loadu_si128((const __m128i *)(src + j + 1));
- v_filtered0_b = xfilter_fn(v_src0_b, v_src1_b, v_filterx_b);
- // Process 2 rows at a time
- for (i = 0; i < h; i += 2) {
- // Load the next row & apply the filter
- v_src2_b = _mm_loadu_si128((const __m128i *)(src + src_stride + j));
- v_src3_b = _mm_loadu_si128((const __m128i *)(src + src_stride + j + 1));
- v_filtered1_b = xfilter_fn(v_src2_b, v_src3_b, v_filterx_b);
- // Load the dst and msk for the variance calculation
- v_dst_b = _mm_loadu_si128((const __m128i *)(dst + j));
- v_msk_b = _mm_loadu_si128((const __m128i *)(msk + j));
- // Complete the calculation for this row and add it to the running total
- v_res_b = yfilter_fn(v_filtered0_b, v_filtered1_b, v_filtery_b);
- sum_and_sse(v_res_b, v_dst_b, v_msk_b, &v_sum_d, &v_sse_q);
-
- // Load the next row & apply the filter
- v_src0_b = _mm_loadu_si128((const __m128i *)(src + src_stride * 2 + j));
- v_src1_b =
- _mm_loadu_si128((const __m128i *)(src + src_stride * 2 + j + 1));
- v_filtered0_b = xfilter_fn(v_src0_b, v_src1_b, v_filterx_b);
- // Load the dst and msk for the variance calculation
- v_dst_b = _mm_loadu_si128((const __m128i *)(dst + dst_stride + j));
- v_msk_b = _mm_loadu_si128((const __m128i *)(msk + msk_stride + j));
- // Complete the calculation for this row and add it to the running total
- v_res_b = yfilter_fn(v_filtered1_b, v_filtered0_b, v_filtery_b);
- sum_and_sse(v_res_b, v_dst_b, v_msk_b, &v_sum_d, &v_sse_q);
- // Move onto the next block of rows
- src += src_stride * 2;
- dst += dst_stride * 2;
- msk += msk_stride * 2;
+ } else {
+ uint8_t *b = dst;
+ const uint8_t *hfilter = bilinear_filters_2t[xoffset];
+ const __m128i hfilter_vec = _mm_set1_epi16(hfilter[0] | (hfilter[1] << 8));
+ for (i = 0; i < h + 1; ++i) {
+ for (j = 0; j < w; j += 16) {
+ const __m128i x = _mm_loadu_si128((__m128i *)&src[j]);
+ const __m128i y = _mm_loadu_si128((__m128i *)&src[j + 16]);
+ const __m128i z = _mm_alignr_epi8(y, x, 1);
+ const __m128i res = filter_block(x, z, hfilter_vec);
+ _mm_storeu_si128((__m128i *)&b[j], res);
+ }
+
+ src += src_stride;
+ b += w;
}
- // Reset to the top of the block
- src -= src_stride * h;
- dst -= dst_stride * h;
- msk -= msk_stride * h;
}
- return calc_masked_variance(v_sum_d, v_sse_q, sse, w, h);
-}
-// Note order in which rows loaded xmm[127:96] = row 1, xmm[95:64] = row 2,
-// xmm[63:32] = row 3, xmm[31:0] = row 4
-unsigned int aom_masked_subpel_var4xH_xzero(const uint8_t *src, int src_stride,
- int yoffset, const uint8_t *dst,
- int dst_stride, const uint8_t *msk,
- int msk_stride, unsigned int *sse,
- int h) {
- int i;
- __m128i v_src0_b, v_src1_b, v_src2_b, v_src3_b, v_filtered1_w, v_filtered2_w;
- __m128i v_dst0_b, v_dst1_b, v_dst2_b, v_dst3_b;
- __m128i v_msk0_b, v_msk1_b, v_msk2_b, v_msk3_b, v_res_b;
- __m128i v_sum_d = _mm_setzero_si128();
- __m128i v_sse_q = _mm_setzero_si128();
- __m128i v_filter_b = _mm_set1_epi16((bilinear_filters_2t[yoffset][1] << 8) +
- bilinear_filters_2t[yoffset][0]);
- assert(yoffset < BIL_SUBPEL_SHIFTS);
- // Load the first row of src data ready
- v_src0_b = _mm_loadl_epi64((const __m128i *)src);
- for (i = 0; i < h; i += 4) {
- // Load the rest of the source data for these rows
- v_src1_b = _mm_loadl_epi64((const __m128i *)(src + src_stride * 1));
- v_src1_b = _mm_unpacklo_epi32(v_src1_b, v_src0_b);
- v_src2_b = _mm_loadl_epi64((const __m128i *)(src + src_stride * 2));
- v_src3_b = _mm_loadl_epi64((const __m128i *)(src + src_stride * 3));
- v_src3_b = _mm_unpacklo_epi32(v_src3_b, v_src2_b);
- v_src0_b = _mm_loadl_epi64((const __m128i *)(src + src_stride * 4));
- // Load the dst data
- v_dst0_b = _mm_cvtsi32_si128(*(const uint32_t *)(dst + dst_stride * 0));
- v_dst1_b = _mm_cvtsi32_si128(*(const uint32_t *)(dst + dst_stride * 1));
- v_dst0_b = _mm_unpacklo_epi32(v_dst1_b, v_dst0_b);
- v_dst2_b = _mm_cvtsi32_si128(*(const uint32_t *)(dst + dst_stride * 2));
- v_dst3_b = _mm_cvtsi32_si128(*(const uint32_t *)(dst + dst_stride * 3));
- v_dst2_b = _mm_unpacklo_epi32(v_dst3_b, v_dst2_b);
- v_dst0_b = _mm_unpacklo_epi64(v_dst2_b, v_dst0_b);
- // Load the mask data
- v_msk0_b = _mm_cvtsi32_si128(*(const uint32_t *)(msk + msk_stride * 0));
- v_msk1_b = _mm_cvtsi32_si128(*(const uint32_t *)(msk + msk_stride * 1));
- v_msk0_b = _mm_unpacklo_epi32(v_msk1_b, v_msk0_b);
- v_msk2_b = _mm_cvtsi32_si128(*(const uint32_t *)(msk + msk_stride * 2));
- v_msk3_b = _mm_cvtsi32_si128(*(const uint32_t *)(msk + msk_stride * 3));
- v_msk2_b = _mm_unpacklo_epi32(v_msk3_b, v_msk2_b);
- v_msk0_b = _mm_unpacklo_epi64(v_msk2_b, v_msk0_b);
- // Apply the y filter
- if (yoffset == HALF_PIXEL_OFFSET) {
- v_src1_b = _mm_unpacklo_epi64(v_src3_b, v_src1_b);
- v_src2_b =
- _mm_or_si128(_mm_slli_si128(v_src1_b, 4),
- _mm_and_si128(v_src0_b, _mm_setr_epi32(-1, 0, 0, 0)));
- v_res_b = _mm_avg_epu8(v_src1_b, v_src2_b);
- } else {
- v_src2_b =
- _mm_or_si128(_mm_slli_si128(v_src1_b, 4),
- _mm_and_si128(v_src2_b, _mm_setr_epi32(-1, 0, 0, 0)));
- apply_filter_lo(v_src1_b, v_src2_b, v_filter_b, &v_filtered1_w);
- v_src2_b =
- _mm_or_si128(_mm_slli_si128(v_src3_b, 4),
- _mm_and_si128(v_src0_b, _mm_setr_epi32(-1, 0, 0, 0)));
- apply_filter_lo(v_src3_b, v_src2_b, v_filter_b, &v_filtered2_w);
- v_res_b = _mm_packus_epi16(v_filtered2_w, v_filtered1_w);
+ // Vertical filter
+ if (yoffset == 0) {
+ // The data is already in 'dst', so no need to filter
+ } else if (yoffset == 4) {
+ for (i = 0; i < h; ++i) {
+ for (j = 0; j < w; j += 16) {
+ __m128i x = _mm_loadu_si128((__m128i *)&dst[j]);
+ __m128i y = _mm_loadu_si128((__m128i *)&dst[j + w]);
+ _mm_storeu_si128((__m128i *)&dst[j], _mm_avg_epu8(x, y));
+ }
+ dst += w;
}
- // Compute the sum and SSE
- sum_and_sse(v_res_b, v_dst0_b, v_msk0_b, &v_sum_d, &v_sse_q);
- // Move onto the next set of rows
- src += src_stride * 4;
- dst += dst_stride * 4;
- msk += msk_stride * 4;
- }
- return calc_masked_variance(v_sum_d, v_sse_q, sse, 4, h);
-}
-
-// Note order in which rows loaded xmm[127:64] = row 1, xmm[63:0] = row 2
-unsigned int aom_masked_subpel_var8xH_xzero(const uint8_t *src, int src_stride,
- int yoffset, const uint8_t *dst,
- int dst_stride, const uint8_t *msk,
- int msk_stride, unsigned int *sse,
- int h) {
- int i;
- __m128i v_src0_b, v_src1_b, v_filtered0_w, v_filtered1_w, v_res_b;
- __m128i v_dst_b = _mm_setzero_si128();
- __m128i v_msk_b = _mm_setzero_si128();
- __m128i v_sum_d = _mm_setzero_si128();
- __m128i v_sse_q = _mm_setzero_si128();
- __m128i v_filter_b = _mm_set1_epi16((bilinear_filters_2t[yoffset][1] << 8) +
- bilinear_filters_2t[yoffset][0]);
- assert(yoffset < BIL_SUBPEL_SHIFTS);
- // Load the first row of src data ready
- v_src0_b = _mm_loadl_epi64((const __m128i *)src);
- for (i = 0; i < h; i += 2) {
- if (yoffset == HALF_PIXEL_OFFSET) {
- // Load the rest of the source data for these rows
- v_src1_b = _mm_or_si128(
- _mm_slli_si128(v_src0_b, 8),
- _mm_loadl_epi64((const __m128i *)(src + src_stride * 1)));
- v_src0_b = _mm_or_si128(
- _mm_slli_si128(v_src1_b, 8),
- _mm_loadl_epi64((const __m128i *)(src + src_stride * 2)));
- // Apply the y filter
- v_res_b = _mm_avg_epu8(v_src1_b, v_src0_b);
- } else {
- // Load the data and apply the y filter
- v_src1_b = _mm_loadl_epi64((const __m128i *)(src + src_stride * 1));
- apply_filter_lo(v_src0_b, v_src1_b, v_filter_b, &v_filtered0_w);
- v_src0_b = _mm_loadl_epi64((const __m128i *)(src + src_stride * 2));
- apply_filter_lo(v_src1_b, v_src0_b, v_filter_b, &v_filtered1_w);
- v_res_b = _mm_packus_epi16(v_filtered1_w, v_filtered0_w);
+ } else {
+ const uint8_t *vfilter = bilinear_filters_2t[yoffset];
+ const __m128i vfilter_vec = _mm_set1_epi16(vfilter[0] | (vfilter[1] << 8));
+ for (i = 0; i < h; ++i) {
+ for (j = 0; j < w; j += 16) {
+ const __m128i x = _mm_loadu_si128((__m128i *)&dst[j]);
+ const __m128i y = _mm_loadu_si128((__m128i *)&dst[j + w]);
+ const __m128i res = filter_block(x, y, vfilter_vec);
+ _mm_storeu_si128((__m128i *)&dst[j], res);
+ }
+
+ dst += w;
}
- // Load the dst data
- v_dst_b = _mm_unpacklo_epi64(
- _mm_loadl_epi64((const __m128i *)(dst + dst_stride * 1)),
- _mm_loadl_epi64((const __m128i *)(dst + dst_stride * 0)));
- // Load the mask data
- v_msk_b = _mm_unpacklo_epi64(
- _mm_loadl_epi64((const __m128i *)(msk + msk_stride * 1)),
- _mm_loadl_epi64((const __m128i *)(msk + msk_stride * 0)));
- // Compute the sum and SSE
- sum_and_sse(v_res_b, v_dst_b, v_msk_b, &v_sum_d, &v_sse_q);
- // Move onto the next set of rows
- src += src_stride * 2;
- dst += dst_stride * 2;
- msk += msk_stride * 2;
}
- return calc_masked_variance(v_sum_d, v_sse_q, sse, 8, h);
}
-// Note order in which rows loaded xmm[127:96] = row 1, xmm[95:64] = row 2,
-// xmm[63:32] = row 3, xmm[31:0] = row 4
-unsigned int aom_masked_subpel_var4xH_yzero(const uint8_t *src, int src_stride,
- int xoffset, const uint8_t *dst,
- int dst_stride, const uint8_t *msk,
- int msk_stride, unsigned int *sse,
- int h) {
- int i;
- __m128i v_src0_b, v_src1_b, v_src2_b, v_src3_b, v_filtered0_w, v_filtered2_w;
- __m128i v_src0_shift_b, v_src1_shift_b, v_src2_shift_b, v_src3_shift_b;
- __m128i v_dst0_b, v_dst1_b, v_dst2_b, v_dst3_b;
- __m128i v_msk0_b, v_msk1_b, v_msk2_b, v_msk3_b, v_res_b;
- __m128i v_sum_d = _mm_setzero_si128();
- __m128i v_sse_q = _mm_setzero_si128();
- __m128i v_filter_b = _mm_set1_epi16((bilinear_filters_2t[xoffset][1] << 8) +
- bilinear_filters_2t[xoffset][0]);
- assert(xoffset < BIL_SUBPEL_SHIFTS);
- for (i = 0; i < h; i += 4) {
- // Load the src data
- v_src0_b = _mm_loadl_epi64((const __m128i *)src);
- v_src0_shift_b = _mm_srli_si128(v_src0_b, 1);
- v_src1_b = _mm_loadl_epi64((const __m128i *)(src + src_stride * 1));
- v_src0_b = _mm_unpacklo_epi32(v_src1_b, v_src0_b);
- v_src1_shift_b = _mm_srli_si128(v_src1_b, 1);
- v_src2_b = _mm_loadl_epi64((const __m128i *)(src + src_stride * 2));
- v_src0_shift_b = _mm_unpacklo_epi32(v_src1_shift_b, v_src0_shift_b);
- v_src2_shift_b = _mm_srli_si128(v_src2_b, 1);
- v_src3_b = _mm_loadl_epi64((const __m128i *)(src + src_stride * 3));
- v_src2_b = _mm_unpacklo_epi32(v_src3_b, v_src2_b);
- v_src3_shift_b = _mm_srli_si128(v_src3_b, 1);
- v_src2_shift_b = _mm_unpacklo_epi32(v_src3_shift_b, v_src2_shift_b);
- // Load the dst data
- v_dst0_b = _mm_cvtsi32_si128(*(const uint32_t *)(dst + dst_stride * 0));
- v_dst1_b = _mm_cvtsi32_si128(*(const uint32_t *)(dst + dst_stride * 1));
- v_dst0_b = _mm_unpacklo_epi32(v_dst1_b, v_dst0_b);
- v_dst2_b = _mm_cvtsi32_si128(*(const uint32_t *)(dst + dst_stride * 2));
- v_dst3_b = _mm_cvtsi32_si128(*(const uint32_t *)(dst + dst_stride * 3));
- v_dst2_b = _mm_unpacklo_epi32(v_dst3_b, v_dst2_b);
- v_dst0_b = _mm_unpacklo_epi64(v_dst2_b, v_dst0_b);
- // Load the mask data
- v_msk0_b = _mm_cvtsi32_si128(*(const uint32_t *)(msk + msk_stride * 0));
- v_msk1_b = _mm_cvtsi32_si128(*(const uint32_t *)(msk + msk_stride * 1));
- v_msk0_b = _mm_unpacklo_epi32(v_msk1_b, v_msk0_b);
- v_msk2_b = _mm_cvtsi32_si128(*(const uint32_t *)(msk + msk_stride * 2));
- v_msk3_b = _mm_cvtsi32_si128(*(const uint32_t *)(msk + msk_stride * 3));
- v_msk2_b = _mm_unpacklo_epi32(v_msk3_b, v_msk2_b);
- v_msk0_b = _mm_unpacklo_epi64(v_msk2_b, v_msk0_b);
- // Apply the x filter
- if (xoffset == HALF_PIXEL_OFFSET) {
- v_src0_b = _mm_unpacklo_epi64(v_src2_b, v_src0_b);
- v_src0_shift_b = _mm_unpacklo_epi64(v_src2_shift_b, v_src0_shift_b);
- v_res_b = _mm_avg_epu8(v_src0_b, v_src0_shift_b);
- } else {
- apply_filter_lo(v_src0_b, v_src0_shift_b, v_filter_b, &v_filtered0_w);
- apply_filter_lo(v_src2_b, v_src2_shift_b, v_filter_b, &v_filtered2_w);
- v_res_b = _mm_packus_epi16(v_filtered2_w, v_filtered0_w);
- }
- // Compute the sum and SSE
- sum_and_sse(v_res_b, v_dst0_b, v_msk0_b, &v_sum_d, &v_sse_q);
- // Move onto the next set of rows
- src += src_stride * 4;
- dst += dst_stride * 4;
- msk += msk_stride * 4;
- }
- return calc_masked_variance(v_sum_d, v_sse_q, sse, 4, h);
-}
+static INLINE __m128i filter_block_2rows(const __m128i a0, const __m128i b0,
+ const __m128i a1, const __m128i b1,
+ const __m128i filter) {
+ __m128i v0 = _mm_unpacklo_epi8(a0, b0);
+ v0 = _mm_maddubs_epi16(v0, filter);
+ v0 = xx_roundn_epu16(v0, FILTER_BITS);
-unsigned int aom_masked_subpel_var8xH_yzero(const uint8_t *src, int src_stride,
- int xoffset, const uint8_t *dst,
- int dst_stride, const uint8_t *msk,
- int msk_stride, unsigned int *sse,
- int h) {
- int i;
- __m128i v_src0_b, v_src1_b, v_filtered0_w, v_filtered1_w;
- __m128i v_src0_shift_b, v_src1_shift_b, v_res_b, v_dst_b, v_msk_b;
- __m128i v_sum_d = _mm_setzero_si128();
- __m128i v_sse_q = _mm_setzero_si128();
- __m128i v_filter_b = _mm_set1_epi16((bilinear_filters_2t[xoffset][1] << 8) +
- bilinear_filters_2t[xoffset][0]);
- assert(xoffset < BIL_SUBPEL_SHIFTS);
- for (i = 0; i < h; i += 2) {
- // Load the src data
- v_src0_b = _mm_loadu_si128((const __m128i *)(src));
- v_src0_shift_b = _mm_srli_si128(v_src0_b, 1);
- v_src1_b = _mm_loadu_si128((const __m128i *)(src + src_stride));
- v_src1_shift_b = _mm_srli_si128(v_src1_b, 1);
- // Apply the x filter
- if (xoffset == HALF_PIXEL_OFFSET) {
- v_src1_b = _mm_unpacklo_epi64(v_src0_b, v_src1_b);
- v_src1_shift_b = _mm_unpacklo_epi64(v_src0_shift_b, v_src1_shift_b);
- v_res_b = _mm_avg_epu8(v_src1_b, v_src1_shift_b);
- } else {
- apply_filter_lo(v_src0_b, v_src0_shift_b, v_filter_b, &v_filtered0_w);
- apply_filter_lo(v_src1_b, v_src1_shift_b, v_filter_b, &v_filtered1_w);
- v_res_b = _mm_packus_epi16(v_filtered0_w, v_filtered1_w);
- }
- // Load the dst data
- v_dst_b = _mm_unpacklo_epi64(
- _mm_loadl_epi64((const __m128i *)(dst + dst_stride * 0)),
- _mm_loadl_epi64((const __m128i *)(dst + dst_stride * 1)));
- // Load the mask data
- v_msk_b = _mm_unpacklo_epi64(
- _mm_loadl_epi64((const __m128i *)(msk + msk_stride * 0)),
- _mm_loadl_epi64((const __m128i *)(msk + msk_stride * 1)));
- // Compute the sum and SSE
- sum_and_sse(v_res_b, v_dst_b, v_msk_b, &v_sum_d, &v_sse_q);
- // Move onto the next set of rows
- src += src_stride * 2;
- dst += dst_stride * 2;
- msk += msk_stride * 2;
- }
- return calc_masked_variance(v_sum_d, v_sse_q, sse, 8, h);
+ __m128i v1 = _mm_unpacklo_epi8(a1, b1);
+ v1 = _mm_maddubs_epi16(v1, filter);
+ v1 = xx_roundn_epu16(v1, FILTER_BITS);
+
+ return _mm_packus_epi16(v0, v1);
}
-// Note order in which rows loaded xmm[127:96] = row 1, xmm[95:64] = row 2,
-// xmm[63:32] = row 3, xmm[31:0] = row 4
-unsigned int aom_masked_subpel_var4xH_xnonzero_ynonzero(
- const uint8_t *src, int src_stride, int xoffset, int yoffset,
- const uint8_t *dst, int dst_stride, const uint8_t *msk, int msk_stride,
- unsigned int *sse, int h) {
+static void bilinear_filter8xh(const uint8_t *src, int src_stride, int xoffset,
+ int yoffset, uint8_t *dst, int h) {
int i;
- __m128i v_src0_b, v_src1_b, v_src2_b, v_src3_b, v_filtered0_w, v_filtered2_w;
- __m128i v_src0_shift_b, v_src1_shift_b, v_src2_shift_b, v_src3_shift_b;
- __m128i v_dst0_b, v_dst1_b, v_dst2_b, v_dst3_b, v_temp_b;
- __m128i v_msk0_b, v_msk1_b, v_msk2_b, v_msk3_b, v_extra_row_b, v_res_b;
- __m128i v_xres_b[2];
- __m128i v_sum_d = _mm_setzero_si128();
- __m128i v_sse_q = _mm_setzero_si128();
- __m128i v_filterx_b = _mm_set1_epi16((bilinear_filters_2t[xoffset][1] << 8) +
- bilinear_filters_2t[xoffset][0]);
- __m128i v_filtery_b = _mm_set1_epi16((bilinear_filters_2t[yoffset][1] << 8) +
- bilinear_filters_2t[yoffset][0]);
- assert(xoffset < BIL_SUBPEL_SHIFTS);
- assert(yoffset < BIL_SUBPEL_SHIFTS);
- for (i = 0; i < h; i += 4) {
- // Load the src data
- v_src0_b = _mm_loadl_epi64((const __m128i *)src);
- v_src0_shift_b = _mm_srli_si128(v_src0_b, 1);
- v_src1_b = _mm_loadl_epi64((const __m128i *)(src + src_stride * 1));
- v_src0_b = _mm_unpacklo_epi32(v_src1_b, v_src0_b);
- v_src1_shift_b = _mm_srli_si128(v_src1_b, 1);
- v_src2_b = _mm_loadl_epi64((const __m128i *)(src + src_stride * 2));
- v_src0_shift_b = _mm_unpacklo_epi32(v_src1_shift_b, v_src0_shift_b);
- v_src2_shift_b = _mm_srli_si128(v_src2_b, 1);
- v_src3_b = _mm_loadl_epi64((const __m128i *)(src + src_stride * 3));
- v_src2_b = _mm_unpacklo_epi32(v_src3_b, v_src2_b);
- v_src3_shift_b = _mm_srli_si128(v_src3_b, 1);
- v_src2_shift_b = _mm_unpacklo_epi32(v_src3_shift_b, v_src2_shift_b);
- // Apply the x filter
- if (xoffset == HALF_PIXEL_OFFSET) {
- v_src0_b = _mm_unpacklo_epi64(v_src2_b, v_src0_b);
- v_src0_shift_b = _mm_unpacklo_epi64(v_src2_shift_b, v_src0_shift_b);
- v_xres_b[i == 0 ? 0 : 1] = _mm_avg_epu8(v_src0_b, v_src0_shift_b);
- } else {
- apply_filter_lo(v_src0_b, v_src0_shift_b, v_filterx_b, &v_filtered0_w);
- apply_filter_lo(v_src2_b, v_src2_shift_b, v_filterx_b, &v_filtered2_w);
- v_xres_b[i == 0 ? 0 : 1] = _mm_packus_epi16(v_filtered2_w, v_filtered0_w);
+ // Horizontal filter
+ if (xoffset == 0) {
+ uint8_t *b = dst;
+ for (i = 0; i < h + 1; ++i) {
+ __m128i x = _mm_loadl_epi64((__m128i *)src);
+ _mm_storel_epi64((__m128i *)b, x);
+ src += src_stride;
+ b += 8;
+ }
+ } else if (xoffset == 4) {
+ uint8_t *b = dst;
+ for (i = 0; i < h + 1; ++i) {
+ __m128i x = _mm_loadu_si128((__m128i *)src);
+ __m128i z = _mm_srli_si128(x, 1);
+ _mm_storel_epi64((__m128i *)b, _mm_avg_epu8(x, z));
+ src += src_stride;
+ b += 8;
}
- // Move onto the next set of rows
- src += src_stride * 4;
- }
- // Load one more row to be used in the y filter
- v_src0_b = _mm_loadl_epi64((const __m128i *)src);
- v_src0_shift_b = _mm_srli_si128(v_src0_b, 1);
- // Apply the x filter
- if (xoffset == HALF_PIXEL_OFFSET) {
- v_extra_row_b = _mm_and_si128(_mm_avg_epu8(v_src0_b, v_src0_shift_b),
- _mm_setr_epi32(-1, 0, 0, 0));
} else {
- apply_filter_lo(v_src0_b, v_src0_shift_b, v_filterx_b, &v_filtered0_w);
- v_extra_row_b =
- _mm_and_si128(_mm_packus_epi16(v_filtered0_w, _mm_setzero_si128()),
- _mm_setr_epi32(-1, 0, 0, 0));
- }
+ uint8_t *b = dst;
+ const uint8_t *hfilter = bilinear_filters_2t[xoffset];
+ const __m128i hfilter_vec = _mm_set1_epi16(hfilter[0] | (hfilter[1] << 8));
+ for (i = 0; i < h; i += 2) {
+ const __m128i x0 = _mm_loadu_si128((__m128i *)src);
+ const __m128i z0 = _mm_srli_si128(x0, 1);
+ const __m128i x1 = _mm_loadu_si128((__m128i *)&src[src_stride]);
+ const __m128i z1 = _mm_srli_si128(x1, 1);
+ const __m128i res = filter_block_2rows(x0, z0, x1, z1, hfilter_vec);
+ _mm_storeu_si128((__m128i *)b, res);
- for (i = 0; i < h; i += 4) {
- if (h == 8 && i == 0) {
- v_temp_b = _mm_or_si128(_mm_slli_si128(v_xres_b[0], 4),
- _mm_srli_si128(v_xres_b[1], 12));
- } else {
- v_temp_b = _mm_or_si128(_mm_slli_si128(v_xres_b[i == 0 ? 0 : 1], 4),
- v_extra_row_b);
+ src += src_stride * 2;
+ b += 16;
}
- // Apply the y filter
- if (yoffset == HALF_PIXEL_OFFSET) {
- v_res_b = _mm_avg_epu8(v_xres_b[i == 0 ? 0 : 1], v_temp_b);
- } else {
- v_res_b = apply_filter(v_xres_b[i == 0 ? 0 : 1], v_temp_b, v_filtery_b);
+ // Handle i = h separately
+ const __m128i x0 = _mm_loadu_si128((__m128i *)src);
+ const __m128i z0 = _mm_srli_si128(x0, 1);
+
+ __m128i v0 = _mm_unpacklo_epi8(x0, z0);
+ v0 = _mm_maddubs_epi16(v0, hfilter_vec);
+ v0 = xx_roundn_epu16(v0, FILTER_BITS);
+
+ _mm_storel_epi64((__m128i *)b, _mm_packus_epi16(v0, v0));
+ }
+
+ // Vertical filter
+ if (yoffset == 0) {
+ // The data is already in 'dst', so no need to filter
+ } else if (yoffset == 4) {
+ for (i = 0; i < h; ++i) {
+ __m128i x = _mm_loadl_epi64((__m128i *)dst);
+ __m128i y = _mm_loadl_epi64((__m128i *)&dst[8]);
+ _mm_storel_epi64((__m128i *)dst, _mm_avg_epu8(x, y));
+ dst += 8;
}
+ } else {
+ const uint8_t *vfilter = bilinear_filters_2t[yoffset];
+ const __m128i vfilter_vec = _mm_set1_epi16(vfilter[0] | (vfilter[1] << 8));
+ for (i = 0; i < h; i += 2) {
+ const __m128i x = _mm_loadl_epi64((__m128i *)dst);
+ const __m128i y = _mm_loadl_epi64((__m128i *)&dst[8]);
+ const __m128i z = _mm_loadl_epi64((__m128i *)&dst[16]);
+ const __m128i res = filter_block_2rows(x, y, y, z, vfilter_vec);
+ _mm_storeu_si128((__m128i *)dst, res);
- // Load the dst data
- v_dst0_b = _mm_cvtsi32_si128(*(const uint32_t *)(dst + dst_stride * 0));
- v_dst1_b = _mm_cvtsi32_si128(*(const uint32_t *)(dst + dst_stride * 1));
- v_dst0_b = _mm_unpacklo_epi32(v_dst1_b, v_dst0_b);
- v_dst2_b = _mm_cvtsi32_si128(*(const uint32_t *)(dst + dst_stride * 2));
- v_dst3_b = _mm_cvtsi32_si128(*(const uint32_t *)(dst + dst_stride * 3));
- v_dst2_b = _mm_unpacklo_epi32(v_dst3_b, v_dst2_b);
- v_dst0_b = _mm_unpacklo_epi64(v_dst2_b, v_dst0_b);
- // Load the mask data
- v_msk0_b = _mm_cvtsi32_si128(*(const uint32_t *)(msk + msk_stride * 0));
- v_msk1_b = _mm_cvtsi32_si128(*(const uint32_t *)(msk + msk_stride * 1));
- v_msk0_b = _mm_unpacklo_epi32(v_msk1_b, v_msk0_b);
- v_msk2_b = _mm_cvtsi32_si128(*(const uint32_t *)(msk + msk_stride * 2));
- v_msk3_b = _mm_cvtsi32_si128(*(const uint32_t *)(msk + msk_stride * 3));
- v_msk2_b = _mm_unpacklo_epi32(v_msk3_b, v_msk2_b);
- v_msk0_b = _mm_unpacklo_epi64(v_msk2_b, v_msk0_b);
- // Compute the sum and SSE
- sum_and_sse(v_res_b, v_dst0_b, v_msk0_b, &v_sum_d, &v_sse_q);
- // Move onto the next set of rows
- dst += dst_stride * 4;
- msk += msk_stride * 4;
+ dst += 16;
+ }
}
- return calc_masked_variance(v_sum_d, v_sse_q, sse, 4, h);
}
-unsigned int aom_masked_subpel_var8xH_xnonzero_ynonzero(
- const uint8_t *src, int src_stride, int xoffset, int yoffset,
- const uint8_t *dst, int dst_stride, const uint8_t *msk, int msk_stride,
- unsigned int *sse, int h) {
+static void bilinear_filter4xh(const uint8_t *src, int src_stride, int xoffset,
+ int yoffset, uint8_t *dst, int h) {
int i;
- __m128i v_src0_b, v_src1_b, v_filtered0_w, v_filtered1_w, v_dst_b, v_msk_b;
- __m128i v_src0_shift_b, v_src1_shift_b;
- __m128i v_xres0_b, v_xres1_b, v_res_b, v_temp_b;
- __m128i v_sum_d = _mm_setzero_si128();
- __m128i v_sse_q = _mm_setzero_si128();
- __m128i v_filterx_b = _mm_set1_epi16((bilinear_filters_2t[xoffset][1] << 8) +
- bilinear_filters_2t[xoffset][0]);
- __m128i v_filtery_b = _mm_set1_epi16((bilinear_filters_2t[yoffset][1] << 8) +
- bilinear_filters_2t[yoffset][0]);
- assert(xoffset < BIL_SUBPEL_SHIFTS);
- assert(yoffset < BIL_SUBPEL_SHIFTS);
- // Load the first block of src data
- v_src0_b = _mm_loadu_si128((const __m128i *)(src));
- v_src0_shift_b = _mm_srli_si128(v_src0_b, 1);
- v_src1_b = _mm_loadu_si128((const __m128i *)(src + src_stride));
- v_src1_shift_b = _mm_srli_si128(v_src1_b, 1);
- // Apply the x filter
- if (xoffset == HALF_PIXEL_OFFSET) {
- v_src1_b = _mm_unpacklo_epi64(v_src0_b, v_src1_b);
- v_src1_shift_b = _mm_unpacklo_epi64(v_src0_shift_b, v_src1_shift_b);
- v_xres0_b = _mm_avg_epu8(v_src1_b, v_src1_shift_b);
- } else {
- apply_filter_lo(v_src0_b, v_src0_shift_b, v_filterx_b, &v_filtered0_w);
- apply_filter_lo(v_src1_b, v_src1_shift_b, v_filterx_b, &v_filtered1_w);
- v_xres0_b = _mm_packus_epi16(v_filtered0_w, v_filtered1_w);
- }
- for (i = 0; i < h; i += 4) {
- // Load the next block of src data
- v_src0_b = _mm_loadu_si128((const __m128i *)(src + src_stride * 2));
- v_src0_shift_b = _mm_srli_si128(v_src0_b, 1);
- v_src1_b = _mm_loadu_si128((const __m128i *)(src + src_stride * 3));
- v_src1_shift_b = _mm_srli_si128(v_src1_b, 1);
- // Apply the x filter
- if (xoffset == HALF_PIXEL_OFFSET) {
- v_src1_b = _mm_unpacklo_epi64(v_src0_b, v_src1_b);
- v_src1_shift_b = _mm_unpacklo_epi64(v_src0_shift_b, v_src1_shift_b);
- v_xres1_b = _mm_avg_epu8(v_src1_b, v_src1_shift_b);
- } else {
- apply_filter_lo(v_src0_b, v_src0_shift_b, v_filterx_b, &v_filtered0_w);
- apply_filter_lo(v_src1_b, v_src1_shift_b, v_filterx_b, &v_filtered1_w);
- v_xres1_b = _mm_packus_epi16(v_filtered0_w, v_filtered1_w);
+ // Horizontal filter
+ if (xoffset == 0) {
+ uint8_t *b = dst;
+ for (i = 0; i < h + 1; ++i) {
+ __m128i x = xx_loadl_32((__m128i *)src);
+ xx_storel_32((__m128i *)b, x);
+ src += src_stride;
+ b += 4;
}
- // Apply the y filter to the previous block
- v_temp_b = _mm_or_si128(_mm_srli_si128(v_xres0_b, 8),
- _mm_slli_si128(v_xres1_b, 8));
- if (yoffset == HALF_PIXEL_OFFSET) {
- v_res_b = _mm_avg_epu8(v_xres0_b, v_temp_b);
- } else {
- v_res_b = apply_filter(v_xres0_b, v_temp_b, v_filtery_b);
+ } else if (xoffset == 4) {
+ uint8_t *b = dst;
+ for (i = 0; i < h + 1; ++i) {
+ __m128i x = _mm_loadl_epi64((__m128i *)src);
+ __m128i z = _mm_srli_si128(x, 1);
+ xx_storel_32((__m128i *)b, _mm_avg_epu8(x, z));
+ src += src_stride;
+ b += 4;
}
- // Load the dst data
- v_dst_b = _mm_unpacklo_epi64(
- _mm_loadl_epi64((const __m128i *)(dst + dst_stride * 0)),
- _mm_loadl_epi64((const __m128i *)(dst + dst_stride * 1)));
- // Load the mask data
- v_msk_b = _mm_unpacklo_epi64(
- _mm_loadl_epi64((const __m128i *)(msk + msk_stride * 0)),
- _mm_loadl_epi64((const __m128i *)(msk + msk_stride * 1)));
- // Compute the sum and SSE
- sum_and_sse(v_res_b, v_dst_b, v_msk_b, &v_sum_d, &v_sse_q);
-
- // Load the next block of src data
- v_src0_b = _mm_loadu_si128((const __m128i *)(src + src_stride * 4));
- v_src0_shift_b = _mm_srli_si128(v_src0_b, 1);
- v_src1_b = _mm_loadu_si128((const __m128i *)(src + src_stride * 5));
- v_src1_shift_b = _mm_srli_si128(v_src1_b, 1);
- // Apply the x filter
- if (xoffset == HALF_PIXEL_OFFSET) {
- v_src1_b = _mm_unpacklo_epi64(v_src0_b, v_src1_b);
- v_src1_shift_b = _mm_unpacklo_epi64(v_src0_shift_b, v_src1_shift_b);
- v_xres0_b = _mm_avg_epu8(v_src1_b, v_src1_shift_b);
- } else {
- apply_filter_lo(v_src0_b, v_src0_shift_b, v_filterx_b, &v_filtered0_w);
- apply_filter_lo(v_src1_b, v_src1_shift_b, v_filterx_b, &v_filtered1_w);
- v_xres0_b = _mm_packus_epi16(v_filtered0_w, v_filtered1_w);
+ } else {
+ uint8_t *b = dst;
+ const uint8_t *hfilter = bilinear_filters_2t[xoffset];
+ const __m128i hfilter_vec = _mm_set1_epi16(hfilter[0] | (hfilter[1] << 8));
+ for (i = 0; i < h; i += 4) {
+ const __m128i x0 = _mm_loadl_epi64((__m128i *)src);
+ const __m128i z0 = _mm_srli_si128(x0, 1);
+ const __m128i x1 = _mm_loadl_epi64((__m128i *)&src[src_stride]);
+ const __m128i z1 = _mm_srli_si128(x1, 1);
+ const __m128i x2 = _mm_loadl_epi64((__m128i *)&src[src_stride * 2]);
+ const __m128i z2 = _mm_srli_si128(x2, 1);
+ const __m128i x3 = _mm_loadl_epi64((__m128i *)&src[src_stride * 3]);
+ const __m128i z3 = _mm_srli_si128(x3, 1);
+
+ const __m128i a0 = _mm_unpacklo_epi32(x0, x1);
+ const __m128i b0 = _mm_unpacklo_epi32(z0, z1);
+ const __m128i a1 = _mm_unpacklo_epi32(x2, x3);
+ const __m128i b1 = _mm_unpacklo_epi32(z2, z3);
+ const __m128i res = filter_block_2rows(a0, b0, a1, b1, hfilter_vec);
+ _mm_storeu_si128((__m128i *)b, res);
+
+ src += src_stride * 4;
+ b += 16;
}
- // Apply the y filter to the previous block
- v_temp_b = _mm_or_si128(_mm_srli_si128(v_xres1_b, 8),
- _mm_slli_si128(v_xres0_b, 8));
- if (yoffset == HALF_PIXEL_OFFSET) {
- v_res_b = _mm_avg_epu8(v_xres1_b, v_temp_b);
- } else {
- v_res_b = apply_filter(v_xres1_b, v_temp_b, v_filtery_b);
+ // Handle i = h separately
+ const __m128i x = _mm_loadl_epi64((__m128i *)src);
+ const __m128i z = _mm_srli_si128(x, 1);
+
+ __m128i v0 = _mm_unpacklo_epi8(x, z);
+ v0 = _mm_maddubs_epi16(v0, hfilter_vec);
+ v0 = xx_roundn_epu16(v0, FILTER_BITS);
+
+ xx_storel_32((__m128i *)b, _mm_packus_epi16(v0, v0));
+ }
+
+ // Vertical filter
+ if (yoffset == 0) {
+ // The data is already in 'dst', so no need to filter
+ } else if (yoffset == 4) {
+ for (i = 0; i < h; ++i) {
+ __m128i x = xx_loadl_32((__m128i *)dst);
+ __m128i y = xx_loadl_32((__m128i *)&dst[4]);
+ xx_storel_32((__m128i *)dst, _mm_avg_epu8(x, y));
+ dst += 4;
+ }
+ } else {
+ const uint8_t *vfilter = bilinear_filters_2t[yoffset];
+ const __m128i vfilter_vec = _mm_set1_epi16(vfilter[0] | (vfilter[1] << 8));
+ for (i = 0; i < h; i += 4) {
+ const __m128i a = xx_loadl_32((__m128i *)dst);
+ const __m128i b = xx_loadl_32((__m128i *)&dst[4]);
+ const __m128i c = xx_loadl_32((__m128i *)&dst[8]);
+ const __m128i d = xx_loadl_32((__m128i *)&dst[12]);
+ const __m128i e = xx_loadl_32((__m128i *)&dst[16]);
+
+ const __m128i a0 = _mm_unpacklo_epi32(a, b);
+ const __m128i b0 = _mm_unpacklo_epi32(b, c);
+ const __m128i a1 = _mm_unpacklo_epi32(c, d);
+ const __m128i b1 = _mm_unpacklo_epi32(d, e);
+ const __m128i res = filter_block_2rows(a0, b0, a1, b1, vfilter_vec);
+ _mm_storeu_si128((__m128i *)dst, res);
+
+ dst += 16;
}
- // Load the dst data
- v_dst_b = _mm_unpacklo_epi64(
- _mm_loadl_epi64((const __m128i *)(dst + dst_stride * 2)),
- _mm_loadl_epi64((const __m128i *)(dst + dst_stride * 3)));
- // Load the mask data
- v_msk_b = _mm_unpacklo_epi64(
- _mm_loadl_epi64((const __m128i *)(msk + msk_stride * 2)),
- _mm_loadl_epi64((const __m128i *)(msk + msk_stride * 3)));
- // Compute the sum and SSE
- sum_and_sse(v_res_b, v_dst_b, v_msk_b, &v_sum_d, &v_sse_q);
- // Move onto the next set of rows
- src += src_stride * 4;
- dst += dst_stride * 4;
- msk += msk_stride * 4;
- }
- return calc_masked_variance(v_sum_d, v_sse_q, sse, 8, h);
-}
-
-// For W >=16
-#define MASK_SUBPIX_VAR_LARGE(W, H) \
- unsigned int aom_masked_sub_pixel_variance##W##x##H##_ssse3( \
- const uint8_t *src, int src_stride, int xoffset, int yoffset, \
- const uint8_t *dst, int dst_stride, const uint8_t *msk, int msk_stride, \
- unsigned int *sse) { \
- assert(W % 16 == 0); \
- if (xoffset == 0) { \
- if (yoffset == 0) \
- return aom_masked_variance##W##x##H##_ssse3( \
- src, src_stride, dst, dst_stride, msk, msk_stride, sse); \
- else if (yoffset == HALF_PIXEL_OFFSET) \
- return aom_masked_subpel_varWxH_xzero( \
- src, src_stride, HALF_PIXEL_OFFSET, dst, dst_stride, msk, \
- msk_stride, sse, W, H, apply_filter_avg); \
- else \
- return aom_masked_subpel_varWxH_xzero(src, src_stride, yoffset, dst, \
- dst_stride, msk, msk_stride, \
- sse, W, H, apply_filter); \
- } else if (yoffset == 0) { \
- if (xoffset == HALF_PIXEL_OFFSET) \
- return aom_masked_subpel_varWxH_yzero( \
- src, src_stride, HALF_PIXEL_OFFSET, dst, dst_stride, msk, \
- msk_stride, sse, W, H, apply_filter_avg); \
- else \
- return aom_masked_subpel_varWxH_yzero(src, src_stride, xoffset, dst, \
- dst_stride, msk, msk_stride, \
- sse, W, H, apply_filter); \
- } else if (xoffset == HALF_PIXEL_OFFSET) { \
- if (yoffset == HALF_PIXEL_OFFSET) \
- return aom_masked_subpel_varWxH_xnonzero_ynonzero( \
- src, src_stride, HALF_PIXEL_OFFSET, HALF_PIXEL_OFFSET, dst, \
- dst_stride, msk, msk_stride, sse, W, H, apply_filter_avg, \
- apply_filter_avg); \
- else \
- return aom_masked_subpel_varWxH_xnonzero_ynonzero( \
- src, src_stride, HALF_PIXEL_OFFSET, yoffset, dst, dst_stride, msk, \
- msk_stride, sse, W, H, apply_filter_avg, apply_filter); \
- } else { \
- if (yoffset == HALF_PIXEL_OFFSET) \
- return aom_masked_subpel_varWxH_xnonzero_ynonzero( \
- src, src_stride, xoffset, HALF_PIXEL_OFFSET, dst, dst_stride, msk, \
- msk_stride, sse, W, H, apply_filter, apply_filter_avg); \
- else \
- return aom_masked_subpel_varWxH_xnonzero_ynonzero( \
- src, src_stride, xoffset, yoffset, dst, dst_stride, msk, \
- msk_stride, sse, W, H, apply_filter, apply_filter); \
- } \
- }
-
-// For W < 16
-#define MASK_SUBPIX_VAR_SMALL(W, H) \
- unsigned int aom_masked_sub_pixel_variance##W##x##H##_ssse3( \
- const uint8_t *src, int src_stride, int xoffset, int yoffset, \
- const uint8_t *dst, int dst_stride, const uint8_t *msk, int msk_stride, \
- unsigned int *sse) { \
- assert(W == 4 || W == 8); \
- if (xoffset == 0 && yoffset == 0) \
- return aom_masked_variance##W##x##H##_ssse3( \
- src, src_stride, dst, dst_stride, msk, msk_stride, sse); \
- else if (xoffset == 0) \
- return aom_masked_subpel_var##W##xH_xzero( \
- src, src_stride, yoffset, dst, dst_stride, msk, msk_stride, sse, H); \
- else if (yoffset == 0) \
- return aom_masked_subpel_var##W##xH_yzero( \
- src, src_stride, xoffset, dst, dst_stride, msk, msk_stride, sse, H); \
- else \
- return aom_masked_subpel_var##W##xH_xnonzero_ynonzero( \
- src, src_stride, xoffset, yoffset, dst, dst_stride, msk, msk_stride, \
- sse, H); \
}
-
-MASK_SUBPIX_VAR_SMALL(4, 4)
-MASK_SUBPIX_VAR_SMALL(4, 8)
-MASK_SUBPIX_VAR_SMALL(8, 4)
-MASK_SUBPIX_VAR_SMALL(8, 8)
-MASK_SUBPIX_VAR_SMALL(8, 16)
-MASK_SUBPIX_VAR_LARGE(16, 8)
-MASK_SUBPIX_VAR_LARGE(16, 16)
-MASK_SUBPIX_VAR_LARGE(16, 32)
-MASK_SUBPIX_VAR_LARGE(32, 16)
-MASK_SUBPIX_VAR_LARGE(32, 32)
-MASK_SUBPIX_VAR_LARGE(32, 64)
-MASK_SUBPIX_VAR_LARGE(64, 32)
-MASK_SUBPIX_VAR_LARGE(64, 64)
-#if CONFIG_EXT_PARTITION
-MASK_SUBPIX_VAR_LARGE(64, 128)
-MASK_SUBPIX_VAR_LARGE(128, 64)
-MASK_SUBPIX_VAR_LARGE(128, 128)
-#endif // CONFIG_EXT_PARTITION
-
-#if CONFIG_HIGHBITDEPTH
-typedef uint32_t (*highbd_calc_masked_var_t)(__m128i v_sum_d, __m128i v_sse_q,
- uint32_t *sse, int w, int h);
-typedef unsigned int (*highbd_variance_fn_t)(const uint8_t *a8, int a_stride,
- const uint8_t *b8, int b_stride,
- const uint8_t *m, int m_stride,
- unsigned int *sse);
-typedef __m128i (*highbd_filter_fn_t)(__m128i v_a_w, __m128i v_b_w,
- __m128i v_filter_w);
-
-static INLINE __m128i highbd_apply_filter_avg(const __m128i v_a_w,
- const __m128i v_b_w,
- const __m128i v_filter_w) {
- (void)v_filter_w;
- return _mm_avg_epu16(v_a_w, v_b_w);
}
-static INLINE __m128i highbd_apply_filter(const __m128i v_a_w,
- const __m128i v_b_w,
- const __m128i v_filter_w) {
- const __m128i v_rounding_d = _mm_set1_epi32(1 << (FILTER_BITS - 1));
- __m128i v_input_lo_w = _mm_unpacklo_epi16(v_a_w, v_b_w);
- __m128i v_input_hi_w = _mm_unpackhi_epi16(v_a_w, v_b_w);
- __m128i v_temp0_d = _mm_madd_epi16(v_input_lo_w, v_filter_w);
- __m128i v_temp1_d = _mm_madd_epi16(v_input_hi_w, v_filter_w);
- __m128i v_res_lo_d =
- _mm_srai_epi32(_mm_add_epi32(v_temp0_d, v_rounding_d), FILTER_BITS);
- __m128i v_res_hi_d =
- _mm_srai_epi32(_mm_add_epi32(v_temp1_d, v_rounding_d), FILTER_BITS);
- return _mm_packs_epi32(v_res_lo_d, v_res_hi_d);
-}
-// Apply the filter to the contents of the lower half of a and b
-static INLINE void highbd_apply_filter_lo(const __m128i v_a_lo_w,
- const __m128i v_b_lo_w,
- const __m128i v_filter_w,
- __m128i *v_res_d) {
- const __m128i v_rounding_d = _mm_set1_epi32(1 << (FILTER_BITS - 1));
- __m128i v_input_w = _mm_unpacklo_epi16(v_a_lo_w, v_b_lo_w);
- __m128i v_temp0_d = _mm_madd_epi16(v_input_w, v_filter_w);
- *v_res_d =
- _mm_srai_epi32(_mm_add_epi32(v_temp0_d, v_rounding_d), FILTER_BITS);
-}
+static INLINE void accumulate_block(const __m128i src, const __m128i a,
+ const __m128i b, const __m128i m,
+ __m128i *sum, __m128i *sum_sq) {
+ const __m128i zero = _mm_setzero_si128();
+ const __m128i one = _mm_set1_epi16(1);
+ const __m128i mask_max = _mm_set1_epi8((1 << AOM_BLEND_A64_ROUND_BITS));
+ const __m128i m_inv = _mm_sub_epi8(mask_max, m);
+
+ // Calculate 16 predicted pixels.
+ // Note that the maximum value of any entry of 'pred_l' or 'pred_r'
+ // is 64 * 255, so we have plenty of space to add rounding constants.
+ const __m128i data_l = _mm_unpacklo_epi8(a, b);
+ const __m128i mask_l = _mm_unpacklo_epi8(m, m_inv);
+ __m128i pred_l = _mm_maddubs_epi16(data_l, mask_l);
+ pred_l = xx_roundn_epu16(pred_l, AOM_BLEND_A64_ROUND_BITS);
+
+ const __m128i data_r = _mm_unpackhi_epi8(a, b);
+ const __m128i mask_r = _mm_unpackhi_epi8(m, m_inv);
+ __m128i pred_r = _mm_maddubs_epi16(data_r, mask_r);
+ pred_r = xx_roundn_epu16(pred_r, AOM_BLEND_A64_ROUND_BITS);
+
+ const __m128i src_l = _mm_unpacklo_epi8(src, zero);
+ const __m128i src_r = _mm_unpackhi_epi8(src, zero);
+ const __m128i diff_l = _mm_sub_epi16(pred_l, src_l);
+ const __m128i diff_r = _mm_sub_epi16(pred_r, src_r);
+
+ // Update partial sums and partial sums of squares
+ *sum =
+ _mm_add_epi32(*sum, _mm_madd_epi16(_mm_add_epi16(diff_l, diff_r), one));
+ *sum_sq =
+ _mm_add_epi32(*sum_sq, _mm_add_epi32(_mm_madd_epi16(diff_l, diff_l),
+ _mm_madd_epi16(diff_r, diff_r)));
+}
+
+static void masked_variance(const uint8_t *src_ptr, int src_stride,
+ const uint8_t *a_ptr, int a_stride,
+ const uint8_t *b_ptr, int b_stride,
+ const uint8_t *m_ptr, int m_stride, int width,
+ int height, unsigned int *sse, int *sum_) {
+ int x, y;
+ __m128i sum = _mm_setzero_si128(), sum_sq = _mm_setzero_si128();
+
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width; x += 16) {
+ const __m128i src = _mm_loadu_si128((const __m128i *)&src_ptr[x]);
+ const __m128i a = _mm_loadu_si128((const __m128i *)&a_ptr[x]);
+ const __m128i b = _mm_loadu_si128((const __m128i *)&b_ptr[x]);
+ const __m128i m = _mm_loadu_si128((const __m128i *)&m_ptr[x]);
+ accumulate_block(src, a, b, m, &sum, &sum_sq);
+ }
-static void highbd_sum_and_sse(const __m128i v_a_w, const __m128i v_b_w,
- const __m128i v_m_b, __m128i *v_sum_d,
- __m128i *v_sse_q) {
- const __m128i v_zero = _mm_setzero_si128();
- const __m128i v_m_w = _mm_unpacklo_epi8(v_m_b, v_zero);
-
- // Difference: [-2^12, 2^12] => 13 bits (incld sign bit)
- const __m128i v_d_w = _mm_sub_epi16(v_a_w, v_b_w);
-
- // Error - [-4095, 4095] * [0, 64] & sum pairs => fits in 19 + 1 bits
- const __m128i v_e_d = _mm_madd_epi16(v_d_w, v_m_w);
-
- // Squared error - max (18 bits * 18 bits) = 36 bits (no sign bit)
- const __m128i v_absd_w = _mm_abs_epi16(v_d_w);
- const __m128i v_dlo_d = _mm_unpacklo_epi16(v_absd_w, v_zero);
- const __m128i v_mlo_d = _mm_unpacklo_epi16(v_m_w, v_zero);
- const __m128i v_elo_d = _mm_madd_epi16(v_dlo_d, v_mlo_d);
- const __m128i v_dhi_d = _mm_unpackhi_epi16(v_absd_w, v_zero);
- const __m128i v_mhi_d = _mm_unpackhi_epi16(v_m_w, v_zero);
- const __m128i v_ehi_d = _mm_madd_epi16(v_dhi_d, v_mhi_d);
- // Square and sum the errors -> 36bits * 4 = 38bits
- __m128i v_se0_q, v_se1_q, v_se2_q, v_se3_q, v_se_q, v_elo1_d, v_ehi3_d;
- v_se0_q = _mm_mul_epu32(v_elo_d, v_elo_d);
- v_elo1_d = _mm_srli_si128(v_elo_d, 4);
- v_se1_q = _mm_mul_epu32(v_elo1_d, v_elo1_d);
- v_se0_q = _mm_add_epi64(v_se0_q, v_se1_q);
- v_se2_q = _mm_mul_epu32(v_ehi_d, v_ehi_d);
- v_ehi3_d = _mm_srli_si128(v_ehi_d, 4);
- v_se3_q = _mm_mul_epu32(v_ehi3_d, v_ehi3_d);
- v_se1_q = _mm_add_epi64(v_se2_q, v_se3_q);
- v_se_q = _mm_add_epi64(v_se0_q, v_se1_q);
-
- // Accumulate
- *v_sum_d = _mm_add_epi32(*v_sum_d, v_e_d);
- *v_sse_q = _mm_add_epi64(*v_sse_q, v_se_q);
+ src_ptr += src_stride;
+ a_ptr += a_stride;
+ b_ptr += b_stride;
+ m_ptr += m_stride;
+ }
+ // Reduce down to a single sum and sum of squares
+ sum = _mm_hadd_epi32(sum, sum_sq);
+ sum = _mm_hadd_epi32(sum, sum);
+ *sum_ = _mm_cvtsi128_si32(sum);
+ *sse = _mm_cvtsi128_si32(_mm_srli_si128(sum, 4));
+}
+
+static void masked_variance8xh(const uint8_t *src_ptr, int src_stride,
+ const uint8_t *a_ptr, const uint8_t *b_ptr,
+ const uint8_t *m_ptr, int m_stride, int height,
+ unsigned int *sse, int *sum_) {
+ int y;
+ __m128i sum = _mm_setzero_si128(), sum_sq = _mm_setzero_si128();
+
+ for (y = 0; y < height; y += 2) {
+ __m128i src = _mm_unpacklo_epi64(
+ _mm_loadl_epi64((const __m128i *)src_ptr),
+ _mm_loadl_epi64((const __m128i *)&src_ptr[src_stride]));
+ const __m128i a = _mm_loadu_si128((const __m128i *)a_ptr);
+ const __m128i b = _mm_loadu_si128((const __m128i *)b_ptr);
+ const __m128i m =
+ _mm_unpacklo_epi64(_mm_loadl_epi64((const __m128i *)m_ptr),
+ _mm_loadl_epi64((const __m128i *)&m_ptr[m_stride]));
+ accumulate_block(src, a, b, m, &sum, &sum_sq);
+
+ src_ptr += src_stride * 2;
+ a_ptr += 16;
+ b_ptr += 16;
+ m_ptr += m_stride * 2;
+ }
+ // Reduce down to a single sum and sum of squares
+ sum = _mm_hadd_epi32(sum, sum_sq);
+ sum = _mm_hadd_epi32(sum, sum);
+ *sum_ = _mm_cvtsi128_si32(sum);
+ *sse = _mm_cvtsi128_si32(_mm_srli_si128(sum, 4));
+}
+
+static void masked_variance4xh(const uint8_t *src_ptr, int src_stride,
+ const uint8_t *a_ptr, const uint8_t *b_ptr,
+ const uint8_t *m_ptr, int m_stride, int height,
+ unsigned int *sse, int *sum_) {
+ int y;
+ __m128i sum = _mm_setzero_si128(), sum_sq = _mm_setzero_si128();
+
+ for (y = 0; y < height; y += 4) {
+ // Load four rows at a time
+ __m128i src =
+ _mm_setr_epi32(*(uint32_t *)src_ptr, *(uint32_t *)&src_ptr[src_stride],
+ *(uint32_t *)&src_ptr[src_stride * 2],
+ *(uint32_t *)&src_ptr[src_stride * 3]);
+ const __m128i a = _mm_loadu_si128((const __m128i *)a_ptr);
+ const __m128i b = _mm_loadu_si128((const __m128i *)b_ptr);
+ const __m128i m = _mm_setr_epi32(
+ *(uint32_t *)m_ptr, *(uint32_t *)&m_ptr[m_stride],
+ *(uint32_t *)&m_ptr[m_stride * 2], *(uint32_t *)&m_ptr[m_stride * 3]);
+ accumulate_block(src, a, b, m, &sum, &sum_sq);
+
+ src_ptr += src_stride * 4;
+ a_ptr += 16;
+ b_ptr += 16;
+ m_ptr += m_stride * 4;
+ }
+ // Reduce down to a single sum and sum of squares
+ sum = _mm_hadd_epi32(sum, sum_sq);
+ sum = _mm_hadd_epi32(sum, sum);
+ *sum_ = _mm_cvtsi128_si32(sum);
+ *sse = _mm_cvtsi128_si32(_mm_srli_si128(sum, 4));
}
-static INLINE uint32_t highbd_10_calc_masked_variance(__m128i v_sum_d,
- __m128i v_sse_q,
- uint32_t *sse, int w,
- int h) {
- int64_t sum64;
- uint64_t sse64;
-
- // Horizontal sum
- sum64 = hsum_epi32_si32(v_sum_d);
- sse64 = hsum_epi64_si64(v_sse_q);
-
- sum64 = (sum64 >= 0) ? sum64 : -sum64;
-
- // Round
- sum64 = ROUND_POWER_OF_TWO(sum64, 6);
- sse64 = ROUND_POWER_OF_TWO(sse64, 12);
-
- // Normalise
- sum64 = ROUND_POWER_OF_TWO(sum64, 2);
- sse64 = ROUND_POWER_OF_TWO(sse64, 4);
-
- // Store the SSE
- *sse = (uint32_t)sse64;
- // Compute the variance
- return *sse - (uint32_t)((sum64 * sum64) / (w * h));
-}
-static INLINE uint32_t highbd_12_calc_masked_variance(__m128i v_sum_d,
- __m128i v_sse_q,
- uint32_t *sse, int w,
- int h) {
- int64_t sum64;
- uint64_t sse64;
-
- // Horizontal sum
- sum64 = hsum_epi32_si64(v_sum_d);
- sse64 = hsum_epi64_si64(v_sse_q);
-
- sum64 = (sum64 >= 0) ? sum64 : -sum64;
-
- // Round
- sum64 = ROUND_POWER_OF_TWO(sum64, 6);
- sse64 = ROUND_POWER_OF_TWO(sse64, 12);
-
- // Normalise
- sum64 = ROUND_POWER_OF_TWO(sum64, 4);
- sse64 = ROUND_POWER_OF_TWO(sse64, 8);
-
- // Store the SSE
- *sse = (uint32_t)sse64;
- // Compute the variance
- return *sse - (uint32_t)((sum64 * sum64) / (w * h));
-}
+#if CONFIG_HIGHBITDEPTH
+// For width a multiple of 8
+static void highbd_bilinear_filter(const uint16_t *src, int src_stride,
+ int xoffset, int yoffset, uint16_t *dst,
+ int w, int h);
+
+static void highbd_bilinear_filter4xh(const uint16_t *src, int src_stride,
+ int xoffset, int yoffset, uint16_t *dst,
+ int h);
+
+// For width a multiple of 8
+static void highbd_masked_variance(const uint16_t *src_ptr, int src_stride,
+ const uint16_t *a_ptr, int a_stride,
+ const uint16_t *b_ptr, int b_stride,
+ const uint8_t *m_ptr, int m_stride,
+ int width, int height, uint64_t *sse,
+ int *sum_);
+
+static void highbd_masked_variance4xh(const uint16_t *src_ptr, int src_stride,
+ const uint16_t *a_ptr,
+ const uint16_t *b_ptr,
+ const uint8_t *m_ptr, int m_stride,
+ int height, int *sse, int *sum_);
+
+#define HIGHBD_MASK_SUBPIX_VAR_SSSE3(W, H) \
+ unsigned int aom_highbd_8_masked_sub_pixel_variance##W##x##H##_ssse3( \
+ const uint8_t *src8, int src_stride, int xoffset, int yoffset, \
+ const uint8_t *ref8, int ref_stride, const uint8_t *second_pred8, \
+ const uint8_t *msk, int msk_stride, int invert_mask, uint32_t *sse) { \
+ uint64_t sse64; \
+ int sum; \
+ uint16_t temp[(H + 1) * W]; \
+ const uint16_t *src = CONVERT_TO_SHORTPTR(src8); \
+ const uint16_t *ref = CONVERT_TO_SHORTPTR(ref8); \
+ const uint16_t *second_pred = CONVERT_TO_SHORTPTR(second_pred8); \
+ \
+ highbd_bilinear_filter(src, src_stride, xoffset, yoffset, temp, W, H); \
+ \
+ if (!invert_mask) \
+ highbd_masked_variance(ref, ref_stride, temp, W, second_pred, W, msk, \
+ msk_stride, W, H, &sse64, &sum); \
+ else \
+ highbd_masked_variance(ref, ref_stride, second_pred, W, temp, W, msk, \
+ msk_stride, W, H, &sse64, &sum); \
+ *sse = (uint32_t)sse64; \
+ return *sse - (uint32_t)(((int64_t)sum * sum) / (W * H)); \
+ } \
+ unsigned int aom_highbd_10_masked_sub_pixel_variance##W##x##H##_ssse3( \
+ const uint8_t *src8, int src_stride, int xoffset, int yoffset, \
+ const uint8_t *ref8, int ref_stride, const uint8_t *second_pred8, \
+ const uint8_t *msk, int msk_stride, int invert_mask, uint32_t *sse) { \
+ uint64_t sse64; \
+ int sum; \
+ uint16_t temp[(H + 1) * W]; \
+ const uint16_t *src = CONVERT_TO_SHORTPTR(src8); \
+ const uint16_t *ref = CONVERT_TO_SHORTPTR(ref8); \
+ const uint16_t *second_pred = CONVERT_TO_SHORTPTR(second_pred8); \
+ \
+ highbd_bilinear_filter(src, src_stride, xoffset, yoffset, temp, W, H); \
+ \
+ if (!invert_mask) \
+ highbd_masked_variance(ref, ref_stride, temp, W, second_pred, W, msk, \
+ msk_stride, W, H, &sse64, &sum); \
+ else \
+ highbd_masked_variance(ref, ref_stride, second_pred, W, temp, W, msk, \
+ msk_stride, W, H, &sse64, &sum); \
+ *sse = (uint32_t)ROUND_POWER_OF_TWO(sse64, 4); \
+ sum = ROUND_POWER_OF_TWO(sum, 2); \
+ return *sse - (uint32_t)(((int64_t)sum * sum) / (W * H)); \
+ } \
+ unsigned int aom_highbd_12_masked_sub_pixel_variance##W##x##H##_ssse3( \
+ const uint8_t *src8, int src_stride, int xoffset, int yoffset, \
+ const uint8_t *ref8, int ref_stride, const uint8_t *second_pred8, \
+ const uint8_t *msk, int msk_stride, int invert_mask, uint32_t *sse) { \
+ uint64_t sse64; \
+ int sum; \
+ uint16_t temp[(H + 1) * W]; \
+ const uint16_t *src = CONVERT_TO_SHORTPTR(src8); \
+ const uint16_t *ref = CONVERT_TO_SHORTPTR(ref8); \
+ const uint16_t *second_pred = CONVERT_TO_SHORTPTR(second_pred8); \
+ \
+ highbd_bilinear_filter(src, src_stride, xoffset, yoffset, temp, W, H); \
+ \
+ if (!invert_mask) \
+ highbd_masked_variance(ref, ref_stride, temp, W, second_pred, W, msk, \
+ msk_stride, W, H, &sse64, &sum); \
+ else \
+ highbd_masked_variance(ref, ref_stride, second_pred, W, temp, W, msk, \
+ msk_stride, W, H, &sse64, &sum); \
+ *sse = (uint32_t)ROUND_POWER_OF_TWO(sse64, 8); \
+ sum = ROUND_POWER_OF_TWO(sum, 4); \
+ return *sse - (uint32_t)(((int64_t)sum * sum) / (W * H)); \
+ }
+
+#define HIGHBD_MASK_SUBPIX_VAR4XH_SSSE3(H) \
+ unsigned int aom_highbd_8_masked_sub_pixel_variance4x##H##_ssse3( \
+ const uint8_t *src8, int src_stride, int xoffset, int yoffset, \
+ const uint8_t *ref8, int ref_stride, const uint8_t *second_pred8, \
+ const uint8_t *msk, int msk_stride, int invert_mask, uint32_t *sse) { \
+ int sse_; \
+ int sum; \
+ uint16_t temp[(H + 1) * 4]; \
+ const uint16_t *src = CONVERT_TO_SHORTPTR(src8); \
+ const uint16_t *ref = CONVERT_TO_SHORTPTR(ref8); \
+ const uint16_t *second_pred = CONVERT_TO_SHORTPTR(second_pred8); \
+ \
+ highbd_bilinear_filter4xh(src, src_stride, xoffset, yoffset, temp, H); \
+ \
+ if (!invert_mask) \
+ highbd_masked_variance4xh(ref, ref_stride, temp, second_pred, msk, \
+ msk_stride, H, &sse_, &sum); \
+ else \
+ highbd_masked_variance4xh(ref, ref_stride, second_pred, temp, msk, \
+ msk_stride, H, &sse_, &sum); \
+ *sse = (uint32_t)sse_; \
+ return *sse - (uint32_t)(((int64_t)sum * sum) / (4 * H)); \
+ } \
+ unsigned int aom_highbd_10_masked_sub_pixel_variance4x##H##_ssse3( \
+ const uint8_t *src8, int src_stride, int xoffset, int yoffset, \
+ const uint8_t *ref8, int ref_stride, const uint8_t *second_pred8, \
+ const uint8_t *msk, int msk_stride, int invert_mask, uint32_t *sse) { \
+ int sse_; \
+ int sum; \
+ uint16_t temp[(H + 1) * 4]; \
+ const uint16_t *src = CONVERT_TO_SHORTPTR(src8); \
+ const uint16_t *ref = CONVERT_TO_SHORTPTR(ref8); \
+ const uint16_t *second_pred = CONVERT_TO_SHORTPTR(second_pred8); \
+ \
+ highbd_bilinear_filter4xh(src, src_stride, xoffset, yoffset, temp, H); \
+ \
+ if (!invert_mask) \
+ highbd_masked_variance4xh(ref, ref_stride, temp, second_pred, msk, \
+ msk_stride, H, &sse_, &sum); \
+ else \
+ highbd_masked_variance4xh(ref, ref_stride, second_pred, temp, msk, \
+ msk_stride, H, &sse_, &sum); \
+ *sse = (uint32_t)ROUND_POWER_OF_TWO(sse_, 4); \
+ sum = ROUND_POWER_OF_TWO(sum, 2); \
+ return *sse - (uint32_t)(((int64_t)sum * sum) / (4 * H)); \
+ } \
+ unsigned int aom_highbd_12_masked_sub_pixel_variance4x##H##_ssse3( \
+ const uint8_t *src8, int src_stride, int xoffset, int yoffset, \
+ const uint8_t *ref8, int ref_stride, const uint8_t *second_pred8, \
+ const uint8_t *msk, int msk_stride, int invert_mask, uint32_t *sse) { \
+ int sse_; \
+ int sum; \
+ uint16_t temp[(H + 1) * 4]; \
+ const uint16_t *src = CONVERT_TO_SHORTPTR(src8); \
+ const uint16_t *ref = CONVERT_TO_SHORTPTR(ref8); \
+ const uint16_t *second_pred = CONVERT_TO_SHORTPTR(second_pred8); \
+ \
+ highbd_bilinear_filter4xh(src, src_stride, xoffset, yoffset, temp, H); \
+ \
+ if (!invert_mask) \
+ highbd_masked_variance4xh(ref, ref_stride, temp, second_pred, msk, \
+ msk_stride, H, &sse_, &sum); \
+ else \
+ highbd_masked_variance4xh(ref, ref_stride, second_pred, temp, msk, \
+ msk_stride, H, &sse_, &sum); \
+ *sse = (uint32_t)ROUND_POWER_OF_TWO(sse_, 8); \
+ sum = ROUND_POWER_OF_TWO(sum, 4); \
+ return *sse - (uint32_t)(((int64_t)sum * sum) / (4 * H)); \
+ }
-// High bit depth functions for width (W) >= 8
-unsigned int aom_highbd_masked_subpel_varWxH_xzero(
- const uint16_t *src, int src_stride, int yoffset, const uint16_t *dst,
- int dst_stride, const uint8_t *msk, int msk_stride, unsigned int *sse,
- int w, int h, highbd_filter_fn_t filter_fn,
- highbd_calc_masked_var_t calc_var) {
+#if CONFIG_EXT_PARTITION
+HIGHBD_MASK_SUBPIX_VAR_SSSE3(128, 128)
+HIGHBD_MASK_SUBPIX_VAR_SSSE3(128, 64)
+HIGHBD_MASK_SUBPIX_VAR_SSSE3(64, 128)
+#endif
+HIGHBD_MASK_SUBPIX_VAR_SSSE3(64, 64)
+HIGHBD_MASK_SUBPIX_VAR_SSSE3(64, 32)
+HIGHBD_MASK_SUBPIX_VAR_SSSE3(32, 64)
+HIGHBD_MASK_SUBPIX_VAR_SSSE3(32, 32)
+HIGHBD_MASK_SUBPIX_VAR_SSSE3(32, 16)
+HIGHBD_MASK_SUBPIX_VAR_SSSE3(16, 32)
+HIGHBD_MASK_SUBPIX_VAR_SSSE3(16, 16)
+HIGHBD_MASK_SUBPIX_VAR_SSSE3(16, 8)
+HIGHBD_MASK_SUBPIX_VAR_SSSE3(8, 16)
+HIGHBD_MASK_SUBPIX_VAR_SSSE3(8, 8)
+HIGHBD_MASK_SUBPIX_VAR_SSSE3(8, 4)
+HIGHBD_MASK_SUBPIX_VAR4XH_SSSE3(8)
+HIGHBD_MASK_SUBPIX_VAR4XH_SSSE3(4)
+
+static INLINE __m128i highbd_filter_block(const __m128i a, const __m128i b,
+ const __m128i filter) {
+ __m128i v0 = _mm_unpacklo_epi16(a, b);
+ v0 = _mm_madd_epi16(v0, filter);
+ v0 = xx_roundn_epu32(v0, FILTER_BITS);
+
+ __m128i v1 = _mm_unpackhi_epi16(a, b);
+ v1 = _mm_madd_epi16(v1, filter);
+ v1 = xx_roundn_epu32(v1, FILTER_BITS);
+
+ return _mm_packs_epi32(v0, v1);
+}
+
+static void highbd_bilinear_filter(const uint16_t *src, int src_stride,
+ int xoffset, int yoffset, uint16_t *dst,
+ int w, int h) {
int i, j;
- __m128i v_src0_w, v_src1_w, v_res_w, v_dst_w, v_msk_b;
- __m128i v_sum_d = _mm_setzero_si128();
- __m128i v_sse_q = _mm_setzero_si128();
- const __m128i v_filter_w =
- _mm_set1_epi32((bilinear_filters_2t[yoffset][1] << 16) +
- bilinear_filters_2t[yoffset][0]);
- assert(yoffset < BIL_SUBPEL_SHIFTS);
- for (j = 0; j < w; j += 8) {
- // Load the first row ready
- v_src0_w = _mm_loadu_si128((const __m128i *)(src + j));
- // Process 2 rows at a time
- for (i = 0; i < h; i += 2) {
- // Load the next row apply the filter
- v_src1_w = _mm_loadu_si128((const __m128i *)(src + j + src_stride));
- v_res_w = filter_fn(v_src0_w, v_src1_w, v_filter_w);
- // Load the dst and msk for the variance calculation
- v_dst_w = _mm_loadu_si128((const __m128i *)(dst + j));
- v_msk_b = _mm_loadl_epi64((const __m128i *)(msk + j));
- highbd_sum_and_sse(v_res_w, v_dst_w, v_msk_b, &v_sum_d, &v_sse_q);
-
- // Load the next row apply the filter
- v_src0_w = _mm_loadu_si128((const __m128i *)(src + j + src_stride * 2));
- v_res_w = filter_fn(v_src1_w, v_src0_w, v_filter_w);
- // Load the dst and msk for the variance calculation
- v_dst_w = _mm_loadu_si128((const __m128i *)(dst + j + dst_stride));
- v_msk_b = _mm_loadl_epi64((const __m128i *)(msk + j + msk_stride));
- highbd_sum_and_sse(v_res_w, v_dst_w, v_msk_b, &v_sum_d, &v_sse_q);
- // Move onto the next block of rows
- src += src_stride * 2;
- dst += dst_stride * 2;
- msk += msk_stride * 2;
+ // Horizontal filter
+ if (xoffset == 0) {
+ uint16_t *b = dst;
+ for (i = 0; i < h + 1; ++i) {
+ for (j = 0; j < w; j += 8) {
+ __m128i x = _mm_loadu_si128((__m128i *)&src[j]);
+ _mm_storeu_si128((__m128i *)&b[j], x);
+ }
+ src += src_stride;
+ b += w;
}
- // Reset to the top of the block
- src -= src_stride * h;
- dst -= dst_stride * h;
- msk -= msk_stride * h;
- }
- return calc_var(v_sum_d, v_sse_q, sse, w, h);
-}
-unsigned int aom_highbd_masked_subpel_varWxH_yzero(
- const uint16_t *src, int src_stride, int xoffset, const uint16_t *dst,
- int dst_stride, const uint8_t *msk, int msk_stride, unsigned int *sse,
- int w, int h, highbd_filter_fn_t filter_fn,
- highbd_calc_masked_var_t calc_var) {
- int i, j;
- __m128i v_src0_w, v_src1_w, v_res_w, v_dst_w, v_msk_b;
- __m128i v_sum_d = _mm_setzero_si128();
- __m128i v_sse_q = _mm_setzero_si128();
- const __m128i v_filter_w =
- _mm_set1_epi32((bilinear_filters_2t[xoffset][1] << 16) +
- bilinear_filters_2t[xoffset][0]);
- assert(xoffset < BIL_SUBPEL_SHIFTS);
- for (i = 0; i < h; i++) {
- for (j = 0; j < w; j += 8) {
- // Load this row & apply the filter to them
- v_src0_w = _mm_loadu_si128((const __m128i *)(src + j));
- v_src1_w = _mm_loadu_si128((const __m128i *)(src + j + 1));
- v_res_w = filter_fn(v_src0_w, v_src1_w, v_filter_w);
-
- // Load the dst and msk for the variance calculation
- v_dst_w = _mm_loadu_si128((const __m128i *)(dst + j));
- v_msk_b = _mm_loadl_epi64((const __m128i *)(msk + j));
- highbd_sum_and_sse(v_res_w, v_dst_w, v_msk_b, &v_sum_d, &v_sse_q);
+ } else if (xoffset == 4) {
+ uint16_t *b = dst;
+ for (i = 0; i < h + 1; ++i) {
+ for (j = 0; j < w; j += 8) {
+ __m128i x = _mm_loadu_si128((__m128i *)&src[j]);
+ __m128i y = _mm_loadu_si128((__m128i *)&src[j + 8]);
+ __m128i z = _mm_alignr_epi8(y, x, 2);
+ _mm_storeu_si128((__m128i *)&b[j], _mm_avg_epu16(x, z));
+ }
+ src += src_stride;
+ b += w;
}
- src += src_stride;
- dst += dst_stride;
- msk += msk_stride;
- }
- return calc_var(v_sum_d, v_sse_q, sse, w, h);
-}
-
-unsigned int aom_highbd_masked_subpel_varWxH_xnonzero_ynonzero(
- const uint16_t *src, int src_stride, int xoffset, int yoffset,
- const uint16_t *dst, int dst_stride, const uint8_t *msk, int msk_stride,
- unsigned int *sse, int w, int h, highbd_filter_fn_t xfilter_fn,
- highbd_filter_fn_t yfilter_fn, highbd_calc_masked_var_t calc_var) {
- int i, j;
- __m128i v_src0_w, v_src1_w, v_src2_w, v_src3_w;
- __m128i v_filtered0_w, v_filtered1_w, v_res_w, v_dst_w, v_msk_b;
- __m128i v_sum_d = _mm_setzero_si128();
- __m128i v_sse_q = _mm_setzero_si128();
- const __m128i v_filterx_w =
- _mm_set1_epi32((bilinear_filters_2t[xoffset][1] << 16) +
- bilinear_filters_2t[xoffset][0]);
- const __m128i v_filtery_w =
- _mm_set1_epi32((bilinear_filters_2t[yoffset][1] << 16) +
- bilinear_filters_2t[yoffset][0]);
- assert(xoffset < BIL_SUBPEL_SHIFTS);
- assert(yoffset < BIL_SUBPEL_SHIFTS);
- for (j = 0; j < w; j += 8) {
- // Load the first row ready
- v_src0_w = _mm_loadu_si128((const __m128i *)(src + j));
- v_src1_w = _mm_loadu_si128((const __m128i *)(src + j + 1));
- v_filtered0_w = xfilter_fn(v_src0_w, v_src1_w, v_filterx_w);
- // Process 2 rows at a time
- for (i = 0; i < h; i += 2) {
- // Load the next row & apply the filter
- v_src2_w = _mm_loadu_si128((const __m128i *)(src + src_stride + j));
- v_src3_w = _mm_loadu_si128((const __m128i *)(src + src_stride + j + 1));
- v_filtered1_w = xfilter_fn(v_src2_w, v_src3_w, v_filterx_w);
- // Load the dst and msk for the variance calculation
- v_dst_w = _mm_loadu_si128((const __m128i *)(dst + j));
- v_msk_b = _mm_loadl_epi64((const __m128i *)(msk + j));
- // Complete the calculation for this row and add it to the running total
- v_res_w = yfilter_fn(v_filtered0_w, v_filtered1_w, v_filtery_w);
- highbd_sum_and_sse(v_res_w, v_dst_w, v_msk_b, &v_sum_d, &v_sse_q);
-
- // Load the next row & apply the filter
- v_src0_w = _mm_loadu_si128((const __m128i *)(src + src_stride * 2 + j));
- v_src1_w =
- _mm_loadu_si128((const __m128i *)(src + src_stride * 2 + j + 1));
- v_filtered0_w = xfilter_fn(v_src0_w, v_src1_w, v_filterx_w);
- // Load the dst and msk for the variance calculation
- v_dst_w = _mm_loadu_si128((const __m128i *)(dst + dst_stride + j));
- v_msk_b = _mm_loadl_epi64((const __m128i *)(msk + msk_stride + j));
- // Complete the calculation for this row and add it to the running total
- v_res_w = yfilter_fn(v_filtered1_w, v_filtered0_w, v_filtery_w);
- highbd_sum_and_sse(v_res_w, v_dst_w, v_msk_b, &v_sum_d, &v_sse_q);
- // Move onto the next block of rows
- src += src_stride * 2;
- dst += dst_stride * 2;
- msk += msk_stride * 2;
+ } else {
+ uint16_t *b = dst;
+ const uint8_t *hfilter = bilinear_filters_2t[xoffset];
+ const __m128i hfilter_vec = _mm_set1_epi32(hfilter[0] | (hfilter[1] << 16));
+ for (i = 0; i < h + 1; ++i) {
+ for (j = 0; j < w; j += 8) {
+ const __m128i x = _mm_loadu_si128((__m128i *)&src[j]);
+ const __m128i y = _mm_loadu_si128((__m128i *)&src[j + 8]);
+ const __m128i z = _mm_alignr_epi8(y, x, 2);
+ const __m128i res = highbd_filter_block(x, z, hfilter_vec);
+ _mm_storeu_si128((__m128i *)&b[j], res);
+ }
+
+ src += src_stride;
+ b += w;
}
- // Reset to the top of the block
- src -= src_stride * h;
- dst -= dst_stride * h;
- msk -= msk_stride * h;
}
- return calc_var(v_sum_d, v_sse_q, sse, w, h);
-}
-// Note order in which rows loaded xmm[127:64] = row 1, xmm[63:0] = row 2
-unsigned int aom_highbd_masked_subpel_var4xH_xzero(
- const uint16_t *src, int src_stride, int yoffset, const uint16_t *dst,
- int dst_stride, const uint8_t *msk, int msk_stride, unsigned int *sse,
- int h, highbd_calc_masked_var_t calc_var) {
- int i;
- __m128i v_src0_w, v_src1_w, v_filtered0_d, v_filtered1_d, v_res_w;
- __m128i v_dst_w, v_msk_b;
- __m128i v_sum_d = _mm_setzero_si128();
- __m128i v_sse_q = _mm_setzero_si128();
- __m128i v_filter_w = _mm_set1_epi32((bilinear_filters_2t[yoffset][1] << 16) +
- bilinear_filters_2t[yoffset][0]);
- assert(yoffset < BIL_SUBPEL_SHIFTS);
- // Load the first row of src data ready
- v_src0_w = _mm_loadl_epi64((const __m128i *)src);
- for (i = 0; i < h; i += 2) {
- if (yoffset == HALF_PIXEL_OFFSET) {
- // Load the rest of the source data for these rows
- v_src1_w = _mm_or_si128(
- _mm_slli_si128(v_src0_w, 8),
- _mm_loadl_epi64((const __m128i *)(src + src_stride * 1)));
- v_src0_w = _mm_or_si128(
- _mm_slli_si128(v_src1_w, 8),
- _mm_loadl_epi64((const __m128i *)(src + src_stride * 2)));
- // Apply the y filter
- v_res_w = _mm_avg_epu16(v_src1_w, v_src0_w);
- } else {
- // Load the data and apply the y filter
- v_src1_w = _mm_loadl_epi64((const __m128i *)(src + src_stride * 1));
- highbd_apply_filter_lo(v_src0_w, v_src1_w, v_filter_w, &v_filtered0_d);
- v_src0_w = _mm_loadl_epi64((const __m128i *)(src + src_stride * 2));
- highbd_apply_filter_lo(v_src1_w, v_src0_w, v_filter_w, &v_filtered1_d);
- v_res_w = _mm_packs_epi32(v_filtered1_d, v_filtered0_d);
+ // Vertical filter
+ if (yoffset == 0) {
+ // The data is already in 'dst', so no need to filter
+ } else if (yoffset == 4) {
+ for (i = 0; i < h; ++i) {
+ for (j = 0; j < w; j += 8) {
+ __m128i x = _mm_loadu_si128((__m128i *)&dst[j]);
+ __m128i y = _mm_loadu_si128((__m128i *)&dst[j + w]);
+ _mm_storeu_si128((__m128i *)&dst[j], _mm_avg_epu16(x, y));
+ }
+ dst += w;
+ }
+ } else {
+ const uint8_t *vfilter = bilinear_filters_2t[yoffset];
+ const __m128i vfilter_vec = _mm_set1_epi32(vfilter[0] | (vfilter[1] << 16));
+ for (i = 0; i < h; ++i) {
+ for (j = 0; j < w; j += 8) {
+ const __m128i x = _mm_loadu_si128((__m128i *)&dst[j]);
+ const __m128i y = _mm_loadu_si128((__m128i *)&dst[j + w]);
+ const __m128i res = highbd_filter_block(x, y, vfilter_vec);
+ _mm_storeu_si128((__m128i *)&dst[j], res);
+ }
+
+ dst += w;
}
- // Load the dst data
- v_dst_w = _mm_unpacklo_epi64(
- _mm_loadl_epi64((const __m128i *)(dst + dst_stride * 1)),
- _mm_loadl_epi64((const __m128i *)(dst + dst_stride * 0)));
- // Load the mask data
- v_msk_b = _mm_unpacklo_epi32(
- _mm_loadl_epi64((const __m128i *)(msk + msk_stride * 1)),
- _mm_loadl_epi64((const __m128i *)(msk + msk_stride * 0)));
- // Compute the sum and SSE
- highbd_sum_and_sse(v_res_w, v_dst_w, v_msk_b, &v_sum_d, &v_sse_q);
- // Move onto the next set of rows
- src += src_stride * 2;
- dst += dst_stride * 2;
- msk += msk_stride * 2;
}
- return calc_var(v_sum_d, v_sse_q, sse, 4, h);
}
-unsigned int aom_highbd_masked_subpel_var4xH_yzero(
- const uint16_t *src, int src_stride, int xoffset, const uint16_t *dst,
- int dst_stride, const uint8_t *msk, int msk_stride, unsigned int *sse,
- int h, highbd_calc_masked_var_t calc_var) {
- int i;
- __m128i v_src0_w, v_src1_w, v_filtered0_d, v_filtered1_d;
- __m128i v_src0_shift_w, v_src1_shift_w, v_res_w, v_dst_w, v_msk_b;
- __m128i v_sum_d = _mm_setzero_si128();
- __m128i v_sse_q = _mm_setzero_si128();
- __m128i v_filter_w = _mm_set1_epi32((bilinear_filters_2t[xoffset][1] << 16) +
- bilinear_filters_2t[xoffset][0]);
- assert(xoffset < BIL_SUBPEL_SHIFTS);
- for (i = 0; i < h; i += 2) {
- // Load the src data
- v_src0_w = _mm_loadu_si128((const __m128i *)(src));
- v_src0_shift_w = _mm_srli_si128(v_src0_w, 2);
- v_src1_w = _mm_loadu_si128((const __m128i *)(src + src_stride));
- v_src1_shift_w = _mm_srli_si128(v_src1_w, 2);
- // Apply the x filter
- if (xoffset == HALF_PIXEL_OFFSET) {
- v_src1_w = _mm_unpacklo_epi64(v_src0_w, v_src1_w);
- v_src1_shift_w = _mm_unpacklo_epi64(v_src0_shift_w, v_src1_shift_w);
- v_res_w = _mm_avg_epu16(v_src1_w, v_src1_shift_w);
- } else {
- highbd_apply_filter_lo(v_src0_w, v_src0_shift_w, v_filter_w,
- &v_filtered0_d);
- highbd_apply_filter_lo(v_src1_w, v_src1_shift_w, v_filter_w,
- &v_filtered1_d);
- v_res_w = _mm_packs_epi32(v_filtered0_d, v_filtered1_d);
- }
- // Load the dst data
- v_dst_w = _mm_unpacklo_epi64(
- _mm_loadl_epi64((const __m128i *)(dst + dst_stride * 0)),
- _mm_loadl_epi64((const __m128i *)(dst + dst_stride * 1)));
- // Load the mask data
- v_msk_b = _mm_unpacklo_epi32(
- _mm_loadl_epi64((const __m128i *)(msk + msk_stride * 0)),
- _mm_loadl_epi64((const __m128i *)(msk + msk_stride * 1)));
- // Compute the sum and SSE
- highbd_sum_and_sse(v_res_w, v_dst_w, v_msk_b, &v_sum_d, &v_sse_q);
- // Move onto the next set of rows
- src += src_stride * 2;
- dst += dst_stride * 2;
- msk += msk_stride * 2;
- }
- return calc_var(v_sum_d, v_sse_q, sse, 4, h);
+static INLINE __m128i highbd_filter_block_2rows(const __m128i a0,
+ const __m128i b0,
+ const __m128i a1,
+ const __m128i b1,
+ const __m128i filter) {
+ __m128i v0 = _mm_unpacklo_epi16(a0, b0);
+ v0 = _mm_madd_epi16(v0, filter);
+ v0 = xx_roundn_epu32(v0, FILTER_BITS);
+
+ __m128i v1 = _mm_unpacklo_epi16(a1, b1);
+ v1 = _mm_madd_epi16(v1, filter);
+ v1 = xx_roundn_epu32(v1, FILTER_BITS);
+
+ return _mm_packs_epi32(v0, v1);
}
-unsigned int aom_highbd_masked_subpel_var4xH_xnonzero_ynonzero(
- const uint16_t *src, int src_stride, int xoffset, int yoffset,
- const uint16_t *dst, int dst_stride, const uint8_t *msk, int msk_stride,
- unsigned int *sse, int h, highbd_calc_masked_var_t calc_var) {
+static void highbd_bilinear_filter4xh(const uint16_t *src, int src_stride,
+ int xoffset, int yoffset, uint16_t *dst,
+ int h) {
int i;
- __m128i v_src0_w, v_src1_w, v_filtered0_d, v_filtered1_d, v_dst_w, v_msk_b;
- __m128i v_src0_shift_w, v_src1_shift_w;
- __m128i v_xres0_w, v_xres1_w, v_res_w, v_temp_w;
- __m128i v_sum_d = _mm_setzero_si128();
- __m128i v_sse_q = _mm_setzero_si128();
- __m128i v_filterx_w = _mm_set1_epi32((bilinear_filters_2t[xoffset][1] << 16) +
- bilinear_filters_2t[xoffset][0]);
- __m128i v_filtery_w = _mm_set1_epi32((bilinear_filters_2t[yoffset][1] << 16) +
- bilinear_filters_2t[yoffset][0]);
- assert(xoffset < BIL_SUBPEL_SHIFTS);
- assert(yoffset < BIL_SUBPEL_SHIFTS);
- // Load the first block of src data
- v_src0_w = _mm_loadu_si128((const __m128i *)(src));
- v_src0_shift_w = _mm_srli_si128(v_src0_w, 2);
- v_src1_w = _mm_loadu_si128((const __m128i *)(src + src_stride));
- v_src1_shift_w = _mm_srli_si128(v_src1_w, 2);
- // Apply the x filter
- if (xoffset == HALF_PIXEL_OFFSET) {
- v_src1_w = _mm_unpacklo_epi64(v_src0_w, v_src1_w);
- v_src1_shift_w = _mm_unpacklo_epi64(v_src0_shift_w, v_src1_shift_w);
- v_xres0_w = _mm_avg_epu16(v_src1_w, v_src1_shift_w);
- } else {
- highbd_apply_filter_lo(v_src0_w, v_src0_shift_w, v_filterx_w,
- &v_filtered0_d);
- highbd_apply_filter_lo(v_src1_w, v_src1_shift_w, v_filterx_w,
- &v_filtered1_d);
- v_xres0_w = _mm_packs_epi32(v_filtered0_d, v_filtered1_d);
- }
- for (i = 0; i < h; i += 4) {
- // Load the next block of src data
- v_src0_w = _mm_loadu_si128((const __m128i *)(src + src_stride * 2));
- v_src0_shift_w = _mm_srli_si128(v_src0_w, 2);
- v_src1_w = _mm_loadu_si128((const __m128i *)(src + src_stride * 3));
- v_src1_shift_w = _mm_srli_si128(v_src1_w, 2);
- // Apply the x filter
- if (xoffset == HALF_PIXEL_OFFSET) {
- v_src1_w = _mm_unpacklo_epi64(v_src0_w, v_src1_w);
- v_src1_shift_w = _mm_unpacklo_epi64(v_src0_shift_w, v_src1_shift_w);
- v_xres1_w = _mm_avg_epu16(v_src1_w, v_src1_shift_w);
- } else {
- highbd_apply_filter_lo(v_src0_w, v_src0_shift_w, v_filterx_w,
- &v_filtered0_d);
- highbd_apply_filter_lo(v_src1_w, v_src1_shift_w, v_filterx_w,
- &v_filtered1_d);
- v_xres1_w = _mm_packs_epi32(v_filtered0_d, v_filtered1_d);
+ // Horizontal filter
+ if (xoffset == 0) {
+ uint16_t *b = dst;
+ for (i = 0; i < h + 1; ++i) {
+ __m128i x = _mm_loadl_epi64((__m128i *)src);
+ _mm_storel_epi64((__m128i *)b, x);
+ src += src_stride;
+ b += 4;
}
- // Apply the y filter to the previous block
- v_temp_w = _mm_or_si128(_mm_srli_si128(v_xres0_w, 8),
- _mm_slli_si128(v_xres1_w, 8));
- if (yoffset == HALF_PIXEL_OFFSET) {
- v_res_w = _mm_avg_epu16(v_xres0_w, v_temp_w);
- } else {
- v_res_w = highbd_apply_filter(v_xres0_w, v_temp_w, v_filtery_w);
+ } else if (xoffset == 4) {
+ uint16_t *b = dst;
+ for (i = 0; i < h + 1; ++i) {
+ __m128i x = _mm_loadu_si128((__m128i *)src);
+ __m128i z = _mm_srli_si128(x, 2);
+ _mm_storel_epi64((__m128i *)b, _mm_avg_epu16(x, z));
+ src += src_stride;
+ b += 4;
}
- // Load the dst data
- v_dst_w = _mm_unpacklo_epi64(
- _mm_loadl_epi64((const __m128i *)(dst + dst_stride * 0)),
- _mm_loadl_epi64((const __m128i *)(dst + dst_stride * 1)));
- // Load the mask data
- v_msk_b = _mm_unpacklo_epi32(
- _mm_loadl_epi64((const __m128i *)(msk + msk_stride * 0)),
- _mm_loadl_epi64((const __m128i *)(msk + msk_stride * 1)));
- // Compute the sum and SSE
- highbd_sum_and_sse(v_res_w, v_dst_w, v_msk_b, &v_sum_d, &v_sse_q);
-
- // Load the next block of src data
- v_src0_w = _mm_loadu_si128((const __m128i *)(src + src_stride * 4));
- v_src0_shift_w = _mm_srli_si128(v_src0_w, 2);
- v_src1_w = _mm_loadu_si128((const __m128i *)(src + src_stride * 5));
- v_src1_shift_w = _mm_srli_si128(v_src1_w, 2);
- // Apply the x filter
- if (xoffset == HALF_PIXEL_OFFSET) {
- v_src1_w = _mm_unpacklo_epi64(v_src0_w, v_src1_w);
- v_src1_shift_w = _mm_unpacklo_epi64(v_src0_shift_w, v_src1_shift_w);
- v_xres0_w = _mm_avg_epu16(v_src1_w, v_src1_shift_w);
- } else {
- highbd_apply_filter_lo(v_src0_w, v_src0_shift_w, v_filterx_w,
- &v_filtered0_d);
- highbd_apply_filter_lo(v_src1_w, v_src1_shift_w, v_filterx_w,
- &v_filtered1_d);
- v_xres0_w = _mm_packs_epi32(v_filtered0_d, v_filtered1_d);
+ } else {
+ uint16_t *b = dst;
+ const uint8_t *hfilter = bilinear_filters_2t[xoffset];
+ const __m128i hfilter_vec = _mm_set1_epi32(hfilter[0] | (hfilter[1] << 16));
+ for (i = 0; i < h; i += 2) {
+ const __m128i x0 = _mm_loadu_si128((__m128i *)src);
+ const __m128i z0 = _mm_srli_si128(x0, 2);
+ const __m128i x1 = _mm_loadu_si128((__m128i *)&src[src_stride]);
+ const __m128i z1 = _mm_srli_si128(x1, 2);
+ const __m128i res =
+ highbd_filter_block_2rows(x0, z0, x1, z1, hfilter_vec);
+ _mm_storeu_si128((__m128i *)b, res);
+
+ src += src_stride * 2;
+ b += 8;
}
- // Apply the y filter to the previous block
- v_temp_w = _mm_or_si128(_mm_srli_si128(v_xres1_w, 8),
- _mm_slli_si128(v_xres0_w, 8));
- if (yoffset == HALF_PIXEL_OFFSET) {
- v_res_w = _mm_avg_epu16(v_xres1_w, v_temp_w);
- } else {
- v_res_w = highbd_apply_filter(v_xres1_w, v_temp_w, v_filtery_w);
+ // Process i = h separately
+ __m128i x = _mm_loadu_si128((__m128i *)src);
+ __m128i z = _mm_srli_si128(x, 2);
+
+ __m128i v0 = _mm_unpacklo_epi16(x, z);
+ v0 = _mm_madd_epi16(v0, hfilter_vec);
+ v0 = xx_roundn_epu32(v0, FILTER_BITS);
+
+ _mm_storel_epi64((__m128i *)b, _mm_packs_epi32(v0, v0));
+ }
+
+ // Vertical filter
+ if (yoffset == 0) {
+ // The data is already in 'dst', so no need to filter
+ } else if (yoffset == 4) {
+ for (i = 0; i < h; ++i) {
+ __m128i x = _mm_loadl_epi64((__m128i *)dst);
+ __m128i y = _mm_loadl_epi64((__m128i *)&dst[4]);
+ _mm_storel_epi64((__m128i *)dst, _mm_avg_epu16(x, y));
+ dst += 4;
}
- // Load the dst data
- v_dst_w = _mm_unpacklo_epi64(
- _mm_loadl_epi64((const __m128i *)(dst + dst_stride * 2)),
- _mm_loadl_epi64((const __m128i *)(dst + dst_stride * 3)));
- // Load the mask data
- v_msk_b = _mm_unpacklo_epi32(
- _mm_loadl_epi64((const __m128i *)(msk + msk_stride * 2)),
- _mm_loadl_epi64((const __m128i *)(msk + msk_stride * 3)));
- // Compute the sum and SSE
- highbd_sum_and_sse(v_res_w, v_dst_w, v_msk_b, &v_sum_d, &v_sse_q);
- // Move onto the next set of rows
- src += src_stride * 4;
- dst += dst_stride * 4;
- msk += msk_stride * 4;
- }
- return calc_var(v_sum_d, v_sse_q, sse, 4, h);
-}
+ } else {
+ const uint8_t *vfilter = bilinear_filters_2t[yoffset];
+ const __m128i vfilter_vec = _mm_set1_epi32(vfilter[0] | (vfilter[1] << 16));
+ for (i = 0; i < h; i += 2) {
+ const __m128i x = _mm_loadl_epi64((__m128i *)dst);
+ const __m128i y = _mm_loadl_epi64((__m128i *)&dst[4]);
+ const __m128i z = _mm_loadl_epi64((__m128i *)&dst[8]);
+ const __m128i res = highbd_filter_block_2rows(x, y, y, z, vfilter_vec);
+ _mm_storeu_si128((__m128i *)dst, res);
-// For W >=8
-#define HIGHBD_MASK_SUBPIX_VAR_LARGE(W, H) \
- unsigned int highbd_masked_sub_pixel_variance##W##x##H##_ssse3( \
- const uint8_t *src8, int src_stride, int xoffset, int yoffset, \
- const uint8_t *dst8, int dst_stride, const uint8_t *msk, int msk_stride, \
- unsigned int *sse, highbd_calc_masked_var_t calc_var, \
- highbd_variance_fn_t full_variance_function) { \
- uint16_t *src = CONVERT_TO_SHORTPTR(src8); \
- uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); \
- assert(W % 8 == 0); \
- if (xoffset == 0) { \
- if (yoffset == 0) \
- return full_variance_function(src8, src_stride, dst8, dst_stride, msk, \
- msk_stride, sse); \
- else if (yoffset == HALF_PIXEL_OFFSET) \
- return aom_highbd_masked_subpel_varWxH_xzero( \
- src, src_stride, HALF_PIXEL_OFFSET, dst, dst_stride, msk, \
- msk_stride, sse, W, H, highbd_apply_filter_avg, calc_var); \
- else \
- return aom_highbd_masked_subpel_varWxH_xzero( \
- src, src_stride, yoffset, dst, dst_stride, msk, msk_stride, sse, \
- W, H, highbd_apply_filter, calc_var); \
- } else if (yoffset == 0) { \
- if (xoffset == HALF_PIXEL_OFFSET) \
- return aom_highbd_masked_subpel_varWxH_yzero( \
- src, src_stride, HALF_PIXEL_OFFSET, dst, dst_stride, msk, \
- msk_stride, sse, W, H, highbd_apply_filter_avg, calc_var); \
- else \
- return aom_highbd_masked_subpel_varWxH_yzero( \
- src, src_stride, xoffset, dst, dst_stride, msk, msk_stride, sse, \
- W, H, highbd_apply_filter, calc_var); \
- } else if (xoffset == HALF_PIXEL_OFFSET) { \
- if (yoffset == HALF_PIXEL_OFFSET) \
- return aom_highbd_masked_subpel_varWxH_xnonzero_ynonzero( \
- src, src_stride, HALF_PIXEL_OFFSET, HALF_PIXEL_OFFSET, dst, \
- dst_stride, msk, msk_stride, sse, W, H, highbd_apply_filter_avg, \
- highbd_apply_filter_avg, calc_var); \
- else \
- return aom_highbd_masked_subpel_varWxH_xnonzero_ynonzero( \
- src, src_stride, HALF_PIXEL_OFFSET, yoffset, dst, dst_stride, msk, \
- msk_stride, sse, W, H, highbd_apply_filter_avg, \
- highbd_apply_filter, calc_var); \
- } else { \
- if (yoffset == HALF_PIXEL_OFFSET) \
- return aom_highbd_masked_subpel_varWxH_xnonzero_ynonzero( \
- src, src_stride, xoffset, HALF_PIXEL_OFFSET, dst, dst_stride, msk, \
- msk_stride, sse, W, H, highbd_apply_filter, \
- highbd_apply_filter_avg, calc_var); \
- else \
- return aom_highbd_masked_subpel_varWxH_xnonzero_ynonzero( \
- src, src_stride, xoffset, yoffset, dst, dst_stride, msk, \
- msk_stride, sse, W, H, highbd_apply_filter, highbd_apply_filter, \
- calc_var); \
- } \
+ dst += 8;
+ }
}
+}
-// For W < 8
-#define HIGHBD_MASK_SUBPIX_VAR_SMALL(W, H) \
- unsigned int highbd_masked_sub_pixel_variance##W##x##H##_ssse3( \
- const uint8_t *src8, int src_stride, int xoffset, int yoffset, \
- const uint8_t *dst8, int dst_stride, const uint8_t *msk, int msk_stride, \
- unsigned int *sse, highbd_calc_masked_var_t calc_var, \
- highbd_variance_fn_t full_variance_function) { \
- uint16_t *src = CONVERT_TO_SHORTPTR(src8); \
- uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); \
- assert(W == 4); \
- if (xoffset == 0 && yoffset == 0) \
- return full_variance_function(src8, src_stride, dst8, dst_stride, msk, \
- msk_stride, sse); \
- else if (xoffset == 0) \
- return aom_highbd_masked_subpel_var4xH_xzero( \
- src, src_stride, yoffset, dst, dst_stride, msk, msk_stride, sse, H, \
- calc_var); \
- else if (yoffset == 0) \
- return aom_highbd_masked_subpel_var4xH_yzero( \
- src, src_stride, xoffset, dst, dst_stride, msk, msk_stride, sse, H, \
- calc_var); \
- else \
- return aom_highbd_masked_subpel_var4xH_xnonzero_ynonzero( \
- src, src_stride, xoffset, yoffset, dst, dst_stride, msk, msk_stride, \
- sse, H, calc_var); \
- }
+static void highbd_masked_variance(const uint16_t *src_ptr, int src_stride,
+ const uint16_t *a_ptr, int a_stride,
+ const uint16_t *b_ptr, int b_stride,
+ const uint8_t *m_ptr, int m_stride,
+ int width, int height, uint64_t *sse,
+ int *sum_) {
+ int x, y;
+ // Note on bit widths:
+ // The maximum value of 'sum' is (2^12 - 1) * 128 * 128 =~ 2^26,
+ // so this can be kept as four 32-bit values.
+ // But the maximum value of 'sum_sq' is (2^12 - 1)^2 * 128 * 128 =~ 2^38,
+ // so this must be stored as two 64-bit values.
+ __m128i sum = _mm_setzero_si128(), sum_sq = _mm_setzero_si128();
+ const __m128i mask_max = _mm_set1_epi16((1 << AOM_BLEND_A64_ROUND_BITS));
+ const __m128i round_const =
+ _mm_set1_epi32((1 << AOM_BLEND_A64_ROUND_BITS) >> 1);
+ const __m128i zero = _mm_setzero_si128();
+
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width; x += 8) {
+ const __m128i src = _mm_loadu_si128((const __m128i *)&src_ptr[x]);
+ const __m128i a = _mm_loadu_si128((const __m128i *)&a_ptr[x]);
+ const __m128i b = _mm_loadu_si128((const __m128i *)&b_ptr[x]);
+ const __m128i m =
+ _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i *)&m_ptr[x]), zero);
+ const __m128i m_inv = _mm_sub_epi16(mask_max, m);
+
+ // Calculate 8 predicted pixels.
+ const __m128i data_l = _mm_unpacklo_epi16(a, b);
+ const __m128i mask_l = _mm_unpacklo_epi16(m, m_inv);
+ __m128i pred_l = _mm_madd_epi16(data_l, mask_l);
+ pred_l = _mm_srai_epi32(_mm_add_epi32(pred_l, round_const),
+ AOM_BLEND_A64_ROUND_BITS);
+
+ const __m128i data_r = _mm_unpackhi_epi16(a, b);
+ const __m128i mask_r = _mm_unpackhi_epi16(m, m_inv);
+ __m128i pred_r = _mm_madd_epi16(data_r, mask_r);
+ pred_r = _mm_srai_epi32(_mm_add_epi32(pred_r, round_const),
+ AOM_BLEND_A64_ROUND_BITS);
+
+ const __m128i src_l = _mm_unpacklo_epi16(src, zero);
+ const __m128i src_r = _mm_unpackhi_epi16(src, zero);
+ __m128i diff_l = _mm_sub_epi32(pred_l, src_l);
+ __m128i diff_r = _mm_sub_epi32(pred_r, src_r);
+
+ // Update partial sums and partial sums of squares
+ sum = _mm_add_epi32(sum, _mm_add_epi32(diff_l, diff_r));
+ // A trick: Now each entry of diff_l and diff_r is stored in a 32-bit
+ // field, but the range of values is only [-(2^12 - 1), 2^12 - 1].
+ // So we can re-pack into 16-bit fields and use _mm_madd_epi16
+ // to calculate the squares and partially sum them.
+ const __m128i tmp = _mm_packs_epi32(diff_l, diff_r);
+ const __m128i prod = _mm_madd_epi16(tmp, tmp);
+ // Then we want to sign-extend to 64 bits and accumulate
+ const __m128i sign = _mm_srai_epi32(prod, 31);
+ const __m128i tmp_0 = _mm_unpacklo_epi32(prod, sign);
+ const __m128i tmp_1 = _mm_unpackhi_epi32(prod, sign);
+ sum_sq = _mm_add_epi64(sum_sq, _mm_add_epi64(tmp_0, tmp_1));
+ }
-#define HIGHBD_MASK_SUBPIX_VAR_WRAPPERS(W, H) \
- unsigned int aom_highbd_masked_sub_pixel_variance##W##x##H##_ssse3( \
- const uint8_t *src8, int src_stride, int xoffset, int yoffset, \
- const uint8_t *dst8, int dst_stride, const uint8_t *msk, int msk_stride, \
- unsigned int *sse) { \
- return highbd_masked_sub_pixel_variance##W##x##H##_ssse3( \
- src8, src_stride, xoffset, yoffset, dst8, dst_stride, msk, msk_stride, \
- sse, calc_masked_variance, \
- aom_highbd_masked_variance##W##x##H##_ssse3); \
- } \
- unsigned int aom_highbd_10_masked_sub_pixel_variance##W##x##H##_ssse3( \
- const uint8_t *src8, int src_stride, int xoffset, int yoffset, \
- const uint8_t *dst8, int dst_stride, const uint8_t *msk, int msk_stride, \
- unsigned int *sse) { \
- return highbd_masked_sub_pixel_variance##W##x##H##_ssse3( \
- src8, src_stride, xoffset, yoffset, dst8, dst_stride, msk, msk_stride, \
- sse, highbd_10_calc_masked_variance, \
- aom_highbd_10_masked_variance##W##x##H##_ssse3); \
- } \
- unsigned int aom_highbd_12_masked_sub_pixel_variance##W##x##H##_ssse3( \
- const uint8_t *src8, int src_stride, int xoffset, int yoffset, \
- const uint8_t *dst8, int dst_stride, const uint8_t *msk, int msk_stride, \
- unsigned int *sse) { \
- return highbd_masked_sub_pixel_variance##W##x##H##_ssse3( \
- src8, src_stride, xoffset, yoffset, dst8, dst_stride, msk, msk_stride, \
- sse, highbd_12_calc_masked_variance, \
- aom_highbd_12_masked_variance##W##x##H##_ssse3); \
- }
+ src_ptr += src_stride;
+ a_ptr += a_stride;
+ b_ptr += b_stride;
+ m_ptr += m_stride;
+ }
+ // Reduce down to a single sum and sum of squares
+ sum = _mm_hadd_epi32(sum, zero);
+ sum = _mm_hadd_epi32(sum, zero);
+ *sum_ = _mm_cvtsi128_si32(sum);
+ sum_sq = _mm_add_epi64(sum_sq, _mm_srli_si128(sum_sq, 8));
+ _mm_storel_epi64((__m128i *)sse, sum_sq);
+}
+
+static void highbd_masked_variance4xh(const uint16_t *src_ptr, int src_stride,
+ const uint16_t *a_ptr,
+ const uint16_t *b_ptr,
+ const uint8_t *m_ptr, int m_stride,
+ int height, int *sse, int *sum_) {
+ int y;
+ // Note: For this function, h <= 8 (or maybe 16 if we add 4:1 partitions).
+ // So the maximum value of sum is (2^12 - 1) * 4 * 16 =~ 2^18
+ // and the maximum value of sum_sq is (2^12 - 1)^2 * 4 * 16 =~ 2^30.
+ // So we can safely pack sum_sq into 32-bit fields, which is slightly more
+ // convenient.
+ __m128i sum = _mm_setzero_si128(), sum_sq = _mm_setzero_si128();
+ const __m128i mask_max = _mm_set1_epi16((1 << AOM_BLEND_A64_ROUND_BITS));
+ const __m128i round_const =
+ _mm_set1_epi32((1 << AOM_BLEND_A64_ROUND_BITS) >> 1);
+ const __m128i zero = _mm_setzero_si128();
+
+ for (y = 0; y < height; y += 2) {
+ __m128i src = _mm_unpacklo_epi64(
+ _mm_loadl_epi64((const __m128i *)src_ptr),
+ _mm_loadl_epi64((const __m128i *)&src_ptr[src_stride]));
+ const __m128i a = _mm_loadu_si128((const __m128i *)a_ptr);
+ const __m128i b = _mm_loadu_si128((const __m128i *)b_ptr);
+ const __m128i m = _mm_unpacklo_epi8(
+ _mm_unpacklo_epi32(
+ _mm_cvtsi32_si128(*(const uint32_t *)m_ptr),
+ _mm_cvtsi32_si128(*(const uint32_t *)&m_ptr[m_stride])),
+ zero);
+ const __m128i m_inv = _mm_sub_epi16(mask_max, m);
+
+ const __m128i data_l = _mm_unpacklo_epi16(a, b);
+ const __m128i mask_l = _mm_unpacklo_epi16(m, m_inv);
+ __m128i pred_l = _mm_madd_epi16(data_l, mask_l);
+ pred_l = _mm_srai_epi32(_mm_add_epi32(pred_l, round_const),
+ AOM_BLEND_A64_ROUND_BITS);
+
+ const __m128i data_r = _mm_unpackhi_epi16(a, b);
+ const __m128i mask_r = _mm_unpackhi_epi16(m, m_inv);
+ __m128i pred_r = _mm_madd_epi16(data_r, mask_r);
+ pred_r = _mm_srai_epi32(_mm_add_epi32(pred_r, round_const),
+ AOM_BLEND_A64_ROUND_BITS);
+
+ const __m128i src_l = _mm_unpacklo_epi16(src, zero);
+ const __m128i src_r = _mm_unpackhi_epi16(src, zero);
+ __m128i diff_l = _mm_sub_epi32(pred_l, src_l);
+ __m128i diff_r = _mm_sub_epi32(pred_r, src_r);
+
+ // Update partial sums and partial sums of squares
+ sum = _mm_add_epi32(sum, _mm_add_epi32(diff_l, diff_r));
+ const __m128i tmp = _mm_packs_epi32(diff_l, diff_r);
+ const __m128i prod = _mm_madd_epi16(tmp, tmp);
+ sum_sq = _mm_add_epi32(sum_sq, prod);
+
+ src_ptr += src_stride * 2;
+ a_ptr += 8;
+ b_ptr += 8;
+ m_ptr += m_stride * 2;
+ }
+ // Reduce down to a single sum and sum of squares
+ sum = _mm_hadd_epi32(sum, sum_sq);
+ sum = _mm_hadd_epi32(sum, zero);
+ *sum_ = _mm_cvtsi128_si32(sum);
+ *sse = _mm_cvtsi128_si32(_mm_srli_si128(sum, 4));
+}
-HIGHBD_MASK_SUBPIX_VAR_SMALL(4, 4)
-HIGHBD_MASK_SUBPIX_VAR_WRAPPERS(4, 4)
-HIGHBD_MASK_SUBPIX_VAR_SMALL(4, 8)
-HIGHBD_MASK_SUBPIX_VAR_WRAPPERS(4, 8)
-HIGHBD_MASK_SUBPIX_VAR_LARGE(8, 4)
-HIGHBD_MASK_SUBPIX_VAR_WRAPPERS(8, 4)
-HIGHBD_MASK_SUBPIX_VAR_LARGE(8, 8)
-HIGHBD_MASK_SUBPIX_VAR_WRAPPERS(8, 8)
-HIGHBD_MASK_SUBPIX_VAR_LARGE(8, 16)
-HIGHBD_MASK_SUBPIX_VAR_WRAPPERS(8, 16)
-HIGHBD_MASK_SUBPIX_VAR_LARGE(16, 8)
-HIGHBD_MASK_SUBPIX_VAR_WRAPPERS(16, 8)
-HIGHBD_MASK_SUBPIX_VAR_LARGE(16, 16)
-HIGHBD_MASK_SUBPIX_VAR_WRAPPERS(16, 16)
-HIGHBD_MASK_SUBPIX_VAR_LARGE(16, 32)
-HIGHBD_MASK_SUBPIX_VAR_WRAPPERS(16, 32)
-HIGHBD_MASK_SUBPIX_VAR_LARGE(32, 16)
-HIGHBD_MASK_SUBPIX_VAR_WRAPPERS(32, 16)
-HIGHBD_MASK_SUBPIX_VAR_LARGE(32, 32)
-HIGHBD_MASK_SUBPIX_VAR_WRAPPERS(32, 32)
-HIGHBD_MASK_SUBPIX_VAR_LARGE(32, 64)
-HIGHBD_MASK_SUBPIX_VAR_WRAPPERS(32, 64)
-HIGHBD_MASK_SUBPIX_VAR_LARGE(64, 32)
-HIGHBD_MASK_SUBPIX_VAR_WRAPPERS(64, 32)
-HIGHBD_MASK_SUBPIX_VAR_LARGE(64, 64)
-HIGHBD_MASK_SUBPIX_VAR_WRAPPERS(64, 64)
-#if CONFIG_EXT_PARTITION
-HIGHBD_MASK_SUBPIX_VAR_LARGE(64, 128)
-HIGHBD_MASK_SUBPIX_VAR_WRAPPERS(64, 128)
-HIGHBD_MASK_SUBPIX_VAR_LARGE(128, 64)
-HIGHBD_MASK_SUBPIX_VAR_WRAPPERS(128, 64)
-HIGHBD_MASK_SUBPIX_VAR_LARGE(128, 128)
-HIGHBD_MASK_SUBPIX_VAR_WRAPPERS(128, 128)
-#endif // CONFIG_EXT_PARTITION
#endif
diff --git a/third_party/aom/aom_dsp/x86/obmc_intrinsic_ssse3.h b/third_party/aom/aom_dsp/x86/obmc_intrinsic_ssse3.h
new file mode 100644
index 000000000..73589a32a
--- /dev/null
+++ b/third_party/aom/aom_dsp/x86/obmc_intrinsic_ssse3.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, Alliance for Open Media. All rights reserved
+ *
+ * This source code is subject to the terms of the BSD 2 Clause License and
+ * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
+ * was not distributed with this source code in the LICENSE file, you can
+ * obtain it at www.aomedia.org/license/software. If the Alliance for Open
+ * Media Patent License 1.0 was not distributed with this source code in the
+ * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
+ */
+
+#ifndef AOM_DSP_X86_OBMC_INTRINSIC_SSSE3_H_
+#define AOM_DSP_X86_OBMC_INTRINSIC_SSSE3_H_
+
+#include <immintrin.h>
+
+#include "./aom_config.h"
+
+static INLINE int32_t xx_hsum_epi32_si32(__m128i v_d) {
+ v_d = _mm_hadd_epi32(v_d, v_d);
+ v_d = _mm_hadd_epi32(v_d, v_d);
+ return _mm_cvtsi128_si32(v_d);
+}
+
+static INLINE int64_t xx_hsum_epi64_si64(__m128i v_q) {
+ v_q = _mm_add_epi64(v_q, _mm_srli_si128(v_q, 8));
+#if ARCH_X86_64
+ return _mm_cvtsi128_si64(v_q);
+#else
+ {
+ int64_t tmp;
+ _mm_storel_epi64((__m128i *)&tmp, v_q);
+ return tmp;
+ }
+#endif
+}
+
+static INLINE int64_t xx_hsum_epi32_si64(__m128i v_d) {
+ const __m128i v_sign_d = _mm_cmplt_epi32(v_d, _mm_setzero_si128());
+ const __m128i v_0_q = _mm_unpacklo_epi32(v_d, v_sign_d);
+ const __m128i v_1_q = _mm_unpackhi_epi32(v_d, v_sign_d);
+ return xx_hsum_epi64_si64(_mm_add_epi64(v_0_q, v_1_q));
+}
+
+#endif // AOM_DSP_X86_OBMC_INTRINSIC_SSSE3_H_
diff --git a/third_party/aom/aom_dsp/x86/obmc_sad_sse4.c b/third_party/aom/aom_dsp/x86/obmc_sad_sse4.c
index ad77f974c..21632644f 100644
--- a/third_party/aom/aom_dsp/x86/obmc_sad_sse4.c
+++ b/third_party/aom/aom_dsp/x86/obmc_sad_sse4.c
@@ -17,6 +17,7 @@
#include "aom/aom_integer.h"
#include "aom_dsp/aom_dsp_common.h"
+#include "aom_dsp/x86/obmc_intrinsic_ssse3.h"
#include "aom_dsp/x86/synonyms.h"
////////////////////////////////////////////////////////////////////////////////
diff --git a/third_party/aom/aom_dsp/x86/obmc_variance_sse4.c b/third_party/aom/aom_dsp/x86/obmc_variance_sse4.c
index efb3659cf..1797ded80 100644
--- a/third_party/aom/aom_dsp/x86/obmc_variance_sse4.c
+++ b/third_party/aom/aom_dsp/x86/obmc_variance_sse4.c
@@ -17,8 +17,9 @@
#include "aom/aom_integer.h"
#include "aom_dsp/aom_dsp_common.h"
-#include "aom_dsp/x86/synonyms.h"
#include "aom_dsp/aom_filter.h"
+#include "aom_dsp/x86/obmc_intrinsic_ssse3.h"
+#include "aom_dsp/x86/synonyms.h"
////////////////////////////////////////////////////////////////////////////////
// 8 bit
diff --git a/third_party/aom/aom_dsp/x86/synonyms.h b/third_party/aom/aom_dsp/x86/synonyms.h
index bef606dae..cd049a454 100644
--- a/third_party/aom/aom_dsp/x86/synonyms.h
+++ b/third_party/aom/aom_dsp/x86/synonyms.h
@@ -89,32 +89,4 @@ static INLINE __m128i xx_roundn_epi32(__m128i v_val_d, int bits) {
return _mm_srai_epi32(v_tmp_d, bits);
}
-#ifdef __SSSE3__
-static INLINE int32_t xx_hsum_epi32_si32(__m128i v_d) {
- v_d = _mm_hadd_epi32(v_d, v_d);
- v_d = _mm_hadd_epi32(v_d, v_d);
- return _mm_cvtsi128_si32(v_d);
-}
-
-static INLINE int64_t xx_hsum_epi64_si64(__m128i v_q) {
- v_q = _mm_add_epi64(v_q, _mm_srli_si128(v_q, 8));
-#if ARCH_X86_64
- return _mm_cvtsi128_si64(v_q);
-#else
- {
- int64_t tmp;
- _mm_storel_epi64((__m128i *)&tmp, v_q);
- return tmp;
- }
-#endif
-}
-
-static INLINE int64_t xx_hsum_epi32_si64(__m128i v_d) {
- const __m128i v_sign_d = _mm_cmplt_epi32(v_d, _mm_setzero_si128());
- const __m128i v_0_q = _mm_unpacklo_epi32(v_d, v_sign_d);
- const __m128i v_1_q = _mm_unpackhi_epi32(v_d, v_sign_d);
- return xx_hsum_epi64_si64(_mm_add_epi64(v_0_q, v_1_q));
-}
-#endif // __SSSE3__
-
#endif // AOM_DSP_X86_SYNONYMS_H_
diff --git a/third_party/aom/aom_dsp/x86/txfm_common_avx2.h b/third_party/aom/aom_dsp/x86/txfm_common_avx2.h
index 39e9b8e2a..4f7a60c22 100644
--- a/third_party/aom/aom_dsp/x86/txfm_common_avx2.h
+++ b/third_party/aom/aom_dsp/x86/txfm_common_avx2.h
@@ -34,7 +34,8 @@ static INLINE void mm256_reverse_epi16(__m256i *u) {
*u = _mm256_permute2x128_si256(v, v, 1);
}
-static INLINE void mm256_transpose_16x16(__m256i *in) {
+// Note: in and out could have the same value
+static INLINE void mm256_transpose_16x16(const __m256i *in, __m256i *out) {
__m256i tr0_0 = _mm256_unpacklo_epi16(in[0], in[1]);
__m256i tr0_1 = _mm256_unpackhi_epi16(in[0], in[1]);
__m256i tr0_2 = _mm256_unpacklo_epi16(in[2], in[3]);
@@ -143,29 +144,30 @@ static INLINE void mm256_transpose_16x16(__m256i *in) {
// 86 96 a6 b6 c6 d6 e6 f6 8e ae 9e be ce de ee fe
// 87 97 a7 b7 c7 d7 e7 f7 8f 9f af bf cf df ef ff
- in[0] = _mm256_permute2x128_si256(tr0_0, tr0_8, 0x20); // 0010 0000
- in[8] = _mm256_permute2x128_si256(tr0_0, tr0_8, 0x31); // 0011 0001
- in[1] = _mm256_permute2x128_si256(tr0_1, tr0_9, 0x20);
- in[9] = _mm256_permute2x128_si256(tr0_1, tr0_9, 0x31);
- in[2] = _mm256_permute2x128_si256(tr0_2, tr0_a, 0x20);
- in[10] = _mm256_permute2x128_si256(tr0_2, tr0_a, 0x31);
- in[3] = _mm256_permute2x128_si256(tr0_3, tr0_b, 0x20);
- in[11] = _mm256_permute2x128_si256(tr0_3, tr0_b, 0x31);
-
- in[4] = _mm256_permute2x128_si256(tr0_4, tr0_c, 0x20);
- in[12] = _mm256_permute2x128_si256(tr0_4, tr0_c, 0x31);
- in[5] = _mm256_permute2x128_si256(tr0_5, tr0_d, 0x20);
- in[13] = _mm256_permute2x128_si256(tr0_5, tr0_d, 0x31);
- in[6] = _mm256_permute2x128_si256(tr0_6, tr0_e, 0x20);
- in[14] = _mm256_permute2x128_si256(tr0_6, tr0_e, 0x31);
- in[7] = _mm256_permute2x128_si256(tr0_7, tr0_f, 0x20);
- in[15] = _mm256_permute2x128_si256(tr0_7, tr0_f, 0x31);
+ out[0] = _mm256_permute2x128_si256(tr0_0, tr0_8, 0x20); // 0010 0000
+ out[8] = _mm256_permute2x128_si256(tr0_0, tr0_8, 0x31); // 0011 0001
+ out[1] = _mm256_permute2x128_si256(tr0_1, tr0_9, 0x20);
+ out[9] = _mm256_permute2x128_si256(tr0_1, tr0_9, 0x31);
+ out[2] = _mm256_permute2x128_si256(tr0_2, tr0_a, 0x20);
+ out[10] = _mm256_permute2x128_si256(tr0_2, tr0_a, 0x31);
+ out[3] = _mm256_permute2x128_si256(tr0_3, tr0_b, 0x20);
+ out[11] = _mm256_permute2x128_si256(tr0_3, tr0_b, 0x31);
+
+ out[4] = _mm256_permute2x128_si256(tr0_4, tr0_c, 0x20);
+ out[12] = _mm256_permute2x128_si256(tr0_4, tr0_c, 0x31);
+ out[5] = _mm256_permute2x128_si256(tr0_5, tr0_d, 0x20);
+ out[13] = _mm256_permute2x128_si256(tr0_5, tr0_d, 0x31);
+ out[6] = _mm256_permute2x128_si256(tr0_6, tr0_e, 0x20);
+ out[14] = _mm256_permute2x128_si256(tr0_6, tr0_e, 0x31);
+ out[7] = _mm256_permute2x128_si256(tr0_7, tr0_f, 0x20);
+ out[15] = _mm256_permute2x128_si256(tr0_7, tr0_f, 0x31);
}
-static INLINE __m256i butter_fly(__m256i a0, __m256i a1, const __m256i cospi) {
+static INLINE __m256i butter_fly(const __m256i *a0, const __m256i *a1,
+ const __m256i *cospi) {
const __m256i dct_rounding = _mm256_set1_epi32(DCT_CONST_ROUNDING);
- __m256i y0 = _mm256_madd_epi16(a0, cospi);
- __m256i y1 = _mm256_madd_epi16(a1, cospi);
+ __m256i y0 = _mm256_madd_epi16(*a0, *cospi);
+ __m256i y1 = _mm256_madd_epi16(*a1, *cospi);
y0 = _mm256_add_epi32(y0, dct_rounding);
y1 = _mm256_add_epi32(y1, dct_rounding);
diff --git a/third_party/aom/aom_mem/aom_mem.cmake b/third_party/aom/aom_mem/aom_mem.cmake
index 0375b09e0..6ea5ae0d4 100644
--- a/third_party/aom/aom_mem/aom_mem.cmake
+++ b/third_party/aom/aom_mem/aom_mem.cmake
@@ -8,6 +8,9 @@
## Media Patent License 1.0 was not distributed with this source code in the
## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
##
+if (NOT AOM_AOM_MEM_AOM_MEM_CMAKE_)
+set(AOM_AOM_MEM_AOM_MEM_CMAKE_ 1)
+
set(AOM_MEM_SOURCES
"${AOM_ROOT}/aom_mem/aom_mem.c"
"${AOM_ROOT}/aom_mem/aom_mem.h"
@@ -20,3 +23,5 @@ function (setup_aom_mem_targets)
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_mem PARENT_SCOPE)
target_sources(aom PUBLIC $<TARGET_OBJECTS:aom_mem>)
endfunction ()
+
+endif () # AOM_AOM_MEM_AOM_MEM_CMAKE_
diff --git a/third_party/aom/aom_mem/aom_mem.h b/third_party/aom/aom_mem/aom_mem.h
index 75bd4be65..0d533c813 100644
--- a/third_party/aom/aom_mem/aom_mem.h
+++ b/third_party/aom/aom_mem/aom_mem.h
@@ -39,6 +39,25 @@ void *aom_memset16(void *dest, int val, size_t length);
#include AOM_MEM_PLTFRM
#endif
+#if CONFIG_DEBUG
+#define AOM_CHECK_MEM_ERROR(error_info, lval, expr) \
+ do { \
+ lval = (expr); \
+ if (!lval) \
+ aom_internal_error(error_info, AOM_CODEC_MEM_ERROR, \
+ "Failed to allocate " #lval " at %s:%d", __FILE__, \
+ __LINE__); \
+ } while (0)
+#else
+#define AOM_CHECK_MEM_ERROR(error_info, lval, expr) \
+ do { \
+ lval = (expr); \
+ if (!lval) \
+ aom_internal_error(error_info, AOM_CODEC_MEM_ERROR, \
+ "Failed to allocate " #lval); \
+ } while (0)
+#endif
+
#if defined(__cplusplus)
}
#endif
diff --git a/third_party/aom/aom_ports/aom_ports.cmake b/third_party/aom/aom_ports/aom_ports.cmake
index 3e8883d56..00ec28c16 100644
--- a/third_party/aom/aom_ports/aom_ports.cmake
+++ b/third_party/aom/aom_ports/aom_ports.cmake
@@ -8,6 +8,9 @@
## Media Patent License 1.0 was not distributed with this source code in the
## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
##
+if (NOT AOM_AOM_PORTS_AOM_PORTS_CMAKE_)
+set(AOM_AOM_PORTS_AOM_PORTS_CMAKE_ 1)
+
set(AOM_PORTS_INCLUDES
"${AOM_ROOT}/aom_ports/aom_once.h"
"${AOM_ROOT}/aom_ports/aom_timer.h"
@@ -64,3 +67,5 @@ function (setup_aom_ports_targets)
endif ()
endif ()
endfunction ()
+
+endif () # AOM_AOM_PORTS_AOM_PORTS_CMAKE_
diff --git a/third_party/aom/aom_ports/arm_cpudetect.c b/third_party/aom/aom_ports/arm_cpudetect.c
index 65ba846c9..4dd1a1a62 100644
--- a/third_party/aom/aom_ports/arm_cpudetect.c
+++ b/third_party/aom/aom_ports/arm_cpudetect.c
@@ -50,9 +50,6 @@ int arm_cpu_caps(void) {
return flags;
}
mask = arm_cpu_env_mask();
-#if HAVE_MEDIA
- flags |= HAS_MEDIA;
-#endif /* HAVE_MEDIA */
#if HAVE_NEON || HAVE_NEON_ASM
flags |= HAS_NEON;
#endif /* HAVE_NEON || HAVE_NEON_ASM */
@@ -76,17 +73,6 @@ int arm_cpu_caps(void) {
* instructions via their assembled hex code.
* All of these instructions should be essentially nops.
*/
-#if HAVE_MEDIA
- if (mask & HAS_MEDIA) {
- __try {
- /*SHADD8 r3,r3,r3*/
- __emit(0xE6333F93);
- flags |= HAS_MEDIA;
- } __except (GetExceptionCode() == EXCEPTION_ILLEGAL_INSTRUCTION) {
- /*Ignore exception.*/
- }
- }
-#endif /* HAVE_MEDIA */
#if HAVE_NEON || HAVE_NEON_ASM
if (mask & HAS_NEON) {
__try {
@@ -114,9 +100,6 @@ int arm_cpu_caps(void) {
mask = arm_cpu_env_mask();
features = android_getCpuFeatures();
-#if HAVE_MEDIA
- flags |= HAS_MEDIA;
-#endif /* HAVE_MEDIA */
#if HAVE_NEON || HAVE_NEON_ASM
if (features & ANDROID_CPU_ARM_FEATURE_NEON) flags |= HAS_NEON;
#endif /* HAVE_NEON || HAVE_NEON_ASM */
@@ -155,15 +138,6 @@ int arm_cpu_caps(void) {
}
}
#endif /* HAVE_NEON || HAVE_NEON_ASM */
-#if HAVE_MEDIA
- if (memcmp(buf, "CPU architecture:", 17) == 0) {
- int version;
- version = atoi(buf + 17);
- if (version >= 6) {
- flags |= HAS_MEDIA;
- }
- }
-#endif /* HAVE_MEDIA */
}
fclose(fin);
}
diff --git a/third_party/aom/aom_scale/aom_scale.cmake b/third_party/aom/aom_scale/aom_scale.cmake
index a6aa31afc..e1e3f6cfb 100644
--- a/third_party/aom/aom_scale/aom_scale.cmake
+++ b/third_party/aom/aom_scale/aom_scale.cmake
@@ -8,6 +8,9 @@
## Media Patent License 1.0 was not distributed with this source code in the
## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
##
+if (NOT AOM_AOM_SCALE_AOM_SCALE_CMAKE_)
+set(AOM_AOM_SCALE_AOM_SCALE_CMAKE_ 1)
+
set(AOM_SCALE_SOURCES
"${AOM_ROOT}/aom_scale/aom_scale.h"
"${AOM_ROOT}/aom_scale/generic/aom_scale.c"
@@ -32,3 +35,5 @@ function (setup_aom_scale_targets)
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_scale PARENT_SCOPE)
endfunction ()
+
+endif () # AOM_AOM_SCALE_AOM_SCALE_CMAKE_
diff --git a/third_party/aom/aom_util/aom_util.cmake b/third_party/aom/aom_util/aom_util.cmake
index 484d9d9a0..68f525335 100644
--- a/third_party/aom/aom_util/aom_util.cmake
+++ b/third_party/aom/aom_util/aom_util.cmake
@@ -8,6 +8,9 @@
## Media Patent License 1.0 was not distributed with this source code in the
## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
##
+if (NOT AOM_AOM_UTIL_AOM_UTIL_CMAKE_)
+set(AOM_AOM_UTIL_AOM_UTIL_CMAKE_ 1)
+
set(AOM_UTIL_SOURCES
"${AOM_ROOT}/aom_util/aom_thread.c"
"${AOM_ROOT}/aom_util/aom_thread.h"
@@ -27,3 +30,5 @@ function (setup_aom_util_targets)
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_util PARENT_SCOPE)
target_sources(aom PUBLIC $<TARGET_OBJECTS:aom_util>)
endfunction ()
+
+endif () # AOM_AOM_UTIL_AOM_UTIL_CMAKE_
diff --git a/third_party/aom/aom_util/debug_util.c b/third_party/aom/aom_util/debug_util.c
index 071d66976..ea73df8da 100644
--- a/third_party/aom/aom_util/debug_util.c
+++ b/third_party/aom/aom_util/debug_util.c
@@ -16,12 +16,8 @@
#define QUEUE_MAX_SIZE 2000000
static int result_queue[QUEUE_MAX_SIZE];
-#if CONFIG_DAALA_EC
static int nsymbs_queue[QUEUE_MAX_SIZE];
static aom_cdf_prob cdf_queue[QUEUE_MAX_SIZE][16];
-#else
-static int prob_queue[QUEUE_MAX_SIZE];
-#endif
static int queue_r = 0;
static int queue_w = 0;
@@ -53,42 +49,24 @@ int bitstream_queue_get_write(void) { return queue_w; }
int bitstream_queue_get_read(void) { return queue_r; }
-void bitstream_queue_pop(int *result,
-#if CONFIG_DAALA_EC
- aom_cdf_prob *cdf, int *nsymbs) {
-#else
- int *prob) {
-#endif // CONFIG_DAALA_EC
+void bitstream_queue_pop(int *result, aom_cdf_prob *cdf, int *nsymbs) {
if (!skip_r) {
if (queue_w == queue_r) {
printf("buffer underflow queue_w %d queue_r %d\n", queue_w, queue_r);
assert(0);
}
*result = result_queue[queue_r];
-#if CONFIG_DAALA_EC
*nsymbs = nsymbs_queue[queue_r];
memcpy(cdf, cdf_queue[queue_r], *nsymbs * sizeof(*cdf));
-#else
- *prob = prob_queue[queue_r];
-#endif // CONFIG_DAALA_EC
queue_r = (queue_r + 1) % QUEUE_MAX_SIZE;
}
}
-void bitstream_queue_push(int result,
-#if CONFIG_DAALA_EC
- const aom_cdf_prob *cdf, int nsymbs) {
-#else
- int prob) {
-#endif // CONFIG_DAALA_EC
+void bitstream_queue_push(int result, const aom_cdf_prob *cdf, int nsymbs) {
if (!skip_w) {
result_queue[queue_w] = result;
-#if CONFIG_DAALA_EC
nsymbs_queue[queue_w] = nsymbs;
memcpy(cdf_queue[queue_w], cdf, nsymbs * sizeof(*cdf));
-#else
- prob_queue[queue_w] = prob;
-#endif // CONFIG_DAALA_EC
queue_w = (queue_w + 1) % QUEUE_MAX_SIZE;
if (queue_w == queue_r) {
printf("buffer overflow queue_w %d queue_r %d\n", queue_w, queue_r);
diff --git a/third_party/aom/aom_util/debug_util.h b/third_party/aom/aom_util/debug_util.h
index 2ed56ea22..3740620a2 100644
--- a/third_party/aom/aom_util/debug_util.h
+++ b/third_party/aom/aom_util/debug_util.h
@@ -13,9 +13,7 @@
#define AOM_UTIL_DEBUG_UTIL_H_
#include "./aom_config.h"
-#if CONFIG_DAALA_EC
#include "aom_dsp/prob.h"
-#endif
#ifdef __cplusplus
extern "C" {
@@ -33,13 +31,8 @@ int bitstream_queue_get_write(void);
int bitstream_queue_get_read(void);
void bitstream_queue_record_write(void);
void bitstream_queue_reset_write(void);
-#if CONFIG_DAALA_EC
void bitstream_queue_pop(int *result, aom_cdf_prob *cdf, int *nsymbs);
void bitstream_queue_push(int result, const aom_cdf_prob *cdf, int nsymbs);
-#else
-void bitstream_queue_pop(int *result, int *prob);
-void bitstream_queue_push(int result, int prob);
-#endif
void bitstream_queue_set_skip_write(int skip);
void bitstream_queue_set_skip_read(int skip);
void bitstream_queue_set_frame_write(int frame_idx);
diff --git a/third_party/aom/aomdec.c b/third_party/aom/aomdec.c
index f74baddb7..289776141 100644
--- a/third_party/aom/aomdec.c
+++ b/third_party/aom/aomdec.c
@@ -312,8 +312,6 @@ static int file_is_raw(struct AvxInputContext *input) {
int is_raw = 0;
aom_codec_stream_info_t si;
- si.sz = sizeof(si);
-
if (fread(buf, 1, 32, input->file) == 32) {
int i;
@@ -892,28 +890,32 @@ static int main_loop(int argc, const char **argv_) {
output_bit_depth = img->bit_depth;
}
// Shift up or down if necessary
- if (output_bit_depth != 0 && output_bit_depth != img->bit_depth) {
+ if (output_bit_depth != 0) {
const aom_img_fmt_t shifted_fmt =
output_bit_depth == 8
? img->fmt ^ (img->fmt & AOM_IMG_FMT_HIGHBITDEPTH)
: img->fmt | AOM_IMG_FMT_HIGHBITDEPTH;
- if (img_shifted &&
- img_shifted_realloc_required(img, img_shifted, shifted_fmt)) {
- aom_img_free(img_shifted);
- img_shifted = NULL;
- }
- if (!img_shifted) {
- img_shifted =
- aom_img_alloc(NULL, shifted_fmt, img->d_w, img->d_h, 16);
- img_shifted->bit_depth = output_bit_depth;
- }
- if (output_bit_depth > img->bit_depth) {
- aom_img_upshift(img_shifted, img, output_bit_depth - img->bit_depth);
- } else {
- aom_img_downshift(img_shifted, img,
- img->bit_depth - output_bit_depth);
+
+ if (shifted_fmt != img->fmt || output_bit_depth != img->bit_depth) {
+ if (img_shifted &&
+ img_shifted_realloc_required(img, img_shifted, shifted_fmt)) {
+ aom_img_free(img_shifted);
+ img_shifted = NULL;
+ }
+ if (!img_shifted) {
+ img_shifted =
+ aom_img_alloc(NULL, shifted_fmt, img->d_w, img->d_h, 16);
+ img_shifted->bit_depth = output_bit_depth;
+ }
+ if (output_bit_depth > img->bit_depth) {
+ aom_img_upshift(img_shifted, img,
+ output_bit_depth - img->bit_depth);
+ } else {
+ aom_img_downshift(img_shifted, img,
+ img->bit_depth - output_bit_depth);
+ }
+ img = img_shifted;
}
- img = img_shifted;
}
#endif
diff --git a/third_party/aom/aomenc.c b/third_party/aom/aomenc.c
index f4bf888ce..ec1935aed 100644
--- a/third_party/aom/aomenc.c
+++ b/third_party/aom/aomenc.c
@@ -25,7 +25,7 @@
#endif
#include "aom/aom_encoder.h"
-#if CONFIG_DECODERS
+#if CONFIG_AV1_DECODER
#include "aom/aom_decoder.h"
#endif
@@ -45,6 +45,7 @@
#include "./rate_hist.h"
#include "./warnings.h"
#include "aom/aom_integer.h"
+#include "aom_dsp/aom_dsp_common.h"
#include "aom_ports/aom_timer.h"
#include "aom_ports/mem_ops.h"
#if CONFIG_WEBM_IO
@@ -627,7 +628,6 @@ void usage_exit(void) {
exit(EXIT_FAILURE);
}
-#define NELEMENTS(x) (sizeof(x) / sizeof(x[0]))
#if CONFIG_AV1_ENCODER
#define ARG_CTRL_CNT_MAX NELEMENTS(av1_arg_ctrl_map)
#endif
@@ -1061,15 +1061,8 @@ static int parse_stream_params(struct AvxEncoderConfig *global,
}
}
#if CONFIG_HIGHBITDEPTH
-#if CONFIG_LOWBITDEPTH
- if (strcmp(global->codec->name, "av1") == 0 ||
- strcmp(global->codec->name, "av1") == 0) {
- config->use_16bit_internal =
- test_16bit_internal | (config->cfg.g_profile > 1);
- }
-#else
- config->use_16bit_internal = 1;
-#endif
+ config->use_16bit_internal =
+ test_16bit_internal || (config->cfg.g_profile > 1) || !CONFIG_LOWBITDEPTH;
#endif
return eos_mark_found;
}
@@ -1344,13 +1337,13 @@ static void initialize_encoder(struct stream_state *stream,
ctx_exit_on_error(&stream->encoder, "Failed to control codec");
}
-#if CONFIG_DECODERS
+#if CONFIG_AV1_DECODER
if (global->test_decode != TEST_DECODE_OFF) {
const AvxInterface *decoder = get_aom_decoder_by_name(global->codec->name);
aom_codec_dec_cfg_t cfg = { 0, 0, 0 };
aom_codec_dec_init(&stream->decoder, decoder->codec_interface(), &cfg, 0);
-#if CONFIG_AV1_DECODER && CONFIG_EXT_TILE
+#if CONFIG_EXT_TILE
if (strcmp(global->codec->name, "av1") == 0) {
aom_codec_control(&stream->decoder, AV1_SET_DECODE_TILE_ROW, -1);
ctx_exit_on_error(&stream->decoder, "Failed to set decode_tile_row");
@@ -1510,7 +1503,7 @@ static void get_cx_data(struct stream_state *stream,
stream->nbytes += pkt->data.raw.sz;
*got_data = 1;
-#if CONFIG_DECODERS
+#if CONFIG_AV1_DECODER
if (global->test_decode != TEST_DECODE_OFF && !stream->mismatch_seen) {
aom_codec_decode(&stream->decoder, pkt->data.frame.buf,
(unsigned int)pkt->data.frame.sz, NULL, 0);
diff --git a/third_party/aom/av1/av1.cmake b/third_party/aom/av1/av1.cmake
index 00f687a0d..56412c90a 100644
--- a/third_party/aom/av1/av1.cmake
+++ b/third_party/aom/av1/av1.cmake
@@ -8,6 +8,9 @@
## Media Patent License 1.0 was not distributed with this source code in the
## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
##
+if (NOT AOM_AV1_AV1_CMAKE_)
+set(AOM_AV1_AV1_CMAKE_ 1)
+
set(AOM_AV1_COMMON_SOURCES
"${AOM_ROOT}/av1/av1_iface_common.h"
"${AOM_ROOT}/av1/common/alloccommon.c"
@@ -16,11 +19,11 @@ set(AOM_AV1_COMMON_SOURCES
"${AOM_ROOT}/av1/common/av1_fwd_txfm1d.c"
"${AOM_ROOT}/av1/common/av1_fwd_txfm1d.h"
"${AOM_ROOT}/av1/common/av1_fwd_txfm2d.c"
- "${AOM_ROOT}/av1/common/av1_fwd_txfm2d_cfg.h"
+ "${AOM_ROOT}/av1/common/av1_fwd_txfm1d_cfg.h"
"${AOM_ROOT}/av1/common/av1_inv_txfm1d.c"
"${AOM_ROOT}/av1/common/av1_inv_txfm1d.h"
"${AOM_ROOT}/av1/common/av1_inv_txfm2d.c"
- "${AOM_ROOT}/av1/common/av1_inv_txfm2d_cfg.h"
+ "${AOM_ROOT}/av1/common/av1_inv_txfm1d_cfg.h"
"${AOM_ROOT}/av1/common/av1_loopfilter.c"
"${AOM_ROOT}/av1/common/av1_loopfilter.h"
"${AOM_ROOT}/av1/common/av1_txfm.h"
@@ -60,7 +63,6 @@ set(AOM_AV1_COMMON_SOURCES
"${AOM_ROOT}/av1/common/reconintra.h"
"${AOM_ROOT}/av1/common/resize.c"
"${AOM_ROOT}/av1/common/resize.h"
- "${AOM_ROOT}/av1/common/restoration.h"
"${AOM_ROOT}/av1/common/scale.c"
"${AOM_ROOT}/av1/common/scale.h"
"${AOM_ROOT}/av1/common/scan.c"
@@ -146,13 +148,9 @@ set(AOM_AV1_ENCODER_SOURCES
"${AOM_ROOT}/av1/encoder/tokenize.c"
"${AOM_ROOT}/av1/encoder/tokenize.h"
"${AOM_ROOT}/av1/encoder/treewriter.c"
- "${AOM_ROOT}/av1/encoder/treewriter.h"
- "${AOM_ROOT}/av1/encoder/variance_tree.c"
- "${AOM_ROOT}/av1/encoder/variance_tree.h")
+ "${AOM_ROOT}/av1/encoder/treewriter.h")
set(AOM_AV1_COMMON_INTRIN_SSE2
- # Requires CONFIG_GLOBAL_MOTION or CONFIG_WARPED_MOTION
- #"${AOM_ROOT}/av1/common/x86/warp_plane_sse2.c"
"${AOM_ROOT}/av1/common/x86/idct_intrin_sse2.c")
set(AOM_AV1_COMMON_INTRIN_SSSE3
@@ -293,6 +291,27 @@ if (CONFIG_ACCOUNTING)
"${AOM_ROOT}/av1/decoder/accounting.h")
endif ()
+if (CONFIG_GLOBAL_MOTION)
+ set(AOM_AV1_ENCODER_SOURCES
+ ${AOM_AV1_ENCODER_SOURCES}
+ "${AOM_ROOT}/av1/encoder/corner_detect.c"
+ "${AOM_ROOT}/av1/encoder/corner_detect.h"
+ "${AOM_ROOT}/av1/encoder/corner_match.c"
+ "${AOM_ROOT}/av1/encoder/corner_match.h"
+ "${AOM_ROOT}/av1/encoder/global_motion.c"
+ "${AOM_ROOT}/av1/encoder/global_motion.h"
+ "${AOM_ROOT}/av1/encoder/ransac.c"
+ "${AOM_ROOT}/av1/encoder/ransac.h"
+ "${AOM_ROOT}/third_party/fastfeat/fast_9.c"
+ "${AOM_ROOT}/third_party/fastfeat/fast.c"
+ "${AOM_ROOT}/third_party/fastfeat/fast.h"
+ "${AOM_ROOT}/third_party/fastfeat/nonmax.c")
+
+ set(AOM_AV1_ENCODER_INTRIN_SSE4_1
+ ${AOM_AV1_ENCODER_INTRIN_SSE4_1}
+ "${AOM_ROOT}/av1/encoder/x86/corner_match_sse4.c")
+endif ()
+
if (CONFIG_INSPECTION)
set(AOM_AV1_DECODER_SOURCES
${AOM_AV1_DECODER_SOURCES}
@@ -320,6 +339,22 @@ if (CONFIG_CFL)
"${AOM_ROOT}/av1/common/cfl.h")
endif ()
+if (CONFIG_LOOP_RESTORATION)
+ set(AOM_AV1_COMMON_SOURCES
+ ${AOM_AV1_COMMON_SOURCES}
+ "${AOM_ROOT}/av1/common/restoration.c"
+ "${AOM_ROOT}/av1/common/restoration.h")
+
+ set(AOM_AV1_COMMON_INTRIN_SSE4_1
+ ${AOM_AV1_COMMON_INTRIN_SSE4_1}
+ "${AOM_ROOT}/av1/common/x86/selfguided_sse4.c")
+
+ set(AOM_AV1_ENCODER_SOURCES
+ ${AOM_AV1_ENCODER_SOURCES}
+ "${AOM_ROOT}/av1/encoder/pickrst.c"
+ "${AOM_ROOT}/av1/encoder/pickrst.h")
+endif ()
+
if (CONFIG_PVQ)
set(AOM_AV1_COMMON_SOURCES
${AOM_AV1_COMMON_SOURCES}
@@ -382,7 +417,7 @@ if (CONFIG_PVQ)
endif ()
endif ()
-if (CONFIG_WARPED_MOTION)
+if (CONFIG_WARPED_MOTION OR CONFIG_GLOBAL_MOTION)
set(AOM_AV1_COMMON_SOURCES
${AOM_AV1_COMMON_SOURCES}
"${AOM_ROOT}/av1/common/warped_motion.c"
@@ -391,6 +426,16 @@ if (CONFIG_WARPED_MOTION)
set(AOM_AV1_COMMON_INTRIN_SSE2
${AOM_AV1_COMMON_INTRIN_SSE2}
"${AOM_ROOT}/av1/common/x86/warp_plane_sse2.c")
+
+ set(AOM_AV1_COMMON_INTRIN_SSSE3
+ ${AOM_AV1_COMMON_INTRIN_SSSE3}
+ "${AOM_ROOT}/av1/common/x86/warp_plane_ssse3.c")
+
+ if (CONFIG_HIGHBITDEPTH)
+ set(AOM_AV1_COMMON_INTRIN_SSSE3
+ ${AOM_AV1_COMMON_INTRIN_SSSE3}
+ "${AOM_ROOT}/av1/common/x86/highbd_warp_plane_ssse3.c")
+ endif ()
endif ()
# Setup AV1 common/decoder/encoder targets. The libaom target must exist before
@@ -516,3 +561,5 @@ endfunction ()
function (setup_av1_test_targets)
endfunction ()
+
+endif () # AOM_AV1_AV1_CMAKE_
diff --git a/third_party/aom/av1/av1_common.mk b/third_party/aom/av1/av1_common.mk
index 6b9a289af..ecbfbdb2c 100644
--- a/third_party/aom/av1/av1_common.mk
+++ b/third_party/aom/av1/av1_common.mk
@@ -58,7 +58,6 @@ AV1_COMMON_SRCS-yes += common/reconinter.c
AV1_COMMON_SRCS-yes += common/reconintra.c
AV1_COMMON_SRCS-yes += common/resize.c
AV1_COMMON_SRCS-yes += common/resize.h
-AV1_COMMON_SRCS-yes += common/restoration.h
AV1_COMMON_SRCS-yes += common/common_data.h
AV1_COMMON_SRCS-yes += common/scan.c
AV1_COMMON_SRCS-yes += common/scan.h
@@ -69,9 +68,9 @@ AV1_COMMON_SRCS-yes += common/av1_fwd_txfm1d.c
AV1_COMMON_SRCS-yes += common/av1_inv_txfm1d.h
AV1_COMMON_SRCS-yes += common/av1_inv_txfm1d.c
AV1_COMMON_SRCS-yes += common/av1_fwd_txfm2d.c
-AV1_COMMON_SRCS-yes += common/av1_fwd_txfm2d_cfg.h
+AV1_COMMON_SRCS-yes += common/av1_fwd_txfm1d_cfg.h
AV1_COMMON_SRCS-yes += common/av1_inv_txfm2d.c
-AV1_COMMON_SRCS-yes += common/av1_inv_txfm2d_cfg.h
+AV1_COMMON_SRCS-yes += common/av1_inv_txfm1d_cfg.h
AV1_COMMON_SRCS-$(HAVE_SSSE3) += common/x86/av1_convolve_ssse3.c
ifeq ($(CONFIG_HIGHBITDEPTH),yes)
AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/av1_highbd_convolve_sse4.c
@@ -172,6 +171,7 @@ endif
ifneq ($(findstring yes,$(CONFIG_GLOBAL_MOTION) $(CONFIG_WARPED_MOTION)),)
AV1_COMMON_SRCS-$(HAVE_SSE2) += common/x86/warp_plane_sse2.c
+AV1_COMMON_SRCS-$(HAVE_SSSE3) += common/x86/warp_plane_ssse3.c
ifeq ($(CONFIG_HIGHBITDEPTH),yes)
AV1_COMMON_SRCS-$(HAVE_SSSE3) += common/x86/highbd_warp_plane_ssse3.c
endif
diff --git a/third_party/aom/av1/av1_cx.mk b/third_party/aom/av1/av1_cx.mk
index 0a0d770ce..6af5c61cb 100644
--- a/third_party/aom/av1/av1_cx.mk
+++ b/third_party/aom/av1/av1_cx.mk
@@ -23,8 +23,6 @@ AV1_CX_SRCS-yes += encoder/av1_quantize.h
AV1_CX_SRCS-yes += encoder/bitstream.c
AV1_CX_SRCS-yes += encoder/context_tree.c
AV1_CX_SRCS-yes += encoder/context_tree.h
-AV1_CX_SRCS-yes += encoder/variance_tree.c
-AV1_CX_SRCS-yes += encoder/variance_tree.h
AV1_CX_SRCS-yes += encoder/cost.h
AV1_CX_SRCS-yes += encoder/cost.c
AV1_CX_SRCS-yes += encoder/dct.c
@@ -38,6 +36,7 @@ AV1_CX_SRCS-yes += encoder/ethread.h
AV1_CX_SRCS-yes += encoder/ethread.c
AV1_CX_SRCS-yes += encoder/extend.c
AV1_CX_SRCS-yes += encoder/firstpass.c
+AV1_CX_SRCS-yes += encoder/mathutils.h
AV1_CX_SRCS-$(CONFIG_GLOBAL_MOTION) += ../third_party/fastfeat/fast.h
AV1_CX_SRCS-$(CONFIG_GLOBAL_MOTION) += ../third_party/fastfeat/nonmax.c
AV1_CX_SRCS-$(CONFIG_GLOBAL_MOTION) += ../third_party/fastfeat/fast_9.c
@@ -162,4 +161,8 @@ AV1_CX_SRCS-$(HAVE_MSA) += encoder/mips/msa/fdct16x16_msa.c
AV1_CX_SRCS-$(HAVE_MSA) += encoder/mips/msa/fdct_msa.h
AV1_CX_SRCS-$(HAVE_MSA) += encoder/mips/msa/temporal_filter_msa.c
+ifeq ($(CONFIG_GLOBAL_MOTION),yes)
+AV1_CX_SRCS-$(HAVE_SSE4_1) += encoder/x86/corner_match_sse4.c
+endif
+
AV1_CX_SRCS-yes := $(filter-out $(AV1_CX_SRCS_REMOVE-yes),$(AV1_CX_SRCS-yes))
diff --git a/third_party/aom/av1/av1_cx_iface.c b/third_party/aom/av1/av1_cx_iface.c
index d4832a15c..4e13409df 100644
--- a/third_party/aom/av1/av1_cx_iface.c
+++ b/third_party/aom/av1/av1_cx_iface.c
@@ -483,6 +483,16 @@ static aom_codec_err_t set_encoder_config(
oxcf->resize_mode = RESIZE_NONE;
}
+ // Initialize to input resolution if not specified.
+ if (oxcf->resize_mode != RESIZE_FIXED) {
+ oxcf->scaled_frame_width = oxcf->width;
+ oxcf->scaled_frame_height = oxcf->height;
+ }
+
+#if CONFIG_FRAME_SUPERRES
+ oxcf->superres_enabled = 1; // TODO(afergs): Check the config
+#endif // CONFIG_FRAME_SUPERRES
+
oxcf->maximum_buffer_size_ms = is_vbr ? 240000 : cfg->rc_buf_sz;
oxcf->starting_buffer_level_ms = is_vbr ? 60000 : cfg->rc_buf_initial_sz;
oxcf->optimal_buffer_level_ms = is_vbr ? 60000 : cfg->rc_buf_optimal_sz;
diff --git a/third_party/aom/av1/av1_dx_iface.c b/third_party/aom/av1/av1_dx_iface.c
index f20ea4815..8f069093b 100644
--- a/third_party/aom/av1/av1_dx_iface.c
+++ b/third_party/aom/av1/av1_dx_iface.c
@@ -31,8 +31,6 @@
#include "av1/av1_iface_common.h"
-typedef aom_codec_stream_info_t av1_stream_info_t;
-
// This limit is due to framebuffer numbers.
// TODO(hkuang): Remove this limit after implementing ondemand framebuffers.
#define FRAME_CACHE_SIZE 6 // Cache maximum 6 decoded frames.
@@ -45,7 +43,7 @@ typedef struct cache_frame {
struct aom_codec_alg_priv {
aom_codec_priv_t base;
aom_codec_dec_cfg_t cfg;
- av1_stream_info_t si;
+ aom_codec_stream_info_t si;
int postproc_cfg_set;
aom_postproc_cfg_t postproc_cfg;
aom_decrypt_cb decrypt_cb;
@@ -101,7 +99,6 @@ static aom_codec_err_t decoder_init(aom_codec_ctx_t *ctx,
ctx->priv = (aom_codec_priv_t *)priv;
ctx->priv->init_flags = ctx->init_flags;
- priv->si.sz = sizeof(priv->si);
priv->flushed = 0;
// Only do frame parallel decode when threads > 1.
priv->frame_parallel_decode =
@@ -263,11 +260,7 @@ static aom_codec_err_t decoder_peek_si(const uint8_t *data,
static aom_codec_err_t decoder_get_si(aom_codec_alg_priv_t *ctx,
aom_codec_stream_info_t *si) {
- const size_t sz = (si->sz >= sizeof(av1_stream_info_t))
- ? sizeof(av1_stream_info_t)
- : sizeof(aom_codec_stream_info_t);
- memcpy(si, &ctx->si, sz);
- si->sz = (unsigned int)sz;
+ memcpy(si, &ctx->si, sizeof(*si));
return AOM_CODEC_OK;
}
diff --git a/third_party/aom/av1/common/alloccommon.c b/third_party/aom/av1/common/alloccommon.c
index 79d41a9c8..80f6b095f 100644
--- a/third_party/aom/av1/common/alloccommon.c
+++ b/third_party/aom/av1/common/alloccommon.c
@@ -125,6 +125,11 @@ void av1_free_context_buffers(AV1_COMMON *cm) {
#if CONFIG_VAR_TX
aom_free(cm->above_txfm_context);
cm->above_txfm_context = NULL;
+
+ for (i = 0; i < MAX_MB_PLANE; ++i) {
+ aom_free(cm->top_txfm_context[i]);
+ cm->top_txfm_context[i] = NULL;
+ }
#endif
}
@@ -155,7 +160,8 @@ int av1_alloc_context_buffers(AV1_COMMON *cm, int width, int height) {
for (i = 0; i < MAX_MB_PLANE; i++) {
aom_free(cm->above_context[i]);
cm->above_context[i] = (ENTROPY_CONTEXT *)aom_calloc(
- 2 * aligned_mi_cols, sizeof(*cm->above_context[0]));
+ aligned_mi_cols << (MI_SIZE_LOG2 - tx_size_wide_log2[0]),
+ sizeof(*cm->above_context[0]));
if (!cm->above_context[i]) goto fail;
}
@@ -167,8 +173,16 @@ int av1_alloc_context_buffers(AV1_COMMON *cm, int width, int height) {
#if CONFIG_VAR_TX
aom_free(cm->above_txfm_context);
cm->above_txfm_context = (TXFM_CONTEXT *)aom_calloc(
- aligned_mi_cols, sizeof(*cm->above_txfm_context));
+ aligned_mi_cols << TX_UNIT_WIDE_LOG2, sizeof(*cm->above_txfm_context));
if (!cm->above_txfm_context) goto fail;
+
+ for (i = 0; i < MAX_MB_PLANE; ++i) {
+ aom_free(cm->top_txfm_context[i]);
+ cm->top_txfm_context[i] =
+ (TXFM_CONTEXT *)aom_calloc(aligned_mi_cols << TX_UNIT_WIDE_LOG2,
+ sizeof(*cm->top_txfm_context[0]));
+ if (!cm->top_txfm_context[i]) goto fail;
+ }
#endif
cm->above_context_alloc_cols = aligned_mi_cols;
diff --git a/third_party/aom/av1/common/av1_fwd_txfm1d.c b/third_party/aom/av1/common/av1_fwd_txfm1d.c
index 7a691e03f..cfe274185 100644
--- a/third_party/aom/av1/common/av1_fwd_txfm1d.c
+++ b/third_party/aom/av1/common/av1_fwd_txfm1d.c
@@ -10,6 +10,7 @@
*/
#include <stdlib.h>
+#include "aom_dsp/inv_txfm.h"
#include "av1/common/av1_fwd_txfm1d.h"
#if CONFIG_COEFFICIENT_RANGE_CHECKING
@@ -53,7 +54,7 @@ void av1_fdct4_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
// stage 2
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
@@ -100,7 +101,7 @@ void av1_fdct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
// stage 2
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[3];
@@ -115,7 +116,7 @@ void av1_fdct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
// stage 3
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
@@ -130,7 +131,7 @@ void av1_fdct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
// stage 4
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -193,7 +194,7 @@ void av1_fdct16_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[7];
@@ -216,7 +217,7 @@ void av1_fdct16_new(const int32_t *input, int32_t *output,
// stage 3
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0] + bf0[3];
@@ -239,7 +240,7 @@ void av1_fdct16_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
@@ -262,7 +263,7 @@ void av1_fdct16_new(const int32_t *input, int32_t *output,
// stage 5
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0];
@@ -285,7 +286,7 @@ void av1_fdct16_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -380,7 +381,7 @@ void av1_fdct32_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[15];
@@ -419,7 +420,7 @@ void av1_fdct32_new(const int32_t *input, int32_t *output,
// stage 3
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0] + bf0[7];
@@ -458,7 +459,7 @@ void av1_fdct32_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[3];
@@ -497,7 +498,7 @@ void av1_fdct32_new(const int32_t *input, int32_t *output,
// stage 5
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
@@ -536,7 +537,7 @@ void av1_fdct32_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -575,7 +576,7 @@ void av1_fdct32_new(const int32_t *input, int32_t *output,
// stage 7
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0];
@@ -614,7 +615,7 @@ void av1_fdct32_new(const int32_t *input, int32_t *output,
// stage 8
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -713,7 +714,7 @@ void av1_fadst4_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[8], bf0[0], cospi[56], bf0[1], cos_bit[stage]);
@@ -734,7 +735,7 @@ void av1_fadst4_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -781,7 +782,7 @@ void av1_fadst8_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[4], bf0[0], cospi[60], bf0[1], cos_bit[stage]);
@@ -810,7 +811,7 @@ void av1_fadst8_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -839,7 +840,7 @@ void av1_fadst8_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -902,7 +903,7 @@ void av1_fadst16_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[2], bf0[0], cospi[62], bf0[1], cos_bit[stage]);
@@ -947,7 +948,7 @@ void av1_fadst16_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -992,7 +993,7 @@ void av1_fadst16_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -1037,7 +1038,7 @@ void av1_fadst16_new(const int32_t *input, int32_t *output,
// stage 8
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -1132,7 +1133,7 @@ void av1_fadst32_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[1], bf0[0], cospi[63], bf0[1], cos_bit[stage]);
@@ -1209,7 +1210,7 @@ void av1_fadst32_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -1286,7 +1287,7 @@ void av1_fadst32_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -1363,7 +1364,7 @@ void av1_fadst32_new(const int32_t *input, int32_t *output,
// stage 8
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -1440,7 +1441,7 @@ void av1_fadst32_new(const int32_t *input, int32_t *output,
// stage 10
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -1516,6 +1517,38 @@ void av1_fadst32_new(const int32_t *input, int32_t *output,
range_check(stage, input, bf1, size, stage_range[stage]);
}
+#if CONFIG_EXT_TX
+void av1_fidentity4_c(const int32_t *input, int32_t *output,
+ const int8_t *cos_bit, const int8_t *stage_range) {
+ (void)cos_bit;
+ for (int i = 0; i < 4; ++i)
+ output[i] = (int32_t)dct_const_round_shift(input[i] * Sqrt2);
+ range_check(0, input, output, 4, stage_range[0]);
+}
+
+void av1_fidentity8_c(const int32_t *input, int32_t *output,
+ const int8_t *cos_bit, const int8_t *stage_range) {
+ (void)cos_bit;
+ for (int i = 0; i < 8; ++i) output[i] = input[i] * 2;
+ range_check(0, input, output, 8, stage_range[0]);
+}
+
+void av1_fidentity16_c(const int32_t *input, int32_t *output,
+ const int8_t *cos_bit, const int8_t *stage_range) {
+ (void)cos_bit;
+ for (int i = 0; i < 16; ++i)
+ output[i] = (int32_t)dct_const_round_shift(input[i] * 2 * Sqrt2);
+ range_check(0, input, output, 16, stage_range[0]);
+}
+
+void av1_fidentity32_c(const int32_t *input, int32_t *output,
+ const int8_t *cos_bit, const int8_t *stage_range) {
+ (void)cos_bit;
+ for (int i = 0; i < 32; ++i) output[i] = input[i] * 4;
+ range_check(0, input, output, 32, stage_range[0]);
+}
+#endif // CONFIG_EXT_TX
+
#if CONFIG_TX64X64
void av1_fdct64_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
@@ -1531,7 +1564,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 1;
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf1 = output;
bf1[0] = input[0] + input[63];
bf1[1] = input[1] + input[62];
@@ -1601,7 +1634,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[31];
@@ -1672,7 +1705,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 3
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0] + bf0[15];
@@ -1743,7 +1776,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[7];
@@ -1814,7 +1847,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 5
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0] + bf0[3];
@@ -1885,7 +1918,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
@@ -1956,7 +1989,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 7
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0];
@@ -2027,7 +2060,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 8
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -2098,7 +2131,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 9
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0];
@@ -2169,7 +2202,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 10
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -2240,7 +2273,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 11
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0];
diff --git a/third_party/aom/av1/common/av1_fwd_txfm1d.h b/third_party/aom/av1/common/av1_fwd_txfm1d.h
index 9f246717e..f6419303a 100644
--- a/third_party/aom/av1/common/av1_fwd_txfm1d.h
+++ b/third_party/aom/av1/common/av1_fwd_txfm1d.h
@@ -37,6 +37,16 @@ void av1_fadst16_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_fadst32_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
+#if CONFIG_EXT_TX
+void av1_fidentity4_c(const int32_t *input, int32_t *output,
+ const int8_t *cos_bit, const int8_t *stage_range);
+void av1_fidentity8_c(const int32_t *input, int32_t *output,
+ const int8_t *cos_bit, const int8_t *stage_range);
+void av1_fidentity16_c(const int32_t *input, int32_t *output,
+ const int8_t *cos_bit, const int8_t *stage_range);
+void av1_fidentity32_c(const int32_t *input, int32_t *output,
+ const int8_t *cos_bit, const int8_t *stage_range);
+#endif // CONFIG_EXT_TX
#ifdef __cplusplus
}
diff --git a/third_party/aom/av1/common/av1_fwd_txfm1d_cfg.h b/third_party/aom/av1/common/av1_fwd_txfm1d_cfg.h
new file mode 100644
index 000000000..c7942683e
--- /dev/null
+++ b/third_party/aom/av1/common/av1_fwd_txfm1d_cfg.h
@@ -0,0 +1,364 @@
+/*
+ * Copyright (c) 2016, Alliance for Open Media. All rights reserved
+ *
+ * This source code is subject to the terms of the BSD 2 Clause License and
+ * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
+ * was not distributed with this source code in the LICENSE file, you can
+ * obtain it at www.aomedia.org/license/software. If the Alliance for Open
+ * Media Patent License 1.0 was not distributed with this source code in the
+ * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
+ */
+
+#ifndef AV1_FWD_TXFM2D_CFG_H_
+#define AV1_FWD_TXFM2D_CFG_H_
+#include "av1/common/enums.h"
+#include "av1/common/av1_fwd_txfm1d.h"
+// Identity will always use max bitdepth regardless of size
+static const int8_t fwd_stage_range_identity[1] = { 12 };
+
+// ---------------- 4x4 1D constants -----------------------
+// shift
+static const int8_t fwd_shift_4[3] = { 2, 0, 0 };
+
+// stage range
+static const int8_t fwd_stage_range_col_dct_4[4] = { 15, 16, 17, 17 };
+static const int8_t fwd_stage_range_row_dct_4[4] = { 17, 18, 18, 18 };
+static const int8_t fwd_stage_range_col_adst_4[6] = { 15, 15, 16, 17, 17, 17 };
+static const int8_t fwd_stage_range_row_adst_4[6] = { 17, 17, 17, 18, 18, 18 };
+// cos bit
+static const int8_t fwd_cos_bit_col_dct_4[4] = { 13, 13, 13, 13 };
+static const int8_t fwd_cos_bit_row_dct_4[4] = { 13, 13, 13, 13 };
+static const int8_t fwd_cos_bit_col_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
+static const int8_t fwd_cos_bit_row_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
+
+// ---------------- 8x8 1D constants -----------------------
+// shift
+static const int8_t fwd_shift_8[3] = { 2, -1, 0 };
+
+// stage range
+static const int8_t fwd_stage_range_col_dct_8[6] = { 15, 16, 17, 18, 18, 18 };
+static const int8_t fwd_stage_range_row_dct_8[6] = { 17, 18, 19, 19, 19, 19 };
+static const int8_t fwd_stage_range_col_adst_8[8] = { 15, 15, 16, 17,
+ 17, 18, 18, 18 };
+static const int8_t fwd_stage_range_row_adst_8[8] = { 17, 17, 17, 18,
+ 18, 19, 19, 19 };
+
+// cos bit
+static const int8_t fwd_cos_bit_col_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
+static const int8_t fwd_cos_bit_row_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
+static const int8_t fwd_cos_bit_col_adst_8[8] = {
+ 13, 13, 13, 13, 13, 13, 13, 13
+};
+static const int8_t fwd_cos_bit_row_adst_8[8] = {
+ 13, 13, 13, 13, 13, 13, 13, 13
+};
+
+// ---------------- 16x16 1D constants -----------------------
+// shift
+static const int8_t fwd_shift_16[3] = { 2, -2, 0 };
+
+// stage range
+static const int8_t fwd_stage_range_col_dct_16[8] = { 15, 16, 17, 18,
+ 19, 19, 19, 19 };
+static const int8_t fwd_stage_range_row_dct_16[8] = { 17, 18, 19, 20,
+ 20, 20, 20, 20 };
+static const int8_t fwd_stage_range_col_adst_16[10] = { 15, 15, 16, 17, 17,
+ 18, 18, 19, 19, 19 };
+static const int8_t fwd_stage_range_row_adst_16[10] = { 17, 17, 17, 18, 18,
+ 19, 19, 20, 20, 20 };
+
+// cos bit
+static const int8_t fwd_cos_bit_col_dct_16[8] = {
+ 13, 13, 13, 13, 13, 13, 13, 13
+};
+static const int8_t fwd_cos_bit_row_dct_16[8] = {
+ 12, 12, 12, 12, 12, 12, 12, 12
+};
+static const int8_t fwd_cos_bit_col_adst_16[10] = { 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13 };
+static const int8_t fwd_cos_bit_row_adst_16[10] = { 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12 };
+
+// ---------------- 32x32 1D constants -----------------------
+// shift
+static const int8_t fwd_shift_32[3] = { 2, -4, 0 };
+
+// stage range
+static const int8_t fwd_stage_range_col_dct_32[10] = { 15, 16, 17, 18, 19,
+ 20, 20, 20, 20, 20 };
+static const int8_t fwd_stage_range_row_dct_32[10] = { 16, 17, 18, 19, 20,
+ 20, 20, 20, 20, 20 };
+static const int8_t fwd_stage_range_col_adst_32[12] = {
+ 15, 15, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20
+};
+static const int8_t fwd_stage_range_row_adst_32[12] = {
+ 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20
+};
+
+// cos bit
+static const int8_t fwd_cos_bit_col_dct_32[10] = { 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12 };
+static const int8_t fwd_cos_bit_row_dct_32[10] = { 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12 };
+static const int8_t fwd_cos_bit_col_adst_32[12] = { 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12 };
+static const int8_t fwd_cos_bit_row_adst_32[12] = { 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12 };
+
+// ---------------- 64x64 1D constants -----------------------
+// shift
+static const int8_t fwd_shift_64[3] = { 0, -2, -2 };
+
+// stage range
+static const int8_t fwd_stage_range_col_dct_64[12] = { 13, 14, 15, 16, 17, 18,
+ 19, 19, 19, 19, 19, 19 };
+static const int8_t fwd_stage_range_row_dct_64[12] = { 17, 18, 19, 20, 21, 22,
+ 22, 22, 22, 22, 22, 22 };
+
+// cos bit
+static const int8_t fwd_cos_bit_col_dct_64[12] = { 15, 15, 15, 15, 15, 14,
+ 13, 13, 13, 13, 13, 13 };
+static const int8_t fwd_cos_bit_row_dct_64[12] = { 15, 14, 13, 12, 11, 10,
+ 10, 10, 10, 10, 10, 10 };
+
+// ---------------- row config fwd_dct_4 ----------------
+static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_dct_4 = {
+ 4, // .txfm_size
+ 4, // .stage_num
+ // 0, // .log_scale
+ fwd_shift_4, // .shift
+ fwd_stage_range_row_dct_4, // .stage_range
+ fwd_cos_bit_row_dct_4, // .cos_bit
+ TXFM_TYPE_DCT4 // .txfm_type
+};
+
+// ---------------- row config fwd_dct_8 ----------------
+static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_dct_8 = {
+ 8, // .txfm_size
+ 6, // .stage_num
+ // 0, // .log_scale
+ fwd_shift_8, // .shift
+ fwd_stage_range_row_dct_8, // .stage_range
+ fwd_cos_bit_row_dct_8, // .cos_bit_
+ TXFM_TYPE_DCT8 // .txfm_type
+};
+// ---------------- row config fwd_dct_16 ----------------
+static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_dct_16 = {
+ 16, // .txfm_size
+ 8, // .stage_num
+ // 0, // .log_scale
+ fwd_shift_16, // .shift
+ fwd_stage_range_row_dct_16, // .stage_range
+ fwd_cos_bit_row_dct_16, // .cos_bit
+ TXFM_TYPE_DCT16 // .txfm_type
+};
+
+// ---------------- row config fwd_dct_32 ----------------
+static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_dct_32 = {
+ 32, // .txfm_size
+ 10, // .stage_num
+ // 1, // .log_scale
+ fwd_shift_32, // .shift
+ fwd_stage_range_row_dct_32, // .stage_range
+ fwd_cos_bit_row_dct_32, // .cos_bit_row
+ TXFM_TYPE_DCT32 // .txfm_type
+};
+
+// ---------------- row config fwd_dct_64 ----------------
+static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_dct_64 = {
+ 64, // .txfm_size
+ 12, // .stage_num
+ fwd_shift_64, // .shift
+ fwd_stage_range_row_dct_64, // .stage_range
+ fwd_cos_bit_row_dct_64, // .cos_bit
+ TXFM_TYPE_DCT64, // .txfm_type_col
+};
+
+// ---------------- row config fwd_adst_4 ----------------
+static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_adst_4 = {
+ 4, // .txfm_size
+ 6, // .stage_num
+ // 0, // .log_scale
+ fwd_shift_4, // .shift
+ fwd_stage_range_row_adst_4, // .stage_range
+ fwd_cos_bit_row_adst_4, // .cos_bit
+ TXFM_TYPE_ADST4, // .txfm_type
+};
+
+// ---------------- row config fwd_adst_8 ----------------
+static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_adst_8 = {
+ 8, // .txfm_size
+ 8, // .stage_num
+ // 0, // .log_scale
+ fwd_shift_8, // .shift
+ fwd_stage_range_row_adst_8, // .stage_range
+ fwd_cos_bit_row_adst_8, // .cos_bit
+ TXFM_TYPE_ADST8, // .txfm_type_col
+};
+
+// ---------------- row config fwd_adst_16 ----------------
+static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_adst_16 = {
+ 16, // .txfm_size
+ 10, // .stage_num
+ // 0, // .log_scale
+ fwd_shift_16, // .shift
+ fwd_stage_range_row_adst_16, // .stage_range
+ fwd_cos_bit_row_adst_16, // .cos_bit
+ TXFM_TYPE_ADST16, // .txfm_type
+};
+
+// ---------------- row config fwd_adst_32 ----------------
+static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_adst_32 = {
+ 32, // .txfm_size
+ 12, // .stage_num
+ // 1, // .log_scale
+ fwd_shift_32, // .shift
+ fwd_stage_range_row_adst_32, // .stage_range
+ fwd_cos_bit_row_adst_32, // .cos_bit
+ TXFM_TYPE_ADST32, // .txfm_type
+};
+
+// ---------------- col config fwd_dct_4 ----------------
+static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_dct_4 = {
+ 4, // .txfm_size
+ 4, // .stage_num
+ // 0, // .log_scale
+ fwd_shift_4, // .shift
+ fwd_stage_range_col_dct_4, // .stage_range
+ fwd_cos_bit_col_dct_4, // .cos_bit
+ TXFM_TYPE_DCT4 // .txfm_type
+};
+
+// ---------------- col config fwd_dct_8 ----------------
+static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_dct_8 = {
+ 8, // .txfm_size
+ 6, // .stage_num
+ // 0, // .log_scale
+ fwd_shift_8, // .shift
+ fwd_stage_range_col_dct_8, // .stage_range
+ fwd_cos_bit_col_dct_8, // .cos_bit_
+ TXFM_TYPE_DCT8 // .txfm_type
+};
+// ---------------- col config fwd_dct_16 ----------------
+static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_dct_16 = {
+ 16, // .txfm_size
+ 8, // .stage_num
+ // 0, // .log_scale
+ fwd_shift_16, // .shift
+ fwd_stage_range_col_dct_16, // .stage_range
+ fwd_cos_bit_col_dct_16, // .cos_bit
+ TXFM_TYPE_DCT16 // .txfm_type
+};
+
+// ---------------- col config fwd_dct_32 ----------------
+static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_dct_32 = {
+ 32, // .txfm_size
+ 10, // .stage_num
+ // 1, // .log_scale
+ fwd_shift_32, // .shift
+ fwd_stage_range_col_dct_32, // .stage_range
+ fwd_cos_bit_col_dct_32, // .cos_bit_col
+ TXFM_TYPE_DCT32 // .txfm_type
+};
+
+// ---------------- col config fwd_dct_64 ----------------
+static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_dct_64 = {
+ 64, // .txfm_size
+ 12, // .stage_num
+ fwd_shift_64, // .shift
+ fwd_stage_range_col_dct_64, // .stage_range
+ fwd_cos_bit_col_dct_64, // .cos_bit
+ TXFM_TYPE_DCT64, // .txfm_type_col
+};
+
+// ---------------- col config fwd_adst_4 ----------------
+static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_adst_4 = {
+ 4, // .txfm_size
+ 6, // .stage_num
+ // 0, // .log_scale
+ fwd_shift_4, // .shift
+ fwd_stage_range_col_adst_4, // .stage_range
+ fwd_cos_bit_col_adst_4, // .cos_bit
+ TXFM_TYPE_ADST4, // .txfm_type
+};
+
+// ---------------- col config fwd_adst_8 ----------------
+static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_adst_8 = {
+ 8, // .txfm_size
+ 8, // .stage_num
+ // 0, // .log_scale
+ fwd_shift_8, // .shift
+ fwd_stage_range_col_adst_8, // .stage_range
+ fwd_cos_bit_col_adst_8, // .cos_bit
+ TXFM_TYPE_ADST8, // .txfm_type_col
+};
+
+// ---------------- col config fwd_adst_16 ----------------
+static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_adst_16 = {
+ 16, // .txfm_size
+ 10, // .stage_num
+ // 0, // .log_scale
+ fwd_shift_16, // .shift
+ fwd_stage_range_col_adst_16, // .stage_range
+ fwd_cos_bit_col_adst_16, // .cos_bit
+ TXFM_TYPE_ADST16, // .txfm_type
+};
+
+// ---------------- col config fwd_adst_32 ----------------
+static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_adst_32 = {
+ 32, // .txfm_size
+ 12, // .stage_num
+ // 1, // .log_scale
+ fwd_shift_32, // .shift
+ fwd_stage_range_col_adst_32, // .stage_range
+ fwd_cos_bit_col_adst_32, // .cos_bit
+ TXFM_TYPE_ADST32, // .txfm_type
+};
+
+#if CONFIG_EXT_TX
+// identity does not need to differentiate between row and col
+// ---------------- row/col config fwd_identity_4 ----------
+static const TXFM_1D_CFG fwd_txfm_1d_cfg_identity_4 = {
+ 4, // .txfm_size
+ 1, // .stage_num
+ // 0, // .log_scale
+ fwd_shift_4, // .shift
+ fwd_stage_range_identity, // .stage_range
+ NULL, // .cos_bit
+ TXFM_TYPE_IDENTITY4, // .txfm_type
+};
+
+// ---------------- row/col config fwd_identity_8 ----------------
+static const TXFM_1D_CFG fwd_txfm_1d_cfg_identity_8 = {
+ 8, // .txfm_size
+ 1, // .stage_num
+ // 0, // .log_scale
+ fwd_shift_8, // .shift
+ fwd_stage_range_identity, // .stage_range
+ NULL, // .cos_bit
+ TXFM_TYPE_IDENTITY8, // .txfm_type
+};
+
+// ---------------- row/col config fwd_identity_16 ----------------
+static const TXFM_1D_CFG fwd_txfm_1d_cfg_identity_16 = {
+ 16, // .txfm_size
+ 1, // .stage_num
+ // 0, // .log_scale
+ fwd_shift_16, // .shift
+ fwd_stage_range_identity, // .stage_range
+ NULL, // .cos_bit
+ TXFM_TYPE_IDENTITY16, // .txfm_type
+};
+
+// ---------------- row/col config fwd_identity_32 ----------------
+static const TXFM_1D_CFG fwd_txfm_1d_cfg_identity_32 = {
+ 32, // .txfm_size
+ 1, // .stage_num
+ // 1, // .log_scale
+ fwd_shift_32, // .shift
+ fwd_stage_range_identity, // .stage_range
+ NULL, // .cos_bit
+ TXFM_TYPE_IDENTITY32, // .txfm_type
+};
+#endif // CONFIG_EXT_TX
+#endif // AV1_FWD_TXFM2D_CFG_H_
diff --git a/third_party/aom/av1/common/av1_fwd_txfm2d.c b/third_party/aom/av1/common/av1_fwd_txfm2d.c
index d1dba82ca..f8d7b2333 100644
--- a/third_party/aom/av1/common/av1_fwd_txfm2d.c
+++ b/third_party/aom/av1/common/av1_fwd_txfm2d.c
@@ -14,7 +14,7 @@
#include "./av1_rtcd.h"
#include "av1/common/enums.h"
#include "av1/common/av1_fwd_txfm1d.h"
-#include "av1/common/av1_fwd_txfm2d_cfg.h"
+#include "av1/common/av1_fwd_txfm1d_cfg.h"
#include "av1/common/av1_txfm.h"
static INLINE TxfmFunc fwd_txfm_type_to_func(TXFM_TYPE txfm_type) {
@@ -27,6 +27,12 @@ static INLINE TxfmFunc fwd_txfm_type_to_func(TXFM_TYPE txfm_type) {
case TXFM_TYPE_ADST8: return av1_fadst8_new;
case TXFM_TYPE_ADST16: return av1_fadst16_new;
case TXFM_TYPE_ADST32: return av1_fadst32_new;
+#if CONFIG_EXT_TX
+ case TXFM_TYPE_IDENTITY4: return av1_fidentity4_c;
+ case TXFM_TYPE_IDENTITY8: return av1_fidentity8_c;
+ case TXFM_TYPE_IDENTITY16: return av1_fidentity16_c;
+ case TXFM_TYPE_IDENTITY32: return av1_fidentity32_c;
+#endif // CONFIG_EXT_TX
default: assert(0); return NULL;
}
}
@@ -35,14 +41,15 @@ static INLINE void fwd_txfm2d_c(const int16_t *input, int32_t *output,
const int stride, const TXFM_2D_FLIP_CFG *cfg,
int32_t *buf) {
int c, r;
- const int txfm_size = cfg->cfg->txfm_size;
- const int8_t *shift = cfg->cfg->shift;
- const int8_t *stage_range_col = cfg->cfg->stage_range_col;
- const int8_t *stage_range_row = cfg->cfg->stage_range_row;
- const int8_t *cos_bit_col = cfg->cfg->cos_bit_col;
- const int8_t *cos_bit_row = cfg->cfg->cos_bit_row;
- const TxfmFunc txfm_func_col = fwd_txfm_type_to_func(cfg->cfg->txfm_type_col);
- const TxfmFunc txfm_func_row = fwd_txfm_type_to_func(cfg->cfg->txfm_type_row);
+ // TODO(sarahparker) must correct for rectangular transforms in follow up
+ const int txfm_size = cfg->row_cfg->txfm_size;
+ const int8_t *shift = cfg->row_cfg->shift;
+ const int8_t *stage_range_col = cfg->col_cfg->stage_range;
+ const int8_t *stage_range_row = cfg->row_cfg->stage_range;
+ const int8_t *cos_bit_col = cfg->col_cfg->cos_bit;
+ const int8_t *cos_bit_row = cfg->row_cfg->cos_bit;
+ const TxfmFunc txfm_func_col = fwd_txfm_type_to_func(cfg->col_cfg->txfm_type);
+ const TxfmFunc txfm_func_row = fwd_txfm_type_to_func(cfg->row_cfg->txfm_type);
// use output buffer as temp buffer
int32_t *temp_in = output;
@@ -117,96 +124,79 @@ void av1_fwd_txfm2d_64x64_c(const int16_t *input, int32_t *output, int stride,
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf);
}
-#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 },
+static const TXFM_1D_CFG *fwd_txfm_col_cfg_ls[TX_TYPES_1D][TX_SIZES] = {
+ // DCT
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
NULL,
#endif
- &fwd_txfm_2d_cfg_adst_adst_4, &fwd_txfm_2d_cfg_adst_adst_8,
- &fwd_txfm_2d_cfg_adst_adst_16, &fwd_txfm_2d_cfg_adst_adst_32 },
+ &fwd_txfm_1d_col_cfg_dct_4, &fwd_txfm_1d_col_cfg_dct_8,
+ &fwd_txfm_1d_col_cfg_dct_16, &fwd_txfm_1d_col_cfg_dct_32 },
+ // ADST
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
NULL,
#endif
- &fwd_txfm_2d_cfg_adst_dct_4, &fwd_txfm_2d_cfg_adst_dct_8,
- &fwd_txfm_2d_cfg_adst_dct_16, &fwd_txfm_2d_cfg_adst_dct_32 },
- {
-#if CONFIG_CB4X4
- NULL,
-#endif
- &fwd_txfm_2d_cfg_dct_adst_4, &fwd_txfm_2d_cfg_dct_adst_8,
- &fwd_txfm_2d_cfg_dct_adst_16, &fwd_txfm_2d_cfg_dct_adst_32 },
- {
-#if CONFIG_CB4X4
- NULL,
-#endif
- &fwd_txfm_2d_cfg_adst_adst_4, &fwd_txfm_2d_cfg_adst_adst_8,
- &fwd_txfm_2d_cfg_adst_adst_16, &fwd_txfm_2d_cfg_adst_adst_32 },
+ &fwd_txfm_1d_col_cfg_adst_4, &fwd_txfm_1d_col_cfg_adst_8,
+ &fwd_txfm_1d_col_cfg_adst_16, &fwd_txfm_1d_col_cfg_adst_32 },
+#if CONFIG_EXT_TX
+ // FLIPADST
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
NULL,
#endif
- &fwd_txfm_2d_cfg_adst_adst_4, &fwd_txfm_2d_cfg_adst_adst_8,
- &fwd_txfm_2d_cfg_adst_adst_16, &fwd_txfm_2d_cfg_adst_adst_32 },
+ &fwd_txfm_1d_col_cfg_adst_4, &fwd_txfm_1d_col_cfg_adst_8,
+ &fwd_txfm_1d_col_cfg_adst_16, &fwd_txfm_1d_col_cfg_adst_32 },
+ // IDENTITY
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
NULL,
#endif
- &fwd_txfm_2d_cfg_adst_adst_4, &fwd_txfm_2d_cfg_adst_adst_8,
- &fwd_txfm_2d_cfg_adst_adst_16, &fwd_txfm_2d_cfg_adst_adst_32 },
+ &fwd_txfm_1d_cfg_identity_4, &fwd_txfm_1d_cfg_identity_8,
+ &fwd_txfm_1d_cfg_identity_16, &fwd_txfm_1d_cfg_identity_32 },
+#endif // CONFIG_EXT_TX
};
-#else // CONFIG_EXT_TX
-static const TXFM_2D_CFG *fwd_txfm_cfg_ls[TX_TYPES][TX_SIZES] = {
+
+static const TXFM_1D_CFG *fwd_txfm_row_cfg_ls[TX_TYPES_1D][TX_SIZES] = {
+ // DCT
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
NULL,
#endif
- &fwd_txfm_2d_cfg_dct_dct_4, &fwd_txfm_2d_cfg_dct_dct_8,
- &fwd_txfm_2d_cfg_dct_dct_16, &fwd_txfm_2d_cfg_dct_dct_32 },
+ &fwd_txfm_1d_row_cfg_dct_4, &fwd_txfm_1d_row_cfg_dct_8,
+ &fwd_txfm_1d_row_cfg_dct_16, &fwd_txfm_1d_row_cfg_dct_32 },
+ // ADST
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
NULL,
#endif
- &fwd_txfm_2d_cfg_adst_dct_4, &fwd_txfm_2d_cfg_adst_dct_8,
- &fwd_txfm_2d_cfg_adst_dct_16, &fwd_txfm_2d_cfg_adst_dct_32 },
+ &fwd_txfm_1d_row_cfg_adst_4, &fwd_txfm_1d_row_cfg_adst_8,
+ &fwd_txfm_1d_row_cfg_adst_16, &fwd_txfm_1d_row_cfg_adst_32 },
+#if CONFIG_EXT_TX
+ // FLIPADST
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
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 },
+ &fwd_txfm_1d_row_cfg_adst_4, &fwd_txfm_1d_row_cfg_adst_8,
+ &fwd_txfm_1d_row_cfg_adst_16, &fwd_txfm_1d_row_cfg_adst_32 },
+ // IDENTITY
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
NULL,
#endif
- &fwd_txfm_2d_cfg_adst_adst_4, &fwd_txfm_2d_cfg_adst_adst_8,
- &fwd_txfm_2d_cfg_adst_adst_16, &fwd_txfm_2d_cfg_adst_adst_32 },
-};
+ &fwd_txfm_1d_cfg_identity_4, &fwd_txfm_1d_cfg_identity_8,
+ &fwd_txfm_1d_cfg_identity_16, &fwd_txfm_1d_cfg_identity_32 },
#endif // CONFIG_EXT_TX
+};
TXFM_2D_FLIP_CFG av1_get_fwd_txfm_cfg(int tx_type, int tx_size) {
TXFM_2D_FLIP_CFG cfg;
set_flip_cfg(tx_type, &cfg);
- cfg.cfg = fwd_txfm_cfg_ls[tx_type][tx_size];
+ int tx_type_col = vtx_tab[tx_type];
+ int tx_type_row = htx_tab[tx_type];
+ cfg.col_cfg = fwd_txfm_col_cfg_ls[tx_type_col][tx_size];
+ cfg.row_cfg = fwd_txfm_row_cfg_ls[tx_type_row][tx_size];
return cfg;
}
@@ -214,13 +204,11 @@ TXFM_2D_FLIP_CFG av1_get_fwd_txfm_64x64_cfg(int tx_type) {
TXFM_2D_FLIP_CFG cfg;
switch (tx_type) {
case DCT_DCT:
- cfg.cfg = &fwd_txfm_2d_cfg_dct_dct_64;
+ cfg.col_cfg = &fwd_txfm_1d_col_cfg_dct_64;
+ cfg.row_cfg = &fwd_txfm_1d_row_cfg_dct_64;
cfg.ud_flip = 0;
cfg.lr_flip = 0;
break;
- case ADST_DCT:
- case DCT_ADST:
- case ADST_ADST:
default:
cfg.ud_flip = 0;
cfg.lr_flip = 0;
diff --git a/third_party/aom/av1/common/av1_fwd_txfm2d_cfg.h b/third_party/aom/av1/common/av1_fwd_txfm2d_cfg.h
deleted file mode 100644
index b5c828286..000000000
--- a/third_party/aom/av1/common/av1_fwd_txfm2d_cfg.h
+++ /dev/null
@@ -1,444 +0,0 @@
-/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved
- *
- * This source code is subject to the terms of the BSD 2 Clause License and
- * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
- * was not distributed with this source code in the LICENSE file, you can
- * obtain it at www.aomedia.org/license/software. If the Alliance for Open
- * Media Patent License 1.0 was not distributed with this source code in the
- * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
- */
-
-#ifndef AV1_FWD_TXFM2D_CFG_H_
-#define AV1_FWD_TXFM2D_CFG_H_
-#include "av1/common/enums.h"
-#include "av1/common/av1_fwd_txfm1d.h"
-// ---------------- config fwd_dct_dct_4 ----------------
-static const int8_t fwd_shift_dct_dct_4[3] = { 2, 0, 0 };
-static const int8_t fwd_stage_range_col_dct_dct_4[4] = { 15, 16, 17, 17 };
-static const int8_t fwd_stage_range_row_dct_dct_4[4] = { 17, 18, 18, 18 };
-static const int8_t fwd_cos_bit_col_dct_dct_4[4] = { 13, 13, 13, 13 };
-static const int8_t fwd_cos_bit_row_dct_dct_4[4] = { 13, 13, 13, 13 };
-
-static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_dct_4 = {
- 4, // .txfm_size
- 4, // .stage_num_col
- 4, // .stage_num_row
- // 0, // .log_scale
- fwd_shift_dct_dct_4, // .shift
- fwd_stage_range_col_dct_dct_4, // .stage_range_col
- fwd_stage_range_row_dct_dct_4, // .stage_range_row
- fwd_cos_bit_col_dct_dct_4, // .cos_bit_col
- fwd_cos_bit_row_dct_dct_4, // .cos_bit_row
- TXFM_TYPE_DCT4, // .txfm_type_col
- TXFM_TYPE_DCT4
-}; // .txfm_type_row
-
-// ---------------- config fwd_dct_dct_8 ----------------
-static const int8_t fwd_shift_dct_dct_8[3] = { 2, -1, 0 };
-static const int8_t fwd_stage_range_col_dct_dct_8[6] = {
- 15, 16, 17, 18, 18, 18
-};
-static const int8_t fwd_stage_range_row_dct_dct_8[6] = {
- 17, 18, 19, 19, 19, 19
-};
-static const int8_t fwd_cos_bit_col_dct_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
-static const int8_t fwd_cos_bit_row_dct_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
-
-static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_dct_8 = {
- 8, // .txfm_size
- 6, // .stage_num_col
- 6, // .stage_num_row
- // 0, // .log_scale
- fwd_shift_dct_dct_8, // .shift
- fwd_stage_range_col_dct_dct_8, // .stage_range_col
- fwd_stage_range_row_dct_dct_8, // .stage_range_row
- fwd_cos_bit_col_dct_dct_8, // .cos_bit_col
- fwd_cos_bit_row_dct_dct_8, // .cos_bit_row
- TXFM_TYPE_DCT8, // .txfm_type_col
- TXFM_TYPE_DCT8
-}; // .txfm_type_row
-
-// ---------------- config fwd_dct_dct_16 ----------------
-static const int8_t fwd_shift_dct_dct_16[3] = { 2, -2, 0 };
-static const int8_t fwd_stage_range_col_dct_dct_16[8] = { 15, 16, 17, 18,
- 19, 19, 19, 19 };
-static const int8_t fwd_stage_range_row_dct_dct_16[8] = { 17, 18, 19, 20,
- 20, 20, 20, 20 };
-static const int8_t fwd_cos_bit_col_dct_dct_16[8] = { 13, 13, 13, 13,
- 13, 13, 13, 13 };
-static const int8_t fwd_cos_bit_row_dct_dct_16[8] = { 12, 12, 12, 12,
- 12, 12, 12, 12 };
-
-static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_dct_16 = {
- 16, // .txfm_size
- 8, // .stage_num_col
- 8, // .stage_num_row
- // 0, // .log_scale
- fwd_shift_dct_dct_16, // .shift
- fwd_stage_range_col_dct_dct_16, // .stage_range_col
- fwd_stage_range_row_dct_dct_16, // .stage_range_row
- fwd_cos_bit_col_dct_dct_16, // .cos_bit_col
- fwd_cos_bit_row_dct_dct_16, // .cos_bit_row
- TXFM_TYPE_DCT16, // .txfm_type_col
- TXFM_TYPE_DCT16
-}; // .txfm_type_row
-
-// ---------------- config fwd_dct_dct_32 ----------------
-static const int8_t fwd_shift_dct_dct_32[3] = { 2, -4, 0 };
-static const int8_t fwd_stage_range_col_dct_dct_32[10] = { 15, 16, 17, 18, 19,
- 20, 20, 20, 20, 20 };
-static const int8_t fwd_stage_range_row_dct_dct_32[10] = { 16, 17, 18, 19, 20,
- 20, 20, 20, 20, 20 };
-static const int8_t fwd_cos_bit_col_dct_dct_32[10] = { 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12 };
-static const int8_t fwd_cos_bit_row_dct_dct_32[10] = { 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12 };
-
-static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_dct_32 = {
- 32, // .txfm_size
- 10, // .stage_num_col
- 10, // .stage_num_row
- // 1, // .log_scale
- fwd_shift_dct_dct_32, // .shift
- fwd_stage_range_col_dct_dct_32, // .stage_range_col
- fwd_stage_range_row_dct_dct_32, // .stage_range_row
- fwd_cos_bit_col_dct_dct_32, // .cos_bit_col
- fwd_cos_bit_row_dct_dct_32, // .cos_bit_row
- TXFM_TYPE_DCT32, // .txfm_type_col
- TXFM_TYPE_DCT32
-}; // .txfm_type_row
-
-// ---------------- config fwd_dct_dct_64 ----------------
-static const int8_t fwd_shift_dct_dct_64[3] = { 0, -2, -2 };
-static const int8_t fwd_stage_range_col_dct_dct_64[12] = {
- 13, 14, 15, 16, 17, 18, 19, 19, 19, 19, 19, 19
-};
-static const int8_t fwd_stage_range_row_dct_dct_64[12] = {
- 17, 18, 19, 20, 21, 22, 22, 22, 22, 22, 22, 22
-};
-static const int8_t fwd_cos_bit_col_dct_dct_64[12] = { 15, 15, 15, 15, 15, 14,
- 13, 13, 13, 13, 13, 13 };
-static const int8_t fwd_cos_bit_row_dct_dct_64[12] = { 15, 14, 13, 12, 11, 10,
- 10, 10, 10, 10, 10, 10 };
-
-static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_dct_64 = {
- 64, // .txfm_size
- 12, // .stage_num_col
- 12, // .stage_num_row
- fwd_shift_dct_dct_64, // .shift
- fwd_stage_range_col_dct_dct_64, // .stage_range_col
- fwd_stage_range_row_dct_dct_64, // .stage_range_row
- fwd_cos_bit_col_dct_dct_64, // .cos_bit_col
- fwd_cos_bit_row_dct_dct_64, // .cos_bit_row
- TXFM_TYPE_DCT64, // .txfm_type_col
- TXFM_TYPE_DCT64
-}; // .txfm_type_row
-
-// ---------------- config fwd_dct_adst_4 ----------------
-static const int8_t fwd_shift_dct_adst_4[3] = { 2, 0, 0 };
-static const int8_t fwd_stage_range_col_dct_adst_4[4] = { 15, 16, 17, 17 };
-static const int8_t fwd_stage_range_row_dct_adst_4[6] = {
- 17, 17, 17, 18, 18, 18
-};
-static const int8_t fwd_cos_bit_col_dct_adst_4[4] = { 13, 13, 13, 13 };
-static const int8_t fwd_cos_bit_row_dct_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
-
-static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_adst_4 = {
- 4, // .txfm_size
- 4, // .stage_num_col
- 6, // .stage_num_row
- // 0, // .log_scale
- fwd_shift_dct_adst_4, // .shift
- fwd_stage_range_col_dct_adst_4, // .stage_range_col
- fwd_stage_range_row_dct_adst_4, // .stage_range_row
- fwd_cos_bit_col_dct_adst_4, // .cos_bit_col
- fwd_cos_bit_row_dct_adst_4, // .cos_bit_row
- TXFM_TYPE_DCT4, // .txfm_type_col
- TXFM_TYPE_ADST4
-}; // .txfm_type_row
-
-// ---------------- config fwd_dct_adst_8 ----------------
-static const int8_t fwd_shift_dct_adst_8[3] = { 2, -1, 0 };
-static const int8_t fwd_stage_range_col_dct_adst_8[6] = {
- 15, 16, 17, 18, 18, 18
-};
-static const int8_t fwd_stage_range_row_dct_adst_8[8] = { 17, 17, 17, 18,
- 18, 19, 19, 19 };
-static const int8_t fwd_cos_bit_col_dct_adst_8[6] = { 13, 13, 13, 13, 13, 13 };
-static const int8_t fwd_cos_bit_row_dct_adst_8[8] = { 13, 13, 13, 13,
- 13, 13, 13, 13 };
-
-static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_adst_8 = {
- 8, // .txfm_size
- 6, // .stage_num_col
- 8, // .stage_num_row
- // 0, // .log_scale
- fwd_shift_dct_adst_8, // .shift
- fwd_stage_range_col_dct_adst_8, // .stage_range_col
- fwd_stage_range_row_dct_adst_8, // .stage_range_row
- fwd_cos_bit_col_dct_adst_8, // .cos_bit_col
- fwd_cos_bit_row_dct_adst_8, // .cos_bit_row
- TXFM_TYPE_DCT8, // .txfm_type_col
- TXFM_TYPE_ADST8
-}; // .txfm_type_row
-
-// ---------------- config fwd_dct_adst_16 ----------------
-static const int8_t fwd_shift_dct_adst_16[3] = { 2, -2, 0 };
-static const int8_t fwd_stage_range_col_dct_adst_16[8] = { 15, 16, 17, 18,
- 19, 19, 19, 19 };
-static const int8_t fwd_stage_range_row_dct_adst_16[10] = {
- 17, 17, 17, 18, 18, 19, 19, 20, 20, 20
-};
-static const int8_t fwd_cos_bit_col_dct_adst_16[8] = { 13, 13, 13, 13,
- 13, 13, 13, 13 };
-static const int8_t fwd_cos_bit_row_dct_adst_16[10] = { 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12 };
-
-static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_adst_16 = {
- 16, // .txfm_size
- 8, // .stage_num_col
- 10, // .stage_num_row
- // 0, // .log_scale
- fwd_shift_dct_adst_16, // .shift
- fwd_stage_range_col_dct_adst_16, // .stage_range_col
- fwd_stage_range_row_dct_adst_16, // .stage_range_row
- fwd_cos_bit_col_dct_adst_16, // .cos_bit_col
- fwd_cos_bit_row_dct_adst_16, // .cos_bit_row
- TXFM_TYPE_DCT16, // .txfm_type_col
- TXFM_TYPE_ADST16
-}; // .txfm_type_row
-
-// ---------------- config fwd_dct_adst_32 ----------------
-static const int8_t fwd_shift_dct_adst_32[3] = { 2, -4, 0 };
-static const int8_t fwd_stage_range_col_dct_adst_32[10] = {
- 15, 16, 17, 18, 19, 20, 20, 20, 20, 20
-};
-static const int8_t fwd_stage_range_row_dct_adst_32[12] = {
- 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20
-};
-static const int8_t fwd_cos_bit_col_dct_adst_32[10] = { 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12 };
-static const int8_t fwd_cos_bit_row_dct_adst_32[12] = {
- 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
-};
-
-static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_adst_32 = {
- 32, // .txfm_size
- 10, // .stage_num_col
- 12, // .stage_num_row
- // 1, // .log_scale
- fwd_shift_dct_adst_32, // .shift
- fwd_stage_range_col_dct_adst_32, // .stage_range_col
- fwd_stage_range_row_dct_adst_32, // .stage_range_row
- fwd_cos_bit_col_dct_adst_32, // .cos_bit_col
- fwd_cos_bit_row_dct_adst_32, // .cos_bit_row
- TXFM_TYPE_DCT32, // .txfm_type_col
- TXFM_TYPE_ADST32
-}; // .txfm_type_row
-// ---------------- config fwd_adst_adst_4 ----------------
-static const int8_t fwd_shift_adst_adst_4[3] = { 2, 0, 0 };
-static const int8_t fwd_stage_range_col_adst_adst_4[6] = { 15, 15, 16,
- 17, 17, 17 };
-static const int8_t fwd_stage_range_row_adst_adst_4[6] = { 17, 17, 17,
- 18, 18, 18 };
-static const int8_t fwd_cos_bit_col_adst_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
-static const int8_t fwd_cos_bit_row_adst_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
-
-static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_adst_4 = {
- 4, // .txfm_size
- 6, // .stage_num_col
- 6, // .stage_num_row
- // 0, // .log_scale
- fwd_shift_adst_adst_4, // .shift
- fwd_stage_range_col_adst_adst_4, // .stage_range_col
- fwd_stage_range_row_adst_adst_4, // .stage_range_row
- fwd_cos_bit_col_adst_adst_4, // .cos_bit_col
- fwd_cos_bit_row_adst_adst_4, // .cos_bit_row
- TXFM_TYPE_ADST4, // .txfm_type_col
- TXFM_TYPE_ADST4
-}; // .txfm_type_row
-
-// ---------------- config fwd_adst_adst_8 ----------------
-static const int8_t fwd_shift_adst_adst_8[3] = { 2, -1, 0 };
-static const int8_t fwd_stage_range_col_adst_adst_8[8] = { 15, 15, 16, 17,
- 17, 18, 18, 18 };
-static const int8_t fwd_stage_range_row_adst_adst_8[8] = { 17, 17, 17, 18,
- 18, 19, 19, 19 };
-static const int8_t fwd_cos_bit_col_adst_adst_8[8] = { 13, 13, 13, 13,
- 13, 13, 13, 13 };
-static const int8_t fwd_cos_bit_row_adst_adst_8[8] = { 13, 13, 13, 13,
- 13, 13, 13, 13 };
-
-static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_adst_8 = {
- 8, // .txfm_size
- 8, // .stage_num_col
- 8, // .stage_num_row
- // 0, // .log_scale
- fwd_shift_adst_adst_8, // .shift
- fwd_stage_range_col_adst_adst_8, // .stage_range_col
- fwd_stage_range_row_adst_adst_8, // .stage_range_row
- fwd_cos_bit_col_adst_adst_8, // .cos_bit_col
- fwd_cos_bit_row_adst_adst_8, // .cos_bit_row
- TXFM_TYPE_ADST8, // .txfm_type_col
- TXFM_TYPE_ADST8
-}; // .txfm_type_row
-
-// ---------------- config fwd_adst_adst_16 ----------------
-static const int8_t fwd_shift_adst_adst_16[3] = { 2, -2, 0 };
-static const int8_t fwd_stage_range_col_adst_adst_16[10] = {
- 15, 15, 16, 17, 17, 18, 18, 19, 19, 19
-};
-static const int8_t fwd_stage_range_row_adst_adst_16[10] = {
- 17, 17, 17, 18, 18, 19, 19, 20, 20, 20
-};
-static const int8_t fwd_cos_bit_col_adst_adst_16[10] = { 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13 };
-static const int8_t fwd_cos_bit_row_adst_adst_16[10] = { 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12 };
-
-static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_adst_16 = {
- 16, // .txfm_size
- 10, // .stage_num_col
- 10, // .stage_num_row
- // 0, // .log_scale
- fwd_shift_adst_adst_16, // .shift
- fwd_stage_range_col_adst_adst_16, // .stage_range_col
- fwd_stage_range_row_adst_adst_16, // .stage_range_row
- fwd_cos_bit_col_adst_adst_16, // .cos_bit_col
- fwd_cos_bit_row_adst_adst_16, // .cos_bit_row
- TXFM_TYPE_ADST16, // .txfm_type_col
- TXFM_TYPE_ADST16
-}; // .txfm_type_row
-
-// ---------------- config fwd_adst_adst_32 ----------------
-static const int8_t fwd_shift_adst_adst_32[3] = { 2, -4, 0 };
-static const int8_t fwd_stage_range_col_adst_adst_32[12] = {
- 15, 15, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20
-};
-static const int8_t fwd_stage_range_row_adst_adst_32[12] = {
- 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20
-};
-static const int8_t fwd_cos_bit_col_adst_adst_32[12] = {
- 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
-};
-static const int8_t fwd_cos_bit_row_adst_adst_32[12] = {
- 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
-};
-
-static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_adst_32 = {
- 32, // .txfm_size
- 12, // .stage_num_col
- 12, // .stage_num_row
- // 1, // .log_scale
- fwd_shift_adst_adst_32, // .shift
- fwd_stage_range_col_adst_adst_32, // .stage_range_col
- fwd_stage_range_row_adst_adst_32, // .stage_range_row
- fwd_cos_bit_col_adst_adst_32, // .cos_bit_col
- fwd_cos_bit_row_adst_adst_32, // .cos_bit_row
- TXFM_TYPE_ADST32, // .txfm_type_col
- TXFM_TYPE_ADST32
-}; // .txfm_type_row
-
-// ---------------- config fwd_adst_dct_4 ----------------
-static const int8_t fwd_shift_adst_dct_4[3] = { 2, 0, 0 };
-static const int8_t fwd_stage_range_col_adst_dct_4[6] = {
- 15, 15, 16, 17, 17, 17
-};
-static const int8_t fwd_stage_range_row_adst_dct_4[4] = { 17, 18, 18, 18 };
-static const int8_t fwd_cos_bit_col_adst_dct_4[6] = { 13, 13, 13, 13, 13, 13 };
-static const int8_t fwd_cos_bit_row_adst_dct_4[4] = { 13, 13, 13, 13 };
-
-static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_dct_4 = {
- 4, // .txfm_size
- 6, // .stage_num_col
- 4, // .stage_num_row
- // 0, // .log_scale
- fwd_shift_adst_dct_4, // .shift
- fwd_stage_range_col_adst_dct_4, // .stage_range_col
- fwd_stage_range_row_adst_dct_4, // .stage_range_row
- fwd_cos_bit_col_adst_dct_4, // .cos_bit_col
- fwd_cos_bit_row_adst_dct_4, // .cos_bit_row
- TXFM_TYPE_ADST4, // .txfm_type_col
- TXFM_TYPE_DCT4
-}; // .txfm_type_row
-
-// ---------------- config fwd_adst_dct_8 ----------------
-static const int8_t fwd_shift_adst_dct_8[3] = { 2, -1, 0 };
-static const int8_t fwd_stage_range_col_adst_dct_8[8] = { 15, 15, 16, 17,
- 17, 18, 18, 18 };
-static const int8_t fwd_stage_range_row_adst_dct_8[6] = {
- 17, 18, 19, 19, 19, 19
-};
-static const int8_t fwd_cos_bit_col_adst_dct_8[8] = { 13, 13, 13, 13,
- 13, 13, 13, 13 };
-static const int8_t fwd_cos_bit_row_adst_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
-
-static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_dct_8 = {
- 8, // .txfm_size
- 8, // .stage_num_col
- 6, // .stage_num_row
- // 0, // .log_scale
- fwd_shift_adst_dct_8, // .shift
- fwd_stage_range_col_adst_dct_8, // .stage_range_col
- fwd_stage_range_row_adst_dct_8, // .stage_range_row
- fwd_cos_bit_col_adst_dct_8, // .cos_bit_col
- fwd_cos_bit_row_adst_dct_8, // .cos_bit_row
- TXFM_TYPE_ADST8, // .txfm_type_col
- TXFM_TYPE_DCT8
-}; // .txfm_type_row
-
-// ---------------- config fwd_adst_dct_16 ----------------
-static const int8_t fwd_shift_adst_dct_16[3] = { 2, -2, 0 };
-static const int8_t fwd_stage_range_col_adst_dct_16[10] = {
- 15, 15, 16, 17, 17, 18, 18, 19, 19, 19
-};
-static const int8_t fwd_stage_range_row_adst_dct_16[8] = { 17, 18, 19, 20,
- 20, 20, 20, 20 };
-static const int8_t fwd_cos_bit_col_adst_dct_16[10] = { 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13 };
-static const int8_t fwd_cos_bit_row_adst_dct_16[8] = { 12, 12, 12, 12,
- 12, 12, 12, 12 };
-
-static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_dct_16 = {
- 16, // .txfm_size
- 10, // .stage_num_col
- 8, // .stage_num_row
- // 0, // .log_scale
- fwd_shift_adst_dct_16, // .shift
- fwd_stage_range_col_adst_dct_16, // .stage_range_col
- fwd_stage_range_row_adst_dct_16, // .stage_range_row
- fwd_cos_bit_col_adst_dct_16, // .cos_bit_col
- fwd_cos_bit_row_adst_dct_16, // .cos_bit_row
- TXFM_TYPE_ADST16, // .txfm_type_col
- TXFM_TYPE_DCT16
-}; // .txfm_type_row
-
-// ---------------- config fwd_adst_dct_32 ----------------
-static const int8_t fwd_shift_adst_dct_32[3] = { 2, -4, 0 };
-static const int8_t fwd_stage_range_col_adst_dct_32[12] = {
- 15, 15, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20
-};
-static const int8_t fwd_stage_range_row_adst_dct_32[10] = {
- 16, 17, 18, 19, 20, 20, 20, 20, 20, 20
-};
-static const int8_t fwd_cos_bit_col_adst_dct_32[12] = {
- 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
-};
-static const int8_t fwd_cos_bit_row_adst_dct_32[10] = { 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12 };
-
-static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_dct_32 = {
- 32, // .txfm_size
- 12, // .stage_num_col
- 10, // .stage_num_row
- // 1, // .log_scale
- fwd_shift_adst_dct_32, // .shift
- fwd_stage_range_col_adst_dct_32, // .stage_range_col
- fwd_stage_range_row_adst_dct_32, // .stage_range_row
- fwd_cos_bit_col_adst_dct_32, // .cos_bit_col
- fwd_cos_bit_row_adst_dct_32, // .cos_bit_row
- TXFM_TYPE_ADST32, // .txfm_type_col
- TXFM_TYPE_DCT32
-}; // .txfm_type_row
-#endif // AV1_FWD_TXFM2D_CFG_H_
diff --git a/third_party/aom/av1/common/av1_inv_txfm1d.c b/third_party/aom/av1/common/av1_inv_txfm1d.c
index 54bbe9adf..3399b7cb9 100644
--- a/third_party/aom/av1/common/av1_inv_txfm1d.c
+++ b/third_party/aom/av1/common/av1_inv_txfm1d.c
@@ -10,6 +10,7 @@
*/
#include <stdlib.h>
+#include "aom_dsp/inv_txfm.h"
#include "av1/common/av1_inv_txfm1d.h"
#if CONFIG_COEFFICIENT_RANGE_CHECKING
@@ -66,6 +67,7 @@ void av1_idct4_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
// stage 1;
stage++;
+ assert(output != input);
bf1 = output;
bf1[0] = input[0];
bf1[1] = input[2];
@@ -75,7 +77,7 @@ void av1_idct4_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
// stage 2
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
@@ -109,6 +111,7 @@ void av1_idct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
// stage 1;
stage++;
+ assert(output != input);
bf1 = output;
bf1[0] = input[0];
bf1[1] = input[4];
@@ -122,7 +125,7 @@ void av1_idct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
// stage 2
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -137,7 +140,7 @@ void av1_idct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
// stage 3
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
@@ -152,7 +155,7 @@ void av1_idct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
// stage 4
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[3];
@@ -194,6 +197,7 @@ void av1_idct16_new(const int32_t *input, int32_t *output,
// stage 1;
stage++;
+ assert(output != input);
bf1 = output;
bf1[0] = input[0];
bf1[1] = input[8];
@@ -215,7 +219,7 @@ void av1_idct16_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -238,7 +242,7 @@ void av1_idct16_new(const int32_t *input, int32_t *output,
// stage 3
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0];
@@ -261,7 +265,7 @@ void av1_idct16_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
@@ -284,7 +288,7 @@ void av1_idct16_new(const int32_t *input, int32_t *output,
// stage 5
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0] + bf0[3];
@@ -307,7 +311,7 @@ void av1_idct16_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[7];
@@ -365,6 +369,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
// stage 1;
stage++;
+ assert(output != input);
bf1 = output;
bf1[0] = input[0];
bf1[1] = input[16];
@@ -402,7 +407,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -441,7 +446,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
// stage 3
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0];
@@ -480,7 +485,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -519,7 +524,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
// stage 5
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
@@ -558,7 +563,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[3];
@@ -597,7 +602,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
// stage 7
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0] + bf0[7];
@@ -636,7 +641,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
// stage 8
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[15];
@@ -726,6 +731,7 @@ void av1_iadst4_new(const int32_t *input, int32_t *output,
// stage 1;
stage++;
+ assert(output != input);
bf1 = output;
bf1[0] = input[0];
bf1[1] = -input[3];
@@ -735,7 +741,7 @@ void av1_iadst4_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -756,7 +762,7 @@ void av1_iadst4_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[8], bf0[0], cospi[56], bf0[1], cos_bit[stage]);
@@ -790,6 +796,7 @@ void av1_iadst8_new(const int32_t *input, int32_t *output,
// stage 1;
stage++;
+ assert(output != input);
bf1 = output;
bf1[0] = input[0];
bf1[1] = -input[7];
@@ -803,7 +810,7 @@ void av1_iadst8_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -832,7 +839,7 @@ void av1_iadst8_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -861,7 +868,7 @@ void av1_iadst8_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[4], bf0[0], cospi[60], bf0[1], cos_bit[stage]);
@@ -903,6 +910,7 @@ void av1_iadst16_new(const int32_t *input, int32_t *output,
// stage 1;
stage++;
+ assert(output != input);
bf1 = output;
bf1[0] = input[0];
bf1[1] = -input[15];
@@ -924,7 +932,7 @@ void av1_iadst16_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -969,7 +977,7 @@ void av1_iadst16_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -1014,7 +1022,7 @@ void av1_iadst16_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -1059,7 +1067,7 @@ void av1_iadst16_new(const int32_t *input, int32_t *output,
// stage 8
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[2], bf0[0], cospi[62], bf0[1], cos_bit[stage]);
@@ -1117,6 +1125,7 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
// stage 1;
stage++;
+ assert(output != input);
bf1 = output;
bf1[0] = input[0];
bf1[1] = -input[31];
@@ -1154,7 +1163,7 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -1231,7 +1240,7 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -1308,7 +1317,7 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -1385,7 +1394,7 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
// stage 8
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -1462,7 +1471,7 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
// stage 10
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[1], bf0[0], cospi[63], bf0[1], cos_bit[stage]);
@@ -1538,6 +1547,38 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
range_check(stage, input, bf1, size, stage_range[stage]);
}
+#if CONFIG_EXT_TX
+void av1_iidentity4_c(const int32_t *input, int32_t *output,
+ const int8_t *cos_bit, const int8_t *stage_range) {
+ (void)cos_bit;
+ for (int i = 0; i < 4; ++i)
+ output[i] = (int32_t)dct_const_round_shift(input[i] * Sqrt2);
+ range_check(0, input, output, 4, stage_range[0]);
+}
+
+void av1_iidentity8_c(const int32_t *input, int32_t *output,
+ const int8_t *cos_bit, const int8_t *stage_range) {
+ (void)cos_bit;
+ for (int i = 0; i < 8; ++i) output[i] = input[i] * 2;
+ range_check(0, input, output, 8, stage_range[0]);
+}
+
+void av1_iidentity16_c(const int32_t *input, int32_t *output,
+ const int8_t *cos_bit, const int8_t *stage_range) {
+ (void)cos_bit;
+ for (int i = 0; i < 16; ++i)
+ output[i] = (int32_t)dct_const_round_shift(input[i] * 2 * Sqrt2);
+ range_check(0, input, output, 16, stage_range[0]);
+}
+
+void av1_iidentity32_c(const int32_t *input, int32_t *output,
+ const int8_t *cos_bit, const int8_t *stage_range) {
+ (void)cos_bit;
+ for (int i = 0; i < 32; ++i) output[i] = input[i] * 4;
+ range_check(0, input, output, 32, stage_range[0]);
+}
+#endif // CONFIG_EXT_TX
+
#if CONFIG_TX64X64
void av1_idct64_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
@@ -1553,7 +1594,8 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 1;
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
+ assert(output != input);
bf1 = output;
bf1[0] = input[0];
bf1[1] = input[32];
@@ -1623,7 +1665,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -1694,7 +1736,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 3
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0];
@@ -1765,7 +1807,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@@ -1836,7 +1878,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 5
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0];
@@ -1907,7 +1949,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
@@ -1978,7 +2020,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 7
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0] + bf0[3];
@@ -2049,7 +2091,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 8
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[7];
@@ -2120,7 +2162,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 9
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0] + bf0[15];
@@ -2191,7 +2233,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 10
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[31];
@@ -2262,7 +2304,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 11
stage++;
- cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
+ cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0] + bf0[63];
diff --git a/third_party/aom/av1/common/av1_inv_txfm1d.h b/third_party/aom/av1/common/av1_inv_txfm1d.h
index 9e7a2323b..037a3c6bc 100644
--- a/third_party/aom/av1/common/av1_inv_txfm1d.h
+++ b/third_party/aom/av1/common/av1_inv_txfm1d.h
@@ -37,6 +37,16 @@ void av1_iadst16_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_iadst32_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
+#if CONFIG_EXT_TX
+void av1_iidentity4_c(const int32_t *input, int32_t *output,
+ const int8_t *cos_bit, const int8_t *stage_range);
+void av1_iidentity8_c(const int32_t *input, int32_t *output,
+ const int8_t *cos_bit, const int8_t *stage_range);
+void av1_iidentity16_c(const int32_t *input, int32_t *output,
+ const int8_t *cos_bit, const int8_t *stage_range);
+void av1_iidentity32_c(const int32_t *input, int32_t *output,
+ const int8_t *cos_bit, const int8_t *stage_range);
+#endif // CONFIG_EXT_TX
#ifdef __cplusplus
}
diff --git a/third_party/aom/av1/common/av1_inv_txfm1d_cfg.h b/third_party/aom/av1/common/av1_inv_txfm1d_cfg.h
new file mode 100644
index 000000000..04d2b3bd3
--- /dev/null
+++ b/third_party/aom/av1/common/av1_inv_txfm1d_cfg.h
@@ -0,0 +1,362 @@
+/*
+ * Copyright (c) 2016, Alliance for Open Media. All rights reserved
+ *
+ * This source code is subject to the terms of the BSD 2 Clause License and
+ * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
+ * was not distributed with this source code in the LICENSE file, you can
+ * obtain it at www.aomedia.org/license/software. If the Alliance for Open
+ * Media Patent License 1.0 was not distributed with this source code in the
+ * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
+ */
+
+#ifndef AV1_INV_TXFM2D_CFG_H_
+#define AV1_INV_TXFM2D_CFG_H_
+#include "av1/common/av1_inv_txfm1d.h"
+// Identity will always use max bitdepth regardless of size
+static const int8_t inv_stage_range_identity[1] = { 12 };
+
+// ---------------- 4x4 1D config -----------------------
+// shift
+static const int8_t inv_shift_4[2] = { 0, -4 };
+
+// stage range
+static const int8_t inv_stage_range_col_dct_4[4] = { 18, 18, 17, 17 };
+static const int8_t inv_stage_range_row_dct_4[4] = { 18, 18, 18, 18 };
+static const int8_t inv_stage_range_col_adst_4[6] = { 18, 18, 18, 18, 17, 17 };
+static const int8_t inv_stage_range_row_adst_4[6] = { 18, 18, 18, 18, 18, 18 };
+// cos bit
+static const int8_t inv_cos_bit_col_dct_4[4] = { 13, 13, 13, 13 };
+static const int8_t inv_cos_bit_row_dct_4[4] = { 13, 13, 13, 13 };
+static const int8_t inv_cos_bit_col_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
+static const int8_t inv_cos_bit_row_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
+
+// ---------------- 8x8 1D constants -----------------------
+// shift
+static const int8_t inv_shift_8[2] = { 0, -5 };
+
+// stage range
+static const int8_t inv_stage_range_col_dct_8[6] = { 19, 19, 19, 19, 18, 18 };
+static const int8_t inv_stage_range_row_dct_8[6] = { 19, 19, 19, 19, 19, 19 };
+static const int8_t inv_stage_range_col_adst_8[8] = { 19, 19, 19, 19,
+ 19, 19, 18, 18 };
+static const int8_t inv_stage_range_row_adst_8[8] = { 19, 19, 19, 19,
+ 19, 19, 19, 19 };
+// cos bit
+static const int8_t inv_cos_bit_col_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
+static const int8_t inv_cos_bit_row_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
+static const int8_t inv_cos_bit_col_adst_8[8] = {
+ 13, 13, 13, 13, 13, 13, 13, 13
+};
+static const int8_t inv_cos_bit_row_adst_8[8] = {
+ 13, 13, 13, 13, 13, 13, 13, 13
+};
+
+// ---------------- 16x16 1D constants -----------------------
+// shift
+static const int8_t inv_shift_16[2] = { -1, -5 };
+
+// stage range
+static const int8_t inv_stage_range_col_dct_16[8] = { 19, 19, 19, 19,
+ 19, 19, 18, 18 };
+static const int8_t inv_stage_range_row_dct_16[8] = { 20, 20, 20, 20,
+ 20, 20, 20, 20 };
+static const int8_t inv_stage_range_col_adst_16[10] = { 19, 19, 19, 19, 19,
+ 19, 19, 19, 18, 18 };
+static const int8_t inv_stage_range_row_adst_16[10] = { 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20 };
+
+// cos bit
+static const int8_t inv_cos_bit_col_dct_16[8] = {
+ 13, 13, 13, 13, 13, 13, 13, 13
+};
+static const int8_t inv_cos_bit_row_dct_16[8] = {
+ 12, 12, 12, 12, 12, 12, 12, 12
+};
+static const int8_t inv_cos_bit_col_adst_16[10] = { 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13 };
+static const int8_t inv_cos_bit_row_adst_16[10] = { 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12 };
+
+// ---------------- 32x32 1D constants -----------------------
+// shift
+static const int8_t inv_shift_32[2] = { -1, -5 };
+
+// stage range
+static const int8_t inv_stage_range_col_dct_32[10] = { 19, 19, 19, 19, 19,
+ 19, 19, 19, 18, 18 };
+static const int8_t inv_stage_range_row_dct_32[10] = { 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20 };
+static const int8_t inv_stage_range_col_adst_32[12] = {
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 18, 18
+};
+static const int8_t inv_stage_range_row_adst_32[12] = {
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
+};
+
+// cos bit
+static const int8_t inv_cos_bit_col_dct_32[10] = { 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13 };
+static const int8_t inv_cos_bit_row_dct_32[10] = { 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12 };
+static const int8_t inv_cos_bit_col_adst_32[12] = { 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13 };
+static const int8_t inv_cos_bit_row_adst_32[12] = { 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12 };
+
+// ---------------- 64x64 1D constants -----------------------
+// shift
+static const int8_t inv_shift_64[2] = { -1, -7 };
+
+// stage range
+static const int8_t inv_stage_range_col_dct_64[12] = { 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 18, 18 };
+static const int8_t inv_stage_range_row_dct_64[12] = { 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20 };
+
+// cos bit
+static const int8_t inv_cos_bit_col_dct_64[12] = { 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13 };
+static const int8_t inv_cos_bit_row_dct_64[12] = { 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12 };
+
+// ---------------- row config inv_dct_4 ----------------
+static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_4 = {
+ 4, // .txfm_size
+ 4, // .stage_num
+ // 0, // .log_scale
+ inv_shift_4, // .shift
+ inv_stage_range_row_dct_4, // .stage_range
+ inv_cos_bit_row_dct_4, // .cos_bit
+ TXFM_TYPE_DCT4 // .txfm_type
+};
+
+// ---------------- row config inv_dct_8 ----------------
+static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_8 = {
+ 8, // .txfm_size
+ 6, // .stage_num
+ // 0, // .log_scale
+ inv_shift_8, // .shift
+ inv_stage_range_row_dct_8, // .stage_range
+ inv_cos_bit_row_dct_8, // .cos_bit_
+ TXFM_TYPE_DCT8 // .txfm_type
+};
+// ---------------- row config inv_dct_16 ----------------
+static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_16 = {
+ 16, // .txfm_size
+ 8, // .stage_num
+ // 0, // .log_scale
+ inv_shift_16, // .shift
+ inv_stage_range_row_dct_16, // .stage_range
+ inv_cos_bit_row_dct_16, // .cos_bit
+ TXFM_TYPE_DCT16 // .txfm_type
+};
+
+// ---------------- row config inv_dct_32 ----------------
+static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_32 = {
+ 32, // .txfm_size
+ 10, // .stage_num
+ // 1, // .log_scale
+ inv_shift_32, // .shift
+ inv_stage_range_row_dct_32, // .stage_range
+ inv_cos_bit_row_dct_32, // .cos_bit_row
+ TXFM_TYPE_DCT32 // .txfm_type
+};
+
+// ---------------- row config inv_dct_64 ----------------
+static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_64 = {
+ 64, // .txfm_size
+ 12, // .stage_num
+ inv_shift_64, // .shift
+ inv_stage_range_row_dct_64, // .stage_range
+ inv_cos_bit_row_dct_64, // .cos_bit
+ TXFM_TYPE_DCT64, // .txfm_type_col
+};
+
+// ---------------- row config inv_adst_4 ----------------
+static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_4 = {
+ 4, // .txfm_size
+ 6, // .stage_num
+ // 0, // .log_scale
+ inv_shift_4, // .shift
+ inv_stage_range_row_adst_4, // .stage_range
+ inv_cos_bit_row_adst_4, // .cos_bit
+ TXFM_TYPE_ADST4, // .txfm_type
+};
+
+// ---------------- row config inv_adst_8 ----------------
+static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_8 = {
+ 8, // .txfm_size
+ 8, // .stage_num
+ // 0, // .log_scale
+ inv_shift_8, // .shift
+ inv_stage_range_row_adst_8, // .stage_range
+ inv_cos_bit_row_adst_8, // .cos_bit
+ TXFM_TYPE_ADST8, // .txfm_type_col
+};
+
+// ---------------- row config inv_adst_16 ----------------
+static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_16 = {
+ 16, // .txfm_size
+ 10, // .stage_num
+ // 0, // .log_scale
+ inv_shift_16, // .shift
+ inv_stage_range_row_adst_16, // .stage_range
+ inv_cos_bit_row_adst_16, // .cos_bit
+ TXFM_TYPE_ADST16, // .txfm_type
+};
+
+// ---------------- row config inv_adst_32 ----------------
+static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_32 = {
+ 32, // .txfm_size
+ 12, // .stage_num
+ // 1, // .log_scale
+ inv_shift_32, // .shift
+ inv_stage_range_row_adst_32, // .stage_range
+ inv_cos_bit_row_adst_32, // .cos_bit
+ TXFM_TYPE_ADST32, // .txfm_type
+};
+
+// ---------------- col config inv_dct_4 ----------------
+static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_4 = {
+ 4, // .txfm_size
+ 4, // .stage_num
+ // 0, // .log_scale
+ inv_shift_4, // .shift
+ inv_stage_range_col_dct_4, // .stage_range
+ inv_cos_bit_col_dct_4, // .cos_bit
+ TXFM_TYPE_DCT4 // .txfm_type
+};
+
+// ---------------- col config inv_dct_8 ----------------
+static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_8 = {
+ 8, // .txfm_size
+ 6, // .stage_num
+ // 0, // .log_scale
+ inv_shift_8, // .shift
+ inv_stage_range_col_dct_8, // .stage_range
+ inv_cos_bit_col_dct_8, // .cos_bit_
+ TXFM_TYPE_DCT8 // .txfm_type
+};
+// ---------------- col config inv_dct_16 ----------------
+static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_16 = {
+ 16, // .txfm_size
+ 8, // .stage_num
+ // 0, // .log_scale
+ inv_shift_16, // .shift
+ inv_stage_range_col_dct_16, // .stage_range
+ inv_cos_bit_col_dct_16, // .cos_bit
+ TXFM_TYPE_DCT16 // .txfm_type
+};
+
+// ---------------- col config inv_dct_32 ----------------
+static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_32 = {
+ 32, // .txfm_size
+ 10, // .stage_num
+ // 1, // .log_scale
+ inv_shift_32, // .shift
+ inv_stage_range_col_dct_32, // .stage_range
+ inv_cos_bit_col_dct_32, // .cos_bit_col
+ TXFM_TYPE_DCT32 // .txfm_type
+};
+
+// ---------------- col config inv_dct_64 ----------------
+static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_64 = {
+ 64, // .txfm_size
+ 12, // .stage_num
+ inv_shift_64, // .shift
+ inv_stage_range_col_dct_64, // .stage_range
+ inv_cos_bit_col_dct_64, // .cos_bit
+ TXFM_TYPE_DCT64, // .txfm_type_col
+};
+
+// ---------------- col config inv_adst_4 ----------------
+static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_4 = {
+ 4, // .txfm_size
+ 6, // .stage_num
+ // 0, // .log_scale
+ inv_shift_4, // .shift
+ inv_stage_range_col_adst_4, // .stage_range
+ inv_cos_bit_col_adst_4, // .cos_bit
+ TXFM_TYPE_ADST4, // .txfm_type
+};
+
+// ---------------- col config inv_adst_8 ----------------
+static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_8 = {
+ 8, // .txfm_size
+ 8, // .stage_num
+ // 0, // .log_scale
+ inv_shift_8, // .shift
+ inv_stage_range_col_adst_8, // .stage_range
+ inv_cos_bit_col_adst_8, // .cos_bit
+ TXFM_TYPE_ADST8, // .txfm_type_col
+};
+
+// ---------------- col config inv_adst_16 ----------------
+static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_16 = {
+ 16, // .txfm_size
+ 10, // .stage_num
+ // 0, // .log_scale
+ inv_shift_16, // .shift
+ inv_stage_range_col_adst_16, // .stage_range
+ inv_cos_bit_col_adst_16, // .cos_bit
+ TXFM_TYPE_ADST16, // .txfm_type
+};
+
+// ---------------- col config inv_adst_32 ----------------
+static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_32 = {
+ 32, // .txfm_size
+ 12, // .stage_num
+ // 1, // .log_scale
+ inv_shift_32, // .shift
+ inv_stage_range_col_adst_32, // .stage_range
+ inv_cos_bit_col_adst_32, // .cos_bit
+ TXFM_TYPE_ADST32, // .txfm_type
+};
+
+#if CONFIG_EXT_TX
+// identity does not need to differentiate between row and col
+// ---------------- row/col config inv_identity_4 ----------
+static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_4 = {
+ 4, // .txfm_size
+ 1, // .stage_num
+ // 0, // .log_scale
+ inv_shift_4, // .shift
+ inv_stage_range_identity, // .stage_range
+ NULL, // .cos_bit
+ TXFM_TYPE_IDENTITY4, // .txfm_type
+};
+
+// ---------------- row/col config inv_identity_8 ----------------
+static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_8 = {
+ 8, // .txfm_size
+ 1, // .stage_num
+ // 0, // .log_scale
+ inv_shift_8, // .shift
+ inv_stage_range_identity, // .stage_range
+ NULL, // .cos_bit
+ TXFM_TYPE_IDENTITY8, // .txfm_type
+};
+
+// ---------------- row/col config inv_identity_16 ----------------
+static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_16 = {
+ 16, // .txfm_size
+ 1, // .stage_num
+ // 0, // .log_scale
+ inv_shift_16, // .shift
+ inv_stage_range_identity, // .stage_range
+ NULL, // .cos_bit
+ TXFM_TYPE_IDENTITY16, // .txfm_type
+};
+
+// ---------------- row/col config inv_identity_32 ----------------
+static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_32 = {
+ 32, // .txfm_size
+ 1, // .stage_num
+ // 1, // .log_scale
+ inv_shift_32, // .shift
+ inv_stage_range_identity, // .stage_range
+ NULL, // .cos_bit
+ TXFM_TYPE_IDENTITY32, // .txfm_type
+};
+#endif // CONFIG_EXT_TX
+#endif // AV1_INV_TXFM2D_CFG_H_
diff --git a/third_party/aom/av1/common/av1_inv_txfm2d.c b/third_party/aom/av1/common/av1_inv_txfm2d.c
index d56c7d11f..e07f994c6 100644
--- a/third_party/aom/av1/common/av1_inv_txfm2d.c
+++ b/third_party/aom/av1/common/av1_inv_txfm2d.c
@@ -13,7 +13,7 @@
#include "av1/common/enums.h"
#include "av1/common/av1_txfm.h"
#include "av1/common/av1_inv_txfm1d.h"
-#include "av1/common/av1_inv_txfm2d_cfg.h"
+#include "av1/common/av1_inv_txfm1d_cfg.h"
static INLINE TxfmFunc inv_txfm_type_to_func(TXFM_TYPE txfm_type) {
switch (txfm_type) {
@@ -25,132 +25,100 @@ static INLINE TxfmFunc inv_txfm_type_to_func(TXFM_TYPE txfm_type) {
case TXFM_TYPE_ADST8: return av1_iadst8_new;
case TXFM_TYPE_ADST16: return av1_iadst16_new;
case TXFM_TYPE_ADST32: return av1_iadst32_new;
+#if CONFIG_EXT_TX
+ case TXFM_TYPE_IDENTITY4: return av1_iidentity4_c;
+ case TXFM_TYPE_IDENTITY8: return av1_iidentity8_c;
+ case TXFM_TYPE_IDENTITY16: return av1_iidentity16_c;
+ case TXFM_TYPE_IDENTITY32: return av1_iidentity32_c;
+#endif // CONFIG_EXT_TX
default: assert(0); return NULL;
}
}
-const TXFM_2D_CFG *inv_txfm_cfg_ls[TX_TYPES][TX_SIZES] = {
- // DCT_DCT
- {
-#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
+static const TXFM_1D_CFG *inv_txfm_col_cfg_ls[TX_TYPES_1D][TX_SIZES] = {
+ // DCT
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
NULL,
#endif
- &inv_txfm_2d_cfg_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
+ &inv_txfm_1d_col_cfg_dct_4, &inv_txfm_1d_col_cfg_dct_8,
+ &inv_txfm_1d_col_cfg_dct_16, &inv_txfm_1d_col_cfg_dct_32 },
+ // ADST
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
NULL,
#endif
- &inv_txfm_2d_cfg_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
+ &inv_txfm_1d_col_cfg_adst_4, &inv_txfm_1d_col_cfg_adst_8,
+ &inv_txfm_1d_col_cfg_adst_16, &inv_txfm_1d_col_cfg_adst_32 },
+#if CONFIG_EXT_TX
+ // FLIPADST
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
NULL,
#endif
- &inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
- &inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
-#if CONFIG_EXT_TX
- // FLIPADST_DCT
+ &inv_txfm_1d_col_cfg_adst_4, &inv_txfm_1d_col_cfg_adst_8,
+ &inv_txfm_1d_col_cfg_adst_16, &inv_txfm_1d_col_cfg_adst_32 },
+ // IDENTITY
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
NULL,
#endif
- &inv_txfm_2d_cfg_adst_dct_4, &inv_txfm_2d_cfg_adst_dct_8,
- &inv_txfm_2d_cfg_adst_dct_16, &inv_txfm_2d_cfg_adst_dct_32 },
- // DCT_FLIPADST
+ &inv_txfm_1d_cfg_identity_4, &inv_txfm_1d_cfg_identity_8,
+ &inv_txfm_1d_cfg_identity_16, &inv_txfm_1d_cfg_identity_32 },
+#endif // CONFIG_EXT_TX
+};
+
+static const TXFM_1D_CFG *inv_txfm_row_cfg_ls[TX_TYPES_1D][TX_SIZES] = {
+ // DCT
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
NULL,
#endif
- &inv_txfm_2d_cfg_dct_adst_4, &inv_txfm_2d_cfg_dct_adst_8,
- &inv_txfm_2d_cfg_dct_adst_16, &inv_txfm_2d_cfg_dct_adst_32 },
- // FLIPADST_FLIPADST
+ &inv_txfm_1d_row_cfg_dct_4, &inv_txfm_1d_row_cfg_dct_8,
+ &inv_txfm_1d_row_cfg_dct_16, &inv_txfm_1d_row_cfg_dct_32 },
+ // ADST
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
NULL,
#endif
- &inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
- &inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
- // ADST_FLIPADST
+ &inv_txfm_1d_row_cfg_adst_4, &inv_txfm_1d_row_cfg_adst_8,
+ &inv_txfm_1d_row_cfg_adst_16, &inv_txfm_1d_row_cfg_adst_32 },
+#if CONFIG_EXT_TX
+ // FLIPADST
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
NULL,
#endif
- &inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
- &inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
- // FLIPADST_ADST
+ &inv_txfm_1d_row_cfg_adst_4, &inv_txfm_1d_row_cfg_adst_8,
+ &inv_txfm_1d_row_cfg_adst_16, &inv_txfm_1d_row_cfg_adst_32 },
+ // IDENTITY
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
NULL,
#endif
- &inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
- &inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
- { // IDTX
-#if CONFIG_CB4X4
- NULL,
-#endif
- &inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
- &inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
- { // V_DCT
-#if CONFIG_CB4X4
- NULL,
-#endif
- &inv_txfm_2d_cfg_dct_adst_4, &inv_txfm_2d_cfg_dct_adst_8,
- &inv_txfm_2d_cfg_dct_adst_16, &inv_txfm_2d_cfg_dct_adst_32 },
- { // H_DCT
-#if CONFIG_CB4X4
- NULL,
-#endif
- &inv_txfm_2d_cfg_adst_dct_4, &inv_txfm_2d_cfg_adst_dct_8,
- &inv_txfm_2d_cfg_adst_dct_16, &inv_txfm_2d_cfg_adst_dct_32 },
- { // V_ADST
-#if CONFIG_CB4X4
- NULL,
-#endif
- &inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
- &inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
- { // H_ADST
-#if CONFIG_CB4X4
- NULL,
-#endif
- &inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
- &inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
- { // V_FLIP_ADST
-#if CONFIG_CB4X4
- NULL,
-#endif
- &inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
- &inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
- { // H_FLIP_ADST
-#if CONFIG_CB4X4
- NULL,
-#endif
- &inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
- &inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
+ &inv_txfm_1d_cfg_identity_4, &inv_txfm_1d_cfg_identity_8,
+ &inv_txfm_1d_cfg_identity_16, &inv_txfm_1d_cfg_identity_32 },
#endif // CONFIG_EXT_TX
};
TXFM_2D_FLIP_CFG av1_get_inv_txfm_cfg(int tx_type, int tx_size) {
TXFM_2D_FLIP_CFG cfg;
set_flip_cfg(tx_type, &cfg);
- cfg.cfg = inv_txfm_cfg_ls[tx_type][tx_size];
+ int tx_type_col = vtx_tab[tx_type];
+ int tx_type_row = htx_tab[tx_type];
+ // TODO(sarahparker) this is currently only implemented for
+ // square transforms
+ cfg.col_cfg = inv_txfm_col_cfg_ls[tx_type_col][tx_size];
+ cfg.row_cfg = inv_txfm_row_cfg_ls[tx_type_row][tx_size];
return cfg;
}
TXFM_2D_FLIP_CFG av1_get_inv_txfm_64x64_cfg(int tx_type) {
- TXFM_2D_FLIP_CFG cfg = { 0, 0, NULL };
+ TXFM_2D_FLIP_CFG cfg = { 0, 0, NULL, NULL };
switch (tx_type) {
case DCT_DCT:
- cfg.cfg = &inv_txfm_2d_cfg_dct_dct_64;
+ cfg.col_cfg = &inv_txfm_1d_col_cfg_dct_64;
+ cfg.row_cfg = &inv_txfm_1d_row_cfg_dct_64;
set_flip_cfg(tx_type, &cfg);
break;
default: assert(0);
@@ -161,14 +129,15 @@ TXFM_2D_FLIP_CFG av1_get_inv_txfm_64x64_cfg(int tx_type) {
static INLINE void inv_txfm2d_add_c(const int32_t *input, int16_t *output,
int stride, TXFM_2D_FLIP_CFG *cfg,
int32_t *txfm_buf) {
- const int txfm_size = cfg->cfg->txfm_size;
- const int8_t *shift = cfg->cfg->shift;
- const int8_t *stage_range_col = cfg->cfg->stage_range_col;
- const int8_t *stage_range_row = cfg->cfg->stage_range_row;
- const int8_t *cos_bit_col = cfg->cfg->cos_bit_col;
- const int8_t *cos_bit_row = cfg->cfg->cos_bit_row;
- const TxfmFunc txfm_func_col = inv_txfm_type_to_func(cfg->cfg->txfm_type_col);
- const TxfmFunc txfm_func_row = inv_txfm_type_to_func(cfg->cfg->txfm_type_row);
+ // TODO(sarahparker) must correct for rectangular transforms in follow up
+ const int txfm_size = cfg->row_cfg->txfm_size;
+ const int8_t *shift = cfg->row_cfg->shift;
+ const int8_t *stage_range_col = cfg->col_cfg->stage_range;
+ const int8_t *stage_range_row = cfg->row_cfg->stage_range;
+ const int8_t *cos_bit_col = cfg->col_cfg->cos_bit;
+ const int8_t *cos_bit_row = cfg->row_cfg->cos_bit;
+ const TxfmFunc txfm_func_col = inv_txfm_type_to_func(cfg->col_cfg->txfm_type);
+ const TxfmFunc txfm_func_row = inv_txfm_type_to_func(cfg->row_cfg->txfm_type);
// txfm_buf's length is txfm_size * txfm_size + 2 * txfm_size
// it is used for intermediate data buffering
@@ -216,7 +185,11 @@ static INLINE void inv_txfm2d_add_facade(const int32_t *input, uint16_t *output,
// int16_t*
TXFM_2D_FLIP_CFG cfg = av1_get_inv_txfm_cfg(tx_type, tx_size);
inv_txfm2d_add_c(input, (int16_t *)output, stride, &cfg, txfm_buf);
- clamp_block((int16_t *)output, cfg.cfg->txfm_size, stride, 0, (1 << bd) - 1);
+ // TODO(sarahparker) just using the cfg_row->txfm_size for now because
+ // we are assumint this is only used for square transforms. This will
+ // be adjusted in a follow up
+ clamp_block((int16_t *)output, cfg.row_cfg->txfm_size, stride, 0,
+ (1 << bd) - 1);
}
void av1_inv_txfm2d_add_4x4_c(const int32_t *input, uint16_t *output,
diff --git a/third_party/aom/av1/common/av1_inv_txfm2d_cfg.h b/third_party/aom/av1/common/av1_inv_txfm2d_cfg.h
deleted file mode 100644
index 9eabc2e5a..000000000
--- a/third_party/aom/av1/common/av1_inv_txfm2d_cfg.h
+++ /dev/null
@@ -1,447 +0,0 @@
-/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved
- *
- * This source code is subject to the terms of the BSD 2 Clause License and
- * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
- * was not distributed with this source code in the LICENSE file, you can
- * obtain it at www.aomedia.org/license/software. If the Alliance for Open
- * Media Patent License 1.0 was not distributed with this source code in the
- * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
- */
-
-#ifndef AV1_INV_TXFM2D_CFG_H_
-#define AV1_INV_TXFM2D_CFG_H_
-#include "av1/common/av1_inv_txfm1d.h"
-// ---------------- config inv_dct_dct_4 ----------------
-static const int8_t inv_shift_dct_dct_4[2] = { 0, -4 };
-static const int8_t inv_stage_range_col_dct_dct_4[4] = { 18, 18, 17, 17 };
-static const int8_t inv_stage_range_row_dct_dct_4[4] = { 18, 18, 18, 18 };
-static const int8_t inv_cos_bit_col_dct_dct_4[4] = { 13, 13, 13, 13 };
-static const int8_t inv_cos_bit_row_dct_dct_4[4] = { 13, 13, 13, 13 };
-
-static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_dct_4 = {
- 4, // .txfm_size
- 4, // .stage_num_col
- 4, // .stage_num_row
- // 0, // .log_scale
- inv_shift_dct_dct_4, // .shift
- inv_stage_range_col_dct_dct_4, // .stage_range_col
- inv_stage_range_row_dct_dct_4, // .stage_range_row
- inv_cos_bit_col_dct_dct_4, // .cos_bit_col
- inv_cos_bit_row_dct_dct_4, // .cos_bit_row
- TXFM_TYPE_DCT4, // .txfm_type_col
- TXFM_TYPE_DCT4
-}; // .txfm_type_row
-
-// ---------------- config inv_dct_dct_8 ----------------
-static const int8_t inv_shift_dct_dct_8[2] = { 0, -5 };
-static const int8_t inv_stage_range_col_dct_dct_8[6] = {
- 19, 19, 19, 19, 18, 18
-};
-static const int8_t inv_stage_range_row_dct_dct_8[6] = {
- 19, 19, 19, 19, 19, 19
-};
-static const int8_t inv_cos_bit_col_dct_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
-static const int8_t inv_cos_bit_row_dct_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
-
-static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_dct_8 = {
- 8, // .txfm_size
- 6, // .stage_num_col
- 6, // .stage_num_row
- // 0, // .log_scale
- inv_shift_dct_dct_8, // .shift
- inv_stage_range_col_dct_dct_8, // .stage_range_col
- inv_stage_range_row_dct_dct_8, // .stage_range_row
- inv_cos_bit_col_dct_dct_8, // .cos_bit_col
- inv_cos_bit_row_dct_dct_8, // .cos_bit_row
- TXFM_TYPE_DCT8, // .txfm_type_col
- TXFM_TYPE_DCT8
-}; // .txfm_type_row
-
-// ---------------- config inv_dct_dct_16 ----------------
-static const int8_t inv_shift_dct_dct_16[2] = { -1, -5 };
-static const int8_t inv_stage_range_col_dct_dct_16[8] = { 19, 19, 19, 19,
- 19, 19, 18, 18 };
-static const int8_t inv_stage_range_row_dct_dct_16[8] = { 20, 20, 20, 20,
- 20, 20, 20, 20 };
-static const int8_t inv_cos_bit_col_dct_dct_16[8] = { 13, 13, 13, 13,
- 13, 13, 13, 13 };
-static const int8_t inv_cos_bit_row_dct_dct_16[8] = { 12, 12, 12, 12,
- 12, 12, 12, 12 };
-
-static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_dct_16 = {
- 16, // .txfm_size
- 8, // .stage_num_col
- 8, // .stage_num_row
- // 0, // .log_scale
- inv_shift_dct_dct_16, // .shift
- inv_stage_range_col_dct_dct_16, // .stage_range_col
- inv_stage_range_row_dct_dct_16, // .stage_range_row
- inv_cos_bit_col_dct_dct_16, // .cos_bit_col
- inv_cos_bit_row_dct_dct_16, // .cos_bit_row
- TXFM_TYPE_DCT16, // .txfm_type_col
- TXFM_TYPE_DCT16
-}; // .txfm_type_row
-
-// ---------------- config inv_dct_dct_32 ----------------
-static const int8_t inv_shift_dct_dct_32[2] = { -1, -5 };
-static const int8_t inv_stage_range_col_dct_dct_32[10] = { 19, 19, 19, 19, 19,
- 19, 19, 19, 18, 18 };
-static const int8_t inv_stage_range_row_dct_dct_32[10] = { 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20 };
-static const int8_t inv_cos_bit_col_dct_dct_32[10] = { 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13 };
-static const int8_t inv_cos_bit_row_dct_dct_32[10] = { 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12 };
-
-static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_dct_32 = {
- 32, // .txfm_size
- 10, // .stage_num_col
- 10, // .stage_num_row
- // 1, // .log_scale
- inv_shift_dct_dct_32, // .shift
- inv_stage_range_col_dct_dct_32, // .stage_range_col
- inv_stage_range_row_dct_dct_32, // .stage_range_row
- inv_cos_bit_col_dct_dct_32, // .cos_bit_col
- inv_cos_bit_row_dct_dct_32, // .cos_bit_row
- TXFM_TYPE_DCT32, // .txfm_type_col
- TXFM_TYPE_DCT32
-}; // .txfm_type_row
-
-// ---------------- config inv_dct_dct_64 ----------------
-static const int8_t inv_shift_dct_dct_64[2] = { -1, -7 };
-static const int8_t inv_stage_range_col_dct_dct_64[12] = {
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 18, 18
-};
-static const int8_t inv_stage_range_row_dct_dct_64[12] = {
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
-};
-static const int8_t inv_cos_bit_col_dct_dct_64[12] = { 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13 };
-static const int8_t inv_cos_bit_row_dct_dct_64[12] = { 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12 };
-
-static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_dct_64 = {
- 64, // .txfm_size
- 12, // .stage_num_col
- 12, // .stage_num_row
- inv_shift_dct_dct_64, // .shift
- inv_stage_range_col_dct_dct_64, // .stage_range_col
- inv_stage_range_row_dct_dct_64, // .stage_range_row
- inv_cos_bit_col_dct_dct_64, // .cos_bit_col
- inv_cos_bit_row_dct_dct_64, // .cos_bit_row
- TXFM_TYPE_DCT64, // .txfm_type_col
- TXFM_TYPE_DCT64
-}; // .txfm_type_row
-
-// ---------------- config inv_dct_adst_4 ----------------
-static const int8_t inv_shift_dct_adst_4[2] = { 0, -4 };
-static const int8_t inv_stage_range_col_dct_adst_4[4] = { 18, 18, 17, 17 };
-static const int8_t inv_stage_range_row_dct_adst_4[6] = {
- 18, 18, 18, 18, 18, 18
-};
-static const int8_t inv_cos_bit_col_dct_adst_4[4] = { 13, 13, 13, 13 };
-static const int8_t inv_cos_bit_row_dct_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
-
-static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_adst_4 = {
- 4, // .txfm_size
- 4, // .stage_num_col
- 6, // .stage_num_row
- // 0, // .log_scale
- inv_shift_dct_adst_4, // .shift
- inv_stage_range_col_dct_adst_4, // .stage_range_col
- inv_stage_range_row_dct_adst_4, // .stage_range_row
- inv_cos_bit_col_dct_adst_4, // .cos_bit_col
- inv_cos_bit_row_dct_adst_4, // .cos_bit_row
- TXFM_TYPE_DCT4, // .txfm_type_col
- TXFM_TYPE_ADST4
-}; // .txfm_type_row
-
-// ---------------- config inv_dct_adst_8 ----------------
-static const int8_t inv_shift_dct_adst_8[2] = { 0, -5 };
-static const int8_t inv_stage_range_col_dct_adst_8[6] = {
- 19, 19, 19, 19, 18, 18
-};
-static const int8_t inv_stage_range_row_dct_adst_8[8] = { 19, 19, 19, 19,
- 19, 19, 19, 19 };
-static const int8_t inv_cos_bit_col_dct_adst_8[6] = { 13, 13, 13, 13, 13, 13 };
-static const int8_t inv_cos_bit_row_dct_adst_8[8] = { 13, 13, 13, 13,
- 13, 13, 13, 13 };
-
-static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_adst_8 = {
- 8, // .txfm_size
- 6, // .stage_num_col
- 8, // .stage_num_row
- // 0, // .log_scale
- inv_shift_dct_adst_8, // .shift
- inv_stage_range_col_dct_adst_8, // .stage_range_col
- inv_stage_range_row_dct_adst_8, // .stage_range_row
- inv_cos_bit_col_dct_adst_8, // .cos_bit_col
- inv_cos_bit_row_dct_adst_8, // .cos_bit_row
- TXFM_TYPE_DCT8, // .txfm_type_col
- TXFM_TYPE_ADST8
-}; // .txfm_type_row
-
-// ---------------- config inv_dct_adst_16 ----------------
-static const int8_t inv_shift_dct_adst_16[2] = { -1, -5 };
-static const int8_t inv_stage_range_col_dct_adst_16[8] = { 19, 19, 19, 19,
- 19, 19, 18, 18 };
-static const int8_t inv_stage_range_row_dct_adst_16[10] = {
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
-};
-static const int8_t inv_cos_bit_col_dct_adst_16[8] = { 13, 13, 13, 13,
- 13, 13, 13, 13 };
-static const int8_t inv_cos_bit_row_dct_adst_16[10] = { 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12 };
-
-static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_adst_16 = {
- 16, // .txfm_size
- 8, // .stage_num_col
- 10, // .stage_num_row
- // 0, // .log_scale
- inv_shift_dct_adst_16, // .shift
- inv_stage_range_col_dct_adst_16, // .stage_range_col
- inv_stage_range_row_dct_adst_16, // .stage_range_row
- inv_cos_bit_col_dct_adst_16, // .cos_bit_col
- inv_cos_bit_row_dct_adst_16, // .cos_bit_row
- TXFM_TYPE_DCT16, // .txfm_type_col
- TXFM_TYPE_ADST16
-}; // .txfm_type_row
-
-// ---------------- config inv_dct_adst_32 ----------------
-static const int8_t inv_shift_dct_adst_32[2] = { -1, -5 };
-static const int8_t inv_stage_range_col_dct_adst_32[10] = {
- 19, 19, 19, 19, 19, 19, 19, 19, 18, 18
-};
-static const int8_t inv_stage_range_row_dct_adst_32[12] = {
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
-};
-static const int8_t inv_cos_bit_col_dct_adst_32[10] = { 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13 };
-static const int8_t inv_cos_bit_row_dct_adst_32[12] = {
- 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
-};
-
-static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_adst_32 = {
- 32, // .txfm_size
- 10, // .stage_num_col
- 12, // .stage_num_row
- // 1, // .log_scale
- inv_shift_dct_adst_32, // .shift
- inv_stage_range_col_dct_adst_32, // .stage_range_col
- inv_stage_range_row_dct_adst_32, // .stage_range_row
- inv_cos_bit_col_dct_adst_32, // .cos_bit_col
- inv_cos_bit_row_dct_adst_32, // .cos_bit_row
- TXFM_TYPE_DCT32, // .txfm_type_col
- TXFM_TYPE_ADST32
-}; // .txfm_type_row
-
-// ---------------- config inv_adst_adst_4 ----------------
-static const int8_t inv_shift_adst_adst_4[2] = { 0, -4 };
-static const int8_t inv_stage_range_col_adst_adst_4[6] = { 18, 18, 18,
- 18, 17, 17 };
-static const int8_t inv_stage_range_row_adst_adst_4[6] = { 18, 18, 18,
- 18, 18, 18 };
-static const int8_t inv_cos_bit_col_adst_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
-static const int8_t inv_cos_bit_row_adst_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
-
-static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_adst_4 = {
- 4, // .txfm_size
- 6, // .stage_num_col
- 6, // .stage_num_row
- // 0, // .log_scale
- inv_shift_adst_adst_4, // .shift
- inv_stage_range_col_adst_adst_4, // .stage_range_col
- inv_stage_range_row_adst_adst_4, // .stage_range_row
- inv_cos_bit_col_adst_adst_4, // .cos_bit_col
- inv_cos_bit_row_adst_adst_4, // .cos_bit_row
- TXFM_TYPE_ADST4, // .txfm_type_col
- TXFM_TYPE_ADST4
-}; // .txfm_type_row
-
-// ---------------- config inv_adst_adst_8 ----------------
-static const int8_t inv_shift_adst_adst_8[2] = { 0, -5 };
-static const int8_t inv_stage_range_col_adst_adst_8[8] = { 19, 19, 19, 19,
- 19, 19, 18, 18 };
-static const int8_t inv_stage_range_row_adst_adst_8[8] = { 19, 19, 19, 19,
- 19, 19, 19, 19 };
-static const int8_t inv_cos_bit_col_adst_adst_8[8] = { 13, 13, 13, 13,
- 13, 13, 13, 13 };
-static const int8_t inv_cos_bit_row_adst_adst_8[8] = { 13, 13, 13, 13,
- 13, 13, 13, 13 };
-
-static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_adst_8 = {
- 8, // .txfm_size
- 8, // .stage_num_col
- 8, // .stage_num_row
- // 0, // .log_scale
- inv_shift_adst_adst_8, // .shift
- inv_stage_range_col_adst_adst_8, // .stage_range_col
- inv_stage_range_row_adst_adst_8, // .stage_range_row
- inv_cos_bit_col_adst_adst_8, // .cos_bit_col
- inv_cos_bit_row_adst_adst_8, // .cos_bit_row
- TXFM_TYPE_ADST8, // .txfm_type_col
- TXFM_TYPE_ADST8
-}; // .txfm_type_row
-
-// ---------------- config inv_adst_adst_16 ----------------
-static const int8_t inv_shift_adst_adst_16[2] = { -1, -5 };
-static const int8_t inv_stage_range_col_adst_adst_16[10] = {
- 19, 19, 19, 19, 19, 19, 19, 19, 18, 18
-};
-static const int8_t inv_stage_range_row_adst_adst_16[10] = {
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
-};
-static const int8_t inv_cos_bit_col_adst_adst_16[10] = { 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13 };
-static const int8_t inv_cos_bit_row_adst_adst_16[10] = { 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12 };
-
-static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_adst_16 = {
- 16, // .txfm_size
- 10, // .stage_num_col
- 10, // .stage_num_row
- // 0, // .log_scale
- inv_shift_adst_adst_16, // .shift
- inv_stage_range_col_adst_adst_16, // .stage_range_col
- inv_stage_range_row_adst_adst_16, // .stage_range_row
- inv_cos_bit_col_adst_adst_16, // .cos_bit_col
- inv_cos_bit_row_adst_adst_16, // .cos_bit_row
- TXFM_TYPE_ADST16, // .txfm_type_col
- TXFM_TYPE_ADST16
-}; // .txfm_type_row
-
-// ---------------- config inv_adst_adst_32 ----------------
-static const int8_t inv_shift_adst_adst_32[2] = { -1, -5 };
-static const int8_t inv_stage_range_col_adst_adst_32[12] = {
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 18, 18
-};
-static const int8_t inv_stage_range_row_adst_adst_32[12] = {
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
-};
-static const int8_t inv_cos_bit_col_adst_adst_32[12] = {
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13
-};
-static const int8_t inv_cos_bit_row_adst_adst_32[12] = {
- 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
-};
-
-static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_adst_32 = {
- 32, // .txfm_size
- 12, // .stage_num_col
- 12, // .stage_num_row
- // 1, // .log_scale
- inv_shift_adst_adst_32, // .shift
- inv_stage_range_col_adst_adst_32, // .stage_range_col
- inv_stage_range_row_adst_adst_32, // .stage_range_row
- inv_cos_bit_col_adst_adst_32, // .cos_bit_col
- inv_cos_bit_row_adst_adst_32, // .cos_bit_row
- TXFM_TYPE_ADST32, // .txfm_type_col
- TXFM_TYPE_ADST32
-}; // .txfm_type_row
-
-// ---------------- config inv_adst_dct_4 ----------------
-static const int8_t inv_shift_adst_dct_4[2] = { 0, -4 };
-static const int8_t inv_stage_range_col_adst_dct_4[6] = {
- 18, 18, 18, 18, 17, 17
-};
-static const int8_t inv_stage_range_row_adst_dct_4[4] = { 18, 18, 18, 18 };
-static const int8_t inv_cos_bit_col_adst_dct_4[6] = { 13, 13, 13, 13, 13, 13 };
-static const int8_t inv_cos_bit_row_adst_dct_4[4] = { 13, 13, 13, 13 };
-
-static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_dct_4 = {
- 4, // .txfm_size
- 6, // .stage_num_col
- 4, // .stage_num_row
- // 0, // .log_scale
- inv_shift_adst_dct_4, // .shift
- inv_stage_range_col_adst_dct_4, // .stage_range_col
- inv_stage_range_row_adst_dct_4, // .stage_range_row
- inv_cos_bit_col_adst_dct_4, // .cos_bit_col
- inv_cos_bit_row_adst_dct_4, // .cos_bit_row
- TXFM_TYPE_ADST4, // .txfm_type_col
- TXFM_TYPE_DCT4
-}; // .txfm_type_row
-
-// ---------------- config inv_adst_dct_8 ----------------
-static const int8_t inv_shift_adst_dct_8[2] = { 0, -5 };
-static const int8_t inv_stage_range_col_adst_dct_8[8] = { 19, 19, 19, 19,
- 19, 19, 18, 18 };
-static const int8_t inv_stage_range_row_adst_dct_8[6] = {
- 19, 19, 19, 19, 19, 19
-};
-static const int8_t inv_cos_bit_col_adst_dct_8[8] = { 13, 13, 13, 13,
- 13, 13, 13, 13 };
-static const int8_t inv_cos_bit_row_adst_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
-
-static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_dct_8 = {
- 8, // .txfm_size
- 8, // .stage_num_col
- 6, // .stage_num_row
- // 0, // .log_scale
- inv_shift_adst_dct_8, // .shift
- inv_stage_range_col_adst_dct_8, // .stage_range_col
- inv_stage_range_row_adst_dct_8, // .stage_range_row
- inv_cos_bit_col_adst_dct_8, // .cos_bit_col
- inv_cos_bit_row_adst_dct_8, // .cos_bit_row
- TXFM_TYPE_ADST8, // .txfm_type_col
- TXFM_TYPE_DCT8
-}; // .txfm_type_row
-
-// ---------------- config inv_adst_dct_16 ----------------
-static const int8_t inv_shift_adst_dct_16[2] = { -1, -5 };
-static const int8_t inv_stage_range_col_adst_dct_16[10] = {
- 19, 19, 19, 19, 19, 19, 19, 19, 18, 18
-};
-static const int8_t inv_stage_range_row_adst_dct_16[8] = { 20, 20, 20, 20,
- 20, 20, 20, 20 };
-static const int8_t inv_cos_bit_col_adst_dct_16[10] = { 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13 };
-static const int8_t inv_cos_bit_row_adst_dct_16[8] = { 12, 12, 12, 12,
- 12, 12, 12, 12 };
-
-static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_dct_16 = {
- 16, // .txfm_size
- 10, // .stage_num_col
- 8, // .stage_num_row
- // 0, // .log_scale
- inv_shift_adst_dct_16, // .shift
- inv_stage_range_col_adst_dct_16, // .stage_range_col
- inv_stage_range_row_adst_dct_16, // .stage_range_row
- inv_cos_bit_col_adst_dct_16, // .cos_bit_col
- inv_cos_bit_row_adst_dct_16, // .cos_bit_row
- TXFM_TYPE_ADST16, // .txfm_type_col
- TXFM_TYPE_DCT16
-}; // .txfm_type_row
-
-// ---------------- config inv_adst_dct_32 ----------------
-static const int8_t inv_shift_adst_dct_32[2] = { -1, -5 };
-static const int8_t inv_stage_range_col_adst_dct_32[12] = {
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 18, 18
-};
-static const int8_t inv_stage_range_row_adst_dct_32[10] = {
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
-};
-static const int8_t inv_cos_bit_col_adst_dct_32[12] = {
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13
-};
-static const int8_t inv_cos_bit_row_adst_dct_32[10] = { 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12 };
-
-static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_dct_32 = {
- 32, // .txfm_size
- 12, // .stage_num_col
- 10, // .stage_num_row
- // 1, // .log_scale
- inv_shift_adst_dct_32, // .shift
- inv_stage_range_col_adst_dct_32, // .stage_range_col
- inv_stage_range_row_adst_dct_32, // .stage_range_row
- inv_cos_bit_col_adst_dct_32, // .cos_bit_col
- inv_cos_bit_row_adst_dct_32, // .cos_bit_row
- TXFM_TYPE_ADST32, // .txfm_type_col
- TXFM_TYPE_DCT32
-}; // .txfm_type_row
-
-extern const TXFM_2D_CFG *inv_txfm_cfg_ls[TX_TYPES][TX_SIZES];
-
-#endif // AV1_INV_TXFM2D_CFG_H_
diff --git a/third_party/aom/av1/common/av1_loopfilter.c b/third_party/aom/av1/common/av1_loopfilter.c
index 530871795..4b27ae93b 100644
--- a/third_party/aom/av1/common/av1_loopfilter.c
+++ b/third_party/aom/av1/common/av1_loopfilter.c
@@ -22,7 +22,7 @@
#include "av1/common/seg_common.h"
-#define CONFIG_PARALLEL_DEBLOCKING_15TAPLUMAONLY 0
+#define PARALLEL_DEBLOCKING_15TAPLUMAONLY 1
// 64 bit masks for left transform size. Each 1 represents a position where
// we should apply a loop filter across the left border of an 8x8 block
@@ -42,7 +42,7 @@
//
// A loopfilter should be applied to every other 8x8 horizontally.
static const uint64_t left_64x64_txform_mask[TX_SIZES] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
0xffffffffffffffffULL, // TX_2X2
#endif
0xffffffffffffffffULL, // TX_4X4
@@ -72,7 +72,7 @@ static const uint64_t left_64x64_txform_mask[TX_SIZES] = {
//
// A loopfilter should be applied to every other 4 the row vertically.
static const uint64_t above_64x64_txform_mask[TX_SIZES] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
0xffffffffffffffffULL, // TX_4X4
#endif
0xffffffffffffffffULL, // TX_4X4
@@ -171,7 +171,7 @@ static const uint64_t above_border = 0x000000ff000000ffULL;
// 16 bit masks for uv transform sizes.
static const uint16_t left_64x64_txform_mask_uv[TX_SIZES] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
0xffff, // TX_2X2
#endif
0xffff, // TX_4X4
@@ -184,7 +184,7 @@ static const uint16_t left_64x64_txform_mask_uv[TX_SIZES] = {
};
static const uint16_t above_64x64_txform_mask_uv[TX_SIZES] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
0xffff, // TX_2X2
#endif
0xffff, // TX_4X4
@@ -267,11 +267,14 @@ static const int mode_lf_lut[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // INTRA_MODES
#if CONFIG_ALT_INTRA
0,
-#endif
+#if CONFIG_SMOOTH_HV
+ 0, 0,
+#endif // CONFIG_SMOOTH_HV
+#endif // CONFIG_ALT_INTRA
1, 1, 0, 1, // INTER_MODES (ZEROMV == 0)
#if CONFIG_EXT_INTER
- 1, 1, 1, 1, 1, 1, 1, 1, 0, 1 // INTER_COMPOUND_MODES (ZERO_ZEROMV == 0)
-#endif // CONFIG_EXT_INTER
+ 1, 1, 1, 1, 1, 1, 0, 1 // INTER_COMPOUND_MODES (ZERO_ZEROMV == 0)
+#endif // CONFIG_EXT_INTER
};
static void update_sharpness(loop_filter_info_n *lfi, int sharpness_lvl) {
@@ -345,8 +348,6 @@ static uint8_t get_filter_level(const loop_filter_info_n *lfi_n,
}
#endif
-#define NELEMENTS(x) (sizeof((x)) / sizeof((x)[0]))
-
void av1_loop_filter_init(AV1_COMMON *cm) {
assert(MB_MODE_COUNT == NELEMENTS(mode_lf_lut));
loop_filter_info_n *lfi = &cm->lf_info;
@@ -1362,9 +1363,10 @@ typedef struct {
// the non420 case).
// Note: 'row_masks_ptr' and/or 'col_masks_ptr' can be passed NULL.
static void get_filter_level_and_masks_non420(
- AV1_COMMON *const cm, const struct macroblockd_plane *const plane,
+ AV1_COMMON *const cm, const struct macroblockd_plane *const plane, int pl,
MODE_INFO **mib, int mi_row, int mi_col, int idx_r, uint8_t *const lfl_r,
- unsigned int *const mask_4x4_int_r, FilterMasks *const row_masks_ptr,
+ unsigned int *const mask_4x4_int_r_ptr,
+ unsigned int *const mask_4x4_int_c_ptr, FilterMasks *const row_masks_ptr,
FilterMasks *const col_masks_ptr) {
const int ss_x = plane->subsampling_x;
const int ss_y = plane->subsampling_y;
@@ -1372,7 +1374,7 @@ static void get_filter_level_and_masks_non420(
FilterMasks row_masks, col_masks;
memset(&row_masks, 0, sizeof(row_masks));
memset(&col_masks, 0, sizeof(col_masks));
- *mask_4x4_int_r = 0;
+ unsigned int mask_4x4_int_r = 0, mask_4x4_int_c = 0;
const int r = idx_r >> mi_height_log2_lookup[BLOCK_8X8];
// Determine the vertical edges that need filtering
@@ -1398,10 +1400,6 @@ static void get_filter_level_and_masks_non420(
(num_4x4_blocks_high_lookup[sb_type] > 1) ? !blk_row : 1;
const int skip_this_r = skip_this && !block_edge_above;
-#if CONFIG_VAR_TX
- const TX_SIZE mb_tx_size = mbmi->inter_tx_size[blk_row][blk_col];
-#endif
-
TX_SIZE tx_size = (plane->plane_type == PLANE_TYPE_UV)
? get_uv_tx_size(mbmi, plane)
: mbmi->tx_size;
@@ -1411,9 +1409,6 @@ static void get_filter_level_and_masks_non420(
const int skip_border_4x4_r =
ss_y && mi_row + idx_r >= cm->mi_rows - mi_size_high[BLOCK_8X8];
- TX_SIZE tx_size_c = txsize_horz_map[tx_size];
- TX_SIZE tx_size_r = txsize_vert_map[tx_size];
-
int tx_size_mask = 0;
const int c_step = (c >> ss_x);
const int r_step = (r >> ss_y);
@@ -1421,8 +1416,15 @@ static void get_filter_level_and_masks_non420(
#if CONFIG_VAR_TX
if (is_inter_block(mbmi) && !mbmi->skip) {
+ const int tx_row_idx =
+ (blk_row * mi_size_high[BLOCK_8X8] << TX_UNIT_HIGH_LOG2) >> 1;
+ const int tx_col_idx =
+ (blk_col * mi_size_wide[BLOCK_8X8] << TX_UNIT_WIDE_LOG2) >> 1;
+ const BLOCK_SIZE bsize =
+ AOMMAX(BLOCK_4X4, get_plane_block_size(mbmi->sb_type, plane));
+ const TX_SIZE mb_tx_size = mbmi->inter_tx_size[tx_row_idx][tx_col_idx];
tx_size = (plane->plane_type == PLANE_TYPE_UV)
- ? uv_txsize_lookup[sb_type][mb_tx_size][ss_x][ss_y]
+ ? uv_txsize_lookup[bsize][mb_tx_size][0][0]
: mb_tx_size;
}
#endif
@@ -1435,12 +1437,29 @@ static void get_filter_level_and_masks_non420(
#endif
#if CONFIG_VAR_TX
- tx_size_r = AOMMIN(tx_size, cm->above_txfm_context[mi_col + c]);
- tx_size_c =
- AOMMIN(tx_size, cm->left_txfm_context[(mi_row + r) & MAX_MIB_MASK]);
-
- cm->above_txfm_context[mi_col + c] = tx_size;
- cm->left_txfm_context[(mi_row + r) & MAX_MIB_MASK] = tx_size;
+ TX_SIZE tx_size_r, tx_size_c;
+
+ const int tx_wide =
+ AOMMIN(tx_size_wide[tx_size],
+ tx_size_wide[cm->top_txfm_context[pl][(mi_col + idx_c)
+ << TX_UNIT_WIDE_LOG2]]);
+ const int tx_high = AOMMIN(
+ tx_size_high[tx_size],
+ tx_size_high[cm->left_txfm_context[pl][((mi_row + idx_r) & MAX_MIB_MASK)
+ << TX_UNIT_HIGH_LOG2]]);
+
+ tx_size_c = get_sqr_tx_size(tx_wide);
+ tx_size_r = get_sqr_tx_size(tx_high);
+
+ memset(cm->top_txfm_context[pl] + ((mi_col + idx_c) << TX_UNIT_WIDE_LOG2),
+ tx_size, mi_size_wide[BLOCK_8X8] << TX_UNIT_WIDE_LOG2);
+ memset(cm->left_txfm_context[pl] +
+ (((mi_row + idx_r) & MAX_MIB_MASK) << TX_UNIT_HIGH_LOG2),
+ tx_size, mi_size_high[BLOCK_8X8] << TX_UNIT_HIGH_LOG2);
+#else
+ TX_SIZE tx_size_c = txsize_horz_map[tx_size];
+ TX_SIZE tx_size_r = txsize_vert_map[tx_size];
+ (void)pl;
#endif // CONFIG_VAR_TX
if (tx_size_c == TX_32X32)
@@ -1477,7 +1496,7 @@ static void get_filter_level_and_masks_non420(
if (!skip_this && tx_size_c < TX_8X8 && !skip_border_4x4_c &&
(c_step & tx_size_mask) == 0)
- *mask_4x4_int_r |= col_mask;
+ mask_4x4_int_c |= col_mask;
}
if (tx_size_r == TX_32X32)
@@ -1511,20 +1530,22 @@ static void get_filter_level_and_masks_non420(
row_masks.m4x4 |= col_mask;
}
- if (!skip_this && tx_size_r < TX_8X8 && !skip_border_4x4_c &&
+ if (!skip_this && tx_size_r < TX_8X8 && !skip_border_4x4_r &&
((r >> ss_y) & tx_size_mask) == 0)
- *mask_4x4_int_r |= col_mask;
+ mask_4x4_int_r |= col_mask;
}
}
if (row_masks_ptr) *row_masks_ptr = row_masks;
if (col_masks_ptr) *col_masks_ptr = col_masks;
+ if (mask_4x4_int_c_ptr) *mask_4x4_int_c_ptr = mask_4x4_int_c;
+ if (mask_4x4_int_r_ptr) *mask_4x4_int_r_ptr = mask_4x4_int_r;
}
void av1_filter_block_plane_non420_ver(AV1_COMMON *const cm,
struct macroblockd_plane *plane,
- MODE_INFO **mib, int mi_row,
- int mi_col) {
+ MODE_INFO **mib, int mi_row, int mi_col,
+ int pl) {
const int ss_y = plane->subsampling_y;
const int row_step = mi_size_high[BLOCK_8X8] << ss_y;
struct buf_2d *const dst = &plane->dst;
@@ -1537,8 +1558,8 @@ void av1_filter_block_plane_non420_ver(AV1_COMMON *const cm,
unsigned int mask_4x4_int;
FilterMasks col_masks;
const int r = idx_r >> mi_height_log2_lookup[BLOCK_8X8];
- get_filter_level_and_masks_non420(cm, plane, mib, mi_row, mi_col, idx_r,
- &lfl[r][0], &mask_4x4_int, NULL,
+ get_filter_level_and_masks_non420(cm, plane, pl, mib, mi_row, mi_col, idx_r,
+ &lfl[r][0], NULL, &mask_4x4_int, NULL,
&col_masks);
// Disable filtering on the leftmost column or tile boundary
@@ -1572,8 +1593,8 @@ void av1_filter_block_plane_non420_ver(AV1_COMMON *const cm,
void av1_filter_block_plane_non420_hor(AV1_COMMON *const cm,
struct macroblockd_plane *plane,
- MODE_INFO **mib, int mi_row,
- int mi_col) {
+ MODE_INFO **mib, int mi_row, int mi_col,
+ int pl) {
const int ss_y = plane->subsampling_y;
const int row_step = mi_size_high[BLOCK_8X8] << ss_y;
struct buf_2d *const dst = &plane->dst;
@@ -1585,16 +1606,13 @@ void av1_filter_block_plane_non420_hor(AV1_COMMON *const cm,
for (idx_r = 0; idx_r < cm->mib_size && mi_row + idx_r < cm->mi_rows;
idx_r += row_step) {
const int r = idx_r >> mi_height_log2_lookup[BLOCK_8X8];
- get_filter_level_and_masks_non420(cm, plane, mib, mi_row, mi_col, idx_r,
- &lfl[r][0], mask_4x4_int + r,
+ get_filter_level_and_masks_non420(cm, plane, pl, mib, mi_row, mi_col, idx_r,
+ &lfl[r][0], mask_4x4_int + r, NULL,
row_masks_array + r, NULL);
}
for (idx_r = 0; idx_r < cm->mib_size && mi_row + idx_r < cm->mi_rows;
idx_r += row_step) {
- const int skip_border_4x4_r =
- ss_y && mi_row + idx_r >= cm->mi_rows - mi_size_wide[BLOCK_8X8];
const int r = idx_r >> mi_width_log2_lookup[BLOCK_8X8];
- const unsigned int mask_4x4_int_r = skip_border_4x4_r ? 0 : mask_4x4_int[r];
FilterMasks row_masks;
#if CONFIG_LOOPFILTERING_ACROSS_TILES
@@ -1615,12 +1633,12 @@ void av1_filter_block_plane_non420_hor(AV1_COMMON *const cm,
if (cm->use_highbitdepth)
highbd_filter_selectively_horiz(
CONVERT_TO_SHORTPTR(dst->buf), dst->stride, row_masks.m16x16,
- row_masks.m8x8, row_masks.m4x4, mask_4x4_int_r, &cm->lf_info,
+ row_masks.m8x8, row_masks.m4x4, mask_4x4_int[r], &cm->lf_info,
&lfl[r][0], (int)cm->bit_depth);
else
#endif // CONFIG_HIGHBITDEPTH
filter_selectively_horiz(dst->buf, dst->stride, row_masks.m16x16,
- row_masks.m8x8, row_masks.m4x4, mask_4x4_int_r,
+ row_masks.m8x8, row_masks.m4x4, mask_4x4_int[r],
&cm->lf_info, &lfl[r][0]);
dst->buf += 8 * dst->stride;
}
@@ -1839,8 +1857,6 @@ void av1_filter_block_plane_ss11_hor(AV1_COMMON *const cm,
dst->buf = dst0;
}
-#if !(CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES || \
- CONFIG_CB4X4)
#if CONFIG_PARALLEL_DEBLOCKING
typedef enum EDGE_DIR { VERT_EDGE = 0, HORZ_EDGE = 1, NUM_EDGE_DIRS } EDGE_DIR;
static const uint32_t av1_prediction_masks[NUM_EDGE_DIRS][BLOCK_SIZES] = {
@@ -1900,7 +1916,7 @@ static const uint32_t av1_prediction_masks[NUM_EDGE_DIRS][BLOCK_SIZES] = {
static const uint32_t av1_transform_masks[NUM_EDGE_DIRS][TX_SIZES_ALL] = {
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
2 - 1, // TX_2X2
#endif
4 - 1, // TX_4X4
@@ -1922,7 +1938,7 @@ static const uint32_t av1_transform_masks[NUM_EDGE_DIRS][TX_SIZES_ALL] = {
32 - 1 // TX_32X8
},
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
2 - 1, // TX_2X2
#endif
4 - 1, // TX_4X4
@@ -1992,10 +2008,17 @@ static void set_lpf_parameters(AV1_DEBLOCKING_PARAMETERS *const pParams,
// not sure if changes are required.
assert(0 && "Not yet updated");
#endif // CONFIG_EXT_PARTITION
+
{
const TX_SIZE ts =
av1_get_transform_size(ppCurr[0], edgeDir, scaleHorz, scaleVert);
+#if CONFIG_EXT_DELTA_Q
+ const uint32_t currLevel =
+ get_filter_level(cm, &cm->lf_info, &ppCurr[0]->mbmi);
+#else
const uint32_t currLevel = get_filter_level(&cm->lf_info, &ppCurr[0]->mbmi);
+#endif // CONFIG_EXT_DELTA_Q
+
const int currSkipped =
ppCurr[0]->mbmi.skip && is_inter_block(&ppCurr[0]->mbmi);
const uint32_t coord = (VERT_EDGE == edgeDir) ? (x) : (y);
@@ -2016,7 +2039,13 @@ static void set_lpf_parameters(AV1_DEBLOCKING_PARAMETERS *const pParams,
const MODE_INFO *const pPrev = *(ppCurr - modeStep);
const TX_SIZE pvTs =
av1_get_transform_size(pPrev, edgeDir, scaleHorz, scaleVert);
+#if CONFIG_EXT_DELTA_Q
+ const uint32_t pvLvl =
+ get_filter_level(cm, &cm->lf_info, &pPrev->mbmi);
+#else
const uint32_t pvLvl = get_filter_level(&cm->lf_info, &pPrev->mbmi);
+#endif // CONFIG_EXT_DELTA_Q
+
const int pvSkip = pPrev->mbmi.skip && is_inter_block(&pPrev->mbmi);
const int32_t puEdge =
(coord &
@@ -2028,7 +2057,7 @@ static void set_lpf_parameters(AV1_DEBLOCKING_PARAMETERS *const pParams,
// if the current and the previous blocks are skipped,
// deblock the edge if the edge belongs to a PU's edge only.
if ((currLevel || pvLvl) && (!pvSkip || !currSkipped || puEdge)) {
-#if CONFIG_PARALLEL_DEBLOCKING_15TAP || CONFIG_PARALLEL_DEBLOCKING_15TAPLUMAONLY
+#if CONFIG_PARALLEL_DEBLOCKING_15TAP || PARALLEL_DEBLOCKING_15TAPLUMAONLY
const TX_SIZE minTs = AOMMIN(ts, pvTs);
if (TX_4X4 >= minTs) {
pParams->filterLength = 4;
@@ -2036,7 +2065,7 @@ static void set_lpf_parameters(AV1_DEBLOCKING_PARAMETERS *const pParams,
pParams->filterLength = 8;
} else {
pParams->filterLength = 16;
-#if CONFIG_PARALLEL_DEBLOCKING_15TAPLUMAONLY
+#if PARALLEL_DEBLOCKING_15TAPLUMAONLY
// No wide filtering for chroma plane
if (scaleHorz || scaleVert) {
pParams->filterLength = 8;
@@ -2046,7 +2075,7 @@ static void set_lpf_parameters(AV1_DEBLOCKING_PARAMETERS *const pParams,
#else
pParams->filterLength = (TX_4X4 >= AOMMIN(ts, pvTs)) ? (4) : (8);
-#endif // CONFIG_PARALLEL_DEBLOCKING_15TAP
+#endif // CONFIG_PARALLEL_DEBLOCKING_15TAP || PARALLEL_DEBLOCKING_15TAPLUMAONLY
// update the level if the current block is skipped,
// but the previous one is not
@@ -2054,10 +2083,14 @@ static void set_lpf_parameters(AV1_DEBLOCKING_PARAMETERS *const pParams,
}
}
}
+
+#if !CONFIG_CB4X4
// prepare internal edge parameters
if (currLevel && !currSkipped) {
pParams->filterLengthInternal = (TX_4X4 >= ts) ? (4) : (0);
}
+#endif
+
// prepare common parameters
if (pParams->filterLength || pParams->filterLengthInternal) {
const loop_filter_thresh *const limits = cm->lf_info.lfthr + level;
@@ -2075,15 +2108,21 @@ static void av1_filter_block_plane_vert(const AV1_COMMON *const cm,
const ptrdiff_t modeStride,
const uint32_t cuX,
const uint32_t cuY) {
+ const int col_step = MI_SIZE >> MI_SIZE_LOG2;
+ const int row_step = MI_SIZE >> MI_SIZE_LOG2;
const uint32_t scaleHorz = pPlane->subsampling_x;
const uint32_t scaleVert = pPlane->subsampling_y;
const uint32_t width = pPlane->dst.width;
const uint32_t height = pPlane->dst.height;
uint8_t *const pDst = pPlane->dst.buf;
const int dstStride = pPlane->dst.stride;
- for (int y = 0; y < (MAX_MIB_SIZE >> scaleVert); y += 1) {
+ for (int y = 0; y < (MAX_MIB_SIZE >> scaleVert); y += row_step) {
uint8_t *p = pDst + y * MI_SIZE * dstStride;
- for (int x = 0; x < (MAX_MIB_SIZE >> scaleHorz); x += 1) {
+ for (int x = 0; x < (MAX_MIB_SIZE >> scaleHorz); x += col_step) {
+ // inner loop always filter vertical edges in a MI block. If MI size
+ // is 8x8, it will filter the vertical edge aligned with a 8x8 block.
+ // If 4x4 trasnform is used, it will then filter the internal edge
+ // aligned with a 4x4 block
const MODE_INFO **const pCurr =
ppModeInfo + (y << scaleVert) * modeStride + (x << scaleHorz);
AV1_DEBLOCKING_PARAMETERS params;
@@ -2094,31 +2133,59 @@ static void av1_filter_block_plane_vert(const AV1_COMMON *const cm,
switch (params.filterLength) {
// apply 4-tap filtering
case 4:
- aom_lpf_vertical_4(p, dstStride, params.mblim, params.lim,
- params.hev_thr);
+#if CONFIG_HIGHBITDEPTH
+ if (cm->use_highbitdepth)
+ aom_highbd_lpf_vertical_4_c(CONVERT_TO_SHORTPTR(p), dstStride,
+ params.mblim, params.lim,
+ params.hev_thr, cm->bit_depth);
+ else
+#endif // CONFIG_HIGHBITDEPTH
+ aom_lpf_vertical_4_c(p, dstStride, params.mblim, params.lim,
+ params.hev_thr);
break;
// apply 8-tap filtering
case 8:
- aom_lpf_vertical_8(p, dstStride, params.mblim, params.lim,
- params.hev_thr);
+#if CONFIG_HIGHBITDEPTH
+ if (cm->use_highbitdepth)
+ aom_highbd_lpf_vertical_8_c(CONVERT_TO_SHORTPTR(p), dstStride,
+ params.mblim, params.lim,
+ params.hev_thr, cm->bit_depth);
+ else
+#endif // CONFIG_HIGHBITDEPTH
+ aom_lpf_vertical_8_c(p, dstStride, params.mblim, params.lim,
+ params.hev_thr);
break;
-#if CONFIG_PARALLEL_DEBLOCKING_15TAP || CONFIG_PARALLEL_DEBLOCKING_15TAPLUMAONLY
+#if CONFIG_PARALLEL_DEBLOCKING_15TAP || PARALLEL_DEBLOCKING_15TAPLUMAONLY
// apply 16-tap filtering
case 16:
- aom_lpf_vertical_16(p, dstStride, params.mblim, params.lim,
- params.hev_thr);
+#if CONFIG_HIGHBITDEPTH
+ if (cm->use_highbitdepth)
+ aom_highbd_lpf_vertical_16_c(CONVERT_TO_SHORTPTR(p), dstStride,
+ params.mblim, params.lim,
+ params.hev_thr, cm->bit_depth);
+ else
+#endif // CONFIG_HIGHBITDEPTH
+ aom_lpf_vertical_16_c(p, dstStride, params.mblim, params.lim,
+ params.hev_thr);
break;
-#endif // CONFIG_PARALLEL_DEBLOCKING_15TAP
+#endif // CONFIG_PARALLEL_DEBLOCKING_15TAP || PARALLEL_DEBLOCKING_15TAPLUMAONLY
// no filtering
default: break;
}
// process the internal edge
if (params.filterLengthInternal) {
- aom_lpf_vertical_4(p + 4, dstStride, params.mblim, params.lim,
- params.hev_thr);
+#if CONFIG_HIGHBITDEPTH
+ if (cm->use_highbitdepth)
+ aom_highbd_lpf_vertical_4_c(CONVERT_TO_SHORTPTR(p + 4), dstStride,
+ params.mblim, params.lim, params.hev_thr,
+ cm->bit_depth);
+ else
+#endif // CONFIG_HIGHBITDEPTH
+ aom_lpf_vertical_4_c(p + 4, dstStride, params.mblim, params.lim,
+ params.hev_thr);
}
// advance the destination pointer
- p += 8;
+ p += MI_SIZE;
}
}
}
@@ -2129,15 +2196,21 @@ static void av1_filter_block_plane_horz(const AV1_COMMON *const cm,
const ptrdiff_t modeStride,
const uint32_t cuX,
const uint32_t cuY) {
+ const int col_step = MI_SIZE >> MI_SIZE_LOG2;
+ const int row_step = MI_SIZE >> MI_SIZE_LOG2;
const uint32_t scaleHorz = pPlane->subsampling_x;
const uint32_t scaleVert = pPlane->subsampling_y;
const uint32_t width = pPlane->dst.width;
const uint32_t height = pPlane->dst.height;
uint8_t *const pDst = pPlane->dst.buf;
const int dstStride = pPlane->dst.stride;
- for (int y = 0; y < (MAX_MIB_SIZE >> scaleVert); y += 1) {
+ for (int y = 0; y < (MAX_MIB_SIZE >> scaleVert); y += row_step) {
uint8_t *p = pDst + y * MI_SIZE * dstStride;
- for (int x = 0; x < (MAX_MIB_SIZE >> scaleHorz); x += 1) {
+ for (int x = 0; x < (MAX_MIB_SIZE >> scaleHorz); x += col_step) {
+ // inner loop always filter vertical edges in a MI block. If MI size
+ // is 8x8, it will first filter the vertical edge aligned with a 8x8
+ // block. If 4x4 trasnform is used, it will then filter the internal
+ // edge aligned with a 4x4 block
const MODE_INFO **const pCurr =
ppModeInfo + (y << scaleVert) * modeStride + (x << scaleHorz);
AV1_DEBLOCKING_PARAMETERS params;
@@ -2148,52 +2221,84 @@ static void av1_filter_block_plane_horz(const AV1_COMMON *const cm,
switch (params.filterLength) {
// apply 4-tap filtering
case 4:
- aom_lpf_horizontal_4(p, dstStride, params.mblim, params.lim,
- params.hev_thr);
+#if CONFIG_HIGHBITDEPTH
+ if (cm->use_highbitdepth)
+ aom_highbd_lpf_horizontal_4_c(CONVERT_TO_SHORTPTR(p), dstStride,
+ params.mblim, params.lim,
+ params.hev_thr, cm->bit_depth);
+ else
+#endif // CONFIG_HIGHBITDEPTH
+ aom_lpf_horizontal_4_c(p, dstStride, params.mblim, params.lim,
+ params.hev_thr);
break;
// apply 8-tap filtering
case 8:
- aom_lpf_horizontal_8(p, dstStride, params.mblim, params.lim,
- params.hev_thr);
+#if CONFIG_HIGHBITDEPTH
+ if (cm->use_highbitdepth)
+ aom_highbd_lpf_horizontal_8_c(CONVERT_TO_SHORTPTR(p), dstStride,
+ params.mblim, params.lim,
+ params.hev_thr, cm->bit_depth);
+ else
+#endif // CONFIG_HIGHBITDEPTH
+ aom_lpf_horizontal_8_c(p, dstStride, params.mblim, params.lim,
+ params.hev_thr);
break;
-#if CONFIG_PARALLEL_DEBLOCKING_15TAP || CONFIG_PARALLEL_DEBLOCKING_15TAPLUMAONLY
+#if CONFIG_PARALLEL_DEBLOCKING_15TAP || PARALLEL_DEBLOCKING_15TAPLUMAONLY
// apply 16-tap filtering
case 16:
- aom_lpf_horizontal_edge_16(p, dstStride, params.mblim, params.lim,
- params.hev_thr);
+#if CONFIG_HIGHBITDEPTH
+ if (cm->use_highbitdepth)
+ aom_highbd_lpf_horizontal_edge_16_c(
+ CONVERT_TO_SHORTPTR(p), dstStride, params.mblim, params.lim,
+ params.hev_thr, cm->bit_depth);
+ else
+#endif // CONFIG_HIGHBITDEPTH
+ aom_lpf_horizontal_edge_16_c(p, dstStride, params.mblim, params.lim,
+ params.hev_thr);
break;
-#endif // CONFIG_PARALLEL_DEBLOCKING_15TAP
+#endif // CONFIG_PARALLEL_DEBLOCKING_15TAP || PARALLEL_DEBLOCKING_15TAPLUMAONLY
// no filtering
default: break;
}
// process the internal edge
if (params.filterLengthInternal) {
- aom_lpf_horizontal_4(p + 4 * dstStride, dstStride, params.mblim,
- params.lim, params.hev_thr);
+#if CONFIG_HIGHBITDEPTH
+ if (cm->use_highbitdepth)
+ aom_highbd_lpf_horizontal_4_c(CONVERT_TO_SHORTPTR(p + 4 * dstStride),
+ dstStride, params.mblim, params.lim,
+ params.hev_thr, cm->bit_depth);
+ else
+#endif // CONFIG_HIGHBITDEPTH
+ aom_lpf_horizontal_4_c(p + 4 * dstStride, dstStride, params.mblim,
+ params.lim, params.hev_thr);
}
// advance the destination pointer
- p += 8;
+ p += MI_SIZE;
}
}
}
#endif // CONFIG_PARALLEL_DEBLOCKING
-#endif
void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
struct macroblockd_plane planes[MAX_MB_PLANE],
int start, int stop, int y_only) {
-#if CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES || \
- CONFIG_CB4X4
const int num_planes = y_only ? 1 : MAX_MB_PLANE;
int mi_row, mi_col;
+#if CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES || \
+ CONFIG_CB4X4
+
+#if !CONFIG_PARALLEL_DEBLOCKING
#if CONFIG_VAR_TX
- memset(cm->above_txfm_context, TX_SIZES, cm->mi_cols);
+ for (int i = 0; i < MAX_MB_PLANE; ++i)
+ memset(cm->top_txfm_context[i], TX_32X32, cm->mi_cols << TX_UNIT_WIDE_LOG2);
#endif // CONFIG_VAR_TX
for (mi_row = start; mi_row < stop; mi_row += cm->mib_size) {
MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
#if CONFIG_VAR_TX
- memset(cm->left_txfm_context, TX_SIZES, MAX_MIB_SIZE);
+ for (int i = 0; i < MAX_MB_PLANE; ++i)
+ memset(cm->left_txfm_context[i], TX_32X32, MAX_MIB_SIZE
+ << TX_UNIT_WIDE_LOG2);
#endif // CONFIG_VAR_TX
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += cm->mib_size) {
int plane;
@@ -2202,33 +2307,58 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
for (plane = 0; plane < num_planes; ++plane) {
av1_filter_block_plane_non420_ver(cm, &planes[plane], mi + mi_col,
- mi_row, mi_col);
+ mi_row, mi_col, plane);
av1_filter_block_plane_non420_hor(cm, &planes[plane], mi + mi_col,
- mi_row, mi_col);
+ mi_row, mi_col, plane);
}
}
}
+#else
+
+#if CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES
+ assert(0 && "Not yet updated. ToDo as next steps");
+#endif // CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES
+
+ for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) {
+ MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
+ for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) {
+ av1_setup_dst_planes(planes, cm->sb_size, frame_buffer, mi_row, mi_col);
+ // filter all vertical edges in every 64x64 super block
+ for (int planeIdx = 0; planeIdx < num_planes; planeIdx += 1) {
+ const int32_t scaleHorz = planes[planeIdx].subsampling_x;
+ const int32_t scaleVert = planes[planeIdx].subsampling_y;
+ av1_filter_block_plane_vert(
+ cm, planes + planeIdx, (const MODE_INFO **)(mi + mi_col),
+ cm->mi_stride, (mi_col * MI_SIZE) >> scaleHorz,
+ (mi_row * MI_SIZE) >> scaleVert);
+ }
+ }
+ }
+ for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) {
+ MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
+ for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) {
+ av1_setup_dst_planes(planes, cm->sb_size, frame_buffer, mi_row, mi_col);
+ // filter all horizontal edges in every 64x64 super block
+ for (int planeIdx = 0; planeIdx < num_planes; planeIdx += 1) {
+ const int32_t scaleHorz = planes[planeIdx].subsampling_x;
+ const int32_t scaleVert = planes[planeIdx].subsampling_y;
+ av1_filter_block_plane_horz(
+ cm, planes + planeIdx, (const MODE_INFO **)(mi + mi_col),
+ cm->mi_stride, (mi_col * MI_SIZE) >> scaleHorz,
+ (mi_row * MI_SIZE) >> scaleVert);
+ }
+ }
+ }
+#endif // CONFIG_PARALLEL_DEBLOCKING
+
#else // CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES
- const int num_planes = y_only ? 1 : MAX_MB_PLANE;
- int mi_row, mi_col;
-#if !CONFIG_PARALLEL_DEBLOCKING
- enum lf_path path;
- LOOP_FILTER_MASK lfm;
- if (y_only)
- path = LF_PATH_444;
- else if (planes[1].subsampling_y == 1 && planes[1].subsampling_x == 1)
- path = LF_PATH_420;
- else if (planes[1].subsampling_y == 0 && planes[1].subsampling_x == 0)
- path = LF_PATH_444;
- else
- path = LF_PATH_SLOW;
-#endif
#if CONFIG_PARALLEL_DEBLOCKING
for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) {
MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) {
av1_setup_dst_planes(planes, cm->sb_size, frame_buffer, mi_row, mi_col);
+ // filter all vertical edges in every 64x64 super block
for (int planeIdx = 0; planeIdx < num_planes; planeIdx += 1) {
const int32_t scaleHorz = planes[planeIdx].subsampling_x;
const int32_t scaleVert = planes[planeIdx].subsampling_y;
@@ -2243,6 +2373,7 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) {
av1_setup_dst_planes(planes, cm->sb_size, frame_buffer, mi_row, mi_col);
+ // filter all horizontal edges in every 64x64 super block
for (int planeIdx = 0; planeIdx < num_planes; planeIdx += 1) {
const int32_t scaleHorz = planes[planeIdx].subsampling_x;
const int32_t scaleVert = planes[planeIdx].subsampling_y;
@@ -2254,6 +2385,18 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
}
}
#else // CONFIG_PARALLEL_DEBLOCKING
+ enum lf_path path;
+ LOOP_FILTER_MASK lfm;
+
+ if (y_only)
+ path = LF_PATH_444;
+ else if (planes[1].subsampling_y == 1 && planes[1].subsampling_x == 1)
+ path = LF_PATH_420;
+ else if (planes[1].subsampling_y == 0 && planes[1].subsampling_x == 0)
+ path = LF_PATH_444;
+ else
+ path = LF_PATH_SLOW;
+
for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) {
MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) {
@@ -2278,9 +2421,9 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
break;
case LF_PATH_SLOW:
av1_filter_block_plane_non420_ver(cm, &planes[plane], mi + mi_col,
- mi_row, mi_col);
+ mi_row, mi_col, plane);
av1_filter_block_plane_non420_hor(cm, &planes[plane], mi + mi_col,
- mi_row, mi_col);
+ mi_row, mi_col, plane);
break;
}
diff --git a/third_party/aom/av1/common/av1_loopfilter.h b/third_party/aom/av1/common/av1_loopfilter.h
index 8ac5d99e6..424df248f 100644
--- a/third_party/aom/av1/common/av1_loopfilter.h
+++ b/third_party/aom/av1/common/av1_loopfilter.h
@@ -115,11 +115,11 @@ void av1_filter_block_plane_ss11_hor(struct AV1Common *const cm,
void av1_filter_block_plane_non420_ver(struct AV1Common *const cm,
struct macroblockd_plane *plane,
MODE_INFO **mi_8x8, int mi_row,
- int mi_col);
+ int mi_col, int pl);
void av1_filter_block_plane_non420_hor(struct AV1Common *const cm,
struct macroblockd_plane *plane,
MODE_INFO **mi_8x8, int mi_row,
- int mi_col);
+ int mi_col, int pl);
void av1_loop_filter_init(struct AV1Common *cm);
diff --git a/third_party/aom/av1/common/av1_rtcd_defs.pl b/third_party/aom/av1/common/av1_rtcd_defs.pl
index 1dca10c52..19f4204cf 100755
--- a/third_party/aom/av1/common/av1_rtcd_defs.pl
+++ b/third_party/aom/av1/common/av1_rtcd_defs.pl
@@ -312,6 +312,7 @@ if (aom_config("CONFIG_AOM_QM") eq "yes") {
add_proto qw/int64_t av1_block_error/, "const tran_low_t *coeff, const tran_low_t *dqcoeff, intptr_t block_size, int64_t *ssz";
add_proto qw/void av1_quantize_fp/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
+ specialize qw/av1_quantize_fp sse2/;
add_proto qw/void av1_quantize_fp_32x32/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
@@ -399,6 +400,13 @@ if (aom_config("CONFIG_HIGHBITDEPTH") ne "yes") {
add_proto qw/void av1_fwd_idtx/, "const int16_t *src_diff, tran_low_t *coeff, int stride, int bs, int tx_type";
+if (aom_config("CONFIG_DPCM_INTRA") eq "yes") {
+ @sizes = (4, 8, 16, 32);
+ foreach $size (@sizes) {
+ add_proto "void", "av1_dpcm_ft$size", "const int16_t *input, int stride, TX_TYPE_1D tx_type, tran_low_t *output";
+ }
+}
+
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
#fwd txfm
add_proto qw/void av1_fwd_txfm2d_4x4/, "const int16_t *input, int32_t *output, int stride, int tx_type, int bd";
@@ -608,15 +616,21 @@ if (aom_config("CONFIG_PVQ") eq "yes") {
if ((aom_config("CONFIG_WARPED_MOTION") eq "yes") ||
(aom_config("CONFIG_GLOBAL_MOTION") eq "yes")) {
- add_proto qw/void av1_warp_affine/, "int32_t *mat, uint8_t *ref, int width, int height, int stride, uint8_t *pred, int p_col, int p_row, int p_width, int p_height, int p_stride, int subsampling_x, int subsampling_y, int ref_frm, int16_t alpha, int16_t beta, int16_t gamma, int16_t delta";
- specialize qw/av1_warp_affine sse2/;
+ add_proto qw/void av1_warp_affine/, "const int32_t *mat, const uint8_t *ref, int width, int height, int stride, uint8_t *pred, int p_col, int p_row, int p_width, int p_height, int p_stride, int subsampling_x, int subsampling_y, int comp_avg, int16_t alpha, int16_t beta, int16_t gamma, int16_t delta";
+ specialize qw/av1_warp_affine sse2 ssse3/;
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
- add_proto qw/void av1_highbd_warp_affine/, "int32_t *mat, uint16_t *ref, int width, int height, int stride, uint16_t *pred, int p_col, int p_row, int p_width, int p_height, int p_stride, int subsampling_x, int subsampling_y, int bd, int ref_frm, int16_t alpha, int16_t beta, int16_t gamma, int16_t delta";
+ add_proto qw/void av1_highbd_warp_affine/, "const int32_t *mat, const uint16_t *ref, int width, int height, int stride, uint16_t *pred, int p_col, int p_row, int p_width, int p_height, int p_stride, int subsampling_x, int subsampling_y, int bd, int comp_avg, int16_t alpha, int16_t beta, int16_t gamma, int16_t delta";
specialize qw/av1_highbd_warp_affine ssse3/;
}
}
+if (aom_config("CONFIG_GLOBAL_MOTION") eq "yes" &&
+ aom_config("CONFIG_AV1_ENCODER") eq "yes") {
+ add_proto qw/double compute_cross_correlation/, "unsigned char *im1, int stride1, int x1, int y1, unsigned char *im2, int stride2, int x2, int y2";
+ specialize qw/compute_cross_correlation sse4_1/;
+}
+
# LOOP_RESTORATION functions
if (aom_config("CONFIG_LOOP_RESTORATION") eq "yes") {
diff --git a/third_party/aom/av1/common/av1_txfm.h b/third_party/aom/av1/common/av1_txfm.h
index 6987317ae..b341cb73d 100644
--- a/third_party/aom/av1/common/av1_txfm.h
+++ b/third_party/aom/av1/common/av1_txfm.h
@@ -24,7 +24,7 @@ static const int cos_bit_min = 10;
static const int cos_bit_max = 16;
// cospi_arr[i][j] = (int)round(cos(M_PI*j/128) * (1<<(cos_bit_min+i)));
-static const int32_t cospi_arr[7][64] = {
+static const int32_t cospi_arr_data[7][64] = {
{ 1024, 1024, 1023, 1021, 1019, 1016, 1013, 1009, 1004, 999, 993, 987, 980,
972, 964, 955, 946, 936, 926, 915, 903, 891, 878, 865, 851, 837,
822, 807, 792, 775, 759, 742, 724, 706, 688, 669, 650, 630, 610,
@@ -68,6 +68,10 @@ static const int32_t cospi_arr[7][64] = {
14359, 12785, 11204, 9616, 8022, 6424, 4821, 3216, 1608 }
};
+static INLINE const int32_t *cospi_arr(int n) {
+ return cospi_arr_data[n - cos_bit_min];
+}
+
static INLINE int32_t round_shift(int32_t value, int bit) {
assert(bit >= 1);
return (value + (1 << (bit - 1))) >> bit;
@@ -139,26 +143,27 @@ typedef enum TXFM_TYPE {
TXFM_TYPE_ADST8,
TXFM_TYPE_ADST16,
TXFM_TYPE_ADST32,
+ TXFM_TYPE_IDENTITY4,
+ TXFM_TYPE_IDENTITY8,
+ TXFM_TYPE_IDENTITY16,
+ TXFM_TYPE_IDENTITY32,
} TXFM_TYPE;
-typedef struct TXFM_2D_CFG {
+typedef struct TXFM_1D_CFG {
const int txfm_size;
- const int stage_num_col;
- const int stage_num_row;
+ const int stage_num;
const int8_t *shift;
- const int8_t *stage_range_col;
- const int8_t *stage_range_row;
- const int8_t *cos_bit_col;
- const int8_t *cos_bit_row;
- const TXFM_TYPE txfm_type_col;
- const TXFM_TYPE txfm_type_row;
-} TXFM_2D_CFG;
+ const int8_t *stage_range;
+ const int8_t *cos_bit;
+ const TXFM_TYPE txfm_type;
+} TXFM_1D_CFG;
typedef struct TXFM_2D_FLIP_CFG {
int ud_flip; // flip upside down
int lr_flip; // flip left to right
- const TXFM_2D_CFG *cfg;
+ const TXFM_1D_CFG *col_cfg;
+ const TXFM_1D_CFG *row_cfg;
} TXFM_2D_FLIP_CFG;
static INLINE void set_flip_cfg(int tx_type, TXFM_2D_FLIP_CFG *cfg) {
@@ -171,11 +176,23 @@ static INLINE void set_flip_cfg(int tx_type, TXFM_2D_FLIP_CFG *cfg) {
cfg->lr_flip = 0;
break;
#if CONFIG_EXT_TX
+ case IDTX:
+ case V_DCT:
+ case H_DCT:
+ case V_ADST:
+ case H_ADST:
+ cfg->ud_flip = 0;
+ cfg->lr_flip = 0;
+ break;
case FLIPADST_DCT:
+ case FLIPADST_ADST:
+ case V_FLIPADST:
cfg->ud_flip = 1;
cfg->lr_flip = 0;
break;
case DCT_FLIPADST:
+ case ADST_FLIPADST:
+ case H_FLIPADST:
cfg->ud_flip = 0;
cfg->lr_flip = 1;
break;
@@ -183,14 +200,6 @@ static INLINE void set_flip_cfg(int tx_type, TXFM_2D_FLIP_CFG *cfg) {
cfg->ud_flip = 1;
cfg->lr_flip = 1;
break;
- case ADST_FLIPADST:
- cfg->ud_flip = 0;
- cfg->lr_flip = 1;
- break;
- case FLIPADST_ADST:
- cfg->ud_flip = 1;
- cfg->lr_flip = 0;
- break;
#endif // CONFIG_EXT_TX
default:
cfg->ud_flip = 0;
diff --git a/third_party/aom/av1/common/blockd.c b/third_party/aom/av1/common/blockd.c
index 4eb6f01ea..5dcd4998b 100644
--- a/third_party/aom/av1/common/blockd.c
+++ b/third_party/aom/av1/common/blockd.c
@@ -179,15 +179,15 @@ void av1_foreach_transformed_block(const MACROBLOCKD *const xd,
#endif
#if CONFIG_DAALA_DIST
-void av1_foreach_8x8_transformed_block_in_plane(
- const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,
+void av1_foreach_8x8_transformed_block_in_yplane(
+ const MACROBLOCKD *const xd, BLOCK_SIZE bsize,
foreach_transformed_block_visitor visit,
foreach_transformed_block_visitor mi_visit, void *arg) {
- const struct macroblockd_plane *const pd = &xd->plane[plane];
+ const struct macroblockd_plane *const pd = &xd->plane[0];
// block and transform sizes, in number of 4x4 blocks log 2 ("*_b")
// 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
// transform size varies per plane, look it up in a common way.
- const TX_SIZE tx_size = get_tx_size(plane, xd);
+ const TX_SIZE tx_size = get_tx_size(0, xd);
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
const uint8_t txw_unit = tx_size_wide_unit[tx_size];
const uint8_t txh_unit = tx_size_high_unit[tx_size];
@@ -197,18 +197,24 @@ void av1_foreach_8x8_transformed_block_in_plane(
// If mb_to_right_edge is < 0 we are in a situation in which
// the current block size extends into the UMV and we won't
// visit the sub blocks that are wholly within the UMV.
- const int max_blocks_wide = max_block_wide(xd, plane_bsize, plane);
- const int max_blocks_high = max_block_high(xd, plane_bsize, plane);
+ const int max_blocks_wide = max_block_wide(xd, plane_bsize, 0);
+ const int max_blocks_high = max_block_high(xd, plane_bsize, 0);
+ const int skip_check_r = tx_size_high[tx_size] == 8 ? 1 : 0;
+ const int skip_check_c = tx_size_wide[tx_size] == 8 ? 1 : 0;
+
+ assert(plane_bsize >= BLOCK_8X8);
+ assert(tx_size == TX_4X4 || tx_size == TX_4X8 || tx_size == TX_8X4);
// Keep track of the row and column of the blocks we use so that we know
// if we are in the unrestricted motion border.
for (r = 0; r < max_blocks_high; r += txh_unit) {
// Skip visiting the sub blocks that are wholly within the UMV.
for (c = 0; c < max_blocks_wide; c += txw_unit) {
- visit(plane, i, r, c, plane_bsize, tx_size, arg);
- // Call whenever each 8x8 block is done
- if ((r & 1) && (c & 1))
- mi_visit(plane, i, r - 1, c - 1, plane_bsize, TX_8X8, arg);
+ visit(0, i, r, c, plane_bsize, tx_size, arg);
+ // Call whenever each 8x8 tx block is done
+ if (((r & txh_unit) || skip_check_r) && ((c & txw_unit) || skip_check_c))
+ mi_visit(0, i, r - (1 - skip_check_r) * txh_unit,
+ c - (1 - skip_check_c) * txw_unit, plane_bsize, tx_size, arg);
i += step;
}
}
@@ -259,6 +265,36 @@ void av1_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
}
#endif
+void av1_reset_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col,
+ BLOCK_SIZE bsize) {
+ int i;
+ int nplanes;
+#if CONFIG_CB4X4
+ int chroma_ref;
+ chroma_ref =
+ is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x,
+ xd->plane[1].subsampling_y);
+ nplanes = 1 + (MAX_MB_PLANE - 1) * chroma_ref;
+#else
+ (void)mi_row;
+ (void)mi_col;
+ nplanes = MAX_MB_PLANE;
+#endif
+ for (i = 0; i < nplanes; i++) {
+ struct macroblockd_plane *const pd = &xd->plane[i];
+#if CONFIG_CHROMA_2X2 || !CONFIG_CB4X4
+ const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
+#else
+ const BLOCK_SIZE plane_bsize =
+ AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
+#endif
+ const int txs_wide = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
+ const int txs_high = block_size_high[plane_bsize] >> tx_size_high_log2[0];
+ memset(pd->above_context, 0, sizeof(ENTROPY_CONTEXT) * txs_wide);
+ memset(pd->left_context, 0, sizeof(ENTROPY_CONTEXT) * txs_high);
+ }
+}
+
void av1_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y) {
int i;
diff --git a/third_party/aom/av1/common/blockd.h b/third_party/aom/av1/common/blockd.h
index 0acab965d..f679a600c 100644
--- a/third_party/aom/av1/common/blockd.h
+++ b/third_party/aom/av1/common/blockd.h
@@ -38,7 +38,11 @@
extern "C" {
#endif
-#define SUB8X8_COMP_REF (!(CONFIG_CB4X4 && CONFIG_CHROMA_2X2))
+#if (CONFIG_CHROMA_SUB8X8 || CONFIG_CHROMA_2X2)
+#define SUB8X8_COMP_REF 0
+#else
+#define SUB8X8_COMP_REF 1
+#endif
#define MAX_MB_PLANE 3
@@ -49,26 +53,20 @@ extern "C" {
// 0: Uniform
// 1: Difference weighted
#define COMPOUND_SEGMENT_TYPE 1
-
-#if COMPOUND_SEGMENT_TYPE == 0
#define MAX_SEG_MASK_BITS 1
+
// SEG_MASK_TYPES should not surpass 1 << MAX_SEG_MASK_BITS
typedef enum {
+#if COMPOUND_SEGMENT_TYPE == 0
UNIFORM_45 = 0,
UNIFORM_45_INV,
- SEG_MASK_TYPES,
-} SEG_MASK_TYPE;
-
#elif COMPOUND_SEGMENT_TYPE == 1
-#define MAX_SEG_MASK_BITS 1
-// SEG_MASK_TYPES should not surpass 1 << MAX_SEG_MASK_BITS
-typedef enum {
- DIFFWTD_42 = 0,
- DIFFWTD_42_INV,
+ DIFFWTD_38 = 0,
+ DIFFWTD_38_INV,
+#endif // COMPOUND_SEGMENT_TYPE
SEG_MASK_TYPES,
} SEG_MASK_TYPE;
-#endif // COMPOUND_SEGMENT_TYPE
#endif // CONFIG_COMPOUND_SEGMENT
#endif // CONFIG_EXT_INTER
@@ -131,7 +129,7 @@ static INLINE int is_inter_compound_mode(PREDICTION_MODE mode) {
}
static INLINE PREDICTION_MODE compound_ref0_mode(PREDICTION_MODE mode) {
- static PREDICTION_MODE lut[MB_MODE_COUNT] = {
+ static PREDICTION_MODE lut[] = {
MB_MODE_COUNT, // DC_PRED
MB_MODE_COUNT, // V_PRED
MB_MODE_COUNT, // H_PRED
@@ -143,6 +141,10 @@ static INLINE PREDICTION_MODE compound_ref0_mode(PREDICTION_MODE mode) {
MB_MODE_COUNT, // D63_PRED
#if CONFIG_ALT_INTRA
MB_MODE_COUNT, // SMOOTH_PRED
+#if CONFIG_SMOOTH_HV
+ MB_MODE_COUNT, // SMOOTH_V_PRED
+ MB_MODE_COUNT, // SMOOTH_H_PRED
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
MB_MODE_COUNT, // TM_PRED
MB_MODE_COUNT, // NEARESTMV
@@ -157,8 +159,6 @@ static INLINE PREDICTION_MODE compound_ref0_mode(PREDICTION_MODE mode) {
NEWMV, // SR_NEW_NEWMV
#endif // CONFIG_COMPOUND_SINGLEREF
NEARESTMV, // NEAREST_NEARESTMV
- NEARESTMV, // NEAREST_NEARMV
- NEARMV, // NEAR_NEARESTMV
NEARMV, // NEAR_NEARMV
NEARESTMV, // NEAREST_NEWMV
NEWMV, // NEW_NEARESTMV
@@ -167,12 +167,13 @@ static INLINE PREDICTION_MODE compound_ref0_mode(PREDICTION_MODE mode) {
ZEROMV, // ZERO_ZEROMV
NEWMV, // NEW_NEWMV
};
+ assert(NELEMENTS(lut) == MB_MODE_COUNT);
assert(is_inter_compound_mode(mode));
return lut[mode];
}
static INLINE PREDICTION_MODE compound_ref1_mode(PREDICTION_MODE mode) {
- static PREDICTION_MODE lut[MB_MODE_COUNT] = {
+ static PREDICTION_MODE lut[] = {
MB_MODE_COUNT, // DC_PRED
MB_MODE_COUNT, // V_PRED
MB_MODE_COUNT, // H_PRED
@@ -184,6 +185,10 @@ static INLINE PREDICTION_MODE compound_ref1_mode(PREDICTION_MODE mode) {
MB_MODE_COUNT, // D63_PRED
#if CONFIG_ALT_INTRA
MB_MODE_COUNT, // SMOOTH_PRED
+#if CONFIG_SMOOTH_HV
+ MB_MODE_COUNT, // SMOOTH_V_PRED
+ MB_MODE_COUNT, // SMOOTH_H_PRED
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
MB_MODE_COUNT, // TM_PRED
MB_MODE_COUNT, // NEARESTMV
@@ -198,8 +203,6 @@ static INLINE PREDICTION_MODE compound_ref1_mode(PREDICTION_MODE mode) {
NEWMV, // SR_NEW_NEWMV
#endif // CONFIG_COMPOUND_SINGLEREF
NEARESTMV, // NEAREST_NEARESTMV
- NEARMV, // NEAREST_NEARMV
- NEARESTMV, // NEAR_NEARESTMV
NEARMV, // NEAR_NEARMV
NEWMV, // NEAREST_NEWMV
NEARESTMV, // NEW_NEARESTMV
@@ -208,13 +211,14 @@ static INLINE PREDICTION_MODE compound_ref1_mode(PREDICTION_MODE mode) {
ZEROMV, // ZERO_ZEROMV
NEWMV, // NEW_NEWMV
};
+ assert(NELEMENTS(lut) == MB_MODE_COUNT);
assert(is_inter_compound_mode(mode));
return lut[mode];
}
static INLINE int have_nearmv_in_inter_mode(PREDICTION_MODE mode) {
- return (mode == NEARMV || mode == NEAR_NEARMV || mode == NEAREST_NEARMV ||
- mode == NEAR_NEARESTMV || mode == NEAR_NEWMV || mode == NEW_NEARMV);
+ return (mode == NEARMV || mode == NEAR_NEARMV || mode == NEAR_NEWMV ||
+ mode == NEW_NEARMV);
}
static INLINE int have_newmv_in_inter_mode(PREDICTION_MODE mode) {
@@ -260,9 +264,7 @@ static INLINE int have_newmv_in_inter_mode(PREDICTION_MODE mode) {
typedef struct {
PREDICTION_MODE as_mode;
int_mv as_mv[2]; // first, second inter predictor motion vectors
-#if CONFIG_REF_MV
int_mv pred_mv[2];
-#endif
#if CONFIG_EXT_INTER
int_mv ref_mv[2];
#endif // CONFIG_EXT_INTER
@@ -274,12 +276,8 @@ typedef int8_t MV_REFERENCE_FRAME;
typedef struct {
// Number of base colors for Y (0) and UV (1)
uint8_t palette_size[2];
-// Value of base colors for Y, U, and V
-#if CONFIG_HIGHBITDEPTH
+ // Value of base colors for Y, U, and V
uint16_t palette_colors[3 * PALETTE_MAX_SIZE];
-#else
- uint8_t palette_colors[3 * PALETTE_MAX_SIZE];
-#endif // CONFIG_HIGHBITDEPTH
// Only used by encoder to store the color index of the top left pixel.
// TODO(huisu): move this to encoder
uint8_t palette_first_color_idx[2];
@@ -312,6 +310,9 @@ typedef struct RD_STATS {
int64_t rdcost;
int64_t sse;
int skip; // sse should equal to dist when skip == 1
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ int64_t dist_y;
+#endif
#if CONFIG_RD_DEBUG
int txb_coeff_cost[MAX_MB_PLANE];
#if CONFIG_VAR_TX
@@ -338,7 +339,7 @@ typedef struct {
#endif // CONFIG_EXT_INTER
// This structure now relates to 8x8 block regions.
-typedef struct {
+typedef struct MB_MODE_INFO {
// Common for both INTER and INTRA blocks
BLOCK_SIZE sb_type;
PREDICTION_MODE mode;
@@ -391,8 +392,10 @@ typedef struct {
#endif // CONFIG_EXT_INTRA
#if CONFIG_EXT_INTER
+#if CONFIG_INTERINTRA
// interintra members
INTERINTRA_MODE interintra_mode;
+#endif
// TODO(debargha): Consolidate these flags
int use_wedge_interintra;
int interintra_wedge_index;
@@ -413,9 +416,7 @@ typedef struct {
#endif // CONFIG_MOTION_VAR
int_mv mv[2];
int_mv pred_mv[2];
-#if CONFIG_REF_MV
uint8_t ref_mv_idx;
-#endif
#if CONFIG_EXT_PARTITION_TYPES
PARTITION_TYPE partition;
#endif
@@ -441,6 +442,13 @@ typedef struct {
WarpedMotionParams wm_params[2];
#endif // CONFIG_WARPED_MOTION
+#if CONFIG_CFL
+ // Index of the alpha Cb and alpha Cr combination
+ int cfl_alpha_idx;
+ // Signs of alpha Cb and alpha Cr
+ CFL_SIGN_TYPE cfl_alpha_signs[CFL_PRED_PLANES];
+#endif
+
BOUNDARY_TYPE boundary_info;
} MB_MODE_INFO;
@@ -536,16 +544,14 @@ typedef struct macroblockd_plane {
uint8_t width, height;
#if CONFIG_AOM_QM
- const qm_val_t *seg_iqmatrix[MAX_SEGMENTS][2][TX_SIZES];
+ const qm_val_t *seg_iqmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
+ const qm_val_t *seg_qmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
#endif
// encoder
const int16_t *dequant;
#if CONFIG_NEW_QUANT
const dequant_val_type_nuq *dequant_val_nuq[QUANT_PROFILES];
#endif // CONFIG_NEW_QUANT
-#if CONFIG_AOM_QM
- const qm_val_t *seg_qmatrix[MAX_SEGMENTS][2][TX_SIZES];
-#endif
#if CONFIG_PVQ || CONFIG_DAALA_DIST
DECLARE_ALIGNED(16, int16_t, pred[MAX_SB_SQUARE]);
@@ -558,14 +564,14 @@ typedef struct macroblockd_plane {
((x) + (i) * (1 << (tx_size_wide_log2[0] + tx_size_high_log2[0])))
typedef struct RefBuffer {
- // TODO(dkovalev): idx is not really required and should be removed, now it
- // is used in av1_onyxd_if.c
int idx;
YV12_BUFFER_CONFIG *buf;
struct scale_factors sf;
} RefBuffer;
-typedef int16_t EobThresholdMD[TX_SIZES_ALL][TX_TYPES];
+#if CONFIG_ADAPT_SCAN
+typedef int16_t EobThresholdMD[TX_TYPES][EOB_THRESHOLD_NUM];
+#endif
typedef struct macroblockd {
struct macroblockd_plane plane[MAX_MB_PLANE];
@@ -606,6 +612,11 @@ typedef struct macroblockd {
/* pointer to current frame */
const YV12_BUFFER_CONFIG *cur_buf;
+#if CONFIG_INTRABC
+ /* Scale of the current frame with respect to itself */
+ struct scale_factors sf_identity;
+#endif
+
ENTROPY_CONTEXT *above_context[MAX_MB_PLANE];
ENTROPY_CONTEXT left_context[MAX_MB_PLANE][2 * MAX_MIB_SIZE];
@@ -615,7 +626,7 @@ typedef struct macroblockd {
#if CONFIG_VAR_TX
TXFM_CONTEXT *above_txfm_context;
TXFM_CONTEXT *left_txfm_context;
- TXFM_CONTEXT left_txfm_context_buffer[MAX_MIB_SIZE];
+ TXFM_CONTEXT left_txfm_context_buffer[2 * MAX_MIB_SIZE];
TX_SIZE max_tx_size;
#if CONFIG_SUPERTX
@@ -626,11 +637,9 @@ typedef struct macroblockd {
// block dimension in the unit of mode_info.
uint8_t n8_w, n8_h;
-#if CONFIG_REF_MV
uint8_t ref_mv_count[MODE_CTX_REF_FRAMES];
CANDIDATE_MV ref_mv_stack[MODE_CTX_REF_FRAMES][MAX_REF_MV_STACK_SIZE];
uint8_t is_sec_rect;
-#endif
#if CONFIG_PVQ
daala_dec_ctx daala_dec;
@@ -638,10 +647,8 @@ typedef struct macroblockd {
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *tile_ctx;
#endif
-#if CONFIG_HIGHBITDEPTH
/* Bit depth: 8, 10, 12 */
int bd;
-#endif
int qindex[MAX_SEGMENTS];
int lossless[MAX_SEGMENTS];
@@ -699,6 +706,10 @@ static const TX_TYPE intra_mode_to_tx_type_context[INTRA_MODES] = {
ADST_DCT, // D63
#if CONFIG_ALT_INTRA
ADST_ADST, // SMOOTH
+#if CONFIG_SMOOTH_HV
+ ADST_DCT, // SMOOTH_V
+ DCT_ADST, // SMOOTH_H
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
ADST_ADST, // TM
};
@@ -761,24 +772,24 @@ static const int ext_tx_set_index_inter[EXT_TX_SET_TYPES] = {
static INLINE TxSetType get_ext_tx_set_type(TX_SIZE tx_size, BLOCK_SIZE bs,
int is_inter, int use_reduced_set) {
- const TX_SIZE tx_size2 = txsize_sqr_up_map[tx_size];
- tx_size = txsize_sqr_map[tx_size];
+ const TX_SIZE tx_size_sqr_up = txsize_sqr_up_map[tx_size];
+ const TX_SIZE tx_size_sqr = txsize_sqr_map[tx_size];
#if CONFIG_CB4X4 && USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4
(void)bs;
- if (tx_size > TX_32X32) return EXT_TX_SET_DCTONLY;
+ if (tx_size_sqr > TX_32X32) return EXT_TX_SET_DCTONLY;
#else
- if (tx_size > TX_32X32 || bs < BLOCK_8X8) return EXT_TX_SET_DCTONLY;
+ if (tx_size_sqr > TX_32X32 || bs < BLOCK_8X8) return EXT_TX_SET_DCTONLY;
#endif
if (use_reduced_set)
return is_inter ? EXT_TX_SET_DCT_IDTX : EXT_TX_SET_DTT4_IDTX;
- if (tx_size2 == TX_32X32)
+ if (tx_size_sqr_up == TX_32X32)
return is_inter ? EXT_TX_SET_DCT_IDTX : EXT_TX_SET_DCTONLY;
if (is_inter)
- return (tx_size == TX_16X16 ? EXT_TX_SET_DTT9_IDTX_1DDCT
- : EXT_TX_SET_ALL16);
+ return (tx_size_sqr == TX_16X16 ? EXT_TX_SET_DTT9_IDTX_1DDCT
+ : EXT_TX_SET_ALL16);
else
- return (tx_size == TX_16X16 ? EXT_TX_SET_DTT4_IDTX
- : EXT_TX_SET_DTT4_IDTX_1DDCT);
+ return (tx_size_sqr == TX_16X16 ? EXT_TX_SET_DTT4_IDTX
+ : EXT_TX_SET_DTT4_IDTX_1DDCT);
}
static INLINE int get_ext_tx_set(TX_SIZE tx_size, BLOCK_SIZE bs, int is_inter,
@@ -791,7 +802,7 @@ static INLINE int get_ext_tx_set(TX_SIZE tx_size, BLOCK_SIZE bs, int is_inter,
static const int use_intra_ext_tx_for_txsize[EXT_TX_SETS_INTRA][EXT_TX_SIZES] =
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ 1, 1, 1, 1, 1 }, // unused
{ 0, 1, 1, 0, 0 },
{ 0, 0, 0, 1, 0 },
@@ -799,12 +810,12 @@ static const int use_intra_ext_tx_for_txsize[EXT_TX_SETS_INTRA][EXT_TX_SIZES] =
{ 1, 1, 1, 1 }, // unused
{ 1, 1, 0, 0 },
{ 0, 0, 1, 0 },
-#endif // CONFIG_CB4X4
+#endif // CONFIG_CHROMA_2X2
};
static const int use_inter_ext_tx_for_txsize[EXT_TX_SETS_INTER][EXT_TX_SIZES] =
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ 1, 1, 1, 1, 1 }, // unused
{ 0, 1, 1, 0, 0 },
{ 0, 0, 0, 1, 0 },
@@ -814,7 +825,7 @@ static const int use_inter_ext_tx_for_txsize[EXT_TX_SETS_INTER][EXT_TX_SIZES] =
{ 1, 1, 0, 0 },
{ 0, 0, 1, 0 },
{ 0, 0, 0, 1 },
-#endif // CONFIG_CB4X4
+#endif // CONFIG_CHROMA_2X2
};
// Transform types used in each intra set
@@ -887,6 +898,45 @@ static INLINE int is_rect_tx_allowed(const MACROBLOCKD *xd,
return is_rect_tx_allowed_bsize(mbmi->sb_type) &&
!xd->lossless[mbmi->segment_id];
}
+
+#if CONFIG_RECT_TX_EXT
+static INLINE int is_quarter_tx_allowed_bsize(BLOCK_SIZE bsize) {
+ static const char LUT_QTTX[BLOCK_SIZES] = {
+#if CONFIG_CB4X4
+ 0, // BLOCK_2X2
+ 0, // BLOCK_2X4
+ 0, // BLOCK_4X2
+#endif
+ 0, // BLOCK_4X4
+ 0, // BLOCK_4X8
+ 0, // BLOCK_8X4
+ 0, // BLOCK_8X8
+ 1, // BLOCK_8X16
+ 1, // BLOCK_16X8
+ 0, // BLOCK_16X16
+ 0, // BLOCK_16X32
+ 0, // BLOCK_32X16
+ 0, // BLOCK_32X32
+ 0, // BLOCK_32X64
+ 0, // BLOCK_64X32
+ 0, // BLOCK_64X64
+#if CONFIG_EXT_PARTITION
+ 0, // BLOCK_64X128
+ 0, // BLOCK_128X64
+ 0, // BLOCK_128X128
+#endif // CONFIG_EXT_PARTITION
+ };
+
+ return LUT_QTTX[bsize];
+}
+
+static INLINE int is_quarter_tx_allowed(const MACROBLOCKD *xd,
+ const MB_MODE_INFO *mbmi,
+ int is_inter) {
+ return is_quarter_tx_allowed_bsize(mbmi->sb_type) && is_inter &&
+ !xd->lossless[mbmi->segment_id];
+}
+#endif // CONFIG_RECT_TX_EXT
#endif // CONFIG_RECT_TX
#endif // CONFIG_EXT_TX
@@ -926,8 +976,14 @@ static INLINE TX_SIZE tx_size_from_tx_mode(BLOCK_SIZE bsize, TX_MODE tx_mode,
#define MAX_ANGLE_DELTA 3
#define ANGLE_STEP 3
extern const int16_t dr_intra_derivative[90];
-static const uint8_t mode_to_angle_map[INTRA_MODES] = {
+static const uint8_t mode_to_angle_map[] = {
0, 90, 180, 45, 135, 111, 157, 203, 67, 0,
+#if CONFIG_ALT_INTRA
+ 0,
+#if CONFIG_SMOOTH_HV
+ 0, 0,
+#endif // CONFIG_SMOOTH_HV
+#endif // CONFIG_ALT_INTRA
};
#if CONFIG_INTRA_INTERP
// Returns whether filter selection is needed for a given
@@ -977,10 +1033,10 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd,
int block, TX_SIZE tx_size) {
const MODE_INFO *const mi = xd->mi[0];
const MB_MODE_INFO *const mbmi = &mi->mbmi;
-#if CONFIG_INTRABC
- // TODO(aconverse@google.com): Revisit this decision
+#if CONFIG_INTRABC && (!CONFIG_EXT_TX || CONFIG_TXK_SEL)
+ // TODO(aconverse@google.com): Handle INTRABC + EXT_TX + TXK_SEL
if (is_intrabc_block(mbmi)) return DCT_DCT;
-#endif // CONFIG_INTRABC
+#endif // CONFIG_INTRABC && (!CONFIG_EXT_TX || CONFIG_TXK_SEL)
#if !CONFIG_TXK_SEL
#if FIXED_TX_TYPE
const int block_raster_idx = av1_block_index_to_raster_order(tx_size, block);
@@ -1002,7 +1058,7 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd,
if (is_inter_block(mbmi)) {
// UV Inter only
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
if (tx_size < TX_4X4) return DCT_DCT;
#endif
return (mbmi->tx_type == IDTX && txsize_sqr_map[tx_size] >= TX_32X32)
@@ -1013,11 +1069,13 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd,
#if CONFIG_CB4X4
(void)block;
+#if CONFIG_CHROMA_2X2
if (tx_size < TX_4X4)
return DCT_DCT;
else
+#endif
return intra_mode_to_tx_type_context[mbmi->uv_mode];
-#else
+#else // CONFIG_CB4X4
// Sub8x8-Inter/Intra OR UV-Intra
if (is_inter_block(mbmi)) // Sub8x8-Inter
@@ -1051,17 +1109,17 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd,
void av1_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y);
static INLINE int tx_size_to_depth(TX_SIZE tx_size) {
- return (int)(tx_size - TX_4X4);
+ return (int)(tx_size - TX_SIZE_LUMA_MIN);
}
static INLINE TX_SIZE depth_to_tx_size(int depth) {
- return (TX_SIZE)(depth + TX_4X4);
+ return (TX_SIZE)(depth + TX_SIZE_LUMA_MIN);
}
static INLINE TX_SIZE get_uv_tx_size(const MB_MODE_INFO *mbmi,
const struct macroblockd_plane *pd) {
TX_SIZE uv_txsize;
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
assert(mbmi->tx_size > TX_2X2);
#endif
@@ -1073,9 +1131,6 @@ static INLINE TX_SIZE get_uv_tx_size(const MB_MODE_INFO *mbmi,
uv_txsize = uv_txsize_lookup[mbmi->sb_type][mbmi->tx_size][pd->subsampling_x]
[pd->subsampling_y];
-#if CONFIG_CB4X4 && !CONFIG_CHROMA_2X2
- uv_txsize = AOMMAX(uv_txsize, TX_4X4);
-#endif
assert(uv_txsize != TX_INVALID);
return uv_txsize;
}
@@ -1092,17 +1147,8 @@ get_plane_block_size(BLOCK_SIZE bsize, const struct macroblockd_plane *pd) {
return ss_size_lookup[bsize][pd->subsampling_x][pd->subsampling_y];
}
-static INLINE void reset_skip_context(MACROBLOCKD *xd, BLOCK_SIZE bsize) {
- int i;
- for (i = 0; i < MAX_MB_PLANE; i++) {
- struct macroblockd_plane *const pd = &xd->plane[i];
- const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
- const int txs_wide = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
- const int txs_high = block_size_high[plane_bsize] >> tx_size_high_log2[0];
- memset(pd->above_context, 0, sizeof(ENTROPY_CONTEXT) * txs_wide);
- memset(pd->left_context, 0, sizeof(ENTROPY_CONTEXT) * txs_high);
- }
-}
+void av1_reset_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col,
+ BLOCK_SIZE bsize);
typedef void (*foreach_transformed_block_visitor)(int plane, int block,
int blk_row, int blk_col,
@@ -1121,8 +1167,8 @@ void av1_foreach_transformed_block(const MACROBLOCKD *const xd,
#endif
#if CONFIG_DAALA_DIST
-void av1_foreach_8x8_transformed_block_in_plane(
- const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,
+void av1_foreach_8x8_transformed_block_in_yplane(
+ const MACROBLOCKD *const xd, BLOCK_SIZE bsize,
foreach_transformed_block_visitor visit,
foreach_transformed_block_visitor mi_visit, void *arg);
#endif
diff --git a/third_party/aom/av1/common/cdef.c b/third_party/aom/av1/common/cdef.c
index 53dff98b7..b35acfc82 100644
--- a/third_party/aom/av1/common/cdef.c
+++ b/third_party/aom/av1/common/cdef.c
@@ -26,13 +26,9 @@ int sb_all_skip(const AV1_COMMON *const cm, int mi_row, int mi_col) {
int skip = 1;
maxc = cm->mi_cols - mi_col;
maxr = cm->mi_rows - mi_row;
-#if CONFIG_EXT_PARTITION
- if (maxr > cm->mib_size_log2) maxr = cm->mib_size_log2;
- if (maxc > cm->mib_size_log2) maxc = cm->mib_size_log2;
-#else
- if (maxr > MAX_MIB_SIZE) maxr = MAX_MIB_SIZE;
- if (maxc > MAX_MIB_SIZE) maxc = MAX_MIB_SIZE;
-#endif
+
+ maxr = AOMMIN(maxr, cm->mib_size);
+ maxc = AOMMIN(maxc, cm->mib_size);
for (r = 0; r < maxr; r++) {
for (c = 0; c < maxc; c++) {
@@ -63,13 +59,9 @@ int sb_compute_dering_list(const AV1_COMMON *const cm, int mi_row, int mi_col,
grid = cm->mi_grid_visible;
maxc = cm->mi_cols - mi_col;
maxr = cm->mi_rows - mi_row;
-#if CONFIG_EXT_PARTITION
- if (maxr > cm->mib_size_log2) maxr = cm->mib_size_log2;
- if (maxc > cm->mib_size_log2) maxc = cm->mib_size_log2;
-#else
- if (maxr > MAX_MIB_SIZE) maxr = MAX_MIB_SIZE;
- if (maxc > MAX_MIB_SIZE) maxc = MAX_MIB_SIZE;
-#endif
+
+ maxr = AOMMIN(maxr, cm->mib_size);
+ maxc = AOMMIN(maxc, cm->mib_size);
const int r_step = mi_size_high[BLOCK_8X8];
const int c_step = mi_size_wide[BLOCK_8X8];
diff --git a/third_party/aom/av1/common/cfl.c b/third_party/aom/av1/common/cfl.c
index d66a989ad..749a5354f 100644
--- a/third_party/aom/av1/common/cfl.c
+++ b/third_party/aom/av1/common/cfl.c
@@ -47,23 +47,27 @@ void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
: tx_size_high[tx_size];
// Number of pixel on the top and left borders.
- const int num_pel = block_width + block_height;
+ const double num_pel = block_width + block_height;
int sum_u = 0;
int sum_v = 0;
- // Match behavior of build_intra_predictors (reconintra.c) at superblock
- // boundaries:
- //
- // 127 127 127 .. 127 127 127 127 127 127
- // 129 A B .. Y Z
- // 129 C D .. W X
- // 129 E F .. U V
- // 129 G H .. S T T T T T
- // ..
-
- // TODO(ltrudeau) replace this with DC_PRED assembly
+// 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
+// ..
+
+#if CONFIG_CHROMA_SUB8X8
+ if (xd->chroma_up_available && xd->mb_to_right_edge >= 0) {
+#else
if (xd->up_available && xd->mb_to_right_edge >= 0) {
+#endif
+ // TODO(ltrudeau) replace this with DC_PRED assembly
for (int i = 0; i < block_width; i++) {
sum_u += dst_u[-dst_u_stride + i];
sum_v += dst_v[-dst_v_stride + i];
@@ -73,7 +77,11 @@ void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
sum_v = block_width * 127;
}
+#if CONFIG_CHROMA_SUB8X8
+ if (xd->chroma_left_available && xd->mb_to_bottom_edge >= 0) {
+#else
if (xd->left_available && xd->mb_to_bottom_edge >= 0) {
+#endif
for (int i = 0; i < block_height; i++) {
sum_u += dst_u[i * dst_u_stride - 1];
sum_v += dst_v[i * dst_v_stride - 1];
@@ -83,25 +91,22 @@ void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
sum_v += block_height * 129;
}
- xd->cfl->dc_pred[CFL_PRED_U] = (sum_u + (num_pel >> 1)) / num_pel;
- xd->cfl->dc_pred[CFL_PRED_V] = (sum_v + (num_pel >> 1)) / num_pel;
+ xd->cfl->dc_pred[CFL_PRED_U] = sum_u / num_pel;
+ xd->cfl->dc_pred[CFL_PRED_V] = sum_v / num_pel;
}
// Predict the current transform block using CfL.
-// it is assumed that dst points at the start of the transform block
void cfl_predict_block(const CFL_CTX *cfl, uint8_t *dst, int dst_stride,
- int row, int col, TX_SIZE tx_size, int dc_pred) {
- const int tx_block_width = tx_size_wide[tx_size];
- const int tx_block_height = tx_size_high[tx_size];
-
- // 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);
+ int row, int col, TX_SIZE tx_size, double dc_pred,
+ double alpha) {
+ const int width = tx_size_wide[tx_size];
+ const int height = tx_size_high[tx_size];
+
+ const double y_avg = cfl_load(cfl, dst, dst_stride, row, col, width, height);
+
+ for (int j = 0; j < height; j++) {
+ for (int i = 0; i < width; i++) {
+ dst[i] = (uint8_t)(alpha * (dst[i] - y_avg) + dc_pred + 0.5);
}
dst += dst_stride;
}
@@ -142,9 +147,7 @@ void cfl_store(CFL_CTX *cfl, const uint8_t *input, int input_stride, int row,
// Load from the CfL pixel buffer into output
double cfl_load(const CFL_CTX *cfl, uint8_t *output, int output_stride, int row,
- int col, TX_SIZE tx_size) {
- const int tx_width = tx_size_wide[tx_size];
- const int tx_height = tx_size_high[tx_size];
+ int col, int width, int height) {
const int sub_x = cfl->subsampling_x;
const int sub_y = cfl->subsampling_y;
const int tx_off_log2 = tx_size_wide_log2[0];
@@ -161,12 +164,12 @@ double cfl_load(const CFL_CTX *cfl, uint8_t *output, int output_stride, int row,
// TODO(ltrudeau) add support for 4:2:2
if (sub_y == 0 && sub_x == 0) {
y_pix = &cfl->y_pix[(row * MAX_SB_SIZE + col) << tx_off_log2];
- int uv_width = (col << tx_off_log2) + tx_width;
+ int uv_width = (col << tx_off_log2) + width;
diff_width = uv_width - cfl->y_width;
- int uv_height = (row << tx_off_log2) + tx_width;
+ int uv_height = (row << tx_off_log2) + height;
diff_height = uv_height - cfl->y_height;
- for (int j = 0; j < tx_height; j++) {
- for (int i = 0; i < tx_width; i++) {
+ for (int j = 0; j < height; j++) {
+ for (int i = 0; i < width; i++) {
// In 4:4:4, pixels match 1 to 1
output[output_row_offset + i] = y_pix[pred_row_offset + i];
}
@@ -175,12 +178,12 @@ double cfl_load(const CFL_CTX *cfl, uint8_t *output, int output_stride, int row,
}
} else if (sub_y == 1 && sub_x == 1) {
y_pix = &cfl->y_pix[(row * MAX_SB_SIZE + col) << (tx_off_log2 + sub_y)];
- int uv_width = ((col << tx_off_log2) + tx_width) << sub_x;
+ int uv_width = ((col << tx_off_log2) + width) << sub_x;
diff_width = (uv_width - cfl->y_width) >> sub_x;
- int uv_height = ((row << tx_off_log2) + tx_width) << sub_y;
+ int uv_height = ((row << tx_off_log2) + height) << sub_y;
diff_height = (uv_height - cfl->y_height) >> sub_y;
- for (int j = 0; j < tx_height; j++) {
- for (int i = 0; i < tx_width; i++) {
+ for (int j = 0; j < height; j++) {
+ for (int i = 0; i < width; i++) {
top_left = (pred_row_offset + i) << sub_y;
bot_left = top_left + MAX_SB_SIZE;
// In 4:2:0, average pixels in 2x2 grid
@@ -206,9 +209,9 @@ double cfl_load(const CFL_CTX *cfl, uint8_t *output, int output_stride, int row,
// frame, the columns will be copied over them.
if (diff_width > 0) {
int last_pixel;
- output_row_offset = tx_width - diff_width;
+ output_row_offset = width - diff_width;
- for (int j = 0; j < tx_height; j++) {
+ for (int j = 0; j < height; j++) {
last_pixel = output_row_offset - 1;
for (int i = 0; i < diff_width; i++) {
output[output_row_offset + i] = output[last_pixel];
@@ -221,7 +224,7 @@ double cfl_load(const CFL_CTX *cfl, uint8_t *output, int output_stride, int row,
output_row_offset = diff_height * output_stride;
const int last_row_offset = output_row_offset - output_stride;
for (int j = 0; j < diff_height; j++) {
- for (int i = 0; i < tx_width; i++) {
+ for (int i = 0; i < width; i++) {
output[output_row_offset + i] = output[last_row_offset + i];
}
output_row_offset += output_stride;
@@ -230,11 +233,11 @@ double cfl_load(const CFL_CTX *cfl, uint8_t *output, int output_stride, int row,
int avg = 0;
output_row_offset = 0;
- for (int j = 0; j < tx_height; j++) {
- for (int i = 0; i < tx_width; i++) {
+ for (int j = 0; j < height; j++) {
+ for (int i = 0; i < width; i++) {
avg += output[output_row_offset + i];
}
output_row_offset += output_stride;
}
- return avg / (double)(tx_width * tx_height);
+ return avg / (double)(width * height);
}
diff --git a/third_party/aom/av1/common/cfl.h b/third_party/aom/av1/common/cfl.h
index 371df70be..c6b72a4d8 100644
--- a/third_party/aom/av1/common/cfl.h
+++ b/third_party/aom/av1/common/cfl.h
@@ -12,6 +12,8 @@
#ifndef AV1_COMMON_CFL_H_
#define AV1_COMMON_CFL_H_
+#include <assert.h>
+
#include "av1/common/enums.h"
// Forward declaration of AV1_COMMON, in order to avoid creating a cyclic
@@ -33,20 +35,53 @@ typedef struct {
int subsampling_x, subsampling_y;
// CfL Performs its own block level DC_PRED for each chromatic plane
- int dc_pred[CFL_PRED_PLANES];
+ double dc_pred[CFL_PRED_PLANES];
+
+ // The rate associated with each alpha codeword
+ int costs[CFL_ALPHABET_SIZE];
+
+ // Count the number of TX blocks in a predicted block to know when you are at
+ // the last one, so you can check for skips.
+ // TODO(any) Is there a better way to do this?
+ int num_tx_blk[CFL_PRED_PLANES];
} CFL_CTX;
+static const double cfl_alpha_mags[CFL_MAGS_SIZE] = {
+ 0., 0.125, -0.125, 0.25, -0.25, 0.5, -0.5
+};
+
+static const int cfl_alpha_codes[CFL_ALPHABET_SIZE][CFL_PRED_PLANES] = {
+ // barrbrain's simple 1D quant ordered by subset 3 likelihood
+ { 0, 0 }, { 1, 1 }, { 3, 0 }, { 3, 1 }, { 1, 0 }, { 3, 3 },
+ { 0, 1 }, { 5, 5 }, { 5, 3 }, { 1, 3 }, { 5, 3 }, { 3, 5 },
+ { 0, 3 }, { 5, 1 }, { 1, 5 }, { 0, 5 }
+};
+
void cfl_init(CFL_CTX *cfl, AV1_COMMON *cm, int subsampling_x,
int subsampling_y);
void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize, TX_SIZE tx_size);
+static INLINE double cfl_idx_to_alpha(int alpha_idx, CFL_SIGN_TYPE alpha_sign,
+ CFL_PRED_TYPE pred_type) {
+ const int mag_idx = cfl_alpha_codes[alpha_idx][pred_type];
+ const double abs_alpha = cfl_alpha_mags[mag_idx];
+ if (alpha_sign == CFL_SIGN_POS) {
+ return abs_alpha;
+ } else {
+ assert(abs_alpha != 0.0);
+ assert(cfl_alpha_mags[mag_idx + 1] == -abs_alpha);
+ return -abs_alpha;
+ }
+}
+
void cfl_predict_block(const CFL_CTX *cfl, uint8_t *dst, int dst_stride,
- int row, int col, TX_SIZE tx_size, int dc_pred);
+ int row, int col, TX_SIZE tx_size, double dc_pred,
+ double alpha);
void cfl_store(CFL_CTX *cfl, const uint8_t *input, int input_stride, int row,
int col, TX_SIZE tx_size);
double cfl_load(const CFL_CTX *cfl, uint8_t *output, int output_stride, int row,
- int col, TX_SIZE tx_size);
+ int col, int width, int height);
#endif // AV1_COMMON_CFL_H_
diff --git a/third_party/aom/av1/common/common_data.h b/third_party/aom/av1/common/common_data.h
index 415d5cf73..7eae71a4f 100644
--- a/third_party/aom/av1/common/common_data.h
+++ b/third_party/aom/av1/common/common_data.h
@@ -21,105 +21,117 @@ extern "C" {
#endif
#if CONFIG_EXT_PARTITION
-#define IF_EXT_PARTITION(...) __VA_ARGS__
+#define IF_EXT_PARTITION(...) __VA_ARGS__,
#else
#define IF_EXT_PARTITION(...)
#endif
// Log 2 conversion lookup tables for block width and height
-static const uint8_t b_width_log2_lookup[BLOCK_SIZES] = {
+static const uint8_t b_width_log2_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
0, 0, 0,
#endif
- 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, IF_EXT_PARTITION(4, 5, 5)
+ 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, IF_EXT_PARTITION(4, 5, 5) 0, 2, 1, 3
};
-static const uint8_t b_height_log2_lookup[BLOCK_SIZES] = {
+static const uint8_t b_height_log2_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
0, 0, 0,
#endif
- 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, IF_EXT_PARTITION(5, 4, 5)
+ 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, IF_EXT_PARTITION(5, 4, 5) 2, 0, 3, 1
};
// Log 2 conversion lookup tables for modeinfo width and height
-static const uint8_t mi_width_log2_lookup[BLOCK_SIZES] = {
+static const uint8_t mi_width_log2_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
- 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, IF_EXT_PARTITION(4, 5, 5)
+ 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, IF_EXT_PARTITION(4, 5, 5) 0,
+ 2, 1, 3
#else
- 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, IF_EXT_PARTITION(3, 4, 4)
+ 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, IF_EXT_PARTITION(3, 4, 4) 0, 1, 0, 2
#endif
};
-static const uint8_t mi_height_log2_lookup[BLOCK_SIZES] = {
+static const uint8_t mi_height_log2_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
- 0, 0, 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, IF_EXT_PARTITION(5, 4, 5)
+ 0, 0, 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, IF_EXT_PARTITION(5, 4, 5) 2,
+ 0, 3, 1
#else
- 0, 0, 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, IF_EXT_PARTITION(4, 3, 4)
+ 0, 0, 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, IF_EXT_PARTITION(4, 3, 4) 1, 0, 2, 0
#endif
};
-static const uint8_t mi_size_wide[BLOCK_SIZES] = {
+/* clang-format off */
+static const uint8_t mi_size_wide[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
- 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16, IF_EXT_PARTITION(16, 32, 32)
+ 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16,
+ IF_EXT_PARTITION(16, 32, 32) 1, 4, 2, 8
#else
- 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, IF_EXT_PARTITION(8, 16, 16)
+ 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, IF_EXT_PARTITION(8, 16, 16) 1, 2, 1, 4
#endif
};
-static const uint8_t mi_size_high[BLOCK_SIZES] = {
+static const uint8_t mi_size_high[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
- 1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16, IF_EXT_PARTITION(32, 16, 32)
+ 1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16,
+ IF_EXT_PARTITION(32, 16, 32) 4, 1, 8, 2
#else
- 1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, IF_EXT_PARTITION(16, 8, 16)
+ 1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, IF_EXT_PARTITION(16, 8, 16) 2, 1, 4, 1
#endif
};
+/* clang-format on */
// Width/height lookup tables in units of various block sizes
-static const uint8_t block_size_wide[BLOCK_SIZES] = {
+static const uint8_t block_size_wide[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
- 2, 2, 4,
+ 2, 2, 4,
#endif
- 4, 4, 8, 8, 8, 16, 16, 16, 32, 32, 32, 64, 64, IF_EXT_PARTITION(64, 128, 128)
+ 4, 4, 8, 8, 8, 16, 16,
+ 16, 32, 32, 32, 64, 64, IF_EXT_PARTITION(64, 128, 128) 4,
+ 16, 8, 32
};
-static const uint8_t block_size_high[BLOCK_SIZES] = {
+static const uint8_t block_size_high[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
- 2, 4, 2,
+ 2, 4, 2,
#endif
- 4, 8, 4, 8, 16, 8, 16, 32, 16, 32, 64, 32, 64, IF_EXT_PARTITION(128, 64, 128)
+ 4, 8, 4, 8, 16, 8, 16,
+ 32, 16, 32, 64, 32, 64, IF_EXT_PARTITION(128, 64, 128) 16,
+ 4, 32, 8
};
-static const uint8_t num_4x4_blocks_wide_lookup[BLOCK_SIZES] = {
+static const uint8_t num_4x4_blocks_wide_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
1, 1, 1,
#endif
- 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16, IF_EXT_PARTITION(16, 32, 32)
+ 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16, IF_EXT_PARTITION(16, 32, 32) 1,
+ 4, 2, 8
};
-static const uint8_t num_4x4_blocks_high_lookup[BLOCK_SIZES] = {
+static const uint8_t num_4x4_blocks_high_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
1, 1, 1,
#endif
- 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16, IF_EXT_PARTITION(32, 16, 32)
+ 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16, IF_EXT_PARTITION(32, 16, 32) 4,
+ 1, 8, 2
};
-static const uint8_t num_8x8_blocks_wide_lookup[BLOCK_SIZES] = {
+static const uint8_t num_8x8_blocks_wide_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
1, 1, 1,
#endif
- 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, IF_EXT_PARTITION(8, 16, 16)
+ 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, IF_EXT_PARTITION(8, 16, 16) 1, 2, 1, 4
};
-static const uint8_t num_8x8_blocks_high_lookup[BLOCK_SIZES] = {
+static const uint8_t num_8x8_blocks_high_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
1, 1, 1,
#endif
- 1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, IF_EXT_PARTITION(16, 8, 16)
+ 1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, IF_EXT_PARTITION(16, 8, 16) 2, 1, 4, 1
};
-static const uint8_t num_16x16_blocks_wide_lookup[BLOCK_SIZES] = {
+static const uint8_t num_16x16_blocks_wide_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
1, 1, 1,
#endif
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, IF_EXT_PARTITION(4, 8, 8)
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, IF_EXT_PARTITION(4, 8, 8) 1, 1, 1, 2
};
-static const uint8_t num_16x16_blocks_high_lookup[BLOCK_SIZES] = {
+static const uint8_t num_16x16_blocks_high_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
1, 1, 1,
#endif
- 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 4, 2, 4, IF_EXT_PARTITION(8, 4, 8)
+ 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 4, 2, 4, IF_EXT_PARTITION(8, 4, 8) 1, 1, 2, 1
};
// AOMMIN(3, AOMMIN(b_width_log2(bsize), b_height_log2(bsize)))
@@ -130,11 +142,12 @@ static const uint8_t size_group_lookup[BLOCK_SIZES] = {
0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, IF_EXT_PARTITION(3, 3, 3)
};
-static const uint8_t num_pels_log2_lookup[BLOCK_SIZES] = {
+static const uint8_t num_pels_log2_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
2, 3, 3,
#endif
- 4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, IF_EXT_PARTITION(13, 13, 14)
+ 4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, IF_EXT_PARTITION(13, 13, 14) 6,
+ 6, 8, 8
};
/* clang-format off */
@@ -424,9 +437,11 @@ static const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES] =
};
static const TX_SIZE max_txsize_lookup[BLOCK_SIZES] = {
-#if CONFIG_CB4X4
// 2X2, 2X4, 4X2,
+#if CONFIG_CHROMA_2X2
TX_2X2, TX_2X2, TX_2X2,
+#elif CONFIG_CB4X4
+ TX_4X4, TX_4X4, TX_4X4,
#endif
// 4X4
TX_4X4,
@@ -457,10 +472,12 @@ static const TX_SIZE max_txsize_lookup[BLOCK_SIZES] = {
#if CONFIG_RECT_TX && (CONFIG_EXT_TX || CONFIG_VAR_TX)
static const TX_SIZE max_txsize_rect_lookup[BLOCK_SIZES] = {
-#if CONFIG_CB4X4
// 2X2, 2X4, 4X2,
+#if CONFIG_CHROMA_2X2
TX_2X2, TX_2X2, TX_2X2,
-#endif // CONFIG_CB4X4
+#elif CONFIG_CB4X4
+ TX_4X4, TX_4X4, TX_4X4,
+#endif
// 4X4
TX_4X4,
// 4X8, 8X4, 8X8
@@ -487,10 +504,49 @@ static const TX_SIZE max_txsize_rect_lookup[BLOCK_SIZES] = {
#endif // CONFIG_EXT_PARTITION
#endif // CONFIG_TX64X64
};
+
+#if CONFIG_EXT_TX && CONFIG_RECT_TX_EXT
+static const TX_SIZE quarter_txsize_lookup[BLOCK_SIZES] = {
+#if CONFIG_CB4X4
+ // 2X2, 2X4, 4X2,
+ TX_INVALID, TX_INVALID, TX_INVALID,
+#endif
+ // 4x4,
+ TX_INVALID,
+ // 4x8, 8x4, 8x8,
+ TX_INVALID, TX_INVALID, TX_INVALID,
+ // 8x16, 16x8, 16x16,
+ TX_4X16, TX_16X4, TX_INVALID,
+ // 16x32, 32x16, 32x32,
+ TX_8X32, TX_32X8, TX_INVALID,
+ // 32x64, 64x32, 64x64
+ TX_INVALID, TX_INVALID, TX_INVALID,
+#if CONFIG_EXT_PARTITION
+ // 64x128, 128x64, 128x128
+ TX_INVALID, TX_INVALID, TX_INVALID,
+#endif
+};
+#endif // CONFIG_EXT_TX && CONFIG_RECT_TX_EXT
#else
#define max_txsize_rect_lookup max_txsize_lookup
#endif // CONFIG_RECT_TX && (CONFIG_EXT_TX || CONFIG_VAR_TX)
+static const TX_TYPE_1D vtx_tab[TX_TYPES] = {
+ DCT_1D, ADST_1D, DCT_1D, ADST_1D,
+#if CONFIG_EXT_TX
+ FLIPADST_1D, DCT_1D, FLIPADST_1D, ADST_1D, FLIPADST_1D, IDTX_1D,
+ DCT_1D, IDTX_1D, ADST_1D, IDTX_1D, FLIPADST_1D, IDTX_1D,
+#endif // CONFIG_EXT_TX
+};
+
+static const TX_TYPE_1D htx_tab[TX_TYPES] = {
+ DCT_1D, DCT_1D, ADST_1D, ADST_1D,
+#if CONFIG_EXT_TX
+ DCT_1D, FLIPADST_1D, FLIPADST_1D, FLIPADST_1D, ADST_1D, IDTX_1D,
+ IDTX_1D, DCT_1D, IDTX_1D, ADST_1D, IDTX_1D, FLIPADST_1D,
+#endif // CONFIG_EXT_TX
+};
+
#if CONFIG_RECT_TX && (CONFIG_EXT_TX || CONFIG_VAR_TX)
// Same as "max_txsize_lookup[bsize] - TX_8X8", except for rectangular
// block which may use a rectangular transform, in which case it is
@@ -571,7 +627,7 @@ static const int32_t intra_tx_size_cat_lookup[BLOCK_SIZES] = {
/* clang-format on */
static const TX_SIZE sub_tx_size_map[TX_SIZES_ALL] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
TX_2X2, // TX_2X2
#endif
TX_4X4, // TX_4X4
@@ -594,7 +650,7 @@ static const TX_SIZE sub_tx_size_map[TX_SIZES_ALL] = {
};
static const TX_SIZE txsize_horz_map[TX_SIZES_ALL] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
TX_2X2, // TX_2X2
#endif
TX_4X4, // TX_4X4
@@ -617,7 +673,7 @@ static const TX_SIZE txsize_horz_map[TX_SIZES_ALL] = {
};
static const TX_SIZE txsize_vert_map[TX_SIZES_ALL] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
TX_2X2, // TX_2X2
#endif
TX_4X4, // TX_4X4
@@ -639,7 +695,7 @@ static const TX_SIZE txsize_vert_map[TX_SIZES_ALL] = {
TX_8X8, // TX_32X8
};
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
#define TX_SIZE_W_MIN 2
#else
#define TX_SIZE_W_MIN 4
@@ -647,7 +703,7 @@ static const TX_SIZE txsize_vert_map[TX_SIZES_ALL] = {
// Transform block width in pixels
static const int tx_size_wide[TX_SIZES_ALL] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
2,
#endif
4, 8, 16, 32,
@@ -657,7 +713,7 @@ static const int tx_size_wide[TX_SIZES_ALL] = {
4, 8, 8, 16, 16, 32, 4, 16, 8, 32
};
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
#define TX_SIZE_H_MIN 2
#else
#define TX_SIZE_H_MIN 4
@@ -665,7 +721,7 @@ static const int tx_size_wide[TX_SIZES_ALL] = {
// Transform block height in pixels
static const int tx_size_high[TX_SIZES_ALL] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
2,
#endif
4, 8, 16, 32,
@@ -677,41 +733,41 @@ static const int tx_size_high[TX_SIZES_ALL] = {
// Transform block width in unit
static const int tx_size_wide_unit[TX_SIZES_ALL] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
1, 2, 4, 8, 16,
#if CONFIG_TX64X64
32,
#endif // CONFIG_TX64X64
2, 4, 4, 8, 8, 16, 2, 8, 4, 16
-#else // CONFIG_CB4X4
+#else // CONFIG_CHROMA_2X2
1, 2, 4, 8,
#if CONFIG_TX64X64
16,
#endif // CONFIG_TX64X64
1, 2, 2, 4, 4, 8, 1, 4, 2, 8
-#endif // CONFIG_CB4X4
+#endif // CONFIG_CHROMA_2X2
};
// Transform block height in unit
static const int tx_size_high_unit[TX_SIZES_ALL] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
1, 2, 4, 8, 16,
#if CONFIG_TX64X64
32,
#endif // CONFIG_TX64X64
4, 2, 8, 4, 16, 8, 8, 2, 16, 4
-#else // CONFIG_CB4X4
+#else // CONFIG_CHROMA_2X2
1, 2, 4, 8,
#if CONFIG_TX64X64
16,
#endif // CONFIG_TX64X64
2, 1, 4, 2, 8, 4, 4, 1, 8, 2
-#endif // CONFIG_CB4X4
+#endif // CONFIG_CHROMA_2X2
};
// Transform block width in log2
static const int tx_size_wide_log2[TX_SIZES_ALL] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
1,
#endif
2, 3, 4, 5,
@@ -723,7 +779,7 @@ static const int tx_size_wide_log2[TX_SIZES_ALL] = {
// Transform block height in log2
static const int tx_size_high_log2[TX_SIZES_ALL] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
1,
#endif
2, 3, 4, 5,
@@ -733,8 +789,11 @@ static const int tx_size_high_log2[TX_SIZES_ALL] = {
3, 2, 4, 3, 5, 4, 4, 2, 5, 3
};
+#define TX_UNIT_WIDE_LOG2 (MI_SIZE_LOG2 - tx_size_wide_log2[0])
+#define TX_UNIT_HIGH_LOG2 (MI_SIZE_LOG2 - tx_size_high_log2[0])
+
static const int tx_size_2d[TX_SIZES_ALL] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
4,
#endif
16, 64, 256, 1024,
@@ -745,7 +804,7 @@ static const int tx_size_2d[TX_SIZES_ALL] = {
};
static const BLOCK_SIZE txsize_to_bsize[TX_SIZES_ALL] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
BLOCK_2X2, // TX_2X2
#endif
BLOCK_4X4, // TX_4X4
@@ -753,22 +812,22 @@ static const BLOCK_SIZE txsize_to_bsize[TX_SIZES_ALL] = {
BLOCK_16X16, // TX_16X16
BLOCK_32X32, // TX_32X32
#if CONFIG_TX64X64
- BLOCK_64X64, // TX_64X64
-#endif // CONFIG_TX64X64
- BLOCK_4X8, // TX_4X8
- BLOCK_8X4, // TX_8X4
- BLOCK_8X16, // TX_8X16
- BLOCK_16X8, // TX_16X8
- BLOCK_16X32, // TX_16X32
- BLOCK_32X16, // TX_32X16
- BLOCK_INVALID, // TX_4X16
- BLOCK_INVALID, // TX_16X4
- BLOCK_INVALID, // TX_8X32
- BLOCK_INVALID, // TX_32X8
+ BLOCK_64X64, // TX_64X64
+#endif // CONFIG_TX64X64
+ BLOCK_4X8, // TX_4X8
+ BLOCK_8X4, // TX_8X4
+ BLOCK_8X16, // TX_8X16
+ BLOCK_16X8, // TX_16X8
+ BLOCK_16X32, // TX_16X32
+ BLOCK_32X16, // TX_32X16
+ BLOCK_4X16, // TX_4X16
+ BLOCK_16X4, // TX_16X4
+ BLOCK_8X32, // TX_8X32
+ BLOCK_32X8, // TX_32X8
};
static const TX_SIZE txsize_sqr_map[TX_SIZES_ALL] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
TX_2X2, // TX_2X2
#endif
TX_4X4, // TX_4X4
@@ -791,7 +850,7 @@ static const TX_SIZE txsize_sqr_map[TX_SIZES_ALL] = {
};
static const TX_SIZE txsize_sqr_up_map[TX_SIZES_ALL] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
TX_2X2, // TX_2X2
#endif
TX_4X4, // TX_4X4
@@ -864,6 +923,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
// ss_x == 0 ss_x == 0 ss_x == 1 ss_x == 1
// ss_y == 0 ss_y == 1 ss_y == 0 ss_y == 1
#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{
// BLOCK_2X2
{ { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
@@ -927,15 +987,77 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
},
+#else // CONFIG_CHROMA_2X2
+ {
+ // BLOCK_2X2
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+#if CONFIG_TX64X64
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+#endif // CONFIG_TX64X64
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
+ { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
+ { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
+ { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
+ },
+ {
+ // BLOCK_2X4
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+#if CONFIG_TX64X64
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+#endif // CONFIG_TX64X64
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
+ { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
+ { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
+ { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
+ },
+ {
+ // BLOCK_2X4
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+#if CONFIG_TX64X64
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+#endif // CONFIG_TX64X64
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
+ { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
+ { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
+ { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
+ { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
+ },
+#endif // CONFIG_CHROMA_2X2
#endif
{
// BLOCK_4X4
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
{ { TX_4X4, TX_2X2 }, { TX_2X2, TX_2X2 } },
#else
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
-#endif // CONFIG_CB4X4
+#endif // CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@@ -955,7 +1077,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
},
{
// BLOCK_4X8
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
{ { TX_4X4, TX_2X2 }, { TX_2X2, TX_2X2 } },
#else
@@ -967,7 +1089,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
#if CONFIG_TX64X64
{ { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif // CONFIG_TX64X64
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ { TX_4X8, TX_4X4 }, { TX_2X2, TX_2X2 } }, // used
#else
{ { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } }, // used
@@ -984,7 +1106,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
},
{
// BLOCK_8X4
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
{ { TX_4X4, TX_2X2 }, { TX_2X2, TX_2X2 } },
#else
@@ -997,7 +1119,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
{ { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif // CONFIG_TX64X64
{ { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ { TX_8X4, TX_2X2 }, { TX_4X4, TX_2X2 } }, // used
#else
{ { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, // used
@@ -1013,7 +1135,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
},
{
// BLOCK_8X8
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@@ -1036,7 +1158,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
},
{
// BLOCK_8X16
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@@ -1052,14 +1174,14 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
{ { TX_8X16, TX_8X8 }, { TX_4X8, TX_4X8 } },
{ { TX_8X16, TX_8X8 }, { TX_4X8, TX_4X8 } },
{ { TX_8X16, TX_8X8 }, { TX_4X8, TX_4X8 } },
- { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
+ { { TX_4X16, TX_4X8 }, { TX_4X16, TX_4X8 } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
},
{
// BLOCK_16X8
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@@ -1076,13 +1198,13 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
{ { TX_16X8, TX_8X4 }, { TX_8X8, TX_8X4 } },
{ { TX_16X8, TX_8X4 }, { TX_8X8, TX_8X4 } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
- { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
+ { { TX_16X4, TX_16X4 }, { TX_8X4, TX_8X4 } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
},
{
// BLOCK_16X16
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@@ -1105,7 +1227,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
},
{
// BLOCK_16X32
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@@ -1123,12 +1245,12 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
{ { TX_16X32, TX_16X16 }, { TX_8X16, TX_8X16 } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
- { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
+ { { TX_8X32, TX_8X16 }, { TX_4X16, TX_4X16 } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
},
{
// BLOCK_32X16
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@@ -1147,11 +1269,11 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
- { { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
+ { { TX_32X8, TX_32X8 }, { TX_16X8, TX_16X4 } },
},
{
// BLOCK_32X32
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@@ -1174,7 +1296,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
},
{
// BLOCK_32X64
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@@ -1197,7 +1319,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
},
{
// BLOCK_64X32
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@@ -1220,7 +1342,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
},
{
// BLOCK_64X64
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@@ -1244,7 +1366,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
#if CONFIG_EXT_PARTITION
{
// BLOCK_64X128
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@@ -1267,7 +1389,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
},
{
// BLOCK_128X64
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@@ -1290,7 +1412,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
},
{
// BLOCK_128X128
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@@ -1371,7 +1493,7 @@ static const struct {
static const TX_SIZE uvsupertx_size_lookup[TX_SIZES][2][2] = {
// ss_x == 0 ss_x == 0 ss_x == 1 ss_x == 1
// ss_y == 0 ss_y == 1 ss_y == 0 ss_y == 1
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
diff --git a/third_party/aom/av1/common/convolve.c b/third_party/aom/av1/common/convolve.c
index eab6fe7a3..ab2440011 100644
--- a/third_party/aom/av1/common/convolve.c
+++ b/third_party/aom/av1/common/convolve.c
@@ -290,12 +290,14 @@ void av1_convolve_2d_facade(const uint8_t *src, int src_stride, uint8_t *dst,
InterpFilterParams filter_params_y =
av1_get_interp_filter_params(interp_filter[0 + 2 * conv_params->ref]);
+#if USE_EXTRA_FILTER
if (filter_params_x.interp_filter == MULTITAP_SHARP &&
filter_params_y.interp_filter == MULTITAP_SHARP) {
// Avoid two directions both using 12-tap filter.
// This will reduce hardware implementation cost.
filter_params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP);
}
+#endif // USE_EXTRA_FILTER
#else
InterpFilterParams filter_params_x =
av1_get_interp_filter_params(*interp_filter);
@@ -331,6 +333,140 @@ void av1_convolve_2d_facade(const uint8_t *src, int src_stride, uint8_t *dst,
}
}
+#if CONFIG_HIGHBITDEPTH
+static INLINE void transpose_uint16(uint16_t *dst, int dst_stride,
+ const uint16_t *src, int src_stride, int w,
+ int h) {
+ int r, c;
+ for (r = 0; r < h; ++r)
+ for (c = 0; c < w; ++c) dst[c * dst_stride + r] = src[r * src_stride + c];
+}
+
+void av1_highbd_convolve_rounding(const int32_t *src, int src_stride,
+ uint8_t *dst8, int dst_stride, int w, int h,
+ int bits, int bd) {
+ uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
+ int r, c;
+ for (r = 0; r < h; ++r) {
+ for (c = 0; c < w; ++c) {
+ dst[r * dst_stride + c] = clip_pixel_highbd(
+ ROUND_POWER_OF_TWO_SIGNED(src[r * src_stride + c], bits), bd);
+ }
+ }
+}
+
+void av1_highbd_convolve_2d(const uint16_t *src, int src_stride,
+ CONV_BUF_TYPE *dst, int dst_stride, int w, int h,
+ InterpFilterParams *filter_params_x,
+ InterpFilterParams *filter_params_y,
+ const int subpel_x_q4, const int subpel_y_q4,
+ ConvolveParams *conv_params, int bd) {
+ int x, y, k;
+ CONV_BUF_TYPE im_block[(MAX_SB_SIZE + MAX_FILTER_TAP - 1) * MAX_SB_SIZE];
+ int im_h = h + filter_params_y->taps - 1;
+ int im_stride = w;
+ const int fo_vert = filter_params_y->taps / 2 - 1;
+ const int fo_horiz = filter_params_x->taps / 2 - 1;
+ (void)conv_params;
+ // horizontal filter
+ const uint16_t *src_horiz = src - fo_vert * src_stride;
+ const int16_t *x_filter = av1_get_interp_filter_subpel_kernel(
+ *filter_params_x, subpel_x_q4 & SUBPEL_MASK);
+ for (y = 0; y < im_h; ++y) {
+ for (x = 0; x < w; ++x) {
+ CONV_BUF_TYPE sum = 0;
+ for (k = 0; k < filter_params_x->taps; ++k) {
+ sum += x_filter[k] * src_horiz[y * src_stride + x - fo_horiz + k];
+ }
+#if CONFIG_COMPOUND_ROUND
+ im_block[y * im_stride + x] = clip_pixel_highbd(
+ ROUND_POWER_OF_TWO_SIGNED(sum, conv_params->round_0), bd);
+#else
+ (void)bd;
+ im_block[y * im_stride + x] =
+ ROUND_POWER_OF_TWO_SIGNED(sum, conv_params->round_0);
+#endif
+ }
+ }
+
+ // vertical filter
+ CONV_BUF_TYPE *src_vert = im_block + fo_vert * im_stride;
+ const int16_t *y_filter = av1_get_interp_filter_subpel_kernel(
+ *filter_params_y, subpel_y_q4 & SUBPEL_MASK);
+ for (y = 0; y < h; ++y) {
+ for (x = 0; x < w; ++x) {
+ CONV_BUF_TYPE sum = 0;
+ for (k = 0; k < filter_params_y->taps; ++k) {
+ sum += y_filter[k] * src_vert[(y - fo_vert + k) * im_stride + x];
+ }
+ dst[y * dst_stride + x] +=
+ ROUND_POWER_OF_TWO_SIGNED(sum, conv_params->round_1);
+ }
+ }
+}
+
+void av1_highbd_convolve_2d_facade(const uint8_t *src8, int src_stride,
+ uint8_t *dst, int dst_stride, int w, int h,
+ const InterpFilter *interp_filter,
+ const int subpel_x_q4, int x_step_q4,
+ const int subpel_y_q4, int y_step_q4,
+ ConvolveParams *conv_params, int bd) {
+ (void)x_step_q4;
+ (void)y_step_q4;
+ (void)dst;
+ (void)dst_stride;
+#if CONFIG_DUAL_FILTER
+ InterpFilterParams filter_params_x =
+ av1_get_interp_filter_params(interp_filter[1 + 2 * conv_params->ref]);
+ InterpFilterParams filter_params_y =
+ av1_get_interp_filter_params(interp_filter[0 + 2 * conv_params->ref]);
+
+#if USE_EXTRA_FILTER
+ if (filter_params_x.interp_filter == MULTITAP_SHARP &&
+ filter_params_y.interp_filter == MULTITAP_SHARP) {
+ // Avoid two directions both using 12-tap filter.
+ // This will reduce hardware implementation cost.
+ filter_params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP);
+ }
+#endif
+#else
+ InterpFilterParams filter_params_x =
+ av1_get_interp_filter_params(*interp_filter);
+ InterpFilterParams filter_params_y =
+ av1_get_interp_filter_params(*interp_filter);
+#endif
+ const uint16_t *src = CONVERT_TO_SHORTPTR(src8);
+ if (filter_params_y.taps < filter_params_x.taps) {
+ uint16_t tr_src[(MAX_SB_SIZE + MAX_FILTER_TAP - 1) *
+ (MAX_SB_SIZE + MAX_FILTER_TAP - 1)];
+ int tr_src_stride = MAX_SB_SIZE + MAX_FILTER_TAP - 1;
+ CONV_BUF_TYPE tr_dst[MAX_SB_SIZE * MAX_SB_SIZE];
+ int tr_dst_stride = MAX_SB_SIZE;
+ int fo_vert = filter_params_y.taps / 2 - 1;
+ int fo_horiz = filter_params_x.taps / 2 - 1;
+
+ transpose_uint16(
+ tr_src, tr_src_stride, src - fo_vert * src_stride - fo_horiz,
+ src_stride, w + filter_params_x.taps - 1, h + filter_params_y.taps - 1);
+ transpose_int32(tr_dst, tr_dst_stride, conv_params->dst,
+ conv_params->dst_stride, w, h);
+
+ // horizontal and vertical parameters are swapped because of the transpose
+ av1_highbd_convolve_2d(tr_src + fo_horiz * tr_src_stride + fo_vert,
+ tr_src_stride, tr_dst, tr_dst_stride, h, w,
+ &filter_params_y, &filter_params_x, subpel_y_q4,
+ subpel_x_q4, conv_params, bd);
+ transpose_int32(conv_params->dst, conv_params->dst_stride, tr_dst,
+ tr_dst_stride, h, w);
+ } else {
+ av1_highbd_convolve_2d(src, src_stride, conv_params->dst,
+ conv_params->dst_stride, w, h, &filter_params_x,
+ &filter_params_y, subpel_x_q4, subpel_y_q4,
+ conv_params, bd);
+ }
+}
+#endif // CONFIG_HIGHBITDEPTH
+
#endif // CONFIG_CONVOLVE_ROUND
typedef void (*ConvolveFunc)(const uint8_t *src, int src_stride, uint8_t *dst,
@@ -394,7 +530,7 @@ static void convolve_helper(const uint8_t *src, int src_stride, uint8_t *dst,
temp[((MAX_SB_SIZE * 2 + 16) + 16) * MAX_SB_SIZE]);
int max_intermediate_size = ((MAX_SB_SIZE * 2 + 16) + 16);
int filter_size;
-#if CONFIG_DUAL_FILTER
+#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
if (interp_filter[0 + 2 * conv_params->ref] == MULTITAP_SHARP &&
interp_filter[1 + 2 * conv_params->ref] == MULTITAP_SHARP) {
// Avoid two directions both using 12-tap filter.
@@ -427,7 +563,7 @@ static void convolve_helper(const uint8_t *src, int src_stride, uint8_t *dst,
convolve_horiz(temp + (filter_size / 2 - 1), temp_stride, dst, dst_stride,
w, h, filter_params, subpel_x_q4, x_step_q4, conv_params);
} else
-#endif // CONFIG_DUAL_FILTER
+#endif // CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
{
int intermediate_height;
int temp_stride = MAX_SB_SIZE;
@@ -708,15 +844,15 @@ void av1_highbd_convolve(const uint8_t *src8, int src_stride, uint8_t *dst8,
av1_get_interp_filter_params(interp_filter[1 + 2 * ref_idx]);
InterpFilterParams filter_params_y =
av1_get_interp_filter_params(interp_filter[0 + 2 * ref_idx]);
+#endif
+
+#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
if (interp_filter[0 + 2 * ref_idx] == MULTITAP_SHARP &&
interp_filter[1 + 2 * ref_idx] == MULTITAP_SHARP) {
// Avoid two directions both using 12-tap filter.
// This will reduce hardware implementation cost.
filter_params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP);
}
-#endif
-
-#if CONFIG_DUAL_FILTER
if (filter_params_y.taps < filter_params_x.taps) {
int intermediate_width;
int temp_stride = max_intermediate_size;
@@ -739,7 +875,7 @@ void av1_highbd_convolve(const uint8_t *src8, int src_stride, uint8_t *dst8,
temp8 + (filter_size / 2 - 1), temp_stride, dst8, dst_stride, w, h,
filter_params, subpel_x_q4, x_step_q4, ref_idx, bd);
} else
-#endif // CONFIG_DUAL_FILTER
+#endif // CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
{
int intermediate_height;
int temp_stride = MAX_SB_SIZE;
diff --git a/third_party/aom/av1/common/convolve.h b/third_party/aom/av1/common/convolve.h
index 4a4dd8cdb..48b476ed5 100644
--- a/third_party/aom/av1/common/convolve.h
+++ b/third_party/aom/av1/common/convolve.h
@@ -33,6 +33,7 @@ typedef struct ConvolveParams {
int round_0;
int round_1;
int plane;
+ int do_post_rounding;
} ConvolveParams;
static INLINE ConvolveParams get_conv_params(int ref, int plane) {
@@ -40,6 +41,7 @@ static INLINE ConvolveParams get_conv_params(int ref, int plane) {
conv_params.ref = ref;
conv_params.round = CONVOLVE_OPT_ROUND;
conv_params.plane = plane;
+ conv_params.do_post_rounding = 0;
return conv_params;
}
struct AV1Common;
@@ -73,11 +75,32 @@ static INLINE ConvolveParams get_conv_params_no_round(int ref, int plane,
conv_params.dst = dst;
conv_params.dst_stride = dst_stride;
conv_params.plane = plane;
+ conv_params.do_post_rounding = 0;
return conv_params;
}
void av1_convolve_rounding(const int32_t *src, int src_stride, uint8_t *dst,
int dst_stride, int w, int h, int bits);
+
+#if CONFIG_HIGHBITDEPTH
+void av1_highbd_convolve_rounding(const int32_t *src, int src_stride,
+ uint8_t *dst8, int dst_stride, int w, int h,
+ int bits, int bd);
+
+void av1_highbd_convolve_2d(const uint16_t *src, int src_stride,
+ CONV_BUF_TYPE *dst, int dst_stride, int w, int h,
+ InterpFilterParams *filter_params_x,
+ InterpFilterParams *filter_params_y,
+ const int subpel_x_q4, const int subpel_y_q4,
+ ConvolveParams *conv_params, int bd);
+
+void av1_highbd_convolve_2d_facade(const uint8_t *src8, int src_stride,
+ uint8_t *dst, int dst_stride, int w, int h,
+ const InterpFilter *interp_filter,
+ const int subpel_x_q4, int x_step_q4,
+ const int subpel_y_q4, int y_step_q4,
+ ConvolveParams *conv_params, int bd);
+#endif
#endif // CONFIG_CONVOLVE_ROUND
void av1_convolve(const uint8_t *src, int src_stride, uint8_t *dst,
diff --git a/third_party/aom/av1/common/debugmodes.c b/third_party/aom/av1/common/debugmodes.c
index d7b31c1e4..91f33d4e3 100644
--- a/third_party/aom/av1/common/debugmodes.c
+++ b/third_party/aom/av1/common/debugmodes.c
@@ -12,6 +12,7 @@
#include <stdio.h>
#include "av1/common/blockd.h"
+#include "av1/common/enums.h"
#include "av1/common/onyxc_int.h"
static void log_frame_info(AV1_COMMON *cm, const char *str, FILE *f) {
@@ -35,11 +36,12 @@ static void print_mi_data(AV1_COMMON *cm, FILE *file, const char *descriptor,
for (mi_row = 0; mi_row < rows; mi_row++) {
fprintf(file, "%c ", prefix);
for (mi_col = 0; mi_col < cols; mi_col++) {
- fprintf(file, "%2d ", *((int *)((char *)(&mi[0]->mbmi) + member_offset)));
+ fprintf(file, "%2d ",
+ *((char *)((char *)(&mi[0]->mbmi) + member_offset)));
mi++;
}
fprintf(file, "\n");
- mi += 8;
+ mi += MAX_MIB_SIZE;
}
fprintf(file, "\n");
}
@@ -67,7 +69,7 @@ void av1_print_modes_and_motion_vectors(AV1_COMMON *cm, const char *file) {
mi++;
}
fprintf(mvs, "\n");
- mi += 8;
+ mi += MAX_MIB_SIZE;
}
fprintf(mvs, "\n");
@@ -82,7 +84,7 @@ void av1_print_modes_and_motion_vectors(AV1_COMMON *cm, const char *file) {
mi++;
}
fprintf(mvs, "\n");
- mi += 8;
+ mi += MAX_MIB_SIZE;
}
fprintf(mvs, "\n");
diff --git a/third_party/aom/av1/common/entropy.c b/third_party/aom/av1/common/entropy.c
index 14ab53ca0..3ce205e3c 100644
--- a/third_party/aom/av1/common/entropy.c
+++ b/third_party/aom/av1/common/entropy.c
@@ -135,7 +135,7 @@ const aom_prob av1_cat6_prob[] = {
};
const uint16_t band_count_table[TX_SIZES_ALL][8] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ 1, 2, 2, 3, 0, 0, 0 },
#endif
{ 1, 2, 3, 4, 3, 16 - 13, 0 }, { 1, 2, 3, 4, 11, 64 - 21, 0 },
@@ -151,7 +151,7 @@ const uint16_t band_count_table[TX_SIZES_ALL][8] = {
};
const uint16_t band_cum_count_table[TX_SIZES_ALL][8] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ 0, 1, 3, 6, 10, 13, 16, 0 },
#endif
{ 0, 1, 3, 6, 10, 13, 16, 0 }, { 0, 1, 3, 6, 10, 21, 64, 0 },
@@ -627,7 +627,6 @@ const aom_prob av1_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES] = {
// The full source code of the generating program is available in:
// tools/gen_constrained_tokenset.py
//
-#if CONFIG_NEW_TOKENSET
// Values for tokens TWO_TOKEN through CATEGORY6_TOKEN included
// in the table here : the ONE_TOKEN probability is
// removed and the probabilities rescaled.
@@ -891,275 +890,13 @@ const aom_cdf_prob av1_pareto8_tail_probs[COEFF_PROB_MODELS][TAIL_NODES] = {
{ 31131, 1448, 152, 31, 2, 1, 1, 1, 1 },
{ 31486, 1150, 107, 20, 1, 1, 1, 1, 1 },
};
-#elif CONFIG_EC_MULTISYMBOL
-// Values for tokens ONE_TOKEN through CATEGORY6_TOKEN included here.
-// ZERO_TOKEN and EOB_TOKEN are coded as flags outside this coder.
-const aom_cdf_prob
- av1_pareto8_token_probs[COEFF_PROB_MODELS][ENTROPY_TOKENS - 2] = {
- { 128, 127, 127, 126, 251, 495, 965, 1832, 3305, 25412 },
- { 256, 254, 252, 249, 492, 959, 1820, 3283, 5365, 19838 },
- { 384, 379, 374, 369, 724, 1392, 2574, 4417, 6568, 15587 },
- { 512, 503, 494, 486, 946, 1795, 3238, 5289, 7184, 12321 },
- { 640, 626, 612, 599, 1159, 2172, 3818, 5946, 7401, 9795 },
- { 768, 748, 728, 709, 1363, 2522, 4324, 6424, 7352, 7830 },
- { 896, 869, 842, 816, 1559, 2847, 4762, 6755, 7131, 6291 },
- { 1024, 988, 954, 921, 1747, 3148, 5139, 6966, 6803, 5078 },
- { 1152, 1107, 1063, 1022, 1926, 3427, 5460, 7080, 6412, 4119 },
- { 1280, 1224, 1171, 1120, 2098, 3685, 5730, 7113, 5991, 3356 },
- { 1408, 1340, 1276, 1216, 2261, 3923, 5955, 7083, 5560, 2746 },
- { 1536, 1455, 1380, 1308, 2418, 4142, 6140, 7001, 5133, 2255 },
- { 1664, 1569, 1481, 1398, 2567, 4342, 6287, 6879, 4721, 1860 },
- { 1792, 1683, 1580, 1485, 2709, 4525, 6401, 6725, 4329, 1539 },
- { 1920, 1794, 1678, 1570, 2845, 4692, 6486, 6546, 3959, 1278 },
- { 2048, 1905, 1773, 1651, 2974, 4844, 6543, 6350, 3615, 1065 },
- { 2176, 2015, 1867, 1731, 3096, 4980, 6576, 6140, 3296, 891 },
- { 2304, 2123, 1958, 1807, 3212, 5104, 6589, 5922, 3002, 747 },
- { 2432, 2231, 2048, 1882, 3322, 5214, 6581, 5698, 2732, 628 },
- { 2560, 2337, 2136, 1953, 3427, 5311, 6557, 5472, 2485, 530 },
- { 2688, 2442, 2222, 2023, 3525, 5397, 6518, 5246, 2259, 448 },
- { 2816, 2547, 2306, 2090, 3618, 5472, 6465, 5021, 2053, 380 },
- { 2944, 2650, 2388, 2154, 3706, 5537, 6401, 4799, 1866, 323 },
- { 3072, 2752, 2468, 2217, 3788, 5591, 6327, 4581, 1696, 276 },
- { 3200, 2853, 2547, 2277, 3866, 5637, 6243, 4369, 1541, 235 },
- { 3328, 2952, 2624, 2335, 3938, 5673, 6152, 4163, 1401, 202 },
- { 3456, 3051, 2699, 2391, 4006, 5702, 6054, 3962, 1274, 173 },
- { 3584, 3149, 2772, 2444, 4070, 5723, 5950, 3769, 1158, 149 },
- { 3712, 3246, 2843, 2496, 4128, 5736, 5842, 3583, 1054, 128 },
- { 3840, 3341, 2913, 2545, 4183, 5743, 5729, 3404, 959, 111 },
- { 3968, 3436, 2981, 2593, 4233, 5743, 5614, 3232, 872, 96 },
- { 4096, 3529, 3048, 2638, 4280, 5737, 5496, 3067, 794, 83 },
- { 4224, 3621, 3113, 2682, 4322, 5726, 5375, 2909, 724, 72 },
- { 4352, 3712, 3176, 2724, 4361, 5709, 5253, 2759, 659, 63 },
- { 4480, 3803, 3237, 2764, 4396, 5687, 5130, 2615, 601, 55 },
- { 4608, 3892, 3297, 2801, 4428, 5661, 5007, 2478, 548, 48 },
- { 4736, 3980, 3355, 2838, 4456, 5631, 4883, 2347, 500, 42 },
- { 4864, 4067, 3412, 2872, 4481, 5596, 4760, 2223, 456, 37 },
- { 4992, 4152, 3467, 2905, 4503, 5558, 4637, 2105, 417, 32 },
- { 5120, 4237, 3521, 2936, 4521, 5516, 4515, 1993, 381, 28 },
- { 5248, 4321, 3573, 2966, 4537, 5471, 4393, 1886, 348, 25 },
- { 5376, 4404, 3623, 2993, 4550, 5424, 4273, 1785, 318, 22 },
- { 5504, 4486, 3672, 3020, 4560, 5373, 4155, 1688, 291, 19 },
- { 5632, 4566, 3720, 3044, 4568, 5321, 4037, 1597, 266, 17 },
- { 5760, 4646, 3766, 3067, 4572, 5265, 3922, 1511, 244, 15 },
- { 5888, 4724, 3811, 3089, 4575, 5208, 3808, 1429, 223, 13 },
- { 6016, 4802, 3854, 3109, 4575, 5148, 3696, 1352, 204, 12 },
- { 6144, 4878, 3895, 3128, 4573, 5088, 3587, 1278, 187, 10 },
- { 6272, 4953, 3936, 3145, 4568, 5025, 3479, 1209, 172, 9 },
- { 6400, 5028, 3975, 3161, 4561, 4961, 3373, 1143, 158, 8 },
- { 6528, 5101, 4012, 3175, 4553, 4896, 3270, 1081, 145, 7 },
- { 6656, 5173, 4048, 3189, 4542, 4830, 3168, 1022, 133, 7 },
- { 6784, 5244, 4083, 3201, 4530, 4763, 3069, 966, 122, 6 },
- { 6912, 5314, 4117, 3212, 4516, 4694, 2973, 913, 112, 5 },
- { 7040, 5383, 4149, 3221, 4500, 4626, 2878, 863, 103, 5 },
- { 7168, 5452, 4180, 3229, 4482, 4556, 2786, 816, 95, 4 },
- { 7296, 5519, 4210, 3236, 4463, 4486, 2696, 771, 87, 4 },
- { 7424, 5585, 4238, 3242, 4442, 4416, 2609, 729, 80, 3 },
- { 7552, 5650, 4265, 3247, 4420, 4345, 2523, 689, 74, 3 },
- { 7680, 5714, 4291, 3251, 4396, 4274, 2440, 651, 68, 3 },
- { 7808, 5777, 4315, 3254, 4371, 4203, 2359, 616, 63, 2 },
- { 7936, 5838, 4339, 3255, 4345, 4132, 2281, 582, 58, 2 },
- { 8064, 5899, 4361, 3256, 4318, 4061, 2204, 550, 53, 2 },
- { 8192, 5959, 4382, 3255, 4289, 3990, 2130, 520, 49, 2 },
- { 8320, 6018, 4402, 3254, 4259, 3919, 2057, 492, 45, 2 },
- { 8448, 6075, 4421, 3252, 4229, 3848, 1987, 465, 42, 1 },
- { 8576, 6133, 4438, 3248, 4197, 3778, 1919, 439, 39, 1 },
- { 8704, 6188, 4455, 3244, 4164, 3708, 1853, 415, 36, 1 },
- { 8832, 6243, 4470, 3239, 4131, 3638, 1789, 392, 33, 1 },
- { 8960, 6297, 4484, 3233, 4096, 3569, 1727, 371, 30, 1 },
- { 9088, 6349, 4497, 3226, 4061, 3500, 1667, 351, 28, 1 },
- { 9216, 6401, 4509, 3219, 4025, 3432, 1608, 331, 26, 1 },
- { 9344, 6452, 4520, 3210, 3989, 3364, 1551, 313, 24, 1 },
- { 9472, 6501, 4530, 3201, 3952, 3297, 1496, 296, 22, 1 },
- { 9600, 6550, 4539, 3191, 3914, 3230, 1443, 280, 20, 1 },
- { 9728, 6597, 4547, 3180, 3875, 3164, 1392, 265, 19, 1 },
- { 9856, 6644, 4554, 3169, 3836, 3098, 1342, 250, 18, 1 },
- { 9984, 6690, 4560, 3157, 3796, 3034, 1293, 237, 16, 1 },
- { 10112, 6734, 4565, 3144, 3756, 2970, 1247, 224, 15, 1 },
- { 10240, 6778, 4568, 3131, 3716, 2907, 1202, 211, 14, 1 },
- { 10368, 6821, 4571, 3117, 3675, 2844, 1158, 200, 13, 1 },
- { 10496, 6862, 4573, 3102, 3634, 2783, 1116, 189, 12, 1 },
- { 10624, 6903, 4574, 3087, 3592, 2722, 1075, 179, 11, 1 },
- { 10752, 6942, 4575, 3071, 3551, 2662, 1035, 169, 10, 1 },
- { 10880, 6981, 4574, 3054, 3508, 2603, 997, 160, 10, 1 },
- { 11008, 7019, 4572, 3038, 3466, 2544, 960, 151, 9, 1 },
- { 11136, 7055, 4570, 3020, 3424, 2487, 924, 143, 8, 1 },
- { 11264, 7091, 4566, 3002, 3381, 2430, 890, 135, 8, 1 },
- { 11392, 7126, 4563, 2984, 3338, 2374, 856, 127, 7, 1 },
- { 11520, 7159, 4557, 2965, 3295, 2319, 824, 121, 7, 1 },
- { 11648, 7193, 4552, 2945, 3252, 2264, 793, 114, 6, 1 },
- { 11776, 7224, 4545, 2925, 3209, 2211, 763, 108, 6, 1 },
- { 11904, 7255, 4538, 2905, 3165, 2159, 734, 102, 5, 1 },
- { 12032, 7285, 4530, 2884, 3122, 2107, 706, 96, 5, 1 },
- { 12160, 7314, 4520, 2863, 3079, 2056, 679, 91, 5, 1 },
- { 12288, 7341, 4511, 2842, 3036, 2006, 653, 86, 4, 1 },
- { 12416, 7368, 4500, 2820, 2993, 1957, 628, 81, 4, 1 },
- { 12544, 7394, 4489, 2797, 2949, 1909, 604, 77, 4, 1 },
- { 12672, 7419, 4477, 2775, 2906, 1861, 581, 73, 3, 1 },
- { 12800, 7443, 4464, 2752, 2863, 1815, 558, 69, 3, 1 },
- { 12928, 7466, 4451, 2729, 2820, 1769, 536, 65, 3, 1 },
- { 13056, 7488, 4437, 2705, 2777, 1724, 516, 61, 3, 1 },
- { 13184, 7509, 4422, 2682, 2734, 1680, 495, 58, 3, 1 },
- { 13312, 7529, 4406, 2658, 2692, 1637, 476, 55, 2, 1 },
- { 13440, 7548, 4390, 2633, 2650, 1595, 457, 52, 2, 1 },
- { 13568, 7567, 4373, 2609, 2607, 1553, 439, 49, 2, 1 },
- { 13696, 7583, 4356, 2584, 2565, 1513, 422, 46, 2, 1 },
- { 13824, 7600, 4337, 2559, 2523, 1473, 405, 44, 2, 1 },
- { 13952, 7615, 4319, 2533, 2482, 1434, 389, 41, 2, 1 },
- { 14080, 7629, 4300, 2508, 2441, 1395, 373, 39, 2, 1 },
- { 14208, 7643, 4280, 2482, 2400, 1358, 358, 37, 1, 1 },
- { 14336, 7655, 4259, 2457, 2359, 1321, 344, 35, 1, 1 },
- { 14464, 7667, 4238, 2431, 2318, 1285, 330, 33, 1, 1 },
- { 14592, 7677, 4217, 2405, 2278, 1250, 316, 31, 1, 1 },
- { 14720, 7687, 4195, 2378, 2238, 1215, 304, 29, 1, 1 },
- { 14848, 7696, 4172, 2352, 2198, 1181, 291, 28, 1, 1 },
- { 14976, 7703, 4149, 2326, 2159, 1148, 279, 26, 1, 1 },
- { 15104, 7710, 4125, 2299, 2119, 1116, 268, 25, 1, 1 },
- { 15232, 7715, 4101, 2272, 2081, 1085, 257, 23, 1, 1 },
- { 15360, 7721, 4076, 2245, 2042, 1054, 246, 22, 1, 1 },
- { 15488, 7724, 4051, 2219, 2004, 1023, 236, 21, 1, 1 },
- { 15616, 7727, 4025, 2192, 1966, 994, 226, 20, 1, 1 },
- { 15744, 7729, 3999, 2164, 1929, 965, 217, 19, 1, 1 },
- { 15872, 7731, 3972, 2137, 1892, 937, 207, 18, 1, 1 },
- { 16000, 7731, 3945, 2110, 1855, 909, 199, 17, 1, 1 },
- { 16128, 7730, 3918, 2083, 1819, 882, 190, 16, 1, 1 },
- { 16256, 7728, 3890, 2056, 1783, 856, 182, 15, 1, 1 },
- { 16384, 7725, 3862, 2029, 1747, 831, 174, 14, 1, 1 },
- { 16512, 7721, 3833, 2002, 1712, 806, 167, 13, 1, 1 },
- { 16640, 7717, 3804, 1975, 1677, 781, 160, 12, 1, 1 },
- { 16768, 7712, 3775, 1947, 1642, 757, 153, 12, 1, 1 },
- { 16896, 7706, 3745, 1920, 1608, 734, 146, 11, 1, 1 },
- { 17024, 7699, 3714, 1893, 1575, 711, 140, 10, 1, 1 },
- { 17152, 7690, 3684, 1866, 1541, 689, 134, 10, 1, 1 },
- { 17280, 7681, 3653, 1839, 1508, 668, 128, 9, 1, 1 },
- { 17408, 7671, 3621, 1812, 1476, 647, 122, 9, 1, 1 },
- { 17536, 7660, 3590, 1785, 1444, 626, 117, 8, 1, 1 },
- { 17664, 7648, 3558, 1758, 1412, 606, 112, 8, 1, 1 },
- { 17792, 7635, 3526, 1731, 1381, 587, 107, 7, 1, 1 },
- { 17920, 7622, 3493, 1704, 1350, 568, 102, 7, 1, 1 },
- { 18048, 7607, 3461, 1678, 1319, 549, 98, 6, 1, 1 },
- { 18176, 7592, 3428, 1651, 1289, 531, 93, 6, 1, 1 },
- { 18304, 7575, 3394, 1625, 1259, 514, 89, 6, 1, 1 },
- { 18432, 7558, 3361, 1598, 1230, 497, 85, 5, 1, 1 },
- { 18560, 7540, 3327, 1572, 1201, 480, 81, 5, 1, 1 },
- { 18688, 7520, 3293, 1546, 1173, 464, 77, 5, 1, 1 },
- { 18816, 7500, 3258, 1520, 1145, 448, 74, 5, 1, 1 },
- { 18944, 7480, 3224, 1494, 1117, 433, 70, 4, 1, 1 },
- { 19072, 7458, 3189, 1468, 1090, 418, 67, 4, 1, 1 },
- { 19200, 7435, 3154, 1442, 1063, 404, 64, 4, 1, 1 },
- { 19328, 7410, 3119, 1417, 1037, 390, 61, 4, 1, 1 },
- { 19456, 7386, 3084, 1392, 1011, 376, 58, 3, 1, 1 },
- { 19584, 7361, 3048, 1366, 986, 363, 55, 3, 1, 1 },
- { 19712, 7335, 3012, 1341, 960, 350, 53, 3, 1, 1 },
- { 19840, 7307, 2977, 1316, 936, 337, 50, 3, 1, 1 },
- { 19968, 7279, 2941, 1291, 911, 325, 48, 3, 1, 1 },
- { 20096, 7251, 2905, 1267, 887, 313, 45, 2, 1, 1 },
- { 20224, 7220, 2868, 1243, 864, 302, 43, 2, 1, 1 },
- { 20352, 7189, 2832, 1218, 841, 291, 41, 2, 1, 1 },
- { 20480, 7158, 2795, 1194, 818, 280, 39, 2, 1, 1 },
- { 20608, 7124, 2759, 1170, 796, 270, 37, 2, 1, 1 },
- { 20736, 7091, 2722, 1147, 774, 259, 35, 2, 1, 1 },
- { 20864, 7056, 2685, 1123, 752, 250, 34, 2, 1, 1 },
- { 20992, 7021, 2648, 1100, 731, 240, 32, 2, 1, 1 },
- { 21120, 6985, 2612, 1077, 710, 231, 30, 1, 1, 1 },
- { 21248, 6948, 2574, 1054, 690, 222, 29, 1, 1, 1 },
- { 21376, 6911, 2537, 1031, 670, 213, 27, 1, 1, 1 },
- { 21504, 6872, 2500, 1008, 650, 205, 26, 1, 1, 1 },
- { 21632, 6831, 2463, 986, 631, 197, 25, 1, 1, 1 },
- { 21760, 6791, 2426, 964, 612, 189, 23, 1, 1, 1 },
- { 21888, 6749, 2389, 942, 594, 181, 22, 1, 1, 1 },
- { 22016, 6707, 2351, 921, 575, 174, 21, 1, 1, 1 },
- { 22144, 6663, 2314, 899, 558, 167, 20, 1, 1, 1 },
- { 22272, 6619, 2277, 878, 540, 160, 19, 1, 1, 1 },
- { 22400, 6574, 2240, 857, 523, 153, 18, 1, 1, 1 },
- { 22528, 6529, 2202, 836, 507, 146, 17, 1, 1, 1 },
- { 22656, 6482, 2165, 816, 490, 140, 16, 1, 1, 1 },
- { 22784, 6435, 2128, 795, 474, 134, 15, 1, 1, 1 },
- { 22912, 6386, 2091, 775, 459, 128, 14, 1, 1, 1 },
- { 23040, 6336, 2054, 756, 443, 123, 13, 1, 1, 1 },
- { 23168, 6286, 2017, 736, 428, 117, 13, 1, 1, 1 },
- { 23296, 6234, 1980, 717, 414, 112, 12, 1, 1, 1 },
- { 23424, 6183, 1943, 698, 399, 107, 11, 1, 1, 1 },
- { 23552, 6130, 1906, 679, 385, 102, 11, 1, 1, 1 },
- { 23680, 6077, 1869, 660, 372, 97, 10, 1, 1, 1 },
- { 23808, 6022, 1833, 642, 358, 93, 9, 1, 1, 1 },
- { 23936, 5966, 1796, 624, 345, 89, 9, 1, 1, 1 },
- { 24064, 5910, 1760, 606, 333, 84, 8, 1, 1, 1 },
- { 24192, 5853, 1724, 588, 320, 80, 8, 1, 1, 1 },
- { 24320, 5796, 1687, 571, 308, 76, 7, 1, 1, 1 },
- { 24448, 5735, 1651, 554, 297, 73, 7, 1, 1, 1 },
- { 24576, 5677, 1615, 537, 285, 69, 6, 1, 1, 1 },
- { 24704, 5615, 1579, 521, 274, 66, 6, 1, 1, 1 },
- { 24832, 5554, 1544, 504, 263, 62, 6, 1, 1, 1 },
- { 24960, 5492, 1508, 488, 253, 59, 5, 1, 1, 1 },
- { 25088, 5428, 1473, 473, 242, 56, 5, 1, 1, 1 },
- { 25216, 5364, 1438, 457, 232, 53, 5, 1, 1, 1 },
- { 25344, 5300, 1403, 442, 222, 50, 4, 1, 1, 1 },
- { 25472, 5233, 1368, 427, 213, 48, 4, 1, 1, 1 },
- { 25600, 5166, 1334, 412, 204, 45, 4, 1, 1, 1 },
- { 25728, 5098, 1299, 398, 195, 43, 4, 1, 1, 1 },
- { 25856, 5030, 1266, 384, 186, 40, 3, 1, 1, 1 },
- { 25984, 4960, 1232, 370, 178, 38, 3, 1, 1, 1 },
- { 26112, 4890, 1198, 356, 170, 36, 3, 1, 1, 1 },
- { 26240, 4819, 1164, 343, 162, 34, 3, 1, 1, 1 },
- { 26368, 4748, 1132, 329, 154, 32, 2, 1, 1, 1 },
- { 26496, 4675, 1098, 317, 147, 30, 2, 1, 1, 1 },
- { 26624, 4602, 1066, 304, 139, 28, 2, 1, 1, 1 },
- { 26752, 4527, 1034, 292, 132, 26, 2, 1, 1, 1 },
- { 26880, 4451, 1001, 280, 126, 25, 2, 1, 1, 1 },
- { 27008, 4375, 970, 268, 119, 23, 2, 1, 1, 1 },
- { 27136, 4299, 938, 256, 113, 21, 2, 1, 1, 1 },
- { 27264, 4221, 907, 245, 107, 20, 1, 1, 1, 1 },
- { 27392, 4142, 876, 234, 101, 19, 1, 1, 1, 1 },
- { 27520, 4063, 846, 223, 95, 17, 1, 1, 1, 1 },
- { 27648, 3982, 815, 213, 90, 16, 1, 1, 1, 1 },
- { 27776, 3900, 786, 202, 85, 15, 1, 1, 1, 1 },
- { 27904, 3818, 756, 192, 80, 14, 1, 1, 1, 1 },
- { 28032, 3734, 727, 183, 75, 13, 1, 1, 1, 1 },
- { 28160, 3651, 698, 173, 70, 12, 1, 1, 1, 1 },
- { 28288, 3566, 669, 164, 66, 11, 1, 1, 1, 1 },
- { 28416, 3481, 641, 155, 61, 10, 1, 1, 1, 1 },
- { 28544, 3393, 614, 147, 57, 9, 1, 1, 1, 1 },
- { 28672, 3306, 586, 138, 53, 9, 1, 1, 1, 1 },
- { 28800, 3217, 559, 130, 50, 8, 1, 1, 1, 1 },
- { 28928, 3128, 533, 122, 46, 7, 1, 1, 1, 1 },
- { 29056, 3037, 507, 114, 43, 7, 1, 1, 1, 1 },
- { 29184, 2947, 481, 107, 39, 6, 1, 1, 1, 1 },
- { 29312, 2855, 456, 100, 36, 5, 1, 1, 1, 1 },
- { 29440, 2762, 431, 93, 33, 5, 1, 1, 1, 1 },
- { 29568, 2668, 407, 86, 31, 4, 1, 1, 1, 1 },
- { 29696, 2573, 383, 80, 28, 4, 1, 1, 1, 1 },
- { 29824, 2478, 359, 74, 25, 4, 1, 1, 1, 1 },
- { 29952, 2381, 337, 68, 23, 3, 1, 1, 1, 1 },
- { 30080, 2284, 314, 62, 21, 3, 1, 1, 1, 1 },
- { 30208, 2185, 293, 57, 19, 2, 1, 1, 1, 1 },
- { 30336, 2086, 271, 52, 17, 2, 1, 1, 1, 1 },
- { 30464, 1986, 250, 47, 15, 2, 1, 1, 1, 1 },
- { 30592, 1885, 230, 42, 13, 2, 1, 1, 1, 1 },
- { 30720, 1782, 211, 38, 12, 1, 1, 1, 1, 1 },
- { 30848, 1679, 192, 34, 10, 1, 1, 1, 1, 1 },
- { 30976, 1575, 173, 30, 9, 1, 1, 1, 1, 1 },
- { 31104, 1469, 156, 26, 8, 1, 1, 1, 1, 1 },
- { 31232, 1364, 138, 23, 6, 1, 1, 1, 1, 1 },
- { 31360, 1257, 122, 19, 5, 1, 1, 1, 1, 1 },
- { 31488, 1149, 106, 16, 4, 1, 1, 1, 1, 1 },
- { 31616, 1038, 91, 14, 4, 1, 1, 1, 1, 1 },
- { 31744, 928, 77, 11, 3, 1, 1, 1, 1, 1 },
- { 31872, 816, 64, 9, 2, 1, 1, 1, 1, 1 },
- { 32000, 703, 51, 7, 2, 1, 1, 1, 1, 1 },
- { 32128, 589, 40, 5, 1, 1, 1, 1, 1, 1 },
- { 32256, 473, 29, 4, 1, 1, 1, 1, 1, 1 },
- { 32384, 357, 19, 2, 1, 1, 1, 1, 1, 1 },
- { 32512, 238, 11, 1, 1, 1, 1, 1, 1, 1 },
- { 32640, 117, 4, 1, 1, 1, 1, 1, 1, 1 },
- };
-#endif // CONFIG_NEW_TOKENSET
/* clang-format off */
#if CONFIG_Q_ADAPT_PROBS
const av1_coeff_probs_model
default_qctx_coef_probs[QCTX_BINS][TX_SIZES][PLANE_TYPES] = {
{ // Q_Index 0
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ // TX_SIZE 0
{ // Y plane
{ // Intra
@@ -1825,7 +1562,7 @@ default_qctx_coef_probs[QCTX_BINS][TX_SIZES][PLANE_TYPES] = {
#endif // CONFIG_TX64X64
},
{ // Q_Index 1
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ // TX_SIZE 0
{ // Y plane
{ // Intra
@@ -2491,7 +2228,7 @@ default_qctx_coef_probs[QCTX_BINS][TX_SIZES][PLANE_TYPES] = {
#endif // CONFIG_TX64X64
},
{ // Q_Index 2
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ // TX_SIZE 0
{ // Y plane
{ // Intra
@@ -3157,7 +2894,7 @@ default_qctx_coef_probs[QCTX_BINS][TX_SIZES][PLANE_TYPES] = {
#endif // CONFIG_TX64X64
},
{ // Q_Index 3
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ // TX_SIZE 0
{ // Y plane
{ // Intra
@@ -3824,7 +3561,6 @@ default_qctx_coef_probs[QCTX_BINS][TX_SIZES][PLANE_TYPES] = {
},
};
#else
-#if CONFIG_NEW_TOKENSET
static const av1_coeff_probs_model default_coef_probs_4x4[PLANE_TYPES] = {
{ // Y plane
{ // Intra
@@ -4249,343 +3985,6 @@ static const av1_coeff_probs_model default_coef_probs_32x32[PLANE_TYPES] = {
}
}
};
-#else // CONFIG_NEW_TOKENSET
-static const av1_coeff_probs_model default_coef_probs_4x4[PLANE_TYPES] = {
- { // Y plane
- { // Intra
- { // Band 0
- { 195, 29, 183 }, { 84, 49, 136 }, { 8, 42, 71 }
- }, { // Band 1
- { 31, 107, 169 }, { 35, 99, 159 }, { 17, 82, 140 },
- { 8, 66, 114 }, { 2, 44, 76 }, { 1, 19, 32 }
- }, { // Band 2
- { 40, 132, 201 }, { 29, 114, 187 }, { 13, 91, 157 },
- { 7, 75, 127 }, { 3, 58, 95 }, { 1, 28, 47 }
- }, { // Band 3
- { 69, 142, 221 }, { 42, 122, 201 }, { 15, 91, 159 },
- { 6, 67, 121 }, { 1, 42, 77 }, { 1, 17, 31 }
- }, { // Band 4
- { 102, 148, 228 }, { 67, 117, 204 }, { 17, 82, 154 },
- { 6, 59, 114 }, { 2, 39, 75 }, { 1, 15, 29 }
- }, { // Band 5
- { 156, 57, 233 }, { 119, 57, 212 }, { 58, 48, 163 },
- { 29, 40, 124 }, { 12, 30, 81 }, { 3, 12, 31 }
- }
- }, { // Inter
- { // Band 0
- { 191, 107, 226 }, { 124, 117, 204 }, { 25, 99, 155 }
- }, { // Band 1
- { 29, 148, 210 }, { 37, 126, 194 }, { 8, 93, 157 },
- { 2, 68, 118 }, { 1, 39, 69 }, { 1, 17, 33 }
- }, { // Band 2
- { 41, 151, 213 }, { 27, 123, 193 }, { 3, 82, 144 },
- { 1, 58, 105 }, { 1, 32, 60 }, { 1, 13, 26 }
- }, { // Band 3
- { 59, 159, 220 }, { 23, 126, 198 }, { 4, 88, 151 },
- { 1, 66, 114 }, { 1, 38, 71 }, { 1, 18, 34 }
- }, { // Band 4
- { 114, 136, 232 }, { 51, 114, 207 }, { 11, 83, 155 },
- { 3, 56, 105 }, { 1, 33, 65 }, { 1, 17, 34 }
- }, { // Band 5
- { 149, 65, 234 }, { 121, 57, 215 }, { 61, 49, 166 },
- { 28, 36, 114 }, { 12, 25, 76 }, { 3, 16, 42 }
- }
- }
- }, { // UV plane
- { // Intra
- { // Band 0
- { 214, 49, 220 }, { 132, 63, 188 }, { 42, 65, 137 }
- }, { // Band 1
- { 85, 137, 221 }, { 104, 131, 216 }, { 49, 111, 192 },
- { 21, 87, 155 }, { 2, 49, 87 }, { 1, 16, 28 }
- }, { // Band 2
- { 89, 163, 230 }, { 90, 137, 220 }, { 29, 100, 183 },
- { 10, 70, 135 }, { 2, 42, 81 }, { 1, 17, 33 }
- }, { // Band 3
- { 108, 167, 237 }, { 55, 133, 222 }, { 15, 97, 179 },
- { 4, 72, 135 }, { 1, 45, 85 }, { 1, 19, 38 }
- }, { // Band 4
- { 124, 146, 240 }, { 66, 124, 224 }, { 17, 88, 175 },
- { 4, 58, 122 }, { 1, 36, 75 }, { 1, 18, 37 }
- }, { // Band 5
- { 141, 79, 241 }, { 126, 70, 227 }, { 66, 58, 182 },
- { 30, 44, 136 }, { 12, 34, 96 }, { 2, 20, 47 }
- }
- }, { // Inter
- { // Band 0
- { 229, 99, 249 }, { 143, 111, 235 }, { 46, 109, 192 }
- }, { // Band 1
- { 82, 158, 236 }, { 94, 146, 224 }, { 25, 117, 191 },
- { 9, 87, 149 }, { 3, 56, 99 }, { 1, 33, 57 }
- }, { // Band 2
- { 83, 167, 237 }, { 68, 145, 222 }, { 10, 103, 177 },
- { 2, 72, 131 }, { 1, 41, 79 }, { 1, 20, 39 }
- }, { // Band 3
- { 99, 167, 239 }, { 47, 141, 224 }, { 10, 104, 178 },
- { 2, 73, 133 }, { 1, 44, 85 }, { 1, 22, 47 }
- }, { // Band 4
- { 127, 145, 243 }, { 71, 129, 228 }, { 17, 93, 177 },
- { 3, 61, 124 }, { 1, 41, 84 }, { 1, 21, 52 }
- }, { // Band 5
- { 157, 78, 244 }, { 140, 72, 231 }, { 69, 58, 184 },
- { 31, 44, 137 }, { 14, 38, 105 }, { 8, 23, 61 }
- }
- }
- }
-};
-
-static const av1_coeff_probs_model default_coef_probs_8x8[PLANE_TYPES] = {
- { // Y plane
- { // Intra
- { // Band 0
- { 125, 34, 187 }, { 52, 41, 133 }, { 6, 31, 56 }
- }, { // Band 1
- { 37, 109, 153 }, { 51, 102, 147 }, { 23, 87, 128 },
- { 8, 67, 101 }, { 1, 41, 63 }, { 1, 19, 29 }
- }, { // Band 2
- { 31, 154, 185 }, { 17, 127, 175 }, { 6, 96, 145 },
- { 2, 73, 114 }, { 1, 51, 82 }, { 1, 28, 45 }
- }, { // Band 3
- { 23, 163, 200 }, { 10, 131, 185 }, { 2, 93, 148 },
- { 1, 67, 111 }, { 1, 41, 69 }, { 1, 14, 24 }
- }, { // Band 4
- { 29, 176, 217 }, { 12, 145, 201 }, { 3, 101, 156 },
- { 1, 69, 111 }, { 1, 39, 63 }, { 1, 14, 23 }
- }, { // Band 5
- { 57, 192, 233 }, { 25, 154, 215 }, { 6, 109, 167 },
- { 3, 78, 118 }, { 1, 48, 69 }, { 1, 21, 29 }
- }
- }, { // Inter
- { // Band 0
- { 202, 105, 245 }, { 108, 106, 216 }, { 18, 90, 144 }
- }, { // Band 1
- { 33, 172, 219 }, { 64, 149, 206 }, { 14, 117, 177 },
- { 5, 90, 141 }, { 2, 61, 95 }, { 1, 37, 57 }
- }, { // Band 2
- { 33, 179, 220 }, { 11, 140, 198 }, { 1, 89, 148 },
- { 1, 60, 104 }, { 1, 33, 57 }, { 1, 12, 21 }
- }, { // Band 3
- { 30, 181, 221 }, { 8, 141, 198 }, { 1, 87, 145 },
- { 1, 58, 100 }, { 1, 31, 55 }, { 1, 12, 20 }
- }, { // Band 4
- { 32, 186, 224 }, { 7, 142, 198 }, { 1, 86, 143 },
- { 1, 58, 100 }, { 1, 31, 55 }, { 1, 12, 22 }
- }, { // Band 5
- { 57, 192, 227 }, { 20, 143, 204 }, { 3, 96, 154 },
- { 1, 68, 112 }, { 1, 42, 69 }, { 1, 19, 32 }
- }
- }
- }, { // UV plane
- { // Intra
- { // Band 0
- { 212, 35, 215 }, { 113, 47, 169 }, { 29, 48, 105 }
- }, { // Band 1
- { 74, 129, 203 }, { 106, 120, 203 }, { 49, 107, 178 },
- { 19, 84, 144 }, { 4, 50, 84 }, { 1, 15, 25 }
- }, { // Band 2
- { 71, 172, 217 }, { 44, 141, 209 }, { 15, 102, 173 },
- { 6, 76, 133 }, { 2, 51, 89 }, { 1, 24, 42 }
- }, { // Band 3
- { 64, 185, 231 }, { 31, 148, 216 }, { 8, 103, 175 },
- { 3, 74, 131 }, { 1, 46, 81 }, { 1, 18, 30 }
- }, { // Band 4
- { 65, 196, 235 }, { 25, 157, 221 }, { 5, 105, 174 },
- { 1, 67, 120 }, { 1, 38, 69 }, { 1, 15, 30 }
- }, { // Band 5
- { 65, 204, 238 }, { 30, 156, 224 }, { 7, 107, 177 },
- { 2, 70, 124 }, { 1, 42, 73 }, { 1, 18, 34 }
- }
- }, { // Inter
- { // Band 0
- { 225, 86, 251 }, { 144, 104, 235 }, { 42, 99, 181 }
- }, { // Band 1
- { 85, 175, 239 }, { 112, 165, 229 }, { 29, 136, 200 },
- { 12, 103, 162 }, { 6, 77, 123 }, { 2, 53, 84 }
- }, { // Band 2
- { 75, 183, 239 }, { 30, 155, 221 }, { 3, 106, 171 },
- { 1, 74, 128 }, { 1, 44, 76 }, { 1, 17, 28 }
- }, { // Band 3
- { 73, 185, 240 }, { 27, 159, 222 }, { 2, 107, 172 },
- { 1, 75, 127 }, { 1, 42, 73 }, { 1, 17, 29 }
- }, { // Band 4
- { 62, 190, 238 }, { 21, 159, 222 }, { 2, 107, 172 },
- { 1, 72, 122 }, { 1, 40, 71 }, { 1, 18, 32 }
- }, { // Band 5
- { 61, 199, 240 }, { 27, 161, 226 }, { 4, 113, 180 },
- { 1, 76, 129 }, { 1, 46, 80 }, { 1, 23, 41 }
- }
- }
- }
-};
-
-static const av1_coeff_probs_model default_coef_probs_16x16[PLANE_TYPES] = {
- { // Y plane
- { // Intra
- { // Band 0
- { 7, 27, 153 }, { 5, 30, 95 }, { 1, 16, 30 }
- }, { // Band 1
- { 50, 75, 127 }, { 57, 75, 124 }, { 27, 67, 108 },
- { 10, 54, 86 }, { 1, 33, 52 }, { 1, 12, 18 }
- }, { // Band 2
- { 43, 125, 151 }, { 26, 108, 148 }, { 7, 83, 122 },
- { 2, 59, 89 }, { 1, 38, 60 }, { 1, 17, 27 }
- }, { // Band 3
- { 23, 144, 163 }, { 13, 112, 154 }, { 2, 75, 117 },
- { 1, 50, 81 }, { 1, 31, 51 }, { 1, 14, 23 }
- }, { // Band 4
- { 18, 162, 185 }, { 6, 123, 171 }, { 1, 78, 125 },
- { 1, 51, 86 }, { 1, 31, 54 }, { 1, 14, 23 }
- }, { // Band 5
- { 15, 199, 227 }, { 3, 150, 204 }, { 1, 91, 146 },
- { 1, 55, 95 }, { 1, 30, 53 }, { 1, 11, 20 }
- }
- }, { // Inter
- { // Band 0
- { 19, 55, 240 }, { 19, 59, 196 }, { 3, 52, 105 }
- }, { // Band 1
- { 41, 166, 207 }, { 104, 153, 199 }, { 31, 123, 181 },
- { 14, 101, 152 }, { 5, 72, 106 }, { 1, 36, 52 }
- }, { // Band 2
- { 35, 176, 211 }, { 12, 131, 190 }, { 2, 88, 144 },
- { 1, 60, 101 }, { 1, 36, 60 }, { 1, 16, 28 }
- }, { // Band 3
- { 28, 183, 213 }, { 8, 134, 191 }, { 1, 86, 142 },
- { 1, 56, 96 }, { 1, 30, 53 }, { 1, 12, 20 }
- }, { // Band 4
- { 20, 190, 215 }, { 4, 135, 192 }, { 1, 84, 139 },
- { 1, 53, 91 }, { 1, 28, 49 }, { 1, 11, 20 }
- }, { // Band 5
- { 13, 196, 216 }, { 2, 137, 192 }, { 1, 86, 143 },
- { 1, 57, 99 }, { 1, 32, 56 }, { 1, 13, 24 }
- }
- }
- }, { // UV plane
- { // Intra
- { // Band 0
- { 211, 29, 217 }, { 96, 47, 156 }, { 22, 43, 87 }
- }, { // Band 1
- { 78, 120, 193 }, { 111, 116, 186 }, { 46, 102, 164 },
- { 15, 80, 128 }, { 2, 49, 76 }, { 1, 18, 28 }
- }, { // Band 2
- { 71, 161, 203 }, { 42, 132, 192 }, { 10, 98, 150 },
- { 3, 69, 109 }, { 1, 44, 70 }, { 1, 18, 29 }
- }, { // Band 3
- { 57, 186, 211 }, { 30, 140, 196 }, { 4, 93, 146 },
- { 1, 62, 102 }, { 1, 38, 65 }, { 1, 16, 27 }
- }, { // Band 4
- { 47, 199, 217 }, { 14, 145, 196 }, { 1, 88, 142 },
- { 1, 57, 98 }, { 1, 36, 62 }, { 1, 15, 26 }
- }, { // Band 5
- { 26, 219, 229 }, { 5, 155, 207 }, { 1, 94, 151 },
- { 1, 60, 104 }, { 1, 36, 62 }, { 1, 16, 28 }
- }
- }, { // Inter
- { // Band 0
- { 233, 29, 248 }, { 146, 47, 220 }, { 43, 52, 140 }
- }, { // Band 1
- { 100, 163, 232 }, { 179, 161, 222 }, { 63, 142, 204 },
- { 37, 113, 174 }, { 26, 89, 137 }, { 18, 68, 97 }
- }, { // Band 2
- { 85, 181, 230 }, { 32, 146, 209 }, { 7, 100, 164 },
- { 3, 71, 121 }, { 1, 45, 77 }, { 1, 18, 30 }
- }, { // Band 3
- { 65, 187, 230 }, { 20, 148, 207 }, { 2, 97, 159 },
- { 1, 68, 116 }, { 1, 40, 70 }, { 1, 14, 29 }
- }, { // Band 4
- { 40, 194, 227 }, { 8, 147, 204 }, { 1, 94, 155 },
- { 1, 65, 112 }, { 1, 39, 66 }, { 1, 14, 26 }
- }, { // Band 5
- { 16, 208, 228 }, { 3, 151, 207 }, { 1, 98, 160 },
- { 1, 67, 117 }, { 1, 41, 74 }, { 1, 17, 31 }
- }
- }
- }
-};
-
-static const av1_coeff_probs_model default_coef_probs_32x32[PLANE_TYPES] = {
- { // Y plane
- { // Intra
- { // Band 0
- { 17, 38, 140 }, { 7, 34, 80 }, { 1, 17, 29 }
- }, { // Band 1
- { 37, 75, 128 }, { 41, 76, 128 }, { 26, 66, 116 },
- { 12, 52, 94 }, { 2, 32, 55 }, { 1, 10, 16 }
- }, { // Band 2
- { 50, 127, 154 }, { 37, 109, 152 }, { 16, 82, 121 },
- { 5, 59, 85 }, { 1, 35, 54 }, { 1, 13, 20 }
- }, { // Band 3
- { 40, 142, 167 }, { 17, 110, 157 }, { 2, 71, 112 },
- { 1, 44, 72 }, { 1, 27, 45 }, { 1, 11, 17 }
- }, { // Band 4
- { 30, 175, 188 }, { 9, 124, 169 }, { 1, 74, 116 },
- { 1, 48, 78 }, { 1, 30, 49 }, { 1, 11, 18 }
- }, { // Band 5
- { 10, 222, 223 }, { 2, 150, 194 }, { 1, 83, 128 },
- { 1, 48, 79 }, { 1, 27, 45 }, { 1, 11, 17 }
- }
- }, { // Inter
- { // Band 0
- { 36, 41, 235 }, { 29, 36, 193 }, { 10, 27, 111 }
- }, { // Band 1
- { 85, 165, 222 }, { 177, 162, 215 }, { 110, 135, 195 },
- { 57, 113, 168 }, { 23, 83, 120 }, { 10, 49, 61 }
- }, { // Band 2
- { 85, 190, 223 }, { 36, 139, 200 }, { 5, 90, 146 },
- { 1, 60, 103 }, { 1, 38, 65 }, { 1, 18, 30 }
- }, { // Band 3
- { 72, 202, 223 }, { 23, 141, 199 }, { 2, 86, 140 },
- { 1, 56, 97 }, { 1, 36, 61 }, { 1, 16, 27 }
- }, { // Band 4
- { 55, 218, 225 }, { 13, 145, 200 }, { 1, 86, 141 },
- { 1, 57, 99 }, { 1, 35, 61 }, { 1, 13, 22 }
- }, { // Band 5
- { 15, 235, 212 }, { 1, 132, 184 }, { 1, 84, 139 },
- { 1, 57, 97 }, { 1, 34, 56 }, { 1, 14, 23 }
- }
- }
- }, { // UV plane
- { // Intra
- { // Band 0
- { 181, 21, 201 }, { 61, 37, 123 }, { 10, 38, 71 }
- }, { // Band 1
- { 47, 106, 172 }, { 95, 104, 173 }, { 42, 93, 159 },
- { 18, 77, 131 }, { 4, 50, 81 }, { 1, 17, 23 }
- }, { // Band 2
- { 62, 147, 199 }, { 44, 130, 189 }, { 28, 102, 154 },
- { 18, 75, 115 }, { 2, 44, 65 }, { 1, 12, 19 }
- }, { // Band 3
- { 55, 153, 210 }, { 24, 130, 194 }, { 3, 93, 146 },
- { 1, 61, 97 }, { 1, 31, 50 }, { 1, 10, 16 }
- }, { // Band 4
- { 49, 186, 223 }, { 17, 148, 204 }, { 1, 96, 142 },
- { 1, 53, 83 }, { 1, 26, 44 }, { 1, 11, 17 }
- }, { // Band 5
- { 13, 217, 212 }, { 2, 136, 180 }, { 1, 78, 124 },
- { 1, 50, 83 }, { 1, 29, 49 }, { 1, 14, 23 }
- }
- }, { // Inter
- { // Band 0
- { 197, 13, 247 }, { 82, 17, 222 }, { 25, 17, 162 }
- }, { // Band 1
- { 126, 186, 247 }, { 234, 191, 243 }, { 176, 177, 234 },
- { 104, 158, 220 }, { 66, 128, 186 }, { 55, 90, 137 }
- }, { // Band 2
- { 111, 197, 242 }, { 46, 158, 219 }, { 9, 104, 171 },
- { 2, 65, 125 }, { 1, 44, 80 }, { 1, 17, 91 }
- }, { // Band 3
- { 104, 208, 245 }, { 39, 168, 224 }, { 3, 109, 162 },
- { 1, 79, 124 }, { 1, 50, 102 }, { 1, 43, 102 }
- }, { // Band 4
- { 84, 220, 246 }, { 31, 177, 231 }, { 2, 115, 180 },
- { 1, 79, 134 }, { 1, 55, 77 }, { 1, 60, 79 }
- }, { // Band 5
- { 43, 243, 240 }, { 8, 180, 217 }, { 1, 115, 166 },
- { 1, 84, 121 }, { 1, 51, 67 }, { 1, 16, 6 }
- }
- }
- }
-};
-#endif // CONFIG_NEW_TOKENSET
#if CONFIG_TX64X64
// FIXME. Optimize for EC_MULTISYMBOL
@@ -4674,9 +4073,20 @@ static const av1_coeff_probs_model default_coef_probs_64x64[PLANE_TYPES] = {
};
#endif // CONFIG_TX64X64
#endif // CONFIG_Q_ADAPT_PROBS
-#if CONFIG_NEW_TOKENSET
static const aom_prob av1_default_blockzero_probs[TX_SIZES][PLANE_TYPES]
[REF_TYPES][BLOCKZ_CONTEXTS] = {
+#if CONFIG_CHROMA_2X2
+ { // TX_2x2
+ { // Y plane
+ { 195, 84, 8, }, // Intra
+ { 191, 124, 25, }, // Inter
+ },
+ { // UV plane
+ { 214, 132, 42, }, // Intra
+ { 229, 143, 46, }, // Inter
+ },
+ },
+#endif
{ // TX_4x4
{ // Y plane
{ 195, 84, 8, }, // Intra
@@ -5915,7 +5325,6 @@ static const coeff_cdf_model default_coef_head_cdf_32x32[PLANE_TYPES] = {
{AOM_ICDF(3009), AOM_ICDF(3246), AOM_ICDF(10158), AOM_ICDF(10533),
AOM_ICDF(32768) } } } }
};
-#endif // CONFIG_NEW_TOKENSET
/* clang-format on */
@@ -5930,8 +5339,6 @@ void av1_model_to_full_probs(const aom_prob *model, aom_prob *full) {
extend_to_full_distribution(&full[UNCONSTRAINED_NODES], model[PIVOT_NODE]);
}
-#if CONFIG_NEW_TOKENSET
-
static void build_tail_cdfs(aom_cdf_prob cdf_tail[CDF_SIZE(ENTROPY_TOKENS)],
aom_cdf_prob cdf_head[CDF_SIZE(ENTROPY_TOKENS)],
int band_zero) {
@@ -6041,7 +5448,7 @@ static void av1_default_coef_cdfs(FRAME_CONTEXT *fc) {
for (j = 0; j < REF_TYPES; ++j)
for (k = 0; k < COEF_BANDS; ++k)
for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
av1_copy(fc->coef_head_cdfs[TX_2X2][i][j][k][l],
default_coef_head_cdf_4x4[i][j][k][l]);
#endif
@@ -6074,19 +5481,6 @@ void av1_coef_head_cdfs(FRAME_CONTEXT *fc) {
}
}
-#elif CONFIG_EC_MULTISYMBOL
-static void build_token_cdfs(const aom_prob *pdf_model,
- aom_cdf_prob cdf[ENTROPY_TOKENS + 1]) {
- int i, sum = 0;
- assert(pdf_model[2] != 0);
- for (i = 0; i < ENTROPY_TOKENS - 2; ++i) {
- sum += av1_pareto8_token_probs[pdf_model[2] - 1][i];
- cdf[i] = AOM_ICDF(sum);
- }
-}
-#endif // CONFIG_NEW_TOKENSET
-
-#if CONFIG_EC_MULTISYMBOL
void av1_coef_pareto_cdfs(FRAME_CONTEXT *fc) {
/* Build the tail based on a Pareto distribution */
TX_SIZE t;
@@ -6096,15 +5490,9 @@ void av1_coef_pareto_cdfs(FRAME_CONTEXT *fc) {
for (j = 0; j < REF_TYPES; ++j)
for (k = 0; k < COEF_BANDS; ++k)
for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l)
-#if CONFIG_NEW_TOKENSET
build_tail_cdfs(fc->coef_tail_cdfs[t][i][j][k][l],
fc->coef_head_cdfs[t][i][j][k][l], k == 0);
-#else
- build_token_cdfs(fc->coef_probs[t][i][j][k][l],
- fc->coef_cdfs[t][i][j][k][l]);
-#endif
}
-#endif
void av1_default_coef_probs(AV1_COMMON *cm) {
#if CONFIG_Q_ADAPT_PROBS
@@ -6112,7 +5500,7 @@ void av1_default_coef_probs(AV1_COMMON *cm) {
ROUND_POWER_OF_TWO(cm->base_qindex, 8 - QCTX_BIN_BITS), QCTX_BINS - 1);
av1_copy(cm->fc->coef_probs, default_qctx_coef_probs[index]);
#else
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
av1_copy(cm->fc->coef_probs[TX_2X2], default_coef_probs_4x4);
#endif
av1_copy(cm->fc->coef_probs[TX_4X4], default_coef_probs_4x4);
@@ -6123,44 +5511,29 @@ void av1_default_coef_probs(AV1_COMMON *cm) {
av1_copy(cm->fc->coef_probs[TX_64X64], default_coef_probs_64x64);
#endif // CONFIG_TX64X64
#endif // CONFIG_Q_ADAPT_PROBS
-#if CONFIG_NEW_TOKENSET
av1_copy(cm->fc->blockzero_probs, av1_default_blockzero_probs);
-#endif
-#if CONFIG_NEW_TOKENSET
/* Load the head tokens */
av1_default_coef_cdfs(cm->fc);
-#endif
-#if CONFIG_EC_MULTISYMBOL
av1_coef_pareto_cdfs(cm->fc);
-#endif // CONFIG_EC_MULTISYMBOL
}
#if !CONFIG_LV_MAP
static void adapt_coef_probs(AV1_COMMON *cm, TX_SIZE tx_size,
unsigned int count_sat,
unsigned int update_factor) {
- const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx];
+ const FRAME_CONTEXT *pre_fc = cm->pre_fc;
av1_coeff_probs_model *const probs = cm->fc->coef_probs[tx_size];
-#if CONFIG_SUBFRAME_PROB_UPDATE
- const av1_coeff_probs_model *const pre_probs =
- cm->partial_prob_update
- ? (const av1_coeff_probs_model *)cm->starting_coef_probs[tx_size]
- : pre_fc->coef_probs[tx_size];
-#else
const av1_coeff_probs_model *const pre_probs = pre_fc->coef_probs[tx_size];
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
const av1_coeff_count_model *const counts =
(const av1_coeff_count_model *)cm->counts.coef[tx_size];
const unsigned int(*eob_counts)[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] =
(const unsigned int(*)[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS])
cm->counts.eob_branch[tx_size];
-#if CONFIG_NEW_TOKENSET
const av1_blockz_probs_model *const pre_blockz_probs =
pre_fc->blockzero_probs[tx_size];
av1_blockz_probs_model *const blockz_probs = cm->fc->blockzero_probs[tx_size];
const av1_blockz_count_model *const blockz_counts =
(const av1_blockz_count_model *)&cm->counts.blockz_count[tx_size][0];
-#endif
int i, j, k, l, m;
#if CONFIG_RECT_TX
assert(!is_rect_tx(tx_size));
@@ -6183,7 +5556,6 @@ static void adapt_coef_probs(AV1_COMMON *cm, TX_SIZE tx_size,
count_sat, update_factor);
}
-#if CONFIG_NEW_TOKENSET
for (i = 0; i < PLANE_TYPES; ++i) {
for (j = 0; j < REF_TYPES; ++j) {
for (k = 0; k < BLOCKZ_CONTEXTS; ++k) {
@@ -6195,7 +5567,6 @@ static void adapt_coef_probs(AV1_COMMON *cm, TX_SIZE tx_size,
}
}
}
-#endif
}
#endif // !CONFIG_LV_MAP
@@ -6209,9 +5580,6 @@ void av1_adapt_coef_probs(AV1_COMMON *cm) {
update_factor = COEF_MAX_UPDATE_FACTOR;
count_sat = COEF_COUNT_SAT;
}
-#if CONFIG_SUBFRAME_PROB_UPDATE
- if (cm->partial_prob_update == 1) update_factor = COEF_MAX_UPDATE_FACTOR;
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
#if CONFIG_LV_MAP
av1_adapt_txb_probs(cm, count_sat, update_factor);
@@ -6222,18 +5590,6 @@ void av1_adapt_coef_probs(AV1_COMMON *cm) {
#endif
}
-#if CONFIG_SUBFRAME_PROB_UPDATE
-void av1_partial_adapt_probs(AV1_COMMON *cm, int mi_row, int mi_col) {
- (void)mi_row;
- (void)mi_col;
-
- if (cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
- cm->partial_prob_update = 1;
- av1_adapt_coef_probs(cm);
- }
-}
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
-
#if CONFIG_EC_ADAPT
static void av1_average_cdf(aom_cdf_prob *cdf_ptr[], aom_cdf_prob *fc_cdf_ptr,
int cdf_size, const int num_tiles) {
@@ -6263,26 +5619,21 @@ static void av1_average_cdf(aom_cdf_prob *cdf_ptr[], aom_cdf_prob *fc_cdf_ptr,
av1_average_cdf(cdf_ptr, fc_cdf_ptr, cdf_size, num_tiles);
void av1_average_tile_coef_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
- aom_cdf_prob *cdf_ptr[], const int num_tiles) {
+ aom_cdf_prob *cdf_ptr[], int num_tiles) {
int i, cdf_size;
aom_cdf_prob *fc_cdf_ptr;
-#if CONFIG_NEW_TOKENSET
AVERAGE_TILE_CDFS(coef_head_cdfs)
AVERAGE_TILE_CDFS(coef_tail_cdfs)
-#else
- AVERAGE_TILE_CDFS(coef_cdfs)
-#endif
}
void av1_average_tile_mv_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
- aom_cdf_prob *cdf_ptr[], const int num_tiles) {
+ aom_cdf_prob *cdf_ptr[], int num_tiles) {
int i, k, cdf_size;
aom_cdf_prob *fc_cdf_ptr;
-#if CONFIG_REF_MV
int j;
for (j = 0; j < NMV_CONTEXTS; ++j) {
AVERAGE_TILE_CDFS(nmvc[j].joint_cdf)
@@ -6293,19 +5644,10 @@ void av1_average_tile_mv_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
AVERAGE_TILE_CDFS(nmvc[j].comps[k].fp_cdf);
}
}
-#else
- AVERAGE_TILE_CDFS(nmvc.joint_cdf)
-
- for (k = 0; k < 2; ++k) {
- AVERAGE_TILE_CDFS(nmvc.comps[k].class_cdf)
- AVERAGE_TILE_CDFS(nmvc.comps[k].class0_fp_cdf)
- AVERAGE_TILE_CDFS(nmvc.comps[k].fp_cdf)
- }
-#endif
}
void av1_average_tile_intra_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
- aom_cdf_prob *cdf_ptr[], const int num_tiles) {
+ aom_cdf_prob *cdf_ptr[], int num_tiles) {
int i, cdf_size;
aom_cdf_prob *fc_cdf_ptr;
@@ -6335,28 +5677,22 @@ void av1_average_tile_intra_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
#if CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
AVERAGE_TILE_CDFS(intra_filter_cdf)
#endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
-#if CONFIG_FILTER_INTRA
-#endif // CONFIG_FILTER_INTRA
}
void av1_average_tile_inter_cdfs(AV1_COMMON *cm, FRAME_CONTEXT *fc,
FRAME_CONTEXT *ec_ctxs[],
- aom_cdf_prob *cdf_ptr[], const int num_tiles) {
+ aom_cdf_prob *cdf_ptr[], int num_tiles) {
int i, cdf_size;
aom_cdf_prob *fc_cdf_ptr;
-// FIXME: comp_inter_cdf not defined
+ // FIXME: comp_inter_cdf not defined
-// FIXME: comp_ref_cdf and comp_bwd_ref not defined
+ // FIXME: comp_ref_cdf and comp_bwd_ref not defined
-// FIXME: single_ref_cdf not defined
+ // FIXME: single_ref_cdf not defined
-#if CONFIG_REF_MV
-// FIXME: cdfs not defined for newmv_mode, zeromv_mode, drl_mode, new2mv_mode
-#else
- AVERAGE_TILE_CDFS(inter_mode_cdf)
-#endif
+ // FIXME: cdfs not defined for newmv_mode, zeromv_mode, drl_mode, new2mv_mode
// FIXME: cdfs not defined for motion_mode_prob, obmc_prob
diff --git a/third_party/aom/av1/common/entropy.h b/third_party/aom/av1/common/entropy.h
index b02d41bff..49d5f6c57 100644
--- a/third_party/aom/av1/common/entropy.h
+++ b/third_party/aom/av1/common/entropy.h
@@ -32,10 +32,6 @@ extern "C" {
#define QCTX_BINS (1 << QCTX_BIN_BITS)
#endif // CONFIG_Q_ADAPT_PROBS
-#if CONFIG_SUBFRAME_PROB_UPDATE
-#define COEF_PROBS_BUFS 16
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
-
// Coefficient token alphabet
#define ZERO_TOKEN 0 // 0 Extra Bits 0+0
#define ONE_TOKEN 1 // 1 Extra Bits 0+1
@@ -49,18 +45,16 @@ extern "C" {
#define CATEGORY5_TOKEN 9 // 35-66 Extra Bits 5+1
#define CATEGORY6_TOKEN 10 // 67+ Extra Bits 14+1
#define EOB_TOKEN 11 // EOB Extra Bits 0+0
-#if CONFIG_NEW_TOKENSET
-#define NO_EOB 0 // Not an end-of-block
-#define EARLY_EOB 1 // End of block before the last position
-#define LAST_EOB 2 // End of block in the last position (implicit)
-#define BLOCK_Z_TOKEN 255 // block zero
+#define NO_EOB 0 // Not an end-of-block
+#define EARLY_EOB 1 // End of block before the last position
+#define LAST_EOB 2 // End of block in the last position (implicit)
+#define BLOCK_Z_TOKEN 255 // block zero
#define HEAD_TOKENS 5
#define TAIL_TOKENS 9
#define ONE_TOKEN_EOB 1
#define ONE_TOKEN_NEOB 2
#define TWO_TOKEN_PLUS_EOB 3
#define TWO_TOKEN_PLUS_NEOB 4
-#endif
#define ENTROPY_TOKENS 12
#define ENTROPY_NODES 11
@@ -131,7 +125,7 @@ static INLINE int av1_get_cat6_extrabits_size(TX_SIZE tx_size,
// TODO(debargha): Does TX_64X64 require an additional extrabit?
if (tx_size > TX_32X32) tx_size = TX_32X32;
#endif
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
int tx_offset = (tx_size < TX_4X4) ? 0 : (int)(tx_size - TX_4X4);
#else
int tx_offset = (int)(tx_size - TX_4X4);
@@ -175,9 +169,7 @@ static INLINE int av1_get_cat6_extrabits_size(TX_SIZE tx_size,
distinct bands). */
#define COEFF_CONTEXTS 6
-#if CONFIG_EC_MULTISYMBOL
#define BLOCKZ_CONTEXTS 3
-#endif
#define COEFF_CONTEXTS0 3 // for band 0
#define BAND_COEFF_CONTEXTS(band) \
((band) == 0 ? COEFF_CONTEXTS0 : COEFF_CONTEXTS)
@@ -199,9 +191,6 @@ void av1_adapt_coef_probs(struct AV1Common *cm);
#if CONFIG_EC_ADAPT
void av1_adapt_coef_cdfs(struct AV1Common *cm, struct frame_contexts *pre_fc);
#endif
-#if CONFIG_SUBFRAME_PROB_UPDATE
-void av1_partial_adapt_probs(struct AV1Common *cm, int mi_row, int mi_col);
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
// This is the index in the scan order beyond which all coefficients for
// 8x8 transform and above are in the top band.
@@ -250,7 +239,6 @@ typedef unsigned int av1_coeff_count_model[REF_TYPES][COEF_BANDS]
void av1_model_to_full_probs(const aom_prob *model, aom_prob *full);
-#if CONFIG_EC_MULTISYMBOL
typedef aom_cdf_prob coeff_cdf_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
[CDF_SIZE(ENTROPY_TOKENS)];
typedef aom_prob av1_blockz_probs_model[REF_TYPES][BLOCKZ_CONTEXTS];
@@ -260,11 +248,9 @@ extern const aom_cdf_prob av1_pareto8_token_probs[COEFF_PROB_MODELS]
extern const aom_cdf_prob av1_pareto8_tail_probs[COEFF_PROB_MODELS]
[ENTROPY_TOKENS - 3];
struct frame_contexts;
-#if CONFIG_NEW_TOKENSET
+
void av1_coef_head_cdfs(struct frame_contexts *fc);
-#endif
void av1_coef_pareto_cdfs(struct frame_contexts *fc);
-#endif // CONFIG_EC_MULTISYMBOL
typedef char ENTROPY_CONTEXT;
@@ -277,7 +263,7 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a,
const ENTROPY_CONTEXT *l) {
ENTROPY_CONTEXT above_ec = 0, left_ec = 0;
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
switch (tx_size) {
case TX_2X2:
above_ec = a[0] != 0;
@@ -323,10 +309,36 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a,
above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8));
left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8));
break;
+#if CONFIG_TX64X64
+ case TX_64X64:
+ above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8) |
+ *(const uint64_t *)(a + 16) | *(const uint64_t *)(a + 24));
+ left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8) |
+ *(const uint64_t *)(l + 16) | *(const uint64_t *)(l + 24));
+ break;
+#endif // CONFIG_TX64X64
+#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
+ case TX_4X16:
+ above_ec = !!*(const uint16_t *)a;
+ left_ec = !!*(const uint64_t *)l;
+ break;
+ case TX_16X4:
+ above_ec = !!*(const uint64_t *)a;
+ left_ec = !!*(const uint16_t *)l;
+ break;
+ case TX_8X32:
+ above_ec = !!*(const uint32_t *)a;
+ left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8));
+ break;
+ case TX_32X8:
+ above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8));
+ left_ec = !!*(const uint32_t *)l;
+ break;
+#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
default: assert(0 && "Invalid transform size."); break;
}
return combine_entropy_contexts(above_ec, left_ec);
-#endif
+#endif // CONFIG_CHROMA_2X2
switch (tx_size) {
case TX_4X4:
@@ -375,6 +387,24 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a,
left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8));
break;
#endif // CONFIG_TX64X64
+#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
+ case TX_4X16:
+ above_ec = a[0] != 0;
+ left_ec = !!*(const uint32_t *)l;
+ break;
+ case TX_16X4:
+ above_ec = !!*(const uint32_t *)a;
+ left_ec = l[0] != 0;
+ break;
+ case TX_8X32:
+ above_ec = !!*(const uint16_t *)a;
+ left_ec = !!*(const uint64_t *)l;
+ break;
+ case TX_32X8:
+ above_ec = !!*(const uint64_t *)a;
+ left_ec = !!*(const uint16_t *)l;
+ break;
+#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
default: assert(0 && "Invalid transform size."); break;
}
return combine_entropy_contexts(above_ec, left_ec);
diff --git a/third_party/aom/av1/common/entropymode.c b/third_party/aom/av1/common/entropymode.c
index 0fcf762d1..65ed163a6 100644
--- a/third_party/aom/av1/common/entropymode.c
+++ b/third_party/aom/av1/common/entropymode.c
@@ -18,7 +18,7 @@
#if CONFIG_LV_MAP
const aom_prob default_txb_skip[TX_SIZES][TXB_SKIP_CONTEXTS] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ 252, 71, 126, 184, 178, 218, 251, 49, 133, 221, 27, 92, 197 },
#endif
{ 252, 71, 126, 184, 178, 218, 251, 49, 133, 221, 27, 92, 197 },
@@ -32,7 +32,7 @@ const aom_prob default_dc_sign[PLANE_TYPES][DC_SIGN_CONTEXTS] = {
const aom_prob default_coeff_base
[TX_SIZES][PLANE_TYPES][NUM_BASE_LEVELS][COEFF_BASE_CONTEXTS] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ // TX_2X2
{
{ 73, 128, 131, 204, 165, 226, 169, 236, 18, 128, 51,
@@ -168,7 +168,7 @@ const aom_prob default_coeff_base
};
const aom_prob default_nz_map[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{
{ 34, 103, 61, 106, 62, 160, 112, 54, 173, 121,
75, 157, 92, 75, 157, 129, 94, 65, 52, 37 },
@@ -203,7 +203,7 @@ const aom_prob default_nz_map[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS] = {
};
const aom_prob default_eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{
{ 229, 236, 231, 222, 239, 236, 214, 201, 236, 226, 195, 134, 228,
210, 150, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
@@ -238,7 +238,7 @@ const aom_prob default_eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] = {
};
const aom_prob default_coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{
{ 164, 128, 134, 165, 128, 137, 168, 128, 97, 136, 167, 128,
182, 205, 143, 172, 200, 145, 173, 193, 103, 137, 170, 191,
@@ -294,6 +294,258 @@ const aom_prob default_coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS] = {
#endif // CONFIG_LV_MAP
#if CONFIG_ALT_INTRA
+#if CONFIG_SMOOTH_HV
+const aom_prob av1_kf_y_mode_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1] = {
+ {
+ // above = dc
+ { 111, 28, 44, 99, 166, 154, 28, 28, 27, 45, 134, 109 }, // left = dc
+ { 82, 31, 102, 75, 117, 135, 33, 34, 21, 31, 134, 149 }, // left = v
+ { 40, 29, 14, 161, 235, 180, 14, 12, 34, 52, 128, 69 }, // left = h
+ { 98, 19, 36, 74, 137, 153, 49, 35, 25, 61, 137, 106 }, // left = d45
+ { 59, 11, 25, 128, 47, 162, 29, 20, 53, 38, 143, 117 }, // left = d135
+ { 86, 20, 51, 160, 39, 101, 69, 101, 112, 154, 158, 145 }, // left = d117
+ { 49, 10, 17, 112, 98, 206, 16, 11, 104, 44, 138, 88 }, // left = d153
+ { 64, 14, 22, 80, 170, 168, 19, 15, 26, 101, 137, 90 }, // left = d207
+ { 84, 21, 31, 62, 110, 135, 40, 57, 22, 45, 143, 130 }, // left = d63
+ { 58, 16, 31, 60, 154, 225, 17, 23, 19, 30, 138, 113 }, // left = smooth
+ { 51, 19, 46, 64, 148, 209, 18, 28, 17, 25, 137,
+ 149 }, // left = smooth_v
+ { 68, 15, 26, 61, 175, 233, 17, 17, 19, 29, 135, 76 }, // left = smooth_h
+ { 49, 61, 41, 113, 203, 158, 26, 26, 29, 55, 123, 99 }, // left = tm
+ },
+ {
+ // above = v
+ { 31, 26, 135, 81, 100, 82, 13, 40, 14, 18, 131, 182 }, // left = dc
+ { 24, 27, 175, 53, 93, 85, 17, 40, 5, 14, 119, 195 }, // left = v
+ { 20, 34, 71, 97, 209, 133, 15, 24, 14, 28, 138, 129 }, // left = h
+ { 54, 19, 88, 55, 102, 103, 39, 45, 8, 44, 134, 167 }, // left = d45
+ { 23, 16, 93, 101, 33, 119, 23, 41, 26, 22, 136, 168 }, // left = d135
+ { 34, 17, 130, 149, 30, 72, 43, 129, 66, 100, 143, 192 }, // left = d117
+ { 23, 17, 83, 85, 63, 158, 16, 30, 64, 28, 145, 146 }, // left = d153
+ { 33, 17, 85, 60, 136, 115, 21, 32, 15, 59, 134, 155 }, // left = d207
+ { 40, 20, 103, 53, 66, 84, 26, 72, 9, 29, 134, 177 }, // left = d63
+ { 22, 18, 112, 41, 138, 192, 12, 30, 9, 16, 131, 178 }, // left = smooth
+ { 20, 20, 125, 39, 137, 179, 11, 28, 7, 12, 123,
+ 199 }, // left = smooth_v
+ { 26, 19, 111, 46, 160, 201, 13, 29, 8, 17, 132,
+ 156 }, // left = smooth_h
+ { 20, 35, 138, 62, 162, 107, 21, 36, 9, 24, 125, 181 }, // left = tm
+ },
+ {
+ // above = h
+ { 89, 27, 21, 136, 218, 175, 20, 19, 35, 56, 134, 96 }, // left = dc
+ { 63, 37, 67, 117, 190, 160, 22, 29, 20, 45, 137, 137 }, // left = v
+ { 34, 23, 7, 177, 245, 207, 13, 9, 30, 73, 125, 63 }, // left = h
+ { 84, 29, 20, 83, 184, 182, 38, 25, 34, 86, 134, 106 }, // left = d45
+ { 65, 19, 19, 119, 109, 177, 27, 19, 56, 56, 141, 103 }, // left = d135
+ { 88, 25, 46, 152, 102, 130, 70, 61, 96, 157, 130, 102 }, // left = d117
+ { 51, 11, 10, 108, 168, 216, 14, 9, 93, 58, 132, 79 }, // left = d153
+ { 53, 15, 9, 103, 224, 192, 20, 13, 23, 122, 135, 80 }, // left = d207
+ { 64, 30, 19, 90, 171, 176, 24, 44, 23, 56, 144, 121 }, // left = d63
+ { 46, 20, 17, 94, 214, 234, 14, 15, 23, 38, 132, 98 }, // left = smooth
+ { 41, 27, 22, 102, 214, 229, 13, 17, 18, 35, 133,
+ 137 }, // left = smooth_v
+ { 52, 17, 14, 95, 224, 241, 14, 11, 24, 38, 133, 62 }, // left = smooth_h
+ { 35, 43, 21, 148, 234, 188, 22, 17, 27, 47, 133, 100 }, // left = tm
+ },
+ {
+ // above = d45
+ { 80, 14, 31, 74, 129, 146, 52, 50, 29, 50, 138, 110 }, // left = dc
+ { 59, 16, 84, 52, 106, 121, 63, 60, 20, 40, 143, 150 }, // left = v
+ { 41, 19, 16, 118, 216, 168, 36, 27, 24, 62, 136, 69 }, // left = h
+ { 86, 11, 11, 37, 168, 158, 113, 53, 8, 99, 140, 121 }, // left = d45
+ { 49, 8, 24, 94, 49, 139, 48, 45, 40, 53, 134, 131 }, // left = d135
+ { 58, 11, 36, 127, 45, 97, 90, 143, 91, 180, 153, 146 }, // left = d117
+ { 39, 9, 14, 93, 97, 187, 32, 26, 66, 57, 134, 106 }, // left = d153
+ { 75, 8, 26, 68, 135, 154, 51, 30, 17, 113, 144, 83 }, // left = d207
+ { 77, 13, 18, 46, 146, 143, 81, 102, 18, 59, 142, 143 }, // left = d63
+ { 49, 13, 31, 47, 142, 218, 46, 42, 19, 46, 146, 120 }, // left = smooth
+ { 46, 15, 35, 47, 132, 206, 47, 50, 18, 37, 143,
+ 147 }, // left = smooth_v
+ { 54, 11, 25, 54, 157, 229, 43, 34, 20, 44, 136, 99 }, // left = smooth_h
+ { 40, 26, 41, 72, 176, 145, 78, 51, 27, 59, 133, 121 }, // left = tm
+ },
+ {
+ // above = d135
+ { 57, 10, 21, 118, 61, 178, 16, 20, 65, 52, 145, 125 }, // left = dc
+ { 56, 15, 48, 107, 58, 153, 20, 32, 42, 35, 143, 162 }, // left = v
+ { 28, 19, 8, 132, 172, 184, 14, 14, 45, 55, 140, 79 }, // left = h
+ { 58, 13, 15, 73, 66, 177, 61, 24, 30, 72, 143, 122 }, // left = d45
+ { 35, 5, 13, 150, 20, 187, 19, 21, 66, 38, 144, 130 }, // left = d135
+ { 57, 9, 30, 173, 28, 133, 38, 71, 156, 140, 156, 173 }, // left = d117
+ { 30, 6, 9, 121, 54, 207, 16, 20, 110, 62, 151, 94 }, // left = d153
+ { 51, 9, 15, 88, 96, 188, 22, 18, 40, 95, 140, 98 }, // left = d207
+ { 56, 12, 21, 82, 53, 140, 30, 37, 32, 47, 145, 149 }, // left = d63
+ { 43, 12, 21, 83, 84, 222, 14, 23, 31, 35, 143, 127 }, // left = smooth
+ { 41, 12, 25, 81, 75, 210, 16, 29, 29, 29, 141, 154 }, // left = smooth_v
+ { 42, 11, 19, 81, 109, 226, 17, 20, 34, 36, 143,
+ 110 }, // left = smooth_h
+ { 36, 26, 27, 107, 132, 151, 24, 28, 38, 46, 140, 127 }, // left = tm
+ },
+ {
+ // above = d117
+ { 52, 15, 58, 191, 40, 95, 38, 78, 98, 140, 152, 175 }, // left = dc
+ { 50, 16, 85, 186, 28, 84, 41, 105, 65, 119, 158, 206 }, // left = v
+ { 30, 23, 30, 179, 122, 124, 38, 47, 68, 140, 161, 102 }, // left = h
+ { 75, 15, 47, 120, 49, 127, 63, 86, 54, 204, 175, 185 }, // left = d45
+ { 36, 9, 37, 198, 15, 120, 56, 78, 104, 151, 155, 165 }, // left = d135
+ { 38, 9, 54, 198, 12, 75, 47, 92, 71, 130, 170, 201 }, // left = d117
+ { 31, 13, 33, 167, 46, 144, 32, 59, 124, 151, 162, 128 }, // left = d153
+ { 47, 15, 43, 123, 70, 129, 49, 72, 48, 175, 163, 125 }, // left = d207
+ { 61, 19, 62, 141, 35, 116, 55, 117, 51, 162, 150, 201 }, // left = d63
+ { 22, 17, 34, 105, 41, 101, 20, 34, 26, 39, 146, 157 }, // left = smooth
+ { 19, 14, 37, 116, 33, 91, 23, 38, 17, 36, 137, 178 }, // left = smooth_v
+ { 25, 17, 35, 102, 59, 118, 23, 28, 30, 43, 147,
+ 148 }, // left = smooth_h
+ { 35, 24, 62, 164, 95, 103, 47, 94, 65, 115, 186, 128 }, // left = tm
+ },
+ {
+ // above = d153
+ { 75, 12, 17, 101, 150, 177, 14, 13, 101, 55, 141, 104 }, // left = dc
+ { 69, 19, 46, 91, 133, 167, 19, 22, 72, 41, 133, 143 }, // left = v
+ { 30, 12, 6, 132, 209, 214, 10, 8, 75, 78, 137, 70 }, // left = h
+ { 77, 16, 12, 85, 120, 203, 35, 17, 69, 66, 137, 96 }, // left = d45
+ { 51, 8, 11, 119, 58, 178, 20, 17, 90, 51, 145, 92 }, // left = d135
+ { 76, 8, 24, 144, 48, 128, 37, 46, 173, 153, 159, 111 }, // left = d117
+ { 40, 6, 6, 87, 112, 213, 7, 7, 152, 54, 141, 84 }, // left = d153
+ { 46, 6, 7, 78, 161, 195, 15, 11, 66, 97, 137, 83 }, // left = d207
+ { 81, 17, 17, 82, 97, 187, 26, 34, 54, 60, 154, 128 }, // left = d63
+ { 47, 10, 16, 74, 138, 233, 13, 17, 59, 42, 143, 106 }, // left = smooth
+ { 45, 12, 17, 76, 141, 227, 14, 16, 56, 43, 141,
+ 135 }, // left = smooth_v
+ { 55, 10, 13, 69, 162, 238, 11, 11, 59, 45, 133, 73 }, // left = smooth_h
+ { 44, 23, 19, 110, 176, 165, 16, 19, 68, 59, 131, 89 }, // left = tm
+ },
+ {
+ // above = d207
+ { 86, 15, 26, 87, 166, 178, 27, 25, 27, 75, 145, 108 }, // left = dc
+ { 71, 27, 62, 70, 126, 142, 29, 34, 17, 69, 141, 144 }, // left = v
+ { 48, 21, 11, 130, 231, 196, 24, 19, 27, 82, 133, 72 }, // left = h
+ { 82, 21, 14, 54, 128, 188, 55, 38, 19, 111, 148, 119 }, // left = d45
+ { 57, 11, 17, 78, 83, 171, 43, 31, 37, 58, 143, 100 }, // left = d135
+ { 76, 16, 44, 115, 77, 130, 78, 79, 82, 178, 132, 123 }, // left = d117
+ { 50, 12, 11, 82, 133, 207, 27, 20, 67, 79, 138, 87 }, // left = d153
+ { 77, 9, 13, 44, 174, 169, 26, 13, 9, 167, 135, 90 }, // left = d207
+ { 70, 16, 18, 57, 117, 167, 43, 46, 17, 70, 150, 116 }, // left = d63
+ { 56, 13, 18, 60, 170, 236, 24, 19, 18, 59, 139, 105 }, // left = smooth
+ { 50, 17, 26, 60, 165, 234, 24, 20, 15, 53, 134,
+ 136 }, // left = smooth_v
+ { 57, 11, 16, 62, 188, 239, 23, 15, 18, 57, 134, 79 }, // left = smooth_h
+ { 49, 31, 24, 78, 194, 184, 45, 27, 19, 81, 138, 102 }, // left = tm
+ },
+ {
+ // above = d63
+ { 53, 13, 46, 61, 109, 116, 40, 83, 19, 31, 141, 150 }, // left = dc
+ { 45, 14, 75, 40, 79, 102, 48, 118, 14, 23, 138, 174 }, // left = v
+ { 34, 14, 24, 98, 214, 128, 33, 54, 18, 51, 138, 103 }, // left = h
+ { 74, 11, 26, 37, 127, 154, 75, 89, 11, 61, 146, 125 }, // left = d45
+ { 35, 9, 26, 68, 55, 128, 53, 74, 21, 33, 138, 132 }, // left = d135
+ { 47, 9, 55, 108, 39, 105, 64, 193, 71, 127, 141, 193 }, // left = d117
+ { 35, 9, 22, 66, 79, 172, 34, 64, 57, 44, 139, 112 }, // left = d153
+ { 54, 7, 26, 48, 136, 139, 48, 60, 15, 82, 144, 116 }, // left = d207
+ { 60, 9, 30, 25, 106, 127, 64, 143, 14, 42, 140, 165 }, // left = d63
+ { 39, 11, 35, 40, 136, 212, 34, 67, 12, 28, 145, 150 }, // left = smooth
+ { 37, 12, 45, 36, 128, 190, 34, 80, 8, 23, 138, 165 }, // left = smooth_v
+ { 45, 9, 37, 46, 152, 196, 36, 58, 14, 29, 145, 127 }, // left = smooth_h
+ { 35, 17, 53, 48, 159, 101, 53, 104, 15, 36, 132, 152 }, // left = tm
+ },
+ {
+ // above = smooth
+ { 58, 12, 33, 66, 168, 219, 13, 21, 16, 27, 137, 113 }, // left = dc
+ { 42, 20, 78, 51, 139, 216, 16, 27, 11, 18, 134, 160 }, // left = v
+ { 28, 17, 16, 118, 236, 231, 13, 14, 16, 41, 132, 77 }, // left = h
+ { 58, 12, 23, 47, 138, 238, 39, 31, 16, 63, 142, 125 }, // left = d45
+ { 44, 9, 27, 76, 80, 220, 21, 27, 27, 30, 142, 122 }, // left = d135
+ { 30, 13, 38, 96, 47, 111, 26, 40, 31, 40, 146, 146 }, // left = d117
+ { 42, 9, 19, 70, 127, 234, 15, 18, 53, 39, 138, 97 }, // left = d153
+ { 44, 10, 20, 57, 186, 229, 15, 18, 15, 80, 141, 97 }, // left = d207
+ { 51, 13, 33, 46, 123, 225, 23, 46, 15, 34, 143, 132 }, // left = d63
+ { 42, 11, 29, 49, 154, 226, 13, 20, 12, 27, 139, 117 }, // left = smooth
+ { 37, 13, 40, 48, 146, 217, 13, 23, 10, 24, 136,
+ 149 }, // left = smooth_v
+ { 45, 10, 24, 55, 176, 230, 11, 16, 14, 26, 136, 86 }, // left = smooth_h
+ { 32, 23, 43, 78, 204, 225, 18, 23, 15, 30, 134, 117 }, // left = tm
+ },
+ {
+ // above = smooth_v
+ { 62, 13, 47, 68, 165, 204, 14, 24, 14, 22, 137, 146 }, // left = dc
+ { 42, 18, 97, 43, 138, 210, 12, 28, 8, 14, 127, 184 }, // left = v
+ { 30, 19, 21, 128, 238, 231, 13, 13, 17, 38, 138, 103 }, // left = h
+ { 66, 12, 31, 50, 132, 228, 37, 34, 14, 56, 142, 135 }, // left = d45
+ { 45, 9, 33, 75, 73, 216, 20, 33, 25, 25, 146, 153 }, // left = d135
+ { 31, 13, 48, 97, 46, 82, 26, 55, 31, 25, 140, 179 }, // left = d117
+ { 47, 10, 26, 67, 109, 229, 15, 23, 52, 34, 136, 133 }, // left = d153
+ { 49, 9, 25, 58, 174, 206, 14, 20, 13, 83, 144, 121 }, // left = d207
+ { 54, 15, 42, 47, 120, 209, 22, 55, 13, 25, 139, 162 }, // left = d63
+ { 41, 11, 43, 50, 146, 216, 11, 21, 11, 23, 136, 151 }, // left = smooth
+ { 37, 12, 58, 48, 148, 202, 11, 24, 8, 19, 134, 178 }, // left = smooth_v
+ { 47, 11, 39, 54, 169, 212, 12, 21, 14, 22, 144,
+ 115 }, // left = smooth_h
+ { 36, 25, 57, 80, 215, 211, 16, 28, 11, 25, 130, 154 }, // left = tm
+ },
+ {
+ // above = smooth_h
+ { 57, 12, 28, 68, 186, 224, 11, 17, 20, 31, 133, 80 }, // left = dc
+ { 42, 21, 86, 51, 159, 221, 14, 25, 10, 19, 134, 131 }, // left = v
+ { 25, 17, 13, 123, 240, 240, 12, 10, 18, 42, 126, 56 }, // left = h
+ { 55, 11, 25, 47, 146, 238, 36, 32, 18, 67, 144, 99 }, // left = d45
+ { 47, 11, 23, 75, 95, 222, 20, 24, 28, 36, 143, 103 }, // left = d135
+ { 30, 14, 34, 92, 59, 101, 27, 44, 31, 41, 142, 129 }, // left = d117
+ { 42, 11, 17, 73, 158, 234, 14, 14, 59, 46, 138, 67 }, // left = d153
+ { 45, 10, 15, 64, 194, 228, 14, 15, 17, 78, 133, 73 }, // left = d207
+ { 52, 14, 29, 45, 138, 227, 25, 43, 16, 36, 136, 119 }, // left = d63
+ { 42, 12, 23, 51, 173, 235, 12, 16, 13, 28, 134, 95 }, // left = smooth
+ { 37, 16, 34, 52, 161, 228, 12, 19, 10, 28, 137,
+ 123 }, // left = smooth_v
+ { 45, 9, 18, 58, 200, 240, 10, 13, 13, 27, 129, 61 }, // left = smooth_h
+ { 32, 26, 44, 82, 217, 222, 19, 23, 16, 34, 134, 99 }, // left = tm
+ },
+ {
+ // above = tm
+ { 51, 42, 80, 104, 178, 121, 20, 37, 25, 42, 136, 150 }, // left = dc
+ { 35, 38, 132, 73, 152, 132, 21, 36, 10, 32, 127, 174 }, // left = v
+ { 21, 34, 26, 149, 241, 165, 17, 15, 19, 60, 132, 95 }, // left = h
+ { 64, 20, 36, 67, 169, 142, 45, 30, 16, 86, 145, 134 }, // left = d45
+ { 40, 23, 51, 96, 102, 149, 25, 33, 34, 43, 143, 125 }, // left = d135
+ { 58, 29, 93, 140, 93, 89, 51, 107, 64, 146, 145, 154 }, // left = d117
+ { 33, 23, 44, 95, 139, 209, 12, 20, 76, 56, 131, 104 }, // left = d153
+ { 40, 21, 28, 79, 210, 165, 21, 15, 16, 134, 138, 108 }, // left = d207
+ { 45, 24, 58, 62, 132, 127, 32, 58, 15, 51, 143, 152 }, // left = d63
+ { 33, 27, 53, 71, 195, 223, 14, 24, 12, 36, 136, 135 }, // left = smooth
+ { 30, 29, 62, 68, 201, 217, 14, 24, 11, 31, 132,
+ 162 }, // left = smooth_v
+ { 37, 25, 50, 76, 204, 212, 12, 18, 15, 38, 134,
+ 106 }, // left = smooth_h
+ { 28, 53, 64, 100, 203, 162, 26, 29, 15, 52, 127, 138 }, // left = tm
+ },
+};
+
+static const aom_prob default_if_y_probs[BLOCK_SIZE_GROUPS][INTRA_MODES - 1] = {
+ { 56, 13, 37, 112, 91, 147, 66, 55, 72, 82, 124, 121 }, // block_size < 8x8
+ { 92, 120, 47, 89, 120, 139, 18, 38, 32, 51, 146,
+ 124 }, // block_size < 16x16
+ { 115, 102, 41, 69, 170, 142, 8, 23, 13, 23, 122,
+ 110 }, // block_size < 32x32
+ { 148, 157, 47, 62, 238, 64, 7, 3, 1, 3, 74, 87 }, // block_size >= 32x32
+};
+
+static const aom_prob default_uv_probs[INTRA_MODES][INTRA_MODES - 1] = {
+ { 184, 3, 67, 135, 194, 108, 33, 43, 40, 86, 121, 118 }, // y = dc
+ { 23, 3, 204, 105, 117, 53, 14, 68, 13, 19, 112, 86 }, // y = v
+ { 34, 3, 7, 220, 249, 142, 11, 13, 59, 124, 119, 131 }, // y = h
+ { 138, 3, 45, 51, 162, 99, 110, 107, 21, 113, 119, 111 }, // y = d45
+ { 130, 2, 28, 163, 52, 163, 16, 25, 94, 46, 127, 118 }, // y = d135
+ { 109, 3, 55, 218, 20, 43, 34, 71, 74, 68, 108, 128 }, // y = d117
+ { 124, 1, 17, 124, 151, 197, 8, 9, 184, 71, 123, 101 }, // y = d153
+ { 127, 2, 16, 110, 225, 134, 28, 19, 18, 190, 124, 132 }, // y = d207
+ { 115, 3, 65, 46, 134, 81, 37, 170, 20, 57, 122, 106 }, // y = d63
+ { 131, 4, 52, 71, 177, 205, 17, 27, 20, 41, 128, 118 }, // y = smooth
+ { 131, 5, 65, 70, 182, 196, 17, 30, 17, 35, 123, 154 }, // y = smooth_v
+ { 137, 4, 43, 78, 196, 202, 16, 21, 24, 48, 123, 91 }, // y = smooth_h
+ { 137, 12, 92, 142, 217, 71, 14, 45, 29, 62, 108, 109 }, // y = tm
+};
+
+#else // !CONFIG_SMOOTH_HV
const aom_prob av1_kf_y_mode_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1] = {
{
@@ -473,7 +725,9 @@ static const aom_prob default_uv_probs[INTRA_MODES][INTRA_MODES - 1] = {
{ 185, 7, 113, 171, 203, 57, 18, 69, 49, 104 }, // y = paeth
};
-#else
+#endif // CONFIG_SMOOTH_HV
+
+#else // !CONFIG_ALT_INTRA
const aom_prob av1_kf_y_mode_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1] = {
{
@@ -732,7 +986,6 @@ static const aom_prob
};
#endif // CONFIG_EXT_PARTITION_TYPES
-#if CONFIG_REF_MV
static const aom_prob default_newmv_prob[NEWMV_MODE_CONTEXTS] = {
200, 180, 150, 150, 110, 70, 60,
};
@@ -747,7 +1000,6 @@ static const aom_prob default_refmv_prob[REFMV_MODE_CONTEXTS] = {
static const aom_prob default_drl_prob[DRL_MODE_CONTEXTS] = { 128, 160, 180,
128, 160 };
-#endif // CONFIG_REF_MV
static const aom_prob
default_inter_mode_probs[INTER_MODE_CONTEXTS][INTER_MODES - 1] = {
@@ -763,13 +1015,13 @@ static const aom_prob
#if CONFIG_EXT_INTER
static const aom_prob default_inter_compound_mode_probs
[INTER_MODE_CONTEXTS][INTER_COMPOUND_MODES - 1] = {
- { 2, 173, 68, 192, 64, 192, 128, 180, 180 }, // 0 = both zero mv
- { 7, 145, 160, 192, 64, 192, 128, 180, 180 }, // 1 = 1 zero + 1 predicted
- { 7, 166, 126, 192, 64, 192, 128, 180, 180 }, // 2 = two predicted mvs
- { 7, 94, 132, 192, 64, 192, 128, 180, 180 }, // 3 = 1 pred/zero, 1 new
- { 8, 64, 64, 192, 64, 192, 128, 180, 180 }, // 4 = two new mvs
- { 17, 81, 52, 192, 64, 192, 128, 180, 180 }, // 5 = one intra neighbour
- { 25, 29, 50, 192, 64, 192, 128, 180, 180 }, // 6 = two intra neighbours
+ { 2, 173, 68, 192, 128, 180, 180 }, // 0 = both zero mv
+ { 7, 145, 160, 192, 128, 180, 180 }, // 1 = 1 zero + 1 predicted
+ { 7, 166, 126, 192, 128, 180, 180 }, // 2 = two predicted mvs
+ { 7, 94, 132, 192, 128, 180, 180 }, // 3 = 1 pred/zero, 1 new
+ { 8, 64, 64, 192, 128, 180, 180 }, // 4 = two new mvs
+ { 17, 81, 52, 192, 128, 180, 180 }, // 5 = one intra neighbour
+ { 25, 29, 50, 192, 128, 180, 180 }, // 6 = two intra neighbours
};
#if CONFIG_COMPOUND_SINGLEREF
@@ -791,20 +1043,20 @@ static const aom_prob default_inter_singleref_comp_mode_probs
static const aom_prob
default_compound_type_probs[BLOCK_SIZES][COMPOUND_TYPES - 1] = {
#if CONFIG_CB4X4
- { 255, 255 }, { 255, 255 }, { 255, 255 },
+ { 255, 128 }, { 255, 128 }, { 255, 128 },
#endif
- { 208, 200 }, { 208, 200 }, { 208, 200 }, { 208, 200 }, { 208, 200 },
- { 208, 200 }, { 216, 200 }, { 216, 200 }, { 216, 200 }, { 224, 200 },
- { 224, 200 }, { 240, 200 }, { 240, 200 },
+ { 208, 128 }, { 208, 128 }, { 208, 128 }, { 208, 128 }, { 208, 128 },
+ { 208, 128 }, { 216, 128 }, { 216, 128 }, { 216, 128 }, { 224, 128 },
+ { 224, 1 }, { 240, 1 }, { 240, 1 },
#if CONFIG_EXT_PARTITION
- { 255, 200 }, { 255, 200 }, { 255, 200 },
+ { 255, 1 }, { 255, 1 }, { 255, 1 },
#endif // CONFIG_EXT_PARTITION
};
#elif !CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE
static const aom_prob
default_compound_type_probs[BLOCK_SIZES][COMPOUND_TYPES - 1] = {
#if CONFIG_CB4X4
- { 208 }, { 208 }, { 208 },
+ { 255 }, { 255 }, { 255 },
#endif
{ 208 }, { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, { 216 },
{ 216 }, { 216 }, { 224 }, { 224 }, { 240 }, { 240 },
@@ -816,7 +1068,7 @@ static const aom_prob
static const aom_prob
default_compound_type_probs[BLOCK_SIZES][COMPOUND_TYPES - 1] = {
#if CONFIG_CB4X4
- { 208 }, { 208 }, { 208 },
+ { 255 }, { 255 }, { 255 },
#endif
{ 208 }, { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, { 216 },
{ 216 }, { 216 }, { 224 }, { 224 }, { 240 }, { 240 },
@@ -829,16 +1081,17 @@ static const aom_prob default_compound_type_probs[BLOCK_SIZES]
[COMPOUND_TYPES - 1];
#endif // CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE
+#if CONFIG_INTERINTRA
static const aom_prob default_interintra_prob[BLOCK_SIZE_GROUPS] = {
208, 208, 208, 208,
};
static const aom_prob
default_interintra_mode_prob[BLOCK_SIZE_GROUPS][INTERINTRA_MODES - 1] = {
- { 65, 32, 18, 144, 162, 194, 41, 51, 98 }, // block_size < 8x8
- { 132, 68, 18, 165, 217, 196, 45, 40, 78 }, // block_size < 16x16
- { 173, 80, 19, 176, 240, 193, 64, 35, 46 }, // block_size < 32x32
- { 221, 135, 38, 194, 248, 121, 96, 85, 29 } // block_size >= 32x32
+ { 88, 16, 150 }, // block_size < 8x8
+ { 75, 26, 150 }, // block_size < 16x16
+ { 73, 24, 150 }, // block_size < 32x32
+ { 96, 27, 150 } // block_size >= 32x32
};
static const aom_prob default_wedge_interintra_prob[BLOCK_SIZES] = {
@@ -850,6 +1103,7 @@ static const aom_prob default_wedge_interintra_prob[BLOCK_SIZES] = {
208, 208, 208
#endif // CONFIG_EXT_PARTITION
};
+#endif // CONFIG_INTERINTRA
#endif // CONFIG_EXT_INTER
// Change this section appropriately once warped motion is supported
@@ -919,22 +1173,17 @@ static const aom_prob default_obmc_prob[BLOCK_SIZES] = {
#if CONFIG_DELTA_Q
static const aom_prob default_delta_q_probs[DELTA_Q_PROBS] = { 220, 220, 220 };
-#if CONFIG_EC_MULTISYMBOL
static const aom_cdf_prob default_delta_q_cdf[CDF_SIZE(DELTA_Q_PROBS + 1)] = {
AOM_ICDF(28160), AOM_ICDF(32120), AOM_ICDF(32677), AOM_ICDF(32768), 0
};
-#endif
#if CONFIG_EXT_DELTA_Q
static const aom_prob default_delta_lf_probs[DELTA_LF_PROBS] = { 220, 220,
220 };
-#if CONFIG_EC_MULTISYMBOL
static const aom_cdf_prob default_delta_lf_cdf[CDF_SIZE(DELTA_LF_PROBS + 1)] = {
- 28160, 32120, 32677, 32768, 0
+ AOM_ICDF(28160), AOM_ICDF(32120), AOM_ICDF(32677), AOM_ICDF(32768), 0
};
#endif
#endif
-#endif
-#if CONFIG_EC_MULTISYMBOL
int av1_intra_mode_ind[INTRA_MODES];
int av1_intra_mode_inv[INTRA_MODES];
int av1_inter_mode_ind[INTER_MODES];
@@ -945,9 +1194,36 @@ int av1_ext_tx_intra_inv[EXT_TX_SETS_INTRA][TX_TYPES];
int av1_ext_tx_inter_ind[EXT_TX_SETS_INTER][TX_TYPES];
int av1_ext_tx_inter_inv[EXT_TX_SETS_INTER][TX_TYPES];
#endif
-#endif
#if CONFIG_ALT_INTRA
+#if CONFIG_SMOOTH_HV
+const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)] = {
+ -DC_PRED,
+ 2, /* 0 = DC_NODE */
+ -TM_PRED,
+ 4, /* 1 = TM_NODE */
+ -V_PRED,
+ 6, /* 2 = V_NODE */
+ 8,
+ 12, /* 3 = COM_NODE */
+ -H_PRED,
+ 10, /* 4 = H_NODE */
+ -D135_PRED,
+ -D117_PRED, /* 5 = D135_NODE */
+ -D45_PRED,
+ 14, /* 6 = D45_NODE */
+ -D63_PRED,
+ 16, /* 7 = D63_NODE */
+ -D153_PRED,
+ 18, /* 8 = D153_NODE */
+ -D207_PRED,
+ 20, /* 9 = D207_NODE */
+ -SMOOTH_PRED,
+ 22, /* 10 = SMOOTH_NODE */
+ -SMOOTH_V_PRED,
+ -SMOOTH_H_PRED /* 11 = SMOOTH_V_NODE */
+};
+#else
const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)] = {
-DC_PRED, 2, /* 0 = DC_NODE */
-TM_PRED, 4, /* 1 = TM_NODE */
@@ -960,6 +1236,7 @@ const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)] = {
-D153_PRED, 18, /* 8 = D153_NODE */
-D207_PRED, -SMOOTH_PRED, /* 9 = D207_NODE */
};
+#endif // CONFIG_SMOOTH_HV
#else
const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)] = {
-DC_PRED, 2, /* 0 = DC_NODE */
@@ -981,28 +1258,25 @@ const aom_tree_index av1_inter_mode_tree[TREE_SIZE(INTER_MODES)] = {
#if CONFIG_EXT_INTER
/* clang-format off */
+#if CONFIG_INTERINTRA
const aom_tree_index av1_interintra_mode_tree[TREE_SIZE(INTERINTRA_MODES)] = {
- -II_DC_PRED, 2, /* 0 = II_DC_NODE */
- -II_TM_PRED, 4, /* 1 = II_TM_NODE */
- -II_V_PRED, 6, /* 2 = II_V_NODE */
- 8, 12, /* 3 = II_COM_NODE */
- -II_H_PRED, 10, /* 4 = II_H_NODE */
- -II_D135_PRED, -II_D117_PRED, /* 5 = II_D135_NODE */
- -II_D45_PRED, 14, /* 6 = II_D45_NODE */
- -II_D63_PRED, 16, /* 7 = II_D63_NODE */
- -II_D153_PRED, -II_D207_PRED /* 8 = II_D153_NODE */
+ -II_DC_PRED, 2, /* 0 = II_DC_NODE */
+#if CONFIG_ALT_INTRA
+ -II_SMOOTH_PRED, 4, /* 1 = II_SMOOTH_PRED */
+#else
+ -II_TM_PRED, 4, /* 1 = II_TM_NODE */
+#endif
+ -II_V_PRED, -II_H_PRED /* 2 = II_V_NODE */
};
+#endif // CONFIG_INTERINTRA
const aom_tree_index av1_inter_compound_mode_tree
[TREE_SIZE(INTER_COMPOUND_MODES)] = {
-INTER_COMPOUND_OFFSET(ZERO_ZEROMV), 2,
-INTER_COMPOUND_OFFSET(NEAREST_NEARESTMV), 4,
6, -INTER_COMPOUND_OFFSET(NEW_NEWMV),
- 8, 12,
- -INTER_COMPOUND_OFFSET(NEAR_NEARMV), 10,
- -INTER_COMPOUND_OFFSET(NEAREST_NEARMV),
- -INTER_COMPOUND_OFFSET(NEAR_NEARESTMV),
- 14, 16,
+ -INTER_COMPOUND_OFFSET(NEAR_NEARMV), 8,
+ 10, 12,
-INTER_COMPOUND_OFFSET(NEAREST_NEWMV), -INTER_COMPOUND_OFFSET(NEW_NEARESTMV),
-INTER_COMPOUND_OFFSET(NEAR_NEWMV), -INTER_COMPOUND_OFFSET(NEW_NEARMV)
};
@@ -1383,6 +1657,10 @@ static const aom_prob default_tx_size_prob[MAX_TX_DEPTH][TX_SIZE_CONTEXTS]
#endif // CONFIG_TX64X64
};
+#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
+static const aom_prob default_quarter_tx_size_prob = 192;
+#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
+
#if CONFIG_LOOP_RESTORATION
const aom_tree_index
av1_switchable_restore_tree[TREE_SIZE(RESTORE_SWITCHABLE_TYPES)] = {
@@ -1491,6 +1769,7 @@ static const aom_prob default_txfm_partition_probs[TXFM_PARTITION_CONTEXTS] = {
static const aom_prob default_skip_probs[SKIP_CONTEXTS] = { 192, 128, 64 };
#if CONFIG_DUAL_FILTER
+#if USE_EXTRA_FILTER
static const aom_prob default_switchable_interp_prob
[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS - 1] = {
{ 235, 192, 128 }, { 36, 243, 48 }, { 34, 16, 128 },
@@ -1501,6 +1780,15 @@ static const aom_prob default_switchable_interp_prob
{ 235, 192, 128 }, { 36, 243, 48 }, { 34, 16, 128 },
{ 34, 16, 128 }, { 149, 160, 128 },
};
+#else // USE_EXTRA_FILTER
+static const aom_prob default_switchable_interp_prob
+ [SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS - 1] = {
+ { 235, 162 }, { 36, 255 }, { 34, 3 }, { 149, 144 },
+ { 235, 162 }, { 36, 255 }, { 34, 3 }, { 149, 144 },
+ { 235, 162 }, { 36, 255 }, { 34, 3 }, { 149, 144 },
+ { 235, 162 }, { 36, 255 }, { 34, 3 }, { 149, 144 },
+ };
+#endif // USE_EXTRA_FILTER
#else // CONFIG_DUAL_FILTER
static const aom_prob default_switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
[SWITCHABLE_FILTERS - 1] = {
@@ -1574,7 +1862,7 @@ static const aom_prob
default_inter_ext_tx_prob[EXT_TX_SETS_INTER][EXT_TX_SIZES][TX_TYPES - 1] = {
{
// ToDo(yaowu): remove unused entry 0.
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ 0 },
#endif
{ 0 },
@@ -1583,7 +1871,7 @@ static const aom_prob
{ 0 },
},
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ 0 },
#endif
{ 10, 24, 30, 128, 128, 128, 128, 112, 160, 128, 128, 128, 128, 128,
@@ -1596,7 +1884,7 @@ static const aom_prob
128 },
},
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ 0 },
#endif
{ 10, 30, 128, 112, 160, 128, 128, 128, 128, 128, 128 },
@@ -1605,7 +1893,7 @@ static const aom_prob
{ 10, 30, 128, 112, 160, 128, 128, 128, 128, 128, 128 },
},
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ 0 },
#endif
{ 12 },
@@ -1622,7 +1910,7 @@ static const aom_prob
[TX_TYPES - 1] = {
{
// ToDo(yaowu): remove unused entry 0.
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{
{ 0 },
},
@@ -1637,10 +1925,14 @@ static const aom_prob
{ 0 },
{ 0 },
{ 0 },
- { 0 },
#if CONFIG_ALT_INTRA
{ 0 },
+#if CONFIG_SMOOTH_HV
+ { 0 },
+ { 0 },
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
+ { 0 },
},
{
{ 0 },
@@ -1652,10 +1944,14 @@ static const aom_prob
{ 0 },
{ 0 },
{ 0 },
- { 0 },
#if CONFIG_ALT_INTRA
{ 0 },
+#if CONFIG_SMOOTH_HV
+ { 0 },
+ { 0 },
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
+ { 0 },
},
{
{ 0 },
@@ -1667,10 +1963,14 @@ static const aom_prob
{ 0 },
{ 0 },
{ 0 },
- { 0 },
#if CONFIG_ALT_INTRA
{ 0 },
+#if CONFIG_SMOOTH_HV
+ { 0 },
+ { 0 },
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
+ { 0 },
},
{
{ 0 },
@@ -1682,14 +1982,18 @@ static const aom_prob
{ 0 },
{ 0 },
{ 0 },
- { 0 },
#if CONFIG_ALT_INTRA
{ 0 },
+#if CONFIG_SMOOTH_HV
+ { 0 },
+ { 0 },
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
+ { 0 },
},
},
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{
{ 0 },
},
@@ -1704,10 +2008,14 @@ static const aom_prob
{ 10, 32, 32, 128, 16, 64 },
{ 10, 23, 32, 128, 80, 176 },
{ 10, 23, 32, 128, 80, 176 },
- { 10, 32, 32, 128, 16, 64 },
#if CONFIG_ALT_INTRA
{ 10, 32, 32, 128, 16, 64 },
+#if CONFIG_SMOOTH_HV
+ { 10, 32, 32, 128, 16, 64 },
+ { 10, 32, 32, 128, 16, 64 },
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
+ { 10, 32, 32, 128, 16, 64 },
},
{
{ 8, 224, 32, 128, 64, 128 },
@@ -1719,10 +2027,14 @@ static const aom_prob
{ 10, 32, 32, 128, 16, 64 },
{ 10, 23, 32, 128, 80, 176 },
{ 10, 23, 32, 128, 80, 176 },
- { 10, 32, 32, 128, 16, 64 },
#if CONFIG_ALT_INTRA
{ 10, 32, 32, 128, 16, 64 },
+#if CONFIG_SMOOTH_HV
+ { 10, 32, 32, 128, 16, 64 },
+ { 10, 32, 32, 128, 16, 64 },
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
+ { 10, 32, 32, 128, 16, 64 },
},
{
{ 8, 224, 32, 128, 64, 128 },
@@ -1734,10 +2046,14 @@ static const aom_prob
{ 10, 32, 32, 128, 16, 64 },
{ 10, 23, 32, 128, 80, 176 },
{ 10, 23, 32, 128, 80, 176 },
- { 10, 32, 32, 128, 16, 64 },
#if CONFIG_ALT_INTRA
{ 10, 32, 32, 128, 16, 64 },
+#if CONFIG_SMOOTH_HV
+ { 10, 32, 32, 128, 16, 64 },
+ { 10, 32, 32, 128, 16, 64 },
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
+ { 10, 32, 32, 128, 16, 64 },
},
{
{ 8, 224, 32, 128, 64, 128 },
@@ -1749,14 +2065,18 @@ static const aom_prob
{ 10, 32, 32, 128, 16, 64 },
{ 10, 23, 32, 128, 80, 176 },
{ 10, 23, 32, 128, 80, 176 },
- { 10, 32, 32, 128, 16, 64 },
#if CONFIG_ALT_INTRA
{ 10, 32, 32, 128, 16, 64 },
+#if CONFIG_SMOOTH_HV
+ { 10, 32, 32, 128, 16, 64 },
+ { 10, 32, 32, 128, 16, 64 },
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
+ { 10, 32, 32, 128, 16, 64 },
},
},
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{
{ 0 },
},
@@ -1771,10 +2091,14 @@ static const aom_prob
{ 10, 32, 16, 64 },
{ 10, 23, 80, 176 },
{ 10, 23, 80, 176 },
- { 10, 32, 16, 64 },
#if CONFIG_ALT_INTRA
{ 10, 32, 16, 64 },
+#if CONFIG_SMOOTH_HV
+ { 10, 32, 16, 64 },
+ { 10, 32, 16, 64 },
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
+ { 10, 32, 16, 64 },
},
{
{ 8, 224, 64, 128 },
@@ -1786,10 +2110,14 @@ static const aom_prob
{ 10, 32, 16, 64 },
{ 10, 23, 80, 176 },
{ 10, 23, 80, 176 },
- { 10, 32, 16, 64 },
#if CONFIG_ALT_INTRA
{ 10, 32, 16, 64 },
+#if CONFIG_SMOOTH_HV
+ { 10, 32, 16, 64 },
+ { 10, 32, 16, 64 },
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
+ { 10, 32, 16, 64 },
},
{
{ 8, 224, 64, 128 },
@@ -1801,10 +2129,14 @@ static const aom_prob
{ 10, 32, 16, 64 },
{ 10, 23, 80, 176 },
{ 10, 23, 80, 176 },
- { 10, 32, 16, 64 },
#if CONFIG_ALT_INTRA
{ 10, 32, 16, 64 },
+#if CONFIG_SMOOTH_HV
+ { 10, 32, 16, 64 },
+ { 10, 32, 16, 64 },
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
+ { 10, 32, 16, 64 },
},
{
{ 8, 224, 64, 128 },
@@ -1816,10 +2148,14 @@ static const aom_prob
{ 10, 32, 16, 64 },
{ 10, 23, 80, 176 },
{ 10, 23, 80, 176 },
- { 10, 32, 16, 64 },
#if CONFIG_ALT_INTRA
{ 10, 32, 16, 64 },
+#if CONFIG_SMOOTH_HV
+ { 10, 32, 16, 64 },
+ { 10, 32, 16, 64 },
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
+ { 10, 32, 16, 64 },
},
},
};
@@ -1838,7 +2174,7 @@ int av1_ext_tx_inv[TX_TYPES];
static const aom_prob
default_intra_ext_tx_prob[EXT_TX_SIZES][TX_TYPES][TX_TYPES - 1] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ { 240, 85, 128 }, { 4, 1, 248 }, { 4, 1, 8 }, { 4, 248, 128 } },
#endif
{ { 240, 85, 128 }, { 4, 1, 248 }, { 4, 1, 8 }, { 4, 248, 128 } },
@@ -1847,7 +2183,7 @@ static const aom_prob
};
static const aom_prob default_inter_ext_tx_prob[EXT_TX_SIZES][TX_TYPES - 1] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ 160, 85, 128 },
#endif
{ 160, 85, 128 },
@@ -1866,10 +2202,8 @@ const aom_tree_index av1_intra_filter_tree[TREE_SIZE(INTRA_FILTERS)] = {
-INTRA_FILTER_LINEAR, 2, -INTRA_FILTER_8TAP, 4, -INTRA_FILTER_8TAP_SHARP,
-INTRA_FILTER_8TAP_SMOOTH,
};
-#if CONFIG_EC_MULTISYMBOL
int av1_intra_filter_ind[INTRA_FILTERS];
int av1_intra_filter_inv[INTRA_FILTERS];
-#endif // CONFIG_EC_MULTISYMBOL
#endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
#if CONFIG_FILTER_INTRA
@@ -1879,7 +2213,7 @@ static const aom_prob default_filter_intra_probs[2] = { 230, 230 };
#if CONFIG_SUPERTX
static const aom_prob
default_supertx_prob[PARTITION_SUPERTX_CONTEXTS][TX_SIZES] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
#if CONFIG_TX64X64
{ 1, 1, 160, 160, 170, 180 }, { 1, 1, 200, 200, 210, 220 },
#else
@@ -1890,8 +2224,8 @@ static const aom_prob
{ 1, 160, 160, 170, 180 }, { 1, 200, 200, 210, 220 },
#else
{ 1, 160, 160, 170 }, { 1, 200, 200, 210 },
-#endif // CONFIG_CB4X4
#endif // CONFIG_TX64X64
+#endif // CONFIG_CHROMA_2X2
};
#endif // CONFIG_SUPERTX
@@ -1905,8 +2239,8 @@ static const aom_prob default_segment_pred_probs[PREDICTION_PROBS] = {
};
// clang-format on
-#if CONFIG_EC_MULTISYMBOL
#if CONFIG_DUAL_FILTER
+#if USE_EXTRA_FILTER
static const aom_cdf_prob
default_switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS][CDF_SIZE(
SWITCHABLE_FILTERS)] = {
@@ -1931,7 +2265,7 @@ static const aom_cdf_prob
{ AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(6128), AOM_ICDF(32768), 0 },
{ AOM_ICDF(19072), AOM_ICDF(23352), AOM_ICDF(27632), AOM_ICDF(32768), 0 }
};
-#else
+#else // USE_EXTRA_FILTER
static const aom_cdf_prob
default_switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS][CDF_SIZE(
SWITCHABLE_FILTERS)] = {
@@ -1939,8 +2273,30 @@ static const aom_cdf_prob
{ AOM_ICDF(4608), AOM_ICDF(32658), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4352), AOM_ICDF(4685), AOM_ICDF(32768), 0 },
{ AOM_ICDF(19072), AOM_ICDF(26776), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(30080), AOM_ICDF(31781), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4608), AOM_ICDF(32658), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4352), AOM_ICDF(4685), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(19072), AOM_ICDF(26776), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(30080), AOM_ICDF(31781), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4608), AOM_ICDF(32658), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4352), AOM_ICDF(4685), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(19072), AOM_ICDF(26776), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(30080), AOM_ICDF(31781), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4608), AOM_ICDF(32658), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4352), AOM_ICDF(4685), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(19072), AOM_ICDF(26776), AOM_ICDF(32768), 0 },
};
-#endif
+#endif // USE_EXTRA_FILTER
+#else // CONFIG_DUAL_FILTER
+static const aom_cdf_prob
+ default_switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS][CDF_SIZE(
+ SWITCHABLE_FILTERS)] = {
+ { AOM_ICDF(30080), AOM_ICDF(31781), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4608), AOM_ICDF(32658), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4352), AOM_ICDF(4685), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(19072), AOM_ICDF(26776), AOM_ICDF(32768), 0 },
+ };
+#endif // CONFIG_DUAL_FILTER
static const aom_cdf_prob default_seg_tree_cdf[CDF_SIZE(MAX_SEGMENTS)] = {
AOM_ICDF(4096), AOM_ICDF(8192), AOM_ICDF(12288),
@@ -1966,6 +2322,83 @@ static const aom_cdf_prob
};
#if CONFIG_ALT_INTRA
+#if CONFIG_SMOOTH_HV
+static const aom_cdf_prob
+ default_if_y_mode_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(INTRA_MODES)] = {
+ { AOM_ICDF(7168), AOM_ICDF(8468), AOM_ICDF(11980), AOM_ICDF(15213),
+ AOM_ICDF(18579), AOM_ICDF(21075), AOM_ICDF(24090), AOM_ICDF(25954),
+ AOM_ICDF(27870), AOM_ICDF(29439), AOM_ICDF(31051), AOM_ICDF(31863),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(11776), AOM_ICDF(21616), AOM_ICDF(23663), AOM_ICDF(25147),
+ AOM_ICDF(26060), AOM_ICDF(26828), AOM_ICDF(27246), AOM_ICDF(28066),
+ AOM_ICDF(28654), AOM_ICDF(29474), AOM_ICDF(31353), AOM_ICDF(32038),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(14720), AOM_ICDF(21911), AOM_ICDF(23650), AOM_ICDF(25282),
+ AOM_ICDF(25740), AOM_ICDF(26108), AOM_ICDF(26316), AOM_ICDF(26896),
+ AOM_ICDF(27194), AOM_ICDF(27695), AOM_ICDF(30113), AOM_ICDF(31254),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(18944), AOM_ICDF(27422), AOM_ICDF(28403), AOM_ICDF(29386),
+ AOM_ICDF(29405), AOM_ICDF(29460), AOM_ICDF(29550), AOM_ICDF(29588),
+ AOM_ICDF(29600), AOM_ICDF(29637), AOM_ICDF(30542), AOM_ICDF(31298),
+ AOM_ICDF(32768), 0 },
+ };
+
+static const aom_cdf_prob
+ default_uv_mode_cdf[INTRA_MODES][CDF_SIZE(INTRA_MODES)] = {
+ { AOM_ICDF(23552), AOM_ICDF(23660), AOM_ICDF(26044), AOM_ICDF(28731),
+ AOM_ICDF(29093), AOM_ICDF(29590), AOM_ICDF(30000), AOM_ICDF(30465),
+ AOM_ICDF(30825), AOM_ICDF(31478), AOM_ICDF(32088), AOM_ICDF(32401),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(2944), AOM_ICDF(3294), AOM_ICDF(26781), AOM_ICDF(27903),
+ AOM_ICDF(28179), AOM_ICDF(29237), AOM_ICDF(29430), AOM_ICDF(30317),
+ AOM_ICDF(30441), AOM_ICDF(30614), AOM_ICDF(31556), AOM_ICDF(31963),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4352), AOM_ICDF(4685), AOM_ICDF(5453), AOM_ICDF(28285),
+ AOM_ICDF(28641), AOM_ICDF(28927), AOM_ICDF(29092), AOM_ICDF(29279),
+ AOM_ICDF(30083), AOM_ICDF(31384), AOM_ICDF(32027), AOM_ICDF(32406),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(17664), AOM_ICDF(17841), AOM_ICDF(20465), AOM_ICDF(22016),
+ AOM_ICDF(22364), AOM_ICDF(22916), AOM_ICDF(27149), AOM_ICDF(29498),
+ AOM_ICDF(29766), AOM_ICDF(31091), AOM_ICDF(31871), AOM_ICDF(32260),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(16640), AOM_ICDF(16766), AOM_ICDF(18516), AOM_ICDF(20359),
+ AOM_ICDF(24964), AOM_ICDF(27591), AOM_ICDF(27915), AOM_ICDF(28389),
+ AOM_ICDF(29997), AOM_ICDF(30495), AOM_ICDF(31623), AOM_ICDF(32151),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(13952), AOM_ICDF(14173), AOM_ICDF(18168), AOM_ICDF(19139),
+ AOM_ICDF(21064), AOM_ICDF(30601), AOM_ICDF(30889), AOM_ICDF(31410),
+ AOM_ICDF(31803), AOM_ICDF(32059), AOM_ICDF(32358), AOM_ICDF(32563),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(15872), AOM_ICDF(15938), AOM_ICDF(17056), AOM_ICDF(21545),
+ AOM_ICDF(23947), AOM_ICDF(24667), AOM_ICDF(24920), AOM_ICDF(25196),
+ AOM_ICDF(30638), AOM_ICDF(31229), AOM_ICDF(31968), AOM_ICDF(32284),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(16256), AOM_ICDF(16385), AOM_ICDF(17409), AOM_ICDF(23210),
+ AOM_ICDF(23628), AOM_ICDF(24009), AOM_ICDF(24967), AOM_ICDF(25546),
+ AOM_ICDF(26054), AOM_ICDF(31037), AOM_ICDF(31875), AOM_ICDF(32335),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(14720), AOM_ICDF(14932), AOM_ICDF(19461), AOM_ICDF(20713),
+ AOM_ICDF(21073), AOM_ICDF(21852), AOM_ICDF(23430), AOM_ICDF(29631),
+ AOM_ICDF(29876), AOM_ICDF(30520), AOM_ICDF(31591), AOM_ICDF(32078),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(16768), AOM_ICDF(17018), AOM_ICDF(20217), AOM_ICDF(22624),
+ AOM_ICDF(23484), AOM_ICDF(23698), AOM_ICDF(24300), AOM_ICDF(25193),
+ AOM_ICDF(25785), AOM_ICDF(26903), AOM_ICDF(29835), AOM_ICDF(31187),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(16768), AOM_ICDF(17081), AOM_ICDF(21064), AOM_ICDF(23339),
+ AOM_ICDF(24047), AOM_ICDF(24264), AOM_ICDF(24829), AOM_ICDF(25759),
+ AOM_ICDF(26224), AOM_ICDF(27119), AOM_ICDF(29833), AOM_ICDF(31599),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(17536), AOM_ICDF(17774), AOM_ICDF(20293), AOM_ICDF(23203),
+ AOM_ICDF(23906), AOM_ICDF(24094), AOM_ICDF(24636), AOM_ICDF(25303),
+ AOM_ICDF(26003), AOM_ICDF(27271), AOM_ICDF(29912), AOM_ICDF(30927),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(17536), AOM_ICDF(18250), AOM_ICDF(23467), AOM_ICDF(27840),
+ AOM_ICDF(28058), AOM_ICDF(28626), AOM_ICDF(28853), AOM_ICDF(29541),
+ AOM_ICDF(29907), AOM_ICDF(30600), AOM_ICDF(31515), AOM_ICDF(32049),
+ AOM_ICDF(32768), 0 },
+ };
+#else // !CONFIG_SMOOTH_HV
static const aom_cdf_prob
default_if_y_mode_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(INTRA_MODES)] = {
{ AOM_ICDF(11264), AOM_ICDF(12608), AOM_ICDF(16309), AOM_ICDF(21086),
@@ -2018,6 +2451,7 @@ static const aom_cdf_prob
AOM_ICDF(30598), AOM_ICDF(31129), AOM_ICDF(31244), AOM_ICDF(31655),
AOM_ICDF(31868), AOM_ICDF(32234), AOM_ICDF(32768), 0 },
};
+#endif // CONFIG_SMOOTH_HV
#else // !CONFIG_ALT_INTRA
static const aom_cdf_prob
default_if_y_mode_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(INTRA_MODES)] = {
@@ -2161,270 +2595,354 @@ static const aom_cdf_prob default_intra_ext_tx_cdf
[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES][CDF_SIZE(TX_TYPES)] = {
{
// FIXME: unused zero positions, from uncoded trivial transform set
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{
{ 0 },
},
#endif
- { { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
+ {
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
#if CONFIG_ALT_INTRA
- { 0 }
-#endif
+ { 0 },
+#if CONFIG_SMOOTH_HV
+ { 0 },
+ { 0 },
+#endif // CONFIG_SMOOTH_HV
+#endif // CONFIG_ALT_INTRA
+ { 0 },
},
- { { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
+ {
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
#if CONFIG_ALT_INTRA
- { 0 }
-#endif
+ { 0 },
+#if CONFIG_SMOOTH_HV
+ { 0 },
+ { 0 },
+#endif // CONFIG_SMOOTH_HV
+#endif // CONFIG_ALT_INTRA
+ { 0 },
},
- { { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
+ {
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
#if CONFIG_ALT_INTRA
- { 0 }
-#endif
+ { 0 },
+#if CONFIG_SMOOTH_HV
+ { 0 },
+ { 0 },
+#endif // CONFIG_SMOOTH_HV
+#endif // CONFIG_ALT_INTRA
+ { 0 },
},
- { { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
- { 0 },
+ {
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
+ { 0 },
#if CONFIG_ALT_INTRA
- { 0 }
-#endif
+ { 0 },
+#if CONFIG_SMOOTH_HV
+ { 0 },
+ { 0 },
+#endif // CONFIG_SMOOTH_HV
+#endif // CONFIG_ALT_INTRA
+ { 0 },
},
},
{
- { { AOM_ICDF(1024), AOM_ICDF(28800), AOM_ICDF(29048), AOM_ICDF(29296),
- AOM_ICDF(30164), AOM_ICDF(31466), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(27118), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1152), AOM_ICDF(25852), AOM_ICDF(26284), AOM_ICDF(26717),
- AOM_ICDF(28230), AOM_ICDF(30499), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1024), AOM_ICDF(2016), AOM_ICDF(3938), AOM_ICDF(5860),
- AOM_ICDF(29404), AOM_ICDF(31086), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(27118), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(5900), AOM_ICDF(7691),
- AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(5900), AOM_ICDF(7691),
- AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+ {
+ { AOM_ICDF(1024), AOM_ICDF(28800), AOM_ICDF(29048),
+ AOM_ICDF(29296), AOM_ICDF(30164), AOM_ICDF(31466),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(27118), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1152), AOM_ICDF(25852), AOM_ICDF(26284),
+ AOM_ICDF(26717), AOM_ICDF(28230), AOM_ICDF(30499),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1024), AOM_ICDF(2016), AOM_ICDF(3938), AOM_ICDF(5860),
+ AOM_ICDF(29404), AOM_ICDF(31086), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(27118), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(5900), AOM_ICDF(7691),
+ AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(5900), AOM_ICDF(7691),
+ AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 },
#if CONFIG_ALT_INTRA
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 }
-#endif
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+#if CONFIG_SMOOTH_HV
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+#endif // CONFIG_SMOOTH_HV
+#endif // CONFIG_ALT_INTRA
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
},
- { { AOM_ICDF(1024), AOM_ICDF(28800), AOM_ICDF(29048), AOM_ICDF(29296),
- AOM_ICDF(30164), AOM_ICDF(31466), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(27118), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1152), AOM_ICDF(25852), AOM_ICDF(26284), AOM_ICDF(26717),
- AOM_ICDF(28230), AOM_ICDF(30499), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1024), AOM_ICDF(2016), AOM_ICDF(3938), AOM_ICDF(5860),
- AOM_ICDF(29404), AOM_ICDF(31086), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(27118), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(5900), AOM_ICDF(7691),
- AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(5900), AOM_ICDF(7691),
- AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+ {
+ { AOM_ICDF(1024), AOM_ICDF(28800), AOM_ICDF(29048),
+ AOM_ICDF(29296), AOM_ICDF(30164), AOM_ICDF(31466),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(27118), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1152), AOM_ICDF(25852), AOM_ICDF(26284),
+ AOM_ICDF(26717), AOM_ICDF(28230), AOM_ICDF(30499),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1024), AOM_ICDF(2016), AOM_ICDF(3938), AOM_ICDF(5860),
+ AOM_ICDF(29404), AOM_ICDF(31086), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(27118), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(5900), AOM_ICDF(7691),
+ AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(5900), AOM_ICDF(7691),
+ AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 },
#if CONFIG_ALT_INTRA
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 }
-#endif
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+#if CONFIG_SMOOTH_HV
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+#endif // CONFIG_SMOOTH_HV
+#endif // CONFIG_ALT_INTRA
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
},
- { { AOM_ICDF(1024), AOM_ICDF(28800), AOM_ICDF(29048), AOM_ICDF(29296),
- AOM_ICDF(30164), AOM_ICDF(31466), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(27118), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1152), AOM_ICDF(25852), AOM_ICDF(26284), AOM_ICDF(26717),
- AOM_ICDF(28230), AOM_ICDF(30499), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1024), AOM_ICDF(2016), AOM_ICDF(3938), AOM_ICDF(5860),
- AOM_ICDF(29404), AOM_ICDF(31086), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(27118), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(5900), AOM_ICDF(7691),
- AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(5900), AOM_ICDF(7691),
- AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+ {
+ { AOM_ICDF(1024), AOM_ICDF(28800), AOM_ICDF(29048),
+ AOM_ICDF(29296), AOM_ICDF(30164), AOM_ICDF(31466),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(27118), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1152), AOM_ICDF(25852), AOM_ICDF(26284),
+ AOM_ICDF(26717), AOM_ICDF(28230), AOM_ICDF(30499),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1024), AOM_ICDF(2016), AOM_ICDF(3938), AOM_ICDF(5860),
+ AOM_ICDF(29404), AOM_ICDF(31086), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(27118), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(5900), AOM_ICDF(7691),
+ AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(5900), AOM_ICDF(7691),
+ AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 },
#if CONFIG_ALT_INTRA
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 }
-#endif
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+#if CONFIG_SMOOTH_HV
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+#endif // CONFIG_SMOOTH_HV
+#endif // CONFIG_ALT_INTRA
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
},
- { { AOM_ICDF(1024), AOM_ICDF(28800), AOM_ICDF(29048), AOM_ICDF(29296),
- AOM_ICDF(30164), AOM_ICDF(31466), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(27118), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1152), AOM_ICDF(25852), AOM_ICDF(26284), AOM_ICDF(26717),
- AOM_ICDF(28230), AOM_ICDF(30499), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1024), AOM_ICDF(2016), AOM_ICDF(3938), AOM_ICDF(5860),
- AOM_ICDF(29404), AOM_ICDF(31086), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(27118), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(5900), AOM_ICDF(7691),
- AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(5900), AOM_ICDF(7691),
- AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+ {
+ { AOM_ICDF(1024), AOM_ICDF(28800), AOM_ICDF(29048),
+ AOM_ICDF(29296), AOM_ICDF(30164), AOM_ICDF(31466),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(27118), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1152), AOM_ICDF(25852), AOM_ICDF(26284),
+ AOM_ICDF(26717), AOM_ICDF(28230), AOM_ICDF(30499),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1024), AOM_ICDF(2016), AOM_ICDF(3938), AOM_ICDF(5860),
+ AOM_ICDF(29404), AOM_ICDF(31086), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(27118), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(5900), AOM_ICDF(7691),
+ AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(5900), AOM_ICDF(7691),
+ AOM_ICDF(15528), AOM_ICDF(27380), AOM_ICDF(32768), 0 },
#if CONFIG_ALT_INTRA
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
- AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 }
-#endif
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+#if CONFIG_SMOOTH_HV
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
+#endif // CONFIG_SMOOTH_HV
+#endif // CONFIG_ALT_INTRA
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(8660),
+ AOM_ICDF(10167), AOM_ICDF(15817), AOM_ICDF(32768), 0 },
},
},
{
- { { AOM_ICDF(1024), AOM_ICDF(28800), AOM_ICDF(29792), AOM_ICDF(31280),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(26310),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1152), AOM_ICDF(25852), AOM_ICDF(27581), AOM_ICDF(30174),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1024), AOM_ICDF(2016), AOM_ICDF(28924), AOM_ICDF(30846),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(26310),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(13065), AOM_ICDF(26611),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(13065), AOM_ICDF(26611),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
- AOM_ICDF(32768), 0 },
+ {
+ { AOM_ICDF(1024), AOM_ICDF(28800), AOM_ICDF(29792),
+ AOM_ICDF(31280), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(26310),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1152), AOM_ICDF(25852), AOM_ICDF(27581),
+ AOM_ICDF(30174), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1024), AOM_ICDF(2016), AOM_ICDF(28924),
+ AOM_ICDF(30846), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(26310),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(13065),
+ AOM_ICDF(26611), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(13065),
+ AOM_ICDF(26611), AOM_ICDF(32768), 0 },
#if CONFIG_ALT_INTRA
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
- AOM_ICDF(32768), 0 }
-#endif
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
+#if CONFIG_SMOOTH_HV
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
+#endif // CONFIG_SMOOTH_HV
+#endif // CONFIG_ALT_INTRA
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
},
- { { AOM_ICDF(1024), AOM_ICDF(28800), AOM_ICDF(29792), AOM_ICDF(31280),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(26310),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1152), AOM_ICDF(25852), AOM_ICDF(27581), AOM_ICDF(30174),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1024), AOM_ICDF(2016), AOM_ICDF(28924), AOM_ICDF(30846),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(26310),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(13065), AOM_ICDF(26611),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(13065), AOM_ICDF(26611),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
- AOM_ICDF(32768), 0 },
+ {
+ { AOM_ICDF(1024), AOM_ICDF(28800), AOM_ICDF(29792),
+ AOM_ICDF(31280), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(26310),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1152), AOM_ICDF(25852), AOM_ICDF(27581),
+ AOM_ICDF(30174), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1024), AOM_ICDF(2016), AOM_ICDF(28924),
+ AOM_ICDF(30846), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(26310),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(13065),
+ AOM_ICDF(26611), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(13065),
+ AOM_ICDF(26611), AOM_ICDF(32768), 0 },
#if CONFIG_ALT_INTRA
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
- AOM_ICDF(32768), 0 }
-#endif
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
+#if CONFIG_SMOOTH_HV
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
+#endif // CONFIG_SMOOTH_HV
+#endif // CONFIG_ALT_INTRA
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
},
- { { AOM_ICDF(1024), AOM_ICDF(28800), AOM_ICDF(29792), AOM_ICDF(31280),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(26310),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1152), AOM_ICDF(25852), AOM_ICDF(27581), AOM_ICDF(30174),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1024), AOM_ICDF(2016), AOM_ICDF(28924), AOM_ICDF(30846),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(26310),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(13065), AOM_ICDF(26611),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(13065), AOM_ICDF(26611),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
- AOM_ICDF(32768), 0 },
+ {
+ { AOM_ICDF(1024), AOM_ICDF(28800), AOM_ICDF(29792),
+ AOM_ICDF(31280), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(26310),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1152), AOM_ICDF(25852), AOM_ICDF(27581),
+ AOM_ICDF(30174), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1024), AOM_ICDF(2016), AOM_ICDF(28924),
+ AOM_ICDF(30846), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(26310),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(13065),
+ AOM_ICDF(26611), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(13065),
+ AOM_ICDF(26611), AOM_ICDF(32768), 0 },
#if CONFIG_ALT_INTRA
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
- AOM_ICDF(32768), 0 }
-#endif
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
+#if CONFIG_SMOOTH_HV
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
+#endif // CONFIG_SMOOTH_HV
+#endif // CONFIG_ALT_INTRA
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
},
- { { AOM_ICDF(1024), AOM_ICDF(28800), AOM_ICDF(29792), AOM_ICDF(31280),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(26310),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1152), AOM_ICDF(25852), AOM_ICDF(27581), AOM_ICDF(30174),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1024), AOM_ICDF(2016), AOM_ICDF(28924), AOM_ICDF(30846),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(26310),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(13065), AOM_ICDF(26611),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(13065), AOM_ICDF(26611),
- AOM_ICDF(32768), 0 },
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
- AOM_ICDF(32768), 0 },
+ {
+ { AOM_ICDF(1024), AOM_ICDF(28800), AOM_ICDF(29792),
+ AOM_ICDF(31280), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(26310),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1152), AOM_ICDF(25852), AOM_ICDF(27581),
+ AOM_ICDF(30174), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1024), AOM_ICDF(2016), AOM_ICDF(28924),
+ AOM_ICDF(30846), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(26310),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(13065),
+ AOM_ICDF(26611), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(4109), AOM_ICDF(13065),
+ AOM_ICDF(26611), AOM_ICDF(32768), 0 },
#if CONFIG_ALT_INTRA
- { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
- AOM_ICDF(32768), 0 }
-#endif
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
+#if CONFIG_SMOOTH_HV
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
+#endif // CONFIG_SMOOTH_HV
+#endif // CONFIG_ALT_INTRA
+ { AOM_ICDF(1280), AOM_ICDF(5216), AOM_ICDF(6938), AOM_ICDF(13396),
+ AOM_ICDF(32768), 0 },
},
}
};
@@ -2432,7 +2950,7 @@ static const aom_cdf_prob
default_inter_ext_tx_cdf[EXT_TX_SETS_INTER][EXT_TX_SIZES][CDF_SIZE(
TX_TYPES)] = {
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ 0 },
#endif
{ 0 },
@@ -2440,7 +2958,7 @@ static const aom_cdf_prob
{ 0 },
{ 0 } },
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ 0 },
#endif
{ AOM_ICDF(1280), AOM_ICDF(1453), AOM_ICDF(1626), AOM_ICDF(2277),
@@ -2464,7 +2982,7 @@ static const aom_cdf_prob
AOM_ICDF(28253), AOM_ICDF(29758), AOM_ICDF(31263), AOM_ICDF(32768),
0 } },
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ 0 },
#endif
{ AOM_ICDF(1280), AOM_ICDF(3125), AOM_ICDF(4970), AOM_ICDF(17132),
@@ -2484,7 +3002,7 @@ static const aom_cdf_prob
AOM_ICDF(28370), AOM_ICDF(29836), AOM_ICDF(31302), AOM_ICDF(32768),
0 } },
{
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ 0 },
#endif
{ AOM_ICDF(1536), AOM_ICDF(32768), 0 },
@@ -2495,7 +3013,7 @@ static const aom_cdf_prob
#else
static const aom_cdf_prob
default_intra_ext_tx_cdf[EXT_TX_SIZES][TX_TYPES][CDF_SIZE(TX_TYPES)] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ { AOM_ICDF(30720), AOM_ICDF(31400), AOM_ICDF(32084), AOM_ICDF(32768),
0 },
{ AOM_ICDF(512), AOM_ICDF(638), AOM_ICDF(31764), AOM_ICDF(32768), 0 },
@@ -2526,7 +3044,7 @@ static const aom_cdf_prob
static const aom_cdf_prob
default_inter_ext_tx_cdf[EXT_TX_SIZES][CDF_SIZE(TX_TYPES)] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ AOM_ICDF(20480), AOM_ICDF(24560), AOM_ICDF(28664), AOM_ICDF(32768), 0 },
#endif
{ AOM_ICDF(20480), AOM_ICDF(24560), AOM_ICDF(28664), AOM_ICDF(32768), 0 },
@@ -2546,10 +3064,724 @@ static const aom_cdf_prob
};
#endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
+#if CONFIG_CFL
+static const aom_cdf_prob default_cfl_alpha_cdf[CDF_SIZE(CFL_ALPHABET_SIZE)] = {
+ // decreasing likelihood, after 6 iterations of alpha RDO on subset 3
+ AOM_ICDF(23928), AOM_ICDF(26267), AOM_ICDF(27319), AOM_ICDF(28330),
+ AOM_ICDF(29341), AOM_ICDF(30160), AOM_ICDF(30581), AOM_ICDF(30983),
+ AOM_ICDF(31353), AOM_ICDF(31634), AOM_ICDF(31907), AOM_ICDF(32171),
+ AOM_ICDF(32407), AOM_ICDF(32558), AOM_ICDF(32669), AOM_ICDF(32768)
+};
+#endif
+
// CDF version of 'av1_kf_y_mode_prob'.
const aom_cdf_prob
av1_kf_y_mode_cdf[INTRA_MODES][INTRA_MODES][CDF_SIZE(INTRA_MODES)] = {
#if CONFIG_ALT_INTRA
+#if CONFIG_SMOOTH_HV
+ {
+ { AOM_ICDF(14208), AOM_ICDF(16238), AOM_ICDF(19079), AOM_ICDF(22512),
+ AOM_ICDF(23632), AOM_ICDF(24373), AOM_ICDF(25291), AOM_ICDF(26109),
+ AOM_ICDF(26811), AOM_ICDF(27858), AOM_ICDF(30428), AOM_ICDF(31424),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(10496), AOM_ICDF(13193), AOM_ICDF(20992), AOM_ICDF(22569),
+ AOM_ICDF(23557), AOM_ICDF(24442), AOM_ICDF(25515), AOM_ICDF(26478),
+ AOM_ICDF(26994), AOM_ICDF(27693), AOM_ICDF(30349), AOM_ICDF(31757),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5120), AOM_ICDF(8252), AOM_ICDF(9593), AOM_ICDF(22972),
+ AOM_ICDF(23813), AOM_ICDF(24168), AOM_ICDF(24638), AOM_ICDF(25019),
+ AOM_ICDF(26048), AOM_ICDF(27413), AOM_ICDF(30090), AOM_ICDF(30812),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(12544), AOM_ICDF(14045), AOM_ICDF(16678), AOM_ICDF(19167),
+ AOM_ICDF(20459), AOM_ICDF(21329), AOM_ICDF(23518), AOM_ICDF(24783),
+ AOM_ICDF(25563), AOM_ICDF(27280), AOM_ICDF(30217), AOM_ICDF(31273),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(7552), AOM_ICDF(8636), AOM_ICDF(10993), AOM_ICDF(12992),
+ AOM_ICDF(18616), AOM_ICDF(21880), AOM_ICDF(23113), AOM_ICDF(23867),
+ AOM_ICDF(25710), AOM_ICDF(26758), AOM_ICDF(30115), AOM_ICDF(31328),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(11008), AOM_ICDF(12708), AOM_ICDF(16704), AOM_ICDF(18234),
+ AOM_ICDF(21591), AOM_ICDF(26744), AOM_ICDF(28368), AOM_ICDF(30104),
+ AOM_ICDF(31270), AOM_ICDF(32171), AOM_ICDF(32539), AOM_ICDF(32669),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6272), AOM_ICDF(7307), AOM_ICDF(8998), AOM_ICDF(12979),
+ AOM_ICDF(18143), AOM_ICDF(19397), AOM_ICDF(20233), AOM_ICDF(20772),
+ AOM_ICDF(25645), AOM_ICDF(26869), AOM_ICDF(30049), AOM_ICDF(30984),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(8192), AOM_ICDF(9536), AOM_ICDF(11533), AOM_ICDF(15940),
+ AOM_ICDF(17403), AOM_ICDF(18169), AOM_ICDF(19253), AOM_ICDF(20045),
+ AOM_ICDF(21337), AOM_ICDF(25847), AOM_ICDF(29551), AOM_ICDF(30682),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(10752), AOM_ICDF(12558), AOM_ICDF(15005), AOM_ICDF(16854),
+ AOM_ICDF(18148), AOM_ICDF(19307), AOM_ICDF(21410), AOM_ICDF(23939),
+ AOM_ICDF(24698), AOM_ICDF(26117), AOM_ICDF(29832), AOM_ICDF(31323),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(7424), AOM_ICDF(9008), AOM_ICDF(11885), AOM_ICDF(14829),
+ AOM_ICDF(16543), AOM_ICDF(16779), AOM_ICDF(17841), AOM_ICDF(19182),
+ AOM_ICDF(20190), AOM_ICDF(21664), AOM_ICDF(27650), AOM_ICDF(29909),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6528), AOM_ICDF(8476), AOM_ICDF(12841), AOM_ICDF(15721),
+ AOM_ICDF(17437), AOM_ICDF(17823), AOM_ICDF(18874), AOM_ICDF(20394),
+ AOM_ICDF(21216), AOM_ICDF(22344), AOM_ICDF(27922), AOM_ICDF(30743),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(8704), AOM_ICDF(10114), AOM_ICDF(12415), AOM_ICDF(15730),
+ AOM_ICDF(17127), AOM_ICDF(17265), AOM_ICDF(18294), AOM_ICDF(19255),
+ AOM_ICDF(20258), AOM_ICDF(21675), AOM_ICDF(27525), AOM_ICDF(29082),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6272), AOM_ICDF(12586), AOM_ICDF(15818), AOM_ICDF(21751),
+ AOM_ICDF(22707), AOM_ICDF(23300), AOM_ICDF(24262), AOM_ICDF(25126),
+ AOM_ICDF(25992), AOM_ICDF(27448), AOM_ICDF(30004), AOM_ICDF(31073),
+ AOM_ICDF(32768), 0 },
+ },
+ {
+ { AOM_ICDF(3968), AOM_ICDF(6893), AOM_ICDF(20538), AOM_ICDF(22050),
+ AOM_ICDF(22805), AOM_ICDF(24408), AOM_ICDF(24833), AOM_ICDF(26073),
+ AOM_ICDF(26439), AOM_ICDF(26884), AOM_ICDF(29895), AOM_ICDF(31938),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(3072), AOM_ICDF(6204), AOM_ICDF(24363), AOM_ICDF(24995),
+ AOM_ICDF(25363), AOM_ICDF(26103), AOM_ICDF(26546), AOM_ICDF(27518),
+ AOM_ICDF(27621), AOM_ICDF(27902), AOM_ICDF(30164), AOM_ICDF(32148),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(2560), AOM_ICDF(6572), AOM_ICDF(13837), AOM_ICDF(19693),
+ AOM_ICDF(20377), AOM_ICDF(21010), AOM_ICDF(21699), AOM_ICDF(22737),
+ AOM_ICDF(23286), AOM_ICDF(24323), AOM_ICDF(28875), AOM_ICDF(30837),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6912), AOM_ICDF(8831), AOM_ICDF(17059), AOM_ICDF(18404),
+ AOM_ICDF(19221), AOM_ICDF(20434), AOM_ICDF(22313), AOM_ICDF(24151),
+ AOM_ICDF(24420), AOM_ICDF(25855), AOM_ICDF(29474), AOM_ICDF(31623),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(2944), AOM_ICDF(4808), AOM_ICDF(14965), AOM_ICDF(15870),
+ AOM_ICDF(18714), AOM_ICDF(21989), AOM_ICDF(22957), AOM_ICDF(24528),
+ AOM_ICDF(25365), AOM_ICDF(26001), AOM_ICDF(29596), AOM_ICDF(31678),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4352), AOM_ICDF(6239), AOM_ICDF(19711), AOM_ICDF(20602),
+ AOM_ICDF(22489), AOM_ICDF(27311), AOM_ICDF(28228), AOM_ICDF(30516),
+ AOM_ICDF(31097), AOM_ICDF(31750), AOM_ICDF(32319), AOM_ICDF(32656),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(2944), AOM_ICDF(4925), AOM_ICDF(13952), AOM_ICDF(15490),
+ AOM_ICDF(18397), AOM_ICDF(20200), AOM_ICDF(20986), AOM_ICDF(22367),
+ AOM_ICDF(24967), AOM_ICDF(25820), AOM_ICDF(29755), AOM_ICDF(31473),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4224), AOM_ICDF(6120), AOM_ICDF(14968), AOM_ICDF(17184),
+ AOM_ICDF(18063), AOM_ICDF(19140), AOM_ICDF(20258), AOM_ICDF(21822),
+ AOM_ICDF(22463), AOM_ICDF(24838), AOM_ICDF(28989), AOM_ICDF(31277),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5120), AOM_ICDF(7280), AOM_ICDF(17535), AOM_ICDF(18348),
+ AOM_ICDF(19116), AOM_ICDF(20689), AOM_ICDF(21916), AOM_ICDF(24968),
+ AOM_ICDF(25242), AOM_ICDF(26095), AOM_ICDF(29588), AOM_ICDF(31787),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(2816), AOM_ICDF(4922), AOM_ICDF(17105), AOM_ICDF(18458),
+ AOM_ICDF(19325), AOM_ICDF(19614), AOM_ICDF(20231), AOM_ICDF(21700),
+ AOM_ICDF(22089), AOM_ICDF(22756), AOM_ICDF(27879), AOM_ICDF(31278),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(2560), AOM_ICDF(4920), AOM_ICDF(18518), AOM_ICDF(19680),
+ AOM_ICDF(20386), AOM_ICDF(20689), AOM_ICDF(21208), AOM_ICDF(22472),
+ AOM_ICDF(22754), AOM_ICDF(23223), AOM_ICDF(27809), AOM_ICDF(31664),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(3328), AOM_ICDF(5513), AOM_ICDF(17331), AOM_ICDF(19065),
+ AOM_ICDF(19882), AOM_ICDF(20105), AOM_ICDF(20748), AOM_ICDF(22110),
+ AOM_ICDF(22443), AOM_ICDF(23129), AOM_ICDF(28099), AOM_ICDF(30944),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(2560), AOM_ICDF(6690), AOM_ICDF(20748), AOM_ICDF(22590),
+ AOM_ICDF(23037), AOM_ICDF(23659), AOM_ICDF(24406), AOM_ICDF(25582),
+ AOM_ICDF(25835), AOM_ICDF(26485), AOM_ICDF(29553), AOM_ICDF(31826),
+ AOM_ICDF(32768), 0 },
+ },
+ {
+ { AOM_ICDF(11392), AOM_ICDF(13647), AOM_ICDF(15216), AOM_ICDF(23156),
+ AOM_ICDF(24102), AOM_ICDF(24540), AOM_ICDF(25183), AOM_ICDF(25746),
+ AOM_ICDF(26706), AOM_ICDF(28032), AOM_ICDF(30511), AOM_ICDF(31357),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(8064), AOM_ICDF(11635), AOM_ICDF(17166), AOM_ICDF(22459),
+ AOM_ICDF(23608), AOM_ICDF(24297), AOM_ICDF(25025), AOM_ICDF(25902),
+ AOM_ICDF(26438), AOM_ICDF(27551), AOM_ICDF(30343), AOM_ICDF(31641),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4352), AOM_ICDF(6905), AOM_ICDF(7612), AOM_ICDF(24258),
+ AOM_ICDF(24862), AOM_ICDF(25005), AOM_ICDF(25399), AOM_ICDF(25658),
+ AOM_ICDF(26491), AOM_ICDF(28281), AOM_ICDF(30472), AOM_ICDF(31037),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(10752), AOM_ICDF(13246), AOM_ICDF(14771), AOM_ICDF(18965),
+ AOM_ICDF(20132), AOM_ICDF(20606), AOM_ICDF(22411), AOM_ICDF(23422),
+ AOM_ICDF(24663), AOM_ICDF(27386), AOM_ICDF(30203), AOM_ICDF(31265),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(8320), AOM_ICDF(10135), AOM_ICDF(11815), AOM_ICDF(15962),
+ AOM_ICDF(19829), AOM_ICDF(21555), AOM_ICDF(22738), AOM_ICDF(23482),
+ AOM_ICDF(25513), AOM_ICDF(27100), AOM_ICDF(30222), AOM_ICDF(31246),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(11264), AOM_ICDF(13364), AOM_ICDF(16851), AOM_ICDF(20617),
+ AOM_ICDF(23504), AOM_ICDF(26302), AOM_ICDF(28070), AOM_ICDF(29189),
+ AOM_ICDF(30531), AOM_ICDF(31903), AOM_ICDF(32342), AOM_ICDF(32512),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6528), AOM_ICDF(7656), AOM_ICDF(8637), AOM_ICDF(15318),
+ AOM_ICDF(18270), AOM_ICDF(18817), AOM_ICDF(19580), AOM_ICDF(20044),
+ AOM_ICDF(24666), AOM_ICDF(26502), AOM_ICDF(29733), AOM_ICDF(30670),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6784), AOM_ICDF(8307), AOM_ICDF(9167), AOM_ICDF(17476),
+ AOM_ICDF(18366), AOM_ICDF(18663), AOM_ICDF(19765), AOM_ICDF(20425),
+ AOM_ICDF(21534), AOM_ICDF(26888), AOM_ICDF(29989), AOM_ICDF(30857),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(8192), AOM_ICDF(11072), AOM_ICDF(12682), AOM_ICDF(17399),
+ AOM_ICDF(19010), AOM_ICDF(19743), AOM_ICDF(20964), AOM_ICDF(22993),
+ AOM_ICDF(23871), AOM_ICDF(25817), AOM_ICDF(29727), AOM_ICDF(31164),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5888), AOM_ICDF(7988), AOM_ICDF(9634), AOM_ICDF(16735),
+ AOM_ICDF(18009), AOM_ICDF(18129), AOM_ICDF(18930), AOM_ICDF(19741),
+ AOM_ICDF(20911), AOM_ICDF(22671), AOM_ICDF(27877), AOM_ICDF(29749),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5248), AOM_ICDF(8151), AOM_ICDF(10267), AOM_ICDF(17761),
+ AOM_ICDF(19077), AOM_ICDF(19232), AOM_ICDF(19919), AOM_ICDF(20772),
+ AOM_ICDF(21615), AOM_ICDF(23140), AOM_ICDF(28142), AOM_ICDF(30618),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6656), AOM_ICDF(8390), AOM_ICDF(9723), AOM_ICDF(17206),
+ AOM_ICDF(18212), AOM_ICDF(18275), AOM_ICDF(19068), AOM_ICDF(19657),
+ AOM_ICDF(20886), AOM_ICDF(22650), AOM_ICDF(27907), AOM_ICDF(29084),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4480), AOM_ICDF(9232), AOM_ICDF(11163), AOM_ICDF(22580),
+ AOM_ICDF(23368), AOM_ICDF(23653), AOM_ICDF(24436), AOM_ICDF(24989),
+ AOM_ICDF(25809), AOM_ICDF(27087), AOM_ICDF(30038), AOM_ICDF(31104),
+ AOM_ICDF(32768), 0 },
+ },
+ {
+ { AOM_ICDF(10240), AOM_ICDF(11472), AOM_ICDF(14051), AOM_ICDF(16777),
+ AOM_ICDF(18308), AOM_ICDF(19461), AOM_ICDF(22164), AOM_ICDF(24235),
+ AOM_ICDF(25202), AOM_ICDF(26680), AOM_ICDF(29962), AOM_ICDF(31168),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(7552), AOM_ICDF(9128), AOM_ICDF(16885), AOM_ICDF(18221),
+ AOM_ICDF(19114), AOM_ICDF(20111), AOM_ICDF(23226), AOM_ICDF(25462),
+ AOM_ICDF(26033), AOM_ICDF(27085), AOM_ICDF(30259), AOM_ICDF(31729),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5248), AOM_ICDF(7291), AOM_ICDF(8883), AOM_ICDF(18172),
+ AOM_ICDF(19301), AOM_ICDF(19892), AOM_ICDF(21703), AOM_ICDF(22870),
+ AOM_ICDF(23798), AOM_ICDF(25970), AOM_ICDF(29581), AOM_ICDF(30440),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(11008), AOM_ICDF(11943), AOM_ICDF(12838), AOM_ICDF(14729),
+ AOM_ICDF(15340), AOM_ICDF(15719), AOM_ICDF(23245), AOM_ICDF(25217),
+ AOM_ICDF(25453), AOM_ICDF(28282), AOM_ICDF(30735), AOM_ICDF(31696),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6272), AOM_ICDF(7100), AOM_ICDF(9506), AOM_ICDF(11141),
+ AOM_ICDF(14891), AOM_ICDF(18048), AOM_ICDF(20808), AOM_ICDF(22910),
+ AOM_ICDF(24450), AOM_ICDF(26172), AOM_ICDF(29625), AOM_ICDF(31233),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(7424), AOM_ICDF(8513), AOM_ICDF(11924), AOM_ICDF(13742),
+ AOM_ICDF(16971), AOM_ICDF(22265), AOM_ICDF(25957), AOM_ICDF(29762),
+ AOM_ICDF(30831), AOM_ICDF(32193), AOM_ICDF(32537), AOM_ICDF(32669),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4992), AOM_ICDF(5969), AOM_ICDF(7435), AOM_ICDF(10922),
+ AOM_ICDF(15097), AOM_ICDF(16638), AOM_ICDF(18654), AOM_ICDF(20087),
+ AOM_ICDF(23356), AOM_ICDF(25452), AOM_ICDF(29281), AOM_ICDF(30725),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(9600), AOM_ICDF(10324), AOM_ICDF(12603), AOM_ICDF(15427),
+ AOM_ICDF(16950), AOM_ICDF(17959), AOM_ICDF(20909), AOM_ICDF(22299),
+ AOM_ICDF(22994), AOM_ICDF(27308), AOM_ICDF(30379), AOM_ICDF(31154),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(9856), AOM_ICDF(11020), AOM_ICDF(12549), AOM_ICDF(14621),
+ AOM_ICDF(15493), AOM_ICDF(16182), AOM_ICDF(21430), AOM_ICDF(25947),
+ AOM_ICDF(26427), AOM_ICDF(27888), AOM_ICDF(30595), AOM_ICDF(31809),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6272), AOM_ICDF(7618), AOM_ICDF(10664), AOM_ICDF(12915),
+ AOM_ICDF(14454), AOM_ICDF(14722), AOM_ICDF(17965), AOM_ICDF(20394),
+ AOM_ICDF(21312), AOM_ICDF(23371), AOM_ICDF(28730), AOM_ICDF(30623),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5888), AOM_ICDF(7463), AOM_ICDF(10923), AOM_ICDF(12991),
+ AOM_ICDF(14555), AOM_ICDF(14934), AOM_ICDF(18208), AOM_ICDF(21052),
+ AOM_ICDF(21876), AOM_ICDF(23450), AOM_ICDF(28655), AOM_ICDF(31017),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6912), AOM_ICDF(8023), AOM_ICDF(10440), AOM_ICDF(13329),
+ AOM_ICDF(14958), AOM_ICDF(15150), AOM_ICDF(18109), AOM_ICDF(20056),
+ AOM_ICDF(21049), AOM_ICDF(23063), AOM_ICDF(28219), AOM_ICDF(29978),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5120), AOM_ICDF(7928), AOM_ICDF(11906), AOM_ICDF(15940),
+ AOM_ICDF(16978), AOM_ICDF(17773), AOM_ICDF(22342), AOM_ICDF(24419),
+ AOM_ICDF(25300), AOM_ICDF(27021), AOM_ICDF(30007), AOM_ICDF(31312),
+ AOM_ICDF(32768), 0 },
+ },
+ {
+ { AOM_ICDF(7296), AOM_ICDF(8291), AOM_ICDF(10299), AOM_ICDF(12767),
+ AOM_ICDF(18252), AOM_ICDF(20656), AOM_ICDF(21413), AOM_ICDF(22300),
+ AOM_ICDF(24958), AOM_ICDF(26544), AOM_ICDF(30069), AOM_ICDF(31387),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(7168), AOM_ICDF(8668), AOM_ICDF(13187), AOM_ICDF(15041),
+ AOM_ICDF(18824), AOM_ICDF(21371), AOM_ICDF(22261), AOM_ICDF(23574),
+ AOM_ICDF(25082), AOM_ICDF(26133), AOM_ICDF(29839), AOM_ICDF(31693),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(3584), AOM_ICDF(5750), AOM_ICDF(6594), AOM_ICDF(15662),
+ AOM_ICDF(18845), AOM_ICDF(20090), AOM_ICDF(20783), AOM_ICDF(21438),
+ AOM_ICDF(23430), AOM_ICDF(25436), AOM_ICDF(29446), AOM_ICDF(30471),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(7424), AOM_ICDF(8711), AOM_ICDF(10121), AOM_ICDF(11786),
+ AOM_ICDF(15100), AOM_ICDF(16579), AOM_ICDF(20437), AOM_ICDF(21593),
+ AOM_ICDF(22903), AOM_ICDF(25678), AOM_ICDF(29638), AOM_ICDF(31130),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4480), AOM_ICDF(5033), AOM_ICDF(6441), AOM_ICDF(7646),
+ AOM_ICDF(18034), AOM_ICDF(21867), AOM_ICDF(22676), AOM_ICDF(23504),
+ AOM_ICDF(25892), AOM_ICDF(26913), AOM_ICDF(30206), AOM_ICDF(31507),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(7296), AOM_ICDF(8192), AOM_ICDF(11072), AOM_ICDF(12676),
+ AOM_ICDF(19460), AOM_ICDF(25734), AOM_ICDF(26778), AOM_ICDF(28439),
+ AOM_ICDF(31077), AOM_ICDF(32002), AOM_ICDF(32469), AOM_ICDF(32671),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(3840), AOM_ICDF(4518), AOM_ICDF(5511), AOM_ICDF(8229),
+ AOM_ICDF(16448), AOM_ICDF(18394), AOM_ICDF(19292), AOM_ICDF(20345),
+ AOM_ICDF(25683), AOM_ICDF(27399), AOM_ICDF(30566), AOM_ICDF(31375),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6528), AOM_ICDF(7451), AOM_ICDF(8934), AOM_ICDF(12006),
+ AOM_ICDF(15767), AOM_ICDF(17127), AOM_ICDF(18471), AOM_ICDF(19476),
+ AOM_ICDF(21553), AOM_ICDF(25715), AOM_ICDF(29572), AOM_ICDF(30795),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(7168), AOM_ICDF(8368), AOM_ICDF(10370), AOM_ICDF(11855),
+ AOM_ICDF(14966), AOM_ICDF(17544), AOM_ICDF(19328), AOM_ICDF(21271),
+ AOM_ICDF(22708), AOM_ICDF(24555), AOM_ICDF(29207), AOM_ICDF(31280),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5504), AOM_ICDF(6782), AOM_ICDF(8914), AOM_ICDF(11452),
+ AOM_ICDF(15958), AOM_ICDF(16648), AOM_ICDF(17530), AOM_ICDF(18899),
+ AOM_ICDF(20578), AOM_ICDF(22245), AOM_ICDF(28123), AOM_ICDF(30427),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5248), AOM_ICDF(6538), AOM_ICDF(9100), AOM_ICDF(11294),
+ AOM_ICDF(15638), AOM_ICDF(16589), AOM_ICDF(17600), AOM_ICDF(19318),
+ AOM_ICDF(20842), AOM_ICDF(22193), AOM_ICDF(28018), AOM_ICDF(30875),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5376), AOM_ICDF(6553), AOM_ICDF(8499), AOM_ICDF(11769),
+ AOM_ICDF(15661), AOM_ICDF(16178), AOM_ICDF(17280), AOM_ICDF(18490),
+ AOM_ICDF(20386), AOM_ICDF(22127), AOM_ICDF(28071), AOM_ICDF(30089),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4608), AOM_ICDF(7468), AOM_ICDF(10136), AOM_ICDF(15013),
+ AOM_ICDF(17716), AOM_ICDF(19595), AOM_ICDF(20830), AOM_ICDF(22136),
+ AOM_ICDF(23714), AOM_ICDF(25341), AOM_ICDF(29403), AOM_ICDF(31072),
+ AOM_ICDF(32768), 0 },
+ },
+ {
+ { AOM_ICDF(6656), AOM_ICDF(8186), AOM_ICDF(13755), AOM_ICDF(15971),
+ AOM_ICDF(20413), AOM_ICDF(27940), AOM_ICDF(28657), AOM_ICDF(29910),
+ AOM_ICDF(31004), AOM_ICDF(31969), AOM_ICDF(32443), AOM_ICDF(32665),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6400), AOM_ICDF(8048), AOM_ICDF(16256), AOM_ICDF(17568),
+ AOM_ICDF(21074), AOM_ICDF(28253), AOM_ICDF(28976), AOM_ICDF(30531),
+ AOM_ICDF(31099), AOM_ICDF(31875), AOM_ICDF(32426), AOM_ICDF(32701),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(3840), AOM_ICDF(6439), AOM_ICDF(9524), AOM_ICDF(17270),
+ AOM_ICDF(21391), AOM_ICDF(25777), AOM_ICDF(26815), AOM_ICDF(27908),
+ AOM_ICDF(29199), AOM_ICDF(31151), AOM_ICDF(32168), AOM_ICDF(32407),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(9600), AOM_ICDF(10958), AOM_ICDF(14962), AOM_ICDF(16560),
+ AOM_ICDF(19908), AOM_ICDF(23309), AOM_ICDF(25637), AOM_ICDF(28033),
+ AOM_ICDF(29032), AOM_ICDF(32009), AOM_ICDF(32528), AOM_ICDF(32701),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4608), AOM_ICDF(5598), AOM_ICDF(9525), AOM_ICDF(10578),
+ AOM_ICDF(18511), AOM_ICDF(27502), AOM_ICDF(28654), AOM_ICDF(29907),
+ AOM_ICDF(31069), AOM_ICDF(32071), AOM_ICDF(32493), AOM_ICDF(32670),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4864), AOM_ICDF(5845), AOM_ICDF(11524), AOM_ICDF(12294),
+ AOM_ICDF(16882), AOM_ICDF(27955), AOM_ICDF(28839), AOM_ICDF(30251),
+ AOM_ICDF(30949), AOM_ICDF(31873), AOM_ICDF(32467), AOM_ICDF(32703),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(3968), AOM_ICDF(5431), AOM_ICDF(8955), AOM_ICDF(11746),
+ AOM_ICDF(18914), AOM_ICDF(24489), AOM_ICDF(25524), AOM_ICDF(27194),
+ AOM_ICDF(29894), AOM_ICDF(31589), AOM_ICDF(32335), AOM_ICDF(32551),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6016), AOM_ICDF(7584), AOM_ICDF(11814), AOM_ICDF(14567),
+ AOM_ICDF(18253), AOM_ICDF(21882), AOM_ICDF(23966), AOM_ICDF(26442),
+ AOM_ICDF(27628), AOM_ICDF(31142), AOM_ICDF(32177), AOM_ICDF(32466),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(7808), AOM_ICDF(9661), AOM_ICDF(15257), AOM_ICDF(16576),
+ AOM_ICDF(20349), AOM_ICDF(24902), AOM_ICDF(26592), AOM_ICDF(29415),
+ AOM_ICDF(30083), AOM_ICDF(31782), AOM_ICDF(32360), AOM_ICDF(32680),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(2816), AOM_ICDF(4805), AOM_ICDF(8519), AOM_ICDF(10112),
+ AOM_ICDF(13408), AOM_ICDF(18465), AOM_ICDF(19582), AOM_ICDF(21333),
+ AOM_ICDF(22494), AOM_ICDF(24059), AOM_ICDF(29026), AOM_ICDF(31321),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(2432), AOM_ICDF(4091), AOM_ICDF(8236), AOM_ICDF(9669),
+ AOM_ICDF(13111), AOM_ICDF(19352), AOM_ICDF(20557), AOM_ICDF(22370),
+ AOM_ICDF(23060), AOM_ICDF(24425), AOM_ICDF(28890), AOM_ICDF(31586),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(3200), AOM_ICDF(5164), AOM_ICDF(8938), AOM_ICDF(11126),
+ AOM_ICDF(14494), AOM_ICDF(18433), AOM_ICDF(19721), AOM_ICDF(21148),
+ AOM_ICDF(22510), AOM_ICDF(24233), AOM_ICDF(29134), AOM_ICDF(31235),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4480), AOM_ICDF(7132), AOM_ICDF(13341), AOM_ICDF(17959),
+ AOM_ICDF(21108), AOM_ICDF(25786), AOM_ICDF(27068), AOM_ICDF(29161),
+ AOM_ICDF(30077), AOM_ICDF(31286), AOM_ICDF(32363), AOM_ICDF(32565),
+ AOM_ICDF(32768), 0 },
+ },
+ {
+ { AOM_ICDF(9600), AOM_ICDF(10686), AOM_ICDF(12152), AOM_ICDF(16918),
+ AOM_ICDF(19247), AOM_ICDF(20286), AOM_ICDF(20969), AOM_ICDF(21568),
+ AOM_ICDF(25987), AOM_ICDF(27444), AOM_ICDF(30376), AOM_ICDF(31348),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(8832), AOM_ICDF(10609), AOM_ICDF(14591), AOM_ICDF(17948),
+ AOM_ICDF(19973), AOM_ICDF(21052), AOM_ICDF(21922), AOM_ICDF(22854),
+ AOM_ICDF(25642), AOM_ICDF(26783), AOM_ICDF(29892), AOM_ICDF(31499),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(3840), AOM_ICDF(5196), AOM_ICDF(5842), AOM_ICDF(17177),
+ AOM_ICDF(19308), AOM_ICDF(19726), AOM_ICDF(20235), AOM_ICDF(20627),
+ AOM_ICDF(24184), AOM_ICDF(26799), AOM_ICDF(29993), AOM_ICDF(30752),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(9856), AOM_ICDF(11288), AOM_ICDF(12295), AOM_ICDF(15482),
+ AOM_ICDF(18345), AOM_ICDF(19093), AOM_ICDF(20963), AOM_ICDF(21747),
+ AOM_ICDF(24718), AOM_ICDF(26793), AOM_ICDF(29991), AOM_ICDF(31032),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6528), AOM_ICDF(7348), AOM_ICDF(8440), AOM_ICDF(11002),
+ AOM_ICDF(17084), AOM_ICDF(19749), AOM_ICDF(20766), AOM_ICDF(21563),
+ AOM_ICDF(25502), AOM_ICDF(26950), AOM_ICDF(30245), AOM_ICDF(31152),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(9728), AOM_ICDF(10448), AOM_ICDF(12541), AOM_ICDF(14674),
+ AOM_ICDF(19296), AOM_ICDF(23919), AOM_ICDF(25198), AOM_ICDF(26558),
+ AOM_ICDF(30755), AOM_ICDF(31958), AOM_ICDF(32461), AOM_ICDF(32594),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5120), AOM_ICDF(5768), AOM_ICDF(6401), AOM_ICDF(10321),
+ AOM_ICDF(14515), AOM_ICDF(15362), AOM_ICDF(15838), AOM_ICDF(16301),
+ AOM_ICDF(26078), AOM_ICDF(27489), AOM_ICDF(30397), AOM_ICDF(31175),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5888), AOM_ICDF(6518), AOM_ICDF(7236), AOM_ICDF(12128),
+ AOM_ICDF(14327), AOM_ICDF(15015), AOM_ICDF(16055), AOM_ICDF(16773),
+ AOM_ICDF(20897), AOM_ICDF(25395), AOM_ICDF(29341), AOM_ICDF(30452),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(10368), AOM_ICDF(11856), AOM_ICDF(13245), AOM_ICDF(15614),
+ AOM_ICDF(18451), AOM_ICDF(19498), AOM_ICDF(20846), AOM_ICDF(22429),
+ AOM_ICDF(24610), AOM_ICDF(26522), AOM_ICDF(30279), AOM_ICDF(31523),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6016), AOM_ICDF(7061), AOM_ICDF(8668), AOM_ICDF(12423),
+ AOM_ICDF(15346), AOM_ICDF(15634), AOM_ICDF(16504), AOM_ICDF(17584),
+ AOM_ICDF(21083), AOM_ICDF(23000), AOM_ICDF(28456), AOM_ICDF(30241),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5760), AOM_ICDF(7026), AOM_ICDF(8735), AOM_ICDF(12665),
+ AOM_ICDF(15507), AOM_ICDF(15870), AOM_ICDF(16794), AOM_ICDF(17792),
+ AOM_ICDF(21068), AOM_ICDF(23033), AOM_ICDF(28395), AOM_ICDF(30701),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(7040), AOM_ICDF(8045), AOM_ICDF(9300), AOM_ICDF(13303),
+ AOM_ICDF(15462), AOM_ICDF(15625), AOM_ICDF(16362), AOM_ICDF(17067),
+ AOM_ICDF(20686), AOM_ICDF(22810), AOM_ICDF(27983), AOM_ICDF(29347),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5632), AOM_ICDF(8070), AOM_ICDF(9903), AOM_ICDF(16658),
+ AOM_ICDF(18637), AOM_ICDF(19728), AOM_ICDF(20543), AOM_ICDF(21450),
+ AOM_ICDF(24456), AOM_ICDF(26372), AOM_ICDF(29645), AOM_ICDF(30731),
+ AOM_ICDF(32768), 0 },
+ },
+ {
+ { AOM_ICDF(11008), AOM_ICDF(12283), AOM_ICDF(14364), AOM_ICDF(18419),
+ AOM_ICDF(19948), AOM_ICDF(20618), AOM_ICDF(21899), AOM_ICDF(22960),
+ AOM_ICDF(23994), AOM_ICDF(26565), AOM_ICDF(30078), AOM_ICDF(31213),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(9088), AOM_ICDF(11586), AOM_ICDF(16716), AOM_ICDF(18876),
+ AOM_ICDF(20112), AOM_ICDF(21105), AOM_ICDF(22426), AOM_ICDF(23800),
+ AOM_ICDF(24396), AOM_ICDF(26653), AOM_ICDF(30021), AOM_ICDF(31566),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6144), AOM_ICDF(8328), AOM_ICDF(9378), AOM_ICDF(20096),
+ AOM_ICDF(20984), AOM_ICDF(21256), AOM_ICDF(22335), AOM_ICDF(23109),
+ AOM_ICDF(24128), AOM_ICDF(26896), AOM_ICDF(29947), AOM_ICDF(30740),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(10496), AOM_ICDF(12323), AOM_ICDF(13441), AOM_ICDF(15479),
+ AOM_ICDF(16976), AOM_ICDF(17518), AOM_ICDF(20794), AOM_ICDF(22571),
+ AOM_ICDF(23328), AOM_ICDF(27421), AOM_ICDF(30512), AOM_ICDF(31561),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(7296), AOM_ICDF(8391), AOM_ICDF(10010), AOM_ICDF(12258),
+ AOM_ICDF(15388), AOM_ICDF(16944), AOM_ICDF(19602), AOM_ICDF(21196),
+ AOM_ICDF(22869), AOM_ICDF(25112), AOM_ICDF(29389), AOM_ICDF(30709),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(9728), AOM_ICDF(11168), AOM_ICDF(14881), AOM_ICDF(17298),
+ AOM_ICDF(20151), AOM_ICDF(22916), AOM_ICDF(25918), AOM_ICDF(28032),
+ AOM_ICDF(29549), AOM_ICDF(31787), AOM_ICDF(32293), AOM_ICDF(32521),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6400), AOM_ICDF(7636), AOM_ICDF(8716), AOM_ICDF(12718),
+ AOM_ICDF(15711), AOM_ICDF(16420), AOM_ICDF(18144), AOM_ICDF(19287),
+ AOM_ICDF(22815), AOM_ICDF(25886), AOM_ICDF(29596), AOM_ICDF(30674),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(9856), AOM_ICDF(10662), AOM_ICDF(11785), AOM_ICDF(14236),
+ AOM_ICDF(14998), AOM_ICDF(15391), AOM_ICDF(17156), AOM_ICDF(17949),
+ AOM_ICDF(18470), AOM_ICDF(27797), AOM_ICDF(30418), AOM_ICDF(31244),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(8960), AOM_ICDF(10448), AOM_ICDF(12017), AOM_ICDF(14128),
+ AOM_ICDF(15765), AOM_ICDF(16637), AOM_ICDF(19347), AOM_ICDF(21759),
+ AOM_ICDF(22490), AOM_ICDF(25300), AOM_ICDF(29676), AOM_ICDF(31077),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(7168), AOM_ICDF(8468), AOM_ICDF(10177), AOM_ICDF(13693),
+ AOM_ICDF(15333), AOM_ICDF(15472), AOM_ICDF(17094), AOM_ICDF(18257),
+ AOM_ICDF(19277), AOM_ICDF(22386), AOM_ICDF(28023), AOM_ICDF(29969),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6400), AOM_ICDF(8151), AOM_ICDF(10651), AOM_ICDF(13992),
+ AOM_ICDF(15677), AOM_ICDF(15835), AOM_ICDF(17422), AOM_ICDF(18621),
+ AOM_ICDF(19450), AOM_ICDF(22207), AOM_ICDF(27735), AOM_ICDF(30409),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(7296), AOM_ICDF(8391), AOM_ICDF(9915), AOM_ICDF(13980),
+ AOM_ICDF(15352), AOM_ICDF(15450), AOM_ICDF(17006), AOM_ICDF(17930),
+ AOM_ICDF(18973), AOM_ICDF(22045), AOM_ICDF(27658), AOM_ICDF(29235),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6272), AOM_ICDF(9481), AOM_ICDF(11664), AOM_ICDF(16537),
+ AOM_ICDF(17656), AOM_ICDF(18094), AOM_ICDF(20673), AOM_ICDF(21949),
+ AOM_ICDF(22752), AOM_ICDF(25921), AOM_ICDF(29612), AOM_ICDF(30869),
+ AOM_ICDF(32768), 0 },
+ },
+ {
+ { AOM_ICDF(6784), AOM_ICDF(8104), AOM_ICDF(12536), AOM_ICDF(14589),
+ AOM_ICDF(15843), AOM_ICDF(17357), AOM_ICDF(19765), AOM_ICDF(23981),
+ AOM_ICDF(24633), AOM_ICDF(25618), AOM_ICDF(29556), AOM_ICDF(31438),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5760), AOM_ICDF(7237), AOM_ICDF(14717), AOM_ICDF(15587),
+ AOM_ICDF(16364), AOM_ICDF(17537), AOM_ICDF(20393), AOM_ICDF(26097),
+ AOM_ICDF(26462), AOM_ICDF(27029), AOM_ICDF(30123), AOM_ICDF(31921),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4352), AOM_ICDF(5906), AOM_ICDF(8424), AOM_ICDF(16214),
+ AOM_ICDF(16978), AOM_ICDF(17743), AOM_ICDF(19680), AOM_ICDF(22441),
+ AOM_ICDF(23167), AOM_ICDF(25080), AOM_ICDF(29224), AOM_ICDF(30650),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(9472), AOM_ICDF(10473), AOM_ICDF(12737), AOM_ICDF(14173),
+ AOM_ICDF(15051), AOM_ICDF(15632), AOM_ICDF(20652), AOM_ICDF(24864),
+ AOM_ICDF(25204), AOM_ICDF(27006), AOM_ICDF(30292), AOM_ICDF(31501),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4480), AOM_ICDF(5475), AOM_ICDF(8247), AOM_ICDF(9646),
+ AOM_ICDF(12203), AOM_ICDF(14760), AOM_ICDF(18488), AOM_ICDF(22616),
+ AOM_ICDF(23449), AOM_ICDF(24650), AOM_ICDF(29026), AOM_ICDF(30955),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6016), AOM_ICDF(6957), AOM_ICDF(12502), AOM_ICDF(13805),
+ AOM_ICDF(16777), AOM_ICDF(21052), AOM_ICDF(23981), AOM_ICDF(30606),
+ AOM_ICDF(31206), AOM_ICDF(31981), AOM_ICDF(32414), AOM_ICDF(32681),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4480), AOM_ICDF(5475), AOM_ICDF(7820), AOM_ICDF(9805),
+ AOM_ICDF(12793), AOM_ICDF(14252), AOM_ICDF(16711), AOM_ICDF(20725),
+ AOM_ICDF(23406), AOM_ICDF(25015), AOM_ICDF(29225), AOM_ICDF(30775),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6912), AOM_ICDF(7619), AOM_ICDF(10173), AOM_ICDF(12424),
+ AOM_ICDF(13502), AOM_ICDF(14410), AOM_ICDF(17852), AOM_ICDF(21348),
+ AOM_ICDF(22017), AOM_ICDF(25461), AOM_ICDF(29571), AOM_ICDF(31020),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(7680), AOM_ICDF(8562), AOM_ICDF(11399), AOM_ICDF(12263),
+ AOM_ICDF(12870), AOM_ICDF(13486), AOM_ICDF(18307), AOM_ICDF(26385),
+ AOM_ICDF(26734), AOM_ICDF(27724), AOM_ICDF(30482), AOM_ICDF(31955),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4992), AOM_ICDF(6186), AOM_ICDF(9820), AOM_ICDF(11725),
+ AOM_ICDF(13117), AOM_ICDF(13406), AOM_ICDF(15978), AOM_ICDF(20372),
+ AOM_ICDF(20953), AOM_ICDF(22245), AOM_ICDF(28205), AOM_ICDF(30879),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4736), AOM_ICDF(6050), AOM_ICDF(10747), AOM_ICDF(12295),
+ AOM_ICDF(13445), AOM_ICDF(13844), AOM_ICDF(16357), AOM_ICDF(21485),
+ AOM_ICDF(21838), AOM_ICDF(22820), AOM_ICDF(28183), AOM_ICDF(31138),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5760), AOM_ICDF(6710), AOM_ICDF(10476), AOM_ICDF(12855),
+ AOM_ICDF(14101), AOM_ICDF(14482), AOM_ICDF(17053), AOM_ICDF(20613),
+ AOM_ICDF(21278), AOM_ICDF(22580), AOM_ICDF(28351), AOM_ICDF(30542),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4480), AOM_ICDF(6359), AOM_ICDF(11826), AOM_ICDF(14265),
+ AOM_ICDF(14852), AOM_ICDF(15753), AOM_ICDF(19276), AOM_ICDF(24757),
+ AOM_ICDF(25226), AOM_ICDF(26287), AOM_ICDF(29629), AOM_ICDF(31493),
+ AOM_ICDF(32768), 0 },
+ },
+ {
+ { AOM_ICDF(7424), AOM_ICDF(8612), AOM_ICDF(11726), AOM_ICDF(15286),
+ AOM_ICDF(16881), AOM_ICDF(17151), AOM_ICDF(17944), AOM_ICDF(19160),
+ AOM_ICDF(20011), AOM_ICDF(21356), AOM_ICDF(27463), AOM_ICDF(29805),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5376), AOM_ICDF(7516), AOM_ICDF(15210), AOM_ICDF(17109),
+ AOM_ICDF(18458), AOM_ICDF(18708), AOM_ICDF(19587), AOM_ICDF(20977),
+ AOM_ICDF(21484), AOM_ICDF(22277), AOM_ICDF(27768), AOM_ICDF(30893),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(3584), AOM_ICDF(5522), AOM_ICDF(7225), AOM_ICDF(18079),
+ AOM_ICDF(18909), AOM_ICDF(18999), AOM_ICDF(19698), AOM_ICDF(20413),
+ AOM_ICDF(21185), AOM_ICDF(23040), AOM_ICDF(28056), AOM_ICDF(29473),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(7424), AOM_ICDF(8612), AOM_ICDF(10782), AOM_ICDF(12958),
+ AOM_ICDF(14687), AOM_ICDF(14818), AOM_ICDF(17553), AOM_ICDF(19395),
+ AOM_ICDF(20231), AOM_ICDF(23316), AOM_ICDF(28559), AOM_ICDF(30614),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5632), AOM_ICDF(6586), AOM_ICDF(9347), AOM_ICDF(11520),
+ AOM_ICDF(15628), AOM_ICDF(16300), AOM_ICDF(17651), AOM_ICDF(19245),
+ AOM_ICDF(20671), AOM_ICDF(22089), AOM_ICDF(28013), AOM_ICDF(30279),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(3840), AOM_ICDF(5309), AOM_ICDF(9385), AOM_ICDF(10995),
+ AOM_ICDF(14099), AOM_ICDF(18154), AOM_ICDF(19638), AOM_ICDF(21690),
+ AOM_ICDF(23031), AOM_ICDF(24552), AOM_ICDF(29238), AOM_ICDF(31251),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5376), AOM_ICDF(6339), AOM_ICDF(8301), AOM_ICDF(11620),
+ AOM_ICDF(14701), AOM_ICDF(14991), AOM_ICDF(16033), AOM_ICDF(17210),
+ AOM_ICDF(20431), AOM_ICDF(22310), AOM_ICDF(27948), AOM_ICDF(29774),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5632), AOM_ICDF(6692), AOM_ICDF(8729), AOM_ICDF(12618),
+ AOM_ICDF(13927), AOM_ICDF(14081), AOM_ICDF(15176), AOM_ICDF(16413),
+ AOM_ICDF(17371), AOM_ICDF(22183), AOM_ICDF(28013), AOM_ICDF(29815),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6528), AOM_ICDF(7861), AOM_ICDF(11072), AOM_ICDF(12945),
+ AOM_ICDF(14726), AOM_ICDF(14971), AOM_ICDF(16570), AOM_ICDF(19481),
+ AOM_ICDF(20260), AOM_ICDF(21921), AOM_ICDF(27980), AOM_ICDF(30449),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5376), AOM_ICDF(6553), AOM_ICDF(9523), AOM_ICDF(12199),
+ AOM_ICDF(13764), AOM_ICDF(13972), AOM_ICDF(14926), AOM_ICDF(16320),
+ AOM_ICDF(17091), AOM_ICDF(18744), AOM_ICDF(26359), AOM_ICDF(29288),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4736), AOM_ICDF(6160), AOM_ICDF(10318), AOM_ICDF(12718),
+ AOM_ICDF(14251), AOM_ICDF(14527), AOM_ICDF(15453), AOM_ICDF(17009),
+ AOM_ICDF(17625), AOM_ICDF(19045), AOM_ICDF(26335), AOM_ICDF(30079),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5760), AOM_ICDF(6815), AOM_ICDF(9248), AOM_ICDF(12722),
+ AOM_ICDF(14141), AOM_ICDF(14301), AOM_ICDF(15095), AOM_ICDF(16200),
+ AOM_ICDF(17106), AOM_ICDF(18697), AOM_ICDF(26172), AOM_ICDF(28388),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4096), AOM_ICDF(6672), AOM_ICDF(11055), AOM_ICDF(16327),
+ AOM_ICDF(17508), AOM_ICDF(17671), AOM_ICDF(18733), AOM_ICDF(19994),
+ AOM_ICDF(20742), AOM_ICDF(22151), AOM_ICDF(27708), AOM_ICDF(30021),
+ AOM_ICDF(32768), 0 },
+ },
+ {
+ { AOM_ICDF(7936), AOM_ICDF(9197), AOM_ICDF(13524), AOM_ICDF(16819),
+ AOM_ICDF(18267), AOM_ICDF(18636), AOM_ICDF(19409), AOM_ICDF(20661),
+ AOM_ICDF(21323), AOM_ICDF(22307), AOM_ICDF(27905), AOM_ICDF(30678),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5376), AOM_ICDF(7302), AOM_ICDF(16951), AOM_ICDF(18383),
+ AOM_ICDF(19388), AOM_ICDF(19608), AOM_ICDF(20225), AOM_ICDF(21597),
+ AOM_ICDF(21946), AOM_ICDF(22538), AOM_ICDF(27613), AOM_ICDF(31318),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(3840), AOM_ICDF(5987), AOM_ICDF(8184), AOM_ICDF(19612),
+ AOM_ICDF(20392), AOM_ICDF(20476), AOM_ICDF(21100), AOM_ICDF(21693),
+ AOM_ICDF(22428), AOM_ICDF(23963), AOM_ICDF(28709), AOM_ICDF(30342),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(8448), AOM_ICDF(9588), AOM_ICDF(12395), AOM_ICDF(14447),
+ AOM_ICDF(16163), AOM_ICDF(16374), AOM_ICDF(18743), AOM_ICDF(20606),
+ AOM_ICDF(21271), AOM_ICDF(23786), AOM_ICDF(28768), AOM_ICDF(30877),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5760), AOM_ICDF(6710), AOM_ICDF(10069), AOM_ICDF(11965),
+ AOM_ICDF(15976), AOM_ICDF(16719), AOM_ICDF(17973), AOM_ICDF(19880),
+ AOM_ICDF(21139), AOM_ICDF(22275), AOM_ICDF(28259), AOM_ICDF(30954),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(3968), AOM_ICDF(5431), AOM_ICDF(10557), AOM_ICDF(12069),
+ AOM_ICDF(14280), AOM_ICDF(18973), AOM_ICDF(20374), AOM_ICDF(23037),
+ AOM_ICDF(24215), AOM_ICDF(25050), AOM_ICDF(29271), AOM_ICDF(31716),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6016), AOM_ICDF(7061), AOM_ICDF(9672), AOM_ICDF(12246),
+ AOM_ICDF(15351), AOM_ICDF(15717), AOM_ICDF(16716), AOM_ICDF(18158),
+ AOM_ICDF(21126), AOM_ICDF(22672), AOM_ICDF(28035), AOM_ICDF(30494),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6272), AOM_ICDF(7204), AOM_ICDF(9700), AOM_ICDF(13252),
+ AOM_ICDF(14599), AOM_ICDF(14926), AOM_ICDF(15902), AOM_ICDF(17220),
+ AOM_ICDF(18010), AOM_ICDF(22795), AOM_ICDF(28405), AOM_ICDF(30467),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6912), AOM_ICDF(8427), AOM_ICDF(12420), AOM_ICDF(14171),
+ AOM_ICDF(15792), AOM_ICDF(16156), AOM_ICDF(17584), AOM_ICDF(20846),
+ AOM_ICDF(21451), AOM_ICDF(22556), AOM_ICDF(28101), AOM_ICDF(31054),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5248), AOM_ICDF(6431), AOM_ICDF(10855), AOM_ICDF(13296),
+ AOM_ICDF(14848), AOM_ICDF(15135), AOM_ICDF(15893), AOM_ICDF(17277),
+ AOM_ICDF(17943), AOM_ICDF(19275), AOM_ICDF(26443), AOM_ICDF(30174),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4736), AOM_ICDF(6050), AOM_ICDF(12103), AOM_ICDF(14343),
+ AOM_ICDF(15633), AOM_ICDF(15978), AOM_ICDF(16699), AOM_ICDF(18205),
+ AOM_ICDF(18660), AOM_ICDF(19707), AOM_ICDF(26544), AOM_ICDF(30872),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6016), AOM_ICDF(7166), AOM_ICDF(11066), AOM_ICDF(14088),
+ AOM_ICDF(15377), AOM_ICDF(15644), AOM_ICDF(16447), AOM_ICDF(17786),
+ AOM_ICDF(18605), AOM_ICDF(19822), AOM_ICDF(27104), AOM_ICDF(29648),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4608), AOM_ICDF(7358), AOM_ICDF(13016), AOM_ICDF(18200),
+ AOM_ICDF(19015), AOM_ICDF(19189), AOM_ICDF(20038), AOM_ICDF(21430),
+ AOM_ICDF(21917), AOM_ICDF(22977), AOM_ICDF(27949), AOM_ICDF(30848),
+ AOM_ICDF(32768), 0 },
+ },
+ {
+ { AOM_ICDF(7296), AOM_ICDF(8490), AOM_ICDF(11145), AOM_ICDF(15318),
+ AOM_ICDF(16693), AOM_ICDF(16889), AOM_ICDF(17571), AOM_ICDF(18580),
+ AOM_ICDF(19688), AOM_ICDF(21272), AOM_ICDF(27245), AOM_ICDF(28971),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5376), AOM_ICDF(7623), AOM_ICDF(16070), AOM_ICDF(18136),
+ AOM_ICDF(19225), AOM_ICDF(19397), AOM_ICDF(20128), AOM_ICDF(21362),
+ AOM_ICDF(21808), AOM_ICDF(22621), AOM_ICDF(27932), AOM_ICDF(30407),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(3200), AOM_ICDF(5164), AOM_ICDF(6566), AOM_ICDF(18368),
+ AOM_ICDF(19106), AOM_ICDF(19155), AOM_ICDF(19793), AOM_ICDF(20300),
+ AOM_ICDF(21177), AOM_ICDF(23079), AOM_ICDF(27848), AOM_ICDF(28924),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(7040), AOM_ICDF(8146), AOM_ICDF(10550), AOM_ICDF(12876),
+ AOM_ICDF(14506), AOM_ICDF(14629), AOM_ICDF(17180), AOM_ICDF(19129),
+ AOM_ICDF(20088), AOM_ICDF(23407), AOM_ICDF(28673), AOM_ICDF(30257),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6016), AOM_ICDF(7166), AOM_ICDF(9466), AOM_ICDF(11999),
+ AOM_ICDF(15723), AOM_ICDF(16293), AOM_ICDF(17580), AOM_ICDF(19004),
+ AOM_ICDF(20509), AOM_ICDF(22233), AOM_ICDF(28118), AOM_ICDF(29989),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(3840), AOM_ICDF(5422), AOM_ICDF(9054), AOM_ICDF(11018),
+ AOM_ICDF(13605), AOM_ICDF(17576), AOM_ICDF(19178), AOM_ICDF(21514),
+ AOM_ICDF(22877), AOM_ICDF(24461), AOM_ICDF(29069), AOM_ICDF(30933),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5376), AOM_ICDF(6553), AOM_ICDF(8294), AOM_ICDF(12601),
+ AOM_ICDF(15043), AOM_ICDF(15273), AOM_ICDF(16230), AOM_ICDF(17134),
+ AOM_ICDF(20737), AOM_ICDF(22899), AOM_ICDF(28219), AOM_ICDF(29410),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5760), AOM_ICDF(6815), AOM_ICDF(8336), AOM_ICDF(12965),
+ AOM_ICDF(14282), AOM_ICDF(14444), AOM_ICDF(15446), AOM_ICDF(16461),
+ AOM_ICDF(17544), AOM_ICDF(22183), AOM_ICDF(27682), AOM_ICDF(29132),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(6656), AOM_ICDF(8084), AOM_ICDF(10880), AOM_ICDF(12954),
+ AOM_ICDF(14527), AOM_ICDF(14728), AOM_ICDF(16490), AOM_ICDF(19224),
+ AOM_ICDF(20071), AOM_ICDF(21857), AOM_ICDF(27653), AOM_ICDF(30031),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5376), AOM_ICDF(6660), AOM_ICDF(9006), AOM_ICDF(12205),
+ AOM_ICDF(13614), AOM_ICDF(13740), AOM_ICDF(14632), AOM_ICDF(15766),
+ AOM_ICDF(16629), AOM_ICDF(18394), AOM_ICDF(25918), AOM_ICDF(28460),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4736), AOM_ICDF(6488), AOM_ICDF(9978), AOM_ICDF(12889),
+ AOM_ICDF(14419), AOM_ICDF(14607), AOM_ICDF(15458), AOM_ICDF(16743),
+ AOM_ICDF(17369), AOM_ICDF(19053), AOM_ICDF(26393), AOM_ICDF(29456),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5760), AOM_ICDF(6710), AOM_ICDF(8542), AOM_ICDF(12830),
+ AOM_ICDF(13956), AOM_ICDF(14031), AOM_ICDF(14763), AOM_ICDF(15677),
+ AOM_ICDF(16545), AOM_ICDF(18256), AOM_ICDF(25569), AOM_ICDF(27284),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4096), AOM_ICDF(7008), AOM_ICDF(11436), AOM_ICDF(17228),
+ AOM_ICDF(18131), AOM_ICDF(18269), AOM_ICDF(19345), AOM_ICDF(20551),
+ AOM_ICDF(21315), AOM_ICDF(22836), AOM_ICDF(28035), AOM_ICDF(29865),
+ AOM_ICDF(32768), 0 },
+ },
+ {
+ { AOM_ICDF(6528), AOM_ICDF(10833), AOM_ICDF(17688), AOM_ICDF(21947),
+ AOM_ICDF(22829), AOM_ICDF(23814), AOM_ICDF(24514), AOM_ICDF(25707),
+ AOM_ICDF(26397), AOM_ICDF(27442), AOM_ICDF(30271), AOM_ICDF(31734),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4480), AOM_ICDF(8679), AOM_ICDF(21100), AOM_ICDF(23075),
+ AOM_ICDF(23772), AOM_ICDF(24427), AOM_ICDF(25111), AOM_ICDF(26188),
+ AOM_ICDF(26445), AOM_ICDF(27235), AOM_ICDF(29980), AOM_ICDF(31875),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(2688), AOM_ICDF(6683), AOM_ICDF(9332), AOM_ICDF(22173),
+ AOM_ICDF(22688), AOM_ICDF(22972), AOM_ICDF(23623), AOM_ICDF(24159),
+ AOM_ICDF(24798), AOM_ICDF(26666), AOM_ICDF(29812), AOM_ICDF(30909),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(8192), AOM_ICDF(10112), AOM_ICDF(13298), AOM_ICDF(16662),
+ AOM_ICDF(17623), AOM_ICDF(18394), AOM_ICDF(20921), AOM_ICDF(22309),
+ AOM_ICDF(22963), AOM_ICDF(26257), AOM_ICDF(29945), AOM_ICDF(31423),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5120), AOM_ICDF(7604), AOM_ICDF(12617), AOM_ICDF(15628),
+ AOM_ICDF(18274), AOM_ICDF(20174), AOM_ICDF(21404), AOM_ICDF(22869),
+ AOM_ICDF(24184), AOM_ICDF(25626), AOM_ICDF(29615), AOM_ICDF(31155),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(7424), AOM_ICDF(10295), AOM_ICDF(18459), AOM_ICDF(21302),
+ AOM_ICDF(23034), AOM_ICDF(26284), AOM_ICDF(27576), AOM_ICDF(29746),
+ AOM_ICDF(30502), AOM_ICDF(31794), AOM_ICDF(32346), AOM_ICDF(32600),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4224), AOM_ICDF(6789), AOM_ICDF(11254), AOM_ICDF(15589),
+ AOM_ICDF(18568), AOM_ICDF(19238), AOM_ICDF(19872), AOM_ICDF(20880),
+ AOM_ICDF(24409), AOM_ICDF(26238), AOM_ICDF(29580), AOM_ICDF(30875),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5120), AOM_ICDF(7388), AOM_ICDF(10164), AOM_ICDF(15886),
+ AOM_ICDF(16694), AOM_ICDF(17139), AOM_ICDF(18421), AOM_ICDF(19262),
+ AOM_ICDF(20106), AOM_ICDF(26734), AOM_ICDF(29987), AOM_ICDF(31160),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(5760), AOM_ICDF(8292), AOM_ICDF(13837), AOM_ICDF(16201),
+ AOM_ICDF(17303), AOM_ICDF(18422), AOM_ICDF(20215), AOM_ICDF(23059),
+ AOM_ICDF(23628), AOM_ICDF(25449), AOM_ICDF(29537), AOM_ICDF(31455),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4224), AOM_ICDF(7235), AOM_ICDF(12521), AOM_ICDF(16798),
+ AOM_ICDF(17964), AOM_ICDF(18136), AOM_ICDF(18936), AOM_ICDF(20233),
+ AOM_ICDF(20821), AOM_ICDF(22501), AOM_ICDF(27955), AOM_ICDF(30493),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(3840), AOM_ICDF(7117), AOM_ICDF(13329), AOM_ICDF(17383),
+ AOM_ICDF(18323), AOM_ICDF(18492), AOM_ICDF(19273), AOM_ICDF(20538),
+ AOM_ICDF(21064), AOM_ICDF(22481), AOM_ICDF(27785), AOM_ICDF(30938),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(4736), AOM_ICDF(7474), AOM_ICDF(12414), AOM_ICDF(17230),
+ AOM_ICDF(18246), AOM_ICDF(18457), AOM_ICDF(19128), AOM_ICDF(20087),
+ AOM_ICDF(20830), AOM_ICDF(22602), AOM_ICDF(27923), AOM_ICDF(29929),
+ AOM_ICDF(32768), 0 },
+ { AOM_ICDF(3584), AOM_ICDF(9626), AOM_ICDF(15412), AOM_ICDF(20788),
+ AOM_ICDF(21676), AOM_ICDF(22192), AOM_ICDF(23266), AOM_ICDF(24342),
+ AOM_ICDF(24836), AOM_ICDF(26447), AOM_ICDF(29583), AOM_ICDF(31300),
+ AOM_ICDF(32768), 0 },
+ },
+#else
{
{ AOM_ICDF(15488), AOM_ICDF(17513), AOM_ICDF(20731), AOM_ICDF(24586),
AOM_ICDF(25921), AOM_ICDF(26749), AOM_ICDF(27807), AOM_ICDF(28602),
@@ -2935,7 +4167,8 @@ const aom_cdf_prob
AOM_ICDF(22933), AOM_ICDF(23648), AOM_ICDF(25322), AOM_ICDF(26602),
AOM_ICDF(27806), AOM_ICDF(29841), AOM_ICDF(32768), 0 },
},
-#else // !CONFIG_ALT_INTRA
+#endif // CONFIG_SMOOTH_HV
+#else // CONFIG_ALT_INTRA
{ { AOM_ICDF(17536), AOM_ICDF(19321), AOM_ICDF(21527), AOM_ICDF(25360),
AOM_ICDF(27516), AOM_ICDF(28026), AOM_ICDF(29323), AOM_ICDF(30023),
AOM_ICDF(30999), AOM_ICDF(32768), 0 },
@@ -3238,7 +4471,6 @@ const aom_cdf_prob
AOM_ICDF(30393), AOM_ICDF(32768), 0 } },
#endif // CONFIG_ALT_INTRA
};
-#endif // CONFIG_EC_MULTISYMBOL
static void init_mode_probs(FRAME_CONTEXT *fc) {
av1_copy(fc->uv_mode_prob, default_uv_probs);
@@ -3264,16 +4496,17 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
av1_copy(fc->comp_inter_mode_prob, default_comp_inter_mode_p);
#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF
av1_copy(fc->tx_size_probs, default_tx_size_prob);
+#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
+ fc->quarter_tx_size_prob = default_quarter_tx_size_prob;
+#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
#if CONFIG_VAR_TX
av1_copy(fc->txfm_partition_prob, default_txfm_partition_probs);
#endif
av1_copy(fc->skip_probs, default_skip_probs);
-#if CONFIG_REF_MV
av1_copy(fc->newmv_prob, default_newmv_prob);
av1_copy(fc->zeromv_prob, default_zeromv_prob);
av1_copy(fc->refmv_prob, default_refmv_prob);
av1_copy(fc->drl_prob, default_drl_prob);
-#endif // CONFIG_REF_MV
av1_copy(fc->inter_mode_probs, default_inter_mode_probs);
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
av1_copy(fc->motion_mode_prob, default_motion_mode_prob);
@@ -3288,9 +4521,11 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
default_inter_singleref_comp_mode_probs);
#endif // CONFIG_COMPOUND_SINGLEREF
av1_copy(fc->compound_type_prob, default_compound_type_probs);
+#if CONFIG_INTERINTRA
av1_copy(fc->interintra_prob, default_interintra_prob);
av1_copy(fc->interintra_mode_prob, default_interintra_mode_prob);
av1_copy(fc->wedge_interintra_prob, default_wedge_interintra_prob);
+#endif
#endif // CONFIG_EXT_INTER
#if CONFIG_SUPERTX
av1_copy(fc->supertx_prob, default_supertx_prob);
@@ -3310,7 +4545,6 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
#if CONFIG_LOOP_RESTORATION
av1_copy(fc->switchable_restore_prob, default_switchable_restore_prob);
#endif // CONFIG_LOOP_RESTORATION
-#if CONFIG_EC_MULTISYMBOL
av1_copy(fc->y_mode_cdf, default_if_y_mode_cdf);
av1_copy(fc->uv_mode_cdf, default_uv_mode_cdf);
av1_copy(fc->switchable_interp_cdf, default_switchable_interp_cdf);
@@ -3323,22 +4557,22 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
#endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
av1_copy(fc->seg.tree_cdf, default_seg_tree_cdf);
av1_copy(fc->tx_size_cdf, default_tx_size_cdf);
-#endif // CONFIG_EC_MULTISYMBOL
#if CONFIG_DELTA_Q
av1_copy(fc->delta_q_prob, default_delta_q_probs);
-#if CONFIG_EC_MULTISYMBOL
av1_copy(fc->delta_q_cdf, default_delta_q_cdf);
-#endif // CONFIG_EC_MULTISYMBOL
#if CONFIG_EXT_DELTA_Q
av1_copy(fc->delta_lf_prob, default_delta_lf_probs);
-#if CONFIG_EC_MULTISYMBOL
av1_copy(fc->delta_lf_cdf, default_delta_lf_cdf);
-#endif // CONFIG_EC_MULTISYMBOL
#endif
#endif // CONFIG_DELTA_Q
+#if CONFIG_CFL
+ av1_copy(fc->cfl_alpha_cdf, default_cfl_alpha_cdf);
+#endif
+#if CONFIG_INTRABC
+ fc->intrabc_prob = INTRABC_PROB_DEFAULT;
+#endif
}
-#if CONFIG_EC_MULTISYMBOL
int av1_switchable_interp_ind[SWITCHABLE_FILTERS];
int av1_switchable_interp_inv[SWITCHABLE_FILTERS];
@@ -3439,9 +4673,8 @@ void av1_set_mode_cdfs(struct AV1Common *cm) {
#endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
}
#endif // !CONFIG_EC_ADAPT
-#endif // CONFIG_EC_MULTISYMBOL
-#if CONFIG_DUAL_FILTER
+#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
const aom_tree_index av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)] =
{
-EIGHTTAP_REGULAR, 2, 4, -MULTITAP_SHARP, -EIGHTTAP_SMOOTH,
@@ -3455,7 +4688,7 @@ const aom_tree_index av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)] =
void av1_adapt_inter_frame_probs(AV1_COMMON *cm) {
int i, j;
FRAME_CONTEXT *fc = cm->fc;
- const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx];
+ const FRAME_CONTEXT *pre_fc = cm->pre_fc;
const FRAME_COUNTS *counts = &cm->counts;
for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
@@ -3494,7 +4727,6 @@ void av1_adapt_inter_frame_probs(AV1_COMMON *cm) {
#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF
-#if CONFIG_REF_MV
for (i = 0; i < NEWMV_MODE_CONTEXTS; ++i)
fc->newmv_prob[i] =
av1_mode_mv_merge_probs(pre_fc->newmv_prob[i], counts->newmv_mode[i]);
@@ -3508,11 +4740,6 @@ void av1_adapt_inter_frame_probs(AV1_COMMON *cm) {
for (i = 0; i < DRL_MODE_CONTEXTS; ++i)
fc->drl_prob[i] =
av1_mode_mv_merge_probs(pre_fc->drl_prob[i], counts->drl_mode[i]);
-#else
- for (i = 0; i < INTER_MODE_CONTEXTS; i++)
- aom_tree_merge_probs(av1_inter_mode_tree, pre_fc->inter_mode_probs[i],
- counts->inter_mode[i], fc->inter_mode_probs[i]);
-#endif
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
for (i = BLOCK_8X8; i < BLOCK_SIZES; ++i)
@@ -3546,27 +4773,35 @@ void av1_adapt_inter_frame_probs(AV1_COMMON *cm) {
counts->inter_singleref_comp_mode[i],
fc->inter_singleref_comp_mode_probs[i]);
#endif // CONFIG_COMPOUND_SINGLEREF
- for (i = 0; i < BLOCK_SIZE_GROUPS; ++i) {
- if (is_interintra_allowed_bsize_group(i))
- fc->interintra_prob[i] = av1_mode_mv_merge_probs(
- pre_fc->interintra_prob[i], counts->interintra[i]);
- }
- for (i = 0; i < BLOCK_SIZE_GROUPS; i++) {
- aom_tree_merge_probs(
- av1_interintra_mode_tree, pre_fc->interintra_mode_prob[i],
- counts->interintra_mode[i], fc->interintra_mode_prob[i]);
- }
- for (i = 0; i < BLOCK_SIZES; ++i) {
- if (is_interintra_allowed_bsize(i) && is_interintra_wedge_used(i))
- fc->wedge_interintra_prob[i] = av1_mode_mv_merge_probs(
- pre_fc->wedge_interintra_prob[i], counts->wedge_interintra[i]);
+#if CONFIG_INTERINTRA
+ if (cm->allow_interintra_compound) {
+ for (i = 0; i < BLOCK_SIZE_GROUPS; ++i) {
+ if (is_interintra_allowed_bsize_group(i))
+ fc->interintra_prob[i] = av1_mode_mv_merge_probs(
+ pre_fc->interintra_prob[i], counts->interintra[i]);
+ }
+ for (i = 0; i < BLOCK_SIZE_GROUPS; i++) {
+ aom_tree_merge_probs(
+ av1_interintra_mode_tree, pre_fc->interintra_mode_prob[i],
+ counts->interintra_mode[i], fc->interintra_mode_prob[i]);
+ }
+#if CONFIG_WEDGE
+ for (i = 0; i < BLOCK_SIZES; ++i) {
+ if (is_interintra_allowed_bsize(i) && is_interintra_wedge_used(i))
+ fc->wedge_interintra_prob[i] = av1_mode_mv_merge_probs(
+ pre_fc->wedge_interintra_prob[i], counts->wedge_interintra[i]);
+ }
+#endif // CONFIG_WEDGE
}
+#endif // CONFIG_INTERINTRA
#if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
- for (i = 0; i < BLOCK_SIZES; ++i) {
- aom_tree_merge_probs(av1_compound_type_tree, pre_fc->compound_type_prob[i],
- counts->compound_interinter[i],
- fc->compound_type_prob[i]);
+ if (cm->allow_masked_compound) {
+ for (i = 0; i < BLOCK_SIZES; ++i) {
+ aom_tree_merge_probs(
+ av1_compound_type_tree, pre_fc->compound_type_prob[i],
+ counts->compound_interinter[i], fc->compound_type_prob[i]);
+ }
}
#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
#endif // CONFIG_EXT_INTER
@@ -3586,7 +4821,7 @@ void av1_adapt_inter_frame_probs(AV1_COMMON *cm) {
void av1_adapt_intra_frame_probs(AV1_COMMON *cm) {
int i, j;
FRAME_CONTEXT *fc = cm->fc;
- const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx];
+ const FRAME_CONTEXT *pre_fc = cm->pre_fc;
const FRAME_COUNTS *counts = &cm->counts;
if (cm->tx_mode == TX_MODE_SELECT) {
@@ -3595,6 +4830,10 @@ void av1_adapt_intra_frame_probs(AV1_COMMON *cm) {
aom_tree_merge_probs(av1_tx_size_tree[i], pre_fc->tx_size_probs[i][j],
counts->tx_size[i][j], fc->tx_size_probs[i][j]);
}
+#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
+ fc->quarter_tx_size_prob = av1_mode_mv_merge_probs(
+ pre_fc->quarter_tx_size_prob, counts->quarter_tx_size);
+#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
}
#if CONFIG_VAR_TX
diff --git a/third_party/aom/av1/common/entropymode.h b/third_party/aom/av1/common/entropymode.h
index 9c3a78d61..e45af4827 100644
--- a/third_party/aom/av1/common/entropymode.h
+++ b/third_party/aom/av1/common/entropymode.h
@@ -73,7 +73,7 @@ extern "C" {
#endif // CONFIG_PALETTE
#if CONFIG_INTRABC
-#define INTRABC_PROB 192
+#define INTRABC_PROB_DEFAULT 192
#endif // CONFIG_INTRABC
struct AV1Common;
@@ -99,18 +99,14 @@ typedef struct frame_contexts {
aom_prob partition_prob[PARTITION_CONTEXTS][PARTITION_TYPES - 1];
#endif
av1_coeff_probs_model coef_probs[TX_SIZES][PLANE_TYPES];
-#if CONFIG_NEW_TOKENSET
coeff_cdf_model coef_tail_cdfs[TX_SIZES][PLANE_TYPES];
coeff_cdf_model coef_head_cdfs[TX_SIZES][PLANE_TYPES];
aom_prob blockzero_probs[TX_SIZES][PLANE_TYPES][REF_TYPES][BLOCKZ_CONTEXTS];
-#elif CONFIG_EC_MULTISYMBOL
- coeff_cdf_model coef_cdfs[TX_SIZES][PLANE_TYPES];
-#endif // CONFIG_NEW_TOKENSET
aom_prob switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
[SWITCHABLE_FILTERS - 1];
#if CONFIG_ADAPT_SCAN
// TODO(angiebird): try aom_prob
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
uint32_t non_zero_prob_2x2[TX_TYPES][4];
#endif
uint32_t non_zero_prob_4X4[TX_TYPES][16];
@@ -125,7 +121,7 @@ typedef struct frame_contexts {
uint32_t non_zero_prob_32X16[TX_TYPES][512];
uint32_t non_zero_prob_16X32[TX_TYPES][512];
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
DECLARE_ALIGNED(16, int16_t, scan_2x2[TX_TYPES][4]);
#endif
DECLARE_ALIGNED(16, int16_t, scan_4X4[TX_TYPES][16]);
@@ -140,7 +136,7 @@ typedef struct frame_contexts {
DECLARE_ALIGNED(16, int16_t, scan_16X32[TX_TYPES][512]);
DECLARE_ALIGNED(16, int16_t, scan_32X16[TX_TYPES][512]);
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
DECLARE_ALIGNED(16, int16_t, iscan_2x2[TX_TYPES][4]);
#endif
DECLARE_ALIGNED(16, int16_t, iscan_4X4[TX_TYPES][16]);
@@ -155,7 +151,7 @@ typedef struct frame_contexts {
DECLARE_ALIGNED(16, int16_t, iscan_16X32[TX_TYPES][512]);
DECLARE_ALIGNED(16, int16_t, iscan_32X16[TX_TYPES][512]);
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
int16_t nb_2x2[TX_TYPES][(4 + 1) * 2];
#endif
int16_t nb_4X4[TX_TYPES][(16 + 1) * 2];
@@ -185,12 +181,10 @@ typedef struct frame_contexts {
aom_prob coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS];
#endif
-#if CONFIG_REF_MV
aom_prob newmv_prob[NEWMV_MODE_CONTEXTS];
aom_prob zeromv_prob[ZEROMV_MODE_CONTEXTS];
aom_prob refmv_prob[REFMV_MODE_CONTEXTS];
aom_prob drl_prob[DRL_MODE_CONTEXTS];
-#endif // CONFIG_REF_MV
aom_prob inter_mode_probs[INTER_MODE_CONTEXTS][INTER_MODES - 1];
#if CONFIG_EXT_INTER
@@ -201,9 +195,11 @@ typedef struct frame_contexts {
[INTER_SINGLEREF_COMP_MODES - 1];
#endif // CONFIG_COMPOUND_SINGLEREF
aom_prob compound_type_prob[BLOCK_SIZES][COMPOUND_TYPES - 1];
+#if CONFIG_INTERINTRA
aom_prob interintra_prob[BLOCK_SIZE_GROUPS];
aom_prob interintra_mode_prob[BLOCK_SIZE_GROUPS][INTERINTRA_MODES - 1];
aom_prob wedge_interintra_prob[BLOCK_SIZES];
+#endif // CONFIG_INTERINTRA
#endif // CONFIG_EXT_INTER
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
aom_prob motion_mode_prob[BLOCK_SIZES][MOTION_MODES - 1];
@@ -224,17 +220,17 @@ typedef struct frame_contexts {
aom_prob comp_inter_mode_prob[COMP_INTER_MODE_CONTEXTS];
#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF
aom_prob tx_size_probs[MAX_TX_DEPTH][TX_SIZE_CONTEXTS][MAX_TX_DEPTH];
+#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
+ aom_prob quarter_tx_size_prob;
+#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
#if CONFIG_VAR_TX
aom_prob txfm_partition_prob[TXFM_PARTITION_CONTEXTS];
#endif
aom_prob skip_probs[SKIP_CONTEXTS];
-#if CONFIG_REF_MV
nmv_context nmvc[NMV_CONTEXTS];
-#else
- nmv_context nmvc;
-#endif
#if CONFIG_INTRABC
nmv_context ndvc;
+ aom_prob intrabc_prob;
#endif
int initialized;
#if CONFIG_EXT_TX
@@ -263,7 +259,6 @@ typedef struct frame_contexts {
#if CONFIG_LOOP_RESTORATION
aom_prob switchable_restore_prob[RESTORE_SWITCHABLE_TYPES - 1];
#endif // CONFIG_LOOP_RESTORATION
-#if CONFIG_EC_MULTISYMBOL
aom_cdf_prob y_mode_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(INTRA_MODES)];
aom_cdf_prob uv_mode_cdf[INTRA_MODES][CDF_SIZE(INTRA_MODES)];
#if CONFIG_EXT_PARTITION_TYPES
@@ -297,7 +292,6 @@ typedef struct frame_contexts {
#if CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
aom_cdf_prob intra_filter_cdf[INTRA_FILTERS + 1][CDF_SIZE(INTRA_FILTERS)];
#endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
-#endif // CONFIG_EC_MULTISYMBOL
#if CONFIG_DELTA_Q
aom_prob delta_q_prob[DELTA_Q_PROBS];
#if CONFIG_EXT_DELTA_Q
@@ -309,6 +303,9 @@ typedef struct frame_contexts {
// such as coef_cdfs[], coef_tail_cdfs[], and coef_heaf_cdfs[] can be removed.
od_adapt_ctx pvq_context;
#endif // CONFIG_PVQ
+#if CONFIG_CFL
+ aom_cdf_prob cfl_alpha_cdf[CDF_SIZE(CFL_ALPHABET_SIZE)];
+#endif
} FRAME_CONTEXT;
typedef struct FRAME_COUNTS {
@@ -328,9 +325,9 @@ typedef struct FRAME_COUNTS {
unsigned int switchable_interp[SWITCHABLE_FILTER_CONTEXTS]
[SWITCHABLE_FILTERS];
#if CONFIG_ADAPT_SCAN
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
unsigned int non_zero_count_2x2[TX_TYPES][4];
-#endif // CONFIG_CB4X4
+#endif // CONFIG_CHROMA_2X2
unsigned int non_zero_count_4X4[TX_TYPES][16];
unsigned int non_zero_count_8X8[TX_TYPES][64];
unsigned int non_zero_count_16X16[TX_TYPES][256];
@@ -356,16 +353,12 @@ typedef struct FRAME_COUNTS {
unsigned int coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS][2];
#endif // CONFIG_LV_MAP
-#if CONFIG_EC_MULTISYMBOL
av1_blockz_count_model blockz_count[TX_SIZES][PLANE_TYPES];
-#endif
-#if CONFIG_REF_MV
unsigned int newmv_mode[NEWMV_MODE_CONTEXTS][2];
unsigned int zeromv_mode[ZEROMV_MODE_CONTEXTS][2];
unsigned int refmv_mode[REFMV_MODE_CONTEXTS][2];
unsigned int drl_mode[DRL_MODE_CONTEXTS][2];
-#endif
unsigned int inter_mode[INTER_MODE_CONTEXTS][INTER_MODES];
#if CONFIG_EXT_INTER
@@ -374,9 +367,11 @@ typedef struct FRAME_COUNTS {
unsigned int inter_singleref_comp_mode[INTER_MODE_CONTEXTS]
[INTER_SINGLEREF_COMP_MODES];
#endif // CONFIG_COMPOUND_SINGLEREF
+#if CONFIG_INTERINTRA
unsigned int interintra[BLOCK_SIZE_GROUPS][2];
unsigned int interintra_mode[BLOCK_SIZE_GROUPS][INTERINTRA_MODES];
unsigned int wedge_interintra[BLOCK_SIZES][2];
+#endif // CONFIG_INTERINTRA
unsigned int compound_interinter[BLOCK_SIZES][COMPOUND_TYPES];
#endif // CONFIG_EXT_INTER
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
@@ -401,17 +396,17 @@ typedef struct FRAME_COUNTS {
// to use forward updates for the coeff probs, and as such it does not really
// belong into this structure.
unsigned int tx_size_totals[TX_SIZES];
- unsigned int tx_size[MAX_TX_DEPTH][TX_SIZE_CONTEXTS][TX_SIZES];
+ unsigned int tx_size[MAX_TX_DEPTH][TX_SIZE_CONTEXTS][MAX_TX_DEPTH + 1];
+#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
+ unsigned int quarter_tx_size[2];
+#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
#if CONFIG_VAR_TX
unsigned int txfm_partition[TXFM_PARTITION_CONTEXTS][2];
#endif
unsigned int skip[SKIP_CONTEXTS][2];
-#if CONFIG_REF_MV
nmv_context_counts mv[NMV_CONTEXTS];
-#else
- nmv_context_counts mv;
-#endif
#if CONFIG_INTRABC
+ unsigned int intrabc[2];
nmv_context_counts dv;
#endif
#if CONFIG_DELTA_Q
@@ -451,11 +446,9 @@ typedef struct FRAME_COUNTS {
// Contexts used: Intra mode (Y plane) of 'above' and 'left' blocks.
extern const aom_prob av1_kf_y_mode_prob[INTRA_MODES][INTRA_MODES]
[INTRA_MODES - 1];
-#if CONFIG_EC_MULTISYMBOL
// CDF version of 'av1_kf_y_mode_prob'.
extern const aom_cdf_prob av1_kf_y_mode_cdf[INTRA_MODES][INTRA_MODES]
[CDF_SIZE(INTRA_MODES)];
-#endif
#if CONFIG_PALETTE
extern const aom_prob av1_default_palette_y_mode_prob[PALETTE_BLOCK_SIZES]
@@ -474,7 +467,6 @@ extern const aom_prob av1_default_palette_uv_color_index_prob
extern const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)];
extern const aom_tree_index av1_inter_mode_tree[TREE_SIZE(INTER_MODES)];
-#if CONFIG_EC_MULTISYMBOL
extern int av1_intra_mode_ind[INTRA_MODES];
extern int av1_intra_mode_inv[INTRA_MODES];
extern int av1_inter_mode_ind[INTER_MODES];
@@ -485,11 +477,12 @@ extern int av1_ext_tx_intra_inv[EXT_TX_SETS_INTRA][TX_TYPES];
extern int av1_ext_tx_inter_ind[EXT_TX_SETS_INTER][TX_TYPES];
extern int av1_ext_tx_inter_inv[EXT_TX_SETS_INTER][TX_TYPES];
#endif
-#endif
#if CONFIG_EXT_INTER
+#if CONFIG_INTERINTRA
extern const aom_tree_index
av1_interintra_mode_tree[TREE_SIZE(INTERINTRA_MODES)];
+#endif
extern const aom_tree_index
av1_inter_compound_mode_tree[TREE_SIZE(INTER_COMPOUND_MODES)];
#if CONFIG_COMPOUND_SINGLEREF
@@ -534,10 +527,10 @@ extern const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)];
extern const aom_tree_index
av1_switchable_restore_tree[TREE_SIZE(RESTORE_SWITCHABLE_TYPES)];
#endif // CONFIG_LOOP_RESTORATION
-#if CONFIG_EC_MULTISYMBOL
extern int av1_switchable_interp_ind[SWITCHABLE_FILTERS];
extern int av1_switchable_interp_inv[SWITCHABLE_FILTERS];
+#if !CONFIG_EC_ADAPT
void av1_set_mode_cdfs(struct AV1Common *cm);
#endif
@@ -545,7 +538,7 @@ void av1_setup_past_independence(struct AV1Common *cm);
void av1_adapt_intra_frame_probs(struct AV1Common *cm);
void av1_adapt_inter_frame_probs(struct AV1Common *cm);
-#if CONFIG_EC_MULTISYMBOL && !CONFIG_EXT_TX
+#if !CONFIG_EXT_TX
extern int av1_ext_tx_ind[TX_TYPES];
extern int av1_ext_tx_inv[TX_TYPES];
#endif
diff --git a/third_party/aom/av1/common/entropymv.c b/third_party/aom/av1/common/entropymv.c
index 9c162d2c5..954bfec4e 100644
--- a/third_party/aom/av1/common/entropymv.c
+++ b/third_party/aom/av1/common/entropymv.c
@@ -43,57 +43,47 @@ const aom_tree_index av1_mv_fp_tree[TREE_SIZE(MV_FP_SIZE)] = { -0, 2, -1,
static const nmv_context default_nmv_context = {
{ 32, 64, 96 }, // joints
-#if CONFIG_EC_MULTISYMBOL
{ AOM_ICDF(4096), AOM_ICDF(11264), AOM_ICDF(19328), AOM_ICDF(32768),
0 }, // joint_cdf
-#endif
{ {
// Vertical component
128, // sign
{ 224, 144, 192, 168, 192, 176, 192, 198, 198, 245 }, // class
-#if CONFIG_EC_MULTISYMBOL
{ AOM_ICDF(28672), AOM_ICDF(30976), AOM_ICDF(31858), AOM_ICDF(32320),
AOM_ICDF(32551), AOM_ICDF(32656), AOM_ICDF(32740), AOM_ICDF(32757),
AOM_ICDF(32762), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, // class_cdf
-#endif
- { 216 }, // class0
- { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits
- { { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp
- { 64, 96, 64 }, // fp
-#if CONFIG_EC_MULTISYMBOL
+ { 216 }, // class0
+ { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits
+ { { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp
+ { 64, 96, 64 }, // fp
{ { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(26624), AOM_ICDF(32768),
0 },
{ AOM_ICDF(12288), AOM_ICDF(21248), AOM_ICDF(24128), AOM_ICDF(32768),
0 } }, // class0_fp_cdf
{ AOM_ICDF(8192), AOM_ICDF(17408), AOM_ICDF(21248), AOM_ICDF(32768),
0 }, // fp_cdf
-#endif
- 160, // class0_hp bit
- 128, // hp
+ 160, // class0_hp bit
+ 128, // hp
},
{
// Horizontal component
128, // sign
{ 216, 128, 176, 160, 176, 176, 192, 198, 198, 208 }, // class
-#if CONFIG_EC_MULTISYMBOL
{ AOM_ICDF(28672), AOM_ICDF(30976), AOM_ICDF(31858), AOM_ICDF(32320),
AOM_ICDF(32551), AOM_ICDF(32656), AOM_ICDF(32740), AOM_ICDF(32757),
AOM_ICDF(32762), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, // class_cdf
-#endif
- { 208 }, // class0
- { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits
- { { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp
- { 64, 96, 64 }, // fp
-#if CONFIG_EC_MULTISYMBOL
+ { 208 }, // class0
+ { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits
+ { { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp
+ { 64, 96, 64 }, // fp
{ { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(26624), AOM_ICDF(32768),
0 },
{ AOM_ICDF(12288), AOM_ICDF(21248), AOM_ICDF(24128), AOM_ICDF(32768),
0 } }, // class0_fp_cdf
{ AOM_ICDF(8192), AOM_ICDF(17408), AOM_ICDF(21248), AOM_ICDF(32768),
0 }, // fp_cdf
-#endif
- 160, // class0_hp bit
- 128, // hp
+ 160, // class0_hp bit
+ 128, // hp
} },
};
@@ -232,23 +222,16 @@ void av1_inc_mv(const MV *mv, nmv_context_counts *counts, const int usehp) {
void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) {
int i, j;
-#if CONFIG_REF_MV
int idx;
for (idx = 0; idx < NMV_CONTEXTS; ++idx) {
- nmv_context *fc = &cm->fc->nmvc[idx];
- const nmv_context *pre_fc =
- &cm->frame_contexts[cm->frame_context_idx].nmvc[idx];
+ nmv_context *nmvc = &cm->fc->nmvc[idx];
+ const nmv_context *pre_nmvc = &cm->pre_fc->nmvc[idx];
const nmv_context_counts *counts = &cm->counts.mv[idx];
-#else
- nmv_context *fc = &cm->fc->nmvc;
- const nmv_context *pre_fc = &cm->frame_contexts[cm->frame_context_idx].nmvc;
- const nmv_context_counts *counts = &cm->counts.mv;
-#endif // CONFIG_REF_MV
- aom_tree_merge_probs(av1_mv_joint_tree, pre_fc->joints, counts->joints,
- fc->joints);
+ aom_tree_merge_probs(av1_mv_joint_tree, pre_nmvc->joints, counts->joints,
+ nmvc->joints);
for (i = 0; i < 2; ++i) {
- nmv_component *comp = &fc->comps[i];
- const nmv_component *pre_comp = &pre_fc->comps[i];
+ nmv_component *comp = &nmvc->comps[i];
+ const nmv_component *pre_comp = &pre_nmvc->comps[i];
const nmv_component_counts *c = &counts->comps[i];
comp->sign = av1_mode_mv_merge_probs(pre_comp->sign, c->sign);
@@ -272,12 +255,10 @@ void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) {
comp->hp = av1_mode_mv_merge_probs(pre_comp->hp, c->hp);
}
}
-#if CONFIG_REF_MV
}
-#endif // CONFIG_REF_MV
}
-#if CONFIG_EC_MULTISYMBOL && !CONFIG_EC_ADAPT
+#if !CONFIG_EC_ADAPT
void av1_set_mv_cdfs(nmv_context *ctx) {
int i;
int j;
@@ -297,15 +278,11 @@ void av1_set_mv_cdfs(nmv_context *ctx) {
#endif
void av1_init_mv_probs(AV1_COMMON *cm) {
-#if CONFIG_REF_MV
int i;
for (i = 0; i < NMV_CONTEXTS; ++i) {
// NB: this sets CDFs too
cm->fc->nmvc[i] = default_nmv_context;
}
-#else
- cm->fc->nmvc = default_nmv_context;
-#endif // CONFIG_REF_MV
#if CONFIG_INTRABC
cm->fc->ndvc = default_nmv_context;
#endif // CONFIG_INTRABC
diff --git a/third_party/aom/av1/common/entropymv.h b/third_party/aom/av1/common/entropymv.h
index 2c79d447a..61bbbe326 100644
--- a/third_party/aom/av1/common/entropymv.h
+++ b/third_party/aom/av1/common/entropymv.h
@@ -84,26 +84,20 @@ extern const aom_tree_index av1_mv_fp_tree[];
typedef struct {
aom_prob sign;
aom_prob classes[MV_CLASSES - 1];
-#if CONFIG_EC_MULTISYMBOL
aom_cdf_prob class_cdf[CDF_SIZE(MV_CLASSES)];
-#endif
aom_prob class0[CLASS0_SIZE - 1];
aom_prob bits[MV_OFFSET_BITS];
aom_prob class0_fp[CLASS0_SIZE][MV_FP_SIZE - 1];
aom_prob fp[MV_FP_SIZE - 1];
-#if CONFIG_EC_MULTISYMBOL
aom_cdf_prob class0_fp_cdf[CLASS0_SIZE][CDF_SIZE(MV_FP_SIZE)];
aom_cdf_prob fp_cdf[CDF_SIZE(MV_FP_SIZE)];
-#endif
aom_prob class0_hp;
aom_prob hp;
} nmv_component;
typedef struct {
aom_prob joints[MV_JOINTS - 1];
-#if CONFIG_EC_MULTISYMBOL
aom_cdf_prob joint_cdf[CDF_SIZE(MV_JOINTS)];
-#endif
nmv_component comps[2];
} nmv_context;
@@ -138,7 +132,7 @@ void av1_inc_mv(const MV *mv, nmv_context_counts *mvctx, const int usehp);
extern const aom_tree_index
av1_global_motion_types_tree[TREE_SIZE(GLOBAL_TRANS_TYPES)];
#endif // CONFIG_GLOBAL_MOTION
-#if CONFIG_EC_MULTISYMBOL
+#if !CONFIG_EC_ADAPT
void av1_set_mv_cdfs(nmv_context *ctx);
#endif
diff --git a/third_party/aom/av1/common/enums.h b/third_party/aom/av1/common/enums.h
index 054bd40be..0cce8f0ee 100644
--- a/third_party/aom/av1/common/enums.h
+++ b/third_party/aom/av1/common/enums.h
@@ -51,7 +51,6 @@ extern "C" {
// 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
@@ -111,8 +110,13 @@ typedef enum ATTRIBUTE_PACKED {
BLOCK_128X64,
BLOCK_128X128,
#endif // CONFIG_EXT_PARTITION
- BLOCK_SIZES,
- BLOCK_INVALID = BLOCK_SIZES,
+ BLOCK_4X16,
+ BLOCK_16X4,
+ BLOCK_8X32,
+ BLOCK_32X8,
+ BLOCK_SIZES_ALL,
+ BLOCK_SIZES = BLOCK_4X16,
+ BLOCK_INVALID = 255,
BLOCK_LARGEST = (BLOCK_SIZES - 1)
} BLOCK_SIZE;
@@ -145,7 +149,7 @@ typedef char PARTITION_CONTEXT;
// block transform size
typedef enum ATTRIBUTE_PACKED {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
TX_2X2, // 2x2 transform
#endif
TX_4X4, // 4x4 transform
@@ -170,7 +174,12 @@ typedef enum ATTRIBUTE_PACKED {
TX_INVALID = 255 // Invalid transform size
} TX_SIZE;
-#define MAX_TX_DEPTH (TX_SIZES - 1 - TX_4X4)
+#define TX_SIZE_LUMA_MIN (TX_4X4)
+/* We don't need to code a transform size unless the allowed size is at least
+ one more than the minimum. */
+#define TX_SIZE_CTX_MIN (TX_SIZE_LUMA_MIN + 1)
+
+#define MAX_TX_DEPTH (TX_SIZES - TX_SIZE_CTX_MIN)
#define MAX_TX_SIZE_LOG2 (5 + CONFIG_TX64X64)
#define MAX_TX_SIZE (1 << MAX_TX_SIZE_LOG2)
@@ -240,15 +249,15 @@ typedef enum {
} BOUNDARY_TYPE;
#if CONFIG_EXT_TX
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
#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
+#endif // CONFIG_CHROMA_2X2
#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
+#if CONFIG_CHROMA_2X2
#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
@@ -274,7 +283,14 @@ typedef enum {
typedef enum { PLANE_TYPE_Y = 0, PLANE_TYPE_UV = 1, PLANE_TYPES } PLANE_TYPE;
#if CONFIG_CFL
+// TODO(ltrudeau) this should change based on QP size
+#define CB_ALPHABET_SIZE 4
+#define CR_ALPHABET_SIZE 4
+#define CFL_ALPHABET_SIZE (CB_ALPHABET_SIZE * CR_ALPHABET_SIZE)
+#define CFL_MAGS_SIZE 7
+
typedef enum { CFL_PRED_U = 0, CFL_PRED_V = 1, CFL_PRED_PLANES } CFL_PRED_TYPE;
+typedef enum { CFL_SIGN_NEG = 0, CFL_SIGN_POS = 1, CFL_SIGNS } CFL_SIGN_TYPE;
#endif
#if CONFIG_PALETTE
@@ -314,8 +330,12 @@ typedef enum ATTRIBUTE_PACKED {
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
+#if CONFIG_SMOOTH_HV
+ SMOOTH_V_PRED, // Vertical interpolation
+ SMOOTH_H_PRED, // Horizontal interpolation
+#endif // CONFIG_SMOOTH_HV
+#endif // CONFIG_ALT_INTRA
+ TM_PRED, // True-motion
NEARESTMV,
NEARMV,
ZEROMV,
@@ -331,8 +351,6 @@ typedef enum ATTRIBUTE_PACKED {
#endif // CONFIG_COMPOUND_SINGLEREF
// Compound ref compound modes
NEAREST_NEARESTMV,
- NEAREST_NEARMV,
- NEAR_NEARESTMV,
NEAR_NEARMV,
NEAREST_NEWMV,
NEW_NEARESTMV,
@@ -357,22 +375,20 @@ typedef enum {
MOTION_MODES
} MOTION_MODE;
-// TODO(urvang): Consider adding II_SMOOTH_PRED if it's helpful.
-
#if CONFIG_EXT_INTER
+#if CONFIG_INTERINTRA
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,
+#if CONFIG_ALT_INTRA
+ II_SMOOTH_PRED,
+#else
II_TM_PRED,
+#endif // CONFIG_ALT_INTRA
INTERINTRA_MODES
} INTERINTRA_MODE;
+#endif
typedef enum {
COMPOUND_AVERAGE = 0,
@@ -404,7 +420,7 @@ typedef enum {
#endif // CONFIG_FILTER_INTRA
#if CONFIG_EXT_INTRA
-#define DIRECTIONAL_MODES (INTRA_MODES - 2)
+#define DIRECTIONAL_MODES 8
#endif // CONFIG_EXT_INTRA
#define INTER_MODES (1 + NEWMV - NEARESTMV)
@@ -419,7 +435,6 @@ typedef enum {
#define SKIP_CONTEXTS 3
-#if CONFIG_REF_MV
#define NMV_CONTEXTS 3
#define NEWMV_MODE_CONTEXTS 7
@@ -438,7 +453,6 @@ typedef enum {
#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
@@ -455,14 +469,12 @@ typedef enum {
/* 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
@@ -508,11 +520,7 @@ typedef uint8_t TXFM_CONTEXT;
#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
diff --git a/third_party/aom/av1/common/filter.c b/third_party/aom/av1/common/filter.c
index 9f0c58866..c5555e34e 100644
--- a/third_party/aom/av1/common/filter.c
+++ b/third_party/aom/av1/common/filter.c
@@ -48,9 +48,19 @@ DECLARE_ALIGNED(16, static const int16_t,
};
#endif // USE_TEMPORALFILTER_12TAP
-#if CONFIG_DUAL_FILTER
+#if USE_EXTRA_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
// 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 },
@@ -60,10 +70,21 @@ DECLARE_ALIGNED(256, static const InterpKernel,
{ -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 },
+#endif
};
DECLARE_ALIGNED(256, static const InterpKernel,
sub_pel_filters_regular_uv[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
// 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 },
@@ -73,6 +94,7 @@ DECLARE_ALIGNED(256, static const InterpKernel,
{ -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 },
+#endif
};
#if USE_12TAP_FILTER
@@ -162,6 +184,16 @@ DECLARE_ALIGNED(256, static const InterpKernel,
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
// 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 },
@@ -171,10 +203,21 @@ DECLARE_ALIGNED(256, static const InterpKernel,
{ 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 },
+#endif
};
DECLARE_ALIGNED(256, static const InterpKernel,
sub_pel_filters_smooth_uv[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
// 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 },
@@ -184,8 +227,9 @@ DECLARE_ALIGNED(256, static const InterpKernel,
{ 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 },
+#endif
};
-#else // CONFIG_DUAL_FILTER
+#else // USE_EXTRA_FILTER
DECLARE_ALIGNED(256, static const InterpKernel,
sub_pel_filters_8[SUBPEL_SHIFTS]) = {
@@ -255,7 +299,7 @@ DECLARE_ALIGNED(256, static const InterpKernel,
{ 0, -3, 2, 41, 63, 29, -2, -2 }, { 0, -3, 1, 38, 64, 32, -1, -3 }
#endif
};
-#endif // CONFIG_DUAL_FILTER
+#endif // USE_EXTRA_FILTER
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
@@ -268,7 +312,7 @@ const InterpKernel *av1_intra_filter_kernels[INTRA_FILTERS] = {
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
-#if CONFIG_DUAL_FILTER
+#if USE_EXTRA_FILTER
static const InterpFilterParams
av1_interp_filter_params_list[SWITCHABLE_FILTERS + EXTRA_FILTERS] = {
{ (const int16_t *)sub_pel_filters_8, SUBPEL_TAPS, SUBPEL_SHIFTS,
@@ -309,7 +353,7 @@ static const InterpFilterParams
{ (const int16_t *)bilinear_filters, SUBPEL_TAPS, SUBPEL_SHIFTS,
BILINEAR }
};
-#endif // CONFIG_DUAL_FILTER
+#endif // USE_EXTRA_FILTER
#if USE_TEMPORALFILTER_12TAP
static const InterpFilterParams av1_interp_temporalfilter_12tap = {
@@ -340,11 +384,17 @@ const int16_t *av1_get_interp_filter_kernel(const InterpFilter interp_filter) {
InterpFilter av1_get_plane_interp_filter(InterpFilter interp_filter,
int plane) {
#if USE_TEMPORALFILTER_12TAP
+#if USE_EXTRA_FILTER
assert(interp_filter <= EIGHTTAP_SHARP ||
interp_filter == TEMPORALFILTER_12TAP);
+#else // USE_EXTRA_FILTER
+ assert(interp_filter <= SWITCHABLE_FILTERS ||
+ interp_filter == TEMPORALFILTER_12TAP);
+#endif // USE_EXTRA_FILTER
#else
assert(interp_filter <= EIGHTTAP_SHARP);
#endif
+#if USE_EXTRA_FILTER
if (plane == 0) {
return interp_filter;
} else {
@@ -356,5 +406,9 @@ InterpFilter av1_get_plane_interp_filter(InterpFilter interp_filter,
default: return interp_filter;
}
}
+#else // USE_EXTRA_FILTER
+ (void)plane;
+ return interp_filter;
+#endif // USE_EXTRA_FILTER
}
#endif
diff --git a/third_party/aom/av1/common/filter.h b/third_party/aom/av1/common/filter.h
index 693a46902..ea7e9cb0b 100644
--- a/third_party/aom/av1/common/filter.h
+++ b/third_party/aom/av1/common/filter.h
@@ -25,22 +25,23 @@ extern "C" {
#define MAX_FILTER_TAP 12
#define USE_12TAP_FILTER 0
+#define USE_EXTRA_FILTER 0
typedef enum {
EIGHTTAP_REGULAR,
EIGHTTAP_SMOOTH,
MULTITAP_SHARP,
-#if CONFIG_DUAL_FILTER
+#if USE_EXTRA_FILTER
EIGHTTAP_SMOOTH2,
-#endif // CONFIG_DUAL_FILTER
+#endif // USE_EXTRA_FILTER
BILINEAR,
-#if CONFIG_DUAL_FILTER
+#if USE_EXTRA_FILTER
EIGHTTAP_SHARP,
FILTER_REGULAR_UV,
FILTER_SMOOTH_UV,
FILTER_SHARP_UV,
FILTER_SMOOTH2_UV,
-#endif // CONFIG_DUAL_FILTER
+#endif // USE_EXTRA_FILTER
INTERP_FILTERS_ALL,
SWITCHABLE_FILTERS = BILINEAR,
SWITCHABLE = SWITCHABLE_FILTERS + 1, /* the last switchable one */
diff --git a/third_party/aom/av1/common/idct.c b/third_party/aom/av1/common/idct.c
index 0ea58bfe6..e94598e34 100644
--- a/third_party/aom/av1/common/idct.c
+++ b/third_party/aom/av1/common/idct.c
@@ -15,7 +15,7 @@
#include "./av1_rtcd.h"
#include "aom_dsp/inv_txfm.h"
#include "aom_ports/mem.h"
-#include "av1/common/av1_inv_txfm2d_cfg.h"
+#include "av1/common/av1_inv_txfm1d_cfg.h"
#include "av1/common/blockd.h"
#include "av1/common/enums.h"
#include "av1/common/idct.h"
@@ -85,8 +85,7 @@ static void idct64_col_c(const tran_low_t *input, tran_low_t *output) {
int32_t in[64], out[64];
int i;
for (i = 0; i < 64; ++i) in[i] = (int32_t)input[i];
- av1_idct64_new(in, out, inv_cos_bit_col_dct_dct_64,
- inv_stage_range_col_dct_dct_64);
+ av1_idct64_new(in, out, inv_cos_bit_col_dct_64, inv_stage_range_col_dct_64);
for (i = 0; i < 64; ++i) output[i] = (tran_low_t)out[i];
}
@@ -94,8 +93,7 @@ static void idct64_row_c(const tran_low_t *input, tran_low_t *output) {
int32_t in[64], out[64];
int i;
for (i = 0; i < 64; ++i) in[i] = (int32_t)input[i];
- av1_idct64_new(in, out, inv_cos_bit_row_dct_dct_64,
- inv_stage_range_row_dct_dct_64);
+ av1_idct64_new(in, out, inv_cos_bit_row_dct_64, inv_stage_range_row_dct_64);
for (i = 0; i < 64; ++i) output[i] = (tran_low_t)out[i];
}
@@ -116,100 +114,42 @@ static void ihalfright64_c(const tran_low_t *input, tran_low_t *output) {
#endif // CONFIG_TX64X64
#if CONFIG_HIGHBITDEPTH
-static void highbd_idct4(const tran_low_t *input, tran_low_t *output,
- const int8_t *cos_bit, const int8_t *stage_range,
- int bd) {
- (void)bd;
- av1_idct4_new(input, output, cos_bit, stage_range);
-}
-
-static void highbd_idct8(const tran_low_t *input, tran_low_t *output,
- const int8_t *cos_bit, const int8_t *stage_range,
- int bd) {
- (void)bd;
- av1_idct8_new(input, output, cos_bit, stage_range);
-}
-
-static void highbd_idct16(const tran_low_t *input, tran_low_t *output,
- const int8_t *cos_bit, const int8_t *stage_range,
- int bd) {
- (void)bd;
- av1_idct16_new(input, output, cos_bit, stage_range);
-}
-
-static void highbd_idct32(const tran_low_t *input, tran_low_t *output,
- const int8_t *cos_bit, const int8_t *stage_range,
- int bd) {
- (void)bd;
- av1_idct32_new(input, output, cos_bit, stage_range);
-}
-
-static void highbd_iadst4(const tran_low_t *input, tran_low_t *output,
- const int8_t *cos_bit, const int8_t *stage_range,
- int bd) {
- (void)bd;
- av1_iadst4_new(input, output, cos_bit, stage_range);
-}
-
-static void highbd_iadst8(const tran_low_t *input, tran_low_t *output,
- const int8_t *cos_bit, const int8_t *stage_range,
- int bd) {
- (void)bd;
- av1_iadst8_new(input, output, cos_bit, stage_range);
-}
-
-static void highbd_iadst16(const tran_low_t *input, tran_low_t *output,
- const int8_t *cos_bit, const int8_t *stage_range,
- int bd) {
- (void)bd;
- av1_iadst16_new(input, output, cos_bit, stage_range);
-}
-
#if CONFIG_EXT_TX
+// TODO(sarahparker) these functions will be removed once the highbitdepth
+// codepath works properly for rectangular transforms. They have almost
+// identical versions in av1_inv_txfm1d.c, but those are currently only
+// being used for square transforms.
static void highbd_iidtx4_c(const tran_low_t *input, tran_low_t *output,
- const int8_t *cos_bit, const int8_t *stage_range,
int bd) {
int i;
- (void)cos_bit;
- (void)stage_range;
for (i = 0; i < 4; ++i)
output[i] = HIGHBD_WRAPLOW(dct_const_round_shift(input[i] * Sqrt2), bd);
}
static void highbd_iidtx8_c(const tran_low_t *input, tran_low_t *output,
- const int8_t *cos_bit, const int8_t *stage_range,
int bd) {
int i;
(void)bd;
- (void)cos_bit;
- (void)stage_range;
for (i = 0; i < 8; ++i) output[i] = input[i] * 2;
}
static void highbd_iidtx16_c(const tran_low_t *input, tran_low_t *output,
- const int8_t *cos_bit, const int8_t *stage_range,
int bd) {
int i;
- (void)cos_bit;
- (void)stage_range;
for (i = 0; i < 16; ++i)
output[i] = HIGHBD_WRAPLOW(dct_const_round_shift(input[i] * 2 * Sqrt2), bd);
}
static void highbd_iidtx32_c(const tran_low_t *input, tran_low_t *output,
- const int8_t *cos_bit, const int8_t *stage_range,
int bd) {
int i;
(void)bd;
- (void)cos_bit;
- (void)stage_range;
for (i = 0; i < 32; ++i) output[i] = input[i] * 4;
}
#endif // CONFIG_EXT_TX
static void highbd_ihalfright32_c(const tran_low_t *input, tran_low_t *output,
- const int8_t *cos_bit,
- const int8_t *stage_range, int bd) {
+ int bd) {
int i;
tran_low_t inputhalf[16];
// Multiply input by sqrt(2)
@@ -219,17 +159,14 @@ static void highbd_ihalfright32_c(const tran_low_t *input, tran_low_t *output,
for (i = 0; i < 16; ++i) {
output[i] = input[16 + i] * 4;
}
- highbd_idct16(inputhalf, output + 16, cos_bit, stage_range, bd);
+ aom_highbd_idct16_c(inputhalf, output + 16, bd);
// Note overall scaling factor is 4 times orthogonal
}
#if CONFIG_EXT_TX
#if CONFIG_TX64X64
static void highbd_iidtx64_c(const tran_low_t *input, tran_low_t *output,
- const int8_t *cos_bit, const int8_t *stage_range,
int bd) {
- (void)cos_bit;
- (void)stage_range;
int i;
for (i = 0; i < 64; ++i)
output[i] = HIGHBD_WRAPLOW(dct_const_round_shift(input[i] * 4 * Sqrt2), bd);
@@ -240,8 +177,7 @@ static void highbd_iidtx64_c(const tran_low_t *input, tran_low_t *output,
#if CONFIG_TX64X64
// For use in lieu of ADST
static void highbd_ihalfright64_c(const tran_low_t *input, tran_low_t *output,
- const int8_t *cos_bit,
- const int8_t *stage_range, int bd) {
+ int bd) {
int i;
tran_low_t inputhalf[32];
// Multiply input by sqrt(2)
@@ -252,35 +188,27 @@ static void highbd_ihalfright64_c(const tran_low_t *input, tran_low_t *output,
output[i] =
HIGHBD_WRAPLOW(dct_const_round_shift(input[32 + i] * 4 * Sqrt2), bd);
}
- highbd_idct32(inputhalf, output + 32, cos_bit, stage_range, bd);
+ aom_highbd_idct32_c(inputhalf, output + 32, bd);
// Note overall scaling factor is 4 * sqrt(2) times orthogonal
}
static void highbd_idct64_col_c(const tran_low_t *input, tran_low_t *output,
- const int8_t *cos_bit,
- const int8_t *stage_range, int bd) {
+ int bd) {
int32_t in[64], out[64];
int i;
- (void)cos_bit;
- (void)stage_range;
(void)bd;
for (i = 0; i < 64; ++i) in[i] = (int32_t)input[i];
- av1_idct64_new(in, out, inv_cos_bit_col_dct_dct_64,
- inv_stage_range_col_dct_dct_64);
+ av1_idct64_new(in, out, inv_cos_bit_col_dct_64, inv_stage_range_col_dct_64);
for (i = 0; i < 64; ++i) output[i] = (tran_low_t)out[i];
}
static void highbd_idct64_row_c(const tran_low_t *input, tran_low_t *output,
- const int8_t *cos_bit,
- const int8_t *stage_range, int bd) {
+ int bd) {
int32_t in[64], out[64];
int i;
- (void)cos_bit;
- (void)stage_range;
(void)bd;
for (i = 0; i < 64; ++i) in[i] = (int32_t)input[i];
- av1_idct64_new(in, out, inv_cos_bit_row_dct_dct_64,
- inv_stage_range_row_dct_dct_64);
+ av1_idct64_new(in, out, inv_cos_bit_row_dct_64, inv_stage_range_row_dct_64);
for (i = 0; i < 64; ++i) output[i] = (tran_low_t)out[i];
}
#endif // CONFIG_TX64X64
@@ -431,7 +359,7 @@ void av1_iht4x4_16_add_c(const tran_low_t *input, uint8_t *dest, int stride,
};
int i, j;
- tran_low_t tmp;
+ tran_low_t tmp[4][4];
tran_low_t out[4][4];
tran_low_t *outp = &out[0][0];
int outstride = 4;
@@ -443,17 +371,15 @@ void av1_iht4x4_16_add_c(const tran_low_t *input, uint8_t *dest, int stride,
}
// transpose
- for (i = 1; i < 4; i++) {
- for (j = 0; j < i; j++) {
- tmp = out[i][j];
- out[i][j] = out[j][i];
- out[j][i] = tmp;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 4; j++) {
+ tmp[j][i] = out[i][j];
}
}
// inverse transform column vectors
for (i = 0; i < 4; ++i) {
- IHT_4[tx_type].cols(out[i], out[i]);
+ IHT_4[tx_type].cols(tmp[i], out[i]);
}
#if CONFIG_EXT_TX
@@ -496,7 +422,7 @@ void av1_iht4x8_32_add_c(const tran_low_t *input, uint8_t *dest, int stride,
const int n = 4;
const int n2 = 8;
int i, j;
- tran_low_t out[4][8], outtmp[4];
+ tran_low_t out[4][8], tmp[4][8], outtmp[4];
tran_low_t *outp = &out[0][0];
int outstride = n2;
@@ -504,13 +430,13 @@ void av1_iht4x8_32_add_c(const tran_low_t *input, uint8_t *dest, int stride,
for (i = 0; i < n2; ++i) {
IHT_4x8[tx_type].rows(input, outtmp);
for (j = 0; j < n; ++j)
- out[j][i] = (tran_low_t)dct_const_round_shift(outtmp[j] * Sqrt2);
+ tmp[j][i] = (tran_low_t)dct_const_round_shift(outtmp[j] * Sqrt2);
input += n;
}
// inverse transform column vectors
for (i = 0; i < n; ++i) {
- IHT_4x8[tx_type].cols(out[i], out[i]);
+ IHT_4x8[tx_type].cols(tmp[i], out[i]);
}
#if CONFIG_EXT_TX
@@ -553,7 +479,7 @@ void av1_iht8x4_32_add_c(const tran_low_t *input, uint8_t *dest, int stride,
const int n2 = 8;
int i, j;
- tran_low_t out[8][4], outtmp[8];
+ tran_low_t out[8][4], tmp[8][4], outtmp[8];
tran_low_t *outp = &out[0][0];
int outstride = n;
@@ -561,13 +487,13 @@ void av1_iht8x4_32_add_c(const tran_low_t *input, uint8_t *dest, int stride,
for (i = 0; i < n; ++i) {
IHT_8x4[tx_type].rows(input, outtmp);
for (j = 0; j < n2; ++j)
- out[j][i] = (tran_low_t)dct_const_round_shift(outtmp[j] * Sqrt2);
+ tmp[j][i] = (tran_low_t)dct_const_round_shift(outtmp[j] * Sqrt2);
input += n2;
}
// inverse transform column vectors
for (i = 0; i < n2; ++i) {
- IHT_8x4[tx_type].cols(out[i], out[i]);
+ IHT_8x4[tx_type].cols(tmp[i], out[i]);
}
#if CONFIG_EXT_TX
@@ -610,19 +536,19 @@ void av1_iht4x16_64_add_c(const tran_low_t *input, uint8_t *dest, int stride,
const int n = 4;
const int n4 = 16;
int i, j;
- tran_low_t out[4][16], outtmp[4];
+ tran_low_t out[4][16], tmp[4][16], outtmp[4];
tran_low_t *outp = &out[0][0];
int outstride = n4;
// inverse transform row vectors and transpose
for (i = 0; i < n4; ++i) {
IHT_4x16[tx_type].rows(input, outtmp);
- for (j = 0; j < n; ++j) out[j][i] = outtmp[j];
+ for (j = 0; j < n; ++j) tmp[j][i] = outtmp[j];
input += n;
}
// inverse transform column vectors
- for (i = 0; i < n; ++i) IHT_4x16[tx_type].cols(out[i], out[i]);
+ for (i = 0; i < n; ++i) IHT_4x16[tx_type].cols(tmp[i], out[i]);
#if CONFIG_EXT_TX
maybe_flip_strides(&dest, &stride, &outp, &outstride, tx_type, n4, n);
@@ -664,19 +590,19 @@ void av1_iht16x4_64_add_c(const tran_low_t *input, uint8_t *dest, int stride,
const int n4 = 16;
int i, j;
- tran_low_t out[16][4], outtmp[16];
+ tran_low_t out[16][4], tmp[16][4], outtmp[16];
tran_low_t *outp = &out[0][0];
int outstride = n;
// inverse transform row vectors and transpose
for (i = 0; i < n; ++i) {
IHT_16x4[tx_type].rows(input, outtmp);
- for (j = 0; j < n4; ++j) out[j][i] = outtmp[j];
+ for (j = 0; j < n4; ++j) tmp[j][i] = outtmp[j];
input += n4;
}
// inverse transform column vectors
- for (i = 0; i < n4; ++i) IHT_16x4[tx_type].cols(out[i], out[i]);
+ for (i = 0; i < n4; ++i) IHT_16x4[tx_type].cols(tmp[i], out[i]);
#if CONFIG_EXT_TX
maybe_flip_strides(&dest, &stride, &outp, &outstride, tx_type, n, n4);
@@ -718,7 +644,7 @@ void av1_iht8x16_128_add_c(const tran_low_t *input, uint8_t *dest, int stride,
const int n = 8;
const int n2 = 16;
int i, j;
- tran_low_t out[8][16], outtmp[8];
+ tran_low_t out[8][16], tmp[8][16], outtmp[8];
tran_low_t *outp = &out[0][0];
int outstride = n2;
@@ -726,13 +652,13 @@ void av1_iht8x16_128_add_c(const tran_low_t *input, uint8_t *dest, int stride,
for (i = 0; i < n2; ++i) {
IHT_8x16[tx_type].rows(input, outtmp);
for (j = 0; j < n; ++j)
- out[j][i] = (tran_low_t)dct_const_round_shift(outtmp[j] * Sqrt2);
+ tmp[j][i] = (tran_low_t)dct_const_round_shift(outtmp[j] * Sqrt2);
input += n;
}
// inverse transform column vectors
for (i = 0; i < n; ++i) {
- IHT_8x16[tx_type].cols(out[i], out[i]);
+ IHT_8x16[tx_type].cols(tmp[i], out[i]);
}
#if CONFIG_EXT_TX
@@ -775,7 +701,7 @@ void av1_iht16x8_128_add_c(const tran_low_t *input, uint8_t *dest, int stride,
const int n2 = 16;
int i, j;
- tran_low_t out[16][8], outtmp[16];
+ tran_low_t out[16][8], tmp[16][8], outtmp[16];
tran_low_t *outp = &out[0][0];
int outstride = n;
@@ -783,13 +709,13 @@ void av1_iht16x8_128_add_c(const tran_low_t *input, uint8_t *dest, int stride,
for (i = 0; i < n; ++i) {
IHT_16x8[tx_type].rows(input, outtmp);
for (j = 0; j < n2; ++j)
- out[j][i] = (tran_low_t)dct_const_round_shift(outtmp[j] * Sqrt2);
+ tmp[j][i] = (tran_low_t)dct_const_round_shift(outtmp[j] * Sqrt2);
input += n2;
}
// inverse transform column vectors
for (i = 0; i < n2; ++i) {
- IHT_16x8[tx_type].cols(out[i], out[i]);
+ IHT_16x8[tx_type].cols(tmp[i], out[i]);
}
#if CONFIG_EXT_TX
@@ -832,19 +758,19 @@ void av1_iht8x32_256_add_c(const tran_low_t *input, uint8_t *dest, int stride,
const int n = 8;
const int n4 = 32;
int i, j;
- tran_low_t out[8][32], outtmp[8];
+ tran_low_t out[8][32], tmp[8][32], outtmp[8];
tran_low_t *outp = &out[0][0];
int outstride = n4;
// inverse transform row vectors and transpose
for (i = 0; i < n4; ++i) {
IHT_8x32[tx_type].rows(input, outtmp);
- for (j = 0; j < n; ++j) out[j][i] = outtmp[j];
+ for (j = 0; j < n; ++j) tmp[j][i] = outtmp[j];
input += n;
}
// inverse transform column vectors
- for (i = 0; i < n; ++i) IHT_8x32[tx_type].cols(out[i], out[i]);
+ for (i = 0; i < n; ++i) IHT_8x32[tx_type].cols(tmp[i], out[i]);
#if CONFIG_EXT_TX
maybe_flip_strides(&dest, &stride, &outp, &outstride, tx_type, n4, n);
@@ -886,19 +812,19 @@ void av1_iht32x8_256_add_c(const tran_low_t *input, uint8_t *dest, int stride,
const int n4 = 32;
int i, j;
- tran_low_t out[32][8], outtmp[32];
+ tran_low_t out[32][8], tmp[32][8], outtmp[32];
tran_low_t *outp = &out[0][0];
int outstride = n;
// inverse transform row vectors and transpose
for (i = 0; i < n; ++i) {
IHT_32x8[tx_type].rows(input, outtmp);
- for (j = 0; j < n4; ++j) out[j][i] = outtmp[j];
+ for (j = 0; j < n4; ++j) tmp[j][i] = outtmp[j];
input += n4;
}
// inverse transform column vectors
- for (i = 0; i < n4; ++i) IHT_32x8[tx_type].cols(out[i], out[i]);
+ for (i = 0; i < n4; ++i) IHT_32x8[tx_type].cols(tmp[i], out[i]);
#if CONFIG_EXT_TX
maybe_flip_strides(&dest, &stride, &outp, &outstride, tx_type, n, n4);
@@ -940,7 +866,7 @@ void av1_iht16x32_512_add_c(const tran_low_t *input, uint8_t *dest, int stride,
const int n = 16;
const int n2 = 32;
int i, j;
- tran_low_t out[16][32], outtmp[16];
+ tran_low_t out[16][32], tmp[16][32], outtmp[16];
tran_low_t *outp = &out[0][0];
int outstride = n2;
@@ -948,13 +874,13 @@ void av1_iht16x32_512_add_c(const tran_low_t *input, uint8_t *dest, int stride,
for (i = 0; i < n2; ++i) {
IHT_16x32[tx_type].rows(input, outtmp);
for (j = 0; j < n; ++j)
- out[j][i] = (tran_low_t)dct_const_round_shift(outtmp[j] * Sqrt2);
+ tmp[j][i] = (tran_low_t)dct_const_round_shift(outtmp[j] * Sqrt2);
input += n;
}
// inverse transform column vectors
for (i = 0; i < n; ++i) {
- IHT_16x32[tx_type].cols(out[i], out[i]);
+ IHT_16x32[tx_type].cols(tmp[i], out[i]);
}
#if CONFIG_EXT_TX
@@ -997,7 +923,7 @@ void av1_iht32x16_512_add_c(const tran_low_t *input, uint8_t *dest, int stride,
const int n2 = 32;
int i, j;
- tran_low_t out[32][16], outtmp[32];
+ tran_low_t out[32][16], tmp[32][16], outtmp[32];
tran_low_t *outp = &out[0][0];
int outstride = n;
@@ -1005,13 +931,13 @@ void av1_iht32x16_512_add_c(const tran_low_t *input, uint8_t *dest, int stride,
for (i = 0; i < n; ++i) {
IHT_32x16[tx_type].rows(input, outtmp);
for (j = 0; j < n2; ++j)
- out[j][i] = (tran_low_t)dct_const_round_shift(outtmp[j] * Sqrt2);
+ tmp[j][i] = (tran_low_t)dct_const_round_shift(outtmp[j] * Sqrt2);
input += n2;
}
// inverse transform column vectors
for (i = 0; i < n2; ++i) {
- IHT_32x16[tx_type].cols(out[i], out[i]);
+ IHT_32x16[tx_type].cols(tmp[i], out[i]);
}
#if CONFIG_EXT_TX
@@ -1052,7 +978,7 @@ void av1_iht8x8_64_add_c(const tran_low_t *input, uint8_t *dest, int stride,
};
int i, j;
- tran_low_t tmp;
+ tran_low_t tmp[8][8];
tran_low_t out[8][8];
tran_low_t *outp = &out[0][0];
int outstride = 8;
@@ -1064,17 +990,15 @@ void av1_iht8x8_64_add_c(const tran_low_t *input, uint8_t *dest, int stride,
}
// transpose
- for (i = 1; i < 8; i++) {
- for (j = 0; j < i; j++) {
- tmp = out[i][j];
- out[i][j] = out[j][i];
- out[j][i] = tmp;
+ for (i = 0; i < 8; i++) {
+ for (j = 0; j < 8; j++) {
+ tmp[j][i] = out[i][j];
}
}
// inverse transform column vectors
for (i = 0; i < 8; ++i) {
- IHT_8[tx_type].cols(out[i], out[i]);
+ IHT_8[tx_type].cols(tmp[i], out[i]);
}
#if CONFIG_EXT_TX
@@ -1115,7 +1039,7 @@ void av1_iht16x16_256_add_c(const tran_low_t *input, uint8_t *dest, int stride,
};
int i, j;
- tran_low_t tmp;
+ tran_low_t tmp[16][16];
tran_low_t out[16][16];
tran_low_t *outp = &out[0][0];
int outstride = 16;
@@ -1127,17 +1051,15 @@ void av1_iht16x16_256_add_c(const tran_low_t *input, uint8_t *dest, int stride,
}
// transpose
- for (i = 1; i < 16; i++) {
- for (j = 0; j < i; j++) {
- tmp = out[i][j];
- out[i][j] = out[j][i];
- out[j][i] = tmp;
+ for (i = 0; i < 16; i++) {
+ for (j = 0; j < 16; j++) {
+ tmp[j][i] = out[i][j];
}
}
// inverse transform column vectors
for (i = 0; i < 16; ++i) {
- IHT_16[tx_type].cols(out[i], out[i]);
+ IHT_16[tx_type].cols(tmp[i], out[i]);
}
#if CONFIG_EXT_TX
@@ -1177,7 +1099,7 @@ void av1_iht32x32_1024_add_c(const tran_low_t *input, uint8_t *dest, int stride,
};
int i, j;
- tran_low_t tmp;
+ tran_low_t tmp[32][32];
tran_low_t out[32][32];
tran_low_t *outp = &out[0][0];
int outstride = 32;
@@ -1189,17 +1111,15 @@ void av1_iht32x32_1024_add_c(const tran_low_t *input, uint8_t *dest, int stride,
}
// transpose
- for (i = 1; i < 32; i++) {
- for (j = 0; j < i; j++) {
- tmp = out[i][j];
- out[i][j] = out[j][i];
- out[j][i] = tmp;
+ for (i = 0; i < 32; i++) {
+ for (j = 0; j < 32; j++) {
+ tmp[j][i] = out[i][j];
}
}
// inverse transform column vectors
for (i = 0; i < 32; ++i) {
- IHT_32[tx_type].cols(out[i], out[i]);
+ IHT_32[tx_type].cols(tmp[i], out[i]);
}
maybe_flip_strides(&dest, &stride, &outp, &outstride, tx_type, 32, 32);
@@ -1240,7 +1160,7 @@ void av1_iht64x64_4096_add_c(const tran_low_t *input, uint8_t *dest, int stride,
};
int i, j;
- tran_low_t tmp;
+ tran_low_t tmp[64][64];
tran_low_t out[64][64];
tran_low_t *outp = &out[0][0];
int outstride = 64;
@@ -1253,17 +1173,15 @@ void av1_iht64x64_4096_add_c(const tran_low_t *input, uint8_t *dest, int stride,
}
// transpose
- for (i = 1; i < 64; i++) {
- for (j = 0; j < i; j++) {
- tmp = out[i][j];
- out[i][j] = out[j][i];
- out[j][i] = tmp;
+ for (i = 0; i < 64; i++) {
+ for (j = 0; j < 64; j++) {
+ tmp[j][i] = out[i][j];
}
}
// inverse transform column vectors
for (i = 0; i < 64; ++i) {
- IHT_64[tx_type].cols(out[i], out[i]);
+ IHT_64[tx_type].cols(tmp[i], out[i]);
}
#if CONFIG_EXT_TX
@@ -1299,60 +1217,85 @@ void av1_iwht4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
}
static void idct8x8_add(const tran_low_t *input, uint8_t *dest, int stride,
- int eob) {
- // If dc is 1, then input[0] is the reconstructed value, do not need
- // dequantization. Also, when dc is 1, dc is counted in eobs, namely eobs >=1.
-
- // The calculation can be simplified if there are not many non-zero dct
- // coefficients. Use eobs to decide what to do.
- // TODO(yunqingwang): "eobs = 1" case is also handled in av1_short_idct8x8_c.
- // Combine that with code here.
+ const INV_TXFM_PARAM *param) {
+// If dc is 1, then input[0] is the reconstructed value, do not need
+// dequantization. Also, when dc is 1, dc is counted in eobs, namely eobs >=1.
+
+// The calculation can be simplified if there are not many non-zero dct
+// coefficients. Use eobs to decide what to do.
+// TODO(yunqingwang): "eobs = 1" case is also handled in av1_short_idct8x8_c.
+// Combine that with code here.
+#if CONFIG_ADAPT_SCAN
+ const int16_t half = param->eob_threshold[0];
+#else
+ const int16_t half = 12;
+#endif
+
+ const int eob = param->eob;
if (eob == 1)
// DC only DCT coefficient
aom_idct8x8_1_add(input, dest, stride);
-#if !CONFIG_ADAPT_SCAN
- else if (eob <= 12)
+ else if (eob <= half)
aom_idct8x8_12_add(input, dest, stride);
-#endif
else
aom_idct8x8_64_add(input, dest, stride);
}
static void idct16x16_add(const tran_low_t *input, uint8_t *dest, int stride,
- int eob) {
- /* The calculation can be simplified if there are not many non-zero dct
- * coefficients. Use eobs to separate different cases. */
+ const INV_TXFM_PARAM *param) {
+// The calculation can be simplified if there are not many non-zero dct
+// coefficients. Use eobs to separate different cases.
+#if CONFIG_ADAPT_SCAN
+ const int16_t half = param->eob_threshold[0];
+ const int16_t quarter = param->eob_threshold[1];
+#else
+ const int16_t half = 38;
+ const int16_t quarter = 10;
+#endif
+
+ const int eob = param->eob;
if (eob == 1) /* DC only DCT coefficient. */
aom_idct16x16_1_add(input, dest, stride);
-#if !CONFIG_ADAPT_SCAN
- else if (eob <= 10)
+ else if (eob <= quarter)
aom_idct16x16_10_add(input, dest, stride);
-#endif
+ else if (eob <= half)
+ aom_idct16x16_38_add(input, dest, stride);
else
aom_idct16x16_256_add(input, dest, stride);
}
static void idct32x32_add(const tran_low_t *input, uint8_t *dest, int stride,
- int eob) {
- if (eob == 1) aom_idct32x32_1_add(input, dest, stride);
-#if !CONFIG_ADAPT_SCAN
- else if (eob <= 34)
+ const INV_TXFM_PARAM *param) {
+#if CONFIG_ADAPT_SCAN
+ const int16_t half = param->eob_threshold[0];
+ const int16_t quarter = param->eob_threshold[1];
+#else
+ const int16_t half = 135;
+ const int16_t quarter = 34;
+#endif
+
+ const int eob = param->eob;
+ if (eob == 1)
+ aom_idct32x32_1_add(input, dest, stride);
+ else if (eob <= quarter)
// non-zero coeff only in upper-left 8x8
aom_idct32x32_34_add(input, dest, stride);
-#endif
+ else if (eob <= half)
+ // non-zero coeff only in upper-left 16x16
+ aom_idct32x32_135_add(input, dest, stride);
else
aom_idct32x32_1024_add(input, dest, stride);
}
#if CONFIG_TX64X64
static void idct64x64_add(const tran_low_t *input, uint8_t *dest, int stride,
- int eob) {
- (void)eob;
+ const INV_TXFM_PARAM *param) {
+ (void)param;
av1_iht64x64_4096_add(input, dest, stride, DCT_DCT);
}
#endif // CONFIG_TX64X64
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
static void inv_txfm_add_2x2(const tran_low_t *input, uint8_t *dest, int stride,
int eob, TX_TYPE tx_type, int lossless) {
tran_high_t a1 = input[0] >> UNIT_QUANT_SHIFT;
@@ -1381,8 +1324,8 @@ static void inv_txfm_add_2x2(const tran_low_t *input, uint8_t *dest, int stride,
}
#endif
-void av1_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest, int stride,
- int eob, TX_TYPE tx_type, int lossless) {
+static void inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest, int stride,
+ int eob, TX_TYPE tx_type, int lossless) {
if (lossless) {
assert(tx_type == DCT_DCT);
av1_iwht4x4_add(input, dest, stride, eob);
@@ -1415,20 +1358,20 @@ void av1_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest, int stride,
}
}
-void av1_inv_txfm_add_4x8(const tran_low_t *input, uint8_t *dest, int stride,
- int eob, TX_TYPE tx_type) {
+static void inv_txfm_add_4x8(const tran_low_t *input, uint8_t *dest, int stride,
+ int eob, TX_TYPE tx_type) {
(void)eob;
av1_iht4x8_32_add(input, dest, stride, tx_type);
}
-void av1_inv_txfm_add_8x4(const tran_low_t *input, uint8_t *dest, int stride,
- int eob, TX_TYPE tx_type) {
+static void inv_txfm_add_8x4(const tran_low_t *input, uint8_t *dest, int stride,
+ int eob, TX_TYPE tx_type) {
(void)eob;
av1_iht8x4_32_add(input, dest, stride, tx_type);
}
// These will be used by the masked-tx experiment in the future.
-#if CONFIG_MASKED_TX && 0
+#if CONFIG_RECT_TX && CONFIG_EXT_TX && CONFIG_RECT_TX_EXT
static void inv_txfm_add_4x16(const tran_low_t *input, uint8_t *dest,
int stride, int eob, TX_TYPE tx_type) {
(void)eob;
@@ -1452,7 +1395,7 @@ static void inv_txfm_add_32x8(const tran_low_t *input, uint8_t *dest,
(void)eob;
av1_iht32x8_256_add(input, dest, stride, tx_type);
}
-#endif // CONFIG_MASKED_TX
+#endif
static void inv_txfm_add_8x16(const tran_low_t *input, uint8_t *dest,
int stride, int eob, TX_TYPE tx_type) {
@@ -1479,9 +1422,10 @@ static void inv_txfm_add_32x16(const tran_low_t *input, uint8_t *dest,
}
static void inv_txfm_add_8x8(const tran_low_t *input, uint8_t *dest, int stride,
- int eob, TX_TYPE tx_type) {
+ const INV_TXFM_PARAM *param) {
+ const TX_TYPE tx_type = param->tx_type;
switch (tx_type) {
- case DCT_DCT: idct8x8_add(input, dest, stride, eob); break;
+ case DCT_DCT: idct8x8_add(input, dest, stride, param); break;
case ADST_DCT:
case DCT_ADST:
case ADST_ADST: av1_iht8x8_64_add(input, dest, stride, tx_type); break;
@@ -1507,9 +1451,10 @@ static void inv_txfm_add_8x8(const tran_low_t *input, uint8_t *dest, int stride,
}
static void inv_txfm_add_16x16(const tran_low_t *input, uint8_t *dest,
- int stride, int eob, TX_TYPE tx_type) {
+ int stride, const INV_TXFM_PARAM *param) {
+ const TX_TYPE tx_type = param->tx_type;
switch (tx_type) {
- case DCT_DCT: idct16x16_add(input, dest, stride, eob); break;
+ case DCT_DCT: idct16x16_add(input, dest, stride, param); break;
case ADST_DCT:
case DCT_ADST:
case ADST_ADST: av1_iht16x16_256_add(input, dest, stride, tx_type); break;
@@ -1532,9 +1477,10 @@ static void inv_txfm_add_16x16(const tran_low_t *input, uint8_t *dest,
}
static void inv_txfm_add_32x32(const tran_low_t *input, uint8_t *dest,
- int stride, int eob, TX_TYPE tx_type) {
+ int stride, const INV_TXFM_PARAM *param) {
+ const TX_TYPE tx_type = param->tx_type;
switch (tx_type) {
- case DCT_DCT: idct32x32_add(input, dest, stride, eob); break;
+ case DCT_DCT: idct32x32_add(input, dest, stride, param); break;
#if CONFIG_EXT_TX
case ADST_DCT:
case DCT_ADST:
@@ -1560,9 +1506,10 @@ static void inv_txfm_add_32x32(const tran_low_t *input, uint8_t *dest,
#if CONFIG_TX64X64
static void inv_txfm_add_64x64(const tran_low_t *input, uint8_t *dest,
- int stride, int eob, TX_TYPE tx_type) {
+ int stride, const INV_TXFM_PARAM *param) {
+ const TX_TYPE tx_type = param->tx_type;
switch (tx_type) {
- case DCT_DCT: idct64x64_add(input, dest, stride, eob); break;
+ case DCT_DCT: idct64x64_add(input, dest, stride, param); break;
#if CONFIG_EXT_TX
case ADST_DCT:
case DCT_ADST:
@@ -1588,87 +1535,53 @@ static void inv_txfm_add_64x64(const tran_low_t *input, uint8_t *dest,
#endif // CONFIG_TX64X64
#if CONFIG_HIGHBITDEPTH
-
-const TXFM_2D_CFG *inv_txfm_cfg_ls[TX_TYPES][TX_SIZES];
-
-typedef struct {
- const int8_t *cos_bit;
- const int8_t *stage_range;
-} tx_1d_cfg;
-
-typedef struct {
- tx_1d_cfg row;
- tx_1d_cfg col;
-} tx_2d_cfg;
-
-tx_2d_cfg inv_tx_cfg(int tx_type, int tx_size_row, int tx_size_col) {
- const TXFM_2D_CFG *cfg_row = inv_txfm_cfg_ls[tx_type][tx_size_row];
- const int8_t *stage_range_row = cfg_row->stage_range_row;
- const int8_t *cos_bit_row = cfg_row->cos_bit_row;
-
- const TXFM_2D_CFG *cfg_col = inv_txfm_cfg_ls[tx_type][tx_size_col];
- const int8_t *stage_range_col = cfg_col->stage_range_col;
- const int8_t *cos_bit_col = cfg_col->cos_bit_col;
-
- tx_2d_cfg cfg = {
- { cos_bit_row, stage_range_row }, { cos_bit_col, stage_range_col },
- };
- return cfg;
-}
-
void av1_highbd_iht4x4_16_add_c(const tran_low_t *input, uint8_t *dest8,
int stride, int tx_type, int bd) {
static const highbd_transform_2d HIGH_IHT_4[] = {
- { highbd_idct4, highbd_idct4 }, // DCT_DCT
- { highbd_iadst4, highbd_idct4 }, // ADST_DCT
- { highbd_idct4, highbd_iadst4 }, // DCT_ADST
- { highbd_iadst4, highbd_iadst4 }, // ADST_ADST
-#if CONFIG_EXT_TX
- { highbd_iadst4, highbd_idct4 }, // FLIPADST_DCT
- { highbd_idct4, highbd_iadst4 }, // DCT_FLIPADST
- { highbd_iadst4, highbd_iadst4 }, // FLIPADST_FLIPADST
- { highbd_iadst4, highbd_iadst4 }, // ADST_FLIPADST
- { highbd_iadst4, highbd_iadst4 }, // FLIPADST_ADST
- { highbd_iidtx4_c, highbd_iidtx4_c }, // IDTX
- { highbd_idct4, highbd_iidtx4_c }, // V_DCT
- { highbd_iidtx4_c, highbd_idct4 }, // H_DCT
- { highbd_iadst4, highbd_iidtx4_c }, // V_ADST
- { highbd_iidtx4_c, highbd_iadst4 }, // H_ADST
- { highbd_iadst4, highbd_iidtx4_c }, // V_FLIPADST
- { highbd_iidtx4_c, highbd_iadst4 }, // H_FLIPADST
-#endif // CONFIG_EXT_TX
+ { aom_highbd_idct4_c, aom_highbd_idct4_c }, // DCT_DCT
+ { aom_highbd_iadst4_c, aom_highbd_idct4_c }, // ADST_DCT
+ { aom_highbd_idct4_c, aom_highbd_iadst4_c }, // DCT_ADST
+ { aom_highbd_iadst4_c, aom_highbd_iadst4_c }, // ADST_ADST
+#if CONFIG_EXT_TX
+ { aom_highbd_iadst4_c, aom_highbd_idct4_c }, // FLIPADST_DCT
+ { aom_highbd_idct4_c, aom_highbd_iadst4_c }, // DCT_FLIPADST
+ { aom_highbd_iadst4_c, aom_highbd_iadst4_c }, // FLIPADST_FLIPADST
+ { aom_highbd_iadst4_c, aom_highbd_iadst4_c }, // ADST_FLIPADST
+ { aom_highbd_iadst4_c, aom_highbd_iadst4_c }, // FLIPADST_ADST
+ { highbd_iidtx4_c, highbd_iidtx4_c }, // IDTX
+ { aom_highbd_idct4_c, highbd_iidtx4_c }, // V_DCT
+ { highbd_iidtx4_c, aom_highbd_idct4_c }, // H_DCT
+ { aom_highbd_iadst4_c, highbd_iidtx4_c }, // V_ADST
+ { highbd_iidtx4_c, aom_highbd_iadst4_c }, // H_ADST
+ { aom_highbd_iadst4_c, highbd_iidtx4_c }, // V_FLIPADST
+ { highbd_iidtx4_c, aom_highbd_iadst4_c }, // H_FLIPADST
+#endif // CONFIG_EXT_TX
};
uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
int i, j;
- tran_low_t tmp;
+ tran_low_t tmp[4][4];
tran_low_t out[4][4];
tran_low_t *outp = &out[0][0];
int outstride = 4;
- tx_2d_cfg cfg = inv_tx_cfg(tx_type, TX_4X4, TX_4X4);
-
// inverse transform row vectors
for (i = 0; i < 4; ++i) {
- HIGH_IHT_4[tx_type].rows(input, out[i], cfg.row.cos_bit,
- cfg.row.stage_range, bd);
+ HIGH_IHT_4[tx_type].rows(input, out[i], bd);
input += 4;
}
// transpose
- for (i = 1; i < 4; i++) {
- for (j = 0; j < i; j++) {
- tmp = out[i][j];
- out[i][j] = out[j][i];
- out[j][i] = tmp;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 4; j++) {
+ tmp[j][i] = out[i][j];
}
}
// inverse transform column vectors
for (i = 0; i < 4; ++i) {
- HIGH_IHT_4[tx_type].cols(out[i], out[i], cfg.col.cos_bit,
- cfg.col.stage_range, bd);
+ HIGH_IHT_4[tx_type].cols(tmp[i], out[i], bd);
}
#if CONFIG_EXT_TX
@@ -1689,24 +1602,24 @@ void av1_highbd_iht4x4_16_add_c(const tran_low_t *input, uint8_t *dest8,
void av1_highbd_iht4x8_32_add_c(const tran_low_t *input, uint8_t *dest8,
int stride, int tx_type, int bd) {
static const highbd_transform_2d HIGH_IHT_4x8[] = {
- { highbd_idct8, highbd_idct4 }, // DCT_DCT
- { highbd_iadst8, highbd_idct4 }, // ADST_DCT
- { highbd_idct8, highbd_iadst4 }, // DCT_ADST
- { highbd_iadst8, highbd_iadst4 }, // ADST_ADST
-#if CONFIG_EXT_TX
- { highbd_iadst8, highbd_idct4 }, // FLIPADST_DCT
- { highbd_idct8, highbd_iadst4 }, // DCT_FLIPADST
- { highbd_iadst8, highbd_iadst4 }, // FLIPADST_FLIPADST
- { highbd_iadst8, highbd_iadst4 }, // ADST_FLIPADST
- { highbd_iadst8, highbd_iadst4 }, // FLIPADST_ADST
- { highbd_iidtx8_c, highbd_iidtx4_c }, // IDTX
- { highbd_idct8, highbd_iidtx4_c }, // V_DCT
- { highbd_iidtx8_c, highbd_idct4 }, // H_DCT
- { highbd_iadst8, highbd_iidtx4_c }, // V_ADST
- { highbd_iidtx8_c, highbd_iadst4 }, // H_ADST
- { highbd_iadst8, highbd_iidtx4_c }, // V_FLIPADST
- { highbd_iidtx8_c, highbd_iadst4 }, // H_FLIPADST
-#endif // CONFIG_EXT_TX
+ { aom_highbd_idct8_c, aom_highbd_idct4_c }, // DCT_DCT
+ { aom_highbd_iadst8_c, aom_highbd_idct4_c }, // ADST_DCT
+ { aom_highbd_idct8_c, aom_highbd_iadst4_c }, // DCT_ADST
+ { aom_highbd_iadst8_c, aom_highbd_iadst4_c }, // ADST_ADST
+#if CONFIG_EXT_TX
+ { aom_highbd_iadst8_c, aom_highbd_idct4_c }, // FLIPADST_DCT
+ { aom_highbd_idct8_c, aom_highbd_iadst4_c }, // DCT_FLIPADST
+ { aom_highbd_iadst8_c, aom_highbd_iadst4_c }, // FLIPADST_FLIPADST
+ { aom_highbd_iadst8_c, aom_highbd_iadst4_c }, // ADST_FLIPADST
+ { aom_highbd_iadst8_c, aom_highbd_iadst4_c }, // FLIPADST_ADST
+ { highbd_iidtx8_c, highbd_iidtx4_c }, // IDTX
+ { aom_highbd_idct8_c, highbd_iidtx4_c }, // V_DCT
+ { highbd_iidtx8_c, aom_highbd_idct4_c }, // H_DCT
+ { aom_highbd_iadst8_c, highbd_iidtx4_c }, // V_ADST
+ { highbd_iidtx8_c, aom_highbd_iadst4_c }, // H_ADST
+ { aom_highbd_iadst8_c, highbd_iidtx4_c }, // V_FLIPADST
+ { highbd_iidtx8_c, aom_highbd_iadst4_c }, // H_FLIPADST
+#endif // CONFIG_EXT_TX
};
const int n = 4;
const int n2 = 8;
@@ -1714,26 +1627,22 @@ void av1_highbd_iht4x8_32_add_c(const tran_low_t *input, uint8_t *dest8,
uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
int i, j;
- tran_low_t out[4][8], outtmp[4];
+ tran_low_t out[4][8], tmp[4][8], outtmp[4];
tran_low_t *outp = &out[0][0];
int outstride = n2;
- tx_2d_cfg cfg = inv_tx_cfg(tx_type, TX_4X4, TX_8X8);
-
// inverse transform row vectors, and transpose
for (i = 0; i < n2; ++i) {
- HIGH_IHT_4x8[tx_type].rows(input, outtmp, cfg.row.cos_bit,
- cfg.row.stage_range, bd);
+ HIGH_IHT_4x8[tx_type].rows(input, outtmp, bd);
for (j = 0; j < n; ++j) {
- out[j][i] = HIGHBD_WRAPLOW(dct_const_round_shift(outtmp[j] * Sqrt2), bd);
+ tmp[j][i] = HIGHBD_WRAPLOW(dct_const_round_shift(outtmp[j] * Sqrt2), bd);
}
input += n;
}
// inverse transform column vectors
for (i = 0; i < n; ++i) {
- HIGH_IHT_4x8[tx_type].cols(out[i], out[i], cfg.col.cos_bit,
- cfg.col.stage_range, bd);
+ HIGH_IHT_4x8[tx_type].cols(tmp[i], out[i], bd);
}
#if CONFIG_EXT_TX
@@ -1754,24 +1663,24 @@ void av1_highbd_iht4x8_32_add_c(const tran_low_t *input, uint8_t *dest8,
void av1_highbd_iht8x4_32_add_c(const tran_low_t *input, uint8_t *dest8,
int stride, int tx_type, int bd) {
static const highbd_transform_2d HIGH_IHT_8x4[] = {
- { highbd_idct4, highbd_idct8 }, // DCT_DCT
- { highbd_iadst4, highbd_idct8 }, // ADST_DCT
- { highbd_idct4, highbd_iadst8 }, // DCT_ADST
- { highbd_iadst4, highbd_iadst8 }, // ADST_ADST
-#if CONFIG_EXT_TX
- { highbd_iadst4, highbd_idct8 }, // FLIPADST_DCT
- { highbd_idct4, highbd_iadst8 }, // DCT_FLIPADST
- { highbd_iadst4, highbd_iadst8 }, // FLIPADST_FLIPADST
- { highbd_iadst4, highbd_iadst8 }, // ADST_FLIPADST
- { highbd_iadst4, highbd_iadst8 }, // FLIPADST_ADST
- { highbd_iidtx4_c, highbd_iidtx8_c }, // IDTX
- { highbd_idct4, highbd_iidtx8_c }, // V_DCT
- { highbd_iidtx4_c, highbd_idct8 }, // H_DCT
- { highbd_iadst4, highbd_iidtx8_c }, // V_ADST
- { highbd_iidtx4_c, highbd_iadst8 }, // H_ADST
- { highbd_iadst4, highbd_iidtx8_c }, // V_FLIPADST
- { highbd_iidtx4_c, highbd_iadst8 }, // H_FLIPADST
-#endif // CONFIG_EXT_TX
+ { aom_highbd_idct4_c, aom_highbd_idct8_c }, // DCT_DCT
+ { aom_highbd_iadst4_c, aom_highbd_idct8_c }, // ADST_DCT
+ { aom_highbd_idct4_c, aom_highbd_iadst8_c }, // DCT_ADST
+ { aom_highbd_iadst4_c, aom_highbd_iadst8_c }, // ADST_ADST
+#if CONFIG_EXT_TX
+ { aom_highbd_iadst4_c, aom_highbd_idct8_c }, // FLIPADST_DCT
+ { aom_highbd_idct4_c, aom_highbd_iadst8_c }, // DCT_FLIPADST
+ { aom_highbd_iadst4_c, aom_highbd_iadst8_c }, // FLIPADST_FLIPADST
+ { aom_highbd_iadst4_c, aom_highbd_iadst8_c }, // ADST_FLIPADST
+ { aom_highbd_iadst4_c, aom_highbd_iadst8_c }, // FLIPADST_ADST
+ { highbd_iidtx4_c, highbd_iidtx8_c }, // IDTX
+ { aom_highbd_idct4_c, highbd_iidtx8_c }, // V_DCT
+ { highbd_iidtx4_c, aom_highbd_idct8_c }, // H_DCT
+ { aom_highbd_iadst4_c, highbd_iidtx8_c }, // V_ADST
+ { highbd_iidtx4_c, aom_highbd_iadst8_c }, // H_ADST
+ { aom_highbd_iadst4_c, highbd_iidtx8_c }, // V_FLIPADST
+ { highbd_iidtx4_c, aom_highbd_iadst8_c }, // H_FLIPADST
+#endif // CONFIG_EXT_TX
};
const int n = 4;
const int n2 = 8;
@@ -1779,26 +1688,22 @@ void av1_highbd_iht8x4_32_add_c(const tran_low_t *input, uint8_t *dest8,
uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
int i, j;
- tran_low_t out[8][4], outtmp[8];
+ tran_low_t out[8][4], tmp[8][4], outtmp[8];
tran_low_t *outp = &out[0][0];
int outstride = n;
- tx_2d_cfg cfg = inv_tx_cfg(tx_type, TX_8X8, TX_4X4);
-
// inverse transform row vectors, and transpose
for (i = 0; i < n; ++i) {
- HIGH_IHT_8x4[tx_type].rows(input, outtmp, cfg.row.cos_bit,
- cfg.row.stage_range, bd);
+ HIGH_IHT_8x4[tx_type].rows(input, outtmp, bd);
for (j = 0; j < n2; ++j) {
- out[j][i] = HIGHBD_WRAPLOW(dct_const_round_shift(outtmp[j] * Sqrt2), bd);
+ tmp[j][i] = HIGHBD_WRAPLOW(dct_const_round_shift(outtmp[j] * Sqrt2), bd);
}
input += n2;
}
// inverse transform column vectors
for (i = 0; i < n2; ++i) {
- HIGH_IHT_8x4[tx_type].cols(out[i], out[i], cfg.col.cos_bit,
- cfg.col.stage_range, bd);
+ HIGH_IHT_8x4[tx_type].cols(tmp[i], out[i], bd);
}
#if CONFIG_EXT_TX
@@ -1819,24 +1724,24 @@ void av1_highbd_iht8x4_32_add_c(const tran_low_t *input, uint8_t *dest8,
void av1_highbd_iht4x16_64_add_c(const tran_low_t *input, uint8_t *dest8,
int stride, int tx_type, int bd) {
static const highbd_transform_2d HIGH_IHT_4x16[] = {
- { highbd_idct16, highbd_idct4 }, // DCT_DCT
- { highbd_iadst16, highbd_idct4 }, // ADST_DCT
- { highbd_idct16, highbd_iadst4 }, // DCT_ADST
- { highbd_iadst16, highbd_iadst4 }, // ADST_ADST
-#if CONFIG_EXT_TX
- { highbd_iadst16, highbd_idct4 }, // FLIPADST_DCT
- { highbd_idct16, highbd_iadst4 }, // DCT_FLIPADST
- { highbd_iadst16, highbd_iadst4 }, // FLIPADST_FLIPADST
- { highbd_iadst16, highbd_iadst4 }, // ADST_FLIPADST
- { highbd_iadst16, highbd_iadst4 }, // FLIPADST_ADST
- { highbd_iidtx16_c, highbd_iidtx4_c }, // IDTX
- { highbd_idct16, highbd_iidtx4_c }, // V_DCT
- { highbd_iidtx16_c, highbd_idct4 }, // H_DCT
- { highbd_iadst16, highbd_iidtx4_c }, // V_ADST
- { highbd_iidtx16_c, highbd_iadst4 }, // H_ADST
- { highbd_iadst16, highbd_iidtx4_c }, // V_FLIPADST
- { highbd_iidtx16_c, highbd_iadst4 }, // H_FLIPADST
-#endif // CONFIG_EXT_TX
+ { aom_highbd_idct16_c, aom_highbd_idct4_c }, // DCT_DCT
+ { aom_highbd_iadst16_c, aom_highbd_idct4_c }, // ADST_DCT
+ { aom_highbd_idct16_c, aom_highbd_iadst4_c }, // DCT_ADST
+ { aom_highbd_iadst16_c, aom_highbd_iadst4_c }, // ADST_ADST
+#if CONFIG_EXT_TX
+ { aom_highbd_iadst16_c, aom_highbd_idct4_c }, // FLIPADST_DCT
+ { aom_highbd_idct16_c, aom_highbd_iadst4_c }, // DCT_FLIPADST
+ { aom_highbd_iadst16_c, aom_highbd_iadst4_c }, // FLIPADST_FLIPADST
+ { aom_highbd_iadst16_c, aom_highbd_iadst4_c }, // ADST_FLIPADST
+ { aom_highbd_iadst16_c, aom_highbd_iadst4_c }, // FLIPADST_ADST
+ { highbd_iidtx16_c, highbd_iidtx4_c }, // IDTX
+ { aom_highbd_idct16_c, highbd_iidtx4_c }, // V_DCT
+ { highbd_iidtx16_c, aom_highbd_idct4_c }, // H_DCT
+ { aom_highbd_iadst16_c, highbd_iidtx4_c }, // V_ADST
+ { highbd_iidtx16_c, aom_highbd_iadst4_c }, // H_ADST
+ { aom_highbd_iadst16_c, highbd_iidtx4_c }, // V_FLIPADST
+ { highbd_iidtx16_c, aom_highbd_iadst4_c }, // H_FLIPADST
+#endif // CONFIG_EXT_TX
};
const int n = 4;
const int n4 = 16;
@@ -1844,24 +1749,19 @@ void av1_highbd_iht4x16_64_add_c(const tran_low_t *input, uint8_t *dest8,
uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
int i, j;
- tran_low_t out[4][16], outtmp[4];
+ tran_low_t out[4][16], tmp[4][16], outtmp[4];
tran_low_t *outp = &out[0][0];
int outstride = n4;
- tx_2d_cfg cfg = inv_tx_cfg(tx_type, TX_4X4, TX_16X16);
-
// inverse transform row vectors, and transpose
for (i = 0; i < n4; ++i) {
- HIGH_IHT_4x16[tx_type].rows(input, outtmp, cfg.row.cos_bit,
- cfg.row.stage_range, bd);
- for (j = 0; j < n; ++j) out[j][i] = outtmp[j];
+ HIGH_IHT_4x16[tx_type].rows(input, outtmp, bd);
+ for (j = 0; j < n; ++j) tmp[j][i] = outtmp[j];
input += n;
}
// inverse transform column vectors
- for (i = 0; i < n; ++i)
- HIGH_IHT_4x16[tx_type].cols(out[i], out[i], cfg.col.cos_bit,
- cfg.col.stage_range, bd);
+ for (i = 0; i < n; ++i) HIGH_IHT_4x16[tx_type].cols(tmp[i], out[i], bd);
#if CONFIG_EXT_TX
maybe_flip_strides16(&dest, &stride, &outp, &outstride, tx_type, n4, n);
@@ -1881,24 +1781,24 @@ void av1_highbd_iht4x16_64_add_c(const tran_low_t *input, uint8_t *dest8,
void av1_highbd_iht16x4_64_add_c(const tran_low_t *input, uint8_t *dest8,
int stride, int tx_type, int bd) {
static const highbd_transform_2d HIGH_IHT_16x4[] = {
- { highbd_idct4, highbd_idct16 }, // DCT_DCT
- { highbd_iadst4, highbd_idct16 }, // ADST_DCT
- { highbd_idct4, highbd_iadst16 }, // DCT_ADST
- { highbd_iadst4, highbd_iadst16 }, // ADST_ADST
-#if CONFIG_EXT_TX
- { highbd_iadst4, highbd_idct16 }, // FLIPADST_DCT
- { highbd_idct4, highbd_iadst16 }, // DCT_FLIPADST
- { highbd_iadst4, highbd_iadst16 }, // FLIPADST_FLIPADST
- { highbd_iadst4, highbd_iadst16 }, // ADST_FLIPADST
- { highbd_iadst4, highbd_iadst16 }, // FLIPADST_ADST
- { highbd_iidtx4_c, highbd_iidtx16_c }, // IDTX
- { highbd_idct4, highbd_iidtx16_c }, // V_DCT
- { highbd_iidtx4_c, highbd_idct16 }, // H_DCT
- { highbd_iadst4, highbd_iidtx16_c }, // V_ADST
- { highbd_iidtx4_c, highbd_iadst16 }, // H_ADST
- { highbd_iadst4, highbd_iidtx16_c }, // V_FLIPADST
- { highbd_iidtx4_c, highbd_iadst16 }, // H_FLIPADST
-#endif // CONFIG_EXT_TX
+ { aom_highbd_idct4_c, aom_highbd_idct16_c }, // DCT_DCT
+ { aom_highbd_iadst4_c, aom_highbd_idct16_c }, // ADST_DCT
+ { aom_highbd_idct4_c, aom_highbd_iadst16_c }, // DCT_ADST
+ { aom_highbd_iadst4_c, aom_highbd_iadst16_c }, // ADST_ADST
+#if CONFIG_EXT_TX
+ { aom_highbd_iadst4_c, aom_highbd_idct16_c }, // FLIPADST_DCT
+ { aom_highbd_idct4_c, aom_highbd_iadst16_c }, // DCT_FLIPADST
+ { aom_highbd_iadst4_c, aom_highbd_iadst16_c }, // FLIPADST_FLIPADST
+ { aom_highbd_iadst4_c, aom_highbd_iadst16_c }, // ADST_FLIPADST
+ { aom_highbd_iadst4_c, aom_highbd_iadst16_c }, // FLIPADST_ADST
+ { highbd_iidtx4_c, highbd_iidtx16_c }, // IDTX
+ { aom_highbd_idct4_c, highbd_iidtx16_c }, // V_DCT
+ { highbd_iidtx4_c, aom_highbd_idct16_c }, // H_DCT
+ { aom_highbd_iadst4_c, highbd_iidtx16_c }, // V_ADST
+ { highbd_iidtx4_c, aom_highbd_iadst16_c }, // H_ADST
+ { aom_highbd_iadst4_c, highbd_iidtx16_c }, // V_FLIPADST
+ { highbd_iidtx4_c, aom_highbd_iadst16_c }, // H_FLIPADST
+#endif // CONFIG_EXT_TX
};
const int n = 4;
const int n4 = 16;
@@ -1906,24 +1806,20 @@ void av1_highbd_iht16x4_64_add_c(const tran_low_t *input, uint8_t *dest8,
uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
int i, j;
- tran_low_t out[16][4], outtmp[16];
+ tran_low_t out[16][4], tmp[16][4], outtmp[16];
tran_low_t *outp = &out[0][0];
int outstride = n;
- tx_2d_cfg cfg = inv_tx_cfg(tx_type, TX_16X16, TX_4X4);
-
// inverse transform row vectors, and transpose
for (i = 0; i < n; ++i) {
- HIGH_IHT_16x4[tx_type].rows(input, outtmp, cfg.row.cos_bit,
- cfg.row.stage_range, bd);
- for (j = 0; j < n4; ++j) out[j][i] = outtmp[j];
+ HIGH_IHT_16x4[tx_type].rows(input, outtmp, bd);
+ for (j = 0; j < n4; ++j) tmp[j][i] = outtmp[j];
input += n4;
}
// inverse transform column vectors
for (i = 0; i < n4; ++i) {
- HIGH_IHT_16x4[tx_type].cols(out[i], out[i], cfg.col.cos_bit,
- cfg.col.stage_range, bd);
+ HIGH_IHT_16x4[tx_type].cols(tmp[i], out[i], bd);
}
#if CONFIG_EXT_TX
@@ -1944,24 +1840,24 @@ void av1_highbd_iht16x4_64_add_c(const tran_low_t *input, uint8_t *dest8,
void av1_highbd_iht8x16_128_add_c(const tran_low_t *input, uint8_t *dest8,
int stride, int tx_type, int bd) {
static const highbd_transform_2d HIGH_IHT_8x16[] = {
- { highbd_idct16, highbd_idct8 }, // DCT_DCT
- { highbd_iadst16, highbd_idct8 }, // ADST_DCT
- { highbd_idct16, highbd_iadst8 }, // DCT_ADST
- { highbd_iadst16, highbd_iadst8 }, // ADST_ADST
-#if CONFIG_EXT_TX
- { highbd_iadst16, highbd_idct8 }, // FLIPADST_DCT
- { highbd_idct16, highbd_iadst8 }, // DCT_FLIPADST
- { highbd_iadst16, highbd_iadst8 }, // FLIPADST_FLIPADST
- { highbd_iadst16, highbd_iadst8 }, // ADST_FLIPADST
- { highbd_iadst16, highbd_iadst8 }, // FLIPADST_ADST
- { highbd_iidtx16_c, highbd_iidtx8_c }, // IDTX
- { highbd_idct16, highbd_iidtx8_c }, // V_DCT
- { highbd_iidtx16_c, highbd_idct8 }, // H_DCT
- { highbd_iadst16, highbd_iidtx8_c }, // V_ADST
- { highbd_iidtx16_c, highbd_iadst8 }, // H_ADST
- { highbd_iadst16, highbd_iidtx8_c }, // V_FLIPADST
- { highbd_iidtx16_c, highbd_iadst8 }, // H_FLIPADST
-#endif // CONFIG_EXT_TX
+ { aom_highbd_idct16_c, aom_highbd_idct8_c }, // DCT_DCT
+ { aom_highbd_iadst16_c, aom_highbd_idct8_c }, // ADST_DCT
+ { aom_highbd_idct16_c, aom_highbd_iadst8_c }, // DCT_ADST
+ { aom_highbd_iadst16_c, aom_highbd_iadst8_c }, // ADST_ADST
+#if CONFIG_EXT_TX
+ { aom_highbd_iadst16_c, aom_highbd_idct8_c }, // FLIPADST_DCT
+ { aom_highbd_idct16_c, aom_highbd_iadst8_c }, // DCT_FLIPADST
+ { aom_highbd_iadst16_c, aom_highbd_iadst8_c }, // FLIPADST_FLIPADST
+ { aom_highbd_iadst16_c, aom_highbd_iadst8_c }, // ADST_FLIPADST
+ { aom_highbd_iadst16_c, aom_highbd_iadst8_c }, // FLIPADST_ADST
+ { highbd_iidtx16_c, highbd_iidtx8_c }, // IDTX
+ { aom_highbd_idct16_c, highbd_iidtx8_c }, // V_DCT
+ { highbd_iidtx16_c, aom_highbd_idct8_c }, // H_DCT
+ { aom_highbd_iadst16_c, highbd_iidtx8_c }, // V_ADST
+ { highbd_iidtx16_c, aom_highbd_iadst8_c }, // H_ADST
+ { aom_highbd_iadst16_c, highbd_iidtx8_c }, // V_FLIPADST
+ { highbd_iidtx16_c, aom_highbd_iadst8_c }, // H_FLIPADST
+#endif // CONFIG_EXT_TX
};
const int n = 8;
const int n2 = 16;
@@ -1969,25 +1865,21 @@ void av1_highbd_iht8x16_128_add_c(const tran_low_t *input, uint8_t *dest8,
uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
int i, j;
- tran_low_t out[8][16], outtmp[8];
+ tran_low_t out[8][16], tmp[8][16], outtmp[8];
tran_low_t *outp = &out[0][0];
int outstride = n2;
- tx_2d_cfg cfg = inv_tx_cfg(tx_type, TX_8X8, TX_16X16);
-
// inverse transform row vectors, and transpose
for (i = 0; i < n2; ++i) {
- HIGH_IHT_8x16[tx_type].rows(input, outtmp, cfg.row.cos_bit,
- cfg.row.stage_range, bd);
+ HIGH_IHT_8x16[tx_type].rows(input, outtmp, bd);
for (j = 0; j < n; ++j)
- out[j][i] = HIGHBD_WRAPLOW(dct_const_round_shift(outtmp[j] * Sqrt2), bd);
+ tmp[j][i] = HIGHBD_WRAPLOW(dct_const_round_shift(outtmp[j] * Sqrt2), bd);
input += n;
}
// inverse transform column vectors
for (i = 0; i < n; ++i) {
- HIGH_IHT_8x16[tx_type].cols(out[i], out[i], cfg.col.cos_bit,
- cfg.col.stage_range, bd);
+ HIGH_IHT_8x16[tx_type].cols(tmp[i], out[i], bd);
}
#if CONFIG_EXT_TX
@@ -2008,24 +1900,24 @@ void av1_highbd_iht8x16_128_add_c(const tran_low_t *input, uint8_t *dest8,
void av1_highbd_iht16x8_128_add_c(const tran_low_t *input, uint8_t *dest8,
int stride, int tx_type, int bd) {
static const highbd_transform_2d HIGH_IHT_16x8[] = {
- { highbd_idct8, highbd_idct16 }, // DCT_DCT
- { highbd_iadst8, highbd_idct16 }, // ADST_DCT
- { highbd_idct8, highbd_iadst16 }, // DCT_ADST
- { highbd_iadst8, highbd_iadst16 }, // ADST_ADST
-#if CONFIG_EXT_TX
- { highbd_iadst8, highbd_idct16 }, // FLIPADST_DCT
- { highbd_idct8, highbd_iadst16 }, // DCT_FLIPADST
- { highbd_iadst8, highbd_iadst16 }, // FLIPADST_FLIPADST
- { highbd_iadst8, highbd_iadst16 }, // ADST_FLIPADST
- { highbd_iadst8, highbd_iadst16 }, // FLIPADST_ADST
- { highbd_iidtx8_c, highbd_iidtx16_c }, // IDTX
- { highbd_idct8, highbd_iidtx16_c }, // V_DCT
- { highbd_iidtx8_c, highbd_idct16 }, // H_DCT
- { highbd_iadst8, highbd_iidtx16_c }, // V_ADST
- { highbd_iidtx8_c, highbd_iadst16 }, // H_ADST
- { highbd_iadst8, highbd_iidtx16_c }, // V_FLIPADST
- { highbd_iidtx8_c, highbd_iadst16 }, // H_FLIPADST
-#endif // CONFIG_EXT_TX
+ { aom_highbd_idct8_c, aom_highbd_idct16_c }, // DCT_DCT
+ { aom_highbd_iadst8_c, aom_highbd_idct16_c }, // ADST_DCT
+ { aom_highbd_idct8_c, aom_highbd_iadst16_c }, // DCT_ADST
+ { aom_highbd_iadst8_c, aom_highbd_iadst16_c }, // ADST_ADST
+#if CONFIG_EXT_TX
+ { aom_highbd_iadst8_c, aom_highbd_idct16_c }, // FLIPADST_DCT
+ { aom_highbd_idct8_c, aom_highbd_iadst16_c }, // DCT_FLIPADST
+ { aom_highbd_iadst8_c, aom_highbd_iadst16_c }, // FLIPADST_FLIPADST
+ { aom_highbd_iadst8_c, aom_highbd_iadst16_c }, // ADST_FLIPADST
+ { aom_highbd_iadst8_c, aom_highbd_iadst16_c }, // FLIPADST_ADST
+ { highbd_iidtx8_c, highbd_iidtx16_c }, // IDTX
+ { aom_highbd_idct8_c, highbd_iidtx16_c }, // V_DCT
+ { highbd_iidtx8_c, aom_highbd_idct16_c }, // H_DCT
+ { aom_highbd_iadst8_c, highbd_iidtx16_c }, // V_ADST
+ { highbd_iidtx8_c, aom_highbd_iadst16_c }, // H_ADST
+ { aom_highbd_iadst8_c, highbd_iidtx16_c }, // V_FLIPADST
+ { highbd_iidtx8_c, aom_highbd_iadst16_c }, // H_FLIPADST
+#endif // CONFIG_EXT_TX
};
const int n = 8;
const int n2 = 16;
@@ -2033,25 +1925,21 @@ void av1_highbd_iht16x8_128_add_c(const tran_low_t *input, uint8_t *dest8,
uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
int i, j;
- tran_low_t out[16][8], outtmp[16];
+ tran_low_t out[16][8], tmp[16][8], outtmp[16];
tran_low_t *outp = &out[0][0];
int outstride = n;
- tx_2d_cfg cfg = inv_tx_cfg(tx_type, TX_16X16, TX_8X8);
-
// inverse transform row vectors, and transpose
for (i = 0; i < n; ++i) {
- HIGH_IHT_16x8[tx_type].rows(input, outtmp, cfg.row.cos_bit,
- cfg.row.stage_range, bd);
+ HIGH_IHT_16x8[tx_type].rows(input, outtmp, bd);
for (j = 0; j < n2; ++j)
- out[j][i] = HIGHBD_WRAPLOW(dct_const_round_shift(outtmp[j] * Sqrt2), bd);
+ tmp[j][i] = HIGHBD_WRAPLOW(dct_const_round_shift(outtmp[j] * Sqrt2), bd);
input += n2;
}
// inverse transform column vectors
for (i = 0; i < n2; ++i) {
- HIGH_IHT_16x8[tx_type].cols(out[i], out[i], cfg.col.cos_bit,
- cfg.col.stage_range, bd);
+ HIGH_IHT_16x8[tx_type].cols(tmp[i], out[i], bd);
}
#if CONFIG_EXT_TX
@@ -2072,24 +1960,24 @@ void av1_highbd_iht16x8_128_add_c(const tran_low_t *input, uint8_t *dest8,
void av1_highbd_iht8x32_256_add_c(const tran_low_t *input, uint8_t *dest8,
int stride, int tx_type, int bd) {
static const highbd_transform_2d HIGH_IHT_8x32[] = {
- { highbd_idct32, highbd_idct8 }, // DCT_DCT
- { highbd_ihalfright32_c, highbd_idct8 }, // ADST_DCT
- { highbd_idct32, highbd_iadst8 }, // DCT_ADST
- { highbd_ihalfright32_c, highbd_iadst8 }, // ADST_ADST
-#if CONFIG_EXT_TX
- { highbd_ihalfright32_c, highbd_idct8 }, // FLIPADST_DCT
- { highbd_idct32, highbd_iadst8 }, // DCT_FLIPADST
- { highbd_ihalfright32_c, highbd_iadst8 }, // FLIPADST_FLIPADST
- { highbd_ihalfright32_c, highbd_iadst8 }, // ADST_FLIPADST
- { highbd_ihalfright32_c, highbd_iadst8 }, // FLIPADST_ADST
- { highbd_iidtx32_c, highbd_iidtx8_c }, // IDTX
- { highbd_idct32, highbd_iidtx8_c }, // V_DCT
- { highbd_iidtx32_c, highbd_idct8 }, // H_DCT
- { highbd_ihalfright32_c, highbd_iidtx8_c }, // V_ADST
- { highbd_iidtx32_c, highbd_iadst8 }, // H_ADST
- { highbd_ihalfright32_c, highbd_iidtx8_c }, // V_FLIPADST
- { highbd_iidtx32_c, highbd_iadst8 }, // H_FLIPADST
-#endif // CONFIG_EXT_TX
+ { aom_highbd_idct32_c, aom_highbd_idct8_c }, // DCT_DCT
+ { highbd_ihalfright32_c, aom_highbd_idct8_c }, // ADST_DCT
+ { aom_highbd_idct32_c, aom_highbd_iadst8_c }, // DCT_ADST
+ { highbd_ihalfright32_c, aom_highbd_iadst8_c }, // ADST_ADST
+#if CONFIG_EXT_TX
+ { highbd_ihalfright32_c, aom_highbd_idct8_c }, // FLIPADST_DCT
+ { aom_highbd_idct32_c, aom_highbd_iadst8_c }, // DCT_FLIPADST
+ { highbd_ihalfright32_c, aom_highbd_iadst8_c }, // FLIPADST_FLIPADST
+ { highbd_ihalfright32_c, aom_highbd_iadst8_c }, // ADST_FLIPADST
+ { highbd_ihalfright32_c, aom_highbd_iadst8_c }, // FLIPADST_ADST
+ { highbd_iidtx32_c, highbd_iidtx8_c }, // IDTX
+ { aom_highbd_idct32_c, highbd_iidtx8_c }, // V_DCT
+ { highbd_iidtx32_c, aom_highbd_idct8_c }, // H_DCT
+ { highbd_ihalfright32_c, highbd_iidtx8_c }, // V_ADST
+ { highbd_iidtx32_c, aom_highbd_iadst8_c }, // H_ADST
+ { highbd_ihalfright32_c, highbd_iidtx8_c }, // V_FLIPADST
+ { highbd_iidtx32_c, aom_highbd_iadst8_c }, // H_FLIPADST
+#endif // CONFIG_EXT_TX
};
const int n = 8;
const int n4 = 32;
@@ -2097,24 +1985,19 @@ void av1_highbd_iht8x32_256_add_c(const tran_low_t *input, uint8_t *dest8,
uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
int i, j;
- tran_low_t out[8][32], outtmp[8];
+ tran_low_t out[8][32], tmp[8][32], outtmp[8];
tran_low_t *outp = &out[0][0];
int outstride = n4;
- tx_2d_cfg cfg = inv_tx_cfg(tx_type, TX_8X8, TX_32X32);
-
// inverse transform row vectors, and transpose
for (i = 0; i < n4; ++i) {
- HIGH_IHT_8x32[tx_type].rows(input, outtmp, cfg.row.cos_bit,
- cfg.row.stage_range, bd);
- for (j = 0; j < n; ++j) out[j][i] = outtmp[j];
+ HIGH_IHT_8x32[tx_type].rows(input, outtmp, bd);
+ for (j = 0; j < n; ++j) tmp[j][i] = outtmp[j];
input += n;
}
// inverse transform column vectors
- for (i = 0; i < n; ++i)
- HIGH_IHT_8x32[tx_type].cols(out[i], out[i], cfg.col.cos_bit,
- cfg.col.stage_range, bd);
+ for (i = 0; i < n; ++i) HIGH_IHT_8x32[tx_type].cols(tmp[i], out[i], bd);
#if CONFIG_EXT_TX
maybe_flip_strides16(&dest, &stride, &outp, &outstride, tx_type, n4, n);
@@ -2134,24 +2017,24 @@ void av1_highbd_iht8x32_256_add_c(const tran_low_t *input, uint8_t *dest8,
void av1_highbd_iht32x8_256_add_c(const tran_low_t *input, uint8_t *dest8,
int stride, int tx_type, int bd) {
static const highbd_transform_2d HIGH_IHT_32x8[] = {
- { highbd_idct8, highbd_idct32 }, // DCT_DCT
- { highbd_iadst8, highbd_idct32 }, // ADST_DCT
- { highbd_idct8, highbd_ihalfright32_c }, // DCT_ADST
- { highbd_iadst8, highbd_ihalfright32_c }, // ADST_ADST
-#if CONFIG_EXT_TX
- { highbd_iadst8, highbd_idct32 }, // FLIPADST_DCT
- { highbd_idct8, highbd_ihalfright32_c }, // DCT_FLIPADST
- { highbd_iadst8, highbd_ihalfright32_c }, // FLIPADST_FLIPADST
- { highbd_iadst8, highbd_ihalfright32_c }, // ADST_FLIPADST
- { highbd_iadst8, highbd_ihalfright32_c }, // FLIPADST_ADST
- { highbd_iidtx8_c, highbd_iidtx32_c }, // IDTX
- { highbd_idct8, highbd_iidtx32_c }, // V_DCT
- { highbd_iidtx8_c, highbd_idct32 }, // H_DCT
- { highbd_iadst8, highbd_iidtx32_c }, // V_ADST
- { highbd_iidtx8_c, highbd_ihalfright32_c }, // H_ADST
- { highbd_iadst8, highbd_iidtx32_c }, // V_FLIPADST
- { highbd_iidtx8_c, highbd_ihalfright32_c }, // H_FLIPADST
-#endif // CONFIG_EXT_TX
+ { aom_highbd_idct8_c, aom_highbd_idct32_c }, // DCT_DCT
+ { aom_highbd_iadst8_c, aom_highbd_idct32_c }, // ADST_DCT
+ { aom_highbd_idct8_c, highbd_ihalfright32_c }, // DCT_ADST
+ { aom_highbd_iadst8_c, highbd_ihalfright32_c }, // ADST_ADST
+#if CONFIG_EXT_TX
+ { aom_highbd_iadst8_c, aom_highbd_idct32_c }, // FLIPADST_DCT
+ { aom_highbd_idct8_c, highbd_ihalfright32_c }, // DCT_FLIPADST
+ { aom_highbd_iadst8_c, highbd_ihalfright32_c }, // FLIPADST_FLIPADST
+ { aom_highbd_iadst8_c, highbd_ihalfright32_c }, // ADST_FLIPADST
+ { aom_highbd_iadst8_c, highbd_ihalfright32_c }, // FLIPADST_ADST
+ { highbd_iidtx8_c, highbd_iidtx32_c }, // IDTX
+ { aom_highbd_idct8_c, highbd_iidtx32_c }, // V_DCT
+ { highbd_iidtx8_c, aom_highbd_idct32_c }, // H_DCT
+ { aom_highbd_iadst8_c, highbd_iidtx32_c }, // V_ADST
+ { highbd_iidtx8_c, highbd_ihalfright32_c }, // H_ADST
+ { aom_highbd_iadst8_c, highbd_iidtx32_c }, // V_FLIPADST
+ { highbd_iidtx8_c, highbd_ihalfright32_c }, // H_FLIPADST
+#endif // CONFIG_EXT_TX
};
const int n = 8;
const int n4 = 32;
@@ -2159,24 +2042,19 @@ void av1_highbd_iht32x8_256_add_c(const tran_low_t *input, uint8_t *dest8,
uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
int i, j;
- tran_low_t out[32][8], outtmp[32];
+ tran_low_t out[32][8], tmp[32][8], outtmp[32];
tran_low_t *outp = &out[0][0];
int outstride = n;
- tx_2d_cfg cfg = inv_tx_cfg(tx_type, TX_32X32, TX_8X8);
-
// inverse transform row vectors, and transpose
for (i = 0; i < n; ++i) {
- HIGH_IHT_32x8[tx_type].rows(input, outtmp, cfg.row.cos_bit,
- cfg.row.stage_range, bd);
- for (j = 0; j < n4; ++j) out[j][i] = outtmp[j];
+ HIGH_IHT_32x8[tx_type].rows(input, outtmp, bd);
+ for (j = 0; j < n4; ++j) tmp[j][i] = outtmp[j];
input += n4;
}
// inverse transform column vectors
- for (i = 0; i < n4; ++i)
- HIGH_IHT_32x8[tx_type].cols(out[i], out[i], cfg.col.cos_bit,
- cfg.col.stage_range, bd);
+ for (i = 0; i < n4; ++i) HIGH_IHT_32x8[tx_type].cols(tmp[i], out[i], bd);
#if CONFIG_EXT_TX
maybe_flip_strides16(&dest, &stride, &outp, &outstride, tx_type, n, n4);
@@ -2196,24 +2074,24 @@ void av1_highbd_iht32x8_256_add_c(const tran_low_t *input, uint8_t *dest8,
void av1_highbd_iht16x32_512_add_c(const tran_low_t *input, uint8_t *dest8,
int stride, int tx_type, int bd) {
static const highbd_transform_2d HIGH_IHT_16x32[] = {
- { highbd_idct32, highbd_idct16 }, // DCT_DCT
- { highbd_ihalfright32_c, highbd_idct16 }, // ADST_DCT
- { highbd_idct32, highbd_iadst16 }, // DCT_ADST
- { highbd_ihalfright32_c, highbd_iadst16 }, // ADST_ADST
-#if CONFIG_EXT_TX
- { highbd_ihalfright32_c, highbd_idct16 }, // FLIPADST_DCT
- { highbd_idct32, highbd_iadst16 }, // DCT_FLIPADST
- { highbd_ihalfright32_c, highbd_iadst16 }, // FLIPADST_FLIPADST
- { highbd_ihalfright32_c, highbd_iadst16 }, // ADST_FLIPADST
- { highbd_ihalfright32_c, highbd_iadst16 }, // FLIPADST_ADST
- { highbd_iidtx32_c, highbd_iidtx16_c }, // IDTX
- { highbd_idct32, highbd_iidtx16_c }, // V_DCT
- { highbd_iidtx32_c, highbd_idct16 }, // H_DCT
- { highbd_ihalfright32_c, highbd_iidtx16_c }, // V_ADST
- { highbd_iidtx32_c, highbd_iadst16 }, // H_ADST
- { highbd_ihalfright32_c, highbd_iidtx16_c }, // V_FLIPADST
- { highbd_iidtx32_c, highbd_iadst16 }, // H_FLIPADST
-#endif // CONFIG_EXT_TX
+ { aom_highbd_idct32_c, aom_highbd_idct16_c }, // DCT_DCT
+ { highbd_ihalfright32_c, aom_highbd_idct16_c }, // ADST_DCT
+ { aom_highbd_idct32_c, aom_highbd_iadst16_c }, // DCT_ADST
+ { highbd_ihalfright32_c, aom_highbd_iadst16_c }, // ADST_ADST
+#if CONFIG_EXT_TX
+ { highbd_ihalfright32_c, aom_highbd_idct16_c }, // FLIPADST_DCT
+ { aom_highbd_idct32_c, aom_highbd_iadst16_c }, // DCT_FLIPADST
+ { highbd_ihalfright32_c, aom_highbd_iadst16_c }, // FLIPADST_FLIPADST
+ { highbd_ihalfright32_c, aom_highbd_iadst16_c }, // ADST_FLIPADST
+ { highbd_ihalfright32_c, aom_highbd_iadst16_c }, // FLIPADST_ADST
+ { highbd_iidtx32_c, highbd_iidtx16_c }, // IDTX
+ { aom_highbd_idct32_c, highbd_iidtx16_c }, // V_DCT
+ { highbd_iidtx32_c, aom_highbd_idct16_c }, // H_DCT
+ { highbd_ihalfright32_c, highbd_iidtx16_c }, // V_ADST
+ { highbd_iidtx32_c, aom_highbd_iadst16_c }, // H_ADST
+ { highbd_ihalfright32_c, highbd_iidtx16_c }, // V_FLIPADST
+ { highbd_iidtx32_c, aom_highbd_iadst16_c }, // H_FLIPADST
+#endif // CONFIG_EXT_TX
};
const int n = 16;
const int n2 = 32;
@@ -2221,25 +2099,21 @@ void av1_highbd_iht16x32_512_add_c(const tran_low_t *input, uint8_t *dest8,
uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
int i, j;
- tran_low_t out[16][32], outtmp[16];
+ tran_low_t out[16][32], tmp[16][32], outtmp[16];
tran_low_t *outp = &out[0][0];
int outstride = n2;
- tx_2d_cfg cfg = inv_tx_cfg(tx_type, TX_16X16, TX_32X32);
-
// inverse transform row vectors, and transpose
for (i = 0; i < n2; ++i) {
- HIGH_IHT_16x32[tx_type].rows(input, outtmp, cfg.row.cos_bit,
- cfg.row.stage_range, bd);
+ HIGH_IHT_16x32[tx_type].rows(input, outtmp, bd);
for (j = 0; j < n; ++j)
- out[j][i] = HIGHBD_WRAPLOW(dct_const_round_shift(outtmp[j] * Sqrt2), bd);
+ tmp[j][i] = HIGHBD_WRAPLOW(dct_const_round_shift(outtmp[j] * Sqrt2), bd);
input += n;
}
// inverse transform column vectors
for (i = 0; i < n; ++i) {
- HIGH_IHT_16x32[tx_type].cols(out[i], out[i], cfg.col.cos_bit,
- cfg.col.stage_range, bd);
+ HIGH_IHT_16x32[tx_type].cols(tmp[i], out[i], bd);
}
#if CONFIG_EXT_TX
@@ -2260,24 +2134,24 @@ void av1_highbd_iht16x32_512_add_c(const tran_low_t *input, uint8_t *dest8,
void av1_highbd_iht32x16_512_add_c(const tran_low_t *input, uint8_t *dest8,
int stride, int tx_type, int bd) {
static const highbd_transform_2d HIGH_IHT_32x16[] = {
- { highbd_idct16, highbd_idct32 }, // DCT_DCT
- { highbd_iadst16, highbd_idct32 }, // ADST_DCT
- { highbd_idct16, highbd_ihalfright32_c }, // DCT_ADST
- { highbd_iadst16, highbd_ihalfright32_c }, // ADST_ADST
-#if CONFIG_EXT_TX
- { highbd_iadst16, highbd_idct32 }, // FLIPADST_DCT
- { highbd_idct16, highbd_ihalfright32_c }, // DCT_FLIPADST
- { highbd_iadst16, highbd_ihalfright32_c }, // FLIPADST_FLIPADST
- { highbd_iadst16, highbd_ihalfright32_c }, // ADST_FLIPADST
- { highbd_iadst16, highbd_ihalfright32_c }, // FLIPADST_ADST
- { highbd_iidtx16_c, highbd_iidtx32_c }, // IDTX
- { highbd_idct16, highbd_iidtx32_c }, // V_DCT
- { highbd_iidtx16_c, highbd_idct32 }, // H_DCT
- { highbd_iadst16, highbd_iidtx32_c }, // V_ADST
- { highbd_iidtx16_c, highbd_ihalfright32_c }, // H_ADST
- { highbd_iadst16, highbd_iidtx32_c }, // V_FLIPADST
- { highbd_iidtx16_c, highbd_ihalfright32_c }, // H_FLIPADST
-#endif // CONFIG_EXT_TX
+ { aom_highbd_idct16_c, aom_highbd_idct32_c }, // DCT_DCT
+ { aom_highbd_iadst16_c, aom_highbd_idct32_c }, // ADST_DCT
+ { aom_highbd_idct16_c, highbd_ihalfright32_c }, // DCT_ADST
+ { aom_highbd_iadst16_c, highbd_ihalfright32_c }, // ADST_ADST
+#if CONFIG_EXT_TX
+ { aom_highbd_iadst16_c, aom_highbd_idct32_c }, // FLIPADST_DCT
+ { aom_highbd_idct16_c, highbd_ihalfright32_c }, // DCT_FLIPADST
+ { aom_highbd_iadst16_c, highbd_ihalfright32_c }, // FLIPADST_FLIPADST
+ { aom_highbd_iadst16_c, highbd_ihalfright32_c }, // ADST_FLIPADST
+ { aom_highbd_iadst16_c, highbd_ihalfright32_c }, // FLIPADST_ADST
+ { highbd_iidtx16_c, highbd_iidtx32_c }, // IDTX
+ { aom_highbd_idct16_c, highbd_iidtx32_c }, // V_DCT
+ { highbd_iidtx16_c, aom_highbd_idct32_c }, // H_DCT
+ { aom_highbd_iadst16_c, highbd_iidtx32_c }, // V_ADST
+ { highbd_iidtx16_c, highbd_ihalfright32_c }, // H_ADST
+ { aom_highbd_iadst16_c, highbd_iidtx32_c }, // V_FLIPADST
+ { highbd_iidtx16_c, highbd_ihalfright32_c }, // H_FLIPADST
+#endif // CONFIG_EXT_TX
};
const int n = 16;
const int n2 = 32;
@@ -2285,25 +2159,21 @@ void av1_highbd_iht32x16_512_add_c(const tran_low_t *input, uint8_t *dest8,
uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
int i, j;
- tran_low_t out[32][16], outtmp[32];
+ tran_low_t out[32][16], tmp[32][16], outtmp[32];
tran_low_t *outp = &out[0][0];
int outstride = n;
- tx_2d_cfg cfg = inv_tx_cfg(tx_type, TX_32X32, TX_16X16);
-
// inverse transform row vectors, and transpose
for (i = 0; i < n; ++i) {
- HIGH_IHT_32x16[tx_type].rows(input, outtmp, cfg.row.cos_bit,
- cfg.row.stage_range, bd);
+ HIGH_IHT_32x16[tx_type].rows(input, outtmp, bd);
for (j = 0; j < n2; ++j)
- out[j][i] = HIGHBD_WRAPLOW(dct_const_round_shift(outtmp[j] * Sqrt2), bd);
+ tmp[j][i] = HIGHBD_WRAPLOW(dct_const_round_shift(outtmp[j] * Sqrt2), bd);
input += n2;
}
// inverse transform column vectors
for (i = 0; i < n2; ++i) {
- HIGH_IHT_32x16[tx_type].cols(out[i], out[i], cfg.col.cos_bit,
- cfg.col.stage_range, bd);
+ HIGH_IHT_32x16[tx_type].cols(tmp[i], out[i], bd);
}
#if CONFIG_EXT_TX
@@ -2324,56 +2194,50 @@ void av1_highbd_iht32x16_512_add_c(const tran_low_t *input, uint8_t *dest8,
void av1_highbd_iht8x8_64_add_c(const tran_low_t *input, uint8_t *dest8,
int stride, int tx_type, int bd) {
static const highbd_transform_2d HIGH_IHT_8[] = {
- { highbd_idct8, highbd_idct8 }, // DCT_DCT
- { highbd_iadst8, highbd_idct8 }, // ADST_DCT
- { highbd_idct8, highbd_iadst8 }, // DCT_ADST
- { highbd_iadst8, highbd_iadst8 }, // ADST_ADST
-#if CONFIG_EXT_TX
- { highbd_iadst8, highbd_idct8 }, // FLIPADST_DCT
- { highbd_idct8, highbd_iadst8 }, // DCT_FLIPADST
- { highbd_iadst8, highbd_iadst8 }, // FLIPADST_FLIPADST
- { highbd_iadst8, highbd_iadst8 }, // ADST_FLIPADST
- { highbd_iadst8, highbd_iadst8 }, // FLIPADST_ADST
- { highbd_iidtx8_c, highbd_iidtx8_c }, // IDTX
- { highbd_idct8, highbd_iidtx8_c }, // V_DCT
- { highbd_iidtx8_c, highbd_idct8 }, // H_DCT
- { highbd_iadst8, highbd_iidtx8_c }, // V_ADST
- { highbd_iidtx8_c, highbd_iadst8 }, // H_ADST
- { highbd_iadst8, highbd_iidtx8_c }, // V_FLIPADST
- { highbd_iidtx8_c, highbd_iadst8 }, // H_FLIPADST
-#endif // CONFIG_EXT_TX
+ { aom_highbd_idct8_c, aom_highbd_idct8_c }, // DCT_DCT
+ { aom_highbd_iadst8_c, aom_highbd_idct8_c }, // ADST_DCT
+ { aom_highbd_idct8_c, aom_highbd_iadst8_c }, // DCT_ADST
+ { aom_highbd_iadst8_c, aom_highbd_iadst8_c }, // ADST_ADST
+#if CONFIG_EXT_TX
+ { aom_highbd_iadst8_c, aom_highbd_idct8_c }, // FLIPADST_DCT
+ { aom_highbd_idct8_c, aom_highbd_iadst8_c }, // DCT_FLIPADST
+ { aom_highbd_iadst8_c, aom_highbd_iadst8_c }, // FLIPADST_FLIPADST
+ { aom_highbd_iadst8_c, aom_highbd_iadst8_c }, // ADST_FLIPADST
+ { aom_highbd_iadst8_c, aom_highbd_iadst8_c }, // FLIPADST_ADST
+ { highbd_iidtx8_c, highbd_iidtx8_c }, // IDTX
+ { aom_highbd_idct8_c, highbd_iidtx8_c }, // V_DCT
+ { highbd_iidtx8_c, aom_highbd_idct8_c }, // H_DCT
+ { aom_highbd_iadst8_c, highbd_iidtx8_c }, // V_ADST
+ { highbd_iidtx8_c, aom_highbd_iadst8_c }, // H_ADST
+ { aom_highbd_iadst8_c, highbd_iidtx8_c }, // V_FLIPADST
+ { highbd_iidtx8_c, aom_highbd_iadst8_c }, // H_FLIPADST
+#endif // CONFIG_EXT_TX
};
uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
int i, j;
- tran_low_t tmp;
+ tran_low_t tmp[8][8];
tran_low_t out[8][8];
tran_low_t *outp = &out[0][0];
int outstride = 8;
- tx_2d_cfg cfg = inv_tx_cfg(tx_type, TX_8X8, TX_8X8);
-
// inverse transform row vectors
for (i = 0; i < 8; ++i) {
- HIGH_IHT_8[tx_type].rows(input, out[i], cfg.row.cos_bit,
- cfg.row.stage_range, bd);
+ HIGH_IHT_8[tx_type].rows(input, out[i], bd);
input += 8;
}
// transpose
- for (i = 1; i < 8; i++) {
- for (j = 0; j < i; j++) {
- tmp = out[i][j];
- out[i][j] = out[j][i];
- out[j][i] = tmp;
+ for (i = 0; i < 8; i++) {
+ for (j = 0; j < 8; j++) {
+ tmp[j][i] = out[i][j];
}
}
// inverse transform column vectors
for (i = 0; i < 8; ++i) {
- HIGH_IHT_8[tx_type].cols(out[i], out[i], cfg.col.cos_bit,
- cfg.col.stage_range, bd);
+ HIGH_IHT_8[tx_type].cols(tmp[i], out[i], bd);
}
#if CONFIG_EXT_TX
@@ -2394,56 +2258,50 @@ void av1_highbd_iht8x8_64_add_c(const tran_low_t *input, uint8_t *dest8,
void av1_highbd_iht16x16_256_add_c(const tran_low_t *input, uint8_t *dest8,
int stride, int tx_type, int bd) {
static const highbd_transform_2d HIGH_IHT_16[] = {
- { highbd_idct16, highbd_idct16 }, // DCT_DCT
- { highbd_iadst16, highbd_idct16 }, // ADST_DCT
- { highbd_idct16, highbd_iadst16 }, // DCT_ADST
- { highbd_iadst16, highbd_iadst16 }, // ADST_ADST
-#if CONFIG_EXT_TX
- { highbd_iadst16, highbd_idct16 }, // FLIPADST_DCT
- { highbd_idct16, highbd_iadst16 }, // DCT_FLIPADST
- { highbd_iadst16, highbd_iadst16 }, // FLIPADST_FLIPADST
- { highbd_iadst16, highbd_iadst16 }, // ADST_FLIPADST
- { highbd_iadst16, highbd_iadst16 }, // FLIPADST_ADST
- { highbd_iidtx16_c, highbd_iidtx16_c }, // IDTX
- { highbd_idct16, highbd_iidtx16_c }, // V_DCT
- { highbd_iidtx16_c, highbd_idct16 }, // H_DCT
- { highbd_iadst16, highbd_iidtx16_c }, // V_ADST
- { highbd_iidtx16_c, highbd_iadst16 }, // H_ADST
- { highbd_iadst16, highbd_iidtx16_c }, // V_FLIPADST
- { highbd_iidtx16_c, highbd_iadst16 }, // H_FLIPADST
-#endif // CONFIG_EXT_TX
+ { aom_highbd_idct16_c, aom_highbd_idct16_c }, // DCT_DCT
+ { aom_highbd_iadst16_c, aom_highbd_idct16_c }, // ADST_DCT
+ { aom_highbd_idct16_c, aom_highbd_iadst16_c }, // DCT_ADST
+ { aom_highbd_iadst16_c, aom_highbd_iadst16_c }, // ADST_ADST
+#if CONFIG_EXT_TX
+ { aom_highbd_iadst16_c, aom_highbd_idct16_c }, // FLIPADST_DCT
+ { aom_highbd_idct16_c, aom_highbd_iadst16_c }, // DCT_FLIPADST
+ { aom_highbd_iadst16_c, aom_highbd_iadst16_c }, // FLIPADST_FLIPADST
+ { aom_highbd_iadst16_c, aom_highbd_iadst16_c }, // ADST_FLIPADST
+ { aom_highbd_iadst16_c, aom_highbd_iadst16_c }, // FLIPADST_ADST
+ { highbd_iidtx16_c, highbd_iidtx16_c }, // IDTX
+ { aom_highbd_idct16_c, highbd_iidtx16_c }, // V_DCT
+ { highbd_iidtx16_c, aom_highbd_idct16_c }, // H_DCT
+ { aom_highbd_iadst16_c, highbd_iidtx16_c }, // V_ADST
+ { highbd_iidtx16_c, aom_highbd_iadst16_c }, // H_ADST
+ { aom_highbd_iadst16_c, highbd_iidtx16_c }, // V_FLIPADST
+ { highbd_iidtx16_c, aom_highbd_iadst16_c }, // H_FLIPADST
+#endif // CONFIG_EXT_TX
};
uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
int i, j;
- tran_low_t tmp;
+ tran_low_t tmp[16][16];
tran_low_t out[16][16];
tran_low_t *outp = &out[0][0];
int outstride = 16;
- tx_2d_cfg cfg = inv_tx_cfg(tx_type, TX_16X16, TX_16X16);
-
// inverse transform row vectors
for (i = 0; i < 16; ++i) {
- HIGH_IHT_16[tx_type].rows(input, out[i], cfg.row.cos_bit,
- cfg.row.stage_range, bd);
+ HIGH_IHT_16[tx_type].rows(input, out[i], bd);
input += 16;
}
// transpose
- for (i = 1; i < 16; i++) {
- for (j = 0; j < i; j++) {
- tmp = out[i][j];
- out[i][j] = out[j][i];
- out[j][i] = tmp;
+ for (i = 0; i < 16; i++) {
+ for (j = 0; j < 16; j++) {
+ tmp[j][i] = out[i][j];
}
}
// inverse transform column vectors
for (i = 0; i < 16; ++i) {
- HIGH_IHT_16[tx_type].cols(out[i], out[i], cfg.col.cos_bit,
- cfg.col.stage_range, bd);
+ HIGH_IHT_16[tx_type].cols(tmp[i], out[i], bd);
}
#if CONFIG_EXT_TX
@@ -2465,18 +2323,18 @@ void av1_highbd_iht16x16_256_add_c(const tran_low_t *input, uint8_t *dest8,
static void highbd_iht32x32_1024_add_c(const tran_low_t *input, uint8_t *dest8,
int stride, int tx_type, int bd) {
static const highbd_transform_2d HIGH_IHT_32[] = {
- { highbd_idct32, highbd_idct32 }, // DCT_DCT
- { highbd_ihalfright32_c, highbd_idct32 }, // ADST_DCT
- { highbd_idct32, highbd_ihalfright32_c }, // DCT_ADST
+ { aom_highbd_idct32_c, aom_highbd_idct32_c }, // DCT_DCT
+ { highbd_ihalfright32_c, aom_highbd_idct32_c }, // ADST_DCT
+ { aom_highbd_idct32_c, highbd_ihalfright32_c }, // DCT_ADST
{ highbd_ihalfright32_c, highbd_ihalfright32_c }, // ADST_ADST
- { highbd_ihalfright32_c, highbd_idct32 }, // FLIPADST_DCT
- { highbd_idct32, highbd_ihalfright32_c }, // DCT_FLIPADST
+ { highbd_ihalfright32_c, aom_highbd_idct32_c }, // FLIPADST_DCT
+ { aom_highbd_idct32_c, highbd_ihalfright32_c }, // DCT_FLIPADST
{ highbd_ihalfright32_c, highbd_ihalfright32_c }, // FLIPADST_FLIPADST
{ highbd_ihalfright32_c, highbd_ihalfright32_c }, // ADST_FLIPADST
{ highbd_ihalfright32_c, highbd_ihalfright32_c }, // FLIPADST_ADST
{ highbd_iidtx32_c, highbd_iidtx32_c }, // IDTX
- { highbd_idct32, highbd_iidtx32_c }, // V_DCT
- { highbd_iidtx32_c, highbd_idct32 }, // H_DCT
+ { aom_highbd_idct32_c, highbd_iidtx32_c }, // V_DCT
+ { highbd_iidtx32_c, aom_highbd_idct32_c }, // H_DCT
{ highbd_ihalfright32_c, highbd_iidtx32_c }, // V_ADST
{ highbd_iidtx32_c, highbd_ihalfright32_c }, // H_ADST
{ highbd_ihalfright32_c, highbd_iidtx32_c }, // V_FLIPADST
@@ -2486,33 +2344,27 @@ static void highbd_iht32x32_1024_add_c(const tran_low_t *input, uint8_t *dest8,
uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
int i, j;
- tran_low_t tmp;
+ tran_low_t tmp[32][32];
tran_low_t out[32][32];
tran_low_t *outp = &out[0][0];
int outstride = 32;
- tx_2d_cfg cfg = inv_tx_cfg(tx_type, TX_32X32, TX_32X32);
-
// inverse transform row vectors
for (i = 0; i < 32; ++i) {
- HIGH_IHT_32[tx_type].rows(input, out[i], cfg.row.cos_bit,
- cfg.row.stage_range, bd);
+ HIGH_IHT_32[tx_type].rows(input, out[i], bd);
input += 32;
}
// transpose
- for (i = 1; i < 32; i++) {
- for (j = 0; j < i; j++) {
- tmp = out[i][j];
- out[i][j] = out[j][i];
- out[j][i] = tmp;
+ for (i = 0; i < 32; i++) {
+ for (j = 0; j < 32; j++) {
+ tmp[j][i] = out[i][j];
}
}
// inverse transform column vectors
for (i = 0; i < 32; ++i) {
- HIGH_IHT_32[tx_type].cols(out[i], out[i], cfg.col.cos_bit,
- cfg.col.stage_range, bd);
+ HIGH_IHT_32[tx_type].cols(tmp[i], out[i], bd);
}
maybe_flip_strides16(&dest, &stride, &outp, &outstride, tx_type, 32, 32);
@@ -2556,34 +2408,28 @@ static void highbd_iht64x64_4096_add_c(const tran_low_t *input, uint8_t *dest8,
uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
int i, j;
- tran_low_t tmp;
+ tran_low_t tmp[64][64];
tran_low_t out[64][64];
tran_low_t *outp = &out[0][0];
int outstride = 64;
- tx_2d_cfg cfg = inv_tx_cfg(tx_type, TX_64X64, TX_64X64);
-
// inverse transform row vectors
for (i = 0; i < 64; ++i) {
- HIGH_IHT_64[tx_type].rows(input, out[i], cfg.row.cos_bit,
- cfg.row.stage_range, bd);
+ HIGH_IHT_64[tx_type].rows(input, out[i], bd);
for (j = 0; j < 64; ++j) out[i][j] = ROUND_POWER_OF_TWO(out[i][j], 1);
input += 64;
}
// transpose
- for (i = 1; i < 64; i++) {
- for (j = 0; j < i; j++) {
- tmp = out[i][j];
- out[i][j] = out[j][i];
- out[j][i] = tmp;
+ for (i = 0; i < 64; i++) {
+ for (j = 0; j < 64; j++) {
+ tmp[j][i] = out[i][j];
}
}
// inverse transform column vectors
for (i = 0; i < 64; ++i) {
- HIGH_IHT_64[tx_type].cols(out[i], out[i], cfg.col.cos_bit_col,
- cfg.col.stage_range, bd);
+ HIGH_IHT_64[tx_type].cols(tmp[i], out[i], bd);
}
#if CONFIG_EXT_TX
@@ -2619,7 +2465,7 @@ void av1_highbd_iwht4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
aom_highbd_iwht4x4_1_add(input, dest, stride, bd);
}
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
static void highbd_inv_txfm_add_2x2(const tran_low_t *input, uint8_t *dest,
int stride, int eob, int bd,
TX_TYPE tx_type, int lossless) {
@@ -2907,21 +2753,21 @@ static void highbd_inv_txfm_add_64x64(const tran_low_t *input, uint8_t *dest,
#endif // CONFIG_HIGHBITDEPTH
void av1_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride,
- INV_TXFM_PARAM *inv_txfm_param) {
- const TX_TYPE tx_type = inv_txfm_param->tx_type;
- const TX_SIZE tx_size = inv_txfm_param->tx_size;
- const int eob = inv_txfm_param->eob;
- const int lossless = inv_txfm_param->lossless;
+ INV_TXFM_PARAM *param) {
+ const TX_TYPE tx_type = param->tx_type;
+ const TX_SIZE tx_size = param->tx_size;
+ const int eob = param->eob;
+ const int lossless = param->lossless;
switch (tx_size) {
#if CONFIG_TX64X64
- case TX_64X64: inv_txfm_add_64x64(input, dest, stride, eob, tx_type); break;
+ case TX_64X64: inv_txfm_add_64x64(input, dest, stride, param); break;
#endif // CONFIG_TX64X64
- case TX_32X32: inv_txfm_add_32x32(input, dest, stride, eob, tx_type); break;
- case TX_16X16: inv_txfm_add_16x16(input, dest, stride, eob, tx_type); break;
- case TX_8X8: inv_txfm_add_8x8(input, dest, stride, eob, tx_type); break;
- case TX_4X8: av1_inv_txfm_add_4x8(input, dest, stride, eob, tx_type); break;
- case TX_8X4: av1_inv_txfm_add_8x4(input, dest, stride, eob, tx_type); break;
+ case TX_32X32: inv_txfm_add_32x32(input, dest, stride, param); break;
+ case TX_16X16: inv_txfm_add_16x16(input, dest, stride, param); break;
+ case TX_8X8: inv_txfm_add_8x8(input, dest, stride, param); break;
+ case TX_4X8: inv_txfm_add_4x8(input, dest, stride, eob, tx_type); break;
+ case TX_8X4: inv_txfm_add_8x4(input, dest, stride, eob, tx_type); break;
case TX_8X16: inv_txfm_add_8x16(input, dest, stride, eob, tx_type); break;
case TX_16X8: inv_txfm_add_16x8(input, dest, stride, eob, tx_type); break;
case TX_16X32: inv_txfm_add_16x32(input, dest, stride, eob, tx_type); break;
@@ -2930,13 +2776,19 @@ void av1_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride,
// this is like av1_short_idct4x4 but has a special case around eob<=1
// which is significant (not just an optimization) for the lossless
// case.
- av1_inv_txfm_add_4x4(input, dest, stride, eob, tx_type, lossless);
+ inv_txfm_add_4x4(input, dest, stride, eob, tx_type, lossless);
break;
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
case TX_2X2:
inv_txfm_add_2x2(input, dest, stride, eob, tx_type, lossless);
break;
#endif
+#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
+ case TX_32X8: inv_txfm_add_32x8(input, dest, stride, eob, tx_type); break;
+ case TX_8X32: inv_txfm_add_8x32(input, dest, stride, eob, tx_type); break;
+ case TX_16X4: inv_txfm_add_16x4(input, dest, stride, eob, tx_type); break;
+ case TX_4X16: inv_txfm_add_4x16(input, dest, stride, eob, tx_type); break;
+#endif
default: assert(0 && "Invalid transform size"); break;
}
}
@@ -2951,7 +2803,8 @@ static void init_inv_txfm_param(const MACROBLOCKD *xd, TX_SIZE tx_size,
inv->bd = xd->bd;
#endif
#if CONFIG_ADAPT_SCAN
- inv->eob_threshold = &xd->eob_threshold_md[tx_size][tx_type][0];
+ inv->eob_threshold =
+ (const int16_t *)&xd->eob_threshold_md[tx_size][tx_type][0];
#endif
}
@@ -2967,7 +2820,6 @@ void av1_inverse_transform_block(const MACROBLOCKD *xd,
int r, c;
#if CONFIG_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
- uint16_t *dst16 = CONVERT_TO_SHORTPTR(dst);
for (r = 0; r < txb_height; r++)
for (c = 0; c < txb_width; c++)
CONVERT_TO_SHORTPTR(dst)[r * stride + c] = 0;
@@ -3056,7 +2908,7 @@ void av1_highbd_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride,
av1_highbd_inv_txfm_add_4x4(input, dest, stride, eob, bd, tx_type,
lossless);
break;
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
case TX_2X2:
highbd_inv_txfm_add_2x2(input, dest, stride, eob, bd, tx_type, lossless);
break;
@@ -3065,3 +2917,157 @@ void av1_highbd_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride,
}
}
#endif // CONFIG_HIGHBITDEPTH
+
+#if CONFIG_DPCM_INTRA
+void av1_dpcm_inv_txfm_add_4_c(const tran_low_t *input, int stride,
+ TX_TYPE_1D tx_type, uint8_t *dest) {
+ assert(tx_type < TX_TYPES_1D);
+ static const transform_1d IHT[] = { aom_idct4_c, aom_iadst4_c, aom_iadst4_c,
+ iidtx4_c };
+ const transform_1d inv_tx = IHT[tx_type];
+ tran_low_t out[4];
+ inv_tx(input, out);
+ for (int i = 0; i < 4; ++i) {
+ out[i] = (tran_low_t)dct_const_round_shift(out[i] * Sqrt2);
+ dest[i * stride] =
+ clip_pixel_add(dest[i * stride], ROUND_POWER_OF_TWO(out[i], 4));
+ }
+}
+
+void av1_dpcm_inv_txfm_add_8_c(const tran_low_t *input, int stride,
+ TX_TYPE_1D tx_type, uint8_t *dest) {
+ assert(tx_type < TX_TYPES_1D);
+ static const transform_1d IHT[] = { aom_idct8_c, aom_iadst8_c, aom_iadst8_c,
+ iidtx8_c };
+ const transform_1d inv_tx = IHT[tx_type];
+ tran_low_t out[8];
+ inv_tx(input, out);
+ for (int i = 0; i < 8; ++i) {
+ dest[i * stride] =
+ clip_pixel_add(dest[i * stride], ROUND_POWER_OF_TWO(out[i], 4));
+ }
+}
+
+void av1_dpcm_inv_txfm_add_16_c(const tran_low_t *input, int stride,
+ TX_TYPE_1D tx_type, uint8_t *dest) {
+ assert(tx_type < TX_TYPES_1D);
+ static const transform_1d IHT[] = { aom_idct16_c, aom_iadst16_c,
+ aom_iadst16_c, iidtx16_c };
+ const transform_1d inv_tx = IHT[tx_type];
+ tran_low_t out[16];
+ inv_tx(input, out);
+ for (int i = 0; i < 16; ++i) {
+ out[i] = (tran_low_t)dct_const_round_shift(out[i] * Sqrt2);
+ dest[i * stride] =
+ clip_pixel_add(dest[i * stride], ROUND_POWER_OF_TWO(out[i], 5));
+ }
+}
+
+void av1_dpcm_inv_txfm_add_32_c(const tran_low_t *input, int stride,
+ TX_TYPE_1D tx_type, uint8_t *dest) {
+ assert(tx_type < TX_TYPES_1D);
+ static const transform_1d IHT[] = { aom_idct32_c, ihalfright32_c,
+ ihalfright32_c, iidtx32_c };
+ const transform_1d inv_tx = IHT[tx_type];
+ tran_low_t out[32];
+ inv_tx(input, out);
+ for (int i = 0; i < 32; ++i) {
+ dest[i * stride] =
+ clip_pixel_add(dest[i * stride], ROUND_POWER_OF_TWO(out[i], 4));
+ }
+}
+
+dpcm_inv_txfm_add_func av1_get_dpcm_inv_txfm_add_func(int tx_length) {
+ switch (tx_length) {
+ case 4: return av1_dpcm_inv_txfm_add_4_c;
+ case 8: return av1_dpcm_inv_txfm_add_8_c;
+ case 16: return av1_dpcm_inv_txfm_add_16_c;
+ case 32:
+ return av1_dpcm_inv_txfm_add_32_c;
+ // TODO(huisu): add support for TX_64X64.
+ default: assert(0); return NULL;
+ }
+}
+
+#if CONFIG_HIGHBITDEPTH
+void av1_hbd_dpcm_inv_txfm_add_4_c(const tran_low_t *input, int stride,
+ TX_TYPE_1D tx_type, int bd, uint16_t *dest) {
+ assert(tx_type < TX_TYPES_1D);
+ static const highbd_transform_1d IHT[] = { aom_highbd_idct4_c,
+ aom_highbd_iadst4_c,
+ aom_highbd_iadst4_c,
+ highbd_iidtx4_c };
+ const highbd_transform_1d inv_tx = IHT[tx_type];
+ tran_low_t out[4];
+ inv_tx(input, out, bd);
+ for (int i = 0; i < 4; ++i) {
+ out[i] = (tran_low_t)dct_const_round_shift(out[i] * Sqrt2);
+ dest[i * stride] = highbd_clip_pixel_add(dest[i * stride],
+ ROUND_POWER_OF_TWO(out[i], 4), bd);
+ }
+}
+
+void av1_hbd_dpcm_inv_txfm_add_8_c(const tran_low_t *input, int stride,
+ TX_TYPE_1D tx_type, int bd, uint16_t *dest) {
+ static const highbd_transform_1d IHT[] = { aom_highbd_idct8_c,
+ aom_highbd_iadst8_c,
+ aom_highbd_iadst8_c,
+ highbd_iidtx8_c };
+ assert(tx_type < TX_TYPES_1D);
+ const highbd_transform_1d inv_tx = IHT[tx_type];
+ tran_low_t out[8];
+ inv_tx(input, out, bd);
+ for (int i = 0; i < 8; ++i) {
+ dest[i * stride] = highbd_clip_pixel_add(dest[i * stride],
+ ROUND_POWER_OF_TWO(out[i], 4), bd);
+ }
+}
+
+void av1_hbd_dpcm_inv_txfm_add_16_c(const tran_low_t *input, int stride,
+ TX_TYPE_1D tx_type, int bd,
+ uint16_t *dest) {
+ assert(tx_type < TX_TYPES_1D);
+ static const highbd_transform_1d IHT[] = { aom_highbd_idct16_c,
+ aom_highbd_iadst16_c,
+ aom_highbd_iadst16_c,
+ highbd_iidtx16_c };
+ const highbd_transform_1d inv_tx = IHT[tx_type];
+ tran_low_t out[16];
+ inv_tx(input, out, bd);
+ for (int i = 0; i < 16; ++i) {
+ out[i] = (tran_low_t)dct_const_round_shift(out[i] * Sqrt2);
+ dest[i * stride] = highbd_clip_pixel_add(dest[i * stride],
+ ROUND_POWER_OF_TWO(out[i], 5), bd);
+ }
+}
+
+void av1_hbd_dpcm_inv_txfm_add_32_c(const tran_low_t *input, int stride,
+ TX_TYPE_1D tx_type, int bd,
+ uint16_t *dest) {
+ assert(tx_type < TX_TYPES_1D);
+ static const highbd_transform_1d IHT[] = { aom_highbd_idct32_c,
+ highbd_ihalfright32_c,
+ highbd_ihalfright32_c,
+ highbd_iidtx32_c };
+ const highbd_transform_1d inv_tx = IHT[tx_type];
+ tran_low_t out[32];
+ inv_tx(input, out, bd);
+ for (int i = 0; i < 32; ++i) {
+ dest[i * stride] = highbd_clip_pixel_add(dest[i * stride],
+ ROUND_POWER_OF_TWO(out[i], 4), bd);
+ }
+}
+
+hbd_dpcm_inv_txfm_add_func av1_get_hbd_dpcm_inv_txfm_add_func(int tx_length) {
+ switch (tx_length) {
+ case 4: return av1_hbd_dpcm_inv_txfm_add_4_c;
+ case 8: return av1_hbd_dpcm_inv_txfm_add_8_c;
+ case 16: return av1_hbd_dpcm_inv_txfm_add_16_c;
+ case 32:
+ return av1_hbd_dpcm_inv_txfm_add_32_c;
+ // TODO(huisu): add support for TX_64X64.
+ default: assert(0); return NULL;
+ }
+}
+#endif // CONFIG_HIGHBITDEPTH
+#endif // CONFIG_DPCM_INTRA
diff --git a/third_party/aom/av1/common/idct.h b/third_party/aom/av1/common/idct.h
index e3a192187..cf656dc53 100644
--- a/third_party/aom/av1/common/idct.h
+++ b/third_party/aom/av1/common/idct.h
@@ -46,9 +46,7 @@ typedef struct {
} 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 void (*highbd_transform_1d)(const tran_low_t *, tran_low_t *, int bd);
typedef struct {
highbd_transform_1d cols, rows; // vertical and horizontal
@@ -63,12 +61,6 @@ void av1_iwht4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
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,
@@ -92,6 +84,33 @@ void av1_highbd_inv_txfm_add_8x4(const tran_low_t *input, uint8_t *dest,
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
+#if CONFIG_DPCM_INTRA
+void av1_dpcm_inv_txfm_add_4_c(const tran_low_t *input, int stride,
+ TX_TYPE_1D tx_type, uint8_t *dest);
+void av1_dpcm_inv_txfm_add_8_c(const tran_low_t *input, int stride,
+ TX_TYPE_1D tx_type, uint8_t *dest);
+void av1_dpcm_inv_txfm_add_16_c(const tran_low_t *input, int stride,
+ TX_TYPE_1D tx_type, uint8_t *dest);
+void av1_dpcm_inv_txfm_add_32_c(const tran_low_t *input, int stride,
+ TX_TYPE_1D tx_type, uint8_t *dest);
+typedef void (*dpcm_inv_txfm_add_func)(const tran_low_t *input, int stride,
+ TX_TYPE_1D tx_type, uint8_t *dest);
+dpcm_inv_txfm_add_func av1_get_dpcm_inv_txfm_add_func(int tx_length);
+#if CONFIG_HIGHBITDEPTH
+void av1_hbd_dpcm_inv_txfm_add_4_c(const tran_low_t *input, int stride,
+ TX_TYPE_1D tx_type, int bd, uint16_t *dest);
+void av1_hbd_dpcm_inv_txfm_add_8_c(const tran_low_t *input, int stride,
+ TX_TYPE_1D tx_type, int bd, uint16_t *dest);
+void av1_hbd_dpcm_inv_txfm_add_16_c(const tran_low_t *input, int stride,
+ TX_TYPE_1D tx_type, int bd, uint16_t *dest);
+void av1_hbd_dpcm_inv_txfm_add_32_c(const tran_low_t *input, int stride,
+ TX_TYPE_1D tx_type, int bd, uint16_t *dest);
+typedef void (*hbd_dpcm_inv_txfm_add_func)(const tran_low_t *input, int stride,
+ TX_TYPE_1D tx_type, int bd,
+ uint16_t *dest);
+hbd_dpcm_inv_txfm_add_func av1_get_hbd_dpcm_inv_txfm_add_func(int tx_length);
+#endif // CONFIG_HIGHBITDEPTH
+#endif // CONFIG_DPCM_INTRA
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/third_party/aom/av1/common/mv.h b/third_party/aom/av1/common/mv.h
index d4df3790f..41a46f5e8 100644
--- a/third_party/aom/av1/common/mv.h
+++ b/third_party/aom/av1/common/mv.h
@@ -58,6 +58,8 @@ typedef struct mv32 {
// Precision of filter taps
#define WARPEDPIXEL_FILTER_BITS 7
+#define WARP_PARAM_REDUCE_BITS 6
+
// Precision bits reduction after horizontal shear
#define HORSHEAR_REDUCE_PREC_BITS 5
#define VERSHEAR_REDUCE_PREC_BITS \
@@ -269,14 +271,12 @@ static INLINE TransformationType get_gmtype(const WarpedMotionParams *gm) {
}
#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;
diff --git a/third_party/aom/av1/common/mvref_common.c b/third_party/aom/av1/common/mvref_common.c
index 5222948c8..d558111b5 100644
--- a/third_party/aom/av1/common/mvref_common.c
+++ b/third_party/aom/av1/common/mvref_common.c
@@ -14,8 +14,6 @@
#include "av1/common/warped_motion.h"
#endif // CONFIG_WARPED_MOTION
-#if CONFIG_REF_MV
-
static uint8_t add_ref_mv_candidate(
const MODE_INFO *const candidate_mi, const MB_MODE_INFO *const candidate,
const MV_REFERENCE_FRAME rf[2], uint8_t *refmv_count,
@@ -556,7 +554,6 @@ static void setup_ref_mv_list(const AV1_COMMON *cm, const MACROBLOCKD *xd,
}
}
}
-#endif
// This function searches the neighbourhood of a given MB/SB
// to try and find candidate reference vectors.
@@ -568,9 +565,6 @@ static void find_mv_refs_idx(const AV1_COMMON *cm, const MACROBLOCKD *xd,
int_mv zeromv) {
const int *ref_sign_bias = cm->ref_frame_sign_bias;
int i, refmv_count = 0;
-#if !CONFIG_REF_MV
- const POSITION *const mv_ref_search = mv_ref_blocks[mi->mbmi.sb_type];
-#endif
int different_ref_found = 0;
int context_counter = 0;
#if CONFIG_MV_COMPRESS
@@ -592,11 +586,13 @@ static void find_mv_refs_idx(const AV1_COMMON *cm, const MACROBLOCKD *xd,
? cm->prev_frame->mvs + mi_row * cm->mi_cols + mi_col
: NULL;
#endif
+#if CONFIG_INTRABC
+ assert(IMPLIES(ref_frame == INTRA_FRAME, cm->use_prev_frame_mvs == 0));
+#endif
const TileInfo *const tile = &xd->tile;
const BLOCK_SIZE bsize = mi->mbmi.sb_type;
const int bw = block_size_wide[AOMMAX(bsize, BLOCK_8X8)];
const int bh = block_size_high[AOMMAX(bsize, BLOCK_8X8)];
-#if CONFIG_REF_MV
POSITION mv_ref_search[MVREF_NEIGHBOURS];
const int num_8x8_blocks_wide = num_8x8_blocks_wide_lookup[bsize];
const int num_8x8_blocks_high = num_8x8_blocks_high_lookup[bsize];
@@ -639,7 +635,6 @@ static void find_mv_refs_idx(const AV1_COMMON *cm, const MACROBLOCKD *xd,
mv_ref_search[i].col *= 2;
}
#endif // CONFIG_CB4X4
-#endif // CONFIG_REF_MV
// The nearest 2 blocks are treated differently
// if the size < 8x8 we get the mv from the bmi substructure,
@@ -673,12 +668,10 @@ static void find_mv_refs_idx(const AV1_COMMON *cm, const MACROBLOCKD *xd,
!xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]
? NULL
: &xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]->mbmi;
-#if CONFIG_REF_MV
if (candidate == NULL) continue;
if ((mi_row % MAX_MIB_SIZE) + mv_ref->row >= MAX_MIB_SIZE ||
(mi_col % MAX_MIB_SIZE) + mv_ref->col >= MAX_MIB_SIZE)
continue;
-#endif
different_ref_found = 1;
if (candidate->ref_frame[0] == ref_frame)
@@ -727,12 +720,10 @@ static void find_mv_refs_idx(const AV1_COMMON *cm, const MACROBLOCKD *xd,
!xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]
? NULL
: &xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]->mbmi;
-#if CONFIG_REF_MV
if (candidate == NULL) continue;
if ((mi_row % MAX_MIB_SIZE) + mv_ref->row >= MAX_MIB_SIZE ||
(mi_col % MAX_MIB_SIZE) + mv_ref->col >= MAX_MIB_SIZE)
continue;
-#endif
// If the candidate is INTRA we don't want to consider its mv.
IF_DIFF_REF_FRAME_ADD_MV(candidate, ref_frame, ref_sign_bias,
@@ -780,50 +771,18 @@ void av1_update_mv_context(const AV1_COMMON *cm, const MACROBLOCKD *xd,
int_mv *mv_ref_list, int block, int mi_row,
int mi_col, int16_t *mode_context) {
int i, refmv_count = 0;
-#if !CONFIG_REF_MV
- const POSITION *const mv_ref_search = mv_ref_blocks[mi->mbmi.sb_type];
-#endif
int context_counter = 0;
const int bw = block_size_wide[mi->mbmi.sb_type];
const int bh = block_size_high[mi->mbmi.sb_type];
const TileInfo *const tile = &xd->tile;
-#if CONFIG_REF_MV
- POSITION mv_ref_search[MVREF_NEIGHBOURS];
+ POSITION mv_ref_search[2];
const int num_8x8_blocks_wide = mi_size_wide[mi->mbmi.sb_type];
const int num_8x8_blocks_high = mi_size_high[mi->mbmi.sb_type];
+
mv_ref_search[0].row = num_8x8_blocks_high - 1;
mv_ref_search[0].col = -1;
mv_ref_search[1].row = -1;
mv_ref_search[1].col = num_8x8_blocks_wide - 1;
- mv_ref_search[2].row = -1;
- mv_ref_search[2].col = (num_8x8_blocks_wide - 1) >> 1;
- mv_ref_search[3].row = (num_8x8_blocks_high - 1) >> 1;
- mv_ref_search[3].col = -1;
- mv_ref_search[4].row = -1;
- mv_ref_search[4].col = -1;
-#if CONFIG_EXT_PARTITION_TYPES
- if (num_8x8_blocks_wide == num_8x8_blocks_high) {
- mv_ref_search[5].row = -1;
- mv_ref_search[5].col = 0;
- mv_ref_search[6].row = 0;
- mv_ref_search[6].col = -1;
- } else {
- mv_ref_search[5].row = -1;
- mv_ref_search[5].col = num_8x8_blocks_wide;
- mv_ref_search[6].row = num_8x8_blocks_high;
- mv_ref_search[6].col = -1;
- }
-#else
- mv_ref_search[5].row = -1;
- mv_ref_search[5].col = num_8x8_blocks_wide;
- mv_ref_search[6].row = num_8x8_blocks_high;
- mv_ref_search[6].col = -1;
-#endif // CONFIG_EXT_PARTITION_TYPES
- mv_ref_search[7].row = -1;
- mv_ref_search[7].col = -3;
- mv_ref_search[8].row = num_8x8_blocks_high - 1;
- mv_ref_search[8].col = -3;
-#endif
// Blank the reference vector list
memset(mv_ref_list, 0, sizeof(*mv_ref_list) * MAX_MV_REF_CANDIDATES);
@@ -859,12 +818,10 @@ Done:
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) {
@@ -872,23 +829,17 @@ void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
#if CONFIG_GLOBAL_MOTION
BLOCK_SIZE bsize = mi->mbmi.sb_type;
#endif // CONFIG_GLOBAL_MOTION
-#if CONFIG_REF_MV
int idx, all_zero = 1;
#if CONFIG_GLOBAL_MOTION
MV_REFERENCE_FRAME rf[2];
#endif // CONFIG_GLOBAL_MOTION
-#endif // CONFIG_REF_MV
+
#if CONFIG_EXT_INTER
av1_update_mv_context(cm, xd, mi, ref_frame, mv_ref_list, -1, mi_row, mi_col,
-#if CONFIG_REF_MV
compound_mode_context);
-#else
- mode_context);
-#endif // CONFIG_REF_MV
#endif // CONFIG_EXT_INTER
#if CONFIG_GLOBAL_MOTION
-#if CONFIG_REF_MV
av1_set_ref_frame(rf, ref_frame);
zeromv[0].as_int = gm_get_motion_vector(&cm->global_motion[rf[0]],
cm->allow_high_precision_mv, bsize,
@@ -901,23 +852,13 @@ void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
.as_int
: 0;
#else
- zeromv[0].as_int = gm_get_motion_vector(&cm->global_motion[ref_frame],
- cm->allow_high_precision_mv, bsize,
- mi_col, mi_row, 0)
- .as_int;
- zeromv[1].as_int = 0;
-#endif // CONFIG_REF_MV
-#else
zeromv[0].as_int = zeromv[1].as_int = 0;
#endif // CONFIG_GLOBAL_MOTION
-#if CONFIG_REF_MV
if (ref_frame <= ALTREF_FRAME)
-#endif // CONFIG_REF_MV
find_mv_refs_idx(cm, xd, mi, ref_frame, mv_ref_list, -1, mi_row, mi_col,
sync, data, mode_context, zeromv[0]);
-#if CONFIG_REF_MV
setup_ref_mv_list(cm, xd, ref_frame, ref_mv_count, ref_mv_stack, mv_ref_list,
-1, mi_row, mi_col, mode_context);
/* Note: If global motion is enabled, then we want to set the ALL_ZERO flag
@@ -947,7 +888,6 @@ void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
}
if (all_zero) mode_context[ref_frame] |= (1 << ALL_ZERO_FLAG_OFFSET);
-#endif
}
void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_mv,
@@ -963,10 +903,8 @@ void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_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
@@ -978,13 +916,11 @@ void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd,
b_mode_info *bmi = mi->bmi;
int n;
int_mv zeromv;
-#if CONFIG_REF_MV
CANDIDATE_MV tmp_mv;
uint8_t idx;
uint8_t above_count = 0, left_count = 0;
MV_REFERENCE_FRAME rf[2] = { mi->mbmi.ref_frame[ref], NONE_FRAME };
*ref_mv_count = 0;
-#endif
assert(MAX_MV_REF_CANDIDATES == 2);
@@ -999,7 +935,6 @@ void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd,
find_mv_refs_idx(cm, xd, mi, mi->mbmi.ref_frame[ref], mv_list, block, mi_row,
mi_col, NULL, NULL, NULL, zeromv);
-#if CONFIG_REF_MV
scan_blk_mbmi(cm, xd, mi_row, mi_col, block, rf, -1, 0, ref_mv_stack,
ref_mv_count);
above_count = *ref_mv_count;
@@ -1020,7 +955,6 @@ void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd,
for (idx = 0; idx < AOMMIN(MAX_MV_REF_CANDIDATES, *ref_mv_count); ++idx)
mv_list[idx].as_int = ref_mv_stack[idx].this_mv.as_int;
-#endif
near_mv->as_int = 0;
switch (block) {
diff --git a/third_party/aom/av1/common/mvref_common.h b/third_party/aom/av1/common/mvref_common.h
index 01f74b77a..ec5edeeab 100644
--- a/third_party/aom/av1/common/mvref_common.h
+++ b/third_party/aom/av1/common/mvref_common.h
@@ -18,11 +18,7 @@
extern "C" {
#endif
-#if CONFIG_REF_MV
#define MVREF_NEIGHBOURS 9
-#else
-#define MVREF_NEIGHBOURS 8
-#endif
typedef struct position {
int row;
@@ -45,7 +41,7 @@ typedef enum {
// 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] = {
+static const int mode_2_counter[] = {
9, // DC_PRED
9, // V_PRED
9, // H_PRED
@@ -56,7 +52,11 @@ static const int mode_2_counter[MB_MODE_COUNT] = {
9, // D207_PRED
9, // D63_PRED
#if CONFIG_ALT_INTRA
- 9, // SMOOTH_PRED
+ 9, // SMOOTH_PRED
+#if CONFIG_SMOOTH_HV
+ 9, // SMOOTH_V_PRED
+ 9, // SMOOTH_H_PRED
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
9, // TM_PRED
0, // NEARESTMV
@@ -72,8 +72,6 @@ static const int mode_2_counter[MB_MODE_COUNT] = {
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
@@ -109,158 +107,6 @@ static const int counter_to_context[19] = {
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 }
};
@@ -283,20 +129,11 @@ static INLINE void clamp_mv_ref(MV *mv, int bw, int bh, const MACROBLOCKD *xd) {
// 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) {
@@ -304,7 +141,6 @@ static INLINE int_mv get_sub_block_pred_mv(const MODE_INFO *candidate,
(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,
@@ -384,7 +220,6 @@ static INLINE void lower_mv_precision(MV *mv, int allow_hp) {
}
}
-#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 &&
@@ -434,8 +269,12 @@ static INLINE void av1_set_ref_frame(MV_REFERENCE_FRAME *rf,
} else {
rf[0] = ref_frame_type;
rf[1] = NONE_FRAME;
- assert(ref_frame_type > INTRA_FRAME &&
- ref_frame_type < TOTAL_REFS_PER_FRAME);
+#if CONFIG_INTRABC
+ assert(ref_frame_type > NONE_FRAME);
+#else
+ assert(ref_frame_type > INTRA_FRAME);
+#endif
+ assert(ref_frame_type < TOTAL_REFS_PER_FRAME);
}
}
@@ -477,17 +316,14 @@ static INLINE uint8_t av1_drl_ctx(const CANDIDATE_MV *ref_mv_stack,
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);
@@ -500,10 +336,8 @@ void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_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
diff --git a/third_party/aom/av1/common/odintrin.h b/third_party/aom/av1/common/odintrin.h
index fe99d8003..3a778abbd 100644
--- a/third_party/aom/av1/common/odintrin.h
+++ b/third_party/aom/av1/common/odintrin.h
@@ -14,6 +14,9 @@
#ifndef AV1_COMMON_ODINTRIN_H_
#define AV1_COMMON_ODINTRIN_H_
+#if defined(_MSC_VER)
+# define _USE_MATH_DEFINES
+#endif
#include <math.h>
#include <stdlib.h>
#include <string.h>
diff --git a/third_party/aom/av1/common/onyxc_int.h b/third_party/aom/av1/common/onyxc_int.h
index 7980bde39..38750c475 100644
--- a/third_party/aom/av1/common/onyxc_int.h
+++ b/third_party/aom/av1/common/onyxc_int.h
@@ -100,9 +100,7 @@ typedef enum {
typedef struct {
int_mv mv[2];
-#if CONFIG_REF_MV
int_mv pred_mv[2];
-#endif
MV_REFERENCE_FRAME ref_frame[2];
} MV_REF;
@@ -163,12 +161,6 @@ typedef struct AV1Common {
int last_width;
int last_height;
-#if CONFIG_FRAME_SUPERRES
- // The numerator of the superres scale, the denominator is fixed
- uint8_t superres_scale_numerator;
- int superres_width, superres_height;
-#endif // CONFIG_FRAME_SUPERRES
-
// TODO(jkoleszar): this implies chroma ss right now, but could vary per
// plane. Revisit as part of the future change to YV12_BUFFER_CONFIG to
// support additional planes.
@@ -216,9 +208,17 @@ typedef struct AV1Common {
int allow_high_precision_mv;
-#if CONFIG_PALETTE
+#if CONFIG_PALETTE || CONFIG_INTRABC
int allow_screen_content_tools;
-#endif // CONFIG_PALETTE
+#endif // CONFIG_PALETTE || CONFIG_INTRABC
+#if CONFIG_EXT_INTER
+#if CONFIG_INTERINTRA
+ int allow_interintra_compound;
+#endif // CONFIG_INTERINTRA
+#if CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT
+ int allow_masked_compound;
+#endif // CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT
+#endif // CONFIG_EXT_INTER
// Flag signaling which frame contexts should be reset to default values.
RESET_FRAME_CONTEXT_MODE reset_frame_context;
@@ -242,15 +242,15 @@ typedef struct AV1Common {
#if CONFIG_AOM_QM
// Global quant matrix tables
- qm_val_t *giqmatrix[NUM_QM_LEVELS][2][2][TX_SIZES];
- qm_val_t *gqmatrix[NUM_QM_LEVELS][2][2][TX_SIZES];
+ qm_val_t *giqmatrix[NUM_QM_LEVELS][2][2][TX_SIZES_ALL];
+ qm_val_t *gqmatrix[NUM_QM_LEVELS][2][2][TX_SIZES_ALL];
// Local quant matrix tables for each frame
- qm_val_t *y_iqmatrix[MAX_SEGMENTS][2][TX_SIZES];
- qm_val_t *uv_iqmatrix[MAX_SEGMENTS][2][TX_SIZES];
+ qm_val_t *y_iqmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
+ qm_val_t *uv_iqmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
// Encoder
- qm_val_t *y_qmatrix[MAX_SEGMENTS][2][TX_SIZES];
- qm_val_t *uv_qmatrix[MAX_SEGMENTS][2][TX_SIZES];
+ qm_val_t *y_qmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
+ qm_val_t *uv_qmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
int using_qmatrix;
int min_qmlevel;
@@ -299,6 +299,10 @@ typedef struct AV1Common {
InterpFilter interp_filter;
loop_filter_info_n lf_info;
+#if CONFIG_FRAME_SUPERRES
+ // The numerator of the superres scale; the denominator is fixed.
+ uint8_t superres_scale_numerator;
+#endif // CONFIG_FRAME_SUPERRES
#if CONFIG_LOOP_RESTORATION
RestorationInfo rst_info[MAX_MB_PLANE];
RestorationInternal rst_internal;
@@ -331,21 +335,10 @@ typedef struct AV1Common {
FRAME_CONTEXT *fc; /* this frame entropy */
FRAME_CONTEXT *frame_contexts; // FRAME_CONTEXTS
+ FRAME_CONTEXT *pre_fc; // Context referenced in this frame
unsigned int frame_context_idx; /* Context to use/update */
FRAME_COUNTS counts;
-#if CONFIG_SUBFRAME_PROB_UPDATE
- // The initial probabilities for a frame, before any subframe backward update,
- // and after forward update.
- av1_coeff_probs_model starting_coef_probs[TX_SIZES][PLANE_TYPES];
- // Number of subframe backward updates already done
- uint8_t coef_probs_update_idx;
- // Signal if the backward update is subframe or end-of-frame
- uint8_t partial_prob_update;
- // Frame level flag to turn on/off subframe backward update
- uint8_t do_subframe_update;
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
-
unsigned int current_video_frame;
BITSTREAM_PROFILE profile;
@@ -393,7 +386,8 @@ typedef struct AV1Common {
ENTROPY_CONTEXT *above_context[MAX_MB_PLANE];
#if CONFIG_VAR_TX
TXFM_CONTEXT *above_txfm_context;
- TXFM_CONTEXT left_txfm_context[MAX_MIB_SIZE];
+ TXFM_CONTEXT *top_txfm_context[MAX_MB_PLANE];
+ TXFM_CONTEXT left_txfm_context[MAX_MB_PLANE][2 * MAX_MIB_SIZE];
#endif
int above_context_alloc_cols;
@@ -576,17 +570,20 @@ static INLINE void av1_init_macroblockd(AV1_COMMON *cm, MACROBLOCKD *xd,
static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col) {
int i;
+ int row_offset = mi_row;
+ int col_offset = mi_col;
for (i = 0; i < MAX_MB_PLANE; ++i) {
struct macroblockd_plane *const pd = &xd->plane[i];
#if CONFIG_CHROMA_SUB8X8
if (xd->mi[0]->mbmi.sb_type < BLOCK_8X8) {
// Offset the buffer pointer
- if (pd->subsampling_y && (mi_row & 0x01)) mi_row -= 1;
- if (pd->subsampling_x && (mi_col & 0x01)) mi_col -= 1;
+ if (pd->subsampling_y && (mi_row & 0x01)) row_offset = mi_row - 1;
+ if (pd->subsampling_x && (mi_col & 0x01)) col_offset = mi_col - 1;
}
#endif
- int above_idx = mi_col * 2;
- int left_idx = (mi_row * 2) & MAX_MIB_MASK_2;
+ int above_idx = col_offset << (MI_SIZE_LOG2 - tx_size_wide_log2[0]);
+ int left_idx = (row_offset & MAX_MIB_MASK)
+ << (MI_SIZE_LOG2 - tx_size_high_log2[0]);
pd->above_context = &xd->above_context[i][above_idx >> pd->subsampling_x];
pd->left_context = &xd->left_context[i][left_idx >> pd->subsampling_y];
}
@@ -668,14 +665,12 @@ static INLINE void set_mi_row_col(MACROBLOCKD *xd, const TileInfo *const tile,
xd->n8_h = bh;
xd->n8_w = bw;
-#if CONFIG_REF_MV
xd->is_sec_rect = 0;
if (xd->n8_w < xd->n8_h)
if (mi_col & (xd->n8_h - 1)) xd->is_sec_rect = 1;
if (xd->n8_w > xd->n8_h)
if (mi_row & (xd->n8_w - 1)) xd->is_sec_rect = 1;
-#endif // CONFIG_REF_MV
}
static INLINE const aom_prob *get_y_mode_probs(const AV1_COMMON *cm,
@@ -688,7 +683,6 @@ static INLINE const aom_prob *get_y_mode_probs(const AV1_COMMON *cm,
return cm->kf_y_prob[above][left];
}
-#if CONFIG_EC_MULTISYMBOL
static INLINE aom_cdf_prob *get_y_mode_cdf(FRAME_CONTEXT *tile_ctx,
const MODE_INFO *mi,
const MODE_INFO *above_mi,
@@ -698,7 +692,6 @@ static INLINE aom_cdf_prob *get_y_mode_cdf(FRAME_CONTEXT *tile_ctx,
const PREDICTION_MODE left = av1_left_block_mode(mi, left_mi, block);
return tile_ctx->kf_y_cdf[above][left];
}
-#endif
static INLINE void update_partition_context(MACROBLOCKD *xd, int mi_row,
int mi_col, BLOCK_SIZE subsize,
@@ -873,8 +866,8 @@ static INLINE void av1_zero_above_context(AV1_COMMON *const cm,
const int width = mi_col_end - mi_col_start;
const int aligned_width = ALIGN_POWER_OF_TWO(width, cm->mib_size_log2);
- const int offset_y = 2 * mi_col_start;
- const int width_y = 2 * aligned_width;
+ const int offset_y = mi_col_start << (MI_SIZE_LOG2 - tx_size_wide_log2[0]);
+ const int width_y = aligned_width << (MI_SIZE_LOG2 - tx_size_wide_log2[0]);
const int offset_uv = offset_y >> cm->subsampling_x;
const int width_uv = width_y >> cm->subsampling_x;
@@ -885,7 +878,8 @@ static INLINE void av1_zero_above_context(AV1_COMMON *const cm,
av1_zero_array(cm->above_seg_context + mi_col_start, aligned_width);
#if CONFIG_VAR_TX
- av1_zero_array(cm->above_txfm_context + mi_col_start, aligned_width);
+ av1_zero_array(cm->above_txfm_context + (mi_col_start << TX_UNIT_WIDE_LOG2),
+ aligned_width << TX_UNIT_WIDE_LOG2);
#endif // CONFIG_VAR_TX
}
@@ -899,7 +893,7 @@ static INLINE void av1_zero_left_context(MACROBLOCKD *const xd) {
#if CONFIG_VAR_TX
static INLINE TX_SIZE get_min_tx_size(TX_SIZE tx_size) {
- if (tx_size >= TX_SIZES_ALL) assert(0);
+ assert(tx_size < TX_SIZES_ALL);
return txsize_sqr_map[tx_size];
}
@@ -918,16 +912,16 @@ static INLINE void set_txfm_ctxs(TX_SIZE tx_size, int n8_w, int n8_h, int skip,
bh = n8_h * MI_SIZE;
}
- set_txfm_ctx(xd->above_txfm_context, bw, n8_w);
- set_txfm_ctx(xd->left_txfm_context, bh, n8_h);
+ set_txfm_ctx(xd->above_txfm_context, bw, n8_w << TX_UNIT_WIDE_LOG2);
+ set_txfm_ctx(xd->left_txfm_context, bh, n8_h << TX_UNIT_HIGH_LOG2);
}
static INLINE void txfm_partition_update(TXFM_CONTEXT *above_ctx,
TXFM_CONTEXT *left_ctx,
TX_SIZE tx_size, TX_SIZE txb_size) {
BLOCK_SIZE bsize = txsize_to_bsize[txb_size];
- int bh = mi_size_high[bsize];
- int bw = mi_size_wide[bsize];
+ int bh = mi_size_high[bsize] << TX_UNIT_HIGH_LOG2;
+ int bw = mi_size_wide[bsize] << TX_UNIT_WIDE_LOG2;
uint8_t txw = tx_size_wide[tx_size];
uint8_t txh = tx_size_high[tx_size];
int i;
@@ -935,6 +929,21 @@ static INLINE void txfm_partition_update(TXFM_CONTEXT *above_ctx,
for (i = 0; i < bw; ++i) above_ctx[i] = txw;
}
+static INLINE TX_SIZE get_sqr_tx_size(int tx_dim) {
+ TX_SIZE tx_size;
+ switch (tx_dim) {
+#if CONFIG_EXT_PARTITION
+ case 128:
+#endif
+ case 64:
+ case 32: tx_size = TX_32X32; break;
+ case 16: tx_size = TX_16X16; break;
+ case 8: tx_size = TX_8X8; break;
+ default: tx_size = TX_4X4;
+ }
+ return tx_size;
+}
+
static INLINE int txfm_partition_context(TXFM_CONTEXT *above_ctx,
TXFM_CONTEXT *left_ctx,
BLOCK_SIZE bsize, TX_SIZE tx_size) {
@@ -942,22 +951,13 @@ static INLINE int txfm_partition_context(TXFM_CONTEXT *above_ctx,
const uint8_t txh = tx_size_high[tx_size];
const int above = *above_ctx < txw;
const int left = *left_ctx < txh;
- TX_SIZE max_tx_size = max_txsize_lookup[bsize];
int category = TXFM_PARTITION_CONTEXTS - 1;
// dummy return, not used by others.
if (tx_size <= TX_4X4) return 0;
- switch (AOMMAX(block_size_wide[bsize], block_size_high[bsize])) {
-#if CONFIG_EXT_PARTITION
- case 128:
-#endif
- case 64:
- case 32: max_tx_size = TX_32X32; break;
- case 16: max_tx_size = TX_16X16; break;
- case 8: max_tx_size = TX_8X8; break;
- default: assert(0);
- }
+ TX_SIZE max_tx_size =
+ get_sqr_tx_size(AOMMAX(block_size_wide[bsize], block_size_high[bsize]));
if (max_tx_size >= TX_8X8) {
category = (tx_size != max_tx_size && max_tx_size > TX_8X8) +
diff --git a/third_party/aom/av1/common/pred_common.c b/third_party/aom/av1/common/pred_common.c
index 905dd3afe..51c343d19 100644
--- a/third_party/aom/av1/common/pred_common.c
+++ b/third_party/aom/av1/common/pred_common.c
@@ -153,6 +153,48 @@ int av1_get_pred_context_intra_interp(const MACROBLOCKD *xd) {
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
+#if CONFIG_PALETTE && CONFIG_PALETTE_DELTA_ENCODING
+int av1_get_palette_cache(const MODE_INFO *above_mi, const MODE_INFO *left_mi,
+ int plane, uint16_t *cache) {
+ int above_n = 0, left_n = 0;
+ if (above_mi)
+ above_n = above_mi->mbmi.palette_mode_info.palette_size[plane != 0];
+ if (left_mi)
+ left_n = left_mi->mbmi.palette_mode_info.palette_size[plane != 0];
+ if (above_n == 0 && left_n == 0) return 0;
+ int above_idx = plane * PALETTE_MAX_SIZE;
+ int left_idx = plane * PALETTE_MAX_SIZE;
+ int n = 0;
+ const uint16_t *above_colors =
+ above_mi->mbmi.palette_mode_info.palette_colors;
+ const uint16_t *left_colors = left_mi->mbmi.palette_mode_info.palette_colors;
+ // Merge the sorted lists of base colors from above and left to get
+ // combined sorted color cache.
+ while (above_n > 0 && left_n > 0) {
+ uint16_t v_above = above_colors[above_idx];
+ uint16_t v_left = left_colors[left_idx];
+ if (v_left < v_above) {
+ if (n == 0 || v_left != cache[n - 1]) cache[n++] = v_left;
+ ++left_idx, --left_n;
+ } else {
+ if (n == 0 || v_above != cache[n - 1]) cache[n++] = v_above;
+ ++above_idx, --above_n;
+ if (v_left == v_above) ++left_idx, --left_n;
+ }
+ }
+ while (above_n-- > 0) {
+ uint16_t val = above_colors[above_idx++];
+ if (n == 0 || val != cache[n - 1]) cache[n++] = val;
+ }
+ while (left_n-- > 0) {
+ uint16_t val = left_colors[left_idx++];
+ if (n == 0 || val != cache[n - 1]) cache[n++] = val;
+ }
+ assert(n <= 2 * PALETTE_MAX_SIZE);
+ return n;
+}
+#endif // CONFIG_PALETTE && CONFIG_PALETTE_DELTA_ENCODING
+
// The mode info data structure has a one element border above and to the
// left of the entries corresponding to real macroblocks.
// The prediction flags in these dummy entries are initialized to 0.
@@ -278,7 +320,7 @@ int av1_get_reference_mode_context(const AV1_COMMON *cm,
//
// NOTE(zoeliu): The probability of ref_frame[0] is either
// GOLDEN_FRAME or LAST3_FRAME.
-#if CONFIG_LOWDELAY_COMPOUND
+#if CONFIG_ONE_SIDED_COMPOUND
int av1_get_pred_context_comp_ref_p(UNUSED const AV1_COMMON *cm,
const MACROBLOCKD *xd) {
#else
@@ -295,7 +337,7 @@ int av1_get_pred_context_comp_ref_p(const AV1_COMMON *cm,
// The mode info data structure has a one element border above and to the
// left of the entries correpsonding to real macroblocks.
// The prediction flags in these dummy entries are initialised to 0.
-#if CONFIG_LOWDELAY_COMPOUND // No change to bitstream
+#if CONFIG_ONE_SIDED_COMPOUND // No change to bitstream
// Code seems to assume that signbias of cm->comp_bwd_ref[0] is always 1
const int bwd_ref_sign_idx = 1;
#else
@@ -388,7 +430,7 @@ int av1_get_pred_context_comp_ref_p(const AV1_COMMON *cm,
//
// NOTE(zoeliu): The probability of ref_frame[0] is LAST_FRAME,
// conditioning on it is either LAST_FRAME or LAST2_FRAME.
-#if CONFIG_LOWDELAY_COMPOUND
+#if CONFIG_ONE_SIDED_COMPOUND
int av1_get_pred_context_comp_ref_p1(UNUSED const AV1_COMMON *cm,
const MACROBLOCKD *xd) {
#else
@@ -405,7 +447,7 @@ int av1_get_pred_context_comp_ref_p1(const AV1_COMMON *cm,
// The mode info data structure has a one element border above and to the
// left of the entries correpsonding to real macroblocks.
// The prediction flags in these dummy entries are initialised to 0.
-#if CONFIG_LOWDELAY_COMPOUND // No change to bitstream
+#if CONFIG_ONE_SIDED_COMPOUND // No change to bitstream
// Code seems to assume that signbias of cm->comp_bwd_ref[0] is always 1
const int bwd_ref_sign_idx = 1;
#else
@@ -499,7 +541,7 @@ int av1_get_pred_context_comp_ref_p1(const AV1_COMMON *cm,
//
// NOTE(zoeliu): The probability of ref_frame[0] is GOLDEN_FRAME,
// conditioning on it is either GOLDEN or LAST3.
-#if CONFIG_LOWDELAY_COMPOUND
+#if CONFIG_ONE_SIDED_COMPOUND
int av1_get_pred_context_comp_ref_p2(UNUSED const AV1_COMMON *cm,
const MACROBLOCKD *xd) {
#else
@@ -516,7 +558,7 @@ int av1_get_pred_context_comp_ref_p2(const AV1_COMMON *cm,
// The mode info data structure has a one element border above and to the
// left of the entries correpsonding to real macroblocks.
// The prediction flags in these dummy entries are initialised to 0.
-#if CONFIG_LOWDELAY_COMPOUND // No change to bitstream
+#if CONFIG_ONE_SIDED_COMPOUND // No change to bitstream
// Code seems to assume that signbias of cm->comp_bwd_ref[0] is always 1
const int bwd_ref_sign_idx = 1;
#else
@@ -604,7 +646,7 @@ int av1_get_pred_context_comp_ref_p2(const AV1_COMMON *cm,
}
// Returns a context number for the given MB prediction signal
-#if CONFIG_LOWDELAY_COMPOUND
+#if CONFIG_ONE_SIDED_COMPOUND
int av1_get_pred_context_comp_bwdref_p(UNUSED const AV1_COMMON *cm,
const MACROBLOCKD *xd) {
#else
@@ -621,7 +663,7 @@ int av1_get_pred_context_comp_bwdref_p(const AV1_COMMON *cm,
// The mode info data structure has a one element border above and to the
// left of the entries corresponding to real macroblocks.
// The prediction flags in these dummy entries are initialized to 0.
-#if CONFIG_LOWDELAY_COMPOUND // No change to bitstream
+#if CONFIG_ONE_SIDED_COMPOUND // No change to bitstream
// Code seems to assume that signbias of cm->comp_bwd_ref[0] is always 1
const int bwd_ref_sign_idx = 1;
#else
diff --git a/third_party/aom/av1/common/pred_common.h b/third_party/aom/av1/common/pred_common.h
index e16ad70f6..ecbe12f7f 100644
--- a/third_party/aom/av1/common/pred_common.h
+++ b/third_party/aom/av1/common/pred_common.h
@@ -79,6 +79,15 @@ int av1_get_pred_context_intra_interp(const MACROBLOCKD *xd);
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
+#if CONFIG_PALETTE && CONFIG_PALETTE_DELTA_ENCODING
+// Get a list of palette base colors that are used in the above and left blocks,
+// referred to as "color cache". The return value is the number of colors in the
+// cache (<= 2 * PALETTE_MAX_SIZE). The color values are stored in "cache"
+// in ascending order.
+int av1_get_palette_cache(const MODE_INFO *above_mi, const MODE_INFO *left_mi,
+ int plane, uint16_t *cache);
+#endif // CONFIG_PALETTE && CONFIG_PALETTE_DELTA_ENCODING
+
int av1_get_intra_inter_context(const MACROBLOCKD *xd);
static INLINE aom_prob av1_get_intra_inter_prob(const AV1_COMMON *cm,
@@ -197,13 +206,7 @@ static INLINE int get_tx_size_context(const MACROBLOCKD *xd) {
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
+ return (above_ctx + left_ctx) > max_tx_size + TX_SIZE_LUMA_MIN;
}
#if CONFIG_VAR_TX
@@ -222,7 +225,9 @@ static void update_tx_counts(AV1_COMMON *cm, MACROBLOCKD *xd,
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];
+ int depth;
+ depth = tx_size_to_depth(tx_size);
+ ++xd->counts->tx_size[max_tx_size - TX_SIZE_CTX_MIN][ctx][depth];
mbmi->tx_size = tx_size;
} else {
int bsl = b_width_log2_lookup[bsize];
diff --git a/third_party/aom/av1/common/quant_common.c b/third_party/aom/av1/common/quant_common.c
index 763465e48..44c0812c1 100644
--- a/third_party/aom/av1/common/quant_common.c
+++ b/third_party/aom/av1/common/quant_common.c
@@ -343,18 +343,21 @@ int av1_get_qindex(const struct segmentation *seg, int segment_id,
#if CONFIG_AOM_QM
qm_val_t *aom_iqmatrix(AV1_COMMON *cm, int qmlevel, int is_chroma,
- int log2sizem2, int is_intra) {
- return &cm->giqmatrix[qmlevel][!!is_chroma][!!is_intra][log2sizem2][0];
+ TX_SIZE tx_size, int is_intra) {
+ return &cm->giqmatrix[qmlevel][!!is_chroma][!!is_intra][tx_size][0];
}
qm_val_t *aom_qmatrix(AV1_COMMON *cm, int qmlevel, int is_chroma,
- int log2sizem2, int is_intra) {
- return &cm->gqmatrix[qmlevel][!!is_chroma][!!is_intra][log2sizem2][0];
+ TX_SIZE tx_size, int is_intra) {
+ return &cm->gqmatrix[qmlevel][!!is_chroma][!!is_intra][tx_size][0];
}
-static uint16_t iwt_matrix_ref[NUM_QM_LEVELS][2][2]
- [4 * 4 + 8 * 8 + 16 * 16 + 32 * 32];
-static uint16_t wt_matrix_ref[NUM_QM_LEVELS][2][2]
- [4 * 4 + 8 * 8 + 16 * 16 + 32 * 32];
+#if CONFIG_CB4X4
+#define QM_TOTAL_SIZE 3348
+#else
+#define QM_TOTAL_SIZE 3344
+#endif
+static uint16_t wt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE];
+static uint16_t iwt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE];
void aom_qm_init(AV1_COMMON *cm) {
int q, c, f, t, size;
@@ -363,5284 +366,7120 @@ void aom_qm_init(AV1_COMMON *cm) {
for (c = 0; c < 2; ++c) {
for (f = 0; f < 2; ++f) {
current = 0;
- for (t = 0; t < TX_SIZES; ++t) {
- size = 1 << (t + 2);
- cm->gqmatrix[q][c][f][t] = &wt_matrix_ref[q][c][f][current];
- cm->giqmatrix[q][c][f][t] = &iwt_matrix_ref[q][c][f][current];
- current += size * size;
+ for (t = 0; t < TX_SIZES_ALL; ++t) {
+ size = tx_size_2d[t];
+ cm->gqmatrix[q][c][f][t] = &wt_matrix_ref[AOMMIN(
+ NUM_QM_LEVELS - 1, f == 0 ? q + DEFAULT_QM_INTER_OFFSET : q)][c]
+ [current];
+ cm->giqmatrix[q][c][f][t] = &iwt_matrix_ref[AOMMIN(
+ NUM_QM_LEVELS - 1, f == 0 ? q + DEFAULT_QM_INTER_OFFSET : q)][c]
+ [current];
+ current += size;
}
}
}
}
}
-static uint16_t iwt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
- 32 * 32] = {
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 71, 124, 214, 71, 112, 165, 241, 124, 165, 254, 331, 214, 241, 331,
- 414,
- /* Size 8 */
- 64, 47, 51, 69, 97, 132, 173, 218, 47, 54, 52, 62, 81, 109, 142, 181,
- 51, 52, 75, 90, 108, 133, 165, 201, 69, 62, 90, 119, 144, 169, 198, 232,
- 97, 81, 108, 144, 178, 208, 238, 268, 132, 109, 133, 169, 208, 244, 276,
- 305, 173, 142, 165, 198, 238, 276, 309, 338, 218, 181, 201, 232, 268,
- 305, 338, 367,
- /* Size 16 */
- 64, 54, 47, 49, 51, 59, 69, 81, 97, 111, 132, 150, 173, 193, 218, 218,
- 54, 52, 50, 51, 51, 58, 65, 75, 88, 101, 119, 135, 156, 175, 198, 198,
- 47, 50, 54, 53, 52, 56, 62, 70, 81, 93, 109, 123, 142, 159, 181, 181,
- 49, 51, 53, 57, 61, 67, 73, 82, 93, 104, 120, 134, 153, 170, 191, 191,
- 51, 51, 52, 61, 75, 82, 90, 98, 108, 119, 133, 147, 165, 181, 201, 201,
- 59, 58, 56, 67, 82, 91, 102, 112, 123, 135, 149, 163, 180, 196, 215,
- 215, 69, 65, 62, 73, 90, 102, 119, 130, 144, 155, 169, 182, 198, 214,
- 232, 232, 81, 75, 70, 82, 98, 112, 130, 143, 159, 172, 186, 200, 216,
- 231, 249, 249, 97, 88, 81, 93, 108, 123, 144, 159, 178, 192, 208, 222,
- 238, 252, 268, 268, 111, 101, 93, 104, 119, 135, 155, 172, 192, 207,
- 225, 239, 255, 269, 285, 285, 132, 119, 109, 120, 133, 149, 169, 186,
- 208, 225, 244, 259, 276, 290, 305, 305, 150, 135, 123, 134, 147, 163,
- 182, 200, 222, 239, 259, 274, 291, 305, 321, 321, 173, 156, 142, 153,
- 165, 180, 198, 216, 238, 255, 276, 291, 309, 323, 338, 338, 193, 175,
- 159, 170, 181, 196, 214, 231, 252, 269, 290, 305, 323, 337, 352, 352,
- 218, 198, 181, 191, 201, 215, 232, 249, 268, 285, 305, 321, 338, 352,
- 367, 367, 218, 198, 181, 191, 201, 215, 232, 249, 268, 285, 305, 321,
- 338, 352, 367, 367,
- /* Size 32 */
- 64, 59, 54, 50, 47, 48, 49, 50, 51, 55, 59, 63, 69, 74, 81, 88, 97, 104,
- 111, 121, 132, 140, 150, 161, 173, 183, 193, 205, 218, 218, 218, 218,
- 59, 56, 53, 51, 49, 49, 50, 51, 51, 54, 58, 62, 67, 72, 78, 84, 92, 99,
- 106, 115, 125, 133, 142, 152, 164, 173, 183, 195, 208, 208, 208, 208,
- 54, 53, 52, 51, 50, 51, 51, 51, 51, 54, 58, 61, 65, 70, 75, 81, 88, 94,
- 101, 110, 119, 127, 135, 145, 156, 165, 175, 186, 198, 198, 198, 198,
- 50, 51, 51, 52, 52, 52, 52, 52, 52, 54, 57, 60, 63, 68, 72, 78, 85, 90,
- 97, 105, 114, 121, 129, 138, 149, 157, 167, 177, 189, 189, 189, 189, 47,
- 49, 50, 52, 54, 54, 53, 52, 52, 54, 56, 59, 62, 66, 70, 75, 81, 87, 93,
- 100, 109, 115, 123, 132, 142, 150, 159, 170, 181, 181, 181, 181, 48, 49,
- 51, 52, 54, 54, 55, 56, 56, 59, 61, 64, 67, 71, 76, 81, 87, 92, 98, 105,
- 114, 121, 128, 137, 147, 155, 164, 174, 186, 186, 186, 186, 49, 50, 51,
- 52, 53, 55, 57, 59, 61, 64, 67, 70, 73, 77, 82, 87, 93, 98, 104, 111,
- 120, 126, 134, 143, 153, 161, 170, 179, 191, 191, 191, 191, 50, 51, 51,
- 52, 52, 56, 59, 63, 68, 71, 74, 77, 81, 85, 89, 94, 100, 105, 111, 118,
- 126, 133, 140, 149, 158, 166, 175, 185, 196, 196, 196, 196, 51, 51, 51,
- 52, 52, 56, 61, 68, 75, 79, 82, 86, 90, 94, 98, 103, 108, 113, 119, 126,
- 133, 140, 147, 155, 165, 172, 181, 191, 201, 201, 201, 201, 55, 54, 54,
- 54, 54, 59, 64, 71, 79, 82, 86, 91, 96, 100, 105, 110, 115, 120, 126,
- 133, 140, 147, 155, 163, 172, 180, 188, 198, 208, 208, 208, 208, 59, 58,
- 58, 57, 56, 61, 67, 74, 82, 86, 91, 96, 102, 107, 112, 117, 123, 129,
- 135, 141, 149, 156, 163, 171, 180, 188, 196, 205, 215, 215, 215, 215,
- 63, 62, 61, 60, 59, 64, 70, 77, 86, 91, 96, 103, 110, 115, 120, 126,
- 133, 138, 144, 151, 158, 165, 172, 180, 189, 196, 204, 213, 223, 223,
- 223, 223, 69, 67, 65, 63, 62, 67, 73, 81, 90, 96, 102, 110, 119, 124,
- 130, 137, 144, 149, 155, 162, 169, 175, 182, 190, 198, 206, 214, 222,
- 232, 232, 232, 232, 74, 72, 70, 68, 66, 71, 77, 85, 94, 100, 107, 115,
- 124, 130, 136, 143, 151, 157, 163, 170, 177, 184, 191, 199, 207, 214,
- 222, 231, 240, 240, 240, 240, 81, 78, 75, 72, 70, 76, 82, 89, 98, 105,
- 112, 120, 130, 136, 143, 151, 159, 165, 172, 179, 186, 193, 200, 208,
- 216, 223, 231, 240, 249, 249, 249, 249, 88, 84, 81, 78, 75, 81, 87, 94,
- 103, 110, 117, 126, 137, 143, 151, 159, 168, 174, 181, 189, 197, 203,
- 211, 218, 226, 234, 241, 249, 258, 258, 258, 258, 97, 92, 88, 85, 81,
- 87, 93, 100, 108, 115, 123, 133, 144, 151, 159, 168, 178, 184, 192, 200,
- 208, 215, 222, 229, 238, 245, 252, 260, 268, 268, 268, 268, 104, 99, 94,
- 90, 87, 92, 98, 105, 113, 120, 129, 138, 149, 157, 165, 174, 184, 191,
- 199, 207, 216, 223, 230, 238, 246, 253, 260, 268, 276, 276, 276, 276,
- 111, 106, 101, 97, 93, 98, 104, 111, 119, 126, 135, 144, 155, 163, 172,
- 181, 192, 199, 207, 215, 225, 232, 239, 247, 255, 262, 269, 277, 285,
- 285, 285, 285, 121, 115, 110, 105, 100, 105, 111, 118, 126, 133, 141,
- 151, 162, 170, 179, 189, 200, 207, 215, 224, 234, 241, 248, 256, 265,
- 272, 279, 287, 295, 295, 295, 295, 132, 125, 119, 114, 109, 114, 120,
- 126, 133, 140, 149, 158, 169, 177, 186, 197, 208, 216, 225, 234, 244,
- 251, 259, 267, 276, 282, 290, 297, 305, 305, 305, 305, 140, 133, 127,
- 121, 115, 121, 126, 133, 140, 147, 156, 165, 175, 184, 193, 203, 215,
- 223, 232, 241, 251, 258, 266, 275, 283, 290, 297, 305, 313, 313, 313,
- 313, 150, 142, 135, 129, 123, 128, 134, 140, 147, 155, 163, 172, 182,
- 191, 200, 211, 222, 230, 239, 248, 259, 266, 274, 283, 291, 298, 305,
- 313, 321, 321, 321, 321, 161, 152, 145, 138, 132, 137, 143, 149, 155,
- 163, 171, 180, 190, 199, 208, 218, 229, 238, 247, 256, 267, 275, 283,
- 291, 300, 307, 314, 322, 329, 329, 329, 329, 173, 164, 156, 149, 142,
- 147, 153, 158, 165, 172, 180, 189, 198, 207, 216, 226, 238, 246, 255,
- 265, 276, 283, 291, 300, 309, 316, 323, 331, 338, 338, 338, 338, 183,
- 173, 165, 157, 150, 155, 161, 166, 172, 180, 188, 196, 206, 214, 223,
- 234, 245, 253, 262, 272, 282, 290, 298, 307, 316, 323, 330, 337, 345,
- 345, 345, 345, 193, 183, 175, 167, 159, 164, 170, 175, 181, 188, 196,
- 204, 214, 222, 231, 241, 252, 260, 269, 279, 290, 297, 305, 314, 323,
- 330, 337, 345, 352, 352, 352, 352, 205, 195, 186, 177, 170, 174, 179,
- 185, 191, 198, 205, 213, 222, 231, 240, 249, 260, 268, 277, 287, 297,
- 305, 313, 322, 331, 337, 345, 352, 360, 360, 360, 360, 218, 208, 198,
- 189, 181, 186, 191, 196, 201, 208, 215, 223, 232, 240, 249, 258, 268,
- 276, 285, 295, 305, 313, 321, 329, 338, 345, 352, 360, 367, 367, 367,
- 367, 218, 208, 198, 189, 181, 186, 191, 196, 201, 208, 215, 223, 232,
- 240, 249, 258, 268, 276, 285, 295, 305, 313, 321, 329, 338, 345, 352,
- 360, 367, 367, 367, 367, 218, 208, 198, 189, 181, 186, 191, 196, 201,
- 208, 215, 223, 232, 240, 249, 258, 268, 276, 285, 295, 305, 313, 321,
- 329, 338, 345, 352, 360, 367, 367, 367, 367, 218, 208, 198, 189, 181,
- 186, 191, 196, 201, 208, 215, 223, 232, 240, 249, 258, 268, 276, 285,
- 295, 305, 313, 321, 329, 338, 345, 352, 360, 367, 367, 367, 367 },
- { /* Intra matrices */
- /* Size 4 */
- 16, 18, 33, 60, 18, 29, 45, 68, 33, 45, 72, 98, 60, 68, 98, 129,
- /* Size 8 */
- 20, 14, 16, 21, 31, 43, 58, 75, 14, 17, 16, 19, 25, 35, 46, 61, 16, 16,
- 24, 28, 34, 43, 54, 68, 21, 19, 28, 38, 47, 56, 67, 80, 31, 25, 34, 47,
- 59, 71, 83, 95, 43, 35, 43, 56, 71, 85, 99, 112, 58, 46, 54, 67, 83, 99,
- 113, 127, 75, 61, 68, 80, 95, 112, 127, 141,
- /* Size 16 */
- 19, 16, 14, 14, 15, 17, 20, 24, 29, 34, 41, 47, 55, 62, 71, 71, 16, 15,
- 15, 15, 15, 17, 19, 22, 26, 31, 36, 42, 49, 55, 64, 64, 14, 15, 16, 16,
- 15, 17, 18, 21, 24, 28, 33, 38, 44, 50, 58, 58, 14, 15, 16, 17, 18, 20,
- 22, 24, 28, 32, 37, 41, 48, 54, 61, 61, 15, 15, 15, 18, 22, 24, 27, 30,
- 33, 36, 41, 46, 52, 58, 65, 65, 17, 17, 17, 20, 24, 27, 31, 34, 38, 42,
- 46, 51, 57, 63, 70, 70, 20, 19, 18, 22, 27, 31, 36, 40, 45, 49, 53, 58,
- 64, 70, 76, 76, 24, 22, 21, 24, 30, 34, 40, 44, 50, 54, 60, 65, 71, 76,
- 83, 83, 29, 26, 24, 28, 33, 38, 45, 50, 56, 61, 67, 73, 79, 84, 91, 91,
- 34, 31, 28, 32, 36, 42, 49, 54, 61, 67, 74, 79, 86, 91, 98, 98, 41, 36,
- 33, 37, 41, 46, 53, 60, 67, 74, 81, 87, 94, 100, 106, 106, 47, 42, 38,
- 41, 46, 51, 58, 65, 73, 79, 87, 93, 100, 106, 113, 113, 55, 49, 44, 48,
- 52, 57, 64, 71, 79, 86, 94, 100, 108, 114, 121, 121, 62, 55, 50, 54, 58,
- 63, 70, 76, 84, 91, 100, 106, 114, 120, 127, 127, 71, 64, 58, 61, 65,
- 70, 76, 83, 91, 98, 106, 113, 121, 127, 134, 134, 71, 64, 58, 61, 65,
- 70, 76, 83, 91, 98, 106, 113, 121, 127, 134, 134,
- /* Size 32 */
- 18, 17, 15, 14, 13, 14, 14, 14, 15, 16, 17, 18, 20, 22, 23, 26, 28, 30,
- 33, 36, 40, 42, 45, 49, 53, 57, 60, 65, 69, 69, 69, 69, 17, 16, 15, 14,
- 14, 14, 14, 14, 15, 16, 17, 18, 19, 21, 23, 25, 27, 29, 31, 34, 37, 40,
- 43, 46, 50, 53, 57, 61, 66, 66, 66, 66, 15, 15, 15, 15, 14, 14, 14, 15,
- 15, 15, 16, 18, 19, 20, 22, 24, 26, 28, 30, 32, 35, 38, 41, 44, 48, 51,
- 54, 58, 62, 62, 62, 62, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 16, 17,
- 18, 19, 21, 23, 25, 26, 28, 31, 34, 36, 39, 42, 45, 48, 51, 55, 59, 59,
- 59, 59, 13, 14, 14, 15, 16, 15, 15, 15, 15, 15, 16, 17, 18, 19, 20, 22,
- 24, 25, 27, 29, 32, 34, 37, 40, 43, 46, 49, 52, 56, 56, 56, 56, 14, 14,
- 14, 15, 15, 16, 16, 16, 16, 17, 18, 18, 19, 20, 22, 23, 25, 27, 29, 31,
- 34, 36, 38, 41, 45, 47, 50, 54, 58, 58, 58, 58, 14, 14, 14, 15, 15, 16,
- 16, 17, 18, 18, 19, 20, 21, 22, 24, 25, 27, 29, 31, 33, 36, 38, 40, 43,
- 46, 49, 52, 56, 60, 60, 60, 60, 14, 14, 15, 15, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 25, 26, 28, 29, 31, 33, 35, 38, 40, 42, 45, 48, 51, 54, 57,
- 61, 61, 61, 61, 15, 15, 15, 15, 15, 16, 18, 19, 22, 23, 24, 25, 26, 27,
- 29, 30, 32, 34, 35, 38, 40, 42, 45, 47, 50, 53, 56, 59, 63, 63, 63, 63,
- 16, 16, 15, 15, 15, 17, 18, 20, 23, 24, 25, 27, 28, 29, 31, 32, 34, 36,
- 38, 40, 42, 45, 47, 50, 53, 56, 59, 62, 66, 66, 66, 66, 17, 17, 16, 16,
- 16, 18, 19, 21, 24, 25, 27, 28, 30, 32, 33, 35, 37, 39, 41, 43, 45, 47,
- 50, 53, 56, 58, 61, 65, 68, 68, 68, 68, 18, 18, 18, 17, 17, 18, 20, 22,
- 25, 27, 28, 30, 33, 34, 36, 38, 40, 42, 44, 46, 48, 51, 53, 56, 59, 62,
- 64, 68, 71, 71, 71, 71, 20, 19, 19, 18, 18, 19, 21, 23, 26, 28, 30, 33,
- 35, 37, 39, 41, 43, 45, 47, 50, 52, 54, 57, 59, 62, 65, 68, 71, 74, 74,
- 74, 74, 22, 21, 20, 19, 19, 20, 22, 25, 27, 29, 32, 34, 37, 39, 41, 43,
- 46, 48, 50, 52, 55, 57, 60, 62, 65, 68, 71, 74, 77, 77, 77, 77, 23, 23,
- 22, 21, 20, 22, 24, 26, 29, 31, 33, 36, 39, 41, 43, 46, 49, 51, 53, 55,
- 58, 60, 63, 66, 69, 71, 74, 77, 81, 81, 81, 81, 26, 25, 24, 23, 22, 23,
- 25, 28, 30, 32, 35, 38, 41, 43, 46, 48, 52, 54, 56, 59, 62, 64, 67, 69,
- 72, 75, 78, 81, 84, 84, 84, 84, 28, 27, 26, 25, 24, 25, 27, 29, 32, 34,
- 37, 40, 43, 46, 49, 52, 55, 57, 60, 63, 66, 68, 71, 74, 77, 79, 82, 85,
- 88, 88, 88, 88, 30, 29, 28, 26, 25, 27, 29, 31, 34, 36, 39, 42, 45, 48,
- 51, 54, 57, 60, 62, 65, 69, 71, 74, 77, 80, 83, 85, 88, 92, 92, 92, 92,
- 33, 31, 30, 28, 27, 29, 31, 33, 35, 38, 41, 44, 47, 50, 53, 56, 60, 62,
- 65, 68, 72, 74, 77, 80, 83, 86, 89, 92, 95, 95, 95, 95, 36, 34, 32, 31,
- 29, 31, 33, 35, 38, 40, 43, 46, 50, 52, 55, 59, 63, 65, 68, 72, 75, 78,
- 81, 84, 87, 90, 93, 96, 99, 99, 99, 99, 40, 37, 35, 34, 32, 34, 36, 38,
- 40, 42, 45, 48, 52, 55, 58, 62, 66, 69, 72, 75, 79, 82, 85, 88, 91, 94,
- 97, 100, 103, 103, 103, 103, 42, 40, 38, 36, 34, 36, 38, 40, 42, 45, 47,
- 51, 54, 57, 60, 64, 68, 71, 74, 78, 82, 85, 88, 91, 94, 97, 100, 103,
- 107, 107, 107, 107, 45, 43, 41, 39, 37, 38, 40, 42, 45, 47, 50, 53, 57,
- 60, 63, 67, 71, 74, 77, 81, 85, 88, 91, 94, 98, 101, 104, 107, 110, 110,
- 110, 110, 49, 46, 44, 42, 40, 41, 43, 45, 47, 50, 53, 56, 59, 62, 66,
- 69, 74, 77, 80, 84, 88, 91, 94, 98, 101, 104, 107, 110, 114, 114, 114,
- 114, 53, 50, 48, 45, 43, 45, 46, 48, 50, 53, 56, 59, 62, 65, 69, 72, 77,
- 80, 83, 87, 91, 94, 98, 101, 105, 108, 111, 114, 118, 118, 118, 118, 57,
- 53, 51, 48, 46, 47, 49, 51, 53, 56, 58, 62, 65, 68, 71, 75, 79, 83, 86,
- 90, 94, 97, 101, 104, 108, 111, 114, 117, 121, 121, 121, 121, 60, 57,
- 54, 51, 49, 50, 52, 54, 56, 59, 61, 64, 68, 71, 74, 78, 82, 85, 89, 93,
- 97, 100, 104, 107, 111, 114, 117, 120, 124, 124, 124, 124, 65, 61, 58,
- 55, 52, 54, 56, 57, 59, 62, 65, 68, 71, 74, 77, 81, 85, 88, 92, 96, 100,
- 103, 107, 110, 114, 117, 120, 124, 127, 127, 127, 127, 69, 66, 62, 59,
- 56, 58, 60, 61, 63, 66, 68, 71, 74, 77, 81, 84, 88, 92, 95, 99, 103,
- 107, 110, 114, 118, 121, 124, 127, 130, 130, 130, 130, 69, 66, 62, 59,
- 56, 58, 60, 61, 63, 66, 68, 71, 74, 77, 81, 84, 88, 92, 95, 99, 103,
- 107, 110, 114, 118, 121, 124, 127, 130, 130, 130, 130, 69, 66, 62, 59,
- 56, 58, 60, 61, 63, 66, 68, 71, 74, 77, 81, 84, 88, 92, 95, 99, 103,
- 107, 110, 114, 118, 121, 124, 127, 130, 130, 130, 130, 69, 66, 62, 59,
- 56, 58, 60, 61, 63, 66, 68, 71, 74, 77, 81, 84, 88, 92, 95, 99, 103,
- 107, 110, 114, 118, 121, 124, 127, 130, 130, 130, 130 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 106, 117, 154, 106, 131, 141, 167, 117, 141, 191, 225, 154, 167,
- 225, 279,
- /* Size 8 */
- 64, 51, 98, 104, 113, 128, 148, 172, 51, 76, 100, 89, 92, 103, 118, 136,
- 98, 100, 119, 115, 114, 121, 134, 151, 104, 89, 115, 132, 140, 147, 158,
- 173, 113, 92, 114, 140, 160, 174, 186, 201, 128, 103, 121, 147, 174,
- 195, 213, 229, 148, 118, 134, 158, 186, 213, 236, 256, 172, 136, 151,
- 173, 201, 229, 256, 280,
- /* Size 16 */
- 64, 57, 51, 67, 98, 101, 104, 108, 113, 120, 128, 137, 148, 159, 172,
- 172, 57, 59, 61, 75, 99, 97, 96, 99, 101, 107, 114, 122, 131, 141, 152,
- 152, 51, 61, 76, 86, 100, 94, 89, 91, 92, 97, 103, 110, 118, 126, 136,
- 136, 67, 75, 86, 96, 109, 104, 100, 101, 102, 106, 111, 118, 125, 134,
- 143, 143, 98, 99, 100, 109, 119, 117, 115, 115, 114, 118, 121, 127, 134,
- 142, 151, 151, 101, 97, 94, 104, 117, 120, 123, 124, 126, 129, 133, 139,
- 145, 153, 161, 161, 104, 96, 89, 100, 115, 123, 132, 136, 140, 144, 147,
- 153, 158, 165, 173, 173, 108, 99, 91, 101, 115, 124, 136, 142, 149, 154,
- 160, 165, 171, 178, 186, 186, 113, 101, 92, 102, 114, 126, 140, 149,
- 160, 167, 174, 180, 186, 193, 201, 201, 120, 107, 97, 106, 118, 129,
- 144, 154, 167, 175, 184, 191, 199, 206, 214, 214, 128, 114, 103, 111,
- 121, 133, 147, 160, 174, 184, 195, 204, 213, 221, 229, 229, 137, 122,
- 110, 118, 127, 139, 153, 165, 180, 191, 204, 213, 224, 233, 242, 242,
- 148, 131, 118, 125, 134, 145, 158, 171, 186, 199, 213, 224, 236, 246,
- 256, 256, 159, 141, 126, 134, 142, 153, 165, 178, 193, 206, 221, 233,
- 246, 256, 267, 267, 172, 152, 136, 143, 151, 161, 173, 186, 201, 214,
- 229, 242, 256, 267, 280, 280, 172, 152, 136, 143, 151, 161, 173, 186,
- 201, 214, 229, 242, 256, 267, 280, 280,
- /* Size 32 */
- 64, 60, 57, 54, 51, 58, 67, 79, 98, 99, 101, 103, 104, 106, 108, 110,
- 113, 116, 120, 124, 128, 133, 137, 143, 148, 153, 159, 165, 172, 172,
- 172, 172, 60, 59, 58, 56, 55, 62, 71, 82, 98, 99, 99, 100, 100, 102,
- 103, 105, 107, 110, 113, 117, 121, 125, 129, 134, 139, 144, 149, 155,
- 161, 161, 161, 161, 57, 58, 59, 60, 61, 67, 75, 85, 99, 98, 97, 97, 96,
- 97, 99, 100, 101, 104, 107, 110, 114, 118, 122, 126, 131, 136, 141, 146,
- 152, 152, 152, 152, 54, 56, 60, 63, 67, 73, 80, 89, 99, 97, 96, 94, 93,
- 94, 94, 95, 97, 99, 102, 105, 108, 112, 115, 120, 124, 128, 133, 138,
- 144, 144, 144, 144, 51, 55, 61, 67, 76, 81, 86, 92, 100, 97, 94, 92, 89,
- 90, 91, 91, 92, 95, 97, 100, 103, 106, 110, 113, 118, 122, 126, 131,
- 136, 136, 136, 136, 58, 62, 67, 73, 81, 85, 91, 97, 104, 101, 99, 97,
- 94, 95, 96, 96, 97, 99, 101, 104, 107, 110, 113, 117, 121, 125, 130,
- 134, 140, 140, 140, 140, 67, 71, 75, 80, 86, 91, 96, 102, 109, 106, 104,
- 102, 100, 101, 101, 102, 102, 104, 106, 109, 111, 114, 118, 121, 125,
- 129, 134, 138, 143, 143, 143, 143, 79, 82, 85, 89, 92, 97, 102, 108,
- 114, 112, 110, 109, 107, 107, 107, 108, 108, 110, 112, 114, 116, 119,
- 122, 126, 129, 133, 138, 142, 147, 147, 147, 147, 98, 98, 99, 99, 100,
- 104, 109, 114, 119, 118, 117, 116, 115, 115, 115, 114, 114, 116, 118,
- 119, 121, 124, 127, 130, 134, 138, 142, 146, 151, 151, 151, 151, 99, 99,
- 98, 97, 97, 101, 106, 112, 118, 118, 118, 119, 119, 119, 119, 120, 120,
- 122, 123, 125, 127, 130, 133, 136, 139, 143, 147, 151, 156, 156, 156,
- 156, 101, 99, 97, 96, 94, 99, 104, 110, 117, 118, 120, 121, 123, 124,
- 124, 125, 126, 128, 129, 131, 133, 136, 139, 142, 145, 149, 153, 157,
- 161, 161, 161, 161, 103, 100, 97, 94, 92, 97, 102, 109, 116, 119, 121,
- 124, 127, 129, 130, 131, 133, 134, 136, 138, 140, 143, 145, 148, 151,
- 155, 159, 163, 167, 167, 167, 167, 104, 100, 96, 93, 89, 94, 100, 107,
- 115, 119, 123, 127, 132, 134, 136, 138, 140, 142, 144, 146, 147, 150,
- 153, 155, 158, 162, 165, 169, 173, 173, 173, 173, 106, 102, 97, 94, 90,
- 95, 101, 107, 115, 119, 124, 129, 134, 137, 139, 142, 145, 147, 149,
- 151, 153, 156, 159, 162, 164, 168, 172, 175, 179, 179, 179, 179, 108,
- 103, 99, 94, 91, 96, 101, 107, 115, 119, 124, 130, 136, 139, 142, 146,
- 149, 152, 154, 157, 160, 162, 165, 168, 171, 175, 178, 182, 186, 186,
- 186, 186, 110, 105, 100, 95, 91, 96, 102, 108, 114, 120, 125, 131, 138,
- 142, 146, 150, 154, 157, 160, 163, 166, 169, 172, 175, 178, 182, 185,
- 189, 193, 193, 193, 193, 113, 107, 101, 97, 92, 97, 102, 108, 114, 120,
- 126, 133, 140, 145, 149, 154, 160, 163, 167, 170, 174, 177, 180, 183,
- 186, 190, 193, 197, 201, 201, 201, 201, 116, 110, 104, 99, 95, 99, 104,
- 110, 116, 122, 128, 134, 142, 147, 152, 157, 163, 167, 171, 175, 179,
- 182, 185, 189, 192, 196, 199, 203, 207, 207, 207, 207, 120, 113, 107,
- 102, 97, 101, 106, 112, 118, 123, 129, 136, 144, 149, 154, 160, 167,
- 171, 175, 179, 184, 187, 191, 195, 199, 202, 206, 210, 214, 214, 214,
- 214, 124, 117, 110, 105, 100, 104, 109, 114, 119, 125, 131, 138, 146,
- 151, 157, 163, 170, 175, 179, 184, 190, 193, 197, 201, 206, 209, 213,
- 217, 221, 221, 221, 221, 128, 121, 114, 108, 103, 107, 111, 116, 121,
- 127, 133, 140, 147, 153, 160, 166, 174, 179, 184, 190, 195, 200, 204,
- 208, 213, 217, 221, 225, 229, 229, 229, 229, 133, 125, 118, 112, 106,
- 110, 114, 119, 124, 130, 136, 143, 150, 156, 162, 169, 177, 182, 187,
- 193, 200, 204, 209, 213, 218, 222, 227, 231, 235, 235, 235, 235, 137,
- 129, 122, 115, 110, 113, 118, 122, 127, 133, 139, 145, 153, 159, 165,
- 172, 180, 185, 191, 197, 204, 209, 213, 219, 224, 228, 233, 237, 242,
- 242, 242, 242, 143, 134, 126, 120, 113, 117, 121, 126, 130, 136, 142,
- 148, 155, 162, 168, 175, 183, 189, 195, 201, 208, 213, 219, 224, 230,
- 234, 239, 244, 249, 249, 249, 249, 148, 139, 131, 124, 118, 121, 125,
- 129, 134, 139, 145, 151, 158, 164, 171, 178, 186, 192, 199, 206, 213,
- 218, 224, 230, 236, 241, 246, 251, 256, 256, 256, 256, 153, 144, 136,
- 128, 122, 125, 129, 133, 138, 143, 149, 155, 162, 168, 175, 182, 190,
- 196, 202, 209, 217, 222, 228, 234, 241, 246, 251, 256, 262, 262, 262,
- 262, 159, 149, 141, 133, 126, 130, 134, 138, 142, 147, 153, 159, 165,
- 172, 178, 185, 193, 199, 206, 213, 221, 227, 233, 239, 246, 251, 256,
- 262, 267, 267, 267, 267, 165, 155, 146, 138, 131, 134, 138, 142, 146,
- 151, 157, 163, 169, 175, 182, 189, 197, 203, 210, 217, 225, 231, 237,
- 244, 251, 256, 262, 267, 273, 273, 273, 273, 172, 161, 152, 144, 136,
- 140, 143, 147, 151, 156, 161, 167, 173, 179, 186, 193, 201, 207, 214,
- 221, 229, 235, 242, 249, 256, 262, 267, 273, 280, 280, 280, 280, 172,
- 161, 152, 144, 136, 140, 143, 147, 151, 156, 161, 167, 173, 179, 186,
- 193, 201, 207, 214, 221, 229, 235, 242, 249, 256, 262, 267, 273, 280,
- 280, 280, 280, 172, 161, 152, 144, 136, 140, 143, 147, 151, 156, 161,
- 167, 173, 179, 186, 193, 201, 207, 214, 221, 229, 235, 242, 249, 256,
- 262, 267, 273, 280, 280, 280, 280, 172, 161, 152, 144, 136, 140, 143,
- 147, 151, 156, 161, 167, 173, 179, 186, 193, 201, 207, 214, 221, 229,
- 235, 242, 249, 256, 262, 267, 273, 280, 280, 280, 280 },
- { /* Intra matrices */
- /* Size 4 */
- 23, 40, 44, 59, 40, 50, 54, 64, 44, 54, 74, 89, 59, 64, 89, 114,
- /* Size 8 */
- 25, 20, 39, 42, 46, 52, 61, 72, 20, 30, 40, 36, 37, 41, 48, 56, 39, 40,
- 49, 47, 46, 49, 55, 62, 42, 36, 47, 54, 58, 61, 66, 73, 46, 37, 46, 58,
- 67, 73, 79, 85, 52, 41, 49, 61, 73, 83, 91, 99, 61, 48, 55, 66, 79, 91,
- 103, 113, 72, 56, 62, 73, 85, 99, 113, 125,
- /* Size 16 */
- 24, 22, 19, 26, 38, 39, 41, 42, 44, 47, 51, 55, 59, 64, 69, 69, 22, 22,
- 23, 29, 38, 38, 37, 38, 39, 42, 45, 48, 52, 56, 61, 61, 19, 23, 29, 33,
- 39, 37, 34, 35, 36, 38, 40, 43, 46, 50, 54, 54, 26, 29, 33, 37, 42, 41,
- 39, 39, 40, 42, 43, 46, 49, 53, 57, 57, 38, 38, 39, 42, 47, 46, 45, 45,
- 45, 46, 48, 50, 53, 56, 60, 60, 39, 38, 37, 41, 46, 47, 48, 49, 50, 51,
- 53, 55, 58, 61, 65, 65, 41, 37, 34, 39, 45, 48, 52, 54, 56, 57, 59, 61,
- 64, 67, 70, 70, 42, 38, 35, 39, 45, 49, 54, 57, 60, 62, 64, 67, 69, 72,
- 76, 76, 44, 39, 36, 40, 45, 50, 56, 60, 64, 67, 70, 73, 76, 79, 82, 82,
- 47, 42, 38, 42, 46, 51, 57, 62, 67, 71, 75, 78, 82, 85, 89, 89, 51, 45,
- 40, 43, 48, 53, 59, 64, 70, 75, 80, 84, 88, 92, 96, 96, 55, 48, 43, 46,
- 50, 55, 61, 67, 73, 78, 84, 88, 93, 97, 102, 102, 59, 52, 46, 49, 53,
- 58, 64, 69, 76, 82, 88, 93, 99, 104, 109, 109, 64, 56, 50, 53, 56, 61,
- 67, 72, 79, 85, 92, 97, 104, 109, 114, 114, 69, 61, 54, 57, 60, 65, 70,
- 76, 82, 89, 96, 102, 109, 114, 120, 120, 69, 61, 54, 57, 60, 65, 70, 76,
- 82, 89, 96, 102, 109, 114, 120, 120,
- /* Size 32 */
- 24, 22, 21, 20, 19, 22, 25, 30, 37, 38, 39, 39, 40, 41, 42, 42, 43, 45,
- 46, 48, 50, 51, 54, 56, 58, 60, 63, 65, 68, 68, 68, 68, 22, 22, 22, 21,
- 21, 23, 27, 31, 37, 38, 38, 38, 38, 39, 40, 40, 41, 42, 44, 45, 47, 48,
- 50, 52, 54, 56, 59, 61, 64, 64, 64, 64, 21, 22, 22, 22, 23, 25, 28, 32,
- 38, 37, 37, 37, 37, 37, 38, 38, 39, 40, 41, 42, 44, 45, 47, 49, 51, 53,
- 55, 57, 60, 60, 60, 60, 20, 21, 22, 24, 25, 28, 30, 34, 38, 37, 36, 36,
- 35, 36, 36, 36, 37, 38, 39, 40, 41, 43, 44, 46, 48, 50, 52, 54, 56, 56,
- 56, 56, 19, 21, 23, 25, 29, 30, 33, 35, 38, 37, 36, 35, 34, 34, 34, 35,
- 35, 36, 37, 38, 39, 41, 42, 44, 45, 47, 49, 51, 53, 53, 53, 53, 22, 23,
- 25, 28, 30, 32, 34, 37, 40, 39, 38, 37, 36, 36, 36, 37, 37, 38, 39, 40,
- 41, 42, 44, 45, 47, 49, 50, 52, 54, 54, 54, 54, 25, 27, 28, 30, 33, 34,
- 37, 39, 42, 41, 40, 39, 38, 38, 39, 39, 39, 40, 41, 42, 43, 44, 45, 47,
- 48, 50, 52, 54, 56, 56, 56, 56, 30, 31, 32, 34, 35, 37, 39, 41, 44, 43,
- 42, 42, 41, 41, 41, 41, 41, 42, 43, 44, 45, 46, 47, 49, 50, 52, 54, 55,
- 57, 57, 57, 57, 37, 37, 38, 38, 38, 40, 42, 44, 46, 46, 45, 45, 44, 44,
- 44, 44, 44, 45, 45, 46, 47, 48, 49, 51, 52, 54, 55, 57, 59, 59, 59, 59,
- 38, 38, 37, 37, 37, 39, 41, 43, 46, 46, 46, 46, 46, 46, 46, 46, 46, 47,
- 48, 48, 49, 50, 52, 53, 54, 56, 58, 59, 61, 61, 61, 61, 39, 38, 37, 36,
- 36, 38, 40, 42, 45, 46, 46, 47, 48, 48, 48, 48, 49, 49, 50, 51, 52, 53,
- 54, 55, 57, 58, 60, 62, 64, 64, 64, 64, 39, 38, 37, 36, 35, 37, 39, 42,
- 45, 46, 47, 48, 49, 50, 50, 51, 52, 52, 53, 54, 55, 56, 57, 58, 59, 61,
- 63, 64, 66, 66, 66, 66, 40, 38, 37, 35, 34, 36, 38, 41, 44, 46, 48, 49,
- 51, 52, 53, 54, 55, 55, 56, 57, 58, 59, 60, 61, 62, 64, 65, 67, 69, 69,
- 69, 69, 41, 39, 37, 36, 34, 36, 38, 41, 44, 46, 48, 50, 52, 53, 54, 55,
- 57, 57, 58, 59, 60, 61, 63, 64, 65, 67, 68, 70, 71, 71, 71, 71, 42, 40,
- 38, 36, 34, 36, 39, 41, 44, 46, 48, 50, 53, 54, 56, 57, 59, 60, 61, 62,
- 63, 64, 65, 67, 68, 69, 71, 73, 74, 74, 74, 74, 42, 40, 38, 36, 35, 37,
- 39, 41, 44, 46, 48, 51, 54, 55, 57, 59, 61, 62, 63, 64, 66, 67, 68, 70,
- 71, 73, 74, 76, 78, 78, 78, 78, 43, 41, 39, 37, 35, 37, 39, 41, 44, 46,
- 49, 52, 55, 57, 59, 61, 63, 64, 66, 67, 69, 70, 72, 73, 75, 76, 78, 79,
- 81, 81, 81, 81, 45, 42, 40, 38, 36, 38, 40, 42, 45, 47, 49, 52, 55, 57,
- 60, 62, 64, 66, 68, 69, 71, 73, 74, 76, 77, 79, 80, 82, 84, 84, 84, 84,
- 46, 44, 41, 39, 37, 39, 41, 43, 45, 48, 50, 53, 56, 58, 61, 63, 66, 68,
- 70, 71, 74, 75, 77, 78, 80, 82, 83, 85, 87, 87, 87, 87, 48, 45, 42, 40,
- 38, 40, 42, 44, 46, 48, 51, 54, 57, 59, 62, 64, 67, 69, 71, 74, 76, 78,
- 79, 81, 83, 85, 87, 89, 90, 90, 90, 90, 50, 47, 44, 41, 39, 41, 43, 45,
- 47, 49, 52, 55, 58, 60, 63, 66, 69, 71, 74, 76, 79, 80, 82, 84, 87, 88,
- 90, 92, 94, 94, 94, 94, 51, 48, 45, 43, 41, 42, 44, 46, 48, 50, 53, 56,
- 59, 61, 64, 67, 70, 73, 75, 78, 80, 82, 85, 87, 89, 91, 93, 95, 97, 97,
- 97, 97, 54, 50, 47, 44, 42, 44, 45, 47, 49, 52, 54, 57, 60, 63, 65, 68,
- 72, 74, 77, 79, 82, 85, 87, 89, 92, 94, 96, 98, 100, 100, 100, 100, 56,
- 52, 49, 46, 44, 45, 47, 49, 51, 53, 55, 58, 61, 64, 67, 70, 73, 76, 78,
- 81, 84, 87, 89, 92, 94, 96, 99, 101, 103, 103, 103, 103, 58, 54, 51, 48,
- 45, 47, 48, 50, 52, 54, 57, 59, 62, 65, 68, 71, 75, 77, 80, 83, 87, 89,
- 92, 94, 97, 99, 102, 104, 107, 107, 107, 107, 60, 56, 53, 50, 47, 49,
- 50, 52, 54, 56, 58, 61, 64, 67, 69, 73, 76, 79, 82, 85, 88, 91, 94, 96,
- 99, 102, 104, 107, 109, 109, 109, 109, 63, 59, 55, 52, 49, 50, 52, 54,
- 55, 58, 60, 63, 65, 68, 71, 74, 78, 80, 83, 87, 90, 93, 96, 99, 102,
- 104, 107, 109, 112, 112, 112, 112, 65, 61, 57, 54, 51, 52, 54, 55, 57,
- 59, 62, 64, 67, 70, 73, 76, 79, 82, 85, 89, 92, 95, 98, 101, 104, 107,
- 109, 112, 115, 115, 115, 115, 68, 64, 60, 56, 53, 54, 56, 57, 59, 61,
- 64, 66, 69, 71, 74, 78, 81, 84, 87, 90, 94, 97, 100, 103, 107, 109, 112,
- 115, 118, 118, 118, 118, 68, 64, 60, 56, 53, 54, 56, 57, 59, 61, 64, 66,
- 69, 71, 74, 78, 81, 84, 87, 90, 94, 97, 100, 103, 107, 109, 112, 115,
- 118, 118, 118, 118, 68, 64, 60, 56, 53, 54, 56, 57, 59, 61, 64, 66, 69,
- 71, 74, 78, 81, 84, 87, 90, 94, 97, 100, 103, 107, 109, 112, 115, 118,
- 118, 118, 118, 68, 64, 60, 56, 53, 54, 56, 57, 59, 61, 64, 66, 69, 71,
- 74, 78, 81, 84, 87, 90, 94, 97, 100, 103, 107, 109, 112, 115, 118, 118,
- 118, 118 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 70, 120, 197, 70, 109, 156, 218, 120, 156, 229, 287, 197, 218, 287,
- 344,
- /* Size 8 */
- 64, 47, 51, 69, 94, 126, 161, 197, 47, 55, 52, 62, 80, 105, 135, 167,
- 51, 52, 75, 88, 105, 127, 154, 183, 69, 62, 88, 115, 136, 157, 181, 207,
- 94, 80, 105, 136, 165, 189, 212, 234, 126, 105, 127, 157, 189, 216, 240,
- 261, 161, 135, 154, 181, 212, 240, 264, 284, 197, 167, 183, 207, 234,
- 261, 284, 303,
- /* Size 16 */
- 64, 54, 47, 49, 51, 59, 69, 80, 94, 108, 126, 141, 161, 177, 197, 197,
- 54, 53, 51, 51, 52, 58, 65, 74, 87, 99, 115, 129, 147, 162, 181, 181,
- 47, 51, 55, 53, 52, 57, 62, 70, 80, 91, 105, 118, 135, 149, 167, 167,
- 49, 51, 53, 57, 62, 67, 73, 81, 91, 102, 115, 128, 144, 158, 175, 175,
- 51, 52, 52, 62, 75, 81, 88, 96, 105, 115, 127, 139, 154, 167, 183, 183,
- 59, 58, 57, 67, 81, 89, 100, 108, 118, 128, 140, 152, 166, 179, 195,
- 195, 69, 65, 62, 73, 88, 100, 115, 124, 136, 146, 157, 168, 181, 193,
- 207, 207, 80, 74, 70, 81, 96, 108, 124, 136, 149, 159, 172, 183, 195,
- 207, 220, 220, 94, 87, 80, 91, 105, 118, 136, 149, 165, 176, 189, 200,
- 212, 222, 234, 234, 108, 99, 91, 102, 115, 128, 146, 159, 176, 188, 202,
- 213, 225, 235, 247, 247, 126, 115, 105, 115, 127, 140, 157, 172, 189,
- 202, 216, 228, 240, 250, 261, 261, 141, 129, 118, 128, 139, 152, 168,
- 183, 200, 213, 228, 239, 251, 261, 272, 272, 161, 147, 135, 144, 154,
- 166, 181, 195, 212, 225, 240, 251, 264, 273, 284, 284, 177, 162, 149,
- 158, 167, 179, 193, 207, 222, 235, 250, 261, 273, 283, 293, 293, 197,
- 181, 167, 175, 183, 195, 207, 220, 234, 247, 261, 272, 284, 293, 303,
- 303, 197, 181, 167, 175, 183, 195, 207, 220, 234, 247, 261, 272, 284,
- 293, 303, 303,
- /* Size 32 */
- 64, 59, 54, 51, 47, 48, 49, 50, 51, 55, 59, 64, 69, 74, 80, 86, 94, 101,
- 108, 116, 126, 133, 141, 150, 161, 169, 177, 186, 197, 197, 197, 197,
- 59, 56, 54, 51, 49, 50, 50, 51, 52, 55, 58, 62, 67, 72, 77, 83, 90, 96,
- 103, 111, 120, 127, 135, 143, 153, 161, 169, 178, 189, 189, 189, 189,
- 54, 54, 53, 52, 51, 51, 51, 52, 52, 55, 58, 61, 65, 69, 74, 80, 87, 92,
- 99, 106, 115, 121, 129, 137, 147, 154, 162, 171, 181, 181, 181, 181, 51,
- 51, 52, 52, 53, 53, 52, 52, 52, 55, 57, 60, 63, 67, 72, 77, 83, 89, 95,
- 102, 110, 116, 123, 131, 141, 148, 155, 164, 174, 174, 174, 174, 47, 49,
- 51, 53, 55, 54, 53, 53, 52, 54, 57, 59, 62, 66, 70, 75, 80, 85, 91, 98,
- 105, 111, 118, 126, 135, 142, 149, 158, 167, 167, 167, 167, 48, 50, 51,
- 53, 54, 55, 55, 56, 57, 59, 61, 64, 67, 71, 75, 80, 85, 90, 96, 102,
- 110, 116, 123, 130, 139, 146, 153, 162, 171, 171, 171, 171, 49, 50, 51,
- 52, 53, 55, 57, 59, 62, 64, 67, 70, 73, 77, 81, 86, 91, 96, 102, 108,
- 115, 121, 128, 135, 144, 150, 158, 166, 175, 175, 175, 175, 50, 51, 52,
- 52, 53, 56, 59, 63, 68, 70, 73, 76, 80, 84, 88, 92, 97, 102, 108, 114,
- 121, 127, 133, 140, 148, 155, 162, 170, 179, 179, 179, 179, 51, 52, 52,
- 52, 52, 57, 62, 68, 75, 78, 81, 84, 88, 92, 96, 100, 105, 109, 115, 120,
- 127, 133, 139, 146, 154, 160, 167, 175, 183, 183, 183, 183, 55, 55, 55,
- 55, 54, 59, 64, 70, 78, 81, 85, 89, 94, 98, 102, 106, 111, 116, 121,
- 127, 133, 139, 145, 152, 160, 166, 173, 181, 189, 189, 189, 189, 59, 58,
- 58, 57, 57, 61, 67, 73, 81, 85, 89, 94, 100, 104, 108, 113, 118, 123,
- 128, 134, 140, 146, 152, 159, 166, 173, 179, 187, 195, 195, 195, 195,
- 64, 62, 61, 60, 59, 64, 70, 76, 84, 89, 94, 100, 107, 111, 116, 121,
- 126, 131, 137, 142, 148, 154, 160, 166, 173, 180, 186, 193, 201, 201,
- 201, 201, 69, 67, 65, 63, 62, 67, 73, 80, 88, 94, 100, 107, 115, 119,
- 124, 130, 136, 141, 146, 151, 157, 163, 168, 175, 181, 187, 193, 200,
- 207, 207, 207, 207, 74, 72, 69, 67, 66, 71, 77, 84, 92, 98, 104, 111,
- 119, 124, 130, 136, 142, 147, 152, 158, 164, 170, 175, 181, 188, 194,
- 200, 206, 213, 213, 213, 213, 80, 77, 74, 72, 70, 75, 81, 88, 96, 102,
- 108, 116, 124, 130, 136, 142, 149, 154, 159, 165, 172, 177, 183, 189,
- 195, 201, 207, 213, 220, 220, 220, 220, 86, 83, 80, 77, 75, 80, 86, 92,
- 100, 106, 113, 121, 130, 136, 142, 149, 156, 162, 167, 173, 180, 185,
- 191, 197, 203, 209, 214, 220, 227, 227, 227, 227, 94, 90, 87, 83, 80,
- 85, 91, 97, 105, 111, 118, 126, 136, 142, 149, 156, 165, 170, 176, 182,
- 189, 194, 200, 205, 212, 217, 222, 228, 234, 234, 234, 234, 101, 96, 92,
- 89, 85, 90, 96, 102, 109, 116, 123, 131, 141, 147, 154, 162, 170, 176,
- 182, 188, 195, 200, 206, 212, 218, 223, 229, 234, 240, 240, 240, 240,
- 108, 103, 99, 95, 91, 96, 102, 108, 115, 121, 128, 137, 146, 152, 159,
- 167, 176, 182, 188, 195, 202, 207, 213, 219, 225, 230, 235, 241, 247,
- 247, 247, 247, 116, 111, 106, 102, 98, 102, 108, 114, 120, 127, 134,
- 142, 151, 158, 165, 173, 182, 188, 195, 201, 209, 214, 220, 226, 232,
- 237, 242, 248, 254, 254, 254, 254, 126, 120, 115, 110, 105, 110, 115,
- 121, 127, 133, 140, 148, 157, 164, 172, 180, 189, 195, 202, 209, 216,
- 222, 228, 234, 240, 245, 250, 255, 261, 261, 261, 261, 133, 127, 121,
- 116, 111, 116, 121, 127, 133, 139, 146, 154, 163, 170, 177, 185, 194,
- 200, 207, 214, 222, 227, 233, 239, 245, 250, 255, 261, 266, 266, 266,
- 266, 141, 135, 129, 123, 118, 123, 128, 133, 139, 145, 152, 160, 168,
- 175, 183, 191, 200, 206, 213, 220, 228, 233, 239, 245, 251, 256, 261,
- 266, 272, 272, 272, 272, 150, 143, 137, 131, 126, 130, 135, 140, 146,
- 152, 159, 166, 175, 181, 189, 197, 205, 212, 219, 226, 234, 239, 245,
- 251, 257, 262, 267, 272, 278, 278, 278, 278, 161, 153, 147, 141, 135,
- 139, 144, 148, 154, 160, 166, 173, 181, 188, 195, 203, 212, 218, 225,
- 232, 240, 245, 251, 257, 264, 268, 273, 278, 284, 284, 284, 284, 169,
- 161, 154, 148, 142, 146, 150, 155, 160, 166, 173, 180, 187, 194, 201,
- 209, 217, 223, 230, 237, 245, 250, 256, 262, 268, 273, 278, 283, 288,
- 288, 288, 288, 177, 169, 162, 155, 149, 153, 158, 162, 167, 173, 179,
- 186, 193, 200, 207, 214, 222, 229, 235, 242, 250, 255, 261, 267, 273,
- 278, 283, 288, 293, 293, 293, 293, 186, 178, 171, 164, 158, 162, 166,
- 170, 175, 181, 187, 193, 200, 206, 213, 220, 228, 234, 241, 248, 255,
- 261, 266, 272, 278, 283, 288, 293, 298, 298, 298, 298, 197, 189, 181,
- 174, 167, 171, 175, 179, 183, 189, 195, 201, 207, 213, 220, 227, 234,
- 240, 247, 254, 261, 266, 272, 278, 284, 288, 293, 298, 303, 303, 303,
- 303, 197, 189, 181, 174, 167, 171, 175, 179, 183, 189, 195, 201, 207,
- 213, 220, 227, 234, 240, 247, 254, 261, 266, 272, 278, 284, 288, 293,
- 298, 303, 303, 303, 303, 197, 189, 181, 174, 167, 171, 175, 179, 183,
- 189, 195, 201, 207, 213, 220, 227, 234, 240, 247, 254, 261, 266, 272,
- 278, 284, 288, 293, 298, 303, 303, 303, 303, 197, 189, 181, 174, 167,
- 171, 175, 179, 183, 189, 195, 201, 207, 213, 220, 227, 234, 240, 247,
- 254, 261, 266, 272, 278, 284, 288, 293, 298, 303, 303, 303, 303 },
- { /* Intra matrices */
- /* Size 4 */
- 19, 21, 37, 63, 21, 33, 49, 70, 37, 49, 74, 96, 63, 70, 96, 119,
- /* Size 8 */
- 23, 17, 18, 25, 34, 47, 61, 77, 17, 19, 18, 22, 29, 38, 50, 64, 18, 18,
- 27, 32, 38, 47, 58, 71, 25, 22, 32, 42, 51, 60, 70, 81, 34, 29, 38, 51,
- 63, 73, 83, 94, 47, 38, 47, 60, 73, 85, 96, 106, 61, 50, 58, 70, 83, 96,
- 108, 118, 77, 64, 71, 81, 94, 106, 118, 127,
- /* Size 16 */
- 22, 18, 16, 17, 17, 20, 23, 27, 33, 38, 45, 51, 58, 65, 73, 73, 18, 18,
- 17, 17, 18, 20, 22, 25, 30, 34, 40, 46, 53, 59, 67, 67, 16, 17, 19, 18,
- 18, 19, 21, 24, 28, 32, 37, 42, 48, 54, 61, 61, 17, 17, 18, 19, 21, 23,
- 25, 28, 31, 35, 40, 45, 52, 57, 64, 64, 17, 18, 18, 21, 26, 28, 31, 33,
- 37, 40, 45, 50, 55, 61, 68, 68, 20, 20, 19, 23, 28, 31, 35, 38, 42, 46,
- 50, 55, 61, 66, 72, 72, 23, 22, 21, 25, 31, 35, 40, 44, 48, 52, 57, 61,
- 67, 72, 78, 78, 27, 25, 24, 28, 33, 38, 44, 48, 54, 58, 63, 67, 73, 78,
- 83, 83, 33, 30, 28, 31, 37, 42, 48, 54, 60, 64, 70, 74, 80, 84, 90, 90,
- 38, 34, 32, 35, 40, 46, 52, 58, 64, 69, 75, 80, 85, 90, 95, 95, 45, 40,
- 37, 40, 45, 50, 57, 63, 70, 75, 82, 87, 92, 97, 102, 102, 51, 46, 42,
- 45, 50, 55, 61, 67, 74, 80, 87, 92, 97, 102, 107, 107, 58, 53, 48, 52,
- 55, 61, 67, 73, 80, 85, 92, 97, 103, 107, 112, 112, 65, 59, 54, 57, 61,
- 66, 72, 78, 84, 90, 97, 102, 107, 112, 117, 117, 73, 67, 61, 64, 68, 72,
- 78, 83, 90, 95, 102, 107, 112, 117, 122, 122, 73, 67, 61, 64, 68, 72,
- 78, 83, 90, 95, 102, 107, 112, 117, 122, 122,
- /* Size 32 */
- 21, 19, 18, 17, 16, 16, 16, 17, 17, 18, 20, 21, 23, 25, 27, 29, 32, 34,
- 37, 40, 44, 46, 49, 53, 57, 60, 63, 67, 72, 72, 72, 72, 19, 19, 18, 17,
- 16, 16, 17, 17, 17, 18, 19, 21, 22, 24, 26, 28, 31, 33, 35, 38, 41, 44,
- 47, 50, 54, 57, 60, 64, 68, 68, 68, 68, 18, 18, 17, 17, 17, 17, 17, 17,
- 17, 18, 19, 20, 22, 23, 25, 27, 29, 31, 34, 36, 39, 42, 45, 48, 52, 54,
- 57, 61, 65, 65, 65, 65, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 19, 20,
- 21, 22, 24, 26, 28, 30, 32, 35, 38, 40, 43, 46, 49, 52, 55, 58, 62, 62,
- 62, 62, 16, 16, 17, 17, 18, 18, 18, 17, 17, 18, 19, 20, 21, 22, 23, 25,
- 27, 29, 31, 33, 36, 38, 41, 44, 47, 50, 53, 56, 60, 60, 60, 60, 16, 16,
- 17, 17, 18, 18, 18, 18, 19, 19, 20, 21, 22, 24, 25, 27, 29, 31, 33, 35,
- 38, 40, 42, 45, 49, 51, 54, 57, 61, 61, 61, 61, 16, 17, 17, 17, 18, 18,
- 19, 20, 20, 21, 22, 23, 24, 26, 27, 29, 31, 33, 35, 37, 40, 42, 44, 47,
- 50, 53, 56, 59, 63, 63, 63, 63, 17, 17, 17, 17, 17, 18, 20, 21, 22, 23,
- 24, 26, 27, 28, 30, 31, 33, 35, 37, 39, 42, 44, 46, 49, 52, 55, 58, 61,
- 64, 64, 64, 64, 17, 17, 17, 17, 17, 19, 20, 22, 25, 26, 27, 28, 30, 31,
- 32, 34, 36, 37, 39, 42, 44, 46, 49, 51, 54, 57, 60, 63, 66, 66, 66, 66,
- 18, 18, 18, 18, 18, 19, 21, 23, 26, 27, 29, 30, 32, 33, 35, 36, 38, 40,
- 42, 44, 46, 49, 51, 54, 57, 59, 62, 65, 68, 68, 68, 68, 20, 19, 19, 19,
- 19, 20, 22, 24, 27, 29, 30, 32, 34, 35, 37, 39, 41, 43, 45, 47, 49, 51,
- 54, 56, 59, 62, 64, 67, 71, 71, 71, 71, 21, 21, 20, 20, 20, 21, 23, 26,
- 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 57, 59, 62, 64,
- 67, 70, 73, 73, 73, 73, 23, 22, 22, 21, 21, 22, 24, 27, 30, 32, 34, 36,
- 39, 41, 43, 45, 47, 49, 51, 53, 56, 58, 60, 62, 65, 68, 70, 73, 76, 76,
- 76, 76, 25, 24, 23, 22, 22, 24, 26, 28, 31, 33, 35, 38, 41, 43, 45, 47,
- 50, 52, 54, 56, 58, 60, 63, 65, 68, 70, 73, 76, 78, 78, 78, 78, 27, 26,
- 25, 24, 23, 25, 27, 30, 32, 35, 37, 40, 43, 45, 47, 50, 52, 54, 56, 59,
- 61, 63, 66, 68, 71, 73, 76, 78, 81, 81, 81, 81, 29, 28, 27, 26, 25, 27,
- 29, 31, 34, 36, 39, 42, 45, 47, 50, 52, 55, 57, 60, 62, 65, 67, 69, 72,
- 74, 76, 79, 82, 84, 84, 84, 84, 32, 31, 29, 28, 27, 29, 31, 33, 36, 38,
- 41, 44, 47, 50, 52, 55, 58, 61, 63, 66, 68, 70, 73, 75, 78, 80, 82, 85,
- 88, 88, 88, 88, 34, 33, 31, 30, 29, 31, 33, 35, 37, 40, 43, 46, 49, 52,
- 54, 57, 61, 63, 65, 68, 71, 73, 75, 78, 80, 83, 85, 88, 90, 90, 90, 90,
- 37, 35, 34, 32, 31, 33, 35, 37, 39, 42, 45, 48, 51, 54, 56, 60, 63, 65,
- 68, 71, 74, 76, 78, 81, 83, 86, 88, 90, 93, 93, 93, 93, 40, 38, 36, 35,
- 33, 35, 37, 39, 42, 44, 47, 50, 53, 56, 59, 62, 66, 68, 71, 73, 77, 79,
- 81, 84, 87, 89, 91, 93, 96, 96, 96, 96, 44, 41, 39, 38, 36, 38, 40, 42,
- 44, 46, 49, 52, 56, 58, 61, 65, 68, 71, 74, 77, 80, 82, 85, 87, 90, 92,
- 94, 97, 99, 99, 99, 99, 46, 44, 42, 40, 38, 40, 42, 44, 46, 49, 51, 54,
- 58, 60, 63, 67, 70, 73, 76, 79, 82, 84, 87, 90, 92, 95, 97, 99, 102,
- 102, 102, 102, 49, 47, 45, 43, 41, 42, 44, 46, 49, 51, 54, 57, 60, 63,
- 66, 69, 73, 75, 78, 81, 85, 87, 89, 92, 95, 97, 99, 102, 104, 104, 104,
- 104, 53, 50, 48, 46, 44, 45, 47, 49, 51, 54, 56, 59, 62, 65, 68, 72, 75,
- 78, 81, 84, 87, 90, 92, 95, 98, 100, 102, 105, 107, 107, 107, 107, 57,
- 54, 52, 49, 47, 49, 50, 52, 54, 57, 59, 62, 65, 68, 71, 74, 78, 80, 83,
- 87, 90, 92, 95, 98, 101, 103, 105, 107, 110, 110, 110, 110, 60, 57, 54,
- 52, 50, 51, 53, 55, 57, 59, 62, 64, 68, 70, 73, 76, 80, 83, 86, 89, 92,
- 95, 97, 100, 103, 105, 107, 110, 112, 112, 112, 112, 63, 60, 57, 55, 53,
- 54, 56, 58, 60, 62, 64, 67, 70, 73, 76, 79, 82, 85, 88, 91, 94, 97, 99,
- 102, 105, 107, 109, 112, 114, 114, 114, 114, 67, 64, 61, 58, 56, 57, 59,
- 61, 63, 65, 67, 70, 73, 76, 78, 82, 85, 88, 90, 93, 97, 99, 102, 105,
- 107, 110, 112, 114, 117, 117, 117, 117, 72, 68, 65, 62, 60, 61, 63, 64,
- 66, 68, 71, 73, 76, 78, 81, 84, 88, 90, 93, 96, 99, 102, 104, 107, 110,
- 112, 114, 117, 119, 119, 119, 119, 72, 68, 65, 62, 60, 61, 63, 64, 66,
- 68, 71, 73, 76, 78, 81, 84, 88, 90, 93, 96, 99, 102, 104, 107, 110, 112,
- 114, 117, 119, 119, 119, 119, 72, 68, 65, 62, 60, 61, 63, 64, 66, 68,
- 71, 73, 76, 78, 81, 84, 88, 90, 93, 96, 99, 102, 104, 107, 110, 112,
- 114, 117, 119, 119, 119, 119, 72, 68, 65, 62, 60, 61, 63, 64, 66, 68,
- 71, 73, 76, 78, 81, 84, 88, 90, 93, 96, 99, 102, 104, 107, 110, 112,
- 114, 117, 119, 119, 119, 119 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 104, 114, 146, 104, 126, 136, 158, 114, 136, 178, 207, 146, 158,
- 207, 250,
- /* Size 8 */
- 64, 51, 96, 102, 109, 123, 141, 161, 51, 75, 98, 88, 91, 100, 114, 131,
- 96, 98, 116, 111, 111, 117, 128, 143, 102, 88, 111, 127, 134, 140, 150,
- 163, 109, 91, 111, 134, 151, 163, 174, 186, 123, 100, 117, 140, 163,
- 181, 196, 209, 141, 114, 128, 150, 174, 196, 214, 230, 161, 131, 143,
- 163, 186, 209, 230, 248,
- /* Size 16 */
- 64, 57, 51, 67, 96, 99, 102, 106, 109, 116, 123, 132, 141, 151, 161,
- 161, 57, 59, 61, 75, 97, 96, 94, 97, 99, 105, 111, 118, 126, 135, 144,
- 144, 51, 61, 75, 85, 98, 92, 88, 89, 91, 95, 100, 107, 114, 122, 131,
- 131, 67, 75, 85, 94, 106, 102, 98, 99, 100, 104, 108, 114, 121, 128,
- 137, 137, 96, 97, 98, 106, 116, 113, 111, 111, 111, 114, 117, 123, 128,
- 135, 143, 143, 99, 96, 92, 102, 113, 116, 119, 120, 121, 125, 128, 133,
- 138, 145, 152, 152, 102, 94, 88, 98, 111, 119, 127, 131, 134, 137, 140,
- 145, 150, 156, 163, 163, 106, 97, 89, 99, 111, 120, 131, 136, 142, 146,
- 151, 156, 161, 167, 173, 173, 109, 99, 91, 100, 111, 121, 134, 142, 151,
- 157, 163, 168, 174, 179, 186, 186, 116, 105, 95, 104, 114, 125, 137,
- 146, 157, 164, 172, 178, 184, 190, 196, 196, 123, 111, 100, 108, 117,
- 128, 140, 151, 163, 172, 181, 188, 196, 202, 209, 209, 132, 118, 107,
- 114, 123, 133, 145, 156, 168, 178, 188, 196, 205, 211, 219, 219, 141,
- 126, 114, 121, 128, 138, 150, 161, 174, 184, 196, 205, 214, 222, 230,
- 230, 151, 135, 122, 128, 135, 145, 156, 167, 179, 190, 202, 211, 222,
- 230, 238, 238, 161, 144, 131, 137, 143, 152, 163, 173, 186, 196, 209,
- 219, 230, 238, 248, 248, 161, 144, 131, 137, 143, 152, 163, 173, 186,
- 196, 209, 219, 230, 238, 248, 248,
- /* Size 32 */
- 64, 60, 57, 54, 51, 58, 67, 79, 96, 97, 99, 100, 102, 104, 106, 107,
- 109, 113, 116, 120, 123, 127, 132, 136, 141, 146, 151, 156, 161, 161,
- 161, 161, 60, 59, 58, 57, 56, 62, 70, 81, 96, 97, 97, 98, 98, 99, 101,
- 102, 104, 107, 110, 113, 117, 120, 124, 129, 133, 137, 142, 147, 152,
- 152, 152, 152, 57, 58, 59, 60, 61, 67, 75, 84, 97, 96, 96, 95, 94, 96,
- 97, 98, 99, 102, 105, 107, 111, 114, 118, 122, 126, 130, 135, 139, 144,
- 144, 144, 144, 54, 57, 60, 63, 67, 73, 79, 87, 97, 96, 94, 92, 91, 92,
- 93, 94, 95, 97, 100, 102, 105, 108, 112, 116, 120, 124, 128, 132, 137,
- 137, 137, 137, 51, 56, 61, 67, 75, 80, 85, 91, 98, 95, 92, 90, 88, 89,
- 89, 90, 91, 93, 95, 98, 100, 103, 107, 110, 114, 118, 122, 126, 131,
- 131, 131, 131, 58, 62, 67, 73, 80, 84, 89, 95, 102, 99, 97, 95, 93, 93,
- 94, 94, 95, 97, 99, 102, 104, 107, 110, 114, 117, 121, 125, 129, 134,
- 134, 134, 134, 67, 70, 75, 79, 85, 89, 94, 100, 106, 104, 102, 100, 98,
- 99, 99, 99, 100, 102, 104, 106, 108, 111, 114, 117, 121, 124, 128, 132,
- 137, 137, 137, 137, 79, 81, 84, 87, 91, 95, 100, 105, 110, 109, 107,
- 106, 104, 105, 105, 105, 105, 107, 109, 111, 112, 115, 118, 121, 125,
- 128, 132, 136, 140, 140, 140, 140, 96, 96, 97, 97, 98, 102, 106, 110,
- 116, 114, 113, 112, 111, 111, 111, 111, 111, 112, 114, 116, 117, 120,
- 123, 125, 128, 132, 135, 139, 143, 143, 143, 143, 97, 97, 96, 96, 95,
- 99, 104, 109, 114, 115, 115, 115, 115, 115, 115, 116, 116, 117, 119,
- 121, 122, 125, 128, 130, 133, 137, 140, 144, 148, 148, 148, 148, 99, 97,
- 96, 94, 92, 97, 102, 107, 113, 115, 116, 117, 119, 119, 120, 121, 121,
- 123, 125, 126, 128, 130, 133, 136, 138, 142, 145, 149, 152, 152, 152,
- 152, 100, 98, 95, 92, 90, 95, 100, 106, 112, 115, 117, 120, 123, 124,
- 125, 126, 127, 129, 131, 132, 134, 136, 139, 141, 144, 147, 150, 154,
- 157, 157, 157, 157, 102, 98, 94, 91, 88, 93, 98, 104, 111, 115, 119,
- 123, 127, 129, 131, 132, 134, 136, 137, 139, 140, 143, 145, 147, 150,
- 153, 156, 159, 163, 163, 163, 163, 104, 99, 96, 92, 89, 93, 99, 105,
- 111, 115, 119, 124, 129, 131, 133, 136, 138, 140, 142, 144, 146, 148,
- 150, 153, 155, 158, 161, 164, 168, 168, 168, 168, 106, 101, 97, 93, 89,
- 94, 99, 105, 111, 115, 120, 125, 131, 133, 136, 139, 142, 144, 146, 149,
- 151, 153, 156, 158, 161, 164, 167, 170, 173, 173, 173, 173, 107, 102,
- 98, 94, 90, 94, 99, 105, 111, 116, 121, 126, 132, 136, 139, 143, 147,
- 149, 151, 154, 157, 159, 162, 164, 167, 170, 173, 176, 179, 179, 179,
- 179, 109, 104, 99, 95, 91, 95, 100, 105, 111, 116, 121, 127, 134, 138,
- 142, 147, 151, 154, 157, 160, 163, 166, 168, 171, 174, 177, 179, 182,
- 186, 186, 186, 186, 113, 107, 102, 97, 93, 97, 102, 107, 112, 117, 123,
- 129, 136, 140, 144, 149, 154, 157, 160, 164, 167, 170, 173, 176, 179,
- 182, 185, 188, 191, 191, 191, 191, 116, 110, 105, 100, 95, 99, 104, 109,
- 114, 119, 125, 131, 137, 142, 146, 151, 157, 160, 164, 168, 172, 175,
- 178, 181, 184, 187, 190, 193, 196, 196, 196, 196, 120, 113, 107, 102,
- 98, 102, 106, 111, 116, 121, 126, 132, 139, 144, 149, 154, 160, 164,
- 168, 172, 176, 180, 183, 186, 190, 193, 196, 199, 202, 202, 202, 202,
- 123, 117, 111, 105, 100, 104, 108, 112, 117, 122, 128, 134, 140, 146,
- 151, 157, 163, 167, 172, 176, 181, 185, 188, 192, 196, 199, 202, 205,
- 209, 209, 209, 209, 127, 120, 114, 108, 103, 107, 111, 115, 120, 125,
- 130, 136, 143, 148, 153, 159, 166, 170, 175, 180, 185, 188, 192, 196,
- 200, 203, 207, 210, 214, 214, 214, 214, 132, 124, 118, 112, 107, 110,
- 114, 118, 123, 128, 133, 139, 145, 150, 156, 162, 168, 173, 178, 183,
- 188, 192, 196, 200, 205, 208, 211, 215, 219, 219, 219, 219, 136, 129,
- 122, 116, 110, 114, 117, 121, 125, 130, 136, 141, 147, 153, 158, 164,
- 171, 176, 181, 186, 192, 196, 200, 205, 209, 213, 216, 220, 224, 224,
- 224, 224, 141, 133, 126, 120, 114, 117, 121, 125, 128, 133, 138, 144,
- 150, 155, 161, 167, 174, 179, 184, 190, 196, 200, 205, 209, 214, 218,
- 222, 226, 230, 230, 230, 230, 146, 137, 130, 124, 118, 121, 124, 128,
- 132, 137, 142, 147, 153, 158, 164, 170, 177, 182, 187, 193, 199, 203,
- 208, 213, 218, 222, 226, 230, 234, 234, 234, 234, 151, 142, 135, 128,
- 122, 125, 128, 132, 135, 140, 145, 150, 156, 161, 167, 173, 179, 185,
- 190, 196, 202, 207, 211, 216, 222, 226, 230, 234, 238, 238, 238, 238,
- 156, 147, 139, 132, 126, 129, 132, 136, 139, 144, 149, 154, 159, 164,
- 170, 176, 182, 188, 193, 199, 205, 210, 215, 220, 226, 230, 234, 238,
- 243, 243, 243, 243, 161, 152, 144, 137, 131, 134, 137, 140, 143, 148,
- 152, 157, 163, 168, 173, 179, 186, 191, 196, 202, 209, 214, 219, 224,
- 230, 234, 238, 243, 248, 248, 248, 248, 161, 152, 144, 137, 131, 134,
- 137, 140, 143, 148, 152, 157, 163, 168, 173, 179, 186, 191, 196, 202,
- 209, 214, 219, 224, 230, 234, 238, 243, 248, 248, 248, 248, 161, 152,
- 144, 137, 131, 134, 137, 140, 143, 148, 152, 157, 163, 168, 173, 179,
- 186, 191, 196, 202, 209, 214, 219, 224, 230, 234, 238, 243, 248, 248,
- 248, 248, 161, 152, 144, 137, 131, 134, 137, 140, 143, 148, 152, 157,
- 163, 168, 173, 179, 186, 191, 196, 202, 209, 214, 219, 224, 230, 234,
- 238, 243, 248, 248, 248, 248 },
- { /* Intra matrices */
- /* Size 4 */
- 25, 42, 46, 60, 42, 51, 55, 65, 46, 55, 75, 88, 60, 65, 88, 109,
- /* Size 8 */
- 27, 22, 41, 44, 48, 54, 63, 72, 22, 32, 42, 38, 39, 43, 50, 58, 41, 42,
- 50, 49, 48, 51, 57, 64, 44, 38, 49, 56, 59, 62, 67, 73, 48, 39, 48, 59,
- 67, 73, 78, 84, 54, 43, 51, 62, 73, 82, 90, 96, 63, 50, 57, 67, 78, 90,
- 99, 107, 72, 58, 64, 73, 84, 96, 107, 117,
- /* Size 16 */
- 26, 23, 21, 27, 40, 41, 43, 44, 46, 49, 52, 56, 61, 65, 70, 70, 23, 24,
- 25, 31, 40, 40, 39, 40, 42, 44, 47, 50, 54, 58, 62, 62, 21, 25, 31, 35,
- 41, 39, 37, 37, 38, 40, 42, 45, 48, 52, 56, 56, 27, 31, 35, 39, 45, 43,
- 41, 41, 42, 44, 46, 48, 51, 55, 58, 58, 40, 40, 41, 45, 49, 48, 47, 47,
- 47, 48, 50, 52, 55, 58, 62, 62, 41, 40, 39, 43, 48, 49, 50, 51, 52, 53,
- 54, 57, 59, 62, 66, 66, 43, 39, 37, 41, 47, 50, 54, 56, 57, 59, 60, 62,
- 65, 68, 71, 71, 44, 40, 37, 41, 47, 51, 56, 58, 61, 63, 65, 67, 70, 73,
- 76, 76, 46, 42, 38, 42, 47, 52, 57, 61, 65, 68, 71, 73, 76, 79, 82, 82,
- 49, 44, 40, 44, 48, 53, 59, 63, 68, 71, 75, 78, 81, 84, 87, 87, 52, 47,
- 42, 46, 50, 54, 60, 65, 71, 75, 80, 83, 87, 90, 93, 93, 56, 50, 45, 48,
- 52, 57, 62, 67, 73, 78, 83, 87, 91, 95, 98, 98, 61, 54, 48, 51, 55, 59,
- 65, 70, 76, 81, 87, 91, 96, 100, 104, 104, 65, 58, 52, 55, 58, 62, 68,
- 73, 79, 84, 90, 95, 100, 104, 108, 108, 70, 62, 56, 58, 62, 66, 71, 76,
- 82, 87, 93, 98, 104, 108, 113, 113, 70, 62, 56, 58, 62, 66, 71, 76, 82,
- 87, 93, 98, 104, 108, 113, 113,
- /* Size 32 */
- 26, 24, 23, 22, 21, 23, 27, 32, 39, 40, 41, 41, 42, 43, 44, 44, 45, 47,
- 48, 50, 52, 53, 55, 57, 60, 62, 64, 66, 69, 69, 69, 69, 24, 24, 23, 23,
- 22, 25, 29, 33, 40, 40, 40, 40, 40, 41, 42, 42, 43, 44, 46, 47, 49, 50,
- 52, 54, 56, 58, 60, 62, 65, 65, 65, 65, 23, 23, 24, 24, 25, 27, 30, 34,
- 40, 40, 39, 39, 39, 39, 40, 40, 41, 42, 43, 45, 46, 47, 49, 51, 53, 55,
- 57, 59, 61, 61, 61, 61, 22, 23, 24, 26, 27, 30, 32, 36, 40, 39, 39, 38,
- 37, 38, 38, 39, 39, 40, 41, 42, 43, 45, 46, 48, 50, 52, 54, 56, 58, 58,
- 58, 58, 21, 22, 25, 27, 31, 33, 35, 37, 40, 39, 38, 37, 36, 36, 37, 37,
- 37, 38, 39, 40, 41, 43, 44, 46, 47, 49, 51, 53, 55, 55, 55, 55, 23, 25,
- 27, 30, 33, 34, 37, 39, 42, 41, 40, 39, 38, 38, 39, 39, 39, 40, 41, 42,
- 43, 44, 46, 47, 49, 50, 52, 54, 56, 56, 56, 56, 27, 29, 30, 32, 35, 37,
- 39, 41, 44, 43, 42, 41, 40, 41, 41, 41, 41, 42, 43, 44, 45, 46, 47, 49,
- 50, 52, 54, 56, 58, 58, 58, 58, 32, 33, 34, 36, 37, 39, 41, 43, 46, 45,
- 44, 44, 43, 43, 43, 43, 43, 44, 45, 46, 47, 48, 49, 51, 52, 54, 55, 57,
- 59, 59, 59, 59, 39, 40, 40, 40, 40, 42, 44, 46, 48, 48, 47, 47, 46, 46,
- 46, 46, 46, 47, 47, 48, 49, 50, 51, 52, 54, 55, 57, 59, 61, 61, 61, 61,
- 40, 40, 40, 39, 39, 41, 43, 45, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49,
- 50, 50, 51, 52, 53, 55, 56, 57, 59, 61, 63, 63, 63, 63, 41, 40, 39, 39,
- 38, 40, 42, 44, 47, 48, 48, 49, 50, 50, 50, 50, 51, 51, 52, 53, 54, 55,
- 56, 57, 58, 60, 61, 63, 65, 65, 65, 65, 41, 40, 39, 38, 37, 39, 41, 44,
- 47, 48, 49, 50, 51, 52, 52, 53, 53, 54, 55, 56, 56, 57, 58, 60, 61, 62,
- 64, 65, 67, 67, 67, 67, 42, 40, 39, 37, 36, 38, 40, 43, 46, 48, 50, 51,
- 53, 54, 55, 56, 56, 57, 58, 59, 59, 60, 61, 62, 64, 65, 66, 68, 69, 69,
- 69, 69, 43, 41, 39, 38, 36, 38, 41, 43, 46, 48, 50, 52, 54, 55, 56, 57,
- 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 69, 70, 72, 72, 72, 72, 44, 42,
- 40, 38, 37, 39, 41, 43, 46, 48, 50, 52, 55, 56, 57, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 69, 70, 71, 73, 74, 74, 74, 74, 44, 42, 40, 39, 37, 39,
- 41, 43, 46, 48, 50, 53, 56, 57, 59, 60, 62, 63, 64, 66, 67, 68, 69, 70,
- 72, 73, 74, 76, 77, 77, 77, 77, 45, 43, 41, 39, 37, 39, 41, 43, 46, 48,
- 51, 53, 56, 58, 60, 62, 64, 65, 67, 68, 70, 71, 72, 73, 75, 76, 77, 79,
- 80, 80, 80, 80, 47, 44, 42, 40, 38, 40, 42, 44, 47, 49, 51, 54, 57, 59,
- 61, 63, 65, 67, 68, 70, 72, 73, 74, 76, 77, 78, 80, 81, 83, 83, 83, 83,
- 48, 46, 43, 41, 39, 41, 43, 45, 47, 50, 52, 55, 58, 60, 62, 64, 67, 68,
- 70, 72, 74, 75, 77, 78, 80, 81, 83, 84, 86, 86, 86, 86, 50, 47, 45, 42,
- 40, 42, 44, 46, 48, 50, 53, 56, 59, 61, 63, 66, 68, 70, 72, 74, 76, 77,
- 79, 81, 82, 84, 85, 87, 89, 89, 89, 89, 52, 49, 46, 43, 41, 43, 45, 47,
- 49, 51, 54, 56, 59, 62, 64, 67, 70, 72, 74, 76, 78, 80, 82, 83, 85, 87,
- 88, 90, 92, 92, 92, 92, 53, 50, 47, 45, 43, 44, 46, 48, 50, 52, 55, 57,
- 60, 63, 65, 68, 71, 73, 75, 77, 80, 82, 83, 85, 87, 89, 91, 92, 94, 94,
- 94, 94, 55, 52, 49, 46, 44, 46, 47, 49, 51, 53, 56, 58, 61, 64, 66, 69,
- 72, 74, 77, 79, 82, 83, 85, 87, 90, 91, 93, 95, 97, 97, 97, 97, 57, 54,
- 51, 48, 46, 47, 49, 51, 52, 55, 57, 60, 62, 65, 67, 70, 73, 76, 78, 81,
- 83, 85, 87, 90, 92, 94, 95, 97, 99, 99, 99, 99, 60, 56, 53, 50, 47, 49,
- 50, 52, 54, 56, 58, 61, 64, 66, 69, 72, 75, 77, 80, 82, 85, 87, 90, 92,
- 94, 96, 98, 100, 102, 102, 102, 102, 62, 58, 55, 52, 49, 50, 52, 54, 55,
- 57, 60, 62, 65, 67, 70, 73, 76, 78, 81, 84, 87, 89, 91, 94, 96, 98, 100,
- 102, 104, 104, 104, 104, 64, 60, 57, 54, 51, 52, 54, 55, 57, 59, 61, 64,
- 66, 69, 71, 74, 77, 80, 83, 85, 88, 91, 93, 95, 98, 100, 102, 104, 107,
- 107, 107, 107, 66, 62, 59, 56, 53, 54, 56, 57, 59, 61, 63, 65, 68, 70,
- 73, 76, 79, 81, 84, 87, 90, 92, 95, 97, 100, 102, 104, 107, 109, 109,
- 109, 109, 69, 65, 61, 58, 55, 56, 58, 59, 61, 63, 65, 67, 69, 72, 74,
- 77, 80, 83, 86, 89, 92, 94, 97, 99, 102, 104, 107, 109, 111, 111, 111,
- 111, 69, 65, 61, 58, 55, 56, 58, 59, 61, 63, 65, 67, 69, 72, 74, 77, 80,
- 83, 86, 89, 92, 94, 97, 99, 102, 104, 107, 109, 111, 111, 111, 111, 69,
- 65, 61, 58, 55, 56, 58, 59, 61, 63, 65, 67, 69, 72, 74, 77, 80, 83, 86,
- 89, 92, 94, 97, 99, 102, 104, 107, 109, 111, 111, 111, 111, 69, 65, 61,
- 58, 55, 56, 58, 59, 61, 63, 65, 67, 69, 72, 74, 77, 80, 83, 86, 89, 92,
- 94, 97, 99, 102, 104, 107, 109, 111, 111, 111, 111 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 70, 116, 182, 70, 106, 148, 199, 116, 148, 207, 251, 182, 199, 251,
- 292,
- /* Size 8 */
- 64, 48, 52, 69, 92, 120, 150, 179, 48, 55, 53, 62, 79, 102, 128, 155,
- 52, 53, 74, 87, 101, 121, 144, 168, 69, 62, 87, 110, 129, 147, 166, 186,
- 92, 79, 101, 129, 153, 172, 190, 207, 120, 102, 121, 147, 172, 194, 211,
- 226, 150, 128, 144, 166, 190, 211, 228, 242, 179, 155, 168, 186, 207,
- 226, 242, 255,
- /* Size 16 */
- 64, 55, 48, 50, 52, 59, 69, 79, 92, 104, 120, 133, 150, 163, 179, 179,
- 55, 53, 51, 52, 52, 58, 65, 74, 85, 96, 110, 123, 138, 151, 166, 166,
- 48, 51, 55, 54, 53, 57, 62, 70, 79, 89, 102, 113, 128, 140, 155, 155,
- 50, 52, 54, 58, 62, 67, 72, 80, 89, 99, 111, 122, 135, 147, 161, 161,
- 52, 52, 53, 62, 74, 80, 87, 93, 101, 110, 121, 131, 144, 155, 168, 168,
- 59, 58, 57, 67, 80, 88, 97, 105, 113, 122, 133, 143, 154, 165, 177, 177,
- 69, 65, 62, 72, 87, 97, 110, 119, 129, 137, 147, 156, 166, 176, 186,
- 186, 79, 74, 70, 80, 93, 105, 119, 128, 140, 149, 158, 167, 177, 186,
- 196, 196, 92, 85, 79, 89, 101, 113, 129, 140, 153, 162, 172, 181, 190,
- 198, 207, 207, 104, 96, 89, 99, 110, 122, 137, 149, 162, 171, 182, 191,
- 200, 208, 216, 216, 120, 110, 102, 111, 121, 133, 147, 158, 172, 182,
- 194, 202, 211, 218, 226, 226, 133, 123, 113, 122, 131, 143, 156, 167,
- 181, 191, 202, 210, 219, 227, 234, 234, 150, 138, 128, 135, 144, 154,
- 166, 177, 190, 200, 211, 219, 228, 235, 242, 242, 163, 151, 140, 147,
- 155, 165, 176, 186, 198, 208, 218, 227, 235, 242, 249, 249, 179, 166,
- 155, 161, 168, 177, 186, 196, 207, 216, 226, 234, 242, 249, 255, 255,
- 179, 166, 155, 161, 168, 177, 186, 196, 207, 216, 226, 234, 242, 249,
- 255, 255,
- /* Size 32 */
- 64, 59, 55, 51, 48, 49, 50, 51, 52, 55, 59, 64, 69, 73, 79, 85, 92, 98,
- 104, 112, 120, 126, 133, 141, 150, 156, 163, 170, 179, 179, 179, 179,
- 59, 56, 54, 52, 50, 50, 51, 52, 52, 55, 59, 62, 67, 71, 76, 82, 89, 94,
- 100, 107, 115, 121, 128, 135, 144, 150, 156, 164, 172, 172, 172, 172,
- 55, 54, 53, 52, 51, 52, 52, 52, 52, 55, 58, 61, 65, 69, 74, 79, 85, 90,
- 96, 103, 110, 116, 123, 130, 138, 144, 151, 158, 166, 166, 166, 166, 51,
- 52, 52, 53, 53, 53, 53, 53, 53, 55, 58, 60, 63, 67, 72, 77, 82, 87, 93,
- 99, 106, 112, 118, 125, 133, 139, 145, 152, 160, 160, 160, 160, 48, 50,
- 51, 53, 55, 55, 54, 53, 53, 55, 57, 59, 62, 66, 70, 74, 79, 84, 89, 95,
- 102, 107, 113, 120, 128, 134, 140, 147, 155, 155, 155, 155, 49, 50, 52,
- 53, 55, 55, 56, 56, 57, 59, 61, 64, 67, 70, 74, 79, 84, 89, 94, 100,
- 106, 112, 117, 124, 131, 137, 144, 150, 158, 158, 158, 158, 50, 51, 52,
- 53, 54, 56, 58, 60, 62, 64, 67, 69, 72, 76, 80, 84, 89, 94, 99, 104,
- 111, 116, 122, 128, 135, 141, 147, 154, 161, 161, 161, 161, 51, 52, 52,
- 53, 53, 56, 60, 63, 67, 70, 73, 76, 79, 82, 86, 90, 95, 99, 104, 110,
- 116, 121, 126, 133, 139, 145, 151, 157, 164, 164, 164, 164, 52, 52, 52,
- 53, 53, 57, 62, 67, 74, 77, 80, 83, 87, 90, 93, 97, 101, 106, 110, 115,
- 121, 126, 131, 137, 144, 149, 155, 161, 168, 168, 168, 168, 55, 55, 55,
- 55, 55, 59, 64, 70, 77, 80, 84, 87, 92, 95, 99, 103, 107, 111, 116, 121,
- 126, 131, 137, 142, 149, 154, 160, 166, 172, 172, 172, 172, 59, 59, 58,
- 58, 57, 61, 67, 73, 80, 84, 88, 92, 97, 101, 105, 109, 113, 118, 122,
- 127, 133, 137, 143, 148, 154, 159, 165, 170, 177, 177, 177, 177, 64, 62,
- 61, 60, 59, 64, 69, 76, 83, 87, 92, 97, 103, 107, 111, 116, 121, 125,
- 129, 134, 139, 144, 149, 154, 160, 165, 170, 176, 181, 181, 181, 181,
- 69, 67, 65, 63, 62, 67, 72, 79, 87, 92, 97, 103, 110, 114, 119, 124,
- 129, 133, 137, 142, 147, 151, 156, 161, 166, 171, 176, 181, 186, 186,
- 186, 186, 73, 71, 69, 67, 66, 70, 76, 82, 90, 95, 101, 107, 114, 119,
- 123, 129, 134, 138, 143, 147, 152, 157, 161, 166, 172, 176, 181, 186,
- 191, 191, 191, 191, 79, 76, 74, 72, 70, 74, 80, 86, 93, 99, 105, 111,
- 119, 123, 128, 134, 140, 144, 149, 153, 158, 163, 167, 172, 177, 182,
- 186, 191, 196, 196, 196, 196, 85, 82, 79, 77, 74, 79, 84, 90, 97, 103,
- 109, 116, 124, 129, 134, 140, 146, 150, 155, 160, 165, 169, 174, 178,
- 183, 188, 192, 197, 202, 202, 202, 202, 92, 89, 85, 82, 79, 84, 89, 95,
- 101, 107, 113, 121, 129, 134, 140, 146, 153, 157, 162, 167, 172, 176,
- 181, 185, 190, 194, 198, 203, 207, 207, 207, 207, 98, 94, 90, 87, 84,
- 89, 94, 99, 106, 111, 118, 125, 133, 138, 144, 150, 157, 162, 167, 172,
- 177, 181, 186, 190, 195, 199, 203, 207, 212, 212, 212, 212, 104, 100,
- 96, 93, 89, 94, 99, 104, 110, 116, 122, 129, 137, 143, 149, 155, 162,
- 167, 171, 177, 182, 186, 191, 195, 200, 204, 208, 212, 216, 216, 216,
- 216, 112, 107, 103, 99, 95, 100, 104, 110, 115, 121, 127, 134, 142, 147,
- 153, 160, 167, 172, 177, 182, 188, 192, 196, 201, 205, 209, 213, 217,
- 221, 221, 221, 221, 120, 115, 110, 106, 102, 106, 111, 116, 121, 126,
- 133, 139, 147, 152, 158, 165, 172, 177, 182, 188, 194, 198, 202, 206,
- 211, 215, 218, 222, 226, 226, 226, 226, 126, 121, 116, 112, 107, 112,
- 116, 121, 126, 131, 137, 144, 151, 157, 163, 169, 176, 181, 186, 192,
- 198, 202, 206, 211, 215, 219, 222, 226, 230, 230, 230, 230, 133, 128,
- 123, 118, 113, 117, 122, 126, 131, 137, 143, 149, 156, 161, 167, 174,
- 181, 186, 191, 196, 202, 206, 210, 215, 219, 223, 227, 230, 234, 234,
- 234, 234, 141, 135, 130, 125, 120, 124, 128, 133, 137, 142, 148, 154,
- 161, 166, 172, 178, 185, 190, 195, 201, 206, 211, 215, 219, 224, 227,
- 231, 234, 238, 238, 238, 238, 150, 144, 138, 133, 128, 131, 135, 139,
- 144, 149, 154, 160, 166, 172, 177, 183, 190, 195, 200, 205, 211, 215,
- 219, 224, 228, 232, 235, 239, 242, 242, 242, 242, 156, 150, 144, 139,
- 134, 137, 141, 145, 149, 154, 159, 165, 171, 176, 182, 188, 194, 199,
- 204, 209, 215, 219, 223, 227, 232, 235, 238, 242, 246, 246, 246, 246,
- 163, 156, 151, 145, 140, 144, 147, 151, 155, 160, 165, 170, 176, 181,
- 186, 192, 198, 203, 208, 213, 218, 222, 227, 231, 235, 238, 242, 245,
- 249, 249, 249, 249, 170, 164, 158, 152, 147, 150, 154, 157, 161, 166,
- 170, 176, 181, 186, 191, 197, 203, 207, 212, 217, 222, 226, 230, 234,
- 239, 242, 245, 249, 252, 252, 252, 252, 179, 172, 166, 160, 155, 158,
- 161, 164, 168, 172, 177, 181, 186, 191, 196, 202, 207, 212, 216, 221,
- 226, 230, 234, 238, 242, 246, 249, 252, 255, 255, 255, 255, 179, 172,
- 166, 160, 155, 158, 161, 164, 168, 172, 177, 181, 186, 191, 196, 202,
- 207, 212, 216, 221, 226, 230, 234, 238, 242, 246, 249, 252, 255, 255,
- 255, 255, 179, 172, 166, 160, 155, 158, 161, 164, 168, 172, 177, 181,
- 186, 191, 196, 202, 207, 212, 216, 221, 226, 230, 234, 238, 242, 246,
- 249, 252, 255, 255, 255, 255, 179, 172, 166, 160, 155, 158, 161, 164,
- 168, 172, 177, 181, 186, 191, 196, 202, 207, 212, 216, 221, 226, 230,
- 234, 238, 242, 246, 249, 252, 255, 255, 255, 255 },
- { /* Intra matrices */
- /* Size 4 */
- 21, 23, 40, 65, 23, 36, 52, 72, 40, 52, 75, 93, 65, 72, 93, 111,
- /* Size 8 */
- 26, 19, 21, 28, 38, 50, 63, 77, 19, 22, 21, 25, 32, 42, 53, 66, 21, 21,
- 30, 35, 42, 50, 61, 72, 28, 25, 35, 46, 54, 62, 71, 81, 38, 32, 42, 54,
- 65, 74, 83, 92, 50, 42, 50, 62, 74, 85, 94, 101, 63, 53, 61, 71, 83, 94,
- 103, 110, 77, 66, 72, 81, 92, 101, 110, 117,
- /* Size 16 */
- 25, 21, 18, 19, 20, 23, 26, 31, 36, 41, 48, 54, 61, 67, 74, 74, 21, 20,
- 20, 20, 20, 22, 25, 29, 33, 38, 44, 49, 56, 61, 68, 68, 18, 20, 21, 21,
- 20, 22, 24, 27, 31, 35, 40, 45, 51, 57, 63, 63, 19, 20, 21, 22, 24, 26,
- 28, 31, 35, 39, 44, 49, 55, 60, 66, 66, 20, 20, 20, 24, 29, 31, 34, 37,
- 40, 44, 48, 53, 58, 63, 69, 69, 23, 22, 22, 26, 31, 34, 38, 41, 45, 49,
- 53, 58, 63, 68, 73, 73, 26, 25, 24, 28, 34, 38, 44, 47, 52, 55, 60, 64,
- 68, 73, 78, 78, 31, 29, 27, 31, 37, 41, 47, 52, 57, 60, 65, 69, 74, 78,
- 83, 83, 36, 33, 31, 35, 40, 45, 52, 57, 62, 67, 71, 75, 80, 84, 88, 88,
- 41, 38, 35, 39, 44, 49, 55, 60, 67, 71, 76, 80, 84, 88, 92, 92, 48, 44,
- 40, 44, 48, 53, 60, 65, 71, 76, 81, 85, 90, 94, 97, 97, 54, 49, 45, 49,
- 53, 58, 64, 69, 75, 80, 85, 90, 94, 98, 101, 101, 61, 56, 51, 55, 58,
- 63, 68, 74, 80, 84, 90, 94, 99, 102, 106, 106, 67, 61, 57, 60, 63, 68,
- 73, 78, 84, 88, 94, 98, 102, 105, 109, 109, 74, 68, 63, 66, 69, 73, 78,
- 83, 88, 92, 97, 101, 106, 109, 112, 112, 74, 68, 63, 66, 69, 73, 78, 83,
- 88, 92, 97, 101, 106, 109, 112, 112,
- /* Size 32 */
- 24, 22, 21, 19, 18, 18, 19, 19, 19, 21, 22, 24, 26, 28, 30, 32, 35, 38,
- 40, 43, 47, 50, 53, 56, 60, 63, 66, 69, 73, 73, 73, 73, 22, 21, 20, 19,
- 19, 19, 19, 19, 19, 21, 22, 23, 25, 27, 29, 31, 34, 36, 39, 41, 45, 47,
- 50, 53, 57, 60, 63, 66, 70, 70, 70, 70, 21, 20, 20, 19, 19, 19, 19, 19,
- 20, 21, 22, 23, 25, 26, 28, 30, 33, 35, 37, 40, 43, 45, 48, 51, 55, 57,
- 60, 63, 67, 67, 67, 67, 19, 19, 19, 20, 20, 20, 20, 20, 20, 21, 22, 23,
- 24, 25, 27, 29, 31, 33, 36, 38, 41, 43, 46, 49, 52, 55, 58, 61, 64, 64,
- 64, 64, 18, 19, 19, 20, 21, 20, 20, 20, 20, 21, 21, 22, 23, 25, 26, 28,
- 30, 32, 34, 37, 39, 42, 44, 47, 50, 53, 56, 59, 62, 62, 62, 62, 18, 19,
- 19, 20, 20, 21, 21, 21, 21, 22, 23, 24, 25, 27, 28, 30, 32, 34, 36, 38,
- 41, 43, 46, 49, 52, 54, 57, 60, 63, 63, 63, 63, 19, 19, 19, 20, 20, 21,
- 22, 22, 23, 24, 25, 26, 27, 29, 30, 32, 34, 36, 38, 40, 43, 45, 48, 50,
- 53, 56, 59, 62, 65, 65, 65, 65, 19, 19, 19, 20, 20, 21, 22, 24, 25, 26,
- 27, 29, 30, 31, 33, 35, 36, 38, 40, 43, 45, 47, 50, 52, 55, 58, 60, 63,
- 66, 66, 66, 66, 19, 19, 20, 20, 20, 21, 23, 25, 28, 29, 30, 32, 33, 34,
- 36, 37, 39, 41, 43, 45, 47, 49, 52, 54, 57, 59, 62, 65, 68, 68, 68, 68,
- 21, 21, 21, 21, 21, 22, 24, 26, 29, 30, 32, 33, 35, 37, 38, 40, 42, 43,
- 45, 47, 50, 52, 54, 57, 59, 62, 64, 67, 70, 70, 70, 70, 22, 22, 22, 22,
- 21, 23, 25, 27, 30, 32, 34, 35, 37, 39, 40, 42, 44, 46, 48, 50, 52, 54,
- 57, 59, 62, 64, 66, 69, 72, 72, 72, 72, 24, 23, 23, 23, 22, 24, 26, 29,
- 32, 33, 35, 38, 40, 42, 43, 45, 47, 49, 51, 53, 55, 57, 59, 62, 64, 66,
- 69, 71, 74, 74, 74, 74, 26, 25, 25, 24, 23, 25, 27, 30, 33, 35, 37, 40,
- 43, 45, 46, 48, 51, 52, 54, 56, 58, 60, 62, 65, 67, 69, 71, 74, 76, 76,
- 76, 76, 28, 27, 26, 25, 25, 27, 29, 31, 34, 37, 39, 42, 45, 46, 48, 51,
- 53, 55, 57, 59, 61, 63, 65, 67, 70, 72, 74, 76, 79, 79, 79, 79, 30, 29,
- 28, 27, 26, 28, 30, 33, 36, 38, 40, 43, 46, 48, 51, 53, 55, 57, 59, 61,
- 64, 66, 68, 70, 72, 74, 76, 79, 81, 81, 81, 81, 32, 31, 30, 29, 28, 30,
- 32, 35, 37, 40, 42, 45, 48, 51, 53, 55, 58, 60, 62, 64, 67, 69, 71, 73,
- 75, 77, 79, 81, 83, 83, 83, 83, 35, 34, 33, 31, 30, 32, 34, 36, 39, 42,
- 44, 47, 51, 53, 55, 58, 61, 63, 65, 67, 70, 72, 74, 76, 78, 80, 82, 84,
- 86, 86, 86, 86, 38, 36, 35, 33, 32, 34, 36, 38, 41, 43, 46, 49, 52, 55,
- 57, 60, 63, 65, 67, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 88, 88, 88,
- 40, 39, 37, 36, 34, 36, 38, 40, 43, 45, 48, 51, 54, 57, 59, 62, 65, 67,
- 70, 72, 74, 76, 78, 81, 83, 85, 86, 88, 91, 91, 91, 91, 43, 41, 40, 38,
- 37, 38, 40, 43, 45, 47, 50, 53, 56, 59, 61, 64, 67, 70, 72, 74, 77, 79,
- 81, 83, 85, 87, 89, 91, 93, 93, 93, 93, 47, 45, 43, 41, 39, 41, 43, 45,
- 47, 50, 52, 55, 58, 61, 64, 67, 70, 72, 74, 77, 80, 82, 84, 86, 88, 90,
- 92, 94, 95, 95, 95, 95, 50, 47, 45, 43, 42, 43, 45, 47, 49, 52, 54, 57,
- 60, 63, 66, 69, 72, 74, 76, 79, 82, 84, 86, 88, 90, 92, 94, 95, 97, 97,
- 97, 97, 53, 50, 48, 46, 44, 46, 48, 50, 52, 54, 57, 59, 62, 65, 68, 71,
- 74, 76, 78, 81, 84, 86, 88, 90, 92, 94, 96, 97, 99, 99, 99, 99, 56, 53,
- 51, 49, 47, 49, 50, 52, 54, 57, 59, 62, 65, 67, 70, 73, 76, 78, 81, 83,
- 86, 88, 90, 92, 94, 96, 98, 100, 101, 101, 101, 101, 60, 57, 55, 52, 50,
- 52, 53, 55, 57, 59, 62, 64, 67, 70, 72, 75, 78, 80, 83, 85, 88, 90, 92,
- 94, 97, 98, 100, 102, 104, 104, 104, 104, 63, 60, 57, 55, 53, 54, 56,
- 58, 59, 62, 64, 66, 69, 72, 74, 77, 80, 82, 85, 87, 90, 92, 94, 96, 98,
- 100, 102, 103, 105, 105, 105, 105, 66, 63, 60, 58, 56, 57, 59, 60, 62,
- 64, 66, 69, 71, 74, 76, 79, 82, 84, 86, 89, 92, 94, 96, 98, 100, 102,
- 103, 105, 107, 107, 107, 107, 69, 66, 63, 61, 59, 60, 62, 63, 65, 67,
- 69, 71, 74, 76, 79, 81, 84, 86, 88, 91, 94, 95, 97, 100, 102, 103, 105,
- 107, 108, 108, 108, 108, 73, 70, 67, 64, 62, 63, 65, 66, 68, 70, 72, 74,
- 76, 79, 81, 83, 86, 88, 91, 93, 95, 97, 99, 101, 104, 105, 107, 108,
- 110, 110, 110, 110, 73, 70, 67, 64, 62, 63, 65, 66, 68, 70, 72, 74, 76,
- 79, 81, 83, 86, 88, 91, 93, 95, 97, 99, 101, 104, 105, 107, 108, 110,
- 110, 110, 110, 73, 70, 67, 64, 62, 63, 65, 66, 68, 70, 72, 74, 76, 79,
- 81, 83, 86, 88, 91, 93, 95, 97, 99, 101, 104, 105, 107, 108, 110, 110,
- 110, 110, 73, 70, 67, 64, 62, 63, 65, 66, 68, 70, 72, 74, 76, 79, 81,
- 83, 86, 88, 91, 93, 95, 97, 99, 101, 104, 105, 107, 108, 110, 110, 110,
- 110 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 101, 110, 139, 101, 122, 130, 149, 110, 130, 167, 190, 139, 149,
- 190, 225,
- /* Size 8 */
- 64, 52, 94, 99, 106, 119, 134, 152, 52, 75, 96, 87, 89, 98, 110, 125,
- 94, 96, 112, 108, 108, 113, 123, 136, 99, 87, 108, 122, 128, 134, 142,
- 153, 106, 89, 108, 128, 143, 153, 162, 172, 119, 98, 113, 134, 153, 168,
- 180, 191, 134, 110, 123, 142, 162, 180, 195, 207, 152, 125, 136, 153,
- 172, 191, 207, 221,
- /* Size 16 */
- 64, 57, 52, 67, 94, 97, 99, 103, 106, 112, 119, 126, 134, 142, 152, 152,
- 57, 59, 61, 74, 95, 94, 93, 95, 97, 102, 107, 114, 121, 129, 137, 137,
- 52, 61, 75, 84, 96, 91, 87, 88, 89, 93, 98, 104, 110, 117, 125, 125, 67,
- 74, 84, 92, 103, 99, 96, 97, 97, 101, 105, 110, 116, 123, 130, 130, 94,
- 95, 96, 103, 112, 110, 108, 108, 108, 110, 113, 118, 123, 129, 136, 136,
- 97, 94, 91, 99, 110, 112, 115, 116, 117, 120, 123, 127, 132, 138, 144,
- 144, 99, 93, 87, 96, 108, 115, 122, 125, 128, 131, 134, 138, 142, 147,
- 153, 153, 103, 95, 88, 97, 108, 116, 125, 130, 135, 139, 143, 147, 151,
- 156, 162, 162, 106, 97, 89, 97, 108, 117, 128, 135, 143, 148, 153, 157,
- 162, 167, 172, 172, 112, 102, 93, 101, 110, 120, 131, 139, 148, 154,
- 160, 165, 171, 176, 181, 181, 119, 107, 98, 105, 113, 123, 134, 143,
- 153, 160, 168, 174, 180, 185, 191, 191, 126, 114, 104, 110, 118, 127,
- 138, 147, 157, 165, 174, 180, 187, 193, 199, 199, 134, 121, 110, 116,
- 123, 132, 142, 151, 162, 171, 180, 187, 195, 201, 207, 207, 142, 129,
- 117, 123, 129, 138, 147, 156, 167, 176, 185, 193, 201, 207, 214, 214,
- 152, 137, 125, 130, 136, 144, 153, 162, 172, 181, 191, 199, 207, 214,
- 221, 221, 152, 137, 125, 130, 136, 144, 153, 162, 172, 181, 191, 199,
- 207, 214, 221, 221,
- /* Size 32 */
- 64, 60, 57, 54, 52, 58, 67, 78, 94, 95, 97, 98, 99, 101, 103, 104, 106,
- 109, 112, 115, 119, 122, 126, 130, 134, 138, 142, 147, 152, 152, 152,
- 152, 60, 59, 58, 57, 56, 62, 70, 80, 94, 95, 95, 95, 96, 97, 99, 100,
- 101, 104, 107, 110, 113, 116, 120, 123, 127, 131, 135, 139, 144, 144,
- 144, 144, 57, 58, 59, 60, 61, 67, 74, 83, 95, 94, 94, 93, 93, 94, 95,
- 96, 97, 99, 102, 104, 107, 110, 114, 117, 121, 125, 129, 133, 137, 137,
- 137, 137, 54, 57, 60, 63, 67, 72, 79, 86, 95, 94, 92, 91, 89, 90, 91,
- 92, 93, 95, 97, 100, 102, 105, 109, 112, 115, 119, 123, 127, 131, 131,
- 131, 131, 52, 56, 61, 67, 75, 79, 84, 89, 96, 93, 91, 89, 87, 87, 88,
- 88, 89, 91, 93, 96, 98, 101, 104, 107, 110, 114, 117, 121, 125, 125,
- 125, 125, 58, 62, 67, 72, 79, 83, 88, 93, 99, 97, 95, 93, 91, 92, 92,
- 93, 93, 95, 97, 99, 101, 104, 107, 110, 113, 117, 120, 124, 128, 128,
- 128, 128, 67, 70, 74, 79, 84, 88, 92, 97, 103, 101, 99, 98, 96, 96, 97,
- 97, 97, 99, 101, 103, 105, 108, 110, 113, 116, 120, 123, 127, 130, 130,
- 130, 130, 78, 80, 83, 86, 89, 93, 97, 102, 107, 106, 104, 103, 102, 102,
- 102, 102, 102, 104, 106, 107, 109, 112, 114, 117, 120, 123, 126, 130,
- 133, 133, 133, 133, 94, 94, 95, 95, 96, 99, 103, 107, 112, 111, 110,
- 109, 108, 108, 108, 108, 108, 109, 110, 112, 113, 116, 118, 121, 123,
- 126, 129, 133, 136, 136, 136, 136, 95, 95, 94, 94, 93, 97, 101, 106,
- 111, 111, 111, 111, 111, 111, 112, 112, 112, 113, 115, 116, 118, 120,
- 122, 125, 127, 130, 133, 137, 140, 140, 140, 140, 97, 95, 94, 92, 91,
- 95, 99, 104, 110, 111, 112, 113, 115, 115, 116, 116, 117, 118, 120, 121,
- 123, 125, 127, 129, 132, 135, 138, 141, 144, 144, 144, 144, 98, 95, 93,
- 91, 89, 93, 98, 103, 109, 111, 113, 116, 118, 119, 120, 121, 122, 124,
- 125, 127, 128, 130, 132, 134, 137, 139, 142, 145, 148, 148, 148, 148,
- 99, 96, 93, 89, 87, 91, 96, 102, 108, 111, 115, 118, 122, 124, 125, 127,
- 128, 130, 131, 132, 134, 136, 138, 140, 142, 144, 147, 150, 153, 153,
- 153, 153, 101, 97, 94, 90, 87, 92, 96, 102, 108, 111, 115, 119, 124,
- 125, 127, 129, 132, 133, 135, 136, 138, 140, 142, 144, 146, 149, 152,
- 154, 157, 157, 157, 157, 103, 99, 95, 91, 88, 92, 97, 102, 108, 112,
- 116, 120, 125, 127, 130, 133, 135, 137, 139, 141, 143, 145, 147, 149,
- 151, 154, 156, 159, 162, 162, 162, 162, 104, 100, 96, 92, 88, 93, 97,
- 102, 108, 112, 116, 121, 127, 129, 133, 136, 139, 141, 143, 145, 148,
- 150, 152, 154, 156, 159, 161, 164, 167, 167, 167, 167, 106, 101, 97, 93,
- 89, 93, 97, 102, 108, 112, 117, 122, 128, 132, 135, 139, 143, 145, 148,
- 150, 153, 155, 157, 160, 162, 164, 167, 169, 172, 172, 172, 172, 109,
- 104, 99, 95, 91, 95, 99, 104, 109, 113, 118, 124, 130, 133, 137, 141,
- 145, 148, 151, 154, 157, 159, 161, 164, 166, 169, 171, 174, 176, 176,
- 176, 176, 112, 107, 102, 97, 93, 97, 101, 106, 110, 115, 120, 125, 131,
- 135, 139, 143, 148, 151, 154, 157, 160, 163, 165, 168, 171, 173, 176,
- 178, 181, 181, 181, 181, 115, 110, 104, 100, 96, 99, 103, 107, 112, 116,
- 121, 127, 132, 136, 141, 145, 150, 154, 157, 161, 164, 167, 170, 172,
- 175, 178, 180, 183, 186, 186, 186, 186, 119, 113, 107, 102, 98, 101,
- 105, 109, 113, 118, 123, 128, 134, 138, 143, 148, 153, 157, 160, 164,
- 168, 171, 174, 177, 180, 183, 185, 188, 191, 191, 191, 191, 122, 116,
- 110, 105, 101, 104, 108, 112, 116, 120, 125, 130, 136, 140, 145, 150,
- 155, 159, 163, 167, 171, 174, 177, 180, 184, 186, 189, 192, 195, 195,
- 195, 195, 126, 120, 114, 109, 104, 107, 110, 114, 118, 122, 127, 132,
- 138, 142, 147, 152, 157, 161, 165, 170, 174, 177, 180, 184, 187, 190,
- 193, 196, 199, 199, 199, 199, 130, 123, 117, 112, 107, 110, 113, 117,
- 121, 125, 129, 134, 140, 144, 149, 154, 160, 164, 168, 172, 177, 180,
- 184, 187, 191, 194, 197, 200, 203, 203, 203, 203, 134, 127, 121, 115,
- 110, 113, 116, 120, 123, 127, 132, 137, 142, 146, 151, 156, 162, 166,
- 171, 175, 180, 184, 187, 191, 195, 198, 201, 204, 207, 207, 207, 207,
- 138, 131, 125, 119, 114, 117, 120, 123, 126, 130, 135, 139, 144, 149,
- 154, 159, 164, 169, 173, 178, 183, 186, 190, 194, 198, 201, 204, 207,
- 211, 211, 211, 211, 142, 135, 129, 123, 117, 120, 123, 126, 129, 133,
- 138, 142, 147, 152, 156, 161, 167, 171, 176, 180, 185, 189, 193, 197,
- 201, 204, 207, 211, 214, 214, 214, 214, 147, 139, 133, 127, 121, 124,
- 127, 130, 133, 137, 141, 145, 150, 154, 159, 164, 169, 174, 178, 183,
- 188, 192, 196, 200, 204, 207, 211, 214, 217, 217, 217, 217, 152, 144,
- 137, 131, 125, 128, 130, 133, 136, 140, 144, 148, 153, 157, 162, 167,
- 172, 176, 181, 186, 191, 195, 199, 203, 207, 211, 214, 217, 221, 221,
- 221, 221, 152, 144, 137, 131, 125, 128, 130, 133, 136, 140, 144, 148,
- 153, 157, 162, 167, 172, 176, 181, 186, 191, 195, 199, 203, 207, 211,
- 214, 217, 221, 221, 221, 221, 152, 144, 137, 131, 125, 128, 130, 133,
- 136, 140, 144, 148, 153, 157, 162, 167, 172, 176, 181, 186, 191, 195,
- 199, 203, 207, 211, 214, 217, 221, 221, 221, 221, 152, 144, 137, 131,
- 125, 128, 130, 133, 136, 140, 144, 148, 153, 157, 162, 167, 172, 176,
- 181, 186, 191, 195, 199, 203, 207, 211, 214, 217, 221, 221, 221, 221 },
- { /* Intra matrices */
- /* Size 4 */
- 27, 44, 48, 61, 44, 53, 57, 66, 48, 57, 74, 86, 61, 66, 86, 103,
- /* Size 8 */
- 29, 23, 43, 46, 49, 56, 63, 72, 23, 34, 44, 40, 41, 45, 51, 59, 43, 44,
- 52, 50, 50, 53, 58, 64, 46, 40, 50, 57, 60, 63, 67, 73, 49, 41, 50, 60,
- 68, 73, 78, 83, 56, 45, 53, 63, 73, 81, 88, 93, 63, 51, 58, 67, 78, 88,
- 96, 102, 72, 59, 64, 73, 83, 93, 102, 110,
- /* Size 16 */
- 28, 25, 23, 29, 42, 43, 45, 46, 48, 51, 54, 58, 62, 66, 70, 70, 25, 26,
- 27, 33, 42, 42, 42, 43, 44, 46, 49, 52, 55, 59, 63, 63, 23, 27, 33, 37,
- 43, 41, 39, 39, 40, 42, 44, 47, 50, 53, 57, 57, 29, 33, 37, 41, 46, 45,
- 43, 44, 44, 46, 47, 50, 53, 56, 60, 60, 42, 42, 43, 46, 51, 50, 49, 49,
- 49, 50, 51, 54, 56, 59, 63, 63, 43, 42, 41, 45, 50, 51, 52, 53, 53, 55,
- 56, 58, 61, 63, 67, 67, 45, 42, 39, 43, 49, 52, 56, 57, 59, 60, 61, 63,
- 65, 68, 71, 71, 46, 43, 39, 44, 49, 53, 57, 60, 62, 64, 66, 68, 70, 73,
- 75, 75, 48, 44, 40, 44, 49, 53, 59, 62, 66, 69, 71, 73, 76, 78, 81, 81,
- 51, 46, 42, 46, 50, 55, 60, 64, 69, 72, 75, 77, 80, 83, 85, 85, 54, 49,
- 44, 47, 51, 56, 61, 66, 71, 75, 79, 82, 85, 88, 91, 91, 58, 52, 47, 50,
- 54, 58, 63, 68, 73, 77, 82, 85, 89, 92, 95, 95, 62, 55, 50, 53, 56, 61,
- 65, 70, 76, 80, 85, 89, 93, 96, 99, 99, 66, 59, 53, 56, 59, 63, 68, 73,
- 78, 83, 88, 92, 96, 99, 103, 103, 70, 63, 57, 60, 63, 67, 71, 75, 81,
- 85, 91, 95, 99, 103, 107, 107, 70, 63, 57, 60, 63, 67, 71, 75, 81, 85,
- 91, 95, 99, 103, 107, 107,
- /* Size 32 */
- 28, 26, 25, 23, 22, 25, 29, 34, 41, 42, 43, 43, 44, 45, 46, 46, 47, 49,
- 50, 52, 53, 55, 57, 59, 61, 63, 65, 67, 69, 69, 69, 69, 26, 26, 25, 25,
- 24, 27, 31, 35, 42, 42, 42, 42, 42, 43, 44, 44, 45, 46, 48, 49, 50, 52,
- 54, 55, 57, 59, 61, 63, 66, 66, 66, 66, 25, 25, 26, 26, 26, 29, 32, 37,
- 42, 42, 41, 41, 41, 41, 42, 42, 43, 44, 45, 46, 48, 49, 51, 53, 54, 56,
- 58, 60, 62, 62, 62, 62, 23, 25, 26, 28, 29, 32, 34, 38, 42, 41, 41, 40,
- 39, 40, 40, 41, 41, 42, 43, 44, 45, 47, 48, 50, 52, 53, 55, 57, 59, 59,
- 59, 59, 22, 24, 26, 29, 33, 35, 37, 39, 42, 41, 40, 39, 38, 38, 39, 39,
- 39, 40, 41, 42, 43, 45, 46, 48, 49, 51, 53, 54, 56, 56, 56, 56, 25, 27,
- 29, 32, 35, 37, 39, 41, 44, 43, 42, 41, 40, 40, 41, 41, 41, 42, 43, 44,
- 45, 46, 48, 49, 51, 52, 54, 56, 58, 58, 58, 58, 29, 31, 32, 34, 37, 39,
- 41, 43, 46, 45, 44, 43, 43, 43, 43, 43, 43, 44, 45, 46, 47, 48, 49, 51,
- 52, 54, 55, 57, 59, 59, 59, 59, 34, 35, 37, 38, 39, 41, 43, 45, 48, 47,
- 46, 46, 45, 45, 45, 45, 45, 46, 47, 48, 49, 50, 51, 52, 54, 55, 57, 58,
- 60, 60, 60, 60, 41, 42, 42, 42, 42, 44, 46, 48, 50, 49, 49, 49, 48, 48,
- 48, 48, 48, 49, 49, 50, 51, 52, 53, 54, 55, 57, 58, 60, 62, 62, 62, 62,
- 42, 42, 42, 41, 41, 43, 45, 47, 49, 50, 50, 50, 50, 50, 50, 50, 50, 51,
- 51, 52, 53, 54, 55, 56, 57, 59, 60, 62, 64, 64, 64, 64, 43, 42, 41, 41,
- 40, 42, 44, 46, 49, 50, 50, 51, 51, 52, 52, 52, 52, 53, 54, 54, 55, 56,
- 57, 58, 60, 61, 62, 64, 65, 65, 65, 65, 43, 42, 41, 40, 39, 41, 43, 46,
- 49, 50, 51, 52, 53, 54, 54, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63,
- 65, 66, 68, 68, 68, 68, 44, 42, 41, 39, 38, 40, 43, 45, 48, 50, 51, 53,
- 55, 56, 56, 57, 58, 58, 59, 60, 61, 61, 62, 63, 64, 66, 67, 68, 70, 70,
- 70, 70, 45, 43, 41, 40, 38, 40, 43, 45, 48, 50, 52, 54, 56, 57, 57, 58,
- 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 71, 72, 72, 72, 72, 46, 44,
- 42, 40, 39, 41, 43, 45, 48, 50, 52, 54, 56, 57, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 70, 72, 73, 74, 74, 74, 74, 46, 44, 42, 41, 39, 41,
- 43, 45, 48, 50, 52, 54, 57, 58, 60, 61, 63, 64, 65, 66, 67, 68, 70, 71,
- 72, 73, 74, 75, 77, 77, 77, 77, 47, 45, 43, 41, 39, 41, 43, 45, 48, 50,
- 52, 55, 58, 59, 61, 63, 65, 66, 67, 69, 70, 71, 72, 73, 75, 76, 77, 78,
- 79, 79, 79, 79, 49, 46, 44, 42, 40, 42, 44, 46, 49, 51, 53, 56, 58, 60,
- 62, 64, 66, 68, 69, 70, 72, 73, 74, 75, 77, 78, 79, 80, 82, 82, 82, 82,
- 50, 48, 45, 43, 41, 43, 45, 47, 49, 51, 54, 56, 59, 61, 63, 65, 67, 69,
- 70, 72, 74, 75, 76, 78, 79, 80, 81, 83, 84, 84, 84, 84, 52, 49, 46, 44,
- 42, 44, 46, 48, 50, 52, 54, 57, 60, 62, 64, 66, 69, 70, 72, 74, 76, 77,
- 78, 80, 81, 83, 84, 85, 87, 87, 87, 87, 53, 50, 48, 45, 43, 45, 47, 49,
- 51, 53, 55, 58, 61, 63, 65, 67, 70, 72, 74, 76, 78, 79, 81, 82, 84, 85,
- 86, 88, 89, 89, 89, 89, 55, 52, 49, 47, 45, 46, 48, 50, 52, 54, 56, 59,
- 61, 64, 66, 68, 71, 73, 75, 77, 79, 81, 82, 84, 86, 87, 88, 90, 91, 91,
- 91, 91, 57, 54, 51, 48, 46, 48, 49, 51, 53, 55, 57, 60, 62, 65, 67, 70,
- 72, 74, 76, 78, 81, 82, 84, 86, 87, 89, 90, 92, 93, 93, 93, 93, 59, 55,
- 53, 50, 48, 49, 51, 52, 54, 56, 58, 61, 63, 66, 68, 71, 73, 75, 78, 80,
- 82, 84, 86, 87, 89, 91, 92, 94, 96, 96, 96, 96, 61, 57, 54, 52, 49, 51,
- 52, 54, 55, 57, 60, 62, 64, 67, 69, 72, 75, 77, 79, 81, 84, 86, 87, 89,
- 91, 93, 95, 96, 98, 98, 98, 98, 63, 59, 56, 53, 51, 52, 54, 55, 57, 59,
- 61, 63, 66, 68, 70, 73, 76, 78, 80, 83, 85, 87, 89, 91, 93, 95, 96, 98,
- 100, 100, 100, 100, 65, 61, 58, 55, 53, 54, 55, 57, 58, 60, 62, 65, 67,
- 69, 72, 74, 77, 79, 81, 84, 86, 88, 90, 92, 95, 96, 98, 100, 102, 102,
- 102, 102, 67, 63, 60, 57, 54, 56, 57, 58, 60, 62, 64, 66, 68, 71, 73,
- 75, 78, 80, 83, 85, 88, 90, 92, 94, 96, 98, 100, 102, 103, 103, 103,
- 103, 69, 66, 62, 59, 56, 58, 59, 60, 62, 64, 65, 68, 70, 72, 74, 77, 79,
- 82, 84, 87, 89, 91, 93, 96, 98, 100, 102, 103, 105, 105, 105, 105, 69,
- 66, 62, 59, 56, 58, 59, 60, 62, 64, 65, 68, 70, 72, 74, 77, 79, 82, 84,
- 87, 89, 91, 93, 96, 98, 100, 102, 103, 105, 105, 105, 105, 69, 66, 62,
- 59, 56, 58, 59, 60, 62, 64, 65, 68, 70, 72, 74, 77, 79, 82, 84, 87, 89,
- 91, 93, 96, 98, 100, 102, 103, 105, 105, 105, 105, 69, 66, 62, 59, 56,
- 58, 59, 60, 62, 64, 65, 68, 70, 72, 74, 77, 79, 82, 84, 87, 89, 91, 93,
- 96, 98, 100, 102, 103, 105, 105, 105, 105 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 70, 112, 168, 70, 103, 139, 181, 112, 139, 188, 221, 168, 181, 221,
- 251,
- /* Size 8 */
- 64, 49, 53, 68, 90, 115, 139, 163, 49, 56, 53, 62, 78, 99, 121, 144, 53,
- 53, 74, 85, 98, 115, 135, 154, 68, 62, 85, 106, 122, 137, 153, 169, 90,
- 78, 98, 122, 142, 158, 172, 185, 115, 99, 115, 137, 158, 174, 188, 199,
- 139, 121, 135, 153, 172, 188, 200, 210, 163, 144, 154, 169, 185, 199,
- 210, 220,
- /* Size 16 */
- 64, 55, 49, 51, 53, 59, 68, 78, 90, 101, 115, 126, 139, 150, 163, 163,
- 55, 54, 52, 52, 53, 58, 65, 73, 84, 94, 106, 117, 130, 140, 153, 153,
- 49, 52, 56, 54, 53, 57, 62, 69, 78, 87, 99, 109, 121, 132, 144, 144, 51,
- 52, 54, 58, 62, 66, 72, 79, 87, 96, 106, 116, 128, 137, 149, 149, 53,
- 53, 53, 62, 74, 79, 85, 91, 98, 106, 115, 124, 135, 144, 154, 154, 59,
- 58, 57, 66, 79, 86, 94, 101, 109, 117, 125, 134, 143, 152, 161, 161, 68,
- 65, 62, 72, 85, 94, 106, 114, 122, 129, 137, 145, 153, 160, 169, 169,
- 78, 73, 69, 79, 91, 101, 114, 122, 131, 139, 147, 154, 162, 169, 176,
- 176, 90, 84, 78, 87, 98, 109, 122, 131, 142, 149, 158, 164, 172, 178,
- 185, 185, 101, 94, 87, 96, 106, 117, 129, 139, 149, 157, 166, 172, 179,
- 185, 191, 191, 115, 106, 99, 106, 115, 125, 137, 147, 158, 166, 174,
- 181, 188, 193, 199, 199, 126, 117, 109, 116, 124, 134, 145, 154, 164,
- 172, 181, 187, 194, 199, 204, 204, 139, 130, 121, 128, 135, 143, 153,
- 162, 172, 179, 188, 194, 200, 205, 210, 210, 150, 140, 132, 137, 144,
- 152, 160, 169, 178, 185, 193, 199, 205, 210, 215, 215, 163, 153, 144,
- 149, 154, 161, 169, 176, 185, 191, 199, 204, 210, 215, 220, 220, 163,
- 153, 144, 149, 154, 161, 169, 176, 185, 191, 199, 204, 210, 215, 220,
+/* Provide 16 sets of quantization matrices for chroma and luma
+ and each TX size. Matrices for different TX sizes are in fact
+ sub-sampled from the 32x32 and 16x16 sizes, but explicitly
+ defined here for convenience. Intra and inter matrix sets are the
+ same but changing DEFAULT_QM_INTER_OFFSET from zero allows
+ for different matrices for inter and intra blocks in the same
+ frame.
+ Matrices for different QM levels have been rescaled in the
+ frequency domain according to different nominal viewing
+ distances.
+ */
+static uint16_t iwt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE] = {
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 86, 173, 173, 334,
+#endif
+ /* Size 4x4 */
+ 65, 86, 146, 202, 86, 134, 189, 239, 146, 189, 274, 270, 202, 239, 270,
+ 405,
+ /* Size 8x8 */
+ 64, 65, 77, 103, 136, 168, 196, 230, 65, 71, 81, 99, 126, 152, 178, 212,
+ 77, 81, 108, 130, 156, 182, 200, 211, 103, 99, 130, 165, 195, 223, 222,
+ 228, 136, 126, 156, 195, 235, 269, 290, 277, 168, 152, 182, 223, 269,
+ 304, 296, 366, 196, 178, 200, 222, 290, 296, 368, 485, 230, 212, 211,
+ 228, 277, 366, 485, 446,
+ /* Size 16x16 */
+ 64, 63, 63, 68, 72, 88, 97, 118, 131, 160, 166, 184, 199, 216, 234, 253,
+ 63, 65, 65, 67, 69, 82, 89, 108, 119, 145, 150, 167, 182, 198, 215, 233,
+ 63, 65, 67, 71, 73, 84, 91, 108, 118, 143, 148, 163, 176, 189, 205, 223,
+ 68, 67, 71, 79, 85, 95, 102, 117, 126, 148, 153, 165, 170, 181, 192,
+ 209, 72, 69, 73, 85, 97, 108, 114, 128, 136, 158, 162, 177, 190, 191,
+ 225, 239, 88, 82, 84, 95, 108, 127, 134, 151, 159, 181, 185, 189, 210,
+ 199, 232, 252, 97, 89, 91, 102, 114, 134, 142, 161, 171, 193, 198, 218,
+ 209, 232, 231, 272, 118, 108, 108, 117, 128, 151, 161, 184, 196, 221,
+ 226, 226, 227, 263, 231, 296, 131, 119, 118, 126, 136, 159, 171, 196,
+ 210, 237, 242, 261, 273, 289, 245, 319, 160, 145, 143, 148, 158, 181,
+ 193, 221, 237, 268, 274, 278, 290, 272, 260, 359, 166, 150, 148, 153,
+ 162, 185, 198, 226, 242, 274, 280, 295, 286, 282, 297, 376, 184, 167,
+ 163, 165, 177, 189, 218, 226, 261, 278, 295, 319, 319, 329, 347, 429,
+ 199, 182, 176, 170, 190, 210, 209, 227, 273, 290, 286, 319, 351, 351,
+ 430, 448, 216, 198, 189, 181, 191, 199, 232, 263, 289, 272, 282, 329,
+ 351, 386, 385, 528, 234, 215, 205, 192, 225, 232, 231, 231, 245, 260,
+ 297, 347, 430, 385, 425, 418, 253, 233, 223, 209, 239, 252, 272, 296,
+ 319, 359, 376, 429, 448, 528, 418, 468,
+ /* Size 32x32 */
+ 64, 63, 63, 63, 63, 64, 68, 70, 72, 79, 88, 92, 97, 108, 118, 124, 131,
+ 143, 160, 163, 166, 177, 184, 192, 199, 207, 216, 225, 234, 243, 253,
+ 263, 63, 64, 64, 64, 64, 65, 68, 69, 70, 77, 85, 89, 93, 103, 113, 118,
+ 125, 136, 152, 154, 157, 168, 175, 182, 189, 196, 204, 213, 221, 230,
+ 239, 246, 63, 64, 65, 65, 65, 65, 67, 68, 69, 75, 82, 85, 89, 99, 108,
+ 113, 119, 130, 145, 147, 150, 160, 167, 174, 182, 190, 198, 206, 215,
+ 224, 233, 249, 63, 64, 65, 65, 66, 67, 69, 70, 71, 77, 83, 86, 90, 99,
+ 108, 113, 119, 129, 144, 146, 149, 159, 165, 173, 180, 187, 195, 202,
+ 211, 219, 228, 229, 63, 64, 65, 66, 67, 68, 71, 72, 73, 78, 84, 88, 91,
+ 100, 108, 113, 118, 129, 143, 145, 148, 157, 163, 169, 176, 181, 189,
+ 197, 205, 214, 223, 237, 64, 65, 65, 67, 68, 71, 74, 75, 77, 81, 85, 88,
+ 92, 99, 107, 111, 116, 126, 139, 141, 144, 152, 157, 163, 170, 178, 189,
+ 196, 204, 212, 220, 223, 68, 68, 67, 69, 71, 74, 79, 82, 85, 90, 95, 99,
+ 102, 109, 117, 121, 126, 136, 148, 151, 153, 161, 165, 166, 170, 176,
+ 181, 184, 192, 200, 209, 228, 70, 69, 68, 70, 72, 75, 82, 86, 91, 95,
+ 101, 104, 107, 114, 122, 126, 131, 141, 153, 155, 158, 166, 167, 173,
+ 186, 193, 198, 191, 196, 203, 210, 208, 72, 70, 69, 71, 73, 77, 85, 91,
+ 97, 101, 108, 111, 114, 120, 128, 132, 136, 146, 158, 160, 162, 171,
+ 177, 186, 190, 185, 191, 204, 225, 232, 239, 218, 79, 77, 75, 77, 78,
+ 81, 90, 95, 101, 108, 116, 119, 122, 130, 138, 142, 147, 156, 168, 171,
+ 173, 182, 188, 186, 187, 200, 213, 219, 204, 211, 218, 262, 88, 85, 82,
+ 83, 84, 85, 95, 101, 108, 116, 127, 130, 134, 143, 151, 155, 159, 169,
+ 181, 183, 185, 192, 189, 192, 210, 213, 199, 205, 232, 245, 252, 226,
+ 92, 89, 85, 86, 88, 88, 99, 104, 111, 119, 130, 134, 138, 148, 156, 160,
+ 165, 175, 187, 189, 191, 197, 198, 213, 207, 203, 226, 239, 227, 218,
+ 225, 273, 97, 93, 89, 90, 91, 92, 102, 107, 114, 122, 134, 138, 142,
+ 153, 161, 166, 171, 181, 193, 195, 198, 206, 218, 210, 209, 237, 232,
+ 215, 231, 266, 272, 232, 108, 103, 99, 99, 100, 99, 109, 114, 120, 130,
+ 143, 148, 153, 165, 174, 179, 185, 195, 208, 210, 213, 223, 221, 216,
+ 239, 222, 220, 263, 264, 228, 234, 297, 118, 113, 108, 108, 108, 107,
+ 117, 122, 128, 138, 151, 156, 161, 174, 184, 190, 196, 207, 221, 223,
+ 226, 232, 226, 248, 227, 235, 263, 232, 231, 292, 296, 241, 124, 118,
+ 113, 113, 113, 111, 121, 126, 132, 142, 155, 160, 166, 179, 190, 196,
+ 203, 214, 229, 231, 234, 238, 248, 241, 245, 271, 233, 263, 290, 241,
+ 244, 324, 131, 125, 119, 119, 118, 116, 126, 131, 136, 147, 159, 165,
+ 171, 185, 196, 203, 210, 222, 237, 239, 242, 251, 261, 246, 273, 242,
+ 289, 282, 245, 301, 319, 250, 143, 136, 130, 129, 129, 126, 136, 141,
+ 146, 156, 169, 175, 181, 195, 207, 214, 222, 235, 251, 253, 256, 269,
+ 257, 286, 252, 290, 272, 255, 327, 277, 257, 349, 160, 152, 145, 144,
+ 143, 139, 148, 153, 158, 168, 181, 187, 193, 208, 221, 229, 237, 251,
+ 268, 271, 274, 280, 278, 276, 290, 286, 272, 320, 260, 310, 359, 264,
+ 163, 154, 147, 146, 145, 141, 151, 155, 160, 171, 183, 189, 195, 210,
+ 223, 231, 239, 253, 271, 274, 277, 286, 305, 280, 307, 279, 335, 270,
+ 343, 311, 272, 394, 166, 157, 150, 149, 148, 144, 153, 158, 162, 173,
+ 185, 191, 198, 213, 226, 234, 242, 256, 274, 277, 280, 292, 295, 331,
+ 286, 336, 282, 366, 297, 309, 376, 278, 177, 168, 160, 159, 157, 152,
+ 161, 166, 171, 182, 192, 197, 206, 223, 232, 238, 251, 269, 280, 286,
+ 292, 304, 300, 306, 346, 296, 357, 301, 348, 366, 289, 409, 184, 175,
+ 167, 165, 163, 157, 165, 167, 177, 188, 189, 198, 218, 221, 226, 248,
+ 261, 257, 278, 305, 295, 300, 319, 307, 319, 351, 329, 350, 347, 316,
+ 429, 296, 192, 182, 174, 173, 169, 163, 166, 173, 186, 186, 192, 213,
+ 210, 216, 248, 241, 246, 286, 276, 280, 331, 306, 307, 334, 313, 334,
+ 351, 373, 337, 408, 309, 469, 199, 189, 182, 180, 176, 170, 170, 186,
+ 190, 187, 210, 207, 209, 239, 227, 245, 273, 252, 290, 307, 286, 346,
+ 319, 313, 351, 321, 351, 345, 430, 321, 448, 316, 207, 196, 190, 187,
+ 181, 178, 176, 193, 185, 200, 213, 203, 237, 222, 235, 271, 242, 290,
+ 286, 279, 336, 296, 351, 334, 321, 368, 329, 369, 337, 485, 328, 484,
+ 216, 204, 198, 195, 189, 189, 181, 198, 191, 213, 199, 226, 232, 220,
+ 263, 233, 289, 272, 272, 335, 282, 357, 329, 351, 351, 329, 386, 337,
+ 385, 345, 528, 336, 225, 213, 206, 202, 197, 196, 184, 191, 204, 219,
+ 205, 239, 215, 263, 232, 263, 282, 255, 320, 270, 366, 301, 350, 373,
+ 345, 369, 337, 405, 345, 401, 353, 574, 234, 221, 215, 211, 205, 204,
+ 192, 196, 225, 204, 232, 227, 231, 264, 231, 290, 245, 327, 260, 343,
+ 297, 348, 347, 337, 430, 337, 385, 345, 425, 353, 418, 361, 243, 230,
+ 224, 219, 214, 212, 200, 203, 232, 211, 245, 218, 266, 228, 292, 241,
+ 301, 277, 310, 311, 309, 366, 316, 408, 321, 485, 345, 401, 353, 446,
+ 362, 436, 253, 239, 233, 228, 223, 220, 209, 210, 239, 218, 252, 225,
+ 272, 234, 296, 244, 319, 257, 359, 272, 376, 289, 429, 309, 448, 328,
+ 528, 353, 418, 362, 468, 370, 263, 246, 249, 229, 237, 223, 228, 208,
+ 218, 262, 226, 273, 232, 297, 241, 324, 250, 349, 264, 394, 278, 409,
+ 296, 469, 316, 484, 336, 574, 361, 436, 370, 491,
+ /* Size 4x8 */
+ 64, 85, 151, 202, 66, 85, 138, 188, 75, 116, 168, 205, 99, 142, 207,
+ 256, 131, 169, 250, 260, 161, 193, 285, 301, 188, 214, 299, 358, 219,
+ 218, 266, 343,
+ /* Size 8x4 */
+ 64, 66, 75, 99, 131, 161, 188, 219, 85, 85, 116, 142, 169, 193, 214,
+ 218, 151, 138, 168, 207, 250, 285, 299, 266, 202, 188, 205, 256, 260,
+ 301, 358, 343,
+ /* Size 8x16 */
+ 64, 64, 72, 107, 131, 174, 199, 229, 63, 66, 69, 99, 119, 157, 182, 211,
+ 64, 68, 73, 100, 118, 154, 174, 202, 68, 74, 85, 109, 126, 159, 170,
+ 190, 72, 77, 96, 120, 136, 168, 179, 221, 88, 86, 107, 143, 159, 191,
+ 205, 235, 96, 93, 113, 152, 171, 204, 232, 256, 117, 108, 127, 174, 196,
+ 232, 231, 282, 130, 117, 136, 185, 210, 249, 237, 292, 159, 140, 158,
+ 208, 236, 282, 285, 309, 165, 145, 162, 212, 242, 289, 331, 310, 183,
+ 160, 176, 218, 259, 294, 333, 325, 198, 174, 187, 209, 273, 344, 314,
+ 327, 215, 188, 210, 229, 248, 281, 350, 337, 232, 205, 222, 261, 319,
+ 363, 364, 342, 252, 223, 237, 272, 320, 378, 451, 431,
+ /* Size 16x8 */
+ 64, 63, 64, 68, 72, 88, 96, 117, 130, 159, 165, 183, 198, 215, 232, 252,
+ 64, 66, 68, 74, 77, 86, 93, 108, 117, 140, 145, 160, 174, 188, 205, 223,
+ 72, 69, 73, 85, 96, 107, 113, 127, 136, 158, 162, 176, 187, 210, 222,
+ 237, 107, 99, 100, 109, 120, 143, 152, 174, 185, 208, 212, 218, 209,
+ 229, 261, 272, 131, 119, 118, 126, 136, 159, 171, 196, 210, 236, 242,
+ 259, 273, 248, 319, 320, 174, 157, 154, 159, 168, 191, 204, 232, 249,
+ 282, 289, 294, 344, 281, 363, 378, 199, 182, 174, 170, 179, 205, 232,
+ 231, 237, 285, 331, 333, 314, 350, 364, 451, 229, 211, 202, 190, 221,
+ 235, 256, 282, 292, 309, 310, 325, 327, 337, 342, 431,
+ /* Size 16x32 */
+ 64, 63, 64, 68, 72, 88, 107, 118, 131, 158, 174, 186, 199, 214, 229,
+ 245, 63, 64, 65, 68, 71, 85, 103, 113, 124, 151, 165, 176, 189, 202,
+ 216, 229, 63, 65, 66, 67, 69, 82, 99, 108, 119, 144, 157, 169, 182, 196,
+ 211, 232, 63, 65, 67, 69, 71, 83, 99, 108, 119, 143, 156, 168, 180, 193,
+ 206, 213, 64, 65, 68, 71, 73, 84, 100, 108, 118, 142, 154, 165, 174,
+ 188, 202, 221, 64, 66, 71, 74, 77, 85, 99, 107, 116, 138, 150, 159, 172,
+ 188, 200, 210, 68, 68, 74, 79, 85, 96, 109, 117, 126, 147, 159, 163,
+ 170, 176, 190, 214, 70, 69, 75, 82, 90, 101, 114, 122, 131, 152, 164,
+ 169, 187, 184, 192, 195, 72, 69, 77, 86, 96, 108, 120, 128, 136, 157,
+ 168, 183, 179, 200, 221, 205, 79, 75, 81, 90, 101, 116, 130, 138, 147,
+ 168, 179, 183, 195, 205, 201, 248, 88, 82, 86, 96, 107, 126, 143, 151,
+ 159, 180, 191, 189, 205, 200, 235, 213, 92, 86, 89, 99, 110, 130, 147,
+ 156, 165, 186, 197, 211, 198, 231, 209, 260, 96, 90, 93, 102, 113, 134,
+ 152, 161, 171, 192, 204, 210, 232, 208, 256, 220, 107, 99, 100, 109,
+ 120, 142, 164, 174, 185, 207, 219, 213, 220, 256, 218, 284, 117, 108,
+ 108, 117, 127, 150, 174, 184, 196, 220, 232, 242, 231, 228, 282, 230,
+ 123, 114, 112, 121, 132, 155, 179, 190, 203, 228, 240, 242, 266, 257,
+ 234, 311, 130, 120, 117, 126, 136, 159, 185, 196, 210, 236, 249, 242,
+ 237, 269, 292, 239, 142, 131, 127, 136, 146, 169, 195, 207, 222, 250,
+ 264, 276, 276, 260, 264, 335, 159, 145, 140, 148, 158, 181, 208, 221,
+ 236, 267, 282, 279, 285, 309, 309, 253, 162, 148, 142, 151, 160, 183,
+ 210, 224, 239, 270, 285, 275, 275, 263, 293, 380, 165, 151, 145, 153,
+ 162, 185, 212, 226, 242, 273, 289, 314, 331, 348, 310, 268, 176, 161,
+ 154, 161, 171, 193, 219, 232, 251, 285, 298, 305, 306, 301, 339, 393,
+ 183, 167, 160, 165, 176, 203, 218, 226, 259, 293, 294, 301, 333, 337,
+ 325, 285, 191, 174, 167, 167, 182, 208, 210, 231, 276, 275, 298, 327,
+ 330, 365, 375, 451, 198, 181, 174, 171, 187, 210, 209, 259, 273, 269,
+ 344, 318, 314, 340, 327, 304, 206, 188, 181, 177, 205, 214, 214, 264,
+ 242, 299, 337, 312, 358, 358, 454, 465, 215, 195, 188, 184, 210, 199,
+ 229, 264, 248, 325, 281, 372, 350, 328, 337, 324, 223, 203, 196, 191,
+ 216, 205, 257, 232, 272, 321, 288, 394, 327, 392, 388, 550, 232, 211,
+ 205, 198, 222, 212, 261, 232, 319, 260, 363, 340, 364, 390, 342, 348,
+ 242, 219, 214, 205, 229, 218, 266, 238, 319, 266, 382, 301, 462, 343,
+ 430, 420, 252, 228, 223, 212, 237, 225, 272, 244, 320, 272, 378, 308,
+ 451, 351, 431, 356, 262, 232, 237, 214, 220, 270, 232, 318, 250, 385,
+ 278, 457, 315, 543, 359, 471,
+ /* Size 32x16 */
+ 64, 63, 63, 63, 64, 64, 68, 70, 72, 79, 88, 92, 96, 107, 117, 123, 130,
+ 142, 159, 162, 165, 176, 183, 191, 198, 206, 215, 223, 232, 242, 252,
+ 262, 63, 64, 65, 65, 65, 66, 68, 69, 69, 75, 82, 86, 90, 99, 108, 114,
+ 120, 131, 145, 148, 151, 161, 167, 174, 181, 188, 195, 203, 211, 219,
+ 228, 232, 64, 65, 66, 67, 68, 71, 74, 75, 77, 81, 86, 89, 93, 100, 108,
+ 112, 117, 127, 140, 142, 145, 154, 160, 167, 174, 181, 188, 196, 205,
+ 214, 223, 237, 68, 68, 67, 69, 71, 74, 79, 82, 86, 90, 96, 99, 102, 109,
+ 117, 121, 126, 136, 148, 151, 153, 161, 165, 167, 171, 177, 184, 191,
+ 198, 205, 212, 214, 72, 71, 69, 71, 73, 77, 85, 90, 96, 101, 107, 110,
+ 113, 120, 127, 132, 136, 146, 158, 160, 162, 171, 176, 182, 187, 205,
+ 210, 216, 222, 229, 237, 220, 88, 85, 82, 83, 84, 85, 96, 101, 108, 116,
+ 126, 130, 134, 142, 150, 155, 159, 169, 181, 183, 185, 193, 203, 208,
+ 210, 214, 199, 205, 212, 218, 225, 270, 107, 103, 99, 99, 100, 99, 109,
+ 114, 120, 130, 143, 147, 152, 164, 174, 179, 185, 195, 208, 210, 212,
+ 219, 218, 210, 209, 214, 229, 257, 261, 266, 272, 232, 118, 113, 108,
+ 108, 108, 107, 117, 122, 128, 138, 151, 156, 161, 174, 184, 190, 196,
+ 207, 221, 224, 226, 232, 226, 231, 259, 264, 264, 232, 232, 238, 244,
+ 318, 131, 124, 119, 119, 118, 116, 126, 131, 136, 147, 159, 165, 171,
+ 185, 196, 203, 210, 222, 236, 239, 242, 251, 259, 276, 273, 242, 248,
+ 272, 319, 319, 320, 250, 158, 151, 144, 143, 142, 138, 147, 152, 157,
+ 168, 180, 186, 192, 207, 220, 228, 236, 250, 267, 270, 273, 285, 293,
+ 275, 269, 299, 325, 321, 260, 266, 272, 385, 174, 165, 157, 156, 154,
+ 150, 159, 164, 168, 179, 191, 197, 204, 219, 232, 240, 249, 264, 282,
+ 285, 289, 298, 294, 298, 344, 337, 281, 288, 363, 382, 378, 278, 186,
+ 176, 169, 168, 165, 159, 163, 169, 183, 183, 189, 211, 210, 213, 242,
+ 242, 242, 276, 279, 275, 314, 305, 301, 327, 318, 312, 372, 394, 340,
+ 301, 308, 457, 199, 189, 182, 180, 174, 172, 170, 187, 179, 195, 205,
+ 198, 232, 220, 231, 266, 237, 276, 285, 275, 331, 306, 333, 330, 314,
+ 358, 350, 327, 364, 462, 451, 315, 214, 202, 196, 193, 188, 188, 176,
+ 184, 200, 205, 200, 231, 208, 256, 228, 257, 269, 260, 309, 263, 348,
+ 301, 337, 365, 340, 358, 328, 392, 390, 343, 351, 543, 229, 216, 211,
+ 206, 202, 200, 190, 192, 221, 201, 235, 209, 256, 218, 282, 234, 292,
+ 264, 309, 293, 310, 339, 325, 375, 327, 454, 337, 388, 342, 430, 431,
+ 359, 245, 229, 232, 213, 221, 210, 214, 195, 205, 248, 213, 260, 220,
+ 284, 230, 311, 239, 335, 253, 380, 268, 393, 285, 451, 304, 465, 324,
+ 550, 348, 420, 356, 471,
+ /* Size 4x16 */
+ 63, 88, 158, 214, 65, 82, 144, 196, 65, 84, 142, 188, 68, 96, 147, 176,
+ 69, 108, 157, 200, 82, 126, 180, 200, 90, 134, 192, 208, 108, 150, 220,
+ 228, 120, 159, 236, 269, 145, 181, 267, 309, 151, 185, 273, 348, 167,
+ 203, 293, 337, 181, 210, 269, 340, 195, 199, 325, 328, 211, 212, 260,
+ 390, 228, 225, 272, 351,
+ /* Size 16x4 */
+ 63, 65, 65, 68, 69, 82, 90, 108, 120, 145, 151, 167, 181, 195, 211, 228,
+ 88, 82, 84, 96, 108, 126, 134, 150, 159, 181, 185, 203, 210, 199, 212,
+ 225, 158, 144, 142, 147, 157, 180, 192, 220, 236, 267, 273, 293, 269,
+ 325, 260, 272, 214, 196, 188, 176, 200, 200, 208, 228, 269, 309, 348,
+ 337, 340, 328, 390, 351,
+ /* Size 8x32 */
+ 64, 64, 72, 107, 131, 174, 199, 229, 63, 65, 71, 103, 124, 165, 189,
+ 216, 63, 66, 69, 99, 119, 157, 182, 211, 63, 67, 71, 99, 119, 156, 180,
+ 206, 64, 68, 73, 100, 118, 154, 174, 202, 64, 71, 77, 99, 116, 150, 172,
+ 200, 68, 74, 85, 109, 126, 159, 170, 190, 70, 75, 90, 114, 131, 164,
+ 187, 192, 72, 77, 96, 120, 136, 168, 179, 221, 79, 81, 101, 130, 147,
+ 179, 195, 201, 88, 86, 107, 143, 159, 191, 205, 235, 92, 89, 110, 147,
+ 165, 197, 198, 209, 96, 93, 113, 152, 171, 204, 232, 256, 107, 100, 120,
+ 164, 185, 219, 220, 218, 117, 108, 127, 174, 196, 232, 231, 282, 123,
+ 112, 132, 179, 203, 240, 266, 234, 130, 117, 136, 185, 210, 249, 237,
+ 292, 142, 127, 146, 195, 222, 264, 276, 264, 159, 140, 158, 208, 236,
+ 282, 285, 309, 162, 142, 160, 210, 239, 285, 275, 293, 165, 145, 162,
+ 212, 242, 289, 331, 310, 176, 154, 171, 219, 251, 298, 306, 339, 183,
+ 160, 176, 218, 259, 294, 333, 325, 191, 167, 182, 210, 276, 298, 330,
+ 375, 198, 174, 187, 209, 273, 344, 314, 327, 206, 181, 205, 214, 242,
+ 337, 358, 454, 215, 188, 210, 229, 248, 281, 350, 337, 223, 196, 216,
+ 257, 272, 288, 327, 388, 232, 205, 222, 261, 319, 363, 364, 342, 242,
+ 214, 229, 266, 319, 382, 462, 430, 252, 223, 237, 272, 320, 378, 451,
+ 431, 262, 237, 220, 232, 250, 278, 315, 359,
+ /* Size 32x8 */
+ 64, 63, 63, 63, 64, 64, 68, 70, 72, 79, 88, 92, 96, 107, 117, 123, 130,
+ 142, 159, 162, 165, 176, 183, 191, 198, 206, 215, 223, 232, 242, 252,
+ 262, 64, 65, 66, 67, 68, 71, 74, 75, 77, 81, 86, 89, 93, 100, 108, 112,
+ 117, 127, 140, 142, 145, 154, 160, 167, 174, 181, 188, 196, 205, 214,
+ 223, 237, 72, 71, 69, 71, 73, 77, 85, 90, 96, 101, 107, 110, 113, 120,
+ 127, 132, 136, 146, 158, 160, 162, 171, 176, 182, 187, 205, 210, 216,
+ 222, 229, 237, 220, 107, 103, 99, 99, 100, 99, 109, 114, 120, 130, 143,
+ 147, 152, 164, 174, 179, 185, 195, 208, 210, 212, 219, 218, 210, 209,
+ 214, 229, 257, 261, 266, 272, 232, 131, 124, 119, 119, 118, 116, 126,
+ 131, 136, 147, 159, 165, 171, 185, 196, 203, 210, 222, 236, 239, 242,
+ 251, 259, 276, 273, 242, 248, 272, 319, 319, 320, 250, 174, 165, 157,
+ 156, 154, 150, 159, 164, 168, 179, 191, 197, 204, 219, 232, 240, 249,
+ 264, 282, 285, 289, 298, 294, 298, 344, 337, 281, 288, 363, 382, 378,
+ 278, 199, 189, 182, 180, 174, 172, 170, 187, 179, 195, 205, 198, 232,
+ 220, 231, 266, 237, 276, 285, 275, 331, 306, 333, 330, 314, 358, 350,
+ 327, 364, 462, 451, 315, 229, 216, 211, 206, 202, 200, 190, 192, 221,
+ 201, 235, 209, 256, 218, 282, 234, 292, 264, 309, 293, 310, 339, 325,
+ 375, 327, 454, 337, 388, 342, 430, 431, 359 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 101, 125, 125, 205,
+#endif
+ /* Size 4x4 */
+ 71, 92, 115, 138, 92, 120, 139, 155, 115, 139, 180, 173, 138, 155, 173,
+ 232,
+ /* Size 8x8 */
+ 63, 77, 94, 100, 114, 128, 139, 151, 77, 95, 93, 94, 104, 115, 125, 139,
+ 94, 93, 109, 115, 123, 132, 138, 138, 100, 94, 115, 133, 145, 155, 150,
+ 147, 114, 104, 123, 145, 164, 178, 184, 173, 128, 115, 132, 155, 178,
+ 193, 188, 214, 139, 125, 138, 150, 184, 188, 218, 261, 151, 139, 138,
+ 147, 173, 214, 261, 247,
+ /* Size 16x16 */
+ 64, 61, 67, 83, 98, 98, 101, 109, 114, 127, 130, 138, 144, 150, 157,
+ 163, 61, 64, 71, 85, 93, 90, 93, 99, 104, 115, 117, 125, 131, 137, 144,
+ 150, 67, 71, 78, 90, 95, 91, 93, 99, 102, 113, 115, 121, 126, 130, 136,
+ 143, 83, 85, 90, 97, 101, 98, 100, 104, 107, 115, 117, 121, 121, 125,
+ 127, 134, 98, 93, 95, 101, 106, 107, 108, 111, 113, 121, 123, 128, 134,
+ 131, 147, 151, 98, 90, 91, 98, 107, 117, 120, 125, 127, 135, 136, 135,
+ 145, 136, 151, 158, 101, 93, 93, 100, 108, 120, 123, 130, 134, 142, 143,
+ 151, 144, 154, 150, 168, 109, 99, 99, 104, 111, 125, 130, 142, 147, 156,
+ 158, 156, 154, 170, 151, 180, 114, 104, 102, 107, 113, 127, 134, 147,
+ 153, 164, 166, 173, 177, 183, 158, 191, 127, 115, 113, 115, 121, 135,
+ 142, 156, 164, 178, 180, 181, 186, 175, 166, 209, 130, 117, 115, 117,
+ 123, 136, 143, 158, 166, 180, 183, 189, 184, 180, 185, 216, 138, 125,
+ 121, 121, 128, 135, 151, 156, 173, 181, 189, 199, 199, 202, 207, 239,
+ 144, 131, 126, 121, 134, 145, 144, 154, 177, 186, 184, 199, 212, 211,
+ 241, 246, 150, 137, 130, 125, 131, 136, 154, 170, 183, 175, 180, 202,
+ 211, 225, 224, 276, 157, 144, 136, 127, 147, 151, 150, 151, 158, 166,
+ 185, 207, 241, 224, 240, 236, 163, 150, 143, 134, 151, 158, 168, 180,
+ 191, 209, 216, 239, 246, 276, 236, 255,
+ /* Size 32x32 */
+ 64, 62, 61, 64, 67, 73, 83, 90, 98, 97, 98, 100, 101, 104, 109, 112,
+ 114, 120, 127, 128, 130, 135, 138, 141, 144, 147, 150, 153, 157, 160,
+ 163, 167, 62, 63, 62, 66, 69, 77, 85, 90, 95, 94, 94, 95, 97, 100, 104,
+ 106, 109, 114, 121, 122, 123, 128, 130, 133, 136, 139, 142, 145, 148,
+ 151, 154, 156, 61, 62, 64, 67, 71, 80, 85, 89, 93, 91, 90, 91, 93, 95,
+ 99, 102, 104, 109, 115, 116, 117, 122, 125, 128, 131, 134, 137, 140,
+ 144, 147, 150, 158, 64, 66, 67, 71, 74, 83, 87, 90, 94, 92, 90, 92, 93,
+ 95, 99, 101, 103, 108, 114, 115, 116, 120, 123, 126, 130, 132, 135, 138,
+ 141, 144, 147, 145, 67, 69, 71, 74, 78, 87, 90, 92, 95, 93, 91, 92, 93,
+ 95, 99, 100, 102, 107, 113, 114, 115, 119, 121, 123, 126, 127, 130, 133,
+ 136, 140, 143, 150, 73, 77, 80, 83, 87, 95, 95, 95, 96, 93, 91, 92, 92,
+ 94, 97, 98, 100, 104, 109, 110, 111, 115, 116, 119, 122, 125, 131, 134,
+ 136, 139, 142, 140, 83, 85, 85, 87, 90, 95, 97, 99, 101, 99, 98, 99,
+ 100, 101, 104, 105, 107, 111, 115, 116, 117, 120, 121, 120, 121, 123,
+ 125, 124, 127, 131, 134, 144, 90, 90, 89, 90, 92, 95, 99, 101, 103, 103,
+ 103, 103, 104, 105, 107, 109, 110, 114, 118, 119, 120, 123, 123, 125,
+ 131, 134, 135, 130, 131, 133, 136, 130, 98, 95, 93, 94, 95, 96, 101,
+ 103, 106, 106, 107, 108, 108, 109, 111, 112, 113, 117, 121, 122, 123,
+ 126, 128, 133, 134, 129, 131, 137, 147, 149, 151, 138, 97, 94, 91, 92,
+ 93, 93, 99, 103, 106, 109, 111, 112, 113, 115, 117, 119, 120, 123, 127,
+ 128, 129, 132, 135, 132, 132, 138, 144, 145, 136, 138, 140, 162, 98, 94,
+ 90, 90, 91, 91, 98, 103, 107, 111, 117, 118, 120, 123, 125, 126, 127,
+ 131, 135, 135, 136, 138, 135, 136, 145, 145, 136, 138, 151, 156, 158,
+ 143, 100, 95, 91, 92, 92, 92, 99, 103, 108, 112, 118, 120, 121, 125,
+ 128, 129, 131, 134, 138, 139, 140, 141, 141, 148, 143, 140, 150, 155,
+ 148, 142, 144, 167, 101, 97, 93, 93, 93, 92, 100, 104, 108, 113, 120,
+ 121, 123, 127, 130, 132, 134, 137, 142, 142, 143, 146, 151, 146, 144,
+ 158, 154, 143, 150, 167, 168, 146, 104, 100, 95, 95, 95, 94, 101, 105,
+ 109, 115, 123, 125, 127, 133, 137, 139, 141, 145, 150, 150, 151, 155,
+ 153, 149, 160, 150, 148, 168, 167, 147, 149, 178, 109, 104, 99, 99, 99,
+ 97, 104, 107, 111, 117, 125, 128, 130, 137, 142, 144, 147, 151, 156,
+ 157, 158, 160, 156, 166, 154, 157, 170, 153, 151, 179, 180, 151, 112,
+ 106, 102, 101, 100, 98, 105, 109, 112, 119, 126, 129, 132, 139, 144,
+ 147, 150, 154, 160, 161, 162, 163, 167, 162, 163, 175, 155, 168, 180,
+ 155, 155, 191, 114, 109, 104, 103, 102, 100, 107, 110, 113, 120, 127,
+ 131, 134, 141, 147, 150, 153, 158, 164, 165, 166, 169, 173, 165, 177,
+ 161, 183, 178, 158, 184, 191, 157, 120, 114, 109, 108, 107, 104, 111,
+ 114, 117, 123, 131, 134, 137, 145, 151, 154, 158, 164, 170, 171, 172,
+ 178, 171, 184, 167, 184, 174, 165, 198, 173, 162, 203, 127, 121, 115,
+ 114, 113, 109, 115, 118, 121, 127, 135, 138, 142, 150, 156, 160, 164,
+ 170, 178, 179, 180, 183, 181, 180, 186, 183, 175, 195, 166, 189, 209,
+ 164, 128, 122, 116, 115, 114, 110, 116, 119, 122, 128, 135, 139, 142,
+ 150, 157, 161, 165, 171, 179, 180, 182, 185, 193, 182, 192, 180, 204,
+ 173, 205, 189, 170, 223, 130, 123, 117, 116, 115, 111, 117, 120, 123,
+ 129, 136, 140, 143, 151, 158, 162, 166, 172, 180, 182, 183, 188, 189,
+ 204, 184, 204, 180, 216, 185, 189, 216, 172, 135, 128, 122, 120, 119,
+ 115, 120, 123, 126, 132, 138, 141, 146, 155, 160, 163, 169, 178, 183,
+ 185, 188, 193, 191, 193, 210, 188, 213, 188, 208, 214, 179, 229, 138,
+ 130, 125, 123, 121, 116, 121, 123, 128, 135, 135, 141, 151, 153, 156,
+ 167, 173, 171, 181, 193, 189, 191, 199, 194, 199, 212, 202, 209, 207,
+ 193, 239, 181, 141, 133, 128, 126, 123, 119, 120, 125, 133, 132, 136,
+ 148, 146, 149, 166, 162, 165, 184, 180, 182, 204, 193, 194, 205, 196,
+ 205, 211, 219, 204, 231, 189, 254, 144, 136, 131, 130, 126, 122, 121,
+ 131, 134, 132, 145, 143, 144, 160, 154, 163, 177, 167, 186, 192, 184,
+ 210, 199, 196, 212, 199, 211, 209, 241, 197, 246, 192, 147, 139, 134,
+ 132, 127, 125, 123, 134, 129, 138, 145, 140, 158, 150, 157, 175, 161,
+ 184, 183, 180, 204, 188, 212, 205, 199, 218, 203, 218, 205, 261, 199,
+ 259, 150, 142, 137, 135, 130, 131, 125, 135, 131, 144, 136, 150, 154,
+ 148, 170, 155, 183, 174, 175, 204, 180, 213, 202, 211, 211, 203, 225,
+ 206, 224, 208, 276, 202, 153, 145, 140, 138, 133, 134, 124, 130, 137,
+ 145, 138, 155, 143, 168, 153, 168, 178, 165, 195, 173, 216, 188, 209,
+ 219, 209, 218, 206, 232, 209, 230, 211, 292, 157, 148, 144, 141, 136,
+ 136, 127, 131, 147, 136, 151, 148, 150, 167, 151, 180, 158, 198, 166,
+ 205, 185, 208, 207, 204, 241, 205, 224, 209, 240, 212, 236, 214, 160,
+ 151, 147, 144, 140, 139, 131, 133, 149, 138, 156, 142, 167, 147, 179,
+ 155, 184, 173, 189, 189, 189, 214, 193, 231, 197, 261, 208, 230, 212,
+ 247, 215, 243, 163, 154, 150, 147, 143, 142, 134, 136, 151, 140, 158,
+ 144, 168, 149, 180, 155, 191, 162, 209, 170, 216, 179, 239, 189, 246,
+ 199, 276, 211, 236, 215, 255, 218, 167, 156, 158, 145, 150, 140, 144,
+ 130, 138, 162, 143, 167, 146, 178, 151, 191, 157, 203, 164, 223, 172,
+ 229, 181, 254, 192, 259, 202, 292, 214, 243, 218, 263,
+ /* Size 4x8 */
+ 63, 94, 120, 141, 80, 91, 109, 131, 92, 112, 128, 140, 96, 122, 150,
+ 167, 109, 131, 170, 169, 122, 139, 185, 189, 133, 145, 189, 214, 144,
+ 142, 169, 208,
+ /* Size 8x4 */
+ 63, 80, 92, 96, 109, 122, 133, 144, 94, 91, 112, 122, 131, 139, 145,
+ 142, 120, 109, 128, 150, 170, 185, 189, 169, 141, 131, 140, 167, 169,
+ 189, 214, 208,
+ /* Size 8x16 */
+ 64, 74, 96, 105, 115, 133, 144, 155, 61, 80, 92, 96, 104, 121, 131, 143,
+ 67, 86, 94, 95, 103, 118, 125, 136, 84, 95, 100, 101, 107, 120, 121,
+ 127, 98, 96, 106, 109, 114, 125, 127, 146, 98, 92, 107, 123, 128, 139,
+ 142, 153, 101, 93, 108, 128, 134, 146, 157, 164, 109, 98, 111, 137, 147,
+ 161, 156, 177, 114, 101, 113, 141, 153, 169, 160, 182, 127, 110, 121,
+ 150, 164, 184, 183, 190, 129, 112, 123, 151, 166, 187, 203, 191, 137,
+ 119, 128, 152, 173, 189, 205, 198, 143, 124, 132, 144, 177, 209, 197,
+ 200, 149, 130, 142, 153, 163, 180, 211, 206, 156, 136, 146, 166, 194,
+ 214, 216, 208, 163, 143, 150, 168, 191, 218, 247, 242,
+ /* Size 16x8 */
+ 64, 61, 67, 84, 98, 98, 101, 109, 114, 127, 129, 137, 143, 149, 156,
+ 163, 74, 80, 86, 95, 96, 92, 93, 98, 101, 110, 112, 119, 124, 130, 136,
+ 143, 96, 92, 94, 100, 106, 107, 108, 111, 113, 121, 123, 128, 132, 142,
+ 146, 150, 105, 96, 95, 101, 109, 123, 128, 137, 141, 150, 151, 152, 144,
+ 153, 166, 168, 115, 104, 103, 107, 114, 128, 134, 147, 153, 164, 166,
+ 173, 177, 163, 194, 191, 133, 121, 118, 120, 125, 139, 146, 161, 169,
+ 184, 187, 189, 209, 180, 214, 218, 144, 131, 125, 121, 127, 142, 157,
+ 156, 160, 183, 203, 205, 197, 211, 216, 247, 155, 143, 136, 127, 146,
+ 153, 164, 177, 182, 190, 191, 198, 200, 206, 208, 242,
+ /* Size 16x32 */
+ 64, 62, 74, 84, 96, 98, 105, 109, 115, 127, 133, 139, 144, 149, 155,
+ 161, 63, 63, 77, 85, 94, 94, 100, 104, 109, 120, 126, 131, 136, 141,
+ 147, 150, 61, 64, 80, 85, 92, 91, 96, 100, 104, 115, 121, 126, 131, 137,
+ 143, 152, 64, 68, 83, 88, 93, 91, 96, 99, 103, 114, 119, 125, 130, 135,
+ 140, 140, 67, 72, 86, 90, 94, 92, 95, 99, 103, 112, 118, 122, 125, 130,
+ 136, 145, 74, 80, 94, 95, 95, 91, 94, 97, 100, 109, 114, 117, 123, 131,
+ 135, 136, 84, 86, 95, 97, 100, 99, 101, 104, 107, 115, 120, 120, 121,
+ 122, 127, 140, 90, 89, 95, 99, 103, 103, 105, 108, 110, 118, 123, 123,
+ 132, 127, 130, 127, 98, 93, 96, 101, 106, 107, 109, 111, 114, 121, 125,
+ 132, 127, 137, 146, 134, 97, 92, 94, 100, 106, 112, 115, 118, 120, 128,
+ 132, 132, 137, 140, 135, 158, 98, 91, 92, 99, 107, 117, 123, 125, 128,
+ 135, 139, 135, 142, 137, 153, 139, 99, 92, 92, 99, 107, 118, 125, 128,
+ 131, 138, 142, 147, 138, 154, 139, 164, 101, 93, 93, 100, 108, 119, 128,
+ 131, 134, 142, 146, 147, 157, 141, 164, 143, 104, 96, 95, 101, 109, 122,
+ 133, 137, 142, 150, 154, 149, 150, 167, 145, 175, 109, 100, 98, 104,
+ 111, 125, 137, 142, 147, 156, 161, 164, 156, 152, 177, 148, 111, 102,
+ 99, 105, 112, 126, 139, 144, 150, 160, 165, 164, 174, 167, 153, 188,
+ 114, 104, 101, 107, 113, 128, 141, 147, 153, 164, 169, 164, 160, 173,
+ 182, 154, 120, 109, 105, 111, 117, 131, 145, 151, 158, 170, 176, 180,
+ 179, 169, 169, 200, 127, 115, 110, 116, 121, 135, 150, 157, 164, 178,
+ 184, 182, 183, 192, 190, 161, 128, 117, 111, 116, 122, 136, 151, 157,
+ 165, 179, 185, 180, 179, 171, 183, 220, 129, 118, 112, 117, 123, 136,
+ 151, 158, 166, 180, 187, 197, 203, 210, 191, 169, 134, 122, 116, 120,
+ 126, 139, 153, 160, 169, 185, 191, 194, 193, 189, 204, 225, 137, 125,
+ 119, 122, 128, 144, 152, 156, 173, 188, 189, 192, 205, 205, 198, 178,
+ 140, 127, 121, 121, 130, 145, 146, 158, 180, 179, 190, 202, 203, 217,
+ 219, 249, 143, 130, 124, 122, 132, 145, 144, 170, 177, 176, 209, 198,
+ 197, 207, 200, 188, 146, 133, 127, 125, 141, 145, 146, 172, 161, 189,
+ 205, 196, 215, 214, 250, 253, 149, 136, 130, 127, 142, 136, 153, 170,
+ 163, 199, 180, 220, 211, 202, 206, 198, 152, 138, 133, 129, 144, 138,
+ 166, 153, 174, 196, 183, 227, 202, 228, 226, 284, 156, 141, 136, 132,
+ 146, 140, 166, 151, 194, 167, 214, 205, 216, 226, 208, 210, 159, 144,
+ 140, 134, 148, 142, 167, 153, 193, 169, 221, 187, 253, 208, 242, 237,
+ 163, 147, 143, 137, 150, 144, 168, 155, 191, 171, 218, 190, 247, 211,
+ 242, 214, 166, 147, 150, 134, 139, 166, 147, 189, 157, 219, 172, 250,
+ 192, 281, 214, 257,
+ /* Size 32x16 */
+ 64, 63, 61, 64, 67, 74, 84, 90, 98, 97, 98, 99, 101, 104, 109, 111, 114,
+ 120, 127, 128, 129, 134, 137, 140, 143, 146, 149, 152, 156, 159, 163,
+ 166, 62, 63, 64, 68, 72, 80, 86, 89, 93, 92, 91, 92, 93, 96, 100, 102,
+ 104, 109, 115, 117, 118, 122, 125, 127, 130, 133, 136, 138, 141, 144,
+ 147, 147, 74, 77, 80, 83, 86, 94, 95, 95, 96, 94, 92, 92, 93, 95, 98,
+ 99, 101, 105, 110, 111, 112, 116, 119, 121, 124, 127, 130, 133, 136,
+ 140, 143, 150, 84, 85, 85, 88, 90, 95, 97, 99, 101, 100, 99, 99, 100,
+ 101, 104, 105, 107, 111, 116, 116, 117, 120, 122, 121, 122, 125, 127,
+ 129, 132, 134, 137, 134, 96, 94, 92, 93, 94, 95, 100, 103, 106, 106,
+ 107, 107, 108, 109, 111, 112, 113, 117, 121, 122, 123, 126, 128, 130,
+ 132, 141, 142, 144, 146, 148, 150, 139, 98, 94, 91, 91, 92, 91, 99, 103,
+ 107, 112, 117, 118, 119, 122, 125, 126, 128, 131, 135, 136, 136, 139,
+ 144, 145, 145, 145, 136, 138, 140, 142, 144, 166, 105, 100, 96, 96, 95,
+ 94, 101, 105, 109, 115, 123, 125, 128, 133, 137, 139, 141, 145, 150,
+ 151, 151, 153, 152, 146, 144, 146, 153, 166, 166, 167, 168, 147, 109,
+ 104, 100, 99, 99, 97, 104, 108, 111, 118, 125, 128, 131, 137, 142, 144,
+ 147, 151, 157, 157, 158, 160, 156, 158, 170, 172, 170, 153, 151, 153,
+ 155, 189, 115, 109, 104, 103, 103, 100, 107, 110, 114, 120, 128, 131,
+ 134, 142, 147, 150, 153, 158, 164, 165, 166, 169, 173, 180, 177, 161,
+ 163, 174, 194, 193, 191, 157, 127, 120, 115, 114, 112, 109, 115, 118,
+ 121, 128, 135, 138, 142, 150, 156, 160, 164, 170, 178, 179, 180, 185,
+ 188, 179, 176, 189, 199, 196, 167, 169, 171, 219, 133, 126, 121, 119,
+ 118, 114, 120, 123, 125, 132, 139, 142, 146, 154, 161, 165, 169, 176,
+ 184, 185, 187, 191, 189, 190, 209, 205, 180, 183, 214, 221, 218, 172,
+ 139, 131, 126, 125, 122, 117, 120, 123, 132, 132, 135, 147, 147, 149,
+ 164, 164, 164, 180, 182, 180, 197, 194, 192, 202, 198, 196, 220, 227,
+ 205, 187, 190, 250, 144, 136, 131, 130, 125, 123, 121, 132, 127, 137,
+ 142, 138, 157, 150, 156, 174, 160, 179, 183, 179, 203, 193, 205, 203,
+ 197, 215, 211, 202, 216, 253, 247, 192, 149, 141, 137, 135, 130, 131,
+ 122, 127, 137, 140, 137, 154, 141, 167, 152, 167, 173, 169, 192, 171,
+ 210, 189, 205, 217, 207, 214, 202, 228, 226, 208, 211, 281, 155, 147,
+ 143, 140, 136, 135, 127, 130, 146, 135, 153, 139, 164, 145, 177, 153,
+ 182, 169, 190, 183, 191, 204, 198, 219, 200, 250, 206, 226, 208, 242,
+ 242, 214, 161, 150, 152, 140, 145, 136, 140, 127, 134, 158, 139, 164,
+ 143, 175, 148, 188, 154, 200, 161, 220, 169, 225, 178, 249, 188, 253,
+ 198, 284, 210, 237, 214, 257,
+ /* Size 4x16 */
+ 62, 98, 127, 149, 64, 91, 115, 137, 72, 92, 112, 130, 86, 99, 115, 122,
+ 93, 107, 121, 137, 91, 117, 135, 137, 93, 119, 142, 141, 100, 125, 156,
+ 152, 104, 128, 164, 173, 115, 135, 178, 192, 118, 136, 180, 210, 125,
+ 144, 188, 205, 130, 145, 176, 207, 136, 136, 199, 202, 141, 140, 167,
+ 226, 147, 144, 171, 211,
+ /* Size 16x4 */
+ 62, 64, 72, 86, 93, 91, 93, 100, 104, 115, 118, 125, 130, 136, 141, 147,
+ 98, 91, 92, 99, 107, 117, 119, 125, 128, 135, 136, 144, 145, 136, 140,
+ 144, 127, 115, 112, 115, 121, 135, 142, 156, 164, 178, 180, 188, 176,
+ 199, 167, 171, 149, 137, 130, 122, 137, 137, 141, 152, 173, 192, 210,
+ 205, 207, 202, 226, 211,
+ /* Size 8x32 */
+ 64, 74, 96, 105, 115, 133, 144, 155, 63, 77, 94, 100, 109, 126, 136,
+ 147, 61, 80, 92, 96, 104, 121, 131, 143, 64, 83, 93, 96, 103, 119, 130,
+ 140, 67, 86, 94, 95, 103, 118, 125, 136, 74, 94, 95, 94, 100, 114, 123,
+ 135, 84, 95, 100, 101, 107, 120, 121, 127, 90, 95, 103, 105, 110, 123,
+ 132, 130, 98, 96, 106, 109, 114, 125, 127, 146, 97, 94, 106, 115, 120,
+ 132, 137, 135, 98, 92, 107, 123, 128, 139, 142, 153, 99, 92, 107, 125,
+ 131, 142, 138, 139, 101, 93, 108, 128, 134, 146, 157, 164, 104, 95, 109,
+ 133, 142, 154, 150, 145, 109, 98, 111, 137, 147, 161, 156, 177, 111, 99,
+ 112, 139, 150, 165, 174, 153, 114, 101, 113, 141, 153, 169, 160, 182,
+ 120, 105, 117, 145, 158, 176, 179, 169, 127, 110, 121, 150, 164, 184,
+ 183, 190, 128, 111, 122, 151, 165, 185, 179, 183, 129, 112, 123, 151,
+ 166, 187, 203, 191, 134, 116, 126, 153, 169, 191, 193, 204, 137, 119,
+ 128, 152, 173, 189, 205, 198, 140, 121, 130, 146, 180, 190, 203, 219,
+ 143, 124, 132, 144, 177, 209, 197, 200, 146, 127, 141, 146, 161, 205,
+ 215, 250, 149, 130, 142, 153, 163, 180, 211, 206, 152, 133, 144, 166,
+ 174, 183, 202, 226, 156, 136, 146, 166, 194, 214, 216, 208, 159, 140,
+ 148, 167, 193, 221, 253, 242, 163, 143, 150, 168, 191, 218, 247, 242,
+ 166, 150, 139, 147, 157, 172, 192, 214,
+ /* Size 32x8 */
+ 64, 63, 61, 64, 67, 74, 84, 90, 98, 97, 98, 99, 101, 104, 109, 111, 114,
+ 120, 127, 128, 129, 134, 137, 140, 143, 146, 149, 152, 156, 159, 163,
+ 166, 74, 77, 80, 83, 86, 94, 95, 95, 96, 94, 92, 92, 93, 95, 98, 99,
+ 101, 105, 110, 111, 112, 116, 119, 121, 124, 127, 130, 133, 136, 140,
+ 143, 150, 96, 94, 92, 93, 94, 95, 100, 103, 106, 106, 107, 107, 108,
+ 109, 111, 112, 113, 117, 121, 122, 123, 126, 128, 130, 132, 141, 142,
+ 144, 146, 148, 150, 139, 105, 100, 96, 96, 95, 94, 101, 105, 109, 115,
+ 123, 125, 128, 133, 137, 139, 141, 145, 150, 151, 151, 153, 152, 146,
+ 144, 146, 153, 166, 166, 167, 168, 147, 115, 109, 104, 103, 103, 100,
+ 107, 110, 114, 120, 128, 131, 134, 142, 147, 150, 153, 158, 164, 165,
+ 166, 169, 173, 180, 177, 161, 163, 174, 194, 193, 191, 157, 133, 126,
+ 121, 119, 118, 114, 120, 123, 125, 132, 139, 142, 146, 154, 161, 165,
+ 169, 176, 184, 185, 187, 191, 189, 190, 209, 205, 180, 183, 214, 221,
+ 218, 172, 144, 136, 131, 130, 125, 123, 121, 132, 127, 137, 142, 138,
+ 157, 150, 156, 174, 160, 179, 183, 179, 203, 193, 205, 203, 197, 215,
+ 211, 202, 216, 253, 247, 192, 155, 147, 143, 140, 136, 135, 127, 130,
+ 146, 135, 153, 139, 164, 145, 177, 153, 182, 169, 190, 183, 191, 204,
+ 198, 219, 200, 250, 206, 226, 208, 242, 242, 214 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 79, 164, 164, 311,
+#endif
+ /* Size 4x4 */
+ 65, 82, 138, 189, 82, 127, 176, 219, 138, 176, 254, 259, 189, 219, 259,
+ 371,
+ /* Size 8x8 */
+ 64, 65, 74, 95, 125, 157, 184, 213, 65, 71, 79, 93, 116, 144, 168, 197,
+ 74, 79, 103, 120, 142, 169, 188, 198, 95, 93, 120, 146, 174, 201, 210,
+ 215, 125, 116, 142, 174, 210, 242, 266, 258, 157, 144, 169, 201, 242,
+ 280, 284, 332, 184, 168, 188, 210, 266, 284, 340, 426, 213, 197, 198,
+ 215, 258, 332, 426, 406,
+ /* Size 16x16 */
+ 64, 63, 63, 65, 72, 79, 95, 108, 123, 143, 160, 173, 187, 202, 217, 234,
+ 63, 64, 65, 66, 69, 75, 88, 100, 113, 131, 146, 158, 172, 186, 200, 216,
+ 63, 65, 67, 69, 73, 78, 90, 100, 112, 129, 143, 154, 166, 177, 191, 207,
+ 65, 66, 69, 73, 80, 84, 94, 103, 114, 130, 142, 153, 160, 170, 181, 196,
+ 72, 69, 73, 80, 97, 101, 112, 120, 131, 146, 158, 168, 177, 180, 206,
+ 217, 79, 75, 78, 84, 101, 108, 121, 130, 141, 156, 168, 178, 194, 189,
+ 214, 230, 95, 88, 90, 94, 112, 121, 139, 151, 163, 178, 190, 200, 200,
+ 215, 216, 247, 108, 100, 100, 103, 120, 130, 151, 165, 178, 195, 208,
+ 218, 216, 241, 221, 268, 123, 113, 112, 114, 131, 141, 163, 178, 194,
+ 213, 227, 238, 250, 264, 234, 288, 143, 131, 129, 130, 146, 156, 178,
+ 195, 213, 235, 251, 263, 270, 259, 249, 321, 160, 146, 143, 142, 158,
+ 168, 190, 208, 227, 251, 268, 281, 275, 271, 280, 338, 173, 158, 154,
+ 153, 168, 178, 200, 218, 238, 263, 281, 295, 303, 308, 321, 380, 187,
+ 172, 166, 160, 177, 194, 200, 216, 250, 270, 275, 303, 325, 329, 384,
+ 399, 202, 186, 177, 170, 180, 189, 215, 241, 264, 259, 271, 308, 329,
+ 355, 357, 461, 217, 200, 191, 181, 206, 214, 216, 221, 234, 249, 280,
+ 321, 384, 357, 389, 387, 234, 216, 207, 196, 217, 230, 247, 268, 288,
+ 321, 338, 380, 399, 461, 387, 425,
+ /* Size 32x32 */
+ 64, 63, 63, 63, 63, 64, 65, 68, 72, 76, 79, 88, 95, 99, 108, 118, 123,
+ 131, 143, 153, 160, 166, 173, 180, 187, 194, 202, 209, 217, 225, 234,
+ 243, 63, 64, 64, 64, 64, 65, 66, 68, 70, 74, 77, 85, 91, 95, 103, 113,
+ 117, 125, 136, 145, 152, 157, 164, 171, 177, 184, 191, 198, 205, 213,
+ 221, 227, 63, 64, 64, 65, 65, 65, 66, 67, 69, 73, 75, 82, 88, 92, 100,
+ 109, 113, 120, 131, 140, 146, 152, 158, 165, 172, 178, 186, 193, 200,
+ 208, 216, 229, 63, 64, 65, 65, 65, 66, 67, 68, 70, 73, 76, 82, 88, 91,
+ 99, 108, 112, 119, 130, 138, 144, 150, 156, 163, 169, 175, 182, 189,
+ 196, 203, 211, 212, 63, 64, 65, 65, 67, 68, 69, 71, 73, 76, 78, 84, 90,
+ 93, 100, 108, 112, 118, 129, 137, 143, 148, 154, 160, 166, 171, 177,
+ 184, 191, 199, 207, 218, 64, 65, 65, 66, 68, 71, 72, 74, 77, 79, 81, 85,
+ 90, 93, 99, 107, 110, 116, 126, 133, 139, 144, 149, 156, 162, 168, 177,
+ 184, 190, 197, 204, 208, 65, 66, 66, 67, 69, 72, 73, 76, 80, 82, 84, 89,
+ 94, 97, 103, 111, 114, 120, 130, 137, 142, 147, 153, 156, 160, 166, 170,
+ 174, 181, 188, 196, 211, 68, 68, 67, 68, 71, 74, 76, 79, 85, 88, 90, 95,
+ 100, 103, 109, 117, 120, 126, 136, 143, 148, 153, 159, 164, 173, 178,
+ 183, 179, 183, 189, 196, 195, 72, 70, 69, 70, 73, 77, 80, 85, 97, 100,
+ 101, 108, 112, 115, 120, 128, 131, 136, 146, 153, 158, 162, 168, 173,
+ 177, 175, 180, 191, 206, 211, 217, 203, 76, 74, 73, 73, 76, 79, 82, 88,
+ 100, 103, 105, 112, 117, 120, 126, 134, 137, 142, 152, 159, 164, 169,
+ 174, 175, 178, 188, 197, 201, 192, 198, 204, 237, 79, 77, 75, 76, 78,
+ 81, 84, 90, 101, 105, 108, 116, 121, 124, 130, 138, 141, 147, 156, 163,
+ 168, 173, 178, 184, 194, 197, 189, 194, 214, 224, 230, 211, 88, 85, 82,
+ 82, 84, 85, 89, 95, 108, 112, 116, 127, 133, 136, 143, 151, 154, 159,
+ 169, 176, 181, 185, 190, 197, 195, 194, 210, 219, 211, 206, 211, 248,
+ 95, 91, 88, 88, 90, 90, 94, 100, 112, 117, 121, 133, 139, 142, 151, 159,
+ 163, 168, 178, 185, 190, 195, 200, 199, 200, 218, 215, 204, 216, 242,
+ 247, 218, 99, 95, 92, 91, 93, 93, 97, 103, 115, 120, 124, 136, 142, 146,
+ 155, 163, 167, 174, 184, 191, 196, 201, 206, 208, 220, 210, 210, 240,
+ 241, 215, 221, 268, 108, 103, 100, 99, 100, 99, 103, 109, 120, 126, 130,
+ 143, 151, 155, 165, 174, 178, 185, 195, 203, 208, 213, 218, 227, 216,
+ 223, 241, 220, 221, 264, 268, 227, 118, 113, 109, 108, 108, 107, 111,
+ 117, 128, 134, 138, 151, 159, 163, 174, 184, 189, 196, 207, 215, 221,
+ 226, 232, 228, 232, 247, 223, 245, 263, 229, 231, 291, 123, 117, 113,
+ 112, 112, 110, 114, 120, 131, 137, 141, 154, 163, 167, 178, 189, 194,
+ 202, 213, 221, 227, 232, 238, 237, 250, 233, 264, 259, 234, 275, 288,
+ 237, 131, 125, 120, 119, 118, 116, 120, 126, 136, 142, 147, 159, 168,
+ 174, 185, 196, 202, 210, 222, 231, 237, 242, 248, 260, 242, 266, 255,
+ 244, 294, 258, 245, 314, 143, 136, 131, 130, 129, 126, 130, 136, 146,
+ 152, 156, 169, 178, 184, 195, 207, 213, 222, 235, 244, 251, 256, 263,
+ 261, 270, 267, 259, 291, 249, 286, 321, 251, 153, 145, 140, 138, 137,
+ 133, 137, 143, 153, 159, 163, 176, 185, 191, 203, 215, 221, 231, 244,
+ 254, 261, 267, 273, 270, 282, 267, 302, 259, 311, 288, 260, 351, 160,
+ 152, 146, 144, 143, 139, 142, 148, 158, 164, 168, 181, 190, 196, 208,
+ 221, 227, 237, 251, 261, 268, 274, 281, 298, 275, 305, 271, 328, 280,
+ 289, 338, 265, 166, 157, 152, 150, 148, 144, 147, 153, 162, 169, 173,
+ 185, 195, 201, 213, 226, 232, 242, 256, 267, 274, 280, 288, 292, 314,
+ 284, 324, 286, 320, 332, 276, 365, 173, 164, 158, 156, 154, 149, 153,
+ 159, 168, 174, 178, 190, 200, 206, 218, 232, 238, 248, 263, 273, 281,
+ 288, 295, 295, 303, 323, 308, 323, 321, 299, 380, 282, 180, 171, 165,
+ 163, 160, 156, 156, 164, 173, 175, 184, 197, 199, 208, 227, 228, 237,
+ 260, 261, 270, 298, 292, 295, 311, 302, 315, 327, 341, 317, 367, 295,
+ 414, 187, 177, 172, 169, 166, 162, 160, 173, 177, 178, 194, 195, 200,
+ 220, 216, 232, 250, 242, 270, 282, 275, 314, 303, 302, 325, 308, 329,
+ 326, 384, 307, 399, 301, 194, 184, 178, 175, 171, 168, 166, 178, 175,
+ 188, 197, 194, 218, 210, 223, 247, 233, 266, 267, 267, 305, 284, 323,
+ 315, 308, 340, 315, 344, 322, 426, 313, 429, 202, 191, 186, 182, 177,
+ 177, 170, 183, 180, 197, 189, 210, 215, 210, 241, 223, 264, 255, 259,
+ 302, 271, 324, 308, 327, 329, 315, 355, 323, 357, 329, 461, 320, 209,
+ 198, 193, 189, 184, 184, 174, 179, 191, 201, 194, 219, 204, 240, 220,
+ 245, 259, 244, 291, 259, 328, 286, 323, 341, 326, 344, 323, 371, 330,
+ 372, 337, 498, 217, 205, 200, 196, 191, 190, 181, 183, 206, 192, 214,
+ 211, 216, 241, 221, 263, 234, 294, 249, 311, 280, 320, 321, 317, 384,
+ 322, 357, 330, 389, 337, 387, 344, 225, 213, 208, 203, 199, 197, 188,
+ 189, 211, 198, 224, 206, 242, 215, 264, 229, 275, 258, 286, 288, 289,
+ 332, 299, 367, 307, 426, 329, 372, 337, 406, 345, 402, 234, 221, 216,
+ 211, 207, 204, 196, 196, 217, 204, 230, 211, 247, 221, 268, 231, 288,
+ 245, 321, 260, 338, 276, 380, 295, 399, 313, 461, 337, 387, 345, 425,
+ 353, 243, 227, 229, 212, 218, 208, 211, 195, 203, 237, 211, 248, 218,
+ 268, 227, 291, 237, 314, 251, 351, 265, 365, 282, 414, 301, 429, 320,
+ 498, 344, 402, 353, 444,
+ /* Size 4x8 */
+ 64, 85, 139, 191, 66, 85, 128, 177, 73, 112, 154, 192, 92, 135, 186,
+ 235, 120, 159, 225, 247, 151, 185, 260, 286, 176, 197, 279, 336, 203,
+ 206, 254, 328,
+ /* Size 8x4 */
+ 64, 66, 73, 92, 120, 151, 176, 203, 85, 85, 112, 135, 159, 185, 197,
+ 206, 139, 128, 154, 186, 225, 260, 279, 254, 191, 177, 192, 235, 247,
+ 286, 336, 328,
+ /* Size 8x16 */
+ 64, 64, 72, 95, 131, 158, 189, 215, 63, 65, 70, 88, 120, 145, 173, 199,
+ 64, 68, 73, 90, 118, 142, 166, 190, 65, 71, 80, 94, 120, 142, 161, 180,
+ 72, 75, 96, 112, 136, 157, 171, 203, 79, 80, 101, 121, 147, 168, 192,
+ 217, 94, 91, 112, 139, 168, 190, 215, 235, 107, 100, 120, 150, 185, 207,
+ 220, 258, 122, 112, 131, 163, 201, 226, 230, 268, 142, 128, 146, 178,
+ 222, 250, 266, 285, 159, 141, 158, 190, 236, 267, 302, 290, 172, 152,
+ 168, 200, 248, 280, 312, 305, 186, 164, 178, 200, 251, 311, 304, 311,
+ 200, 177, 194, 216, 238, 270, 328, 323, 216, 191, 204, 239, 288, 330,
+ 341, 328, 232, 207, 216, 247, 289, 339, 401, 396,
+ /* Size 16x8 */
+ 64, 63, 64, 65, 72, 79, 94, 107, 122, 142, 159, 172, 186, 200, 216, 232,
+ 64, 65, 68, 71, 75, 80, 91, 100, 112, 128, 141, 152, 164, 177, 191, 207,
+ 72, 70, 73, 80, 96, 101, 112, 120, 131, 146, 158, 168, 178, 194, 204,
+ 216, 95, 88, 90, 94, 112, 121, 139, 150, 163, 178, 190, 200, 200, 216,
+ 239, 247, 131, 120, 118, 120, 136, 147, 168, 185, 201, 222, 236, 248,
+ 251, 238, 288, 289, 158, 145, 142, 142, 157, 168, 190, 207, 226, 250,
+ 267, 280, 311, 270, 330, 339, 189, 173, 166, 161, 171, 192, 215, 220,
+ 230, 266, 302, 312, 304, 328, 341, 401, 215, 199, 190, 180, 203, 217,
+ 235, 258, 268, 285, 290, 305, 311, 323, 328, 396,
+ /* Size 16x32 */
+ 64, 63, 64, 65, 72, 88, 95, 107, 131, 146, 158, 177, 189, 201, 215, 229,
+ 63, 64, 65, 66, 71, 85, 91, 103, 124, 139, 151, 168, 179, 191, 203, 214,
+ 63, 65, 65, 66, 70, 82, 88, 99, 120, 134, 145, 162, 173, 186, 199, 216,
+ 63, 65, 66, 67, 70, 82, 88, 99, 119, 132, 143, 160, 171, 182, 194, 201,
+ 64, 65, 68, 69, 73, 84, 90, 100, 118, 131, 142, 157, 166, 178, 190, 206,
+ 64, 66, 70, 72, 77, 85, 90, 99, 116, 128, 138, 153, 164, 177, 188, 197,
+ 65, 66, 71, 73, 80, 89, 94, 103, 120, 132, 142, 154, 161, 168, 180, 200,
+ 68, 68, 72, 76, 85, 96, 101, 109, 126, 138, 147, 162, 174, 173, 181,
+ 185, 72, 69, 75, 80, 96, 108, 112, 120, 136, 148, 157, 171, 171, 187,
+ 203, 192, 76, 73, 78, 83, 99, 112, 117, 126, 142, 154, 163, 174, 184,
+ 192, 191, 227, 79, 75, 80, 85, 101, 116, 121, 130, 147, 159, 168, 181,
+ 192, 190, 217, 201, 88, 82, 85, 90, 107, 126, 132, 143, 159, 171, 180,
+ 196, 190, 213, 198, 239, 94, 88, 91, 95, 112, 132, 139, 150, 168, 181,
+ 190, 199, 215, 199, 235, 209, 98, 92, 94, 97, 114, 135, 142, 155, 173,
+ 186, 195, 206, 209, 235, 209, 259, 107, 99, 100, 103, 120, 142, 150,
+ 164, 185, 198, 207, 225, 220, 217, 258, 219, 117, 108, 108, 111, 127,
+ 150, 159, 174, 196, 210, 220, 229, 244, 240, 224, 282, 122, 113, 112,
+ 115, 131, 154, 163, 178, 201, 215, 226, 235, 230, 250, 268, 229, 130,
+ 120, 118, 121, 136, 159, 168, 185, 210, 225, 236, 256, 258, 247, 249,
+ 304, 142, 131, 128, 131, 146, 169, 178, 195, 222, 238, 250, 262, 266,
+ 284, 285, 242, 152, 139, 136, 138, 153, 176, 185, 202, 230, 247, 260,
+ 266, 264, 253, 275, 340, 159, 145, 141, 143, 158, 181, 190, 208, 236,
+ 254, 267, 290, 302, 316, 290, 257, 165, 151, 146, 148, 162, 185, 195,
+ 212, 242, 260, 273, 291, 290, 286, 313, 354, 172, 157, 152, 154, 168,
+ 190, 200, 218, 248, 266, 280, 292, 312, 314, 305, 273, 179, 164, 158,
+ 158, 173, 193, 199, 223, 253, 260, 287, 306, 312, 335, 344, 400, 186,
+ 170, 164, 162, 178, 195, 200, 239, 251, 259, 311, 302, 304, 322, 311,
+ 292, 193, 176, 171, 167, 190, 197, 205, 241, 233, 279, 305, 300, 333,
+ 336, 405, 415, 200, 182, 177, 173, 194, 189, 216, 241, 238, 295, 270,
+ 340, 328, 316, 323, 311, 208, 189, 184, 179, 199, 194, 236, 220, 256,
+ 292, 276, 353, 313, 362, 362, 481, 216, 196, 191, 185, 204, 200, 239,
+ 221, 288, 249, 330, 316, 341, 361, 328, 333, 224, 203, 199, 191, 210,
+ 206, 243, 226, 288, 254, 343, 288, 410, 328, 395, 389, 232, 211, 207,
+ 198, 216, 212, 247, 232, 289, 260, 339, 295, 401, 335, 396, 342, 241,
+ 215, 219, 200, 204, 246, 218, 287, 237, 344, 265, 405, 301, 476, 342,
+ 430,
+ /* Size 32x16 */
+ 64, 63, 63, 63, 64, 64, 65, 68, 72, 76, 79, 88, 94, 98, 107, 117, 122,
+ 130, 142, 152, 159, 165, 172, 179, 186, 193, 200, 208, 216, 224, 232,
+ 241, 63, 64, 65, 65, 65, 66, 66, 68, 69, 73, 75, 82, 88, 92, 99, 108,
+ 113, 120, 131, 139, 145, 151, 157, 164, 170, 176, 182, 189, 196, 203,
+ 211, 215, 64, 65, 65, 66, 68, 70, 71, 72, 75, 78, 80, 85, 91, 94, 100,
+ 108, 112, 118, 128, 136, 141, 146, 152, 158, 164, 171, 177, 184, 191,
+ 199, 207, 219, 65, 66, 66, 67, 69, 72, 73, 76, 80, 83, 85, 90, 95, 97,
+ 103, 111, 115, 121, 131, 138, 143, 148, 154, 158, 162, 167, 173, 179,
+ 185, 191, 198, 200, 72, 71, 70, 70, 73, 77, 80, 85, 96, 99, 101, 107,
+ 112, 114, 120, 127, 131, 136, 146, 153, 158, 162, 168, 173, 178, 190,
+ 194, 199, 204, 210, 216, 204, 88, 85, 82, 82, 84, 85, 89, 96, 108, 112,
+ 116, 126, 132, 135, 142, 150, 154, 159, 169, 176, 181, 185, 190, 193,
+ 195, 197, 189, 194, 200, 206, 212, 246, 95, 91, 88, 88, 90, 90, 94, 101,
+ 112, 117, 121, 132, 139, 142, 150, 159, 163, 168, 178, 185, 190, 195,
+ 200, 199, 200, 205, 216, 236, 239, 243, 247, 218, 107, 103, 99, 99, 100,
+ 99, 103, 109, 120, 126, 130, 143, 150, 155, 164, 174, 178, 185, 195,
+ 202, 208, 212, 218, 223, 239, 241, 241, 220, 221, 226, 232, 287, 131,
+ 124, 120, 119, 118, 116, 120, 126, 136, 142, 147, 159, 168, 173, 185,
+ 196, 201, 210, 222, 230, 236, 242, 248, 253, 251, 233, 238, 256, 288,
+ 288, 289, 237, 146, 139, 134, 132, 131, 128, 132, 138, 148, 154, 159,
+ 171, 181, 186, 198, 210, 215, 225, 238, 247, 254, 260, 266, 260, 259,
+ 279, 295, 292, 249, 254, 260, 344, 158, 151, 145, 143, 142, 138, 142,
+ 147, 157, 163, 168, 180, 190, 195, 207, 220, 226, 236, 250, 260, 267,
+ 273, 280, 287, 311, 305, 270, 276, 330, 343, 339, 265, 177, 168, 162,
+ 160, 157, 153, 154, 162, 171, 174, 181, 196, 199, 206, 225, 229, 235,
+ 256, 262, 266, 290, 291, 292, 306, 302, 300, 340, 353, 316, 288, 295,
+ 405, 189, 179, 173, 171, 166, 164, 161, 174, 171, 184, 192, 190, 215,
+ 209, 220, 244, 230, 258, 266, 264, 302, 290, 312, 312, 304, 333, 328,
+ 313, 341, 410, 401, 301, 201, 191, 186, 182, 178, 177, 168, 173, 187,
+ 192, 190, 213, 199, 235, 217, 240, 250, 247, 284, 253, 316, 286, 314,
+ 335, 322, 336, 316, 362, 361, 328, 335, 476, 215, 203, 199, 194, 190,
+ 188, 180, 181, 203, 191, 217, 198, 235, 209, 258, 224, 268, 249, 285,
+ 275, 290, 313, 305, 344, 311, 405, 323, 362, 328, 395, 396, 342, 229,
+ 214, 216, 201, 206, 197, 200, 185, 192, 227, 201, 239, 209, 259, 219,
+ 282, 229, 304, 242, 340, 257, 354, 273, 400, 292, 415, 311, 481, 333,
+ 389, 342, 430,
+ /* Size 4x16 */
+ 63, 88, 146, 201, 65, 82, 134, 186, 65, 84, 131, 178, 66, 89, 132, 168,
+ 69, 108, 148, 187, 75, 116, 159, 190, 88, 132, 181, 199, 99, 142, 198,
+ 217, 113, 154, 215, 250, 131, 169, 238, 284, 145, 181, 254, 316, 157,
+ 190, 266, 314, 170, 195, 259, 322, 182, 189, 295, 316, 196, 200, 249,
+ 361, 211, 212, 260, 335,
+ /* Size 16x4 */
+ 63, 65, 65, 66, 69, 75, 88, 99, 113, 131, 145, 157, 170, 182, 196, 211,
+ 88, 82, 84, 89, 108, 116, 132, 142, 154, 169, 181, 190, 195, 189, 200,
+ 212, 146, 134, 131, 132, 148, 159, 181, 198, 215, 238, 254, 266, 259,
+ 295, 249, 260, 201, 186, 178, 168, 187, 190, 199, 217, 250, 284, 316,
+ 314, 322, 316, 361, 335,
+ /* Size 8x32 */
+ 64, 64, 72, 95, 131, 158, 189, 215, 63, 65, 71, 91, 124, 151, 179, 203,
+ 63, 65, 70, 88, 120, 145, 173, 199, 63, 66, 70, 88, 119, 143, 171, 194,
+ 64, 68, 73, 90, 118, 142, 166, 190, 64, 70, 77, 90, 116, 138, 164, 188,
+ 65, 71, 80, 94, 120, 142, 161, 180, 68, 72, 85, 101, 126, 147, 174, 181,
+ 72, 75, 96, 112, 136, 157, 171, 203, 76, 78, 99, 117, 142, 163, 184,
+ 191, 79, 80, 101, 121, 147, 168, 192, 217, 88, 85, 107, 132, 159, 180,
+ 190, 198, 94, 91, 112, 139, 168, 190, 215, 235, 98, 94, 114, 142, 173,
+ 195, 209, 209, 107, 100, 120, 150, 185, 207, 220, 258, 117, 108, 127,
+ 159, 196, 220, 244, 224, 122, 112, 131, 163, 201, 226, 230, 268, 130,
+ 118, 136, 168, 210, 236, 258, 249, 142, 128, 146, 178, 222, 250, 266,
+ 285, 152, 136, 153, 185, 230, 260, 264, 275, 159, 141, 158, 190, 236,
+ 267, 302, 290, 165, 146, 162, 195, 242, 273, 290, 313, 172, 152, 168,
+ 200, 248, 280, 312, 305, 179, 158, 173, 199, 253, 287, 312, 344, 186,
+ 164, 178, 200, 251, 311, 304, 311, 193, 171, 190, 205, 233, 305, 333,
+ 405, 200, 177, 194, 216, 238, 270, 328, 323, 208, 184, 199, 236, 256,
+ 276, 313, 362, 216, 191, 204, 239, 288, 330, 341, 328, 224, 199, 210,
+ 243, 288, 343, 410, 395, 232, 207, 216, 247, 289, 339, 401, 396, 241,
+ 219, 204, 218, 237, 265, 301, 342,
+ /* Size 32x8 */
+ 64, 63, 63, 63, 64, 64, 65, 68, 72, 76, 79, 88, 94, 98, 107, 117, 122,
+ 130, 142, 152, 159, 165, 172, 179, 186, 193, 200, 208, 216, 224, 232,
+ 241, 64, 65, 65, 66, 68, 70, 71, 72, 75, 78, 80, 85, 91, 94, 100, 108,
+ 112, 118, 128, 136, 141, 146, 152, 158, 164, 171, 177, 184, 191, 199,
+ 207, 219, 72, 71, 70, 70, 73, 77, 80, 85, 96, 99, 101, 107, 112, 114,
+ 120, 127, 131, 136, 146, 153, 158, 162, 168, 173, 178, 190, 194, 199,
+ 204, 210, 216, 204, 95, 91, 88, 88, 90, 90, 94, 101, 112, 117, 121, 132,
+ 139, 142, 150, 159, 163, 168, 178, 185, 190, 195, 200, 199, 200, 205,
+ 216, 236, 239, 243, 247, 218, 131, 124, 120, 119, 118, 116, 120, 126,
+ 136, 142, 147, 159, 168, 173, 185, 196, 201, 210, 222, 230, 236, 242,
+ 248, 253, 251, 233, 238, 256, 288, 288, 289, 237, 158, 151, 145, 143,
+ 142, 138, 142, 147, 157, 163, 168, 180, 190, 195, 207, 220, 226, 236,
+ 250, 260, 267, 273, 280, 287, 311, 305, 270, 276, 330, 343, 339, 265,
+ 189, 179, 173, 171, 166, 164, 161, 174, 171, 184, 192, 190, 215, 209,
+ 220, 244, 230, 258, 266, 264, 302, 290, 312, 312, 304, 333, 328, 313,
+ 341, 410, 401, 301, 215, 203, 199, 194, 190, 188, 180, 181, 203, 191,
+ 217, 198, 235, 209, 258, 224, 268, 249, 285, 275, 290, 313, 305, 344,
+ 311, 405, 323, 362, 328, 395, 396, 342 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 97, 122, 122, 196,
+#endif
+ /* Size 4x4 */
+ 66, 90, 112, 133, 90, 117, 133, 148, 112, 133, 172, 169, 133, 148, 169,
220,
- /* Size 32 */
- 64, 59, 55, 52, 49, 50, 51, 52, 53, 56, 59, 64, 68, 73, 78, 83, 90, 95,
- 101, 107, 115, 120, 126, 132, 139, 145, 150, 156, 163, 163, 163, 163,
- 59, 57, 54, 52, 50, 51, 51, 52, 53, 56, 59, 63, 67, 71, 75, 81, 87, 92,
- 97, 103, 110, 115, 121, 127, 134, 140, 145, 151, 158, 158, 158, 158, 55,
- 54, 54, 53, 52, 52, 52, 53, 53, 55, 58, 62, 65, 69, 73, 78, 84, 88, 94,
- 99, 106, 111, 117, 123, 130, 135, 140, 146, 153, 153, 153, 153, 52, 52,
- 53, 53, 54, 54, 53, 53, 53, 55, 58, 61, 63, 67, 71, 76, 81, 85, 90, 96,
- 102, 107, 113, 119, 125, 130, 136, 142, 148, 148, 148, 148, 49, 50, 52,
- 54, 56, 55, 54, 54, 53, 55, 57, 60, 62, 65, 69, 73, 78, 83, 87, 93, 99,
- 104, 109, 115, 121, 126, 132, 137, 144, 144, 144, 144, 50, 51, 52, 54,
- 55, 56, 56, 57, 57, 59, 62, 64, 67, 70, 74, 78, 82, 87, 91, 97, 102,
- 107, 112, 118, 124, 129, 134, 140, 146, 146, 146, 146, 51, 51, 52, 53,
- 54, 56, 58, 60, 62, 64, 66, 69, 72, 75, 79, 83, 87, 91, 96, 101, 106,
- 111, 116, 122, 128, 132, 137, 143, 149, 149, 149, 149, 52, 52, 53, 53,
- 54, 57, 60, 63, 67, 70, 72, 75, 78, 81, 84, 88, 92, 96, 101, 105, 111,
- 115, 120, 125, 131, 136, 140, 146, 151, 151, 151, 151, 53, 53, 53, 53,
- 53, 57, 62, 67, 74, 76, 79, 82, 85, 88, 91, 95, 98, 102, 106, 111, 115,
- 120, 124, 129, 135, 139, 144, 149, 154, 154, 154, 154, 56, 56, 55, 55,
- 55, 59, 64, 70, 76, 79, 82, 86, 89, 93, 96, 99, 103, 107, 111, 115, 120,
- 124, 129, 134, 139, 143, 148, 152, 158, 158, 158, 158, 59, 59, 58, 58,
- 57, 62, 66, 72, 79, 82, 86, 90, 94, 98, 101, 105, 109, 113, 117, 121,
- 125, 129, 134, 138, 143, 147, 152, 156, 161, 161, 161, 161, 64, 63, 62,
- 61, 60, 64, 69, 75, 82, 86, 90, 95, 100, 103, 107, 111, 115, 119, 122,
- 127, 131, 135, 139, 143, 148, 152, 156, 160, 165, 165, 165, 165, 68, 67,
- 65, 63, 62, 67, 72, 78, 85, 89, 94, 100, 106, 110, 114, 118, 122, 125,
- 129, 133, 137, 141, 145, 149, 153, 157, 160, 165, 169, 169, 169, 169,
- 73, 71, 69, 67, 65, 70, 75, 81, 88, 93, 98, 103, 110, 113, 118, 122,
- 126, 130, 134, 138, 142, 145, 149, 153, 157, 161, 164, 168, 173, 173,
- 173, 173, 78, 75, 73, 71, 69, 74, 79, 84, 91, 96, 101, 107, 114, 118,
- 122, 126, 131, 135, 139, 142, 147, 150, 154, 158, 162, 165, 169, 172,
- 176, 176, 176, 176, 83, 81, 78, 76, 73, 78, 83, 88, 95, 99, 105, 111,
- 118, 122, 126, 131, 136, 140, 144, 148, 152, 155, 159, 163, 166, 170,
- 173, 177, 180, 180, 180, 180, 90, 87, 84, 81, 78, 82, 87, 92, 98, 103,
- 109, 115, 122, 126, 131, 136, 142, 146, 149, 153, 158, 161, 164, 168,
- 172, 175, 178, 181, 185, 185, 185, 185, 95, 92, 88, 85, 83, 87, 91, 96,
- 102, 107, 113, 119, 125, 130, 135, 140, 146, 149, 153, 157, 162, 165,
- 168, 172, 175, 178, 181, 185, 188, 188, 188, 188, 101, 97, 94, 90, 87,
- 91, 96, 101, 106, 111, 117, 122, 129, 134, 139, 144, 149, 153, 157, 161,
- 166, 169, 172, 176, 179, 182, 185, 188, 191, 191, 191, 191, 107, 103,
- 99, 96, 93, 97, 101, 105, 111, 115, 121, 127, 133, 138, 142, 148, 153,
- 157, 161, 165, 170, 173, 176, 180, 183, 186, 189, 192, 195, 195, 195,
- 195, 115, 110, 106, 102, 99, 102, 106, 111, 115, 120, 125, 131, 137,
- 142, 147, 152, 158, 162, 166, 170, 174, 177, 181, 184, 188, 190, 193,
- 196, 199, 199, 199, 199, 120, 115, 111, 107, 104, 107, 111, 115, 120,
- 124, 129, 135, 141, 145, 150, 155, 161, 165, 169, 173, 177, 181, 184,
- 187, 191, 193, 196, 199, 202, 202, 202, 202, 126, 121, 117, 113, 109,
- 112, 116, 120, 124, 129, 134, 139, 145, 149, 154, 159, 164, 168, 172,
- 176, 181, 184, 187, 190, 194, 196, 199, 202, 204, 204, 204, 204, 132,
- 127, 123, 119, 115, 118, 122, 125, 129, 134, 138, 143, 149, 153, 158,
- 163, 168, 172, 176, 180, 184, 187, 190, 194, 197, 199, 202, 205, 207,
- 207, 207, 207, 139, 134, 130, 125, 121, 124, 128, 131, 135, 139, 143,
- 148, 153, 157, 162, 166, 172, 175, 179, 183, 188, 191, 194, 197, 200,
- 203, 205, 208, 210, 210, 210, 210, 145, 140, 135, 130, 126, 129, 132,
- 136, 139, 143, 147, 152, 157, 161, 165, 170, 175, 178, 182, 186, 190,
- 193, 196, 199, 203, 205, 208, 210, 213, 213, 213, 213, 150, 145, 140,
- 136, 132, 134, 137, 140, 144, 148, 152, 156, 160, 164, 169, 173, 178,
- 181, 185, 189, 193, 196, 199, 202, 205, 208, 210, 212, 215, 215, 215,
- 215, 156, 151, 146, 142, 137, 140, 143, 146, 149, 152, 156, 160, 165,
- 168, 172, 177, 181, 185, 188, 192, 196, 199, 202, 205, 208, 210, 212,
- 215, 217, 217, 217, 217, 163, 158, 153, 148, 144, 146, 149, 151, 154,
- 158, 161, 165, 169, 173, 176, 180, 185, 188, 191, 195, 199, 202, 204,
- 207, 210, 213, 215, 217, 220, 220, 220, 220, 163, 158, 153, 148, 144,
- 146, 149, 151, 154, 158, 161, 165, 169, 173, 176, 180, 185, 188, 191,
- 195, 199, 202, 204, 207, 210, 213, 215, 217, 220, 220, 220, 220, 163,
- 158, 153, 148, 144, 146, 149, 151, 154, 158, 161, 165, 169, 173, 176,
- 180, 185, 188, 191, 195, 199, 202, 204, 207, 210, 213, 215, 217, 220,
- 220, 220, 220, 163, 158, 153, 148, 144, 146, 149, 151, 154, 158, 161,
- 165, 169, 173, 176, 180, 185, 188, 191, 195, 199, 202, 204, 207, 210,
- 213, 215, 217, 220, 220, 220, 220 },
- { /* Intra matrices */
- /* Size 4 */
- 24, 26, 43, 67, 26, 39, 54, 72, 43, 54, 75, 91, 67, 72, 91, 105,
- /* Size 8 */
- 28, 21, 23, 30, 41, 53, 65, 77, 21, 25, 23, 27, 35, 45, 56, 68, 23, 23,
- 33, 38, 45, 53, 63, 73, 30, 27, 38, 49, 56, 64, 72, 81, 41, 35, 45, 56,
- 67, 75, 82, 89, 53, 45, 53, 64, 75, 84, 91, 97, 65, 56, 63, 72, 82, 91,
- 98, 104, 77, 68, 73, 81, 89, 97, 104, 109,
- /* Size 16 */
- 27, 24, 21, 21, 22, 25, 29, 34, 39, 44, 51, 56, 63, 68, 75, 75, 24, 23,
- 22, 22, 22, 25, 28, 32, 36, 41, 47, 52, 58, 63, 70, 70, 21, 22, 24, 23,
- 23, 24, 27, 30, 34, 38, 43, 48, 54, 59, 65, 65, 21, 22, 23, 25, 26, 28,
- 31, 34, 38, 42, 47, 52, 57, 62, 68, 68, 22, 22, 23, 26, 32, 34, 37, 40,
- 43, 47, 51, 55, 61, 65, 70, 70, 25, 25, 24, 28, 34, 37, 41, 44, 48, 52,
- 56, 60, 65, 69, 74, 74, 29, 28, 27, 31, 37, 41, 47, 50, 54, 58, 62, 65,
- 70, 74, 78, 78, 34, 32, 30, 34, 40, 44, 50, 54, 59, 62, 67, 70, 74, 78,
- 82, 82, 39, 36, 34, 38, 43, 48, 54, 59, 64, 68, 72, 76, 79, 83, 86, 86,
- 44, 41, 38, 42, 47, 52, 58, 62, 68, 72, 76, 80, 83, 86, 90, 90, 51, 47,
- 43, 47, 51, 56, 62, 67, 72, 76, 81, 84, 88, 91, 94, 94, 56, 52, 48, 52,
- 55, 60, 65, 70, 76, 80, 84, 87, 91, 94, 97, 97, 63, 58, 54, 57, 61, 65,
- 70, 74, 79, 83, 88, 91, 95, 97, 100, 100, 68, 63, 59, 62, 65, 69, 74,
- 78, 83, 86, 91, 94, 97, 100, 103, 103, 75, 70, 65, 68, 70, 74, 78, 82,
- 86, 90, 94, 97, 100, 103, 105, 105, 75, 70, 65, 68, 70, 74, 78, 82, 86,
- 90, 94, 97, 100, 103, 105, 105,
- /* Size 32 */
- 27, 25, 23, 22, 20, 21, 21, 21, 22, 23, 25, 27, 29, 31, 33, 36, 39, 41,
- 43, 46, 50, 52, 55, 58, 62, 64, 67, 70, 73, 73, 73, 73, 25, 24, 23, 22,
- 21, 21, 21, 22, 22, 23, 25, 26, 28, 30, 32, 34, 37, 39, 42, 45, 48, 50,
- 53, 56, 59, 62, 65, 67, 71, 71, 71, 71, 23, 23, 22, 22, 22, 22, 22, 22,
- 22, 23, 24, 26, 27, 29, 31, 33, 36, 38, 40, 43, 46, 48, 51, 54, 57, 60,
- 62, 65, 68, 68, 68, 68, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 24, 25,
- 27, 28, 30, 32, 34, 36, 39, 41, 44, 46, 49, 52, 55, 57, 60, 63, 66, 66,
- 66, 66, 20, 21, 22, 22, 23, 23, 23, 22, 22, 23, 24, 25, 26, 28, 29, 31,
- 33, 35, 37, 40, 43, 45, 47, 50, 53, 55, 58, 61, 64, 64, 64, 64, 21, 21,
- 22, 22, 23, 23, 23, 24, 24, 25, 26, 27, 28, 30, 31, 33, 35, 37, 39, 42,
- 44, 46, 49, 52, 54, 57, 59, 62, 65, 65, 65, 65, 21, 21, 22, 22, 23, 23,
- 24, 25, 26, 27, 28, 29, 30, 32, 33, 35, 37, 39, 41, 43, 46, 48, 51, 53,
- 56, 58, 61, 63, 66, 66, 66, 66, 21, 22, 22, 22, 22, 24, 25, 27, 28, 29,
- 30, 32, 33, 34, 36, 38, 40, 41, 43, 46, 48, 50, 52, 55, 58, 60, 62, 65,
- 68, 68, 68, 68, 22, 22, 22, 22, 22, 24, 26, 28, 31, 32, 33, 35, 36, 38,
- 39, 41, 42, 44, 46, 48, 50, 52, 54, 57, 59, 62, 64, 66, 69, 69, 69, 69,
- 23, 23, 23, 23, 23, 25, 27, 29, 32, 34, 35, 37, 38, 40, 41, 43, 45, 46,
- 48, 50, 52, 54, 57, 59, 61, 64, 66, 68, 71, 71, 71, 71, 25, 25, 24, 24,
- 24, 26, 28, 30, 33, 35, 37, 39, 41, 42, 44, 45, 47, 49, 51, 53, 55, 57,
- 59, 61, 64, 66, 68, 70, 73, 73, 73, 73, 27, 26, 26, 25, 25, 27, 29, 32,
- 35, 37, 39, 41, 43, 45, 46, 48, 50, 52, 54, 56, 58, 60, 61, 64, 66, 68,
- 70, 72, 74, 74, 74, 74, 29, 28, 27, 27, 26, 28, 30, 33, 36, 38, 41, 43,
- 46, 48, 49, 51, 53, 55, 57, 59, 61, 62, 64, 66, 68, 70, 72, 74, 76, 76,
- 76, 76, 31, 30, 29, 28, 28, 30, 32, 34, 38, 40, 42, 45, 48, 49, 51, 53,
- 56, 57, 59, 61, 63, 65, 66, 68, 71, 72, 74, 76, 78, 78, 78, 78, 33, 32,
- 31, 30, 29, 31, 33, 36, 39, 41, 44, 46, 49, 51, 53, 55, 58, 60, 61, 63,
- 65, 67, 69, 71, 73, 75, 76, 78, 80, 80, 80, 80, 36, 34, 33, 32, 31, 33,
- 35, 38, 41, 43, 45, 48, 51, 53, 55, 58, 60, 62, 64, 66, 68, 70, 71, 73,
- 75, 77, 79, 80, 82, 82, 82, 82, 39, 37, 36, 34, 33, 35, 37, 40, 42, 45,
- 47, 50, 53, 56, 58, 60, 63, 65, 67, 69, 71, 72, 74, 76, 78, 79, 81, 83,
- 85, 85, 85, 85, 41, 39, 38, 36, 35, 37, 39, 41, 44, 46, 49, 52, 55, 57,
- 60, 62, 65, 67, 69, 71, 73, 74, 76, 78, 80, 81, 83, 85, 86, 86, 86, 86,
- 43, 42, 40, 39, 37, 39, 41, 43, 46, 48, 51, 54, 57, 59, 61, 64, 67, 69,
- 70, 73, 75, 76, 78, 80, 82, 83, 85, 86, 88, 88, 88, 88, 46, 45, 43, 41,
- 40, 42, 43, 46, 48, 50, 53, 56, 59, 61, 63, 66, 69, 71, 73, 75, 77, 79,
- 80, 82, 84, 85, 87, 88, 90, 90, 90, 90, 50, 48, 46, 44, 43, 44, 46, 48,
- 50, 52, 55, 58, 61, 63, 65, 68, 71, 73, 75, 77, 79, 81, 83, 84, 86, 87,
- 89, 90, 92, 92, 92, 92, 52, 50, 48, 46, 45, 46, 48, 50, 52, 54, 57, 60,
- 62, 65, 67, 70, 72, 74, 76, 79, 81, 82, 84, 86, 88, 89, 90, 92, 93, 93,
- 93, 93, 55, 53, 51, 49, 47, 49, 51, 52, 54, 57, 59, 61, 64, 66, 69, 71,
- 74, 76, 78, 80, 83, 84, 86, 88, 89, 91, 92, 94, 95, 95, 95, 95, 58, 56,
- 54, 52, 50, 52, 53, 55, 57, 59, 61, 64, 66, 68, 71, 73, 76, 78, 80, 82,
- 84, 86, 88, 89, 91, 92, 94, 95, 97, 97, 97, 97, 62, 59, 57, 55, 53, 54,
- 56, 58, 59, 61, 64, 66, 68, 71, 73, 75, 78, 80, 82, 84, 86, 88, 89, 91,
- 93, 94, 95, 97, 98, 98, 98, 98, 64, 62, 60, 57, 55, 57, 58, 60, 62, 64,
- 66, 68, 70, 72, 75, 77, 79, 81, 83, 85, 87, 89, 91, 92, 94, 95, 97, 98,
- 99, 99, 99, 99, 67, 65, 62, 60, 58, 59, 61, 62, 64, 66, 68, 70, 72, 74,
- 76, 79, 81, 83, 85, 87, 89, 90, 92, 94, 95, 97, 98, 99, 101, 101, 101,
- 101, 70, 67, 65, 63, 61, 62, 63, 65, 66, 68, 70, 72, 74, 76, 78, 80, 83,
- 85, 86, 88, 90, 92, 94, 95, 97, 98, 99, 101, 102, 102, 102, 102, 73, 71,
- 68, 66, 64, 65, 66, 68, 69, 71, 73, 74, 76, 78, 80, 82, 85, 86, 88, 90,
- 92, 93, 95, 97, 98, 99, 101, 102, 103, 103, 103, 103, 73, 71, 68, 66,
- 64, 65, 66, 68, 69, 71, 73, 74, 76, 78, 80, 82, 85, 86, 88, 90, 92, 93,
- 95, 97, 98, 99, 101, 102, 103, 103, 103, 103, 73, 71, 68, 66, 64, 65,
- 66, 68, 69, 71, 73, 74, 76, 78, 80, 82, 85, 86, 88, 90, 92, 93, 95, 97,
- 98, 99, 101, 102, 103, 103, 103, 103, 73, 71, 68, 66, 64, 65, 66, 68,
- 69, 71, 73, 74, 76, 78, 80, 82, 85, 86, 88, 90, 92, 93, 95, 97, 98, 99,
- 101, 102, 103, 103, 103, 103 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 99, 107, 133, 99, 117, 124, 141, 107, 124, 156, 175, 133, 141, 175,
- 203,
- /* Size 8 */
- 64, 52, 92, 97, 103, 114, 128, 143, 52, 74, 93, 85, 87, 96, 107, 120,
- 92, 93, 108, 105, 104, 109, 118, 129, 97, 85, 105, 117, 122, 127, 134,
- 143, 103, 87, 104, 122, 135, 144, 151, 159, 114, 96, 109, 127, 144, 156,
- 166, 175, 128, 107, 118, 134, 151, 166, 178, 188, 143, 120, 129, 143,
- 159, 175, 188, 198,
- /* Size 16 */
- 64, 57, 52, 66, 92, 94, 97, 100, 103, 108, 114, 121, 128, 135, 143, 143,
- 57, 59, 61, 74, 93, 92, 91, 93, 95, 99, 104, 110, 116, 123, 130, 130,
- 52, 61, 74, 83, 93, 89, 85, 86, 87, 91, 96, 101, 107, 113, 120, 120, 66,
- 74, 83, 91, 100, 97, 94, 95, 95, 98, 102, 107, 112, 118, 124, 124, 92,
- 93, 93, 100, 108, 106, 105, 104, 104, 107, 109, 114, 118, 123, 129, 129,
- 94, 92, 89, 97, 106, 108, 111, 112, 113, 115, 118, 122, 126, 131, 136,
- 136, 97, 91, 85, 94, 105, 111, 117, 120, 122, 125, 127, 131, 134, 139,
- 143, 143, 100, 93, 86, 95, 104, 112, 120, 124, 129, 132, 135, 139, 142,
- 146, 151, 151, 103, 95, 87, 95, 104, 113, 122, 129, 135, 139, 144, 147,
- 151, 155, 159, 159, 108, 99, 91, 98, 107, 115, 125, 132, 139, 144, 150,
- 154, 158, 162, 167, 167, 114, 104, 96, 102, 109, 118, 127, 135, 144,
- 150, 156, 161, 166, 170, 175, 175, 121, 110, 101, 107, 114, 122, 131,
- 139, 147, 154, 161, 166, 172, 176, 181, 181, 128, 116, 107, 112, 118,
- 126, 134, 142, 151, 158, 166, 172, 178, 183, 188, 188, 135, 123, 113,
- 118, 123, 131, 139, 146, 155, 162, 170, 176, 183, 188, 193, 193, 143,
- 130, 120, 124, 129, 136, 143, 151, 159, 167, 175, 181, 188, 193, 198,
- 198, 143, 130, 120, 124, 129, 136, 143, 151, 159, 167, 175, 181, 188,
- 193, 198, 198,
- /* Size 32 */
- 64, 61, 57, 55, 52, 58, 66, 77, 92, 93, 94, 96, 97, 98, 100, 101, 103,
- 106, 108, 111, 114, 117, 121, 124, 128, 131, 135, 139, 143, 143, 143,
- 143, 61, 59, 58, 57, 56, 62, 70, 79, 92, 93, 93, 93, 94, 95, 96, 97, 99,
- 101, 104, 106, 109, 112, 115, 118, 122, 125, 129, 132, 136, 136, 136,
- 136, 57, 58, 59, 60, 61, 67, 74, 82, 93, 92, 92, 91, 91, 92, 93, 94, 95,
- 97, 99, 101, 104, 107, 110, 113, 116, 119, 123, 126, 130, 130, 130, 130,
- 55, 57, 60, 63, 67, 72, 78, 85, 93, 92, 90, 89, 88, 89, 89, 90, 91, 93,
- 95, 97, 100, 102, 105, 108, 111, 114, 118, 121, 125, 125, 125, 125, 52,
- 56, 61, 67, 74, 78, 83, 88, 93, 91, 89, 87, 85, 86, 86, 87, 87, 89, 91,
- 93, 96, 98, 101, 104, 107, 110, 113, 116, 120, 120, 120, 120, 58, 62,
- 67, 72, 78, 82, 86, 91, 97, 95, 93, 91, 89, 90, 90, 91, 91, 93, 95, 97,
- 99, 101, 104, 106, 109, 112, 115, 119, 122, 122, 122, 122, 66, 70, 74,
- 78, 83, 86, 91, 95, 100, 99, 97, 95, 94, 94, 95, 95, 95, 97, 98, 100,
- 102, 104, 107, 109, 112, 115, 118, 121, 124, 124, 124, 124, 77, 79, 82,
- 85, 88, 91, 95, 99, 104, 103, 101, 100, 99, 99, 99, 99, 100, 101, 102,
- 104, 106, 108, 110, 113, 115, 118, 121, 124, 127, 127, 127, 127, 92, 92,
- 93, 93, 93, 97, 100, 104, 108, 107, 106, 105, 105, 105, 104, 104, 104,
- 106, 107, 108, 109, 111, 114, 116, 118, 121, 123, 126, 129, 129, 129,
- 129, 93, 93, 92, 92, 91, 95, 99, 103, 107, 107, 107, 107, 108, 108, 108,
- 108, 108, 110, 111, 112, 113, 115, 117, 120, 122, 124, 127, 130, 133,
- 133, 133, 133, 94, 93, 92, 90, 89, 93, 97, 101, 106, 107, 108, 109, 111,
- 111, 112, 112, 113, 114, 115, 116, 118, 120, 122, 124, 126, 128, 131,
- 133, 136, 136, 136, 136, 96, 93, 91, 89, 87, 91, 95, 100, 105, 107, 109,
- 112, 114, 115, 116, 116, 117, 119, 120, 121, 122, 124, 126, 128, 130,
- 132, 135, 137, 140, 140, 140, 140, 97, 94, 91, 88, 85, 89, 94, 99, 105,
- 108, 111, 114, 117, 118, 120, 121, 122, 124, 125, 126, 127, 129, 131,
- 132, 134, 136, 139, 141, 143, 143, 143, 143, 98, 95, 92, 89, 86, 90, 94,
- 99, 105, 108, 111, 115, 118, 120, 122, 124, 125, 127, 128, 130, 131,
- 133, 134, 136, 138, 140, 142, 145, 147, 147, 147, 147, 100, 96, 93, 89,
- 86, 90, 95, 99, 104, 108, 112, 116, 120, 122, 124, 126, 129, 130, 132,
- 133, 135, 137, 139, 140, 142, 144, 146, 149, 151, 151, 151, 151, 101,
- 97, 94, 90, 87, 91, 95, 99, 104, 108, 112, 116, 121, 124, 126, 129, 132,
- 134, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 155, 155,
- 155, 103, 99, 95, 91, 87, 91, 95, 100, 104, 108, 113, 117, 122, 125,
- 129, 132, 135, 137, 139, 142, 144, 146, 147, 149, 151, 153, 155, 157,
- 159, 159, 159, 159, 106, 101, 97, 93, 89, 93, 97, 101, 106, 110, 114,
- 119, 124, 127, 130, 134, 137, 140, 142, 144, 147, 149, 151, 153, 155,
- 157, 159, 161, 163, 163, 163, 163, 108, 104, 99, 95, 91, 95, 98, 102,
- 107, 111, 115, 120, 125, 128, 132, 135, 139, 142, 144, 147, 150, 152,
- 154, 156, 158, 160, 162, 164, 167, 167, 167, 167, 111, 106, 101, 97, 93,
- 97, 100, 104, 108, 112, 116, 121, 126, 130, 133, 137, 142, 144, 147,
- 150, 153, 155, 157, 160, 162, 164, 166, 168, 170, 170, 170, 170, 114,
- 109, 104, 100, 96, 99, 102, 106, 109, 113, 118, 122, 127, 131, 135, 139,
- 144, 147, 150, 153, 156, 159, 161, 164, 166, 168, 170, 172, 175, 175,
- 175, 175, 117, 112, 107, 102, 98, 101, 104, 108, 111, 115, 120, 124,
- 129, 133, 137, 141, 146, 149, 152, 155, 159, 161, 164, 166, 169, 171,
- 173, 175, 178, 178, 178, 178, 121, 115, 110, 105, 101, 104, 107, 110,
- 114, 117, 122, 126, 131, 134, 139, 143, 147, 151, 154, 157, 161, 164,
- 166, 169, 172, 174, 176, 178, 181, 181, 181, 181, 124, 118, 113, 108,
- 104, 106, 109, 113, 116, 120, 124, 128, 132, 136, 140, 145, 149, 153,
- 156, 160, 164, 166, 169, 172, 175, 177, 179, 182, 184, 184, 184, 184,
- 128, 122, 116, 111, 107, 109, 112, 115, 118, 122, 126, 130, 134, 138,
- 142, 147, 151, 155, 158, 162, 166, 169, 172, 175, 178, 180, 183, 185,
- 188, 188, 188, 188, 131, 125, 119, 114, 110, 112, 115, 118, 121, 124,
- 128, 132, 136, 140, 144, 149, 153, 157, 160, 164, 168, 171, 174, 177,
- 180, 183, 185, 188, 190, 190, 190, 190, 135, 129, 123, 118, 113, 115,
- 118, 121, 123, 127, 131, 135, 139, 142, 146, 151, 155, 159, 162, 166,
- 170, 173, 176, 179, 183, 185, 188, 190, 193, 193, 193, 193, 139, 132,
- 126, 121, 116, 119, 121, 124, 126, 130, 133, 137, 141, 145, 149, 153,
- 157, 161, 164, 168, 172, 175, 178, 182, 185, 188, 190, 193, 196, 196,
- 196, 196, 143, 136, 130, 125, 120, 122, 124, 127, 129, 133, 136, 140,
- 143, 147, 151, 155, 159, 163, 167, 170, 175, 178, 181, 184, 188, 190,
- 193, 196, 198, 198, 198, 198, 143, 136, 130, 125, 120, 122, 124, 127,
- 129, 133, 136, 140, 143, 147, 151, 155, 159, 163, 167, 170, 175, 178,
- 181, 184, 188, 190, 193, 196, 198, 198, 198, 198, 143, 136, 130, 125,
- 120, 122, 124, 127, 129, 133, 136, 140, 143, 147, 151, 155, 159, 163,
- 167, 170, 175, 178, 181, 184, 188, 190, 193, 196, 198, 198, 198, 198,
- 143, 136, 130, 125, 120, 122, 124, 127, 129, 133, 136, 140, 143, 147,
- 151, 155, 159, 163, 167, 170, 175, 178, 181, 184, 188, 190, 193, 196,
- 198, 198, 198, 198 },
- { /* Intra matrices */
- /* Size 4 */
- 29, 46, 49, 62, 46, 54, 58, 66, 49, 58, 74, 84, 62, 66, 84, 99,
- /* Size 8 */
- 31, 25, 45, 48, 51, 57, 64, 72, 25, 36, 46, 42, 43, 47, 53, 60, 45, 46,
- 54, 52, 52, 54, 59, 65, 48, 42, 52, 59, 61, 64, 68, 73, 51, 43, 52, 61,
- 68, 73, 77, 82, 57, 47, 54, 64, 73, 80, 86, 90, 64, 53, 59, 68, 77, 86,
- 92, 98, 72, 60, 65, 73, 82, 90, 98, 104,
- /* Size 16 */
- 30, 27, 24, 31, 44, 45, 47, 48, 50, 53, 56, 59, 63, 66, 71, 71, 27, 28,
- 29, 35, 44, 44, 43, 44, 45, 48, 50, 53, 57, 60, 64, 64, 24, 29, 35, 39,
- 45, 43, 41, 41, 42, 44, 46, 49, 52, 55, 58, 58, 31, 35, 39, 43, 48, 47,
- 45, 45, 46, 47, 49, 52, 54, 58, 61, 61, 44, 44, 45, 48, 52, 51, 51, 51,
- 50, 52, 53, 55, 58, 60, 63, 63, 45, 44, 43, 47, 51, 53, 54, 54, 55, 56,
- 57, 59, 62, 64, 67, 67, 47, 43, 41, 45, 51, 54, 57, 58, 60, 61, 62, 64,
- 66, 68, 71, 71, 48, 44, 41, 45, 51, 54, 58, 61, 63, 65, 67, 68, 70, 73,
- 75, 75, 50, 45, 42, 46, 50, 55, 60, 63, 67, 69, 71, 73, 75, 77, 80, 80,
- 53, 48, 44, 47, 52, 56, 61, 65, 69, 72, 74, 77, 79, 81, 84, 84, 56, 50,
- 46, 49, 53, 57, 62, 67, 71, 74, 78, 81, 83, 86, 88, 88, 59, 53, 49, 52,
- 55, 59, 64, 68, 73, 77, 81, 83, 87, 89, 92, 92, 63, 57, 52, 54, 58, 62,
- 66, 70, 75, 79, 83, 87, 90, 93, 95, 95, 66, 60, 55, 58, 60, 64, 68, 73,
- 77, 81, 86, 89, 93, 95, 98, 98, 71, 64, 58, 61, 63, 67, 71, 75, 80, 84,
- 88, 92, 95, 98, 102, 102, 71, 64, 58, 61, 63, 67, 71, 75, 80, 84, 88,
- 92, 95, 98, 102, 102,
- /* Size 32 */
- 30, 28, 27, 25, 24, 27, 31, 36, 43, 44, 45, 45, 46, 47, 48, 48, 49, 50,
- 52, 53, 55, 56, 58, 60, 62, 64, 65, 67, 70, 70, 70, 70, 28, 28, 27, 27,
- 26, 29, 33, 37, 44, 44, 44, 44, 44, 45, 46, 46, 47, 48, 49, 51, 52, 54,
- 55, 57, 59, 60, 62, 64, 66, 66, 66, 66, 27, 27, 28, 28, 28, 31, 35, 39,
- 44, 44, 43, 43, 43, 43, 44, 44, 45, 46, 47, 48, 50, 51, 53, 54, 56, 58,
- 59, 61, 63, 63, 63, 63, 25, 27, 28, 30, 31, 34, 37, 40, 44, 43, 43, 42,
- 41, 42, 42, 43, 43, 44, 45, 46, 47, 49, 50, 52, 53, 55, 57, 58, 60, 60,
- 60, 60, 24, 26, 28, 31, 35, 37, 39, 41, 44, 43, 42, 41, 40, 40, 41, 41,
- 41, 42, 43, 44, 45, 47, 48, 49, 51, 53, 54, 56, 58, 58, 58, 58, 27, 29,
- 31, 34, 37, 39, 41, 43, 46, 45, 44, 43, 42, 42, 43, 43, 43, 44, 45, 46,
- 47, 48, 49, 51, 52, 54, 55, 57, 59, 59, 59, 59, 31, 33, 35, 37, 39, 41,
- 43, 45, 48, 47, 46, 45, 45, 45, 45, 45, 45, 46, 47, 48, 49, 50, 51, 52,
- 54, 55, 57, 58, 60, 60, 60, 60, 36, 37, 39, 40, 41, 43, 45, 47, 50, 49,
- 48, 48, 47, 47, 47, 47, 47, 48, 49, 50, 50, 52, 53, 54, 55, 57, 58, 60,
- 61, 61, 61, 61, 43, 44, 44, 44, 44, 46, 48, 50, 52, 51, 51, 50, 50, 50,
- 50, 50, 50, 50, 51, 52, 52, 53, 54, 56, 57, 58, 60, 61, 63, 63, 63, 63,
- 44, 44, 44, 43, 43, 45, 47, 49, 51, 51, 51, 51, 51, 51, 52, 52, 52, 52,
- 53, 54, 54, 55, 56, 58, 59, 60, 61, 63, 64, 64, 64, 64, 45, 44, 43, 43,
- 42, 44, 46, 48, 51, 51, 52, 52, 53, 53, 53, 54, 54, 55, 55, 56, 57, 58,
- 59, 60, 61, 62, 63, 65, 66, 66, 66, 66, 45, 44, 43, 42, 41, 43, 45, 48,
- 50, 51, 52, 53, 55, 55, 55, 56, 56, 57, 58, 58, 59, 60, 61, 62, 63, 64,
- 65, 67, 68, 68, 68, 68, 46, 44, 43, 41, 40, 42, 45, 47, 50, 51, 53, 55,
- 56, 57, 58, 58, 59, 60, 60, 61, 62, 62, 63, 64, 65, 66, 68, 69, 70, 70,
- 70, 70, 47, 45, 43, 42, 40, 42, 45, 47, 50, 51, 53, 55, 57, 58, 59, 60,
- 61, 61, 62, 63, 64, 64, 65, 66, 67, 68, 70, 71, 72, 72, 72, 72, 48, 46,
- 44, 42, 41, 43, 45, 47, 50, 52, 53, 55, 58, 59, 60, 61, 62, 63, 64, 65,
- 66, 67, 67, 68, 69, 71, 72, 73, 74, 74, 74, 74, 48, 46, 44, 43, 41, 43,
- 45, 47, 50, 52, 54, 56, 58, 60, 61, 62, 64, 65, 66, 67, 68, 69, 70, 71,
- 72, 73, 74, 75, 76, 76, 76, 76, 49, 47, 45, 43, 41, 43, 45, 47, 50, 52,
- 54, 56, 59, 61, 62, 64, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
- 79, 79, 79, 79, 50, 48, 46, 44, 42, 44, 46, 48, 50, 52, 55, 57, 60, 61,
- 63, 65, 67, 68, 69, 70, 72, 73, 74, 75, 76, 77, 78, 79, 80, 80, 80, 80,
- 52, 49, 47, 45, 43, 45, 47, 49, 51, 53, 55, 58, 60, 62, 64, 66, 68, 69,
- 71, 72, 73, 75, 76, 77, 78, 79, 80, 81, 82, 82, 82, 82, 53, 51, 48, 46,
- 44, 46, 48, 50, 52, 54, 56, 58, 61, 63, 65, 67, 69, 70, 72, 74, 75, 76,
- 78, 79, 80, 81, 82, 83, 85, 85, 85, 85, 55, 52, 50, 47, 45, 47, 49, 50,
- 52, 54, 57, 59, 62, 64, 66, 68, 70, 72, 73, 75, 77, 78, 80, 81, 82, 83,
- 84, 86, 87, 87, 87, 87, 56, 54, 51, 49, 47, 48, 50, 52, 53, 55, 58, 60,
- 62, 64, 67, 69, 71, 73, 75, 76, 78, 80, 81, 82, 84, 85, 86, 87, 89, 89,
- 89, 89, 58, 55, 53, 50, 48, 49, 51, 53, 54, 56, 59, 61, 63, 65, 67, 70,
- 72, 74, 76, 78, 80, 81, 82, 84, 85, 87, 88, 89, 90, 90, 90, 90, 60, 57,
- 54, 52, 49, 51, 52, 54, 56, 58, 60, 62, 64, 66, 68, 71, 73, 75, 77, 79,
- 81, 82, 84, 85, 87, 88, 90, 91, 92, 92, 92, 92, 62, 59, 56, 53, 51, 52,
- 54, 55, 57, 59, 61, 63, 65, 67, 69, 72, 74, 76, 78, 80, 82, 84, 85, 87,
- 89, 90, 91, 93, 94, 94, 94, 94, 64, 60, 58, 55, 53, 54, 55, 57, 58, 60,
- 62, 64, 66, 68, 71, 73, 75, 77, 79, 81, 83, 85, 87, 88, 90, 91, 93, 94,
- 96, 96, 96, 96, 65, 62, 59, 57, 54, 55, 57, 58, 60, 61, 63, 65, 68, 70,
- 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 91, 93, 94, 96, 97, 97, 97, 97,
- 67, 64, 61, 58, 56, 57, 58, 60, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79,
- 81, 83, 86, 87, 89, 91, 93, 94, 96, 97, 99, 99, 99, 99, 70, 66, 63, 60,
- 58, 59, 60, 61, 63, 64, 66, 68, 70, 72, 74, 76, 79, 80, 82, 85, 87, 89,
- 90, 92, 94, 96, 97, 99, 100, 100, 100, 100, 70, 66, 63, 60, 58, 59, 60,
- 61, 63, 64, 66, 68, 70, 72, 74, 76, 79, 80, 82, 85, 87, 89, 90, 92, 94,
- 96, 97, 99, 100, 100, 100, 100, 70, 66, 63, 60, 58, 59, 60, 61, 63, 64,
- 66, 68, 70, 72, 74, 76, 79, 80, 82, 85, 87, 89, 90, 92, 94, 96, 97, 99,
- 100, 100, 100, 100, 70, 66, 63, 60, 58, 59, 60, 61, 63, 64, 66, 68, 70,
- 72, 74, 76, 79, 80, 82, 85, 87, 89, 90, 92, 94, 96, 97, 99, 100, 100,
- 100, 100 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 69, 108, 155, 69, 100, 131, 166, 108, 131, 171, 197, 155, 166, 197,
- 218,
- /* Size 8 */
- 64, 49, 53, 68, 88, 109, 130, 149, 49, 56, 54, 62, 77, 96, 115, 134, 53,
- 54, 73, 83, 95, 110, 126, 142, 68, 62, 83, 102, 116, 128, 141, 154, 88,
- 77, 95, 116, 132, 145, 156, 166, 109, 96, 110, 128, 145, 158, 168, 176,
- 130, 115, 126, 141, 156, 168, 177, 185, 149, 134, 142, 154, 166, 176,
- 185, 191,
- /* Size 16 */
- 64, 56, 49, 51, 53, 60, 68, 77, 88, 97, 109, 119, 130, 139, 149, 149,
- 56, 54, 52, 53, 53, 59, 65, 73, 82, 91, 102, 111, 122, 131, 141, 141,
- 49, 52, 56, 55, 54, 58, 62, 69, 77, 85, 96, 104, 115, 124, 134, 134, 51,
- 53, 55, 58, 62, 66, 71, 78, 85, 93, 102, 111, 120, 128, 138, 138, 53,
- 53, 54, 62, 73, 78, 83, 89, 95, 102, 110, 117, 126, 134, 142, 142, 60,
- 59, 58, 66, 78, 84, 92, 98, 104, 111, 118, 125, 133, 140, 148, 148, 68,
- 65, 62, 71, 83, 92, 102, 108, 116, 122, 128, 134, 141, 147, 154, 154,
- 77, 73, 69, 78, 89, 98, 108, 115, 123, 129, 136, 142, 148, 153, 159,
- 159, 88, 82, 77, 85, 95, 104, 116, 123, 132, 138, 145, 150, 156, 161,
- 166, 166, 97, 91, 85, 93, 102, 111, 122, 129, 138, 144, 151, 156, 162,
- 166, 171, 171, 109, 102, 96, 102, 110, 118, 128, 136, 145, 151, 158,
- 163, 168, 172, 176, 176, 119, 111, 104, 111, 117, 125, 134, 142, 150,
- 156, 163, 168, 173, 176, 180, 180, 130, 122, 115, 120, 126, 133, 141,
- 148, 156, 162, 168, 173, 177, 181, 185, 185, 139, 131, 124, 128, 134,
- 140, 147, 153, 161, 166, 172, 176, 181, 184, 188, 188, 149, 141, 134,
- 138, 142, 148, 154, 159, 166, 171, 176, 180, 185, 188, 191, 191, 149,
- 141, 134, 138, 142, 148, 154, 159, 166, 171, 176, 180, 185, 188, 191,
- 191,
- /* Size 32 */
- 64, 60, 56, 52, 49, 50, 51, 52, 53, 56, 60, 64, 68, 72, 77, 82, 88, 92,
- 97, 103, 109, 114, 119, 124, 130, 134, 139, 144, 149, 149, 149, 149, 60,
- 57, 55, 53, 51, 51, 52, 53, 53, 56, 59, 63, 66, 70, 75, 79, 85, 89, 94,
- 100, 106, 110, 115, 120, 126, 130, 135, 140, 145, 145, 145, 145, 56, 55,
- 54, 53, 52, 53, 53, 53, 53, 56, 59, 62, 65, 69, 73, 77, 82, 86, 91, 96,
- 102, 106, 111, 116, 122, 126, 131, 136, 141, 141, 141, 141, 52, 53, 53,
- 54, 54, 54, 54, 54, 54, 56, 58, 61, 64, 67, 71, 75, 80, 84, 88, 93, 99,
- 103, 108, 113, 118, 123, 127, 132, 137, 137, 137, 137, 49, 51, 52, 54,
- 56, 55, 55, 54, 54, 56, 58, 60, 62, 65, 69, 73, 77, 81, 85, 90, 96, 100,
- 104, 109, 115, 119, 124, 128, 134, 134, 134, 134, 50, 51, 53, 54, 55,
- 56, 56, 57, 58, 60, 62, 64, 66, 70, 73, 77, 81, 85, 89, 94, 99, 103,
- 107, 112, 118, 122, 126, 131, 136, 136, 136, 136, 51, 52, 53, 54, 55,
- 56, 58, 60, 62, 64, 66, 69, 71, 74, 78, 81, 85, 89, 93, 97, 102, 106,
- 111, 115, 120, 124, 128, 133, 138, 138, 138, 138, 52, 53, 53, 54, 54,
- 57, 60, 63, 67, 69, 72, 74, 77, 80, 83, 86, 90, 94, 97, 101, 106, 110,
- 114, 118, 123, 127, 131, 135, 140, 140, 140, 140, 53, 53, 53, 54, 54,
- 58, 62, 67, 73, 75, 78, 80, 83, 86, 89, 92, 95, 99, 102, 106, 110, 114,
- 117, 122, 126, 130, 134, 138, 142, 142, 142, 142, 56, 56, 56, 56, 56,
- 60, 64, 69, 75, 78, 81, 84, 87, 90, 93, 96, 100, 103, 106, 110, 114,
- 118, 121, 125, 130, 133, 137, 141, 145, 145, 145, 145, 60, 59, 59, 58,
- 58, 62, 66, 72, 78, 81, 84, 88, 92, 95, 98, 101, 104, 108, 111, 115,
- 118, 122, 125, 129, 133, 136, 140, 144, 148, 148, 148, 148, 64, 63, 62,
- 61, 60, 64, 69, 74, 80, 84, 88, 92, 97, 100, 103, 106, 110, 113, 116,
- 119, 123, 126, 130, 133, 137, 140, 143, 147, 151, 151, 151, 151, 68, 66,
- 65, 64, 62, 66, 71, 77, 83, 87, 92, 97, 102, 105, 108, 112, 116, 119,
- 122, 125, 128, 131, 134, 138, 141, 144, 147, 150, 154, 154, 154, 154,
- 72, 70, 69, 67, 65, 70, 74, 80, 86, 90, 95, 100, 105, 108, 112, 116,
- 119, 122, 125, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156, 156,
- 156, 156, 77, 75, 73, 71, 69, 73, 78, 83, 89, 93, 98, 103, 108, 112,
- 115, 119, 123, 126, 129, 133, 136, 139, 142, 145, 148, 151, 153, 156,
- 159, 159, 159, 159, 82, 79, 77, 75, 73, 77, 81, 86, 92, 96, 101, 106,
- 112, 116, 119, 123, 128, 131, 134, 137, 140, 143, 146, 149, 152, 154,
- 157, 160, 162, 162, 162, 162, 88, 85, 82, 80, 77, 81, 85, 90, 95, 100,
- 104, 110, 116, 119, 123, 128, 132, 135, 138, 141, 145, 147, 150, 153,
- 156, 158, 161, 163, 166, 166, 166, 166, 92, 89, 86, 84, 81, 85, 89, 94,
- 99, 103, 108, 113, 119, 122, 126, 131, 135, 138, 141, 144, 148, 150,
- 153, 156, 159, 161, 163, 166, 168, 168, 168, 168, 97, 94, 91, 88, 85,
- 89, 93, 97, 102, 106, 111, 116, 122, 125, 129, 134, 138, 141, 144, 148,
- 151, 154, 156, 159, 162, 164, 166, 168, 171, 171, 171, 171, 103, 100,
- 96, 93, 90, 94, 97, 101, 106, 110, 115, 119, 125, 129, 133, 137, 141,
- 144, 148, 151, 154, 157, 159, 162, 165, 167, 169, 171, 174, 174, 174,
- 174, 109, 106, 102, 99, 96, 99, 102, 106, 110, 114, 118, 123, 128, 132,
- 136, 140, 145, 148, 151, 154, 158, 160, 163, 165, 168, 170, 172, 174,
- 176, 176, 176, 176, 114, 110, 106, 103, 100, 103, 106, 110, 114, 118,
- 122, 126, 131, 135, 139, 143, 147, 150, 154, 157, 160, 163, 165, 168,
- 170, 172, 174, 176, 178, 178, 178, 178, 119, 115, 111, 108, 104, 107,
- 111, 114, 117, 121, 125, 130, 134, 138, 142, 146, 150, 153, 156, 159,
- 163, 165, 168, 170, 173, 174, 176, 178, 180, 180, 180, 180, 124, 120,
- 116, 113, 109, 112, 115, 118, 122, 125, 129, 133, 138, 141, 145, 149,
- 153, 156, 159, 162, 165, 168, 170, 172, 175, 177, 179, 181, 183, 183,
- 183, 183, 130, 126, 122, 118, 115, 118, 120, 123, 126, 130, 133, 137,
- 141, 144, 148, 152, 156, 159, 162, 165, 168, 170, 173, 175, 177, 179,
- 181, 183, 185, 185, 185, 185, 134, 130, 126, 123, 119, 122, 124, 127,
- 130, 133, 136, 140, 144, 147, 151, 154, 158, 161, 164, 167, 170, 172,
- 174, 177, 179, 181, 183, 185, 186, 186, 186, 186, 139, 135, 131, 127,
- 124, 126, 128, 131, 134, 137, 140, 143, 147, 150, 153, 157, 161, 163,
- 166, 169, 172, 174, 176, 179, 181, 183, 184, 186, 188, 188, 188, 188,
- 144, 140, 136, 132, 128, 131, 133, 135, 138, 141, 144, 147, 150, 153,
- 156, 160, 163, 166, 168, 171, 174, 176, 178, 181, 183, 185, 186, 188,
- 190, 190, 190, 190, 149, 145, 141, 137, 134, 136, 138, 140, 142, 145,
- 148, 151, 154, 156, 159, 162, 166, 168, 171, 174, 176, 178, 180, 183,
- 185, 186, 188, 190, 191, 191, 191, 191, 149, 145, 141, 137, 134, 136,
- 138, 140, 142, 145, 148, 151, 154, 156, 159, 162, 166, 168, 171, 174,
- 176, 178, 180, 183, 185, 186, 188, 190, 191, 191, 191, 191, 149, 145,
- 141, 137, 134, 136, 138, 140, 142, 145, 148, 151, 154, 156, 159, 162,
- 166, 168, 171, 174, 176, 178, 180, 183, 185, 186, 188, 190, 191, 191,
- 191, 191, 149, 145, 141, 137, 134, 136, 138, 140, 142, 145, 148, 151,
- 154, 156, 159, 162, 166, 168, 171, 174, 176, 178, 180, 183, 185, 186,
- 188, 190, 191, 191, 191, 191 },
- { /* Intra matrices */
- /* Size 4 */
- 26, 29, 46, 68, 29, 42, 57, 73, 46, 57, 75, 88, 68, 73, 88, 99,
- /* Size 8 */
- 31, 24, 26, 33, 44, 55, 67, 77, 24, 27, 26, 30, 38, 48, 58, 69, 26, 26,
- 36, 41, 47, 55, 64, 73, 33, 30, 41, 51, 59, 65, 73, 80, 44, 38, 47, 59,
- 68, 75, 81, 87, 55, 48, 55, 65, 75, 82, 88, 93, 67, 58, 64, 73, 81, 88,
- 94, 98, 77, 69, 73, 80, 87, 93, 98, 102,
- /* Size 16 */
- 30, 26, 23, 24, 25, 28, 32, 37, 42, 47, 53, 58, 64, 69, 75, 75, 26, 25,
- 25, 25, 25, 28, 31, 34, 39, 44, 49, 54, 60, 65, 70, 70, 23, 25, 26, 26,
- 25, 27, 29, 33, 37, 41, 46, 51, 56, 61, 66, 66, 24, 25, 26, 27, 29, 31,
- 34, 37, 41, 45, 50, 54, 59, 63, 69, 69, 25, 25, 25, 29, 35, 37, 40, 43,
- 46, 49, 54, 58, 62, 66, 71, 71, 28, 28, 27, 31, 37, 40, 44, 47, 51, 54,
- 58, 62, 66, 70, 74, 74, 32, 31, 29, 34, 40, 44, 50, 53, 57, 60, 63, 67,
- 70, 74, 77, 77, 37, 34, 33, 37, 43, 47, 53, 57, 61, 64, 68, 71, 74, 77,
- 81, 81, 42, 39, 37, 41, 46, 51, 57, 61, 66, 69, 72, 75, 79, 81, 84, 84,
- 47, 44, 41, 45, 49, 54, 60, 64, 69, 72, 76, 79, 82, 84, 87, 87, 53, 49,
- 46, 50, 54, 58, 63, 68, 72, 76, 80, 83, 85, 88, 90, 90, 58, 54, 51, 54,
- 58, 62, 67, 71, 75, 79, 83, 85, 88, 90, 93, 93, 64, 60, 56, 59, 62, 66,
- 70, 74, 79, 82, 85, 88, 91, 93, 95, 95, 69, 65, 61, 63, 66, 70, 74, 77,
- 81, 84, 88, 90, 93, 95, 97, 97, 75, 70, 66, 69, 71, 74, 77, 81, 84, 87,
- 90, 93, 95, 97, 99, 99, 75, 70, 66, 69, 71, 74, 77, 81, 84, 87, 90, 93,
- 95, 97, 99, 99,
- /* Size 32 */
- 30, 28, 26, 24, 23, 23, 24, 24, 24, 26, 28, 30, 32, 34, 36, 39, 42, 44,
- 46, 49, 52, 55, 57, 60, 63, 66, 68, 71, 73, 73, 73, 73, 28, 26, 25, 24,
- 23, 24, 24, 24, 25, 26, 27, 29, 31, 33, 35, 37, 40, 42, 45, 47, 50, 53,
- 55, 58, 61, 63, 66, 68, 71, 71, 71, 71, 26, 25, 25, 25, 24, 24, 24, 25,
- 25, 26, 27, 29, 30, 32, 34, 36, 39, 41, 43, 46, 49, 51, 53, 56, 59, 61,
- 64, 66, 69, 69, 69, 69, 24, 24, 25, 25, 25, 25, 25, 25, 25, 26, 27, 28,
- 29, 31, 33, 35, 37, 39, 42, 44, 47, 49, 52, 54, 57, 59, 62, 64, 67, 67,
- 67, 67, 23, 23, 24, 25, 26, 26, 25, 25, 25, 26, 27, 28, 29, 30, 32, 34,
- 36, 38, 40, 43, 45, 48, 50, 52, 55, 58, 60, 62, 65, 65, 65, 65, 23, 24,
- 24, 25, 26, 26, 26, 26, 27, 28, 29, 30, 31, 32, 34, 36, 38, 40, 42, 44,
- 47, 49, 51, 54, 57, 59, 61, 64, 66, 66, 66, 66, 24, 24, 24, 25, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 35, 36, 38, 40, 42, 44, 46, 49, 51, 53, 55,
- 58, 60, 62, 65, 67, 67, 67, 67, 24, 24, 25, 25, 25, 26, 28, 29, 31, 32,
- 33, 35, 36, 37, 39, 41, 43, 44, 46, 48, 51, 53, 55, 57, 60, 62, 64, 66,
- 69, 69, 69, 69, 24, 25, 25, 25, 25, 27, 29, 31, 34, 35, 36, 38, 39, 41,
- 42, 44, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 70, 70, 70, 70,
- 26, 26, 26, 26, 26, 28, 30, 32, 35, 37, 38, 40, 41, 43, 44, 46, 47, 49,
- 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 71, 71, 71, 28, 27, 27, 27,
- 27, 29, 31, 33, 36, 38, 40, 41, 43, 45, 46, 48, 50, 52, 53, 55, 57, 59,
- 61, 63, 65, 67, 69, 71, 73, 73, 73, 73, 30, 29, 29, 28, 28, 30, 32, 35,
- 38, 40, 41, 44, 46, 47, 49, 51, 53, 54, 56, 58, 60, 61, 63, 65, 67, 69,
- 71, 72, 74, 74, 74, 74, 32, 31, 30, 29, 29, 31, 33, 36, 39, 41, 43, 46,
- 49, 50, 52, 54, 56, 57, 59, 61, 62, 64, 66, 67, 69, 71, 72, 74, 76, 76,
- 76, 76, 34, 33, 32, 31, 30, 32, 35, 37, 41, 43, 45, 47, 50, 52, 54, 56,
- 58, 59, 61, 63, 64, 66, 68, 69, 71, 73, 74, 76, 78, 78, 78, 78, 36, 35,
- 34, 33, 32, 34, 36, 39, 42, 44, 46, 49, 52, 54, 56, 58, 60, 61, 63, 65,
- 66, 68, 70, 71, 73, 74, 76, 78, 79, 79, 79, 79, 39, 37, 36, 35, 34, 36,
- 38, 41, 44, 46, 48, 51, 54, 56, 58, 60, 62, 64, 65, 67, 69, 70, 72, 73,
- 75, 76, 78, 79, 81, 81, 81, 81, 42, 40, 39, 37, 36, 38, 40, 43, 45, 47,
- 50, 53, 56, 58, 60, 62, 64, 66, 68, 69, 71, 73, 74, 76, 77, 79, 80, 81,
- 83, 83, 83, 83, 44, 42, 41, 39, 38, 40, 42, 44, 47, 49, 52, 54, 57, 59,
- 61, 64, 66, 68, 69, 71, 73, 74, 76, 77, 79, 80, 81, 83, 84, 84, 84, 84,
- 46, 45, 43, 42, 40, 42, 44, 46, 49, 51, 53, 56, 59, 61, 63, 65, 68, 69,
- 71, 73, 75, 76, 77, 79, 81, 82, 83, 84, 86, 86, 86, 86, 49, 47, 46, 44,
- 43, 44, 46, 48, 51, 53, 55, 58, 61, 63, 65, 67, 69, 71, 73, 75, 77, 78,
- 79, 81, 82, 83, 85, 86, 87, 87, 87, 87, 52, 50, 49, 47, 45, 47, 49, 51,
- 53, 55, 57, 60, 62, 64, 66, 69, 71, 73, 75, 77, 78, 80, 81, 83, 84, 85,
- 86, 88, 89, 89, 89, 89, 55, 53, 51, 49, 48, 49, 51, 53, 55, 57, 59, 61,
- 64, 66, 68, 70, 73, 74, 76, 78, 80, 81, 82, 84, 85, 86, 88, 89, 90, 90,
- 90, 90, 57, 55, 53, 52, 50, 51, 53, 55, 57, 59, 61, 63, 66, 68, 70, 72,
- 74, 76, 77, 79, 81, 82, 84, 85, 87, 88, 89, 90, 91, 91, 91, 91, 60, 58,
- 56, 54, 52, 54, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 76, 77, 79, 81,
- 83, 84, 85, 87, 88, 89, 90, 91, 92, 92, 92, 92, 63, 61, 59, 57, 55, 57,
- 58, 60, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 82, 84, 85, 87, 88,
- 89, 90, 92, 93, 94, 94, 94, 94, 66, 63, 61, 59, 58, 59, 60, 62, 63, 65,
- 67, 69, 71, 73, 74, 76, 79, 80, 82, 83, 85, 86, 88, 89, 90, 91, 93, 94,
- 95, 95, 95, 95, 68, 66, 64, 62, 60, 61, 62, 64, 65, 67, 69, 71, 72, 74,
- 76, 78, 80, 81, 83, 85, 86, 88, 89, 90, 92, 93, 94, 95, 96, 96, 96, 96,
- 71, 68, 66, 64, 62, 64, 65, 66, 67, 69, 71, 72, 74, 76, 78, 79, 81, 83,
- 84, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 97, 97, 97, 73, 71, 69, 67,
- 65, 66, 67, 69, 70, 71, 73, 74, 76, 78, 79, 81, 83, 84, 86, 87, 89, 90,
- 91, 92, 94, 95, 96, 97, 98, 98, 98, 98, 73, 71, 69, 67, 65, 66, 67, 69,
- 70, 71, 73, 74, 76, 78, 79, 81, 83, 84, 86, 87, 89, 90, 91, 92, 94, 95,
- 96, 97, 98, 98, 98, 98, 73, 71, 69, 67, 65, 66, 67, 69, 70, 71, 73, 74,
- 76, 78, 79, 81, 83, 84, 86, 87, 89, 90, 91, 92, 94, 95, 96, 97, 98, 98,
- 98, 98, 73, 71, 69, 67, 65, 66, 67, 69, 70, 71, 73, 74, 76, 78, 79, 81,
- 83, 84, 86, 87, 89, 90, 91, 92, 94, 95, 96, 97, 98, 98, 98, 98 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 96, 104, 126, 96, 113, 119, 133, 104, 119, 146, 162, 126, 133, 162,
+ /* Size 8x8 */
+ 63, 77, 95, 97, 109, 123, 134, 145, 77, 95, 94, 93, 100, 111, 122, 134,
+ 95, 94, 107, 111, 117, 127, 133, 134, 97, 93, 111, 125, 135, 145, 146,
+ 144, 109, 100, 117, 135, 153, 166, 175, 166, 123, 111, 127, 145, 166,
+ 183, 183, 201, 134, 122, 133, 146, 175, 183, 207, 240, 145, 134, 134,
+ 144, 166, 201, 240, 233,
+ /* Size 16x16 */
+ 64, 61, 67, 77, 98, 97, 101, 104, 111, 120, 127, 133, 139, 144, 150,
+ 157, 61, 63, 71, 82, 93, 92, 93, 96, 102, 110, 116, 121, 127, 133, 139,
+ 145, 67, 71, 78, 88, 95, 93, 93, 95, 100, 107, 113, 117, 122, 126, 132,
+ 138, 77, 82, 88, 95, 98, 96, 95, 96, 101, 107, 111, 116, 118, 121, 124,
+ 130, 98, 93, 95, 98, 106, 106, 108, 109, 112, 117, 121, 125, 128, 127,
+ 139, 143, 97, 92, 93, 96, 106, 109, 113, 115, 118, 123, 127, 131, 138,
+ 132, 144, 149, 101, 93, 93, 95, 108, 113, 122, 126, 131, 136, 140, 144,
+ 141, 147, 145, 158, 104, 96, 95, 96, 109, 115, 126, 133, 139, 145, 150,
+ 153, 150, 161, 148, 169, 111, 102, 100, 101, 112, 118, 131, 139, 146,
+ 154, 159, 163, 168, 173, 155, 179, 120, 110, 107, 107, 117, 123, 136,
+ 145, 154, 164, 170, 175, 177, 170, 163, 195, 127, 116, 113, 111, 121,
+ 127, 140, 150, 159, 170, 178, 183, 180, 176, 179, 202, 133, 121, 117,
+ 116, 125, 131, 144, 153, 163, 175, 183, 189, 192, 193, 197, 221, 139,
+ 127, 122, 118, 128, 138, 141, 150, 168, 177, 180, 192, 201, 203, 224,
+ 228, 144, 133, 126, 121, 127, 132, 147, 161, 173, 170, 176, 193, 203,
+ 213, 214, 253, 150, 139, 132, 124, 139, 144, 145, 148, 155, 163, 179,
+ 197, 224, 214, 226, 225, 157, 145, 138, 130, 143, 149, 158, 169, 179,
+ 195, 202, 221, 228, 253, 225, 240,
+ /* Size 32x32 */
+ 64, 62, 61, 62, 67, 73, 77, 83, 98, 98, 97, 98, 101, 102, 104, 109, 111,
+ 114, 120, 124, 127, 130, 133, 136, 139, 142, 144, 147, 150, 153, 157,
+ 160, 62, 63, 63, 64, 69, 77, 80, 85, 95, 95, 94, 94, 96, 97, 100, 104,
+ 106, 109, 114, 118, 121, 123, 126, 129, 131, 134, 137, 139, 142, 145,
+ 148, 149, 61, 63, 63, 65, 71, 79, 82, 85, 93, 92, 92, 91, 93, 94, 96,
+ 100, 102, 105, 110, 114, 116, 118, 121, 124, 127, 130, 133, 136, 139,
+ 142, 145, 151, 62, 64, 65, 66, 72, 81, 83, 86, 93, 92, 91, 90, 92, 93,
+ 95, 99, 101, 103, 109, 112, 114, 117, 119, 123, 125, 128, 130, 133, 135,
+ 138, 141, 140, 67, 69, 71, 72, 78, 87, 88, 90, 95, 93, 93, 91, 93, 94,
+ 95, 99, 100, 102, 107, 110, 113, 115, 117, 120, 122, 123, 126, 129, 132,
+ 135, 138, 144, 73, 77, 79, 81, 87, 95, 95, 95, 96, 94, 93, 91, 92, 93,
+ 94, 97, 98, 100, 104, 107, 109, 111, 113, 116, 119, 122, 127, 129, 131,
+ 134, 136, 136, 77, 80, 82, 83, 88, 95, 95, 96, 98, 96, 96, 94, 95, 95,
+ 96, 99, 101, 102, 107, 109, 111, 113, 116, 116, 118, 120, 121, 121, 124,
+ 127, 130, 139, 83, 85, 85, 86, 90, 95, 96, 97, 101, 100, 99, 98, 100,
+ 100, 101, 104, 105, 107, 111, 113, 115, 117, 119, 122, 126, 127, 129,
+ 125, 126, 128, 131, 127, 98, 95, 93, 93, 95, 96, 98, 101, 106, 106, 106,
+ 107, 108, 108, 109, 111, 112, 113, 117, 119, 121, 123, 125, 127, 128,
+ 125, 127, 132, 139, 141, 143, 133, 98, 95, 92, 92, 93, 94, 96, 100, 106,
+ 107, 108, 110, 111, 111, 112, 115, 116, 117, 121, 123, 125, 127, 129,
+ 128, 129, 133, 137, 138, 131, 134, 136, 152, 97, 94, 92, 91, 93, 93, 96,
+ 99, 106, 108, 109, 111, 113, 113, 115, 117, 118, 120, 123, 126, 127,
+ 129, 131, 133, 138, 138, 132, 134, 144, 148, 149, 138, 98, 94, 91, 90,
+ 91, 91, 94, 98, 107, 110, 111, 117, 119, 120, 123, 125, 126, 127, 131,
+ 133, 135, 136, 138, 141, 138, 136, 144, 148, 142, 138, 140, 158, 101,
+ 96, 93, 92, 93, 92, 95, 100, 108, 111, 113, 119, 122, 123, 126, 129,
+ 131, 133, 136, 138, 140, 142, 144, 142, 141, 150, 147, 140, 145, 157,
+ 158, 142, 102, 97, 94, 93, 94, 93, 95, 100, 108, 111, 113, 120, 123,
+ 125, 129, 132, 133, 135, 139, 141, 143, 145, 147, 147, 152, 146, 145,
+ 159, 158, 144, 145, 168, 104, 100, 96, 95, 95, 94, 96, 101, 109, 112,
+ 115, 123, 126, 129, 133, 137, 139, 141, 145, 148, 150, 151, 153, 157,
+ 150, 152, 161, 149, 148, 169, 169, 147, 109, 104, 100, 99, 99, 97, 99,
+ 104, 111, 115, 117, 125, 129, 132, 137, 142, 144, 147, 151, 154, 156,
+ 158, 160, 157, 159, 165, 152, 162, 170, 151, 151, 179, 111, 106, 102,
+ 101, 100, 98, 101, 105, 112, 116, 118, 126, 131, 133, 139, 144, 146,
+ 149, 154, 157, 159, 161, 163, 162, 168, 158, 173, 169, 155, 174, 179,
+ 153, 114, 109, 105, 103, 102, 100, 102, 107, 113, 117, 120, 127, 133,
+ 135, 141, 147, 149, 153, 158, 161, 164, 166, 168, 173, 164, 175, 168,
+ 162, 185, 166, 158, 190, 120, 114, 110, 109, 107, 104, 107, 111, 117,
+ 121, 123, 131, 136, 139, 145, 151, 154, 158, 164, 168, 170, 172, 175,
+ 173, 177, 175, 170, 184, 163, 180, 195, 160, 124, 118, 114, 112, 110,
+ 107, 109, 113, 119, 123, 126, 133, 138, 141, 148, 154, 157, 161, 168,
+ 172, 175, 177, 180, 178, 183, 175, 190, 169, 192, 181, 166, 207, 127,
+ 121, 116, 114, 113, 109, 111, 115, 121, 125, 127, 135, 140, 143, 150,
+ 156, 159, 164, 170, 175, 178, 180, 183, 190, 180, 192, 176, 201, 179,
+ 182, 202, 168, 130, 123, 118, 117, 115, 111, 113, 117, 123, 127, 129,
+ 136, 142, 145, 151, 158, 161, 166, 172, 177, 180, 183, 186, 188, 197,
+ 183, 200, 183, 197, 201, 175, 213, 133, 126, 121, 119, 117, 113, 116,
+ 119, 125, 129, 131, 138, 144, 147, 153, 160, 163, 168, 175, 180, 183,
+ 186, 189, 189, 192, 200, 193, 199, 197, 187, 221, 177, 136, 129, 124,
+ 123, 120, 116, 116, 122, 127, 128, 133, 141, 142, 147, 157, 157, 162,
+ 173, 173, 178, 190, 188, 189, 196, 192, 197, 202, 207, 196, 216, 185,
+ 234, 139, 131, 127, 125, 122, 119, 118, 126, 128, 129, 138, 138, 141,
+ 152, 150, 159, 168, 164, 177, 183, 180, 197, 192, 192, 201, 194, 203,
+ 201, 224, 191, 228, 187, 142, 134, 130, 128, 123, 122, 120, 127, 125,
+ 133, 138, 136, 150, 146, 152, 165, 158, 175, 175, 175, 192, 183, 200,
+ 197, 194, 207, 197, 208, 199, 240, 194, 239, 144, 137, 133, 130, 126,
+ 127, 121, 129, 127, 137, 132, 144, 147, 145, 161, 152, 173, 168, 170,
+ 190, 176, 200, 193, 202, 203, 197, 213, 200, 214, 202, 253, 196, 147,
+ 139, 136, 133, 129, 129, 121, 125, 132, 138, 134, 148, 140, 159, 149,
+ 162, 169, 162, 184, 169, 201, 183, 199, 207, 201, 208, 200, 220, 203,
+ 219, 205, 266, 150, 142, 139, 135, 132, 131, 124, 126, 139, 131, 144,
+ 142, 145, 158, 148, 170, 155, 185, 163, 192, 179, 197, 197, 196, 224,
+ 199, 214, 203, 226, 206, 225, 208, 153, 145, 142, 138, 135, 134, 127,
+ 128, 141, 134, 148, 138, 157, 144, 169, 151, 174, 166, 180, 181, 182,
+ 201, 187, 216, 191, 240, 202, 219, 206, 233, 209, 230, 157, 148, 145,
+ 141, 138, 136, 130, 131, 143, 136, 149, 140, 158, 145, 169, 151, 179,
+ 158, 195, 166, 202, 175, 221, 185, 228, 194, 253, 205, 225, 209, 240,
+ 212, 160, 149, 151, 140, 144, 136, 139, 127, 133, 152, 138, 158, 142,
+ 168, 147, 179, 153, 190, 160, 207, 168, 213, 177, 234, 187, 239, 196,
+ 266, 208, 230, 212, 247,
+ /* Size 4x8 */
+ 63, 94, 115, 137, 80, 91, 105, 127, 92, 110, 122, 134, 94, 120, 140,
+ 158, 104, 128, 159, 164, 118, 136, 174, 183, 128, 138, 181, 206, 139,
+ 138, 165, 202,
+ /* Size 8x4 */
+ 63, 80, 92, 94, 104, 118, 128, 139, 94, 91, 110, 120, 128, 136, 138,
+ 138, 115, 105, 122, 140, 159, 174, 181, 165, 137, 127, 134, 158, 164,
+ 183, 206, 202,
+ /* Size 8x16 */
+ 64, 71, 96, 101, 115, 127, 140, 150, 61, 76, 92, 93, 105, 116, 128, 139,
+ 67, 83, 94, 93, 103, 112, 122, 132, 78, 92, 97, 95, 103, 111, 118, 125,
+ 98, 96, 106, 108, 114, 121, 124, 139, 97, 93, 106, 113, 120, 128, 136,
+ 146, 100, 93, 108, 122, 133, 140, 149, 156, 104, 95, 109, 127, 142, 150,
+ 152, 167, 111, 99, 112, 131, 149, 159, 157, 173, 120, 106, 117, 136,
+ 158, 170, 175, 181, 127, 111, 121, 140, 164, 178, 192, 184, 132, 116,
+ 125, 144, 168, 183, 196, 191, 138, 121, 129, 142, 168, 196, 193, 194,
+ 144, 126, 136, 148, 160, 177, 202, 200, 150, 132, 138, 157, 182, 202,
+ 207, 203, 156, 138, 142, 159, 180, 203, 229, 229,
+ /* Size 16x8 */
+ 64, 61, 67, 78, 98, 97, 100, 104, 111, 120, 127, 132, 138, 144, 150,
+ 156, 71, 76, 83, 92, 96, 93, 93, 95, 99, 106, 111, 116, 121, 126, 132,
+ 138, 96, 92, 94, 97, 106, 106, 108, 109, 112, 117, 121, 125, 129, 136,
+ 138, 142, 101, 93, 93, 95, 108, 113, 122, 127, 131, 136, 140, 144, 142,
+ 148, 157, 159, 115, 105, 103, 103, 114, 120, 133, 142, 149, 158, 164,
+ 168, 168, 160, 182, 180, 127, 116, 112, 111, 121, 128, 140, 150, 159,
+ 170, 178, 183, 196, 177, 202, 203, 140, 128, 122, 118, 124, 136, 149,
+ 152, 157, 175, 192, 196, 193, 202, 207, 229, 150, 139, 132, 125, 139,
+ 146, 156, 167, 173, 181, 184, 191, 194, 200, 203, 229,
+ /* Size 16x32 */
+ 64, 62, 71, 77, 96, 98, 101, 105, 115, 122, 127, 135, 140, 145, 150,
+ 155, 63, 63, 74, 80, 94, 94, 97, 100, 109, 115, 120, 128, 132, 137, 142,
+ 145, 61, 64, 76, 81, 92, 91, 93, 97, 105, 111, 116, 123, 128, 133, 139,
+ 147, 62, 66, 77, 83, 92, 91, 93, 96, 104, 110, 114, 121, 126, 130, 135,
+ 136, 67, 72, 83, 88, 94, 92, 93, 95, 103, 108, 112, 119, 122, 127, 132,
+ 140, 74, 80, 91, 95, 95, 91, 92, 94, 100, 105, 109, 115, 121, 127, 131,
+ 132, 78, 82, 92, 95, 97, 94, 95, 97, 103, 108, 111, 116, 118, 120, 125,
+ 135, 84, 86, 93, 96, 100, 99, 100, 101, 107, 112, 115, 121, 126, 123,
+ 126, 124, 98, 93, 96, 98, 106, 107, 108, 109, 114, 118, 121, 127, 124,
+ 132, 139, 130, 97, 92, 94, 97, 106, 110, 111, 113, 117, 122, 125, 128,
+ 132, 134, 131, 149, 97, 92, 93, 96, 106, 112, 113, 115, 120, 124, 128,
+ 133, 136, 134, 146, 135, 98, 91, 91, 94, 107, 117, 119, 123, 128, 132,
+ 135, 141, 135, 146, 136, 155, 100, 93, 93, 96, 108, 119, 122, 127, 133,
+ 137, 140, 143, 149, 139, 156, 139, 102, 94, 94, 96, 108, 120, 123, 129,
+ 136, 140, 143, 146, 146, 158, 142, 165, 104, 96, 95, 97, 109, 122, 127,
+ 133, 142, 146, 150, 156, 152, 149, 167, 145, 109, 100, 98, 100, 111,
+ 125, 130, 137, 147, 152, 156, 159, 164, 161, 150, 177, 111, 102, 99,
+ 101, 112, 126, 131, 139, 149, 155, 159, 161, 157, 166, 173, 151, 114,
+ 104, 101, 103, 113, 128, 133, 141, 153, 159, 164, 172, 171, 164, 163,
+ 187, 120, 109, 106, 107, 117, 131, 136, 145, 158, 165, 170, 175, 175,
+ 182, 181, 158, 124, 113, 109, 110, 120, 133, 139, 148, 162, 169, 175,
+ 177, 175, 168, 176, 204, 127, 115, 111, 112, 121, 135, 140, 150, 164,
+ 172, 178, 187, 192, 197, 184, 166, 129, 118, 113, 114, 123, 136, 142,
+ 151, 166, 174, 180, 188, 187, 183, 194, 210, 132, 121, 116, 116, 125,
+ 138, 144, 153, 168, 177, 183, 188, 196, 196, 191, 175, 135, 123, 118,
+ 117, 127, 138, 142, 155, 170, 173, 186, 194, 196, 205, 207, 230, 138,
+ 126, 121, 119, 129, 138, 142, 162, 168, 172, 196, 192, 193, 200, 194,
+ 184, 141, 128, 124, 121, 134, 138, 143, 162, 158, 181, 193, 191, 205,
+ 206, 232, 235, 144, 131, 126, 123, 136, 133, 148, 161, 160, 187, 177,
+ 207, 202, 198, 200, 193, 147, 133, 129, 125, 137, 135, 157, 149, 168,
+ 185, 179, 212, 196, 216, 216, 261, 150, 136, 132, 127, 138, 136, 157,
+ 148, 182, 163, 202, 196, 207, 215, 203, 204, 153, 139, 135, 130, 140,
+ 138, 158, 150, 181, 165, 206, 183, 234, 202, 229, 226, 156, 141, 138,
+ 132, 142, 140, 159, 151, 180, 167, 203, 185, 229, 205, 229, 208, 159,
+ 142, 144, 130, 134, 157, 142, 178, 153, 204, 169, 231, 187, 258, 207,
+ 242,
+ /* Size 32x16 */
+ 64, 63, 61, 62, 67, 74, 78, 84, 98, 97, 97, 98, 100, 102, 104, 109, 111,
+ 114, 120, 124, 127, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156,
+ 159, 62, 63, 64, 66, 72, 80, 82, 86, 93, 92, 92, 91, 93, 94, 96, 100,
+ 102, 104, 109, 113, 115, 118, 121, 123, 126, 128, 131, 133, 136, 139,
+ 141, 142, 71, 74, 76, 77, 83, 91, 92, 93, 96, 94, 93, 91, 93, 94, 95,
+ 98, 99, 101, 106, 109, 111, 113, 116, 118, 121, 124, 126, 129, 132, 135,
+ 138, 144, 77, 80, 81, 83, 88, 95, 95, 96, 98, 97, 96, 94, 96, 96, 97,
+ 100, 101, 103, 107, 110, 112, 114, 116, 117, 119, 121, 123, 125, 127,
+ 130, 132, 130, 96, 94, 92, 92, 94, 95, 97, 100, 106, 106, 106, 107, 108,
+ 108, 109, 111, 112, 113, 117, 120, 121, 123, 125, 127, 129, 134, 136,
+ 137, 138, 140, 142, 134, 98, 94, 91, 91, 92, 91, 94, 99, 107, 110, 112,
+ 117, 119, 120, 122, 125, 126, 128, 131, 133, 135, 136, 138, 138, 138,
+ 138, 133, 135, 136, 138, 140, 157, 101, 97, 93, 93, 93, 92, 95, 100,
+ 108, 111, 113, 119, 122, 123, 127, 130, 131, 133, 136, 139, 140, 142,
+ 144, 142, 142, 143, 148, 157, 157, 158, 159, 142, 105, 100, 97, 96, 95,
+ 94, 97, 101, 109, 113, 115, 123, 127, 129, 133, 137, 139, 141, 145, 148,
+ 150, 151, 153, 155, 162, 162, 161, 149, 148, 150, 151, 178, 115, 109,
+ 105, 104, 103, 100, 103, 107, 114, 117, 120, 128, 133, 136, 142, 147,
+ 149, 153, 158, 162, 164, 166, 168, 170, 168, 158, 160, 168, 182, 181,
+ 180, 153, 122, 115, 111, 110, 108, 105, 108, 112, 118, 122, 124, 132,
+ 137, 140, 146, 152, 155, 159, 165, 169, 172, 174, 177, 173, 172, 181,
+ 187, 185, 163, 165, 167, 204, 127, 120, 116, 114, 112, 109, 111, 115,
+ 121, 125, 128, 135, 140, 143, 150, 156, 159, 164, 170, 175, 178, 180,
+ 183, 186, 196, 193, 177, 179, 202, 206, 203, 169, 135, 128, 123, 121,
+ 119, 115, 116, 121, 127, 128, 133, 141, 143, 146, 156, 159, 161, 172,
+ 175, 177, 187, 188, 188, 194, 192, 191, 207, 212, 196, 183, 185, 231,
+ 140, 132, 128, 126, 122, 121, 118, 126, 124, 132, 136, 135, 149, 146,
+ 152, 164, 157, 171, 175, 175, 192, 187, 196, 196, 193, 205, 202, 196,
+ 207, 234, 229, 187, 145, 137, 133, 130, 127, 127, 120, 123, 132, 134,
+ 134, 146, 139, 158, 149, 161, 166, 164, 182, 168, 197, 183, 196, 205,
+ 200, 206, 198, 216, 215, 202, 205, 258, 150, 142, 139, 135, 132, 131,
+ 125, 126, 139, 131, 146, 136, 156, 142, 167, 150, 173, 163, 181, 176,
+ 184, 194, 191, 207, 194, 232, 200, 216, 203, 229, 229, 207, 155, 145,
+ 147, 136, 140, 132, 135, 124, 130, 149, 135, 155, 139, 165, 145, 177,
+ 151, 187, 158, 204, 166, 210, 175, 230, 184, 235, 193, 261, 204, 226,
+ 208, 242,
+ /* Size 4x16 */
+ 62, 98, 122, 145, 64, 91, 111, 133, 72, 92, 108, 127, 82, 94, 108, 120,
+ 93, 107, 118, 132, 92, 112, 124, 134, 93, 119, 137, 139, 96, 122, 146,
+ 149, 102, 126, 155, 166, 109, 131, 165, 182, 115, 135, 172, 197, 121,
+ 138, 177, 196, 126, 138, 172, 200, 131, 133, 187, 198, 136, 136, 163,
+ 215, 141, 140, 167, 205,
+ /* Size 16x4 */
+ 62, 64, 72, 82, 93, 92, 93, 96, 102, 109, 115, 121, 126, 131, 136, 141,
+ 98, 91, 92, 94, 107, 112, 119, 122, 126, 131, 135, 138, 138, 133, 136,
+ 140, 122, 111, 108, 108, 118, 124, 137, 146, 155, 165, 172, 177, 172,
+ 187, 163, 167, 145, 133, 127, 120, 132, 134, 139, 149, 166, 182, 197,
+ 196, 200, 198, 215, 205,
+ /* Size 8x32 */
+ 64, 71, 96, 101, 115, 127, 140, 150, 63, 74, 94, 97, 109, 120, 132, 142,
+ 61, 76, 92, 93, 105, 116, 128, 139, 62, 77, 92, 93, 104, 114, 126, 135,
+ 67, 83, 94, 93, 103, 112, 122, 132, 74, 91, 95, 92, 100, 109, 121, 131,
+ 78, 92, 97, 95, 103, 111, 118, 125, 84, 93, 100, 100, 107, 115, 126,
+ 126, 98, 96, 106, 108, 114, 121, 124, 139, 97, 94, 106, 111, 117, 125,
+ 132, 131, 97, 93, 106, 113, 120, 128, 136, 146, 98, 91, 107, 119, 128,
+ 135, 135, 136, 100, 93, 108, 122, 133, 140, 149, 156, 102, 94, 108, 123,
+ 136, 143, 146, 142, 104, 95, 109, 127, 142, 150, 152, 167, 109, 98, 111,
+ 130, 147, 156, 164, 150, 111, 99, 112, 131, 149, 159, 157, 173, 114,
+ 101, 113, 133, 153, 164, 171, 163, 120, 106, 117, 136, 158, 170, 175,
+ 181, 124, 109, 120, 139, 162, 175, 175, 176, 127, 111, 121, 140, 164,
+ 178, 192, 184, 129, 113, 123, 142, 166, 180, 187, 194, 132, 116, 125,
+ 144, 168, 183, 196, 191, 135, 118, 127, 142, 170, 186, 196, 207, 138,
+ 121, 129, 142, 168, 196, 193, 194, 141, 124, 134, 143, 158, 193, 205,
+ 232, 144, 126, 136, 148, 160, 177, 202, 200, 147, 129, 137, 157, 168,
+ 179, 196, 216, 150, 132, 138, 157, 182, 202, 207, 203, 153, 135, 140,
+ 158, 181, 206, 234, 229, 156, 138, 142, 159, 180, 203, 229, 229, 159,
+ 144, 134, 142, 153, 169, 187, 207,
+ /* Size 32x8 */
+ 64, 63, 61, 62, 67, 74, 78, 84, 98, 97, 97, 98, 100, 102, 104, 109, 111,
+ 114, 120, 124, 127, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156,
+ 159, 71, 74, 76, 77, 83, 91, 92, 93, 96, 94, 93, 91, 93, 94, 95, 98, 99,
+ 101, 106, 109, 111, 113, 116, 118, 121, 124, 126, 129, 132, 135, 138,
+ 144, 96, 94, 92, 92, 94, 95, 97, 100, 106, 106, 106, 107, 108, 108, 109,
+ 111, 112, 113, 117, 120, 121, 123, 125, 127, 129, 134, 136, 137, 138,
+ 140, 142, 134, 101, 97, 93, 93, 93, 92, 95, 100, 108, 111, 113, 119,
+ 122, 123, 127, 130, 131, 133, 136, 139, 140, 142, 144, 142, 142, 143,
+ 148, 157, 157, 158, 159, 142, 115, 109, 105, 104, 103, 100, 103, 107,
+ 114, 117, 120, 128, 133, 136, 142, 147, 149, 153, 158, 162, 164, 166,
+ 168, 170, 168, 158, 160, 168, 182, 181, 180, 153, 127, 120, 116, 114,
+ 112, 109, 111, 115, 121, 125, 128, 135, 140, 143, 150, 156, 159, 164,
+ 170, 175, 178, 180, 183, 186, 196, 193, 177, 179, 202, 206, 203, 169,
+ 140, 132, 128, 126, 122, 121, 118, 126, 124, 132, 136, 135, 149, 146,
+ 152, 164, 157, 171, 175, 175, 192, 187, 196, 196, 193, 205, 202, 196,
+ 207, 234, 229, 187, 150, 142, 139, 135, 132, 131, 125, 126, 139, 131,
+ 146, 136, 156, 142, 167, 150, 173, 163, 181, 176, 184, 194, 191, 207,
+ 194, 232, 200, 216, 203, 229, 229, 207 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 79, 153, 153, 280,
+#endif
+ /* Size 4x4 */
+ 65, 77, 127, 176, 77, 113, 157, 200, 127, 157, 227, 248, 176, 200, 248,
+ 341,
+ /* Size 8x8 */
+ 64, 65, 70, 92, 114, 152, 172, 198, 65, 68, 75, 91, 108, 141, 159, 183,
+ 70, 75, 97, 113, 128, 158, 176, 186, 92, 91, 113, 141, 161, 192, 199,
+ 204, 114, 108, 128, 161, 186, 222, 245, 242, 152, 141, 158, 192, 222,
+ 268, 272, 301, 172, 159, 176, 199, 245, 272, 314, 375, 198, 183, 186,
+ 204, 242, 301, 375, 370,
+ /* Size 16x16 */
+ 64, 63, 63, 64, 69, 79, 88, 99, 116, 131, 143, 163, 176, 188, 202, 216,
+ 63, 64, 65, 65, 68, 76, 83, 93, 108, 121, 132, 151, 162, 174, 187, 201,
+ 63, 65, 67, 68, 72, 78, 84, 93, 106, 118, 129, 146, 156, 167, 179, 192,
+ 64, 65, 68, 71, 75, 81, 85, 93, 105, 116, 126, 142, 151, 161, 171, 184,
+ 69, 68, 72, 75, 85, 94, 100, 107, 119, 130, 140, 155, 164, 170, 188,
+ 197, 79, 76, 78, 81, 94, 108, 116, 124, 136, 147, 156, 171, 180, 179,
+ 197, 209, 88, 83, 84, 85, 100, 116, 127, 136, 149, 159, 169, 183, 192,
+ 199, 203, 224, 99, 93, 93, 93, 107, 124, 136, 146, 162, 174, 184, 199,
+ 206, 220, 210, 242, 116, 108, 106, 105, 119, 136, 149, 162, 180, 194,
+ 205, 221, 230, 242, 223, 260, 131, 121, 118, 116, 130, 147, 159, 174,
+ 194, 210, 222, 240, 251, 246, 238, 287, 143, 132, 129, 126, 140, 156,
+ 169, 184, 205, 222, 235, 254, 265, 260, 264, 303, 163, 151, 146, 142,
+ 155, 171, 183, 199, 221, 240, 254, 275, 287, 288, 296, 337, 176, 162,
+ 156, 151, 164, 180, 192, 206, 230, 251, 265, 287, 301, 308, 342, 356,
+ 188, 174, 167, 161, 170, 179, 199, 220, 242, 246, 260, 288, 308, 327,
+ 332, 402, 202, 187, 179, 171, 188, 197, 203, 210, 223, 238, 264, 296,
+ 342, 332, 355, 357, 216, 201, 192, 184, 197, 209, 224, 242, 260, 287,
+ 303, 337, 356, 402, 357, 386,
+ /* Size 32x32 */
+ 64, 63, 63, 63, 63, 64, 64, 68, 69, 72, 79, 82, 88, 96, 99, 108, 116,
+ 119, 131, 139, 143, 160, 163, 166, 176, 182, 188, 195, 202, 209, 216,
+ 223, 63, 64, 64, 64, 64, 65, 65, 68, 69, 70, 77, 79, 85, 92, 95, 103,
+ 111, 114, 125, 132, 136, 152, 155, 157, 167, 172, 178, 185, 191, 198,
+ 204, 210, 63, 64, 64, 64, 65, 65, 65, 67, 68, 69, 76, 78, 83, 90, 93,
+ 100, 108, 111, 121, 129, 132, 147, 151, 153, 162, 168, 174, 181, 187,
+ 194, 201, 211, 63, 64, 64, 65, 65, 65, 65, 67, 68, 69, 75, 77, 82, 88,
+ 91, 99, 106, 109, 119, 127, 130, 145, 148, 150, 159, 164, 170, 176, 182,
+ 188, 195, 197, 63, 64, 65, 65, 67, 67, 68, 71, 72, 73, 78, 80, 84, 90,
+ 93, 100, 106, 109, 118, 126, 129, 143, 146, 148, 156, 161, 167, 173,
+ 179, 185, 192, 201, 64, 65, 65, 65, 67, 68, 69, 72, 73, 75, 80, 81, 85,
+ 91, 93, 99, 106, 108, 117, 124, 127, 141, 144, 146, 154, 159, 166, 172,
+ 177, 183, 189, 193, 64, 65, 65, 65, 68, 69, 71, 74, 75, 77, 81, 82, 85,
+ 91, 93, 99, 105, 108, 116, 123, 126, 139, 142, 144, 151, 156, 161, 165,
+ 171, 177, 184, 196, 68, 68, 67, 67, 71, 72, 74, 79, 82, 85, 90, 92, 95,
+ 101, 103, 109, 115, 118, 126, 133, 136, 148, 151, 153, 161, 165, 168,
+ 167, 171, 177, 182, 183, 69, 69, 68, 68, 72, 73, 75, 82, 85, 90, 94, 96,
+ 100, 106, 107, 113, 119, 122, 130, 137, 140, 152, 155, 157, 164, 165,
+ 170, 178, 188, 193, 197, 188, 72, 70, 69, 69, 73, 75, 77, 85, 90, 97,
+ 101, 103, 108, 113, 115, 120, 126, 128, 136, 143, 146, 158, 160, 162,
+ 170, 176, 182, 185, 180, 186, 191, 215, 79, 77, 76, 75, 78, 80, 81, 90,
+ 94, 101, 108, 110, 116, 122, 124, 130, 136, 139, 147, 153, 156, 168,
+ 171, 173, 180, 182, 179, 184, 197, 205, 209, 197, 82, 79, 78, 77, 80,
+ 81, 82, 92, 96, 103, 110, 113, 119, 125, 127, 134, 140, 142, 150, 157,
+ 160, 172, 175, 176, 183, 185, 195, 200, 197, 194, 199, 225, 88, 85, 83,
+ 82, 84, 85, 85, 95, 100, 108, 116, 119, 127, 133, 136, 143, 149, 151,
+ 159, 166, 169, 181, 183, 185, 192, 200, 199, 194, 203, 221, 224, 204,
+ 96, 92, 90, 88, 90, 91, 91, 101, 106, 113, 122, 125, 133, 141, 143, 152,
+ 158, 161, 170, 176, 180, 192, 194, 196, 203, 199, 201, 219, 220, 204,
+ 209, 243, 99, 95, 93, 91, 93, 93, 93, 103, 107, 115, 124, 127, 136, 143,
+ 146, 155, 162, 164, 174, 180, 184, 196, 199, 201, 206, 211, 220, 209,
+ 210, 240, 242, 214, 108, 103, 100, 99, 100, 99, 99, 109, 113, 120, 130,
+ 134, 143, 152, 155, 165, 172, 175, 185, 192, 195, 208, 211, 213, 220,
+ 225, 214, 228, 239, 217, 220, 262, 116, 111, 108, 106, 106, 106, 105,
+ 115, 119, 126, 136, 140, 149, 158, 162, 172, 180, 183, 194, 201, 205,
+ 218, 221, 223, 230, 224, 242, 238, 223, 251, 260, 225, 119, 114, 111,
+ 109, 109, 108, 108, 118, 122, 128, 139, 142, 151, 161, 164, 175, 183,
+ 186, 198, 205, 209, 222, 225, 227, 234, 245, 239, 234, 265, 242, 233,
+ 282, 131, 125, 121, 119, 118, 117, 116, 126, 130, 136, 147, 150, 159,
+ 170, 174, 185, 194, 198, 210, 218, 222, 237, 240, 242, 251, 248, 246,
+ 264, 238, 264, 287, 238, 139, 132, 129, 127, 126, 124, 123, 133, 137,
+ 143, 153, 157, 166, 176, 180, 192, 201, 205, 218, 227, 231, 246, 250,
+ 252, 259, 256, 272, 248, 282, 267, 248, 312, 143, 136, 132, 130, 129,
+ 127, 126, 136, 140, 146, 156, 160, 169, 180, 184, 195, 205, 209, 222,
+ 231, 235, 251, 254, 256, 265, 277, 260, 294, 264, 271, 303, 253, 160,
+ 152, 147, 145, 143, 141, 139, 148, 152, 158, 168, 172, 181, 192, 196,
+ 208, 218, 222, 237, 246, 251, 268, 272, 274, 285, 272, 294, 271, 294,
+ 301, 264, 327, 163, 155, 151, 148, 146, 144, 142, 151, 155, 160, 171,
+ 175, 183, 194, 199, 211, 221, 225, 240, 250, 254, 272, 275, 278, 287,
+ 297, 288, 298, 296, 283, 337, 269, 166, 157, 153, 150, 148, 146, 144,
+ 153, 157, 162, 173, 176, 185, 196, 201, 213, 223, 227, 242, 252, 256,
+ 274, 278, 280, 290, 297, 305, 311, 298, 330, 282, 364, 176, 167, 162,
+ 159, 156, 154, 151, 161, 164, 170, 180, 183, 192, 203, 206, 220, 230,
+ 234, 251, 259, 265, 285, 287, 290, 301, 296, 308, 308, 342, 293, 356,
+ 287, 182, 172, 168, 164, 161, 159, 156, 165, 165, 176, 182, 185, 200,
+ 199, 211, 225, 224, 245, 248, 256, 277, 272, 297, 297, 296, 314, 303,
+ 320, 308, 375, 299, 380, 188, 178, 174, 170, 167, 166, 161, 168, 170,
+ 182, 179, 195, 199, 201, 220, 214, 242, 239, 246, 272, 260, 294, 288,
+ 305, 308, 303, 327, 309, 332, 314, 402, 305, 195, 185, 181, 176, 173,
+ 172, 165, 167, 178, 185, 184, 200, 194, 219, 209, 228, 238, 234, 264,
+ 248, 294, 271, 298, 311, 308, 320, 309, 341, 315, 344, 321, 433, 202,
+ 191, 187, 182, 179, 177, 171, 171, 188, 180, 197, 197, 203, 220, 210,
+ 239, 223, 265, 238, 282, 264, 294, 296, 298, 342, 308, 332, 315, 355,
+ 322, 357, 328, 209, 198, 194, 188, 185, 183, 177, 177, 193, 186, 205,
+ 194, 221, 204, 240, 217, 251, 242, 264, 267, 271, 301, 283, 330, 293,
+ 375, 314, 344, 322, 370, 329, 370, 216, 204, 201, 195, 192, 189, 184,
+ 182, 197, 191, 209, 199, 224, 209, 242, 220, 260, 233, 287, 248, 303,
+ 264, 337, 282, 356, 299, 402, 321, 357, 329, 386, 336, 223, 210, 211,
+ 197, 201, 193, 196, 183, 188, 215, 197, 225, 204, 243, 214, 262, 225,
+ 282, 238, 312, 253, 327, 269, 364, 287, 380, 305, 433, 328, 370, 336,
+ 402,
+ /* Size 4x8 */
+ 64, 77, 124, 180, 65, 80, 117, 168, 69, 102, 136, 179, 89, 122, 170,
+ 216, 109, 139, 197, 235, 145, 168, 236, 271, 165, 182, 260, 315, 189,
+ 194, 243, 313,
+ /* Size 8x4 */
+ 64, 65, 69, 89, 109, 145, 165, 189, 77, 80, 102, 122, 139, 168, 182,
+ 194, 124, 117, 136, 170, 197, 236, 260, 243, 180, 168, 179, 216, 235,
+ 271, 315, 313,
+ /* Size 8x16 */
+ 64, 64, 72, 88, 116, 158, 179, 201, 63, 65, 70, 83, 108, 146, 165, 187,
+ 64, 67, 73, 84, 106, 142, 158, 179, 64, 69, 77, 85, 105, 138, 154, 171,
+ 69, 72, 89, 100, 119, 151, 163, 187, 79, 79, 101, 116, 136, 168, 179,
+ 200, 88, 85, 107, 126, 149, 180, 199, 216, 98, 93, 114, 135, 162, 195,
+ 209, 235, 115, 106, 126, 149, 180, 217, 222, 247, 130, 118, 136, 159,
+ 194, 236, 249, 263, 142, 129, 146, 169, 205, 250, 276, 271, 162, 145,
+ 161, 183, 221, 271, 292, 287, 175, 155, 170, 192, 230, 281, 294, 296,
+ 187, 167, 179, 204, 229, 260, 307, 310, 200, 179, 187, 218, 261, 300,
+ 320, 316, 215, 192, 197, 224, 261, 305, 357, 363,
+ /* Size 16x8 */
+ 64, 63, 64, 64, 69, 79, 88, 98, 115, 130, 142, 162, 175, 187, 200, 215,
+ 64, 65, 67, 69, 72, 79, 85, 93, 106, 118, 129, 145, 155, 167, 179, 192,
+ 72, 70, 73, 77, 89, 101, 107, 114, 126, 136, 146, 161, 170, 179, 187,
+ 197, 88, 83, 84, 85, 100, 116, 126, 135, 149, 159, 169, 183, 192, 204,
+ 218, 224, 116, 108, 106, 105, 119, 136, 149, 162, 180, 194, 205, 221,
+ 230, 229, 261, 261, 158, 146, 142, 138, 151, 168, 180, 195, 217, 236,
+ 250, 271, 281, 260, 300, 305, 179, 165, 158, 154, 163, 179, 199, 209,
+ 222, 249, 276, 292, 294, 307, 320, 357, 201, 187, 179, 171, 187, 200,
+ 216, 235, 247, 263, 271, 287, 296, 310, 316, 363,
+ /* Size 16x32 */
+ 64, 63, 64, 64, 72, 79, 88, 107, 116, 131, 158, 163, 179, 190, 201, 214,
+ 63, 64, 65, 65, 71, 77, 85, 103, 111, 124, 151, 155, 169, 180, 191, 201,
+ 63, 64, 65, 65, 70, 76, 83, 100, 108, 121, 146, 150, 165, 176, 187, 202,
+ 63, 65, 65, 66, 69, 75, 82, 99, 106, 119, 144, 148, 162, 171, 182, 189,
+ 64, 65, 67, 68, 73, 78, 84, 100, 106, 118, 142, 145, 158, 168, 179, 193,
+ 64, 65, 68, 69, 75, 80, 85, 99, 106, 117, 140, 143, 157, 168, 177, 185,
+ 64, 66, 69, 71, 77, 81, 85, 99, 105, 116, 138, 141, 154, 161, 171, 188,
+ 68, 68, 71, 74, 85, 90, 96, 109, 115, 126, 147, 151, 163, 164, 171, 176,
+ 69, 68, 72, 75, 89, 94, 100, 113, 119, 130, 151, 154, 163, 175, 187,
+ 181, 72, 69, 74, 77, 96, 102, 108, 120, 126, 136, 157, 160, 173, 179,
+ 180, 208, 79, 75, 79, 81, 101, 108, 116, 130, 136, 147, 168, 171, 179,
+ 181, 200, 190, 81, 77, 81, 83, 103, 110, 119, 134, 140, 150, 171, 174,
+ 183, 197, 189, 219, 88, 82, 85, 86, 107, 116, 126, 143, 149, 159, 180,
+ 183, 199, 191, 216, 198, 95, 89, 91, 92, 112, 122, 133, 151, 158, 170,
+ 191, 194, 199, 216, 199, 236, 98, 92, 93, 94, 114, 124, 135, 155, 162,
+ 173, 195, 198, 209, 207, 235, 208, 107, 99, 100, 100, 120, 130, 142,
+ 164, 172, 185, 207, 210, 224, 225, 213, 256, 115, 106, 106, 106, 126,
+ 136, 149, 172, 180, 194, 217, 221, 222, 233, 247, 219, 118, 109, 109,
+ 109, 128, 139, 151, 175, 183, 197, 222, 225, 240, 235, 235, 275, 130,
+ 120, 118, 117, 136, 147, 159, 185, 194, 210, 236, 239, 249, 260, 263,
+ 232, 138, 127, 125, 124, 143, 153, 166, 192, 201, 218, 245, 249, 254,
+ 245, 258, 304, 142, 131, 129, 127, 146, 156, 169, 195, 205, 222, 250,
+ 254, 276, 287, 271, 247, 159, 145, 142, 140, 158, 168, 181, 208, 218,
+ 236, 267, 271, 275, 271, 288, 318, 162, 148, 145, 143, 161, 171, 183,
+ 210, 221, 240, 271, 275, 292, 292, 287, 263, 165, 151, 147, 145, 162,
+ 173, 185, 212, 223, 242, 273, 278, 295, 309, 315, 355, 175, 159, 155,
+ 153, 170, 180, 192, 220, 230, 250, 281, 286, 294, 305, 296, 281, 181,
+ 165, 161, 158, 176, 182, 197, 221, 224, 260, 277, 288, 309, 315, 361,
+ 371, 187, 171, 167, 162, 179, 179, 204, 221, 229, 267, 260, 311, 307,
+ 304, 310, 298, 194, 176, 173, 168, 183, 184, 216, 209, 241, 265, 265,
+ 317, 300, 335, 338, 421, 200, 182, 179, 173, 187, 189, 218, 210, 261,
+ 238, 300, 293, 320, 334, 316, 320, 207, 189, 186, 178, 192, 194, 221,
+ 215, 260, 243, 307, 276, 363, 313, 362, 361, 215, 195, 192, 184, 197,
+ 199, 224, 220, 261, 248, 305, 281, 357, 319, 363, 328, 222, 199, 202,
+ 186, 190, 224, 205, 260, 225, 307, 253, 359, 287, 418, 326, 392,
+ /* Size 32x16 */
+ 64, 63, 63, 63, 64, 64, 64, 68, 69, 72, 79, 81, 88, 95, 98, 107, 115,
+ 118, 130, 138, 142, 159, 162, 165, 175, 181, 187, 194, 200, 207, 215,
+ 222, 63, 64, 64, 65, 65, 65, 66, 68, 68, 69, 75, 77, 82, 89, 92, 99,
+ 106, 109, 120, 127, 131, 145, 148, 151, 159, 165, 171, 176, 182, 189,
+ 195, 199, 64, 65, 65, 65, 67, 68, 69, 71, 72, 74, 79, 81, 85, 91, 93,
+ 100, 106, 109, 118, 125, 129, 142, 145, 147, 155, 161, 167, 173, 179,
+ 186, 192, 202, 64, 65, 65, 66, 68, 69, 71, 74, 75, 77, 81, 83, 86, 92,
+ 94, 100, 106, 109, 117, 124, 127, 140, 143, 145, 153, 158, 162, 168,
+ 173, 178, 184, 186, 72, 71, 70, 69, 73, 75, 77, 85, 89, 96, 101, 103,
+ 107, 112, 114, 120, 126, 128, 136, 143, 146, 158, 161, 162, 170, 176,
+ 179, 183, 187, 192, 197, 190, 79, 77, 76, 75, 78, 80, 81, 90, 94, 102,
+ 108, 110, 116, 122, 124, 130, 136, 139, 147, 153, 156, 168, 171, 173,
+ 180, 182, 179, 184, 189, 194, 199, 224, 88, 85, 83, 82, 84, 85, 85, 96,
+ 100, 108, 116, 119, 126, 133, 135, 142, 149, 151, 159, 166, 169, 181,
+ 183, 185, 192, 197, 204, 216, 218, 221, 224, 205, 107, 103, 100, 99,
+ 100, 99, 99, 109, 113, 120, 130, 134, 143, 151, 155, 164, 172, 175, 185,
+ 192, 195, 208, 210, 212, 220, 221, 221, 209, 210, 215, 220, 260, 116,
+ 111, 108, 106, 106, 106, 105, 115, 119, 126, 136, 140, 149, 158, 162,
+ 172, 180, 183, 194, 201, 205, 218, 221, 223, 230, 224, 229, 241, 261,
+ 260, 261, 225, 131, 124, 121, 119, 118, 117, 116, 126, 130, 136, 147,
+ 150, 159, 170, 173, 185, 194, 197, 210, 218, 222, 236, 240, 242, 250,
+ 260, 267, 265, 238, 243, 248, 307, 158, 151, 146, 144, 142, 140, 138,
+ 147, 151, 157, 168, 171, 180, 191, 195, 207, 217, 222, 236, 245, 250,
+ 267, 271, 273, 281, 277, 260, 265, 300, 307, 305, 253, 163, 155, 150,
+ 148, 145, 143, 141, 151, 154, 160, 171, 174, 183, 194, 198, 210, 221,
+ 225, 239, 249, 254, 271, 275, 278, 286, 288, 311, 317, 293, 276, 281,
+ 359, 179, 169, 165, 162, 158, 157, 154, 163, 163, 173, 179, 183, 199,
+ 199, 209, 224, 222, 240, 249, 254, 276, 275, 292, 295, 294, 309, 307,
+ 300, 320, 363, 357, 287, 190, 180, 176, 171, 168, 168, 161, 164, 175,
+ 179, 181, 197, 191, 216, 207, 225, 233, 235, 260, 245, 287, 271, 292,
+ 309, 305, 315, 304, 335, 334, 313, 319, 418, 201, 191, 187, 182, 179,
+ 177, 171, 171, 187, 180, 200, 189, 216, 199, 235, 213, 247, 235, 263,
+ 258, 271, 288, 287, 315, 296, 361, 310, 338, 316, 362, 363, 326, 214,
+ 201, 202, 189, 193, 185, 188, 176, 181, 208, 190, 219, 198, 236, 208,
+ 256, 219, 275, 232, 304, 247, 318, 263, 355, 281, 371, 298, 421, 320,
+ 361, 328, 392,
+ /* Size 4x16 */
+ 63, 79, 131, 190, 64, 76, 121, 176, 65, 78, 118, 168, 66, 81, 116, 161,
+ 68, 94, 130, 175, 75, 108, 147, 181, 82, 116, 159, 191, 92, 124, 173,
+ 207, 106, 136, 194, 233, 120, 147, 210, 260, 131, 156, 222, 287, 148,
+ 171, 240, 292, 159, 180, 250, 305, 171, 179, 267, 304, 182, 189, 238,
+ 334, 195, 199, 248, 319,
+ /* Size 16x4 */
+ 63, 64, 65, 66, 68, 75, 82, 92, 106, 120, 131, 148, 159, 171, 182, 195,
+ 79, 76, 78, 81, 94, 108, 116, 124, 136, 147, 156, 171, 180, 179, 189,
+ 199, 131, 121, 118, 116, 130, 147, 159, 173, 194, 210, 222, 240, 250,
+ 267, 238, 248, 190, 176, 168, 161, 175, 181, 191, 207, 233, 260, 287,
+ 292, 305, 304, 334, 319,
+ /* Size 8x32 */
+ 64, 64, 72, 88, 116, 158, 179, 201, 63, 65, 71, 85, 111, 151, 169, 191,
+ 63, 65, 70, 83, 108, 146, 165, 187, 63, 65, 69, 82, 106, 144, 162, 182,
+ 64, 67, 73, 84, 106, 142, 158, 179, 64, 68, 75, 85, 106, 140, 157, 177,
+ 64, 69, 77, 85, 105, 138, 154, 171, 68, 71, 85, 96, 115, 147, 163, 171,
+ 69, 72, 89, 100, 119, 151, 163, 187, 72, 74, 96, 108, 126, 157, 173,
+ 180, 79, 79, 101, 116, 136, 168, 179, 200, 81, 81, 103, 119, 140, 171,
+ 183, 189, 88, 85, 107, 126, 149, 180, 199, 216, 95, 91, 112, 133, 158,
+ 191, 199, 199, 98, 93, 114, 135, 162, 195, 209, 235, 107, 100, 120, 142,
+ 172, 207, 224, 213, 115, 106, 126, 149, 180, 217, 222, 247, 118, 109,
+ 128, 151, 183, 222, 240, 235, 130, 118, 136, 159, 194, 236, 249, 263,
+ 138, 125, 143, 166, 201, 245, 254, 258, 142, 129, 146, 169, 205, 250,
+ 276, 271, 159, 142, 158, 181, 218, 267, 275, 288, 162, 145, 161, 183,
+ 221, 271, 292, 287, 165, 147, 162, 185, 223, 273, 295, 315, 175, 155,
+ 170, 192, 230, 281, 294, 296, 181, 161, 176, 197, 224, 277, 309, 361,
+ 187, 167, 179, 204, 229, 260, 307, 310, 194, 173, 183, 216, 241, 265,
+ 300, 338, 200, 179, 187, 218, 261, 300, 320, 316, 207, 186, 192, 221,
+ 260, 307, 363, 362, 215, 192, 197, 224, 261, 305, 357, 363, 222, 202,
+ 190, 205, 225, 253, 287, 326,
+ /* Size 32x8 */
+ 64, 63, 63, 63, 64, 64, 64, 68, 69, 72, 79, 81, 88, 95, 98, 107, 115,
+ 118, 130, 138, 142, 159, 162, 165, 175, 181, 187, 194, 200, 207, 215,
+ 222, 64, 65, 65, 65, 67, 68, 69, 71, 72, 74, 79, 81, 85, 91, 93, 100,
+ 106, 109, 118, 125, 129, 142, 145, 147, 155, 161, 167, 173, 179, 186,
+ 192, 202, 72, 71, 70, 69, 73, 75, 77, 85, 89, 96, 101, 103, 107, 112,
+ 114, 120, 126, 128, 136, 143, 146, 158, 161, 162, 170, 176, 179, 183,
+ 187, 192, 197, 190, 88, 85, 83, 82, 84, 85, 85, 96, 100, 108, 116, 119,
+ 126, 133, 135, 142, 149, 151, 159, 166, 169, 181, 183, 185, 192, 197,
+ 204, 216, 218, 221, 224, 205, 116, 111, 108, 106, 106, 106, 105, 115,
+ 119, 126, 136, 140, 149, 158, 162, 172, 180, 183, 194, 201, 205, 218,
+ 221, 223, 230, 224, 229, 241, 261, 260, 261, 225, 158, 151, 146, 144,
+ 142, 140, 138, 147, 151, 157, 168, 171, 180, 191, 195, 207, 217, 222,
+ 236, 245, 250, 267, 271, 273, 281, 277, 260, 265, 300, 307, 305, 253,
+ 179, 169, 165, 162, 158, 157, 154, 163, 163, 173, 179, 183, 199, 199,
+ 209, 224, 222, 240, 249, 254, 276, 275, 292, 295, 294, 309, 307, 300,
+ 320, 363, 357, 287, 201, 191, 187, 182, 179, 177, 171, 171, 187, 180,
+ 200, 189, 216, 199, 235, 213, 247, 235, 263, 258, 271, 288, 287, 315,
+ 296, 361, 310, 338, 316, 362, 363, 326 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 97, 117, 117, 183,
+#endif
+ /* Size 4x4 */
+ 64, 91, 107, 128, 91, 110, 125, 140, 107, 125, 160, 166, 128, 140, 166,
+ 208,
+ /* Size 8x8 */
+ 63, 73, 95, 97, 104, 121, 129, 139, 73, 86, 95, 93, 98, 111, 119, 129,
+ 95, 95, 106, 108, 111, 121, 128, 129, 97, 93, 108, 122, 130, 141, 142,
+ 140, 104, 98, 111, 130, 143, 157, 166, 160, 121, 111, 121, 141, 157,
+ 178, 179, 189, 129, 119, 128, 142, 166, 179, 197, 221, 139, 129, 129,
+ 140, 160, 189, 221, 219,
+ /* Size 16x16 */
+ 64, 61, 67, 73, 89, 97, 98, 102, 108, 114, 120, 129, 134, 139, 144, 150,
+ 61, 63, 70, 79, 88, 92, 92, 95, 100, 106, 111, 119, 123, 129, 134, 140,
+ 67, 70, 78, 87, 92, 93, 91, 94, 98, 102, 107, 114, 118, 122, 127, 133,
+ 73, 79, 87, 95, 95, 93, 91, 93, 96, 100, 104, 110, 114, 118, 121, 126,
+ 89, 88, 92, 95, 100, 102, 102, 103, 106, 109, 113, 119, 122, 124, 132,
+ 135, 97, 92, 93, 93, 102, 109, 111, 113, 117, 120, 123, 129, 132, 129,
+ 137, 141, 98, 92, 91, 91, 102, 111, 117, 120, 124, 127, 131, 136, 139,
+ 140, 140, 149, 102, 95, 94, 93, 103, 113, 120, 125, 131, 135, 139, 144,
+ 146, 152, 145, 159, 108, 100, 98, 96, 106, 117, 124, 131, 140, 146, 150,
+ 156, 159, 163, 152, 168, 114, 106, 102, 100, 109, 120, 127, 135, 146,
+ 153, 158, 165, 169, 165, 160, 181, 120, 111, 107, 104, 113, 123, 131,
+ 139, 150, 158, 164, 172, 176, 173, 173, 189, 129, 119, 114, 110, 119,
+ 129, 136, 144, 156, 165, 172, 181, 186, 186, 188, 205, 134, 123, 118,
+ 114, 122, 132, 139, 146, 159, 169, 176, 186, 192, 194, 208, 212, 139,
+ 129, 122, 118, 124, 129, 140, 152, 163, 165, 173, 186, 194, 202, 204,
+ 231, 144, 134, 127, 121, 132, 137, 140, 145, 152, 160, 173, 188, 208,
+ 204, 213, 214, 150, 140, 133, 126, 135, 141, 149, 159, 168, 181, 189,
+ 205, 212, 231, 214, 225,
+ /* Size 32x32 */
+ 64, 62, 61, 61, 67, 70, 73, 83, 89, 98, 97, 97, 98, 101, 102, 104, 108,
+ 110, 114, 118, 120, 127, 129, 130, 134, 137, 139, 142, 144, 147, 150,
+ 153, 62, 63, 63, 62, 69, 73, 77, 85, 89, 95, 94, 94, 94, 97, 97, 100,
+ 103, 104, 109, 112, 114, 121, 122, 123, 127, 129, 132, 134, 137, 139,
+ 142, 143, 61, 63, 63, 63, 70, 74, 79, 85, 88, 94, 92, 92, 92, 94, 95,
+ 97, 100, 102, 106, 109, 111, 117, 119, 120, 123, 126, 129, 131, 134,
+ 137, 140, 144, 61, 62, 63, 64, 71, 75, 80, 85, 88, 93, 91, 91, 90, 93,
+ 93, 95, 99, 100, 104, 107, 109, 115, 116, 117, 121, 123, 126, 128, 130,
+ 133, 135, 135, 67, 69, 70, 71, 78, 82, 87, 90, 92, 95, 93, 92, 91, 93,
+ 94, 95, 98, 99, 102, 106, 107, 113, 114, 115, 118, 120, 122, 125, 127,
+ 130, 133, 138, 70, 73, 74, 75, 82, 86, 91, 92, 93, 95, 93, 92, 91, 93,
+ 93, 94, 97, 98, 101, 104, 106, 111, 112, 113, 116, 119, 122, 124, 127,
+ 129, 131, 131, 73, 77, 79, 80, 87, 91, 95, 95, 95, 96, 93, 92, 91, 92,
+ 93, 94, 96, 97, 100, 103, 104, 109, 110, 111, 114, 116, 118, 119, 121,
+ 124, 126, 133, 83, 85, 85, 85, 90, 92, 95, 97, 99, 101, 99, 99, 98, 100,
+ 100, 101, 103, 104, 107, 109, 111, 115, 116, 117, 120, 121, 122, 121,
+ 122, 124, 126, 124, 89, 89, 88, 88, 92, 93, 95, 99, 100, 103, 102, 102,
+ 102, 103, 103, 104, 106, 107, 109, 112, 113, 118, 119, 119, 122, 122,
+ 124, 127, 132, 133, 135, 128, 98, 95, 94, 93, 95, 95, 96, 101, 103, 106,
+ 106, 107, 107, 108, 108, 109, 111, 111, 113, 116, 117, 121, 122, 123,
+ 126, 128, 131, 131, 127, 129, 131, 143, 97, 94, 92, 91, 93, 93, 93, 99,
+ 102, 106, 109, 109, 111, 113, 113, 115, 117, 118, 120, 122, 123, 127,
+ 129, 129, 132, 132, 129, 131, 137, 140, 141, 133, 97, 94, 92, 91, 92,
+ 92, 92, 99, 102, 107, 109, 110, 113, 115, 115, 117, 119, 120, 122, 125,
+ 126, 130, 131, 131, 133, 133, 138, 140, 137, 134, 136, 149, 98, 94, 92,
+ 90, 91, 91, 91, 98, 102, 107, 111, 113, 117, 119, 120, 123, 124, 125,
+ 127, 130, 131, 135, 136, 136, 139, 142, 140, 137, 140, 149, 149, 138,
+ 101, 97, 94, 93, 93, 93, 92, 100, 103, 108, 113, 115, 119, 122, 124,
+ 127, 129, 130, 133, 136, 137, 141, 142, 143, 145, 142, 142, 150, 149,
+ 140, 141, 158, 102, 97, 95, 93, 94, 93, 93, 100, 103, 108, 113, 115,
+ 120, 124, 125, 129, 131, 132, 135, 138, 139, 143, 144, 145, 146, 148,
+ 152, 145, 145, 159, 159, 143, 104, 100, 97, 95, 95, 94, 94, 101, 104,
+ 109, 115, 117, 123, 127, 129, 133, 136, 137, 141, 144, 145, 150, 151,
+ 151, 154, 156, 149, 155, 160, 147, 148, 168, 108, 103, 100, 99, 98, 97,
+ 96, 103, 106, 111, 117, 119, 124, 129, 131, 136, 140, 141, 146, 149,
+ 150, 155, 156, 157, 159, 155, 163, 160, 152, 165, 168, 149, 110, 104,
+ 102, 100, 99, 98, 97, 104, 107, 111, 118, 120, 125, 130, 132, 137, 141,
+ 143, 147, 150, 152, 157, 158, 159, 161, 166, 162, 159, 173, 160, 155,
+ 178, 114, 109, 106, 104, 102, 101, 100, 107, 109, 113, 120, 122, 127,
+ 133, 135, 141, 146, 147, 153, 156, 158, 164, 165, 166, 169, 167, 165,
+ 173, 160, 172, 181, 156, 118, 112, 109, 107, 106, 104, 103, 109, 112,
+ 116, 122, 125, 130, 136, 138, 144, 149, 150, 156, 160, 162, 168, 170,
+ 170, 173, 171, 178, 166, 181, 173, 163, 192, 120, 114, 111, 109, 107,
+ 106, 104, 111, 113, 117, 123, 126, 131, 137, 139, 145, 150, 152, 158,
+ 162, 164, 170, 172, 172, 176, 181, 173, 188, 173, 175, 189, 164, 127,
+ 121, 117, 115, 113, 111, 109, 115, 118, 121, 127, 130, 135, 141, 143,
+ 150, 155, 157, 164, 168, 170, 178, 179, 180, 185, 179, 188, 177, 187,
+ 189, 171, 199, 129, 122, 119, 116, 114, 112, 110, 116, 119, 122, 129,
+ 131, 136, 142, 144, 151, 156, 158, 165, 170, 172, 179, 181, 182, 186,
+ 190, 186, 189, 188, 182, 205, 173, 130, 123, 120, 117, 115, 113, 111,
+ 117, 119, 123, 129, 131, 136, 143, 145, 151, 157, 159, 166, 170, 172,
+ 180, 182, 183, 187, 190, 193, 195, 189, 202, 180, 216, 134, 127, 123,
+ 121, 118, 116, 114, 120, 122, 126, 132, 133, 139, 145, 146, 154, 159,
+ 161, 169, 173, 176, 185, 186, 187, 192, 190, 194, 194, 208, 187, 212,
+ 182, 137, 129, 126, 123, 120, 119, 116, 121, 122, 128, 132, 133, 142,
+ 142, 148, 156, 155, 166, 167, 171, 181, 179, 190, 190, 190, 197, 192,
+ 199, 194, 221, 189, 222, 139, 132, 129, 126, 122, 122, 118, 122, 124,
+ 131, 129, 138, 140, 142, 152, 149, 163, 162, 165, 178, 173, 188, 186,
+ 193, 194, 192, 202, 195, 204, 196, 231, 191, 142, 134, 131, 128, 125,
+ 124, 119, 121, 127, 131, 131, 140, 137, 150, 145, 155, 160, 159, 173,
+ 166, 188, 177, 189, 195, 194, 199, 195, 208, 197, 209, 199, 243, 144,
+ 137, 134, 130, 127, 127, 121, 122, 132, 127, 137, 137, 140, 149, 145,
+ 160, 152, 173, 160, 181, 173, 187, 188, 189, 208, 194, 204, 197, 213,
+ 200, 214, 202, 147, 139, 137, 133, 130, 129, 124, 124, 133, 129, 140,
+ 134, 149, 140, 159, 147, 165, 160, 172, 173, 175, 189, 182, 202, 187,
+ 221, 196, 209, 200, 219, 203, 219, 150, 142, 140, 135, 133, 131, 126,
+ 126, 135, 131, 141, 136, 149, 141, 159, 148, 168, 155, 181, 163, 189,
+ 171, 205, 180, 212, 189, 231, 199, 214, 203, 225, 205, 153, 143, 144,
+ 135, 138, 131, 133, 124, 128, 143, 133, 149, 138, 158, 143, 168, 149,
+ 178, 156, 192, 164, 199, 173, 216, 182, 222, 191, 243, 202, 219, 205,
+ 231,
+ /* Size 4x8 */
+ 63, 94, 109, 133, 76, 93, 101, 123, 93, 107, 114, 129, 93, 113, 133,
+ 150, 100, 118, 148, 160, 115, 128, 164, 178, 124, 132, 173, 198, 133,
+ 134, 162, 196,
+ /* Size 8x4 */
+ 63, 76, 93, 93, 100, 115, 124, 133, 94, 93, 107, 113, 118, 128, 132,
+ 134, 109, 101, 114, 133, 148, 164, 173, 162, 133, 123, 129, 150, 160,
+ 178, 198, 196,
+ /* Size 8x16 */
+ 64, 68, 96, 98, 109, 127, 135, 145, 62, 72, 93, 92, 101, 117, 125, 134,
+ 67, 80, 94, 92, 98, 112, 119, 128, 74, 88, 95, 91, 96, 109, 115, 122,
+ 89, 92, 102, 102, 106, 118, 121, 132, 97, 93, 106, 112, 117, 128, 131,
+ 139, 98, 91, 107, 117, 125, 135, 142, 148, 102, 94, 108, 120, 131, 143,
+ 148, 158, 108, 98, 111, 124, 140, 155, 155, 164, 114, 102, 113, 128,
+ 146, 164, 168, 172, 120, 107, 117, 131, 150, 170, 181, 176, 128, 114,
+ 122, 136, 156, 179, 188, 184, 133, 118, 126, 139, 159, 183, 189, 188,
+ 139, 123, 129, 143, 157, 173, 194, 195, 144, 128, 132, 149, 171, 190,
+ 199, 198, 149, 133, 134, 150, 169, 190, 213, 216,
+ /* Size 16x8 */
+ 64, 62, 67, 74, 89, 97, 98, 102, 108, 114, 120, 128, 133, 139, 144, 149,
+ 68, 72, 80, 88, 92, 93, 91, 94, 98, 102, 107, 114, 118, 123, 128, 133,
+ 96, 93, 94, 95, 102, 106, 107, 108, 111, 113, 117, 122, 126, 129, 132,
+ 134, 98, 92, 92, 91, 102, 112, 117, 120, 124, 128, 131, 136, 139, 143,
+ 149, 150, 109, 101, 98, 96, 106, 117, 125, 131, 140, 146, 150, 156, 159,
+ 157, 171, 169, 127, 117, 112, 109, 118, 128, 135, 143, 155, 164, 170,
+ 179, 183, 173, 190, 190, 135, 125, 119, 115, 121, 131, 142, 148, 155,
+ 168, 181, 188, 189, 194, 199, 213, 145, 134, 128, 122, 132, 139, 148,
+ 158, 164, 172, 176, 184, 188, 195, 198, 216,
+ /* Size 16x32 */
+ 64, 62, 68, 74, 96, 97, 98, 105, 109, 115, 127, 129, 135, 140, 145, 149,
+ 63, 63, 71, 77, 94, 94, 94, 100, 103, 109, 120, 122, 128, 133, 137, 140,
+ 62, 64, 72, 79, 93, 92, 92, 97, 101, 106, 117, 119, 125, 130, 134, 141,
+ 61, 64, 73, 80, 92, 91, 91, 96, 99, 104, 115, 116, 122, 126, 130, 132,
+ 67, 72, 80, 86, 94, 93, 92, 95, 98, 103, 112, 114, 119, 124, 128, 135,
+ 71, 76, 84, 90, 95, 93, 91, 95, 97, 101, 111, 112, 118, 123, 127, 129,
+ 74, 80, 88, 94, 95, 93, 91, 94, 96, 100, 109, 110, 115, 117, 122, 131,
+ 84, 86, 91, 95, 100, 100, 99, 101, 103, 107, 115, 117, 121, 120, 122,
+ 121, 89, 89, 92, 95, 102, 102, 102, 104, 106, 109, 118, 119, 121, 127,
+ 132, 126, 98, 93, 95, 96, 106, 107, 107, 109, 111, 114, 121, 122, 128,
+ 129, 128, 141, 97, 92, 93, 94, 106, 109, 112, 115, 117, 120, 128, 129,
+ 131, 130, 139, 131, 97, 91, 92, 93, 106, 110, 113, 117, 119, 122, 130,
+ 131, 133, 139, 133, 147, 98, 91, 91, 92, 107, 112, 117, 123, 125, 128,
+ 135, 136, 142, 136, 148, 136, 101, 93, 93, 93, 108, 113, 119, 127, 130,
+ 133, 141, 142, 142, 150, 139, 156, 102, 94, 94, 94, 108, 114, 120, 129,
+ 131, 136, 143, 144, 148, 145, 158, 141, 104, 96, 95, 95, 109, 115, 122,
+ 133, 137, 142, 150, 151, 156, 154, 147, 167, 108, 99, 98, 97, 111, 117,
+ 124, 136, 140, 146, 155, 156, 155, 159, 164, 148, 109, 100, 99, 98, 111,
+ 118, 125, 137, 141, 148, 157, 158, 164, 160, 158, 176, 114, 104, 102,
+ 101, 113, 120, 128, 141, 146, 153, 164, 165, 168, 172, 172, 155, 118,
+ 108, 105, 104, 116, 123, 130, 144, 149, 157, 168, 170, 171, 165, 170,
+ 190, 120, 109, 107, 105, 117, 124, 131, 145, 150, 158, 170, 172, 181,
+ 185, 176, 163, 127, 115, 112, 110, 121, 128, 135, 150, 155, 164, 178,
+ 180, 181, 178, 185, 196, 128, 117, 114, 111, 122, 129, 136, 151, 156,
+ 165, 179, 181, 188, 187, 184, 171, 129, 118, 114, 112, 123, 130, 136,
+ 151, 157, 166, 180, 182, 189, 195, 196, 213, 133, 122, 118, 115, 126,
+ 132, 139, 154, 159, 169, 183, 186, 189, 193, 188, 180, 136, 124, 120,
+ 117, 129, 132, 140, 154, 155, 173, 181, 186, 195, 198, 216, 218, 139,
+ 126, 123, 119, 129, 129, 143, 152, 157, 176, 173, 196, 194, 193, 195,
+ 189, 141, 128, 125, 121, 130, 131, 149, 145, 162, 174, 175, 198, 191,
+ 206, 207, 239, 144, 131, 128, 123, 132, 133, 149, 145, 171, 160, 190,
+ 187, 199, 205, 198, 199, 146, 133, 130, 125, 133, 134, 149, 146, 170,
+ 162, 192, 178, 216, 196, 216, 216, 149, 136, 133, 127, 134, 136, 150,
+ 148, 169, 163, 190, 180, 213, 199, 216, 202, 152, 136, 138, 126, 129,
+ 148, 138, 167, 149, 190, 165, 213, 182, 237, 201, 228,
+ /* Size 32x16 */
+ 64, 63, 62, 61, 67, 71, 74, 84, 89, 98, 97, 97, 98, 101, 102, 104, 108,
+ 109, 114, 118, 120, 127, 128, 129, 133, 136, 139, 141, 144, 146, 149,
+ 152, 62, 63, 64, 64, 72, 76, 80, 86, 89, 93, 92, 91, 91, 93, 94, 96, 99,
+ 100, 104, 108, 109, 115, 117, 118, 122, 124, 126, 128, 131, 133, 136,
+ 136, 68, 71, 72, 73, 80, 84, 88, 91, 92, 95, 93, 92, 91, 93, 94, 95, 98,
+ 99, 102, 105, 107, 112, 114, 114, 118, 120, 123, 125, 128, 130, 133,
+ 138, 74, 77, 79, 80, 86, 90, 94, 95, 95, 96, 94, 93, 92, 93, 94, 95, 97,
+ 98, 101, 104, 105, 110, 111, 112, 115, 117, 119, 121, 123, 125, 127,
+ 126, 96, 94, 93, 92, 94, 95, 95, 100, 102, 106, 106, 106, 107, 108, 108,
+ 109, 111, 111, 113, 116, 117, 121, 122, 123, 126, 129, 129, 130, 132,
+ 133, 134, 129, 97, 94, 92, 91, 93, 93, 93, 100, 102, 107, 109, 110, 112,
+ 113, 114, 115, 117, 118, 120, 123, 124, 128, 129, 130, 132, 132, 129,
+ 131, 133, 134, 136, 148, 98, 94, 92, 91, 92, 91, 91, 99, 102, 107, 112,
+ 113, 117, 119, 120, 122, 124, 125, 128, 130, 131, 135, 136, 136, 139,
+ 140, 143, 149, 149, 149, 150, 138, 105, 100, 97, 96, 95, 95, 94, 101,
+ 104, 109, 115, 117, 123, 127, 129, 133, 136, 137, 141, 144, 145, 150,
+ 151, 151, 154, 154, 152, 145, 145, 146, 148, 167, 109, 103, 101, 99, 98,
+ 97, 96, 103, 106, 111, 117, 119, 125, 130, 131, 137, 140, 141, 146, 149,
+ 150, 155, 156, 157, 159, 155, 157, 162, 171, 170, 169, 149, 115, 109,
+ 106, 104, 103, 101, 100, 107, 109, 114, 120, 122, 128, 133, 136, 142,
+ 146, 148, 153, 157, 158, 164, 165, 166, 169, 173, 176, 174, 160, 162,
+ 163, 190, 127, 120, 117, 115, 112, 111, 109, 115, 118, 121, 128, 130,
+ 135, 141, 143, 150, 155, 157, 164, 168, 170, 178, 179, 180, 183, 181,
+ 173, 175, 190, 192, 190, 165, 129, 122, 119, 116, 114, 112, 110, 117,
+ 119, 122, 129, 131, 136, 142, 144, 151, 156, 158, 165, 170, 172, 180,
+ 181, 182, 186, 186, 196, 198, 187, 178, 180, 213, 135, 128, 125, 122,
+ 119, 118, 115, 121, 121, 128, 131, 133, 142, 142, 148, 156, 155, 164,
+ 168, 171, 181, 181, 188, 189, 189, 195, 194, 191, 199, 216, 213, 182,
+ 140, 133, 130, 126, 124, 123, 117, 120, 127, 129, 130, 139, 136, 150,
+ 145, 154, 159, 160, 172, 165, 185, 178, 187, 195, 193, 198, 193, 206,
+ 205, 196, 199, 237, 145, 137, 134, 130, 128, 127, 122, 122, 132, 128,
+ 139, 133, 148, 139, 158, 147, 164, 158, 172, 170, 176, 185, 184, 196,
+ 188, 216, 195, 207, 198, 216, 216, 201, 149, 140, 141, 132, 135, 129,
+ 131, 121, 126, 141, 131, 147, 136, 156, 141, 167, 148, 176, 155, 190,
+ 163, 196, 171, 213, 180, 218, 189, 239, 199, 216, 202, 228,
+ /* Size 4x16 */
+ 62, 97, 115, 140, 64, 92, 106, 130, 72, 93, 103, 124, 80, 93, 100, 117,
+ 89, 102, 109, 127, 92, 109, 120, 130, 91, 112, 128, 136, 94, 114, 136,
+ 145, 99, 117, 146, 159, 104, 120, 153, 172, 109, 124, 158, 185, 117,
+ 129, 165, 187, 122, 132, 169, 193, 126, 129, 176, 193, 131, 133, 160,
+ 205, 136, 136, 163, 199,
+ /* Size 16x4 */
+ 62, 64, 72, 80, 89, 92, 91, 94, 99, 104, 109, 117, 122, 126, 131, 136,
+ 97, 92, 93, 93, 102, 109, 112, 114, 117, 120, 124, 129, 132, 129, 133,
+ 136, 115, 106, 103, 100, 109, 120, 128, 136, 146, 153, 158, 165, 169,
+ 176, 160, 163, 140, 130, 124, 117, 127, 130, 136, 145, 159, 172, 185,
+ 187, 193, 193, 205, 199,
+ /* Size 8x32 */
+ 64, 68, 96, 98, 109, 127, 135, 145, 63, 71, 94, 94, 103, 120, 128, 137,
+ 62, 72, 93, 92, 101, 117, 125, 134, 61, 73, 92, 91, 99, 115, 122, 130,
+ 67, 80, 94, 92, 98, 112, 119, 128, 71, 84, 95, 91, 97, 111, 118, 127,
+ 74, 88, 95, 91, 96, 109, 115, 122, 84, 91, 100, 99, 103, 115, 121, 122,
+ 89, 92, 102, 102, 106, 118, 121, 132, 98, 95, 106, 107, 111, 121, 128,
+ 128, 97, 93, 106, 112, 117, 128, 131, 139, 97, 92, 106, 113, 119, 130,
+ 133, 133, 98, 91, 107, 117, 125, 135, 142, 148, 101, 93, 108, 119, 130,
+ 141, 142, 139, 102, 94, 108, 120, 131, 143, 148, 158, 104, 95, 109, 122,
+ 137, 150, 156, 147, 108, 98, 111, 124, 140, 155, 155, 164, 109, 99, 111,
+ 125, 141, 157, 164, 158, 114, 102, 113, 128, 146, 164, 168, 172, 118,
+ 105, 116, 130, 149, 168, 171, 170, 120, 107, 117, 131, 150, 170, 181,
+ 176, 127, 112, 121, 135, 155, 178, 181, 185, 128, 114, 122, 136, 156,
+ 179, 188, 184, 129, 114, 123, 136, 157, 180, 189, 196, 133, 118, 126,
+ 139, 159, 183, 189, 188, 136, 120, 129, 140, 155, 181, 195, 216, 139,
+ 123, 129, 143, 157, 173, 194, 195, 141, 125, 130, 149, 162, 175, 191,
+ 207, 144, 128, 132, 149, 171, 190, 199, 198, 146, 130, 133, 149, 170,
+ 192, 216, 216, 149, 133, 134, 150, 169, 190, 213, 216, 152, 138, 129,
+ 138, 149, 165, 182, 201,
+ /* Size 32x8 */
+ 64, 63, 62, 61, 67, 71, 74, 84, 89, 98, 97, 97, 98, 101, 102, 104, 108,
+ 109, 114, 118, 120, 127, 128, 129, 133, 136, 139, 141, 144, 146, 149,
+ 152, 68, 71, 72, 73, 80, 84, 88, 91, 92, 95, 93, 92, 91, 93, 94, 95, 98,
+ 99, 102, 105, 107, 112, 114, 114, 118, 120, 123, 125, 128, 130, 133,
+ 138, 96, 94, 93, 92, 94, 95, 95, 100, 102, 106, 106, 106, 107, 108, 108,
+ 109, 111, 111, 113, 116, 117, 121, 122, 123, 126, 129, 129, 130, 132,
+ 133, 134, 129, 98, 94, 92, 91, 92, 91, 91, 99, 102, 107, 112, 113, 117,
+ 119, 120, 122, 124, 125, 128, 130, 131, 135, 136, 136, 139, 140, 143,
+ 149, 149, 149, 150, 138, 109, 103, 101, 99, 98, 97, 96, 103, 106, 111,
+ 117, 119, 125, 130, 131, 137, 140, 141, 146, 149, 150, 155, 156, 157,
+ 159, 155, 157, 162, 171, 170, 169, 149, 127, 120, 117, 115, 112, 111,
+ 109, 115, 118, 121, 128, 130, 135, 141, 143, 150, 155, 157, 164, 168,
+ 170, 178, 179, 180, 183, 181, 173, 175, 190, 192, 190, 165, 135, 128,
+ 125, 122, 119, 118, 115, 121, 121, 128, 131, 133, 142, 142, 148, 156,
+ 155, 164, 168, 171, 181, 181, 188, 189, 189, 195, 194, 191, 199, 216,
+ 213, 182, 145, 137, 134, 130, 128, 127, 122, 122, 132, 128, 139, 133,
+ 148, 139, 158, 147, 164, 158, 172, 170, 176, 185, 184, 196, 188, 216,
+ 195, 207, 198, 216, 216, 201 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 73, 142, 142, 268,
+#endif
+ /* Size 4x4 */
+ 65, 75, 117, 164, 75, 108, 145, 184, 117, 145, 204, 238, 164, 184, 238,
+ 313,
+ /* Size 8x8 */
+ 64, 64, 70, 85, 107, 136, 157, 183, 64, 67, 72, 84, 103, 129, 148, 171,
+ 70, 72, 92, 105, 121, 144, 160, 174, 85, 84, 105, 127, 146, 169, 185,
+ 193, 107, 103, 121, 146, 172, 200, 218, 226, 136, 129, 144, 169, 200,
+ 235, 256, 273, 157, 148, 160, 185, 218, 256, 280, 329, 183, 171, 174,
+ 193, 226, 273, 329, 338,
+ /* Size 16x16 */
+ 64, 63, 63, 64, 68, 72, 82, 95, 108, 118, 131, 149, 164, 176, 187, 199,
+ 63, 64, 65, 65, 68, 70, 79, 90, 101, 111, 122, 139, 153, 164, 175, 187,
+ 63, 65, 66, 67, 70, 72, 80, 89, 99, 108, 119, 134, 147, 157, 167, 179,
+ 64, 65, 67, 71, 74, 77, 83, 90, 99, 107, 116, 131, 143, 151, 161, 172,
+ 68, 68, 70, 74, 79, 85, 92, 100, 109, 117, 126, 141, 152, 161, 172, 179,
+ 72, 70, 72, 77, 85, 97, 104, 112, 120, 128, 136, 150, 161, 170, 182,
+ 190, 82, 79, 80, 83, 92, 104, 114, 125, 135, 143, 151, 166, 177, 184,
+ 191, 203, 95, 90, 89, 90, 100, 112, 125, 139, 151, 159, 168, 183, 194,
+ 202, 200, 219, 108, 101, 99, 99, 109, 120, 135, 151, 165, 174, 185, 200,
+ 212, 221, 213, 235, 118, 111, 108, 107, 117, 128, 143, 159, 174, 184,
+ 196, 213, 225, 234, 228, 257, 131, 122, 119, 116, 126, 136, 151, 168,
+ 185, 196, 210, 228, 241, 250, 248, 273, 149, 139, 134, 131, 141, 150,
+ 166, 183, 200, 213, 228, 247, 262, 270, 274, 299, 164, 153, 147, 143,
+ 152, 161, 177, 194, 212, 225, 241, 262, 278, 288, 305, 317, 176, 164,
+ 157, 151, 161, 170, 184, 202, 221, 234, 250, 270, 288, 301, 308, 351,
+ 187, 175, 167, 161, 172, 182, 191, 200, 213, 228, 248, 274, 305, 308,
+ 325, 330, 199, 187, 179, 172, 179, 190, 203, 219, 235, 257, 273, 299,
+ 317, 351, 330, 351,
+ /* Size 32x32 */
+ 64, 63, 63, 63, 63, 63, 64, 65, 68, 71, 72, 79, 82, 88, 95, 97, 108,
+ 112, 118, 128, 131, 143, 149, 160, 164, 166, 176, 181, 187, 193, 199,
+ 206, 63, 64, 64, 64, 64, 64, 65, 66, 68, 70, 70, 77, 80, 85, 91, 93,
+ 103, 107, 113, 122, 125, 136, 142, 152, 156, 157, 167, 172, 177, 183,
+ 189, 194, 63, 64, 64, 64, 65, 65, 65, 66, 68, 69, 70, 76, 79, 84, 90,
+ 91, 101, 105, 111, 120, 122, 134, 139, 149, 153, 154, 164, 169, 175,
+ 181, 187, 195, 63, 64, 64, 65, 65, 65, 65, 66, 67, 68, 69, 75, 77, 82,
+ 88, 89, 99, 102, 108, 117, 119, 130, 136, 145, 149, 150, 159, 164, 169,
+ 175, 180, 183, 63, 64, 65, 65, 66, 66, 67, 68, 70, 72, 72, 78, 80, 84,
+ 89, 91, 99, 103, 108, 116, 119, 129, 134, 143, 147, 148, 157, 162, 167,
+ 173, 179, 186, 63, 64, 65, 65, 66, 67, 68, 69, 71, 72, 73, 78, 81, 84,
+ 90, 91, 100, 103, 108, 116, 118, 129, 134, 143, 147, 148, 156, 161, 166,
+ 171, 176, 180, 64, 65, 65, 65, 67, 68, 71, 72, 74, 76, 77, 81, 83, 85,
+ 90, 92, 99, 102, 107, 114, 116, 126, 131, 139, 143, 144, 151, 156, 161,
+ 166, 172, 181, 65, 66, 66, 66, 68, 69, 72, 73, 76, 79, 80, 84, 86, 89,
+ 94, 95, 103, 106, 111, 118, 120, 130, 135, 142, 146, 147, 155, 156, 160,
+ 165, 170, 171, 68, 68, 68, 67, 70, 71, 74, 76, 79, 84, 85, 90, 92, 95,
+ 100, 102, 109, 112, 117, 124, 126, 136, 141, 148, 152, 153, 161, 166,
+ 172, 176, 179, 175, 71, 70, 69, 68, 72, 72, 76, 79, 84, 92, 94, 99, 101,
+ 105, 110, 111, 118, 121, 125, 132, 134, 144, 148, 156, 159, 160, 168,
+ 170, 170, 174, 179, 195, 72, 70, 70, 69, 72, 73, 77, 80, 85, 94, 97,
+ 101, 104, 108, 112, 114, 120, 123, 128, 134, 136, 146, 150, 158, 161,
+ 162, 170, 174, 182, 187, 190, 184, 79, 77, 76, 75, 78, 78, 81, 84, 90,
+ 99, 101, 108, 111, 116, 121, 122, 130, 133, 138, 145, 147, 156, 161,
+ 168, 172, 173, 181, 184, 183, 183, 187, 205, 82, 80, 79, 77, 80, 81, 83,
+ 86, 92, 101, 104, 111, 114, 120, 125, 127, 135, 138, 143, 150, 151, 161,
+ 166, 173, 177, 178, 184, 184, 191, 201, 203, 192, 88, 85, 84, 82, 84,
+ 84, 85, 89, 95, 105, 108, 116, 120, 127, 133, 134, 143, 146, 151, 158,
+ 159, 169, 173, 181, 184, 185, 192, 200, 200, 193, 197, 220, 95, 91, 90,
+ 88, 89, 90, 90, 94, 100, 110, 112, 121, 125, 133, 139, 141, 151, 154,
+ 159, 166, 168, 178, 183, 190, 194, 195, 202, 198, 200, 217, 219, 202,
+ 97, 93, 91, 89, 91, 91, 92, 95, 102, 111, 114, 122, 127, 134, 141, 142,
+ 153, 156, 161, 169, 171, 181, 186, 193, 197, 198, 205, 212, 218, 206,
+ 209, 236, 108, 103, 101, 99, 99, 100, 99, 103, 109, 118, 120, 130, 135,
+ 143, 151, 153, 165, 168, 174, 183, 185, 195, 200, 208, 212, 213, 221,
+ 219, 213, 230, 235, 213, 112, 107, 105, 102, 103, 103, 102, 106, 112,
+ 121, 123, 133, 138, 146, 154, 156, 168, 172, 178, 187, 189, 200, 205,
+ 213, 217, 218, 224, 224, 239, 226, 222, 253, 118, 113, 111, 108, 108,
+ 108, 107, 111, 117, 125, 128, 138, 143, 151, 159, 161, 174, 178, 184,
+ 194, 196, 207, 213, 221, 225, 226, 234, 240, 228, 244, 257, 226, 128,
+ 122, 120, 117, 116, 116, 114, 118, 124, 132, 134, 145, 150, 158, 166,
+ 169, 183, 187, 194, 204, 207, 219, 224, 233, 237, 238, 245, 238, 255,
+ 247, 237, 277, 131, 125, 122, 119, 119, 118, 116, 120, 126, 134, 136,
+ 147, 151, 159, 168, 171, 185, 189, 196, 207, 210, 222, 228, 237, 241,
+ 242, 250, 263, 248, 254, 273, 241, 143, 136, 134, 130, 129, 129, 126,
+ 130, 136, 144, 146, 156, 161, 169, 178, 181, 195, 200, 207, 219, 222,
+ 235, 241, 251, 255, 256, 266, 258, 270, 273, 252, 292, 149, 142, 139,
+ 136, 134, 134, 131, 135, 141, 148, 150, 161, 166, 173, 183, 186, 200,
+ 205, 213, 224, 228, 241, 247, 257, 262, 263, 270, 276, 274, 268, 299,
+ 256, 160, 152, 149, 145, 143, 143, 139, 142, 148, 156, 158, 168, 173,
+ 181, 190, 193, 208, 213, 221, 233, 237, 251, 257, 268, 273, 274, 285,
+ 285, 280, 297, 269, 321, 164, 156, 153, 149, 147, 147, 143, 146, 152,
+ 159, 161, 172, 177, 184, 194, 197, 212, 217, 225, 237, 241, 255, 262,
+ 273, 278, 279, 288, 291, 305, 280, 317, 274, 166, 157, 154, 150, 148,
+ 148, 144, 147, 153, 160, 162, 173, 178, 185, 195, 198, 213, 218, 226,
+ 238, 242, 256, 263, 274, 279, 280, 290, 298, 295, 329, 286, 337, 176,
+ 167, 164, 159, 157, 156, 151, 155, 161, 168, 170, 181, 184, 192, 202,
+ 205, 221, 224, 234, 245, 250, 266, 270, 285, 288, 290, 301, 296, 308,
+ 300, 351, 291, 181, 172, 169, 164, 162, 161, 156, 156, 166, 170, 174,
+ 184, 184, 200, 198, 212, 219, 224, 240, 238, 263, 258, 276, 285, 291,
+ 298, 296, 313, 302, 319, 306, 376, 187, 177, 175, 169, 167, 166, 161,
+ 160, 172, 170, 182, 183, 191, 200, 200, 218, 213, 239, 228, 255, 248,
+ 270, 274, 280, 305, 295, 308, 302, 325, 308, 330, 312, 193, 183, 181,
+ 175, 173, 171, 166, 165, 176, 174, 187, 183, 201, 193, 217, 206, 230,
+ 226, 244, 247, 254, 273, 268, 297, 280, 329, 300, 319, 308, 338, 313,
+ 341, 199, 189, 187, 180, 179, 176, 172, 170, 179, 179, 190, 187, 203,
+ 197, 219, 209, 235, 222, 257, 237, 273, 252, 299, 269, 317, 286, 351,
+ 306, 330, 313, 351, 319, 206, 194, 195, 183, 186, 180, 181, 171, 175,
+ 195, 184, 205, 192, 220, 202, 236, 213, 253, 226, 277, 241, 292, 256,
+ 321, 274, 337, 291, 376, 312, 341, 319, 364,
+ /* Size 4x8 */
+ 64, 71, 119, 169, 65, 73, 114, 158, 69, 94, 130, 168, 82, 107, 156, 199,
+ 103, 123, 185, 224, 131, 146, 216, 258, 151, 162, 235, 296, 175, 183,
+ 232, 299,
+ /* Size 8x4 */
+ 64, 65, 69, 82, 103, 131, 151, 175, 71, 73, 94, 107, 123, 146, 162, 183,
+ 119, 114, 130, 156, 185, 216, 235, 232, 169, 158, 168, 199, 224, 258,
+ 296, 299,
+ /* Size 8x16 */
+ 64, 63, 70, 88, 107, 131, 164, 189, 63, 65, 69, 83, 101, 122, 153, 177,
+ 63, 66, 71, 84, 99, 118, 147, 169, 64, 68, 75, 85, 99, 116, 142, 163,
+ 68, 70, 83, 96, 109, 126, 152, 172, 72, 72, 92, 108, 120, 136, 161, 184,
+ 82, 80, 99, 120, 135, 152, 177, 198, 94, 89, 107, 132, 150, 168, 194,
+ 215, 107, 100, 115, 142, 164, 185, 212, 227, 117, 108, 123, 150, 174,
+ 196, 225, 242, 130, 119, 132, 159, 185, 210, 241, 253, 149, 134, 146,
+ 173, 200, 227, 262, 269, 164, 147, 158, 184, 211, 241, 278, 281, 175,
+ 157, 166, 192, 220, 250, 288, 298, 186, 167, 172, 199, 236, 272, 299,
+ 304, 198, 179, 180, 204, 235, 273, 317, 334,
+ /* Size 16x8 */
+ 64, 63, 63, 64, 68, 72, 82, 94, 107, 117, 130, 149, 164, 175, 186, 198,
+ 63, 65, 66, 68, 70, 72, 80, 89, 100, 108, 119, 134, 147, 157, 167, 179,
+ 70, 69, 71, 75, 83, 92, 99, 107, 115, 123, 132, 146, 158, 166, 172, 180,
+ 88, 83, 84, 85, 96, 108, 120, 132, 142, 150, 159, 173, 184, 192, 199,
+ 204, 107, 101, 99, 99, 109, 120, 135, 150, 164, 174, 185, 200, 211, 220,
+ 236, 235, 131, 122, 118, 116, 126, 136, 152, 168, 185, 196, 210, 227,
+ 241, 250, 272, 273, 164, 153, 147, 142, 152, 161, 177, 194, 212, 225,
+ 241, 262, 278, 288, 299, 317, 189, 177, 169, 163, 172, 184, 198, 215,
+ 227, 242, 253, 269, 281, 298, 304, 334,
+ /* Size 16x32 */
+ 64, 63, 63, 64, 70, 72, 88, 95, 107, 125, 131, 158, 164, 179, 189, 199,
+ 63, 64, 64, 65, 70, 71, 85, 91, 103, 119, 124, 151, 156, 169, 179, 188,
+ 63, 64, 65, 65, 69, 70, 83, 90, 101, 117, 122, 148, 153, 167, 177, 189,
+ 63, 65, 65, 66, 68, 69, 82, 88, 99, 114, 119, 144, 149, 162, 171, 178,
+ 63, 65, 66, 68, 71, 72, 84, 89, 99, 114, 118, 142, 147, 159, 169, 180,
+ 64, 65, 66, 68, 72, 73, 84, 90, 100, 114, 118, 142, 146, 158, 167, 174,
+ 64, 66, 68, 71, 75, 77, 85, 90, 99, 112, 116, 138, 142, 153, 163, 176,
+ 65, 66, 69, 72, 78, 80, 89, 94, 103, 116, 120, 142, 146, 155, 161, 167,
+ 68, 68, 70, 74, 83, 85, 96, 101, 109, 122, 126, 147, 152, 164, 172, 170,
+ 71, 69, 72, 76, 90, 94, 105, 110, 118, 130, 134, 155, 159, 168, 171,
+ 190, 72, 69, 72, 77, 92, 96, 108, 112, 120, 133, 136, 157, 161, 172,
+ 184, 179, 79, 75, 78, 81, 96, 101, 116, 121, 130, 143, 147, 168, 172,
+ 182, 180, 201, 82, 78, 80, 83, 99, 103, 120, 125, 135, 148, 152, 172,
+ 177, 183, 198, 187, 88, 82, 84, 86, 102, 107, 126, 132, 143, 156, 159,
+ 180, 184, 199, 190, 215, 94, 88, 89, 91, 107, 112, 132, 139, 150, 164,
+ 168, 190, 194, 197, 215, 198, 96, 90, 91, 93, 108, 113, 134, 140, 152,
+ 167, 171, 192, 197, 210, 204, 232, 107, 99, 100, 100, 115, 120, 142,
+ 150, 164, 180, 185, 207, 212, 217, 227, 209, 111, 103, 103, 103, 118,
+ 123, 145, 154, 168, 185, 189, 212, 217, 224, 222, 249, 117, 108, 108,
+ 108, 123, 127, 150, 159, 174, 191, 196, 220, 225, 238, 242, 222, 127,
+ 117, 116, 115, 130, 134, 157, 166, 182, 201, 207, 232, 237, 236, 242,
+ 273, 130, 120, 119, 117, 132, 136, 159, 168, 185, 204, 210, 236, 241,
+ 260, 253, 237, 142, 131, 129, 127, 142, 146, 169, 178, 195, 216, 222,
+ 250, 255, 258, 266, 287, 149, 136, 134, 132, 146, 150, 173, 183, 200,
+ 221, 227, 256, 262, 272, 269, 252, 159, 145, 143, 140, 154, 158, 181,
+ 190, 208, 230, 236, 267, 273, 284, 289, 315, 164, 150, 147, 144, 158,
+ 162, 184, 194, 211, 234, 241, 272, 278, 289, 281, 269, 165, 151, 148,
+ 145, 159, 162, 185, 195, 212, 235, 242, 273, 279, 296, 322, 331, 175,
+ 159, 157, 153, 166, 170, 192, 202, 220, 242, 250, 284, 288, 294, 298,
+ 286, 180, 165, 162, 157, 169, 174, 198, 198, 226, 240, 254, 284, 288,
+ 309, 315, 369, 186, 170, 167, 162, 172, 178, 199, 200, 236, 228, 272,
+ 272, 299, 309, 304, 307, 192, 175, 173, 166, 176, 183, 201, 205, 235,
+ 232, 276, 264, 322, 299, 333, 335, 198, 181, 179, 171, 180, 187, 204,
+ 209, 235, 237, 273, 269, 317, 305, 334, 314, 205, 185, 186, 174, 176,
+ 204, 192, 235, 213, 274, 241, 318, 274, 366, 311, 358,
+ /* Size 32x16 */
+ 64, 63, 63, 63, 63, 64, 64, 65, 68, 71, 72, 79, 82, 88, 94, 96, 107,
+ 111, 117, 127, 130, 142, 149, 159, 164, 165, 175, 180, 186, 192, 198,
+ 205, 63, 64, 64, 65, 65, 65, 66, 66, 68, 69, 69, 75, 78, 82, 88, 90, 99,
+ 103, 108, 117, 120, 131, 136, 145, 150, 151, 159, 165, 170, 175, 181,
+ 185, 63, 64, 65, 65, 66, 66, 68, 69, 70, 72, 72, 78, 80, 84, 89, 91,
+ 100, 103, 108, 116, 119, 129, 134, 143, 147, 148, 157, 162, 167, 173,
+ 179, 186, 64, 65, 65, 66, 68, 68, 71, 72, 74, 76, 77, 81, 83, 86, 91,
+ 93, 100, 103, 108, 115, 117, 127, 132, 140, 144, 145, 153, 157, 162,
+ 166, 171, 174, 70, 70, 69, 68, 71, 72, 75, 78, 83, 90, 92, 96, 99, 102,
+ 107, 108, 115, 118, 123, 130, 132, 142, 146, 154, 158, 159, 166, 169,
+ 172, 176, 180, 176, 72, 71, 70, 69, 72, 73, 77, 80, 85, 94, 96, 101,
+ 103, 107, 112, 113, 120, 123, 127, 134, 136, 146, 150, 158, 162, 162,
+ 170, 174, 178, 183, 187, 204, 88, 85, 83, 82, 84, 84, 85, 89, 96, 105,
+ 108, 116, 120, 126, 132, 134, 142, 145, 150, 157, 159, 169, 173, 181,
+ 184, 185, 192, 198, 199, 201, 204, 192, 95, 91, 90, 88, 89, 90, 90, 94,
+ 101, 110, 112, 121, 125, 132, 139, 140, 150, 154, 159, 166, 168, 178,
+ 183, 190, 194, 195, 202, 198, 200, 205, 209, 235, 107, 103, 101, 99, 99,
+ 100, 99, 103, 109, 118, 120, 130, 135, 143, 150, 152, 164, 168, 174,
+ 182, 185, 195, 200, 208, 211, 212, 220, 226, 236, 235, 235, 213, 125,
+ 119, 117, 114, 114, 114, 112, 116, 122, 130, 133, 143, 148, 156, 164,
+ 167, 180, 185, 191, 201, 204, 216, 221, 230, 234, 235, 242, 240, 228,
+ 232, 237, 274, 131, 124, 122, 119, 118, 118, 116, 120, 126, 134, 136,
+ 147, 152, 159, 168, 171, 185, 189, 196, 207, 210, 222, 227, 236, 241,
+ 242, 250, 254, 272, 276, 273, 241, 158, 151, 148, 144, 142, 142, 138,
+ 142, 147, 155, 157, 168, 172, 180, 190, 192, 207, 212, 220, 232, 236,
+ 250, 256, 267, 272, 273, 284, 284, 272, 264, 269, 318, 164, 156, 153,
+ 149, 147, 146, 142, 146, 152, 159, 161, 172, 177, 184, 194, 197, 212,
+ 217, 225, 237, 241, 255, 262, 273, 278, 279, 288, 288, 299, 322, 317,
+ 274, 179, 169, 167, 162, 159, 158, 153, 155, 164, 168, 172, 182, 183,
+ 199, 197, 210, 217, 224, 238, 236, 260, 258, 272, 284, 289, 296, 294,
+ 309, 309, 299, 305, 366, 189, 179, 177, 171, 169, 167, 163, 161, 172,
+ 171, 184, 180, 198, 190, 215, 204, 227, 222, 242, 242, 253, 266, 269,
+ 289, 281, 322, 298, 315, 304, 333, 334, 311, 199, 188, 189, 178, 180,
+ 174, 176, 167, 170, 190, 179, 201, 187, 215, 198, 232, 209, 249, 222,
+ 273, 237, 287, 252, 315, 269, 331, 286, 369, 307, 335, 314, 358,
+ /* Size 4x16 */
+ 63, 72, 125, 179, 64, 70, 117, 167, 65, 72, 114, 159, 66, 77, 112, 153,
+ 68, 85, 122, 164, 69, 96, 133, 172, 78, 103, 148, 183, 88, 112, 164,
+ 197, 99, 120, 180, 217, 108, 127, 191, 238, 120, 136, 204, 260, 136,
+ 150, 221, 272, 150, 162, 234, 289, 159, 170, 242, 294, 170, 178, 228,
+ 309, 181, 187, 237, 305,
+ /* Size 16x4 */
+ 63, 64, 65, 66, 68, 69, 78, 88, 99, 108, 120, 136, 150, 159, 170, 181,
+ 72, 70, 72, 77, 85, 96, 103, 112, 120, 127, 136, 150, 162, 170, 178,
+ 187, 125, 117, 114, 112, 122, 133, 148, 164, 180, 191, 204, 221, 234,
+ 242, 228, 237, 179, 167, 159, 153, 164, 172, 183, 197, 217, 238, 260,
+ 272, 289, 294, 309, 305,
+ /* Size 8x32 */
+ 64, 63, 70, 88, 107, 131, 164, 189, 63, 64, 70, 85, 103, 124, 156, 179,
+ 63, 65, 69, 83, 101, 122, 153, 177, 63, 65, 68, 82, 99, 119, 149, 171,
+ 63, 66, 71, 84, 99, 118, 147, 169, 64, 66, 72, 84, 100, 118, 146, 167,
+ 64, 68, 75, 85, 99, 116, 142, 163, 65, 69, 78, 89, 103, 120, 146, 161,
+ 68, 70, 83, 96, 109, 126, 152, 172, 71, 72, 90, 105, 118, 134, 159, 171,
+ 72, 72, 92, 108, 120, 136, 161, 184, 79, 78, 96, 116, 130, 147, 172,
+ 180, 82, 80, 99, 120, 135, 152, 177, 198, 88, 84, 102, 126, 143, 159,
+ 184, 190, 94, 89, 107, 132, 150, 168, 194, 215, 96, 91, 108, 134, 152,
+ 171, 197, 204, 107, 100, 115, 142, 164, 185, 212, 227, 111, 103, 118,
+ 145, 168, 189, 217, 222, 117, 108, 123, 150, 174, 196, 225, 242, 127,
+ 116, 130, 157, 182, 207, 237, 242, 130, 119, 132, 159, 185, 210, 241,
+ 253, 142, 129, 142, 169, 195, 222, 255, 266, 149, 134, 146, 173, 200,
+ 227, 262, 269, 159, 143, 154, 181, 208, 236, 273, 289, 164, 147, 158,
+ 184, 211, 241, 278, 281, 165, 148, 159, 185, 212, 242, 279, 322, 175,
+ 157, 166, 192, 220, 250, 288, 298, 180, 162, 169, 198, 226, 254, 288,
+ 315, 186, 167, 172, 199, 236, 272, 299, 304, 192, 173, 176, 201, 235,
+ 276, 322, 333, 198, 179, 180, 204, 235, 273, 317, 334, 205, 186, 176,
+ 192, 213, 241, 274, 311,
+ /* Size 32x8 */
+ 64, 63, 63, 63, 63, 64, 64, 65, 68, 71, 72, 79, 82, 88, 94, 96, 107,
+ 111, 117, 127, 130, 142, 149, 159, 164, 165, 175, 180, 186, 192, 198,
+ 205, 63, 64, 65, 65, 66, 66, 68, 69, 70, 72, 72, 78, 80, 84, 89, 91,
+ 100, 103, 108, 116, 119, 129, 134, 143, 147, 148, 157, 162, 167, 173,
+ 179, 186, 70, 70, 69, 68, 71, 72, 75, 78, 83, 90, 92, 96, 99, 102, 107,
+ 108, 115, 118, 123, 130, 132, 142, 146, 154, 158, 159, 166, 169, 172,
+ 176, 180, 176, 88, 85, 83, 82, 84, 84, 85, 89, 96, 105, 108, 116, 120,
+ 126, 132, 134, 142, 145, 150, 157, 159, 169, 173, 181, 184, 185, 192,
+ 198, 199, 201, 204, 192, 107, 103, 101, 99, 99, 100, 99, 103, 109, 118,
+ 120, 130, 135, 143, 150, 152, 164, 168, 174, 182, 185, 195, 200, 208,
+ 211, 212, 220, 226, 236, 235, 235, 213, 131, 124, 122, 119, 118, 118,
+ 116, 120, 126, 134, 136, 147, 152, 159, 168, 171, 185, 189, 196, 207,
+ 210, 222, 227, 236, 241, 242, 250, 254, 272, 276, 273, 241, 164, 156,
+ 153, 149, 147, 146, 142, 146, 152, 159, 161, 172, 177, 184, 194, 197,
+ 212, 217, 225, 237, 241, 255, 262, 273, 278, 279, 288, 288, 299, 322,
+ 317, 274, 189, 179, 177, 171, 169, 167, 163, 161, 172, 171, 184, 180,
+ 198, 190, 215, 204, 227, 222, 242, 242, 253, 266, 269, 289, 281, 322,
+ 298, 315, 304, 333, 334, 311 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 95, 111, 111, 178,
+#endif
+ /* Size 4x4 */
+ 64, 91, 103, 123, 91, 109, 119, 133, 103, 119, 150, 162, 123, 133, 162,
+ 196,
+ /* Size 8x8 */
+ 63, 69, 93, 94, 101, 114, 123, 134, 69, 78, 94, 91, 96, 107, 115, 124,
+ 93, 94, 104, 105, 108, 116, 122, 125, 94, 91, 105, 117, 124, 131, 136,
+ 136, 101, 96, 108, 124, 136, 147, 154, 154, 114, 107, 116, 131, 147,
+ 164, 172, 178, 123, 115, 122, 136, 154, 172, 183, 203, 134, 124, 125,
+ 136, 154, 178, 203, 206,
+ /* Size 16x16 */
+ 64, 62, 66, 73, 83, 98, 98, 101, 104, 109, 114, 123, 129, 134, 139, 144,
+ 62, 63, 68, 78, 85, 94, 93, 95, 98, 102, 107, 114, 120, 125, 129, 134,
+ 66, 68, 75, 85, 89, 94, 92, 93, 95, 99, 103, 110, 115, 119, 123, 128,
+ 73, 78, 85, 95, 95, 96, 92, 92, 94, 97, 100, 106, 111, 114, 118, 123,
+ 83, 85, 89, 95, 97, 101, 99, 100, 101, 104, 107, 112, 117, 120, 125,
+ 127, 98, 94, 94, 96, 101, 106, 107, 108, 109, 111, 113, 119, 123, 126,
+ 131, 134, 98, 93, 92, 92, 99, 107, 111, 115, 118, 120, 123, 128, 132,
+ 134, 136, 141, 101, 95, 93, 92, 100, 108, 115, 122, 126, 129, 133, 138,
+ 141, 144, 141, 149, 104, 98, 95, 94, 101, 109, 118, 126, 133, 137, 141,
+ 147, 151, 154, 148, 158, 109, 102, 99, 97, 104, 111, 120, 129, 137, 142,
+ 147, 153, 158, 161, 156, 169, 114, 107, 103, 100, 107, 113, 123, 133,
+ 141, 147, 153, 160, 165, 169, 167, 177, 123, 114, 110, 106, 112, 119,
+ 128, 138, 147, 153, 160, 169, 175, 178, 179, 189, 129, 120, 115, 111,
+ 117, 123, 132, 141, 151, 158, 165, 175, 182, 186, 193, 197, 134, 125,
+ 119, 114, 120, 126, 134, 144, 154, 161, 169, 178, 186, 192, 194, 212,
+ 139, 129, 123, 118, 125, 131, 136, 141, 148, 156, 167, 179, 193, 194,
+ 201, 203, 144, 134, 128, 123, 127, 134, 141, 149, 158, 169, 177, 189,
+ 197, 212, 203, 212,
+ /* Size 32x32 */
+ 64, 62, 62, 61, 66, 67, 73, 77, 83, 95, 98, 97, 98, 98, 101, 101, 104,
+ 106, 109, 113, 114, 120, 123, 127, 129, 130, 134, 136, 139, 141, 144,
+ 146, 62, 63, 63, 62, 68, 69, 77, 80, 85, 93, 95, 94, 94, 94, 96, 97,
+ 100, 101, 104, 108, 109, 114, 117, 121, 123, 123, 127, 129, 131, 134,
+ 136, 138, 62, 63, 63, 63, 68, 70, 78, 81, 85, 92, 94, 93, 93, 92, 95,
+ 95, 98, 100, 102, 106, 107, 112, 114, 118, 120, 121, 125, 127, 129, 132,
+ 134, 138, 61, 62, 63, 64, 69, 71, 80, 82, 85, 91, 93, 91, 91, 90, 92,
+ 93, 95, 97, 99, 103, 104, 109, 111, 115, 117, 117, 121, 123, 125, 127,
+ 130, 130, 66, 68, 68, 69, 75, 77, 85, 87, 89, 93, 94, 92, 92, 91, 93,
+ 93, 95, 97, 99, 102, 103, 107, 110, 113, 115, 115, 119, 121, 123, 126,
+ 128, 132, 67, 69, 70, 71, 77, 78, 87, 88, 90, 94, 95, 93, 92, 91, 93,
+ 93, 95, 96, 99, 102, 102, 107, 109, 113, 114, 115, 118, 120, 122, 124,
+ 126, 126, 73, 77, 78, 80, 85, 87, 95, 95, 95, 95, 96, 93, 92, 91, 92,
+ 92, 94, 95, 97, 99, 100, 104, 106, 109, 111, 111, 114, 116, 118, 120,
+ 123, 128, 77, 80, 81, 82, 87, 88, 95, 95, 96, 97, 98, 96, 95, 94, 95,
+ 95, 96, 98, 99, 102, 102, 107, 108, 111, 113, 113, 116, 116, 118, 119,
+ 121, 120, 83, 85, 85, 85, 89, 90, 95, 96, 97, 100, 101, 99, 99, 98, 100,
+ 100, 101, 102, 104, 106, 107, 111, 112, 115, 117, 117, 120, 122, 125,
+ 126, 127, 123, 95, 93, 92, 91, 93, 94, 95, 97, 100, 104, 105, 105, 105,
+ 105, 106, 106, 107, 108, 110, 111, 112, 116, 117, 120, 121, 122, 124,
+ 125, 123, 125, 127, 135, 98, 95, 94, 93, 94, 95, 96, 98, 101, 105, 106,
+ 106, 107, 107, 108, 108, 109, 110, 111, 113, 113, 117, 119, 121, 123,
+ 123, 126, 127, 131, 133, 134, 129, 97, 94, 93, 91, 92, 93, 93, 96, 99,
+ 105, 106, 109, 110, 111, 113, 113, 115, 116, 117, 119, 120, 123, 125,
+ 127, 129, 129, 132, 133, 131, 130, 132, 141, 98, 94, 93, 91, 92, 92, 92,
+ 95, 99, 105, 107, 110, 111, 114, 115, 116, 118, 119, 120, 122, 123, 126,
+ 128, 130, 132, 132, 134, 133, 136, 141, 141, 133, 98, 94, 92, 90, 91,
+ 91, 91, 94, 98, 105, 107, 111, 114, 117, 119, 120, 123, 124, 125, 127,
+ 127, 131, 132, 135, 136, 136, 139, 142, 141, 136, 138, 149, 101, 96, 95,
+ 92, 93, 93, 92, 95, 100, 106, 108, 113, 115, 119, 122, 122, 126, 128,
+ 129, 132, 133, 136, 138, 140, 141, 142, 144, 141, 141, 150, 149, 139,
+ 101, 97, 95, 93, 93, 93, 92, 95, 100, 106, 108, 113, 116, 120, 122, 123,
+ 127, 129, 130, 133, 134, 137, 139, 142, 143, 143, 146, 149, 151, 143,
+ 144, 158, 104, 100, 98, 95, 95, 95, 94, 96, 101, 107, 109, 115, 118,
+ 123, 126, 127, 133, 135, 137, 140, 141, 145, 147, 150, 151, 151, 154,
+ 152, 148, 156, 158, 145, 106, 101, 100, 97, 97, 96, 95, 98, 102, 108,
+ 110, 116, 119, 124, 128, 129, 135, 136, 139, 143, 143, 147, 149, 152,
+ 154, 154, 156, 155, 162, 154, 151, 166, 109, 104, 102, 99, 99, 99, 97,
+ 99, 104, 110, 111, 117, 120, 125, 129, 130, 137, 139, 142, 146, 147,
+ 151, 153, 156, 158, 158, 161, 163, 156, 164, 169, 153, 113, 108, 106,
+ 103, 102, 102, 99, 102, 106, 111, 113, 119, 122, 127, 132, 133, 140,
+ 143, 146, 150, 152, 157, 159, 162, 164, 164, 167, 162, 170, 165, 159,
+ 178, 114, 109, 107, 104, 103, 102, 100, 102, 107, 112, 113, 120, 123,
+ 127, 133, 134, 141, 143, 147, 152, 153, 158, 160, 164, 165, 166, 169,
+ 175, 167, 169, 177, 161, 120, 114, 112, 109, 107, 107, 104, 107, 111,
+ 116, 117, 123, 126, 131, 136, 137, 145, 147, 151, 157, 158, 164, 166,
+ 170, 172, 172, 176, 172, 177, 178, 167, 185, 123, 117, 114, 111, 110,
+ 109, 106, 108, 112, 117, 119, 125, 128, 132, 138, 139, 147, 149, 153,
+ 159, 160, 166, 169, 173, 175, 176, 178, 180, 179, 176, 189, 169, 127,
+ 121, 118, 115, 113, 113, 109, 111, 115, 120, 121, 127, 130, 135, 140,
+ 142, 150, 152, 156, 162, 164, 170, 173, 178, 180, 180, 185, 184, 182,
+ 189, 176, 199, 129, 123, 120, 117, 115, 114, 111, 113, 117, 121, 123,
+ 129, 132, 136, 141, 143, 151, 154, 158, 164, 165, 172, 175, 180, 182,
+ 183, 186, 187, 193, 182, 197, 178, 130, 123, 121, 117, 115, 115, 111,
+ 113, 117, 122, 123, 129, 132, 136, 142, 143, 151, 154, 158, 164, 166,
+ 172, 176, 180, 183, 183, 187, 190, 189, 203, 184, 205, 134, 127, 125,
+ 121, 119, 118, 114, 116, 120, 124, 126, 132, 134, 139, 144, 146, 154,
+ 156, 161, 167, 169, 176, 178, 185, 186, 187, 192, 189, 194, 191, 212,
+ 186, 136, 129, 127, 123, 121, 120, 116, 116, 122, 125, 127, 133, 133,
+ 142, 141, 149, 152, 155, 163, 162, 175, 172, 180, 184, 187, 190, 189,
+ 196, 192, 199, 193, 221, 139, 131, 129, 125, 123, 122, 118, 118, 125,
+ 123, 131, 131, 136, 141, 141, 151, 148, 162, 156, 170, 167, 177, 179,
+ 182, 193, 189, 194, 192, 201, 194, 203, 196, 141, 134, 132, 127, 126,
+ 124, 120, 119, 126, 125, 133, 130, 141, 136, 150, 143, 156, 154, 164,
+ 165, 169, 178, 176, 189, 182, 203, 191, 199, 194, 206, 196, 207, 144,
+ 136, 134, 130, 128, 126, 123, 121, 127, 127, 134, 132, 141, 138, 149,
+ 144, 158, 151, 169, 159, 177, 167, 189, 176, 197, 184, 212, 193, 203,
+ 196, 212, 199, 146, 138, 138, 130, 132, 126, 128, 120, 123, 135, 129,
+ 141, 133, 149, 139, 158, 145, 166, 153, 178, 161, 185, 169, 199, 178,
+ 205, 186, 221, 196, 207, 199, 217,
+ /* Size 4x8 */
+ 63, 94, 107, 128, 72, 94, 101, 119, 92, 105, 111, 124, 91, 107, 127,
+ 142, 98, 110, 142, 156, 109, 117, 155, 173, 118, 123, 163, 190, 128,
+ 131, 158, 191,
+ /* Size 8x4 */
+ 63, 72, 92, 91, 98, 109, 118, 128, 94, 94, 105, 107, 110, 117, 123, 131,
+ 107, 101, 111, 127, 142, 155, 163, 158, 128, 119, 124, 142, 156, 173,
+ 190, 191,
+ /* Size 8x16 */
+ 64, 66, 91, 98, 105, 115, 129, 140, 62, 69, 90, 93, 98, 107, 120, 131,
+ 66, 75, 92, 91, 95, 103, 115, 124, 74, 86, 95, 91, 94, 100, 111, 119,
+ 84, 89, 99, 99, 101, 107, 117, 125, 98, 94, 104, 107, 109, 114, 123,
+ 132, 97, 92, 103, 114, 118, 123, 132, 140, 100, 93, 104, 119, 127, 133,
+ 142, 149, 104, 95, 106, 122, 133, 142, 151, 156, 109, 99, 108, 125, 137,
+ 147, 158, 164, 114, 103, 111, 128, 141, 153, 166, 169, 122, 110, 116,
+ 133, 147, 160, 175, 177, 129, 115, 120, 136, 151, 166, 182, 183, 133,
+ 119, 124, 139, 154, 169, 186, 190, 138, 124, 125, 141, 160, 179, 191,
+ 193, 143, 128, 127, 141, 158, 177, 198, 205,
+ /* Size 16x8 */
+ 64, 62, 66, 74, 84, 98, 97, 100, 104, 109, 114, 122, 129, 133, 138, 143,
+ 66, 69, 75, 86, 89, 94, 92, 93, 95, 99, 103, 110, 115, 119, 124, 128,
+ 91, 90, 92, 95, 99, 104, 103, 104, 106, 108, 111, 116, 120, 124, 125,
+ 127, 98, 93, 91, 91, 99, 107, 114, 119, 122, 125, 128, 133, 136, 139,
+ 141, 141, 105, 98, 95, 94, 101, 109, 118, 127, 133, 137, 141, 147, 151,
+ 154, 160, 158, 115, 107, 103, 100, 107, 114, 123, 133, 142, 147, 153,
+ 160, 166, 169, 179, 177, 129, 120, 115, 111, 117, 123, 132, 142, 151,
+ 158, 166, 175, 182, 186, 191, 198, 140, 131, 124, 119, 125, 132, 140,
+ 149, 156, 164, 169, 177, 183, 190, 193, 205,
+ /* Size 16x32 */
+ 64, 62, 66, 74, 91, 96, 98, 101, 105, 112, 115, 127, 129, 135, 140, 144,
+ 63, 63, 68, 77, 90, 94, 94, 97, 100, 107, 109, 120, 123, 128, 132, 136,
+ 62, 64, 69, 78, 90, 93, 93, 95, 98, 105, 107, 118, 120, 126, 131, 136,
+ 61, 64, 70, 80, 89, 92, 91, 93, 96, 102, 104, 115, 117, 122, 126, 128,
+ 66, 70, 75, 85, 92, 94, 91, 93, 95, 101, 103, 113, 115, 120, 124, 130,
+ 67, 72, 77, 86, 92, 94, 92, 93, 95, 101, 103, 112, 114, 119, 123, 125,
+ 74, 80, 86, 94, 95, 95, 91, 92, 94, 99, 100, 109, 111, 115, 119, 126,
+ 78, 82, 87, 95, 97, 97, 94, 95, 97, 101, 103, 111, 113, 116, 118, 119,
+ 84, 86, 89, 95, 99, 100, 99, 100, 101, 106, 107, 115, 117, 122, 125,
+ 122, 95, 92, 93, 96, 103, 105, 106, 106, 107, 111, 112, 120, 122, 124,
+ 124, 134, 98, 93, 94, 96, 104, 106, 107, 108, 109, 113, 114, 121, 123,
+ 127, 132, 127, 97, 92, 93, 94, 103, 106, 112, 113, 115, 119, 120, 128,
+ 129, 133, 129, 140, 97, 91, 92, 93, 103, 106, 114, 115, 118, 122, 123,
+ 130, 132, 133, 140, 132, 98, 91, 91, 92, 103, 107, 117, 119, 123, 127,
+ 128, 135, 136, 142, 135, 148, 100, 93, 93, 93, 104, 108, 119, 122, 127,
+ 131, 133, 140, 142, 141, 149, 138, 101, 93, 93, 93, 105, 108, 119, 123,
+ 128, 133, 134, 142, 143, 148, 143, 157, 104, 96, 95, 95, 106, 109, 122,
+ 127, 133, 140, 142, 150, 151, 152, 156, 144, 106, 98, 97, 96, 107, 110,
+ 123, 128, 135, 142, 144, 152, 154, 156, 153, 165, 109, 100, 99, 98, 108,
+ 111, 125, 130, 137, 145, 147, 156, 158, 163, 164, 152, 113, 103, 102,
+ 100, 110, 113, 127, 132, 140, 149, 152, 162, 164, 162, 164, 177, 114,
+ 104, 103, 101, 111, 113, 128, 133, 141, 151, 153, 164, 166, 174, 169,
+ 160, 120, 109, 108, 105, 115, 117, 131, 136, 145, 155, 158, 170, 172,
+ 173, 175, 184, 122, 112, 110, 107, 116, 119, 133, 138, 147, 158, 160,
+ 173, 175, 179, 177, 167, 127, 115, 113, 110, 119, 121, 135, 140, 150,
+ 161, 164, 178, 180, 184, 186, 197, 129, 117, 115, 112, 120, 123, 136,
+ 142, 151, 162, 166, 180, 182, 187, 183, 176, 129, 118, 116, 112, 121,
+ 123, 136, 142, 151, 163, 166, 180, 183, 190, 200, 203, 133, 122, 119,
+ 115, 124, 126, 139, 144, 154, 165, 169, 185, 186, 189, 190, 184, 136,
+ 124, 121, 117, 124, 127, 141, 141, 156, 163, 171, 184, 186, 195, 198,
+ 219, 138, 126, 124, 119, 125, 129, 141, 142, 160, 157, 179, 179, 191,
+ 195, 193, 194, 141, 128, 126, 121, 126, 131, 141, 143, 159, 158, 179,
+ 174, 200, 191, 205, 205, 143, 130, 128, 122, 127, 132, 141, 144, 158,
+ 159, 177, 176, 198, 193, 205, 197, 145, 131, 132, 122, 124, 140, 134,
+ 157, 146, 177, 161, 197, 178, 218, 195, 215,
+ /* Size 32x16 */
+ 64, 63, 62, 61, 66, 67, 74, 78, 84, 95, 98, 97, 97, 98, 100, 101, 104,
+ 106, 109, 113, 114, 120, 122, 127, 129, 129, 133, 136, 138, 141, 143,
+ 145, 62, 63, 64, 64, 70, 72, 80, 82, 86, 92, 93, 92, 91, 91, 93, 93, 96,
+ 98, 100, 103, 104, 109, 112, 115, 117, 118, 122, 124, 126, 128, 130,
+ 131, 66, 68, 69, 70, 75, 77, 86, 87, 89, 93, 94, 93, 92, 91, 93, 93, 95,
+ 97, 99, 102, 103, 108, 110, 113, 115, 116, 119, 121, 124, 126, 128, 132,
+ 74, 77, 78, 80, 85, 86, 94, 95, 95, 96, 96, 94, 93, 92, 93, 93, 95, 96,
+ 98, 100, 101, 105, 107, 110, 112, 112, 115, 117, 119, 121, 122, 122, 91,
+ 90, 90, 89, 92, 92, 95, 97, 99, 103, 104, 103, 103, 103, 104, 105, 106,
+ 107, 108, 110, 111, 115, 116, 119, 120, 121, 124, 124, 125, 126, 127,
+ 124, 96, 94, 93, 92, 94, 94, 95, 97, 100, 105, 106, 106, 106, 107, 108,
+ 108, 109, 110, 111, 113, 113, 117, 119, 121, 123, 123, 126, 127, 129,
+ 131, 132, 140, 98, 94, 93, 91, 91, 92, 91, 94, 99, 106, 107, 112, 114,
+ 117, 119, 119, 122, 123, 125, 127, 128, 131, 133, 135, 136, 136, 139,
+ 141, 141, 141, 141, 134, 101, 97, 95, 93, 93, 93, 92, 95, 100, 106, 108,
+ 113, 115, 119, 122, 123, 127, 128, 130, 132, 133, 136, 138, 140, 142,
+ 142, 144, 141, 142, 143, 144, 157, 105, 100, 98, 96, 95, 95, 94, 97,
+ 101, 107, 109, 115, 118, 123, 127, 128, 133, 135, 137, 140, 141, 145,
+ 147, 150, 151, 151, 154, 156, 160, 159, 158, 146, 112, 107, 105, 102,
+ 101, 101, 99, 101, 106, 111, 113, 119, 122, 127, 131, 133, 140, 142,
+ 145, 149, 151, 155, 158, 161, 162, 163, 165, 163, 157, 158, 159, 177,
+ 115, 109, 107, 104, 103, 103, 100, 103, 107, 112, 114, 120, 123, 128,
+ 133, 134, 142, 144, 147, 152, 153, 158, 160, 164, 166, 166, 169, 171,
+ 179, 179, 177, 161, 127, 120, 118, 115, 113, 112, 109, 111, 115, 120,
+ 121, 128, 130, 135, 140, 142, 150, 152, 156, 162, 164, 170, 173, 178,
+ 180, 180, 185, 184, 179, 174, 176, 197, 129, 123, 120, 117, 115, 114,
+ 111, 113, 117, 122, 123, 129, 132, 136, 142, 143, 151, 154, 158, 164,
+ 166, 172, 175, 180, 182, 183, 186, 186, 191, 200, 198, 178, 135, 128,
+ 126, 122, 120, 119, 115, 116, 122, 124, 127, 133, 133, 142, 141, 148,
+ 152, 156, 163, 162, 174, 173, 179, 184, 187, 190, 189, 195, 195, 191,
+ 193, 218, 140, 132, 131, 126, 124, 123, 119, 118, 125, 124, 132, 129,
+ 140, 135, 149, 143, 156, 153, 164, 164, 169, 175, 177, 186, 183, 200,
+ 190, 198, 193, 205, 205, 195, 144, 136, 136, 128, 130, 125, 126, 119,
+ 122, 134, 127, 140, 132, 148, 138, 157, 144, 165, 152, 177, 160, 184,
+ 167, 197, 176, 203, 184, 219, 194, 205, 197, 215,
+ /* Size 4x16 */
+ 62, 96, 112, 135, 64, 93, 105, 126, 70, 94, 101, 120, 80, 95, 99, 115,
+ 86, 100, 106, 122, 93, 106, 113, 127, 91, 106, 122, 133, 93, 108, 131,
+ 141, 96, 109, 140, 152, 100, 111, 145, 163, 104, 113, 151, 174, 112,
+ 119, 158, 179, 117, 123, 162, 187, 122, 126, 165, 189, 126, 129, 157,
+ 195, 130, 132, 159, 193,
+ /* Size 16x4 */
+ 62, 64, 70, 80, 86, 93, 91, 93, 96, 100, 104, 112, 117, 122, 126, 130,
+ 96, 93, 94, 95, 100, 106, 106, 108, 109, 111, 113, 119, 123, 126, 129,
+ 132, 112, 105, 101, 99, 106, 113, 122, 131, 140, 145, 151, 158, 162,
+ 165, 157, 159, 135, 126, 120, 115, 122, 127, 133, 141, 152, 163, 174,
+ 179, 187, 189, 195, 193,
+ /* Size 8x32 */
+ 64, 66, 91, 98, 105, 115, 129, 140, 63, 68, 90, 94, 100, 109, 123, 132,
+ 62, 69, 90, 93, 98, 107, 120, 131, 61, 70, 89, 91, 96, 104, 117, 126,
+ 66, 75, 92, 91, 95, 103, 115, 124, 67, 77, 92, 92, 95, 103, 114, 123,
+ 74, 86, 95, 91, 94, 100, 111, 119, 78, 87, 97, 94, 97, 103, 113, 118,
+ 84, 89, 99, 99, 101, 107, 117, 125, 95, 93, 103, 106, 107, 112, 122,
+ 124, 98, 94, 104, 107, 109, 114, 123, 132, 97, 93, 103, 112, 115, 120,
+ 129, 129, 97, 92, 103, 114, 118, 123, 132, 140, 98, 91, 103, 117, 123,
+ 128, 136, 135, 100, 93, 104, 119, 127, 133, 142, 149, 101, 93, 105, 119,
+ 128, 134, 143, 143, 104, 95, 106, 122, 133, 142, 151, 156, 106, 97, 107,
+ 123, 135, 144, 154, 153, 109, 99, 108, 125, 137, 147, 158, 164, 113,
+ 102, 110, 127, 140, 152, 164, 164, 114, 103, 111, 128, 141, 153, 166,
+ 169, 120, 108, 115, 131, 145, 158, 172, 175, 122, 110, 116, 133, 147,
+ 160, 175, 177, 127, 113, 119, 135, 150, 164, 180, 186, 129, 115, 120,
+ 136, 151, 166, 182, 183, 129, 116, 121, 136, 151, 166, 183, 200, 133,
+ 119, 124, 139, 154, 169, 186, 190, 136, 121, 124, 141, 156, 171, 186,
+ 198, 138, 124, 125, 141, 160, 179, 191, 193, 141, 126, 126, 141, 159,
+ 179, 200, 205, 143, 128, 127, 141, 158, 177, 198, 205, 145, 132, 124,
+ 134, 146, 161, 178, 195,
+ /* Size 32x8 */
+ 64, 63, 62, 61, 66, 67, 74, 78, 84, 95, 98, 97, 97, 98, 100, 101, 104,
+ 106, 109, 113, 114, 120, 122, 127, 129, 129, 133, 136, 138, 141, 143,
+ 145, 66, 68, 69, 70, 75, 77, 86, 87, 89, 93, 94, 93, 92, 91, 93, 93, 95,
+ 97, 99, 102, 103, 108, 110, 113, 115, 116, 119, 121, 124, 126, 128, 132,
+ 91, 90, 90, 89, 92, 92, 95, 97, 99, 103, 104, 103, 103, 103, 104, 105,
+ 106, 107, 108, 110, 111, 115, 116, 119, 120, 121, 124, 124, 125, 126,
+ 127, 124, 98, 94, 93, 91, 91, 92, 91, 94, 99, 106, 107, 112, 114, 117,
+ 119, 119, 122, 123, 125, 127, 128, 131, 133, 135, 136, 136, 139, 141,
+ 141, 141, 141, 134, 105, 100, 98, 96, 95, 95, 94, 97, 101, 107, 109,
+ 115, 118, 123, 127, 128, 133, 135, 137, 140, 141, 145, 147, 150, 151,
+ 151, 154, 156, 160, 159, 158, 146, 115, 109, 107, 104, 103, 103, 100,
+ 103, 107, 112, 114, 120, 123, 128, 133, 134, 142, 144, 147, 152, 153,
+ 158, 160, 164, 166, 166, 169, 171, 179, 179, 177, 161, 129, 123, 120,
+ 117, 115, 114, 111, 113, 117, 122, 123, 129, 132, 136, 142, 143, 151,
+ 154, 158, 164, 166, 172, 175, 180, 182, 183, 186, 186, 191, 200, 198,
+ 178, 140, 132, 131, 126, 124, 123, 119, 118, 125, 124, 132, 129, 140,
+ 135, 149, 143, 156, 153, 164, 164, 169, 175, 177, 186, 183, 200, 190,
+ 198, 193, 205, 205, 195 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 71, 126, 126, 235,
+#endif
+ /* Size 4x4 */
+ 65, 69, 107, 150, 69, 98, 128, 163, 107, 128, 182, 225, 150, 163, 225,
+ 280,
+ /* Size 8x8 */
+ 64, 64, 68, 79, 100, 125, 152, 170, 64, 67, 71, 80, 97, 118, 143, 159,
+ 68, 71, 79, 92, 107, 126, 148, 163, 79, 80, 92, 113, 131, 150, 172, 183,
+ 100, 97, 107, 131, 157, 180, 203, 211, 125, 118, 126, 150, 180, 210,
+ 237, 247, 152, 143, 148, 172, 203, 237, 268, 289, 170, 159, 163, 183,
+ 211, 247, 289, 308,
+ /* Size 16x16 */
+ 64, 63, 63, 64, 67, 72, 79, 88, 97, 108, 118, 133, 149, 163, 173, 184,
+ 63, 64, 64, 65, 67, 70, 77, 84, 92, 102, 112, 126, 141, 154, 162, 174,
+ 63, 64, 65, 66, 68, 70, 76, 83, 90, 99, 108, 121, 135, 147, 155, 166,
+ 64, 65, 66, 69, 72, 75, 80, 85, 91, 99, 107, 119, 132, 143, 151, 161,
+ 67, 67, 68, 72, 77, 84, 88, 93, 100, 107, 115, 126, 139, 149, 157, 163,
+ 72, 70, 70, 75, 84, 97, 101, 108, 114, 120, 128, 138, 150, 160, 168,
+ 173, 79, 77, 76, 80, 88, 101, 108, 116, 122, 130, 138, 148, 161, 171,
+ 178, 185, 88, 84, 83, 85, 93, 108, 116, 127, 134, 143, 151, 161, 173,
+ 183, 190, 198, 97, 92, 90, 91, 100, 114, 122, 134, 142, 153, 161, 173,
+ 186, 196, 203, 212, 108, 102, 99, 99, 107, 120, 130, 143, 153, 165, 174,
+ 187, 200, 211, 218, 229, 118, 112, 108, 107, 115, 128, 138, 151, 161,
+ 174, 184, 198, 213, 224, 232, 245, 133, 126, 121, 119, 126, 138, 148,
+ 161, 173, 187, 198, 215, 230, 242, 251, 265, 149, 141, 135, 132, 139,
+ 150, 161, 173, 186, 200, 213, 230, 247, 261, 270, 282, 163, 154, 147,
+ 143, 149, 160, 171, 183, 196, 211, 224, 242, 261, 275, 285, 307, 173,
+ 162, 155, 151, 157, 168, 178, 190, 203, 218, 232, 251, 270, 285, 295,
+ 305, 184, 174, 166, 161, 163, 173, 185, 198, 212, 229, 245, 265, 282,
+ 307, 305, 319,
+ /* Size 32x32 */
+ 64, 63, 63, 63, 63, 63, 64, 64, 67, 68, 72, 72, 79, 82, 88, 92, 97, 104,
+ 108, 117, 118, 131, 133, 143, 149, 160, 163, 166, 173, 179, 184, 190,
+ 63, 64, 64, 64, 64, 64, 65, 65, 67, 68, 70, 71, 77, 79, 85, 89, 93, 100,
+ 103, 112, 113, 125, 127, 136, 142, 152, 155, 157, 164, 170, 175, 179,
+ 63, 64, 64, 64, 64, 65, 65, 65, 67, 68, 70, 71, 77, 79, 84, 88, 92, 99,
+ 102, 111, 112, 123, 126, 135, 141, 150, 154, 156, 162, 168, 174, 180,
+ 63, 64, 64, 65, 65, 65, 65, 65, 67, 67, 69, 69, 75, 77, 82, 85, 89, 96,
+ 99, 107, 108, 119, 121, 130, 136, 145, 148, 150, 156, 162, 167, 170, 63,
+ 64, 64, 65, 65, 66, 66, 66, 68, 69, 70, 71, 76, 78, 83, 86, 90, 96, 99,
+ 107, 108, 119, 121, 130, 135, 144, 147, 149, 155, 161, 166, 171, 63, 64,
+ 65, 65, 66, 67, 67, 68, 70, 71, 73, 73, 78, 80, 84, 88, 91, 97, 100,
+ 107, 108, 118, 120, 129, 134, 143, 146, 148, 154, 159, 163, 167, 64, 65,
+ 65, 65, 66, 67, 69, 70, 72, 72, 75, 76, 80, 81, 85, 88, 91, 97, 99, 106,
+ 107, 117, 119, 127, 132, 140, 143, 145, 151, 156, 161, 168, 64, 65, 65,
+ 65, 66, 68, 70, 71, 73, 74, 77, 77, 81, 82, 85, 88, 92, 97, 99, 106,
+ 107, 116, 118, 126, 131, 139, 142, 144, 149, 154, 158, 161, 67, 67, 67,
+ 67, 68, 70, 72, 73, 77, 78, 84, 84, 88, 90, 93, 96, 100, 105, 107, 114,
+ 115, 124, 126, 134, 139, 146, 149, 151, 157, 160, 163, 162, 68, 68, 68,
+ 67, 69, 71, 72, 74, 78, 79, 85, 86, 90, 92, 95, 99, 102, 107, 109, 116,
+ 117, 126, 128, 136, 141, 148, 151, 153, 159, 163, 167, 177, 72, 70, 70,
+ 69, 70, 73, 75, 77, 84, 85, 97, 97, 101, 103, 108, 111, 114, 118, 120,
+ 127, 128, 136, 138, 146, 150, 158, 160, 162, 168, 171, 173, 171, 72, 71,
+ 71, 69, 71, 73, 76, 77, 84, 86, 97, 98, 102, 104, 108, 111, 114, 119,
+ 121, 128, 129, 137, 139, 147, 151, 159, 161, 163, 169, 172, 176, 186,
+ 79, 77, 77, 75, 76, 78, 80, 81, 88, 90, 101, 102, 108, 110, 116, 119,
+ 122, 128, 130, 137, 138, 147, 148, 156, 161, 168, 171, 173, 178, 183,
+ 185, 180, 82, 79, 79, 77, 78, 80, 81, 82, 90, 92, 103, 104, 110, 113,
+ 119, 122, 126, 131, 134, 141, 141, 150, 152, 160, 164, 172, 175, 176,
+ 182, 183, 187, 199, 88, 85, 84, 82, 83, 84, 85, 85, 93, 95, 108, 108,
+ 116, 119, 127, 130, 134, 140, 143, 150, 151, 159, 161, 169, 173, 181,
+ 183, 185, 190, 197, 198, 191, 92, 89, 88, 85, 86, 88, 88, 88, 96, 99,
+ 111, 111, 119, 122, 130, 134, 138, 145, 148, 155, 156, 165, 167, 175,
+ 179, 187, 189, 191, 196, 195, 198, 213, 97, 93, 92, 89, 90, 91, 91, 92,
+ 100, 102, 114, 114, 122, 126, 134, 138, 142, 149, 153, 160, 161, 171,
+ 173, 181, 186, 193, 196, 198, 203, 210, 212, 202, 104, 100, 99, 96, 96,
+ 97, 97, 97, 105, 107, 118, 119, 128, 131, 140, 145, 149, 157, 161, 169,
+ 170, 180, 182, 191, 195, 203, 206, 208, 213, 211, 211, 227, 108, 103,
+ 102, 99, 99, 100, 99, 99, 107, 109, 120, 121, 130, 134, 143, 148, 153,
+ 161, 165, 173, 174, 185, 187, 195, 200, 208, 211, 213, 218, 225, 229,
+ 215, 117, 112, 111, 107, 107, 107, 106, 106, 114, 116, 127, 128, 137,
+ 141, 150, 155, 160, 169, 173, 182, 183, 195, 197, 206, 211, 220, 223,
+ 225, 230, 229, 226, 247, 118, 113, 112, 108, 108, 108, 107, 107, 115,
+ 117, 128, 129, 138, 141, 151, 156, 161, 170, 174, 183, 184, 196, 198,
+ 207, 213, 221, 224, 226, 232, 238, 245, 230, 131, 125, 123, 119, 119,
+ 118, 117, 116, 124, 126, 136, 137, 147, 150, 159, 165, 171, 180, 185,
+ 195, 196, 210, 212, 222, 228, 237, 240, 242, 248, 247, 240, 261, 133,
+ 127, 126, 121, 121, 120, 119, 118, 126, 128, 138, 139, 148, 152, 161,
+ 167, 173, 182, 187, 197, 198, 212, 215, 224, 230, 239, 242, 245, 251,
+ 254, 265, 244, 143, 136, 135, 130, 130, 129, 127, 126, 134, 136, 146,
+ 147, 156, 160, 169, 175, 181, 191, 195, 206, 207, 222, 224, 235, 241,
+ 251, 254, 256, 263, 267, 257, 283, 149, 142, 141, 136, 135, 134, 132,
+ 131, 139, 141, 150, 151, 161, 164, 173, 179, 186, 195, 200, 211, 213,
+ 228, 230, 241, 247, 257, 261, 263, 270, 268, 282, 261, 160, 152, 150,
+ 145, 144, 143, 140, 139, 146, 148, 158, 159, 168, 172, 181, 187, 193,
+ 203, 208, 220, 221, 237, 239, 251, 257, 268, 272, 274, 281, 289, 273,
+ 298, 163, 155, 154, 148, 147, 146, 143, 142, 149, 151, 160, 161, 171,
+ 175, 183, 189, 196, 206, 211, 223, 224, 240, 242, 254, 261, 272, 275,
+ 278, 285, 287, 307, 277, 166, 157, 156, 150, 149, 148, 145, 144, 151,
+ 153, 162, 163, 173, 176, 185, 191, 198, 208, 213, 225, 226, 242, 245,
+ 256, 263, 274, 278, 280, 288, 296, 292, 326, 173, 164, 162, 156, 155,
+ 154, 151, 149, 157, 159, 168, 169, 178, 182, 190, 196, 203, 213, 218,
+ 230, 232, 248, 251, 263, 270, 281, 285, 288, 295, 294, 305, 297, 179,
+ 170, 168, 162, 161, 159, 156, 154, 160, 163, 171, 172, 183, 183, 197,
+ 195, 210, 211, 225, 229, 238, 247, 254, 267, 268, 289, 287, 296, 294,
+ 308, 299, 314, 184, 175, 174, 167, 166, 163, 161, 158, 163, 167, 173,
+ 176, 185, 187, 198, 198, 212, 211, 229, 226, 245, 240, 265, 257, 282,
+ 273, 307, 292, 305, 299, 319, 304, 190, 179, 180, 170, 171, 167, 168,
+ 161, 162, 177, 171, 186, 180, 199, 191, 213, 202, 227, 215, 247, 230,
+ 261, 244, 283, 261, 298, 277, 326, 297, 314, 304, 330,
+ /* Size 4x8 */
+ 64, 71, 103, 155, 65, 73, 100, 145, 68, 85, 109, 151, 77, 103, 134, 174,
+ 96, 118, 161, 206, 120, 136, 185, 239, 145, 158, 208, 271, 162, 172,
+ 222, 286,
+ /* Size 8x4 */
+ 64, 65, 68, 77, 96, 120, 145, 162, 71, 73, 85, 103, 118, 136, 158, 172,
+ 103, 100, 109, 134, 161, 185, 208, 222, 155, 145, 151, 174, 206, 239,
+ 271, 286,
+ /* Size 8x16 */
+ 64, 63, 67, 81, 103, 131, 158, 177, 63, 64, 67, 78, 98, 123, 149, 166,
+ 63, 65, 68, 77, 95, 119, 143, 159, 64, 66, 72, 81, 96, 117, 139, 155,
+ 67, 68, 77, 89, 104, 124, 145, 159, 72, 71, 84, 103, 117, 136, 157, 170,
+ 79, 77, 88, 109, 127, 147, 168, 182, 88, 83, 93, 118, 139, 159, 180,
+ 196, 96, 90, 100, 125, 148, 171, 192, 209, 107, 99, 107, 132, 159, 185,
+ 207, 224, 117, 108, 115, 140, 168, 196, 220, 237, 132, 121, 126, 151,
+ 181, 212, 238, 253, 149, 135, 139, 163, 194, 227, 256, 267, 162, 147,
+ 150, 173, 204, 240, 271, 285, 172, 156, 157, 181, 212, 248, 280, 292,
+ 183, 166, 164, 185, 212, 245, 282, 306,
+ /* Size 16x8 */
+ 64, 63, 63, 64, 67, 72, 79, 88, 96, 107, 117, 132, 149, 162, 172, 183,
+ 63, 64, 65, 66, 68, 71, 77, 83, 90, 99, 108, 121, 135, 147, 156, 166,
+ 67, 67, 68, 72, 77, 84, 88, 93, 100, 107, 115, 126, 139, 150, 157, 164,
+ 81, 78, 77, 81, 89, 103, 109, 118, 125, 132, 140, 151, 163, 173, 181,
+ 185, 103, 98, 95, 96, 104, 117, 127, 139, 148, 159, 168, 181, 194, 204,
+ 212, 212, 131, 123, 119, 117, 124, 136, 147, 159, 171, 185, 196, 212,
+ 227, 240, 248, 245, 158, 149, 143, 139, 145, 157, 168, 180, 192, 207,
+ 220, 238, 256, 271, 280, 282, 177, 166, 159, 155, 159, 170, 182, 196,
+ 209, 224, 237, 253, 267, 285, 292, 306,
+ /* Size 16x32 */
+ 64, 63, 63, 64, 67, 72, 81, 88, 103, 107, 131, 133, 158, 163, 177, 186,
+ 63, 64, 64, 65, 67, 71, 79, 85, 99, 103, 124, 127, 151, 155, 168, 176,
+ 63, 64, 64, 65, 67, 70, 78, 84, 98, 102, 123, 125, 149, 153, 166, 176,
+ 63, 65, 65, 66, 67, 69, 76, 82, 95, 99, 119, 121, 144, 148, 160, 167,
+ 63, 65, 65, 67, 68, 71, 77, 83, 95, 99, 119, 121, 143, 147, 159, 168,
+ 64, 65, 66, 68, 70, 73, 79, 84, 96, 100, 118, 120, 142, 145, 157, 164,
+ 64, 65, 66, 70, 72, 75, 81, 85, 96, 99, 117, 119, 139, 143, 155, 165,
+ 64, 66, 67, 71, 73, 77, 82, 85, 96, 99, 116, 118, 138, 141, 152, 158,
+ 67, 67, 68, 73, 77, 83, 89, 93, 104, 107, 124, 126, 145, 149, 159, 159,
+ 68, 68, 69, 74, 78, 85, 91, 96, 106, 109, 126, 128, 147, 151, 162, 174,
+ 72, 69, 71, 77, 84, 96, 103, 108, 117, 120, 136, 138, 157, 160, 170,
+ 169, 72, 70, 71, 77, 84, 96, 103, 108, 118, 121, 137, 139, 158, 161,
+ 171, 184, 79, 75, 77, 81, 88, 101, 109, 116, 127, 130, 147, 149, 168,
+ 171, 182, 178, 81, 77, 78, 83, 90, 103, 112, 119, 130, 134, 150, 152,
+ 171, 174, 181, 196, 88, 82, 83, 86, 93, 107, 118, 126, 139, 143, 159,
+ 161, 180, 183, 196, 188, 92, 86, 87, 89, 97, 110, 121, 130, 144, 147,
+ 165, 167, 186, 189, 194, 211, 96, 90, 90, 93, 100, 113, 125, 134, 148,
+ 152, 171, 173, 192, 196, 209, 200, 104, 96, 97, 98, 105, 118, 130, 140,
+ 156, 161, 180, 182, 202, 206, 210, 225, 107, 99, 99, 100, 107, 120, 132,
+ 142, 159, 164, 185, 187, 207, 210, 224, 213, 116, 107, 107, 107, 114,
+ 127, 139, 149, 167, 173, 195, 197, 219, 222, 227, 244, 117, 108, 108,
+ 108, 115, 127, 140, 150, 168, 174, 196, 198, 220, 224, 237, 228, 130,
+ 120, 119, 117, 124, 136, 149, 159, 179, 185, 210, 212, 236, 239, 246,
+ 258, 132, 122, 121, 119, 126, 138, 151, 161, 181, 187, 212, 214, 238,
+ 242, 253, 242, 142, 131, 130, 127, 134, 146, 159, 169, 189, 195, 222,
+ 224, 250, 254, 265, 280, 149, 136, 135, 132, 139, 150, 163, 173, 194,
+ 200, 227, 230, 256, 260, 267, 259, 159, 145, 144, 140, 147, 158, 171,
+ 181, 202, 208, 236, 239, 267, 271, 287, 295, 162, 148, 147, 143, 150,
+ 161, 173, 183, 204, 210, 240, 242, 271, 275, 285, 275, 165, 151, 149,
+ 145, 151, 162, 175, 185, 206, 212, 242, 244, 273, 278, 294, 322, 172,
+ 157, 156, 151, 157, 168, 181, 190, 212, 218, 248, 250, 280, 285, 292,
+ 294, 178, 162, 161, 155, 161, 172, 183, 195, 212, 222, 247, 253, 286,
+ 286, 305, 311, 183, 167, 166, 159, 164, 176, 185, 198, 212, 226, 245,
+ 257, 282, 291, 306, 301, 189, 171, 172, 163, 164, 186, 180, 212, 202,
+ 245, 230, 281, 261, 321, 296, 327,
+ /* Size 32x16 */
+ 64, 63, 63, 63, 63, 64, 64, 64, 67, 68, 72, 72, 79, 81, 88, 92, 96, 104,
+ 107, 116, 117, 130, 132, 142, 149, 159, 162, 165, 172, 178, 183, 189,
+ 63, 64, 64, 65, 65, 65, 65, 66, 67, 68, 69, 70, 75, 77, 82, 86, 90, 96,
+ 99, 107, 108, 120, 122, 131, 136, 145, 148, 151, 157, 162, 167, 171, 63,
+ 64, 64, 65, 65, 66, 66, 67, 68, 69, 71, 71, 77, 78, 83, 87, 90, 97, 99,
+ 107, 108, 119, 121, 130, 135, 144, 147, 149, 156, 161, 166, 172, 64, 65,
+ 65, 66, 67, 68, 70, 71, 73, 74, 77, 77, 81, 83, 86, 89, 93, 98, 100,
+ 107, 108, 117, 119, 127, 132, 140, 143, 145, 151, 155, 159, 163, 67, 67,
+ 67, 67, 68, 70, 72, 73, 77, 78, 84, 84, 88, 90, 93, 97, 100, 105, 107,
+ 114, 115, 124, 126, 134, 139, 147, 150, 151, 157, 161, 164, 164, 72, 71,
+ 70, 69, 71, 73, 75, 77, 83, 85, 96, 96, 101, 103, 107, 110, 113, 118,
+ 120, 127, 127, 136, 138, 146, 150, 158, 161, 162, 168, 172, 176, 186,
+ 81, 79, 78, 76, 77, 79, 81, 82, 89, 91, 103, 103, 109, 112, 118, 121,
+ 125, 130, 132, 139, 140, 149, 151, 159, 163, 171, 173, 175, 181, 183,
+ 185, 180, 88, 85, 84, 82, 83, 84, 85, 85, 93, 96, 108, 108, 116, 119,
+ 126, 130, 134, 140, 142, 149, 150, 159, 161, 169, 173, 181, 183, 185,
+ 190, 195, 198, 212, 103, 99, 98, 95, 95, 96, 96, 96, 104, 106, 117, 118,
+ 127, 130, 139, 144, 148, 156, 159, 167, 168, 179, 181, 189, 194, 202,
+ 204, 206, 212, 212, 212, 202, 107, 103, 102, 99, 99, 100, 99, 99, 107,
+ 109, 120, 121, 130, 134, 143, 147, 152, 161, 164, 173, 174, 185, 187,
+ 195, 200, 208, 210, 212, 218, 222, 226, 245, 131, 124, 123, 119, 119,
+ 118, 117, 116, 124, 126, 136, 137, 147, 150, 159, 165, 171, 180, 185,
+ 195, 196, 210, 212, 222, 227, 236, 240, 242, 248, 247, 245, 230, 133,
+ 127, 125, 121, 121, 120, 119, 118, 126, 128, 138, 139, 149, 152, 161,
+ 167, 173, 182, 187, 197, 198, 212, 214, 224, 230, 239, 242, 244, 250,
+ 253, 257, 281, 158, 151, 149, 144, 143, 142, 139, 138, 145, 147, 157,
+ 158, 168, 171, 180, 186, 192, 202, 207, 219, 220, 236, 238, 250, 256,
+ 267, 271, 273, 280, 286, 282, 261, 163, 155, 153, 148, 147, 145, 143,
+ 141, 149, 151, 160, 161, 171, 174, 183, 189, 196, 206, 210, 222, 224,
+ 239, 242, 254, 260, 271, 275, 278, 285, 286, 291, 321, 177, 168, 166,
+ 160, 159, 157, 155, 152, 159, 162, 170, 171, 182, 181, 196, 194, 209,
+ 210, 224, 227, 237, 246, 253, 265, 267, 287, 285, 294, 292, 305, 306,
+ 296, 186, 176, 176, 167, 168, 164, 165, 158, 159, 174, 169, 184, 178,
+ 196, 188, 211, 200, 225, 213, 244, 228, 258, 242, 280, 259, 295, 275,
+ 322, 294, 311, 301, 327,
+ /* Size 4x16 */
+ 63, 72, 107, 163, 64, 70, 102, 153, 65, 71, 99, 147, 65, 75, 99, 143,
+ 67, 83, 107, 149, 69, 96, 120, 160, 75, 101, 130, 171, 82, 107, 143,
+ 183, 90, 113, 152, 196, 99, 120, 164, 210, 108, 127, 174, 224, 122, 138,
+ 187, 242, 136, 150, 200, 260, 148, 161, 210, 275, 157, 168, 218, 285,
+ 167, 176, 226, 291,
+ /* Size 16x4 */
+ 63, 64, 65, 65, 67, 69, 75, 82, 90, 99, 108, 122, 136, 148, 157, 167,
+ 72, 70, 71, 75, 83, 96, 101, 107, 113, 120, 127, 138, 150, 161, 168,
+ 176, 107, 102, 99, 99, 107, 120, 130, 143, 152, 164, 174, 187, 200, 210,
+ 218, 226, 163, 153, 147, 143, 149, 160, 171, 183, 196, 210, 224, 242,
+ 260, 275, 285, 291,
+ /* Size 8x32 */
+ 64, 63, 67, 81, 103, 131, 158, 177, 63, 64, 67, 79, 99, 124, 151, 168,
+ 63, 64, 67, 78, 98, 123, 149, 166, 63, 65, 67, 76, 95, 119, 144, 160,
+ 63, 65, 68, 77, 95, 119, 143, 159, 64, 66, 70, 79, 96, 118, 142, 157,
+ 64, 66, 72, 81, 96, 117, 139, 155, 64, 67, 73, 82, 96, 116, 138, 152,
+ 67, 68, 77, 89, 104, 124, 145, 159, 68, 69, 78, 91, 106, 126, 147, 162,
+ 72, 71, 84, 103, 117, 136, 157, 170, 72, 71, 84, 103, 118, 137, 158,
+ 171, 79, 77, 88, 109, 127, 147, 168, 182, 81, 78, 90, 112, 130, 150,
+ 171, 181, 88, 83, 93, 118, 139, 159, 180, 196, 92, 87, 97, 121, 144,
+ 165, 186, 194, 96, 90, 100, 125, 148, 171, 192, 209, 104, 97, 105, 130,
+ 156, 180, 202, 210, 107, 99, 107, 132, 159, 185, 207, 224, 116, 107,
+ 114, 139, 167, 195, 219, 227, 117, 108, 115, 140, 168, 196, 220, 237,
+ 130, 119, 124, 149, 179, 210, 236, 246, 132, 121, 126, 151, 181, 212,
+ 238, 253, 142, 130, 134, 159, 189, 222, 250, 265, 149, 135, 139, 163,
+ 194, 227, 256, 267, 159, 144, 147, 171, 202, 236, 267, 287, 162, 147,
+ 150, 173, 204, 240, 271, 285, 165, 149, 151, 175, 206, 242, 273, 294,
+ 172, 156, 157, 181, 212, 248, 280, 292, 178, 161, 161, 183, 212, 247,
+ 286, 305, 183, 166, 164, 185, 212, 245, 282, 306, 189, 172, 164, 180,
+ 202, 230, 261, 296,
+ /* Size 32x8 */
+ 64, 63, 63, 63, 63, 64, 64, 64, 67, 68, 72, 72, 79, 81, 88, 92, 96, 104,
+ 107, 116, 117, 130, 132, 142, 149, 159, 162, 165, 172, 178, 183, 189,
+ 63, 64, 64, 65, 65, 66, 66, 67, 68, 69, 71, 71, 77, 78, 83, 87, 90, 97,
+ 99, 107, 108, 119, 121, 130, 135, 144, 147, 149, 156, 161, 166, 172, 67,
+ 67, 67, 67, 68, 70, 72, 73, 77, 78, 84, 84, 88, 90, 93, 97, 100, 105,
+ 107, 114, 115, 124, 126, 134, 139, 147, 150, 151, 157, 161, 164, 164,
+ 81, 79, 78, 76, 77, 79, 81, 82, 89, 91, 103, 103, 109, 112, 118, 121,
+ 125, 130, 132, 139, 140, 149, 151, 159, 163, 171, 173, 175, 181, 183,
+ 185, 180, 103, 99, 98, 95, 95, 96, 96, 96, 104, 106, 117, 118, 127, 130,
+ 139, 144, 148, 156, 159, 167, 168, 179, 181, 189, 194, 202, 204, 206,
+ 212, 212, 212, 202, 131, 124, 123, 119, 119, 118, 117, 116, 124, 126,
+ 136, 137, 147, 150, 159, 165, 171, 180, 185, 195, 196, 210, 212, 222,
+ 227, 236, 240, 242, 248, 247, 245, 230, 158, 151, 149, 144, 143, 142,
+ 139, 138, 145, 147, 157, 158, 168, 171, 180, 186, 192, 202, 207, 219,
+ 220, 236, 238, 250, 256, 267, 271, 273, 280, 286, 282, 261, 177, 168,
+ 166, 160, 159, 157, 155, 152, 159, 162, 170, 171, 182, 181, 196, 194,
+ 209, 210, 224, 227, 237, 246, 253, 265, 267, 287, 285, 294, 292, 305,
+ 306, 296 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 95, 104, 104, 164,
+#endif
+ /* Size 4x4 */
+ 64, 93, 99, 117, 93, 106, 111, 124, 99, 111, 141, 157, 117, 124, 157,
183,
- /* Size 8 */
- 64, 53, 90, 94, 100, 110, 121, 134, 53, 73, 91, 84, 86, 93, 103, 115,
- 90, 91, 104, 101, 101, 105, 113, 123, 94, 84, 101, 112, 117, 121, 127,
- 135, 100, 86, 101, 117, 128, 135, 141, 148, 110, 93, 105, 121, 135, 145,
- 153, 160, 121, 103, 113, 127, 141, 153, 163, 170, 134, 115, 123, 135,
- 148, 160, 170, 179,
- /* Size 16 */
- 64, 58, 53, 66, 90, 92, 94, 97, 100, 105, 110, 115, 121, 127, 134, 134,
- 58, 59, 61, 73, 90, 90, 89, 90, 92, 96, 101, 106, 112, 117, 123, 123,
- 53, 61, 73, 81, 91, 87, 84, 85, 86, 89, 93, 98, 103, 109, 115, 115, 66,
- 73, 81, 89, 97, 94, 92, 92, 93, 96, 99, 103, 108, 113, 119, 119, 90, 90,
- 91, 97, 104, 103, 101, 101, 101, 103, 105, 109, 113, 118, 123, 123, 92,
- 90, 87, 94, 103, 105, 107, 107, 108, 110, 113, 116, 120, 124, 128, 128,
- 94, 89, 84, 92, 101, 107, 112, 115, 117, 119, 121, 124, 127, 131, 135,
- 135, 97, 90, 85, 92, 101, 107, 115, 118, 122, 125, 128, 131, 134, 137,
- 141, 141, 100, 92, 86, 93, 101, 108, 117, 122, 128, 131, 135, 138, 141,
- 144, 148, 148, 105, 96, 89, 96, 103, 110, 119, 125, 131, 135, 140, 143,
- 147, 150, 154, 154, 110, 101, 93, 99, 105, 113, 121, 128, 135, 140, 145,
- 149, 153, 157, 160, 160, 115, 106, 98, 103, 109, 116, 124, 131, 138,
- 143, 149, 153, 158, 161, 165, 165, 121, 112, 103, 108, 113, 120, 127,
- 134, 141, 147, 153, 158, 163, 166, 170, 170, 127, 117, 109, 113, 118,
- 124, 131, 137, 144, 150, 157, 161, 166, 170, 174, 174, 134, 123, 115,
- 119, 123, 128, 135, 141, 148, 154, 160, 165, 170, 174, 179, 179, 134,
- 123, 115, 119, 123, 128, 135, 141, 148, 154, 160, 165, 170, 174, 179,
- 179,
- /* Size 32 */
- 64, 61, 58, 55, 53, 59, 66, 76, 90, 91, 92, 93, 94, 96, 97, 98, 100,
- 102, 105, 107, 110, 112, 115, 118, 121, 124, 127, 131, 134, 134, 134,
- 134, 61, 60, 59, 58, 57, 62, 70, 78, 90, 90, 91, 91, 91, 93, 94, 95, 96,
- 98, 100, 103, 105, 108, 110, 113, 116, 119, 122, 125, 129, 129, 129,
- 129, 58, 59, 59, 60, 61, 67, 73, 81, 90, 90, 90, 89, 89, 90, 90, 91, 92,
- 94, 96, 98, 101, 103, 106, 109, 112, 114, 117, 120, 123, 123, 123, 123,
- 55, 58, 60, 63, 67, 72, 77, 83, 91, 90, 88, 87, 86, 87, 87, 88, 89, 91,
- 93, 95, 97, 99, 102, 104, 107, 110, 113, 116, 119, 119, 119, 119, 53,
- 57, 61, 67, 73, 77, 81, 86, 91, 89, 87, 85, 84, 84, 85, 85, 86, 88, 89,
- 91, 93, 95, 98, 100, 103, 106, 109, 111, 115, 115, 115, 115, 59, 62, 67,
- 72, 77, 81, 85, 89, 94, 92, 91, 89, 87, 88, 88, 89, 89, 91, 92, 94, 96,
- 98, 100, 103, 105, 108, 111, 114, 117, 117, 117, 117, 66, 70, 73, 77,
- 81, 85, 89, 93, 97, 96, 94, 93, 92, 92, 92, 92, 93, 94, 96, 97, 99, 101,
- 103, 105, 108, 110, 113, 116, 119, 119, 119, 119, 76, 78, 81, 83, 86,
- 89, 93, 97, 101, 99, 98, 97, 96, 96, 96, 97, 97, 98, 99, 101, 102, 104,
- 106, 108, 110, 113, 115, 118, 121, 121, 121, 121, 90, 90, 90, 91, 91,
- 94, 97, 101, 104, 103, 103, 102, 101, 101, 101, 101, 101, 102, 103, 104,
- 105, 107, 109, 111, 113, 115, 118, 120, 123, 123, 123, 123, 91, 90, 90,
- 90, 89, 92, 96, 99, 103, 104, 104, 104, 104, 104, 104, 104, 105, 106,
- 107, 108, 109, 111, 112, 114, 116, 118, 121, 123, 126, 126, 126, 126,
- 92, 91, 90, 88, 87, 91, 94, 98, 103, 104, 105, 106, 107, 107, 107, 108,
- 108, 109, 110, 112, 113, 114, 116, 118, 120, 122, 124, 126, 128, 128,
- 128, 128, 93, 91, 89, 87, 85, 89, 93, 97, 102, 104, 106, 107, 109, 110,
- 111, 112, 112, 113, 115, 116, 117, 118, 120, 121, 123, 125, 127, 129,
- 131, 131, 131, 131, 94, 91, 89, 86, 84, 87, 92, 96, 101, 104, 107, 109,
- 112, 113, 115, 116, 117, 118, 119, 120, 121, 122, 124, 125, 127, 129,
- 131, 133, 135, 135, 135, 135, 96, 93, 90, 87, 84, 88, 92, 96, 101, 104,
- 107, 110, 113, 115, 116, 118, 119, 121, 122, 123, 124, 126, 127, 129,
- 130, 132, 134, 136, 138, 138, 138, 138, 97, 94, 90, 87, 85, 88, 92, 96,
- 101, 104, 107, 111, 115, 116, 118, 120, 122, 123, 125, 126, 128, 129,
- 131, 132, 134, 135, 137, 139, 141, 141, 141, 141, 98, 95, 91, 88, 85,
- 89, 92, 97, 101, 104, 108, 112, 116, 118, 120, 122, 125, 126, 128, 130,
- 131, 133, 134, 136, 137, 139, 141, 142, 144, 144, 144, 144, 100, 96, 92,
- 89, 86, 89, 93, 97, 101, 105, 108, 112, 117, 119, 122, 125, 128, 130,
- 131, 133, 135, 136, 138, 140, 141, 143, 144, 146, 148, 148, 148, 148,
- 102, 98, 94, 91, 88, 91, 94, 98, 102, 106, 109, 113, 118, 121, 123, 126,
- 130, 131, 133, 135, 137, 139, 141, 142, 144, 146, 147, 149, 151, 151,
- 151, 151, 105, 100, 96, 93, 89, 92, 96, 99, 103, 107, 110, 115, 119,
- 122, 125, 128, 131, 133, 135, 138, 140, 142, 143, 145, 147, 149, 150,
- 152, 154, 154, 154, 154, 107, 103, 98, 95, 91, 94, 97, 101, 104, 108,
- 112, 116, 120, 123, 126, 130, 133, 135, 138, 140, 143, 144, 146, 148,
- 150, 152, 153, 155, 157, 157, 157, 157, 110, 105, 101, 97, 93, 96, 99,
- 102, 105, 109, 113, 117, 121, 124, 128, 131, 135, 137, 140, 143, 145,
- 147, 149, 151, 153, 155, 157, 158, 160, 160, 160, 160, 112, 108, 103,
- 99, 95, 98, 101, 104, 107, 111, 114, 118, 122, 126, 129, 133, 136, 139,
- 142, 144, 147, 149, 151, 153, 156, 157, 159, 161, 162, 162, 162, 162,
- 115, 110, 106, 102, 98, 100, 103, 106, 109, 112, 116, 120, 124, 127,
- 131, 134, 138, 141, 143, 146, 149, 151, 153, 156, 158, 160, 161, 163,
- 165, 165, 165, 165, 118, 113, 109, 104, 100, 103, 105, 108, 111, 114,
- 118, 121, 125, 129, 132, 136, 140, 142, 145, 148, 151, 153, 156, 158,
- 160, 162, 164, 166, 168, 168, 168, 168, 121, 116, 112, 107, 103, 105,
- 108, 110, 113, 116, 120, 123, 127, 130, 134, 137, 141, 144, 147, 150,
- 153, 156, 158, 160, 163, 165, 166, 168, 170, 170, 170, 170, 124, 119,
- 114, 110, 106, 108, 110, 113, 115, 118, 122, 125, 129, 132, 135, 139,
- 143, 146, 149, 152, 155, 157, 160, 162, 165, 166, 168, 170, 172, 172,
- 172, 172, 127, 122, 117, 113, 109, 111, 113, 115, 118, 121, 124, 127,
- 131, 134, 137, 141, 144, 147, 150, 153, 157, 159, 161, 164, 166, 168,
- 170, 172, 174, 174, 174, 174, 131, 125, 120, 116, 111, 114, 116, 118,
- 120, 123, 126, 129, 133, 136, 139, 142, 146, 149, 152, 155, 158, 161,
- 163, 166, 168, 170, 172, 174, 177, 177, 177, 177, 134, 129, 123, 119,
- 115, 117, 119, 121, 123, 126, 128, 131, 135, 138, 141, 144, 148, 151,
- 154, 157, 160, 162, 165, 168, 170, 172, 174, 177, 179, 179, 179, 179,
- 134, 129, 123, 119, 115, 117, 119, 121, 123, 126, 128, 131, 135, 138,
- 141, 144, 148, 151, 154, 157, 160, 162, 165, 168, 170, 172, 174, 177,
- 179, 179, 179, 179, 134, 129, 123, 119, 115, 117, 119, 121, 123, 126,
- 128, 131, 135, 138, 141, 144, 148, 151, 154, 157, 160, 162, 165, 168,
- 170, 172, 174, 177, 179, 179, 179, 179, 134, 129, 123, 119, 115, 117,
- 119, 121, 123, 126, 128, 131, 135, 138, 141, 144, 148, 151, 154, 157,
- 160, 162, 165, 168, 170, 172, 174, 177, 179, 179, 179, 179 },
- { /* Intra matrices */
- /* Size 4 */
- 31, 47, 51, 63, 47, 56, 59, 67, 51, 59, 74, 82, 63, 67, 82, 95,
- /* Size 8 */
- 33, 27, 47, 50, 53, 58, 65, 72, 27, 38, 48, 44, 45, 49, 55, 61, 47, 48,
- 55, 54, 53, 56, 60, 66, 50, 44, 54, 60, 62, 65, 68, 73, 53, 45, 53, 62,
- 69, 73, 76, 80, 58, 49, 56, 65, 73, 79, 84, 88, 65, 55, 60, 68, 76, 84,
- 89, 94, 72, 61, 66, 73, 80, 88, 94, 99,
- /* Size 16 */
- 32, 29, 26, 33, 46, 47, 48, 50, 51, 54, 57, 60, 63, 67, 70, 70, 29, 30,
- 31, 37, 46, 46, 45, 46, 47, 50, 52, 55, 58, 61, 65, 65, 26, 31, 37, 41,
- 47, 45, 43, 43, 44, 46, 48, 50, 53, 56, 60, 60, 33, 37, 41, 45, 50, 48,
- 47, 47, 48, 49, 51, 53, 56, 59, 62, 62, 46, 46, 47, 50, 54, 53, 52, 52,
- 52, 53, 55, 57, 59, 61, 64, 64, 47, 46, 45, 48, 53, 54, 55, 56, 56, 57,
- 59, 60, 62, 65, 67, 67, 48, 45, 43, 47, 52, 55, 58, 60, 61, 62, 63, 65,
- 67, 69, 71, 71, 50, 46, 43, 47, 52, 56, 60, 62, 64, 65, 67, 69, 70, 72,
- 74, 74, 51, 47, 44, 48, 52, 56, 61, 64, 67, 69, 71, 73, 75, 76, 78, 78,
- 54, 50, 46, 49, 53, 57, 62, 65, 69, 71, 74, 76, 78, 80, 82, 82, 57, 52,
- 48, 51, 55, 59, 63, 67, 71, 74, 77, 79, 82, 84, 86, 86, 60, 55, 50, 53,
- 57, 60, 65, 69, 73, 76, 79, 82, 84, 86, 89, 89, 63, 58, 53, 56, 59, 62,
- 67, 70, 75, 78, 82, 84, 87, 89, 92, 92, 67, 61, 56, 59, 61, 65, 69, 72,
- 76, 80, 84, 86, 89, 92, 94, 94, 70, 65, 60, 62, 64, 67, 71, 74, 78, 82,
- 86, 89, 92, 94, 97, 97, 70, 65, 60, 62, 64, 67, 71, 74, 78, 82, 86, 89,
- 92, 94, 97, 97,
- /* Size 32 */
- 32, 30, 29, 27, 26, 29, 33, 38, 45, 46, 47, 47, 48, 49, 49, 50, 51, 52,
- 53, 55, 56, 58, 59, 61, 63, 64, 66, 68, 70, 70, 70, 70, 30, 30, 29, 29,
- 28, 31, 35, 39, 46, 46, 46, 46, 46, 47, 47, 48, 49, 50, 51, 52, 54, 55,
- 57, 58, 60, 61, 63, 65, 67, 67, 67, 67, 29, 29, 30, 30, 30, 33, 37, 41,
- 46, 46, 45, 45, 45, 45, 46, 46, 47, 48, 49, 50, 51, 53, 54, 56, 57, 59,
- 60, 62, 64, 64, 64, 64, 27, 29, 30, 32, 33, 36, 39, 42, 46, 45, 45, 44,
- 43, 44, 44, 45, 45, 46, 47, 48, 49, 50, 52, 53, 55, 56, 58, 59, 61, 61,
- 61, 61, 26, 28, 30, 33, 37, 39, 41, 43, 46, 45, 44, 43, 42, 42, 43, 43,
- 43, 44, 45, 46, 47, 48, 50, 51, 53, 54, 56, 57, 59, 59, 59, 59, 29, 31,
- 33, 36, 39, 41, 43, 45, 48, 47, 46, 45, 44, 44, 45, 45, 45, 46, 47, 48,
- 49, 50, 51, 52, 54, 55, 57, 58, 60, 60, 60, 60, 33, 35, 37, 39, 41, 43,
- 45, 47, 49, 49, 48, 47, 46, 47, 47, 47, 47, 48, 49, 49, 50, 51, 53, 54,
- 55, 57, 58, 59, 61, 61, 61, 61, 38, 39, 41, 42, 43, 45, 47, 49, 51, 51,
- 50, 49, 49, 49, 49, 49, 49, 50, 51, 51, 52, 53, 54, 55, 57, 58, 59, 61,
- 62, 62, 62, 62, 45, 46, 46, 46, 46, 48, 49, 51, 53, 53, 52, 52, 52, 52,
- 52, 51, 51, 52, 53, 53, 54, 55, 56, 57, 58, 59, 61, 62, 63, 63, 63, 63,
- 46, 46, 46, 45, 45, 47, 49, 51, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54,
- 55, 55, 56, 57, 58, 59, 60, 61, 62, 64, 65, 65, 65, 65, 47, 46, 45, 45,
- 44, 46, 48, 50, 52, 53, 53, 54, 54, 55, 55, 55, 55, 56, 57, 57, 58, 59,
- 60, 61, 62, 63, 64, 65, 67, 67, 67, 67, 47, 46, 45, 44, 43, 45, 47, 49,
- 52, 53, 54, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 61, 62, 63, 64, 65,
- 66, 67, 68, 68, 68, 68, 48, 46, 45, 43, 42, 44, 46, 49, 52, 53, 54, 56,
- 58, 58, 59, 59, 60, 61, 61, 62, 62, 63, 64, 65, 66, 67, 68, 69, 70, 70,
- 70, 70, 49, 47, 45, 44, 42, 44, 47, 49, 52, 53, 55, 56, 58, 59, 60, 61,
- 62, 62, 63, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 72, 72, 72, 49, 47,
- 46, 44, 43, 45, 47, 49, 52, 53, 55, 57, 59, 60, 61, 62, 63, 64, 64, 65,
- 66, 67, 68, 69, 69, 70, 71, 72, 74, 74, 74, 74, 50, 48, 46, 45, 43, 45,
- 47, 49, 51, 53, 55, 57, 59, 61, 62, 63, 65, 65, 66, 67, 68, 69, 70, 71,
- 72, 72, 73, 74, 75, 75, 75, 75, 51, 49, 47, 45, 43, 45, 47, 49, 51, 53,
- 55, 58, 60, 62, 63, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 76,
- 77, 77, 77, 77, 52, 50, 48, 46, 44, 46, 48, 50, 52, 54, 56, 58, 61, 62,
- 64, 65, 67, 68, 69, 70, 72, 72, 73, 74, 75, 76, 77, 78, 79, 79, 79, 79,
- 53, 51, 49, 47, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 64, 66, 68, 69,
- 70, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 81, 81, 81, 55, 52, 50, 48,
- 46, 48, 49, 51, 53, 55, 57, 59, 62, 63, 65, 67, 69, 70, 72, 73, 75, 76,
- 77, 78, 79, 80, 81, 82, 83, 83, 83, 83, 56, 54, 51, 49, 47, 49, 50, 52,
- 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 73, 75, 76, 77, 78, 79, 81, 82,
- 83, 84, 85, 85, 85, 85, 58, 55, 53, 50, 48, 50, 51, 53, 55, 57, 59, 61,
- 63, 65, 67, 69, 71, 72, 74, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86, 86,
- 86, 86, 59, 57, 54, 52, 50, 51, 53, 54, 56, 58, 60, 62, 64, 66, 68, 70,
- 72, 73, 75, 77, 78, 80, 81, 82, 83, 84, 85, 86, 87, 87, 87, 87, 61, 58,
- 56, 53, 51, 52, 54, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 74, 76, 78,
- 79, 81, 82, 83, 85, 86, 87, 88, 89, 89, 89, 89, 63, 60, 57, 55, 53, 54,
- 55, 57, 58, 60, 62, 64, 66, 68, 69, 72, 74, 75, 77, 79, 81, 82, 83, 85,
- 86, 87, 88, 89, 91, 91, 91, 91, 64, 61, 59, 56, 54, 55, 57, 58, 59, 61,
- 63, 65, 67, 69, 70, 72, 75, 76, 78, 80, 82, 83, 84, 86, 87, 88, 89, 91,
- 92, 92, 92, 92, 66, 63, 60, 58, 56, 57, 58, 59, 61, 62, 64, 66, 68, 70,
- 71, 73, 76, 77, 79, 81, 83, 84, 85, 87, 88, 89, 91, 92, 93, 93, 93, 93,
- 68, 65, 62, 59, 57, 58, 59, 61, 62, 64, 65, 67, 69, 71, 72, 74, 76, 78,
- 80, 82, 84, 85, 86, 88, 89, 91, 92, 93, 94, 94, 94, 94, 70, 67, 64, 61,
- 59, 60, 61, 62, 63, 65, 67, 68, 70, 72, 74, 75, 77, 79, 81, 83, 85, 86,
- 87, 89, 91, 92, 93, 94, 96, 96, 96, 96, 70, 67, 64, 61, 59, 60, 61, 62,
- 63, 65, 67, 68, 70, 72, 74, 75, 77, 79, 81, 83, 85, 86, 87, 89, 91, 92,
- 93, 94, 96, 96, 96, 96, 70, 67, 64, 61, 59, 60, 61, 62, 63, 65, 67, 68,
- 70, 72, 74, 75, 77, 79, 81, 83, 85, 86, 87, 89, 91, 92, 93, 94, 96, 96,
- 96, 96, 70, 67, 64, 61, 59, 60, 61, 62, 63, 65, 67, 68, 70, 72, 74, 75,
- 77, 79, 81, 83, 85, 86, 87, 89, 91, 92, 93, 94, 96, 96, 96, 96 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 69, 104, 143, 69, 97, 124, 152, 104, 124, 156, 176, 143, 152, 176,
- 192,
- /* Size 8 */
- 64, 50, 54, 68, 86, 104, 122, 137, 50, 56, 54, 62, 76, 93, 109, 125, 54,
- 54, 72, 82, 92, 105, 118, 131, 68, 62, 82, 98, 110, 120, 130, 140, 86,
- 76, 92, 110, 123, 133, 142, 150, 104, 93, 105, 120, 133, 144, 151, 158,
- 122, 109, 118, 130, 142, 151, 158, 164, 137, 125, 131, 140, 150, 158,
- 164, 169,
- /* Size 16 */
- 64, 56, 50, 52, 54, 60, 68, 76, 86, 94, 104, 112, 122, 129, 137, 137,
- 56, 55, 53, 54, 54, 59, 65, 72, 81, 89, 98, 106, 115, 122, 130, 130, 50,
- 53, 56, 55, 54, 58, 62, 69, 76, 84, 93, 100, 109, 116, 125, 125, 52, 54,
- 55, 59, 62, 66, 71, 77, 83, 90, 98, 105, 114, 120, 128, 128, 54, 54, 54,
- 62, 72, 77, 82, 87, 92, 98, 105, 111, 118, 124, 131, 131, 60, 59, 58,
- 66, 77, 82, 89, 94, 100, 106, 112, 118, 124, 130, 136, 136, 68, 65, 62,
- 71, 82, 89, 98, 104, 110, 115, 120, 125, 130, 135, 140, 140, 76, 72, 69,
- 77, 87, 94, 104, 109, 116, 121, 126, 131, 136, 140, 145, 145, 86, 81,
- 76, 83, 92, 100, 110, 116, 123, 128, 133, 138, 142, 146, 150, 150, 94,
- 89, 84, 90, 98, 106, 115, 121, 128, 133, 138, 142, 146, 150, 153, 153,
- 104, 98, 93, 98, 105, 112, 120, 126, 133, 138, 144, 147, 151, 154, 158,
- 158, 112, 106, 100, 105, 111, 118, 125, 131, 138, 142, 147, 151, 155,
- 158, 161, 161, 122, 115, 109, 114, 118, 124, 130, 136, 142, 146, 151,
- 155, 158, 161, 164, 164, 129, 122, 116, 120, 124, 130, 135, 140, 146,
- 150, 154, 158, 161, 164, 166, 166, 137, 130, 125, 128, 131, 136, 140,
- 145, 150, 153, 158, 161, 164, 166, 169, 169, 137, 130, 125, 128, 131,
- 136, 140, 145, 150, 153, 158, 161, 164, 166, 169, 169,
- /* Size 32 */
- 64, 60, 56, 53, 50, 51, 52, 53, 54, 57, 60, 64, 68, 72, 76, 80, 86, 90,
- 94, 99, 104, 108, 112, 117, 122, 125, 129, 132, 137, 137, 137, 137, 60,
- 58, 55, 53, 52, 52, 53, 53, 54, 57, 59, 63, 66, 70, 74, 78, 83, 87, 91,
- 96, 101, 105, 109, 113, 118, 122, 125, 129, 133, 133, 133, 133, 56, 55,
- 55, 54, 53, 53, 54, 54, 54, 56, 59, 62, 65, 68, 72, 76, 81, 84, 89, 93,
- 98, 102, 106, 110, 115, 118, 122, 126, 130, 130, 130, 130, 53, 53, 54,
- 54, 55, 55, 55, 54, 54, 56, 59, 61, 64, 67, 70, 74, 78, 82, 86, 90, 95,
- 99, 103, 107, 112, 115, 119, 123, 127, 127, 127, 127, 50, 52, 53, 55,
- 56, 56, 55, 55, 54, 56, 58, 60, 62, 65, 69, 72, 76, 80, 84, 88, 93, 96,
- 100, 104, 109, 113, 116, 120, 125, 125, 125, 125, 51, 52, 53, 55, 56,
- 56, 57, 57, 58, 60, 62, 64, 66, 69, 72, 76, 80, 83, 87, 91, 95, 99, 103,
- 107, 111, 115, 118, 122, 126, 126, 126, 126, 52, 53, 54, 55, 55, 57, 59,
- 60, 62, 64, 66, 68, 71, 73, 77, 80, 83, 87, 90, 94, 98, 102, 105, 109,
- 114, 117, 120, 124, 128, 128, 128, 128, 53, 53, 54, 54, 55, 57, 60, 63,
- 67, 69, 71, 73, 76, 78, 81, 84, 88, 91, 94, 98, 101, 105, 108, 112, 116,
- 119, 122, 126, 129, 129, 129, 129, 54, 54, 54, 54, 54, 58, 62, 67, 72,
- 74, 77, 79, 82, 84, 87, 89, 92, 95, 98, 101, 105, 108, 111, 115, 118,
- 121, 124, 128, 131, 131, 131, 131, 57, 57, 56, 56, 56, 60, 64, 69, 74,
- 77, 79, 82, 85, 88, 90, 93, 96, 99, 102, 105, 108, 111, 114, 118, 121,
- 124, 127, 130, 133, 133, 133, 133, 60, 59, 59, 59, 58, 62, 66, 71, 77,
- 79, 82, 86, 89, 92, 94, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124,
- 127, 130, 133, 136, 136, 136, 136, 64, 63, 62, 61, 60, 64, 68, 73, 79,
- 82, 86, 89, 93, 96, 99, 102, 105, 107, 110, 113, 116, 118, 121, 124,
- 127, 130, 132, 135, 138, 138, 138, 138, 68, 66, 65, 64, 62, 66, 71, 76,
- 82, 85, 89, 93, 98, 101, 104, 107, 110, 112, 115, 117, 120, 122, 125,
- 128, 130, 133, 135, 138, 140, 140, 140, 140, 72, 70, 68, 67, 65, 69, 73,
- 78, 84, 88, 92, 96, 101, 104, 106, 110, 113, 115, 118, 120, 123, 125,
- 128, 130, 133, 135, 138, 140, 143, 143, 143, 143, 76, 74, 72, 70, 69,
- 72, 77, 81, 87, 90, 94, 99, 104, 106, 109, 113, 116, 119, 121, 124, 126,
- 129, 131, 133, 136, 138, 140, 142, 145, 145, 145, 145, 80, 78, 76, 74,
- 72, 76, 80, 84, 89, 93, 97, 102, 107, 110, 113, 116, 120, 122, 124, 127,
- 130, 132, 134, 136, 139, 141, 143, 145, 147, 147, 147, 147, 86, 83, 81,
- 78, 76, 80, 83, 88, 92, 96, 100, 105, 110, 113, 116, 120, 123, 126, 128,
- 131, 133, 135, 138, 140, 142, 144, 146, 148, 150, 150, 150, 150, 90, 87,
- 84, 82, 80, 83, 87, 91, 95, 99, 103, 107, 112, 115, 119, 122, 126, 128,
- 131, 133, 136, 138, 140, 142, 144, 146, 148, 150, 151, 151, 151, 151,
- 94, 91, 89, 86, 84, 87, 90, 94, 98, 102, 106, 110, 115, 118, 121, 124,
- 128, 131, 133, 136, 138, 140, 142, 144, 146, 148, 150, 152, 153, 153,
- 153, 153, 99, 96, 93, 90, 88, 91, 94, 98, 101, 105, 109, 113, 117, 120,
- 124, 127, 131, 133, 136, 138, 141, 143, 145, 147, 149, 150, 152, 154,
- 155, 155, 155, 155, 104, 101, 98, 95, 93, 95, 98, 101, 105, 108, 112,
- 116, 120, 123, 126, 130, 133, 136, 138, 141, 144, 145, 147, 149, 151,
- 153, 154, 156, 158, 158, 158, 158, 108, 105, 102, 99, 96, 99, 102, 105,
- 108, 111, 115, 118, 122, 125, 129, 132, 135, 138, 140, 143, 145, 147,
- 149, 151, 153, 154, 156, 158, 159, 159, 159, 159, 112, 109, 106, 103,
- 100, 103, 105, 108, 111, 114, 118, 121, 125, 128, 131, 134, 138, 140,
- 142, 145, 147, 149, 151, 153, 155, 156, 158, 159, 161, 161, 161, 161,
- 117, 113, 110, 107, 104, 107, 109, 112, 115, 118, 121, 124, 128, 130,
- 133, 136, 140, 142, 144, 147, 149, 151, 153, 155, 157, 158, 159, 161,
- 162, 162, 162, 162, 122, 118, 115, 112, 109, 111, 114, 116, 118, 121,
- 124, 127, 130, 133, 136, 139, 142, 144, 146, 149, 151, 153, 155, 157,
- 158, 160, 161, 162, 164, 164, 164, 164, 125, 122, 118, 115, 113, 115,
- 117, 119, 121, 124, 127, 130, 133, 135, 138, 141, 144, 146, 148, 150,
- 153, 154, 156, 158, 160, 161, 162, 164, 165, 165, 165, 165, 129, 125,
- 122, 119, 116, 118, 120, 122, 124, 127, 130, 132, 135, 138, 140, 143,
- 146, 148, 150, 152, 154, 156, 158, 159, 161, 162, 164, 165, 166, 166,
- 166, 166, 132, 129, 126, 123, 120, 122, 124, 126, 128, 130, 133, 135,
- 138, 140, 142, 145, 148, 150, 152, 154, 156, 158, 159, 161, 162, 164,
- 165, 166, 167, 167, 167, 167, 137, 133, 130, 127, 125, 126, 128, 129,
- 131, 133, 136, 138, 140, 143, 145, 147, 150, 151, 153, 155, 158, 159,
- 161, 162, 164, 165, 166, 167, 169, 169, 169, 169, 137, 133, 130, 127,
- 125, 126, 128, 129, 131, 133, 136, 138, 140, 143, 145, 147, 150, 151,
- 153, 155, 158, 159, 161, 162, 164, 165, 166, 167, 169, 169, 169, 169,
- 137, 133, 130, 127, 125, 126, 128, 129, 131, 133, 136, 138, 140, 143,
- 145, 147, 150, 151, 153, 155, 158, 159, 161, 162, 164, 165, 166, 167,
- 169, 169, 169, 169, 137, 133, 130, 127, 125, 126, 128, 129, 131, 133,
- 136, 138, 140, 143, 145, 147, 150, 151, 153, 155, 158, 159, 161, 162,
- 164, 165, 166, 167, 169, 169, 169, 169 },
- { /* Intra matrices */
- /* Size 4 */
- 29, 32, 48, 68, 32, 45, 58, 73, 48, 58, 75, 86, 68, 73, 86, 94,
- /* Size 8 */
- 34, 26, 28, 36, 46, 57, 67, 77, 26, 30, 29, 33, 41, 50, 60, 69, 28, 29,
- 39, 44, 50, 57, 65, 73, 36, 33, 44, 53, 60, 66, 73, 79, 46, 41, 50, 60,
- 68, 75, 80, 85, 57, 50, 57, 66, 75, 81, 86, 90, 67, 60, 65, 73, 80, 86,
- 90, 94, 77, 69, 73, 79, 85, 90, 94, 97,
- /* Size 16 */
- 33, 29, 26, 27, 28, 31, 35, 39, 45, 50, 55, 60, 65, 70, 74, 74, 29, 28,
- 27, 27, 28, 30, 34, 37, 42, 47, 52, 56, 62, 66, 71, 71, 26, 27, 29, 28,
- 28, 30, 32, 35, 40, 44, 49, 53, 58, 62, 67, 67, 27, 27, 28, 30, 32, 34,
- 37, 40, 44, 47, 52, 56, 61, 65, 69, 69, 28, 28, 28, 32, 37, 40, 43, 45,
- 49, 52, 56, 59, 64, 67, 71, 71, 31, 30, 30, 34, 40, 43, 47, 50, 53, 56,
- 60, 63, 67, 70, 74, 74, 35, 34, 32, 37, 43, 47, 52, 55, 59, 61, 65, 67,
- 71, 74, 77, 77, 39, 37, 35, 40, 45, 50, 55, 58, 62, 65, 68, 71, 74, 77,
- 79, 79, 45, 42, 40, 44, 49, 53, 59, 62, 66, 69, 72, 75, 78, 80, 82, 82,
- 50, 47, 44, 47, 52, 56, 61, 65, 69, 72, 75, 78, 80, 82, 85, 85, 55, 52,
- 49, 52, 56, 60, 65, 68, 72, 75, 79, 81, 83, 85, 87, 87, 60, 56, 53, 56,
- 59, 63, 67, 71, 75, 78, 81, 83, 85, 87, 89, 89, 65, 62, 58, 61, 64, 67,
- 71, 74, 78, 80, 83, 85, 88, 89, 91, 91, 70, 66, 62, 65, 67, 70, 74, 77,
- 80, 82, 85, 87, 89, 91, 93, 93, 74, 71, 67, 69, 71, 74, 77, 79, 82, 85,
- 87, 89, 91, 93, 94, 94, 74, 71, 67, 69, 71, 74, 77, 79, 82, 85, 87, 89,
- 91, 93, 94, 94,
- /* Size 32 */
- 33, 30, 28, 27, 25, 26, 26, 27, 27, 29, 30, 32, 35, 37, 39, 41, 44, 47,
- 49, 52, 55, 57, 59, 62, 65, 67, 69, 71, 73, 73, 73, 73, 30, 29, 28, 27,
- 26, 26, 27, 27, 27, 29, 30, 32, 34, 36, 38, 40, 43, 45, 47, 50, 53, 55,
- 57, 60, 63, 65, 67, 69, 71, 71, 71, 71, 28, 28, 28, 27, 27, 27, 27, 27,
- 27, 29, 30, 31, 33, 35, 37, 39, 42, 44, 46, 48, 51, 53, 56, 58, 61, 63,
- 65, 67, 70, 70, 70, 70, 27, 27, 27, 27, 28, 28, 28, 27, 27, 28, 30, 31,
- 32, 34, 36, 38, 40, 42, 44, 47, 50, 52, 54, 56, 59, 61, 63, 65, 68, 68,
- 68, 68, 25, 26, 27, 28, 29, 28, 28, 28, 27, 28, 29, 30, 32, 33, 35, 37,
- 39, 41, 43, 45, 48, 50, 52, 55, 57, 59, 61, 64, 66, 66, 66, 66, 26, 26,
- 27, 28, 28, 29, 29, 29, 29, 30, 31, 33, 34, 35, 37, 39, 41, 43, 45, 47,
- 50, 52, 54, 56, 59, 61, 63, 65, 67, 67, 67, 67, 26, 27, 27, 28, 28, 29,
- 30, 31, 32, 33, 34, 35, 36, 38, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
- 60, 62, 64, 66, 68, 68, 68, 68, 27, 27, 27, 27, 28, 29, 31, 32, 34, 35,
- 36, 38, 39, 40, 42, 44, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67,
- 69, 69, 69, 69, 27, 27, 27, 27, 27, 29, 32, 34, 37, 38, 39, 41, 42, 43,
- 45, 46, 48, 49, 51, 53, 55, 57, 59, 61, 63, 64, 66, 68, 70, 70, 70, 70,
- 29, 29, 29, 28, 28, 30, 33, 35, 38, 39, 41, 42, 44, 45, 47, 48, 50, 52,
- 53, 55, 57, 59, 60, 62, 64, 66, 68, 69, 71, 71, 71, 71, 30, 30, 30, 30,
- 29, 31, 34, 36, 39, 41, 42, 44, 46, 48, 49, 51, 52, 54, 55, 57, 59, 61,
- 62, 64, 66, 68, 69, 71, 73, 73, 73, 73, 32, 32, 31, 31, 30, 33, 35, 38,
- 41, 42, 44, 46, 49, 50, 52, 53, 55, 56, 58, 59, 61, 63, 64, 66, 68, 69,
- 71, 72, 74, 74, 74, 74, 35, 34, 33, 32, 32, 34, 36, 39, 42, 44, 46, 49,
- 51, 53, 54, 56, 58, 59, 60, 62, 64, 65, 66, 68, 70, 71, 72, 74, 75, 75,
- 75, 75, 37, 36, 35, 34, 33, 35, 38, 40, 43, 45, 48, 50, 53, 54, 56, 58,
- 59, 61, 62, 64, 65, 67, 68, 70, 71, 73, 74, 75, 77, 77, 77, 77, 39, 38,
- 37, 36, 35, 37, 39, 42, 45, 47, 49, 52, 54, 56, 58, 59, 61, 63, 64, 66,
- 67, 69, 70, 71, 73, 74, 75, 77, 78, 78, 78, 78, 41, 40, 39, 38, 37, 39,
- 41, 44, 46, 48, 51, 53, 56, 58, 59, 61, 63, 65, 66, 68, 69, 71, 72, 73,
- 75, 76, 77, 78, 80, 80, 80, 80, 44, 43, 42, 40, 39, 41, 43, 45, 48, 50,
- 52, 55, 58, 59, 61, 63, 65, 67, 68, 70, 71, 73, 74, 75, 76, 78, 79, 80,
- 81, 81, 81, 81, 47, 45, 44, 42, 41, 43, 45, 47, 49, 52, 54, 56, 59, 61,
- 63, 65, 67, 68, 70, 71, 73, 74, 75, 76, 78, 79, 80, 81, 82, 82, 82, 82,
- 49, 47, 46, 44, 43, 45, 47, 49, 51, 53, 55, 58, 60, 62, 64, 66, 68, 70,
- 71, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 83, 83, 83, 52, 50, 48, 47,
- 45, 47, 49, 51, 53, 55, 57, 59, 62, 64, 66, 68, 70, 71, 73, 74, 76, 77,
- 78, 79, 81, 82, 83, 84, 85, 85, 85, 85, 55, 53, 51, 50, 48, 50, 51, 53,
- 55, 57, 59, 61, 64, 65, 67, 69, 71, 73, 74, 76, 77, 79, 80, 81, 82, 83,
- 84, 85, 86, 86, 86, 86, 57, 55, 53, 52, 50, 52, 53, 55, 57, 59, 61, 63,
- 65, 67, 69, 71, 73, 74, 75, 77, 79, 80, 81, 82, 83, 84, 85, 86, 87, 87,
- 87, 87, 59, 57, 56, 54, 52, 54, 55, 57, 59, 60, 62, 64, 66, 68, 70, 72,
- 74, 75, 77, 78, 80, 81, 82, 83, 84, 85, 86, 87, 88, 88, 88, 88, 62, 60,
- 58, 56, 55, 56, 57, 59, 61, 62, 64, 66, 68, 70, 71, 73, 75, 76, 78, 79,
- 81, 82, 83, 84, 85, 86, 87, 88, 89, 89, 89, 89, 65, 63, 61, 59, 57, 59,
- 60, 61, 63, 64, 66, 68, 70, 71, 73, 75, 76, 78, 79, 81, 82, 83, 84, 85,
- 86, 87, 88, 89, 90, 90, 90, 90, 67, 65, 63, 61, 59, 61, 62, 63, 64, 66,
- 68, 69, 71, 73, 74, 76, 78, 79, 80, 82, 83, 84, 85, 86, 87, 88, 89, 90,
- 90, 90, 90, 90, 69, 67, 65, 63, 61, 63, 64, 65, 66, 68, 69, 71, 72, 74,
- 75, 77, 79, 80, 81, 83, 84, 85, 86, 87, 88, 89, 90, 90, 91, 91, 91, 91,
- 71, 69, 67, 65, 64, 65, 66, 67, 68, 69, 71, 72, 74, 75, 77, 78, 80, 81,
- 82, 84, 85, 86, 87, 88, 89, 90, 90, 91, 92, 92, 92, 92, 73, 71, 70, 68,
- 66, 67, 68, 69, 70, 71, 73, 74, 75, 77, 78, 80, 81, 82, 83, 85, 86, 87,
- 88, 89, 90, 90, 91, 92, 93, 93, 93, 93, 73, 71, 70, 68, 66, 67, 68, 69,
- 70, 71, 73, 74, 75, 77, 78, 80, 81, 82, 83, 85, 86, 87, 88, 89, 90, 90,
- 91, 92, 93, 93, 93, 93, 73, 71, 70, 68, 66, 67, 68, 69, 70, 71, 73, 74,
- 75, 77, 78, 80, 81, 82, 83, 85, 86, 87, 88, 89, 90, 90, 91, 92, 93, 93,
- 93, 93, 73, 71, 70, 68, 66, 67, 68, 69, 70, 71, 73, 74, 75, 77, 78, 80,
- 81, 82, 83, 85, 86, 87, 88, 89, 90, 90, 91, 92, 93, 93, 93, 93 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 94, 100, 120, 94, 108, 114, 126, 100, 114, 136, 149, 120, 126, 149,
- 166,
- /* Size 8 */
- 64, 53, 88, 92, 97, 105, 115, 126, 53, 73, 89, 82, 84, 91, 100, 109, 88,
- 89, 100, 98, 98, 102, 108, 116, 92, 82, 98, 107, 111, 115, 120, 126, 97,
- 84, 98, 111, 121, 127, 132, 137, 105, 91, 102, 115, 127, 135, 142, 147,
- 115, 100, 108, 120, 132, 142, 149, 155, 126, 109, 116, 126, 137, 147,
- 155, 162,
- /* Size 16 */
- 64, 58, 53, 66, 88, 90, 92, 94, 97, 101, 105, 110, 115, 120, 126, 126,
- 58, 60, 61, 72, 88, 87, 87, 88, 90, 94, 97, 102, 107, 112, 117, 117, 53,
- 61, 73, 80, 89, 85, 82, 83, 84, 87, 91, 95, 100, 104, 109, 109, 66, 72,
- 80, 87, 94, 92, 89, 90, 90, 93, 96, 100, 104, 108, 113, 113, 88, 88, 89,
- 94, 100, 99, 98, 98, 98, 100, 102, 105, 108, 112, 116, 116, 90, 87, 85,
- 92, 99, 101, 102, 103, 104, 106, 108, 111, 114, 117, 121, 121, 92, 87,
- 82, 89, 98, 102, 107, 109, 111, 113, 115, 117, 120, 123, 126, 126, 94,
- 88, 83, 90, 98, 103, 109, 113, 116, 118, 121, 123, 126, 128, 132, 132,
- 97, 90, 84, 90, 98, 104, 111, 116, 121, 124, 127, 129, 132, 134, 137,
- 137, 101, 94, 87, 93, 100, 106, 113, 118, 124, 127, 131, 134, 136, 139,
- 142, 142, 105, 97, 91, 96, 102, 108, 115, 121, 127, 131, 135, 138, 142,
- 144, 147, 147, 110, 102, 95, 100, 105, 111, 117, 123, 129, 134, 138,
- 142, 145, 148, 151, 151, 115, 107, 100, 104, 108, 114, 120, 126, 132,
- 136, 142, 145, 149, 152, 155, 155, 120, 112, 104, 108, 112, 117, 123,
- 128, 134, 139, 144, 148, 152, 155, 158, 158, 126, 117, 109, 113, 116,
- 121, 126, 132, 137, 142, 147, 151, 155, 158, 162, 162, 126, 117, 109,
- 113, 116, 121, 126, 132, 137, 142, 147, 151, 155, 158, 162, 162,
- /* Size 32 */
- 64, 61, 58, 56, 53, 59, 66, 75, 88, 89, 90, 91, 92, 93, 94, 95, 97, 99,
- 101, 103, 105, 108, 110, 113, 115, 118, 120, 123, 126, 126, 126, 126,
- 61, 60, 59, 58, 57, 63, 69, 77, 88, 88, 89, 89, 89, 90, 91, 92, 93, 95,
- 97, 99, 101, 103, 106, 108, 111, 113, 116, 118, 121, 121, 121, 121, 58,
- 59, 60, 61, 61, 67, 72, 80, 88, 88, 87, 87, 87, 88, 88, 89, 90, 92, 94,
- 95, 97, 100, 102, 104, 107, 109, 112, 114, 117, 117, 117, 117, 56, 58,
- 61, 63, 67, 71, 76, 82, 89, 88, 86, 85, 84, 85, 86, 86, 87, 89, 90, 92,
- 94, 96, 98, 101, 103, 105, 108, 110, 113, 113, 113, 113, 53, 57, 61, 67,
- 73, 76, 80, 84, 89, 87, 85, 84, 82, 83, 83, 84, 84, 86, 87, 89, 91, 93,
- 95, 97, 100, 102, 104, 107, 109, 109, 109, 109, 59, 63, 67, 71, 76, 80,
- 83, 87, 92, 90, 88, 87, 86, 86, 86, 87, 87, 89, 90, 92, 93, 95, 97, 99,
- 102, 104, 106, 109, 111, 111, 111, 111, 66, 69, 72, 76, 80, 83, 87, 90,
- 94, 93, 92, 91, 89, 90, 90, 90, 90, 92, 93, 94, 96, 98, 100, 102, 104,
- 106, 108, 110, 113, 113, 113, 113, 75, 77, 80, 82, 84, 87, 90, 94, 97,
- 96, 95, 94, 93, 94, 94, 94, 94, 95, 96, 97, 99, 100, 102, 104, 106, 108,
- 110, 112, 115, 115, 115, 115, 88, 88, 88, 89, 89, 92, 94, 97, 100, 100,
- 99, 99, 98, 98, 98, 98, 98, 99, 100, 101, 102, 103, 105, 106, 108, 110,
- 112, 114, 116, 116, 116, 116, 89, 88, 88, 88, 87, 90, 93, 96, 100, 100,
- 100, 100, 100, 100, 100, 101, 101, 102, 103, 104, 105, 106, 108, 109,
- 111, 113, 115, 117, 119, 119, 119, 119, 90, 89, 87, 86, 85, 88, 92, 95,
- 99, 100, 101, 102, 102, 103, 103, 104, 104, 105, 106, 107, 108, 109,
- 111, 112, 114, 116, 117, 119, 121, 121, 121, 121, 91, 89, 87, 85, 84,
- 87, 91, 94, 99, 100, 102, 103, 105, 106, 106, 107, 108, 109, 109, 110,
- 111, 113, 114, 115, 117, 118, 120, 122, 124, 124, 124, 124, 92, 89, 87,
- 84, 82, 86, 89, 93, 98, 100, 102, 105, 107, 108, 109, 110, 111, 112,
- 113, 114, 115, 116, 117, 119, 120, 122, 123, 125, 126, 126, 126, 126,
- 93, 90, 88, 85, 83, 86, 90, 94, 98, 100, 103, 106, 108, 110, 111, 112,
- 114, 115, 116, 117, 118, 119, 120, 121, 123, 124, 126, 127, 129, 129,
- 129, 129, 94, 91, 88, 86, 83, 86, 90, 94, 98, 100, 103, 106, 109, 111,
- 113, 114, 116, 117, 118, 119, 121, 122, 123, 124, 126, 127, 128, 130,
- 132, 132, 132, 132, 95, 92, 89, 86, 84, 87, 90, 94, 98, 101, 104, 107,
- 110, 112, 114, 116, 118, 119, 121, 122, 124, 125, 126, 127, 129, 130,
- 131, 133, 134, 134, 134, 134, 97, 93, 90, 87, 84, 87, 90, 94, 98, 101,
- 104, 108, 111, 114, 116, 118, 121, 122, 124, 125, 127, 128, 129, 130,
- 132, 133, 134, 136, 137, 137, 137, 137, 99, 95, 92, 89, 86, 89, 92, 95,
- 99, 102, 105, 109, 112, 115, 117, 119, 122, 124, 125, 127, 129, 130,
- 131, 133, 134, 135, 137, 138, 139, 139, 139, 139, 101, 97, 94, 90, 87,
- 90, 93, 96, 100, 103, 106, 109, 113, 116, 118, 121, 124, 125, 127, 129,
- 131, 132, 134, 135, 136, 138, 139, 140, 142, 142, 142, 142, 103, 99, 95,
- 92, 89, 92, 94, 97, 101, 104, 107, 110, 114, 117, 119, 122, 125, 127,
- 129, 131, 133, 134, 136, 137, 139, 140, 142, 143, 144, 144, 144, 144,
- 105, 101, 97, 94, 91, 93, 96, 99, 102, 105, 108, 111, 115, 118, 121,
- 124, 127, 129, 131, 133, 135, 137, 138, 140, 142, 143, 144, 146, 147,
- 147, 147, 147, 108, 103, 100, 96, 93, 95, 98, 100, 103, 106, 109, 113,
- 116, 119, 122, 125, 128, 130, 132, 134, 137, 138, 140, 142, 143, 145,
- 146, 148, 149, 149, 149, 149, 110, 106, 102, 98, 95, 97, 100, 102, 105,
- 108, 111, 114, 117, 120, 123, 126, 129, 131, 134, 136, 138, 140, 142,
- 143, 145, 147, 148, 149, 151, 151, 151, 151, 113, 108, 104, 101, 97, 99,
- 102, 104, 106, 109, 112, 115, 119, 121, 124, 127, 130, 133, 135, 137,
- 140, 142, 143, 145, 147, 149, 150, 151, 153, 153, 153, 153, 115, 111,
- 107, 103, 100, 102, 104, 106, 108, 111, 114, 117, 120, 123, 126, 129,
- 132, 134, 136, 139, 142, 143, 145, 147, 149, 151, 152, 154, 155, 155,
- 155, 155, 118, 113, 109, 105, 102, 104, 106, 108, 110, 113, 116, 118,
- 122, 124, 127, 130, 133, 135, 138, 140, 143, 145, 147, 149, 151, 152,
- 154, 155, 157, 157, 157, 157, 120, 116, 112, 108, 104, 106, 108, 110,
- 112, 115, 117, 120, 123, 126, 128, 131, 134, 137, 139, 142, 144, 146,
- 148, 150, 152, 154, 155, 157, 158, 158, 158, 158, 123, 118, 114, 110,
- 107, 109, 110, 112, 114, 117, 119, 122, 125, 127, 130, 133, 136, 138,
- 140, 143, 146, 148, 149, 151, 154, 155, 157, 158, 160, 160, 160, 160,
- 126, 121, 117, 113, 109, 111, 113, 115, 116, 119, 121, 124, 126, 129,
- 132, 134, 137, 139, 142, 144, 147, 149, 151, 153, 155, 157, 158, 160,
- 162, 162, 162, 162, 126, 121, 117, 113, 109, 111, 113, 115, 116, 119,
- 121, 124, 126, 129, 132, 134, 137, 139, 142, 144, 147, 149, 151, 153,
- 155, 157, 158, 160, 162, 162, 162, 162, 126, 121, 117, 113, 109, 111,
- 113, 115, 116, 119, 121, 124, 126, 129, 132, 134, 137, 139, 142, 144,
- 147, 149, 151, 153, 155, 157, 158, 160, 162, 162, 162, 162, 126, 121,
- 117, 113, 109, 111, 113, 115, 116, 119, 121, 124, 126, 129, 132, 134,
- 137, 139, 142, 144, 147, 149, 151, 153, 155, 157, 158, 160, 162, 162,
- 162, 162 },
- { /* Intra matrices */
- /* Size 4 */
- 33, 49, 53, 64, 49, 57, 60, 67, 53, 60, 73, 81, 64, 67, 81, 91,
- /* Size 8 */
- 35, 29, 49, 51, 54, 59, 65, 72, 29, 40, 50, 46, 47, 51, 56, 62, 49, 50,
- 56, 55, 55, 57, 61, 66, 51, 46, 55, 61, 63, 65, 68, 72, 54, 47, 55, 63,
- 69, 72, 76, 79, 59, 51, 57, 65, 72, 78, 82, 85, 65, 56, 61, 68, 76, 82,
- 86, 90, 72, 62, 66, 72, 79, 85, 90, 94,
- /* Size 16 */
- 34, 31, 28, 36, 48, 49, 50, 52, 53, 55, 58, 61, 64, 67, 70, 70, 31, 32,
- 33, 39, 48, 48, 47, 48, 49, 51, 53, 56, 59, 62, 65, 65, 28, 33, 39, 43,
- 49, 47, 45, 45, 46, 48, 50, 52, 55, 57, 61, 61, 36, 39, 43, 47, 52, 50,
- 49, 49, 49, 51, 53, 55, 57, 60, 63, 63, 48, 48, 49, 52, 55, 55, 54, 54,
- 54, 55, 56, 58, 60, 62, 65, 65, 49, 48, 47, 50, 55, 55, 56, 57, 57, 58,
- 60, 61, 63, 65, 68, 68, 50, 47, 45, 49, 54, 56, 59, 61, 62, 63, 64, 65,
- 67, 69, 71, 71, 52, 48, 45, 49, 54, 57, 61, 62, 64, 66, 67, 69, 70, 72,
- 74, 74, 53, 49, 46, 49, 54, 57, 62, 64, 67, 69, 71, 72, 74, 76, 77, 77,
- 55, 51, 48, 51, 55, 58, 63, 66, 69, 71, 73, 75, 77, 78, 80, 80, 58, 53,
- 50, 53, 56, 60, 64, 67, 71, 73, 76, 78, 80, 82, 83, 83, 61, 56, 52, 55,
- 58, 61, 65, 69, 72, 75, 78, 80, 82, 84, 86, 86, 64, 59, 55, 57, 60, 63,
- 67, 70, 74, 77, 80, 82, 85, 86, 88, 88, 67, 62, 57, 60, 62, 65, 69, 72,
- 76, 78, 82, 84, 86, 88, 90, 90, 70, 65, 61, 63, 65, 68, 71, 74, 77, 80,
- 83, 86, 88, 90, 92, 92, 70, 65, 61, 63, 65, 68, 71, 74, 77, 80, 83, 86,
- 88, 90, 92, 92,
- /* Size 32 */
- 34, 32, 31, 29, 28, 31, 35, 40, 47, 48, 48, 49, 50, 50, 51, 52, 52, 54,
- 55, 56, 57, 59, 60, 62, 63, 65, 66, 68, 70, 70, 70, 70, 32, 32, 31, 31,
- 30, 33, 37, 42, 47, 48, 48, 48, 48, 49, 49, 50, 50, 52, 53, 54, 55, 56,
- 58, 59, 61, 62, 64, 65, 67, 67, 67, 67, 31, 31, 32, 32, 33, 35, 39, 43,
- 48, 47, 47, 47, 47, 47, 48, 48, 49, 50, 51, 52, 53, 54, 55, 57, 58, 60,
- 61, 63, 64, 64, 64, 64, 29, 31, 32, 34, 35, 38, 41, 44, 48, 47, 47, 46,
- 45, 46, 46, 47, 47, 48, 49, 50, 51, 52, 53, 55, 56, 57, 59, 60, 62, 62,
- 62, 62, 28, 30, 33, 35, 39, 41, 43, 45, 48, 47, 46, 45, 44, 44, 45, 45,
- 45, 46, 47, 48, 49, 50, 51, 53, 54, 55, 57, 58, 60, 60, 60, 60, 31, 33,
- 35, 38, 41, 43, 45, 47, 50, 49, 48, 47, 46, 46, 47, 47, 47, 48, 49, 50,
- 50, 52, 53, 54, 55, 57, 58, 59, 61, 61, 61, 61, 35, 37, 39, 41, 43, 45,
- 47, 49, 51, 50, 50, 49, 48, 48, 49, 49, 49, 50, 50, 51, 52, 53, 54, 55,
- 57, 58, 59, 60, 62, 62, 62, 62, 40, 42, 43, 44, 45, 47, 49, 51, 53, 52,
- 52, 51, 51, 51, 51, 51, 51, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 62,
- 63, 63, 63, 63, 47, 47, 48, 48, 48, 50, 51, 53, 55, 54, 54, 54, 53, 53,
- 53, 53, 53, 54, 54, 55, 55, 56, 57, 58, 59, 60, 61, 63, 64, 64, 64, 64,
- 48, 48, 47, 47, 47, 49, 50, 52, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55,
- 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 65, 65, 65, 48, 48, 47, 47,
- 46, 48, 50, 52, 54, 54, 55, 55, 56, 56, 56, 56, 57, 57, 58, 58, 59, 60,
- 61, 61, 62, 63, 65, 66, 67, 67, 67, 67, 49, 48, 47, 46, 45, 47, 49, 51,
- 54, 54, 55, 56, 57, 58, 58, 58, 59, 59, 60, 60, 61, 62, 63, 63, 64, 65,
- 66, 67, 68, 68, 68, 68, 50, 48, 47, 45, 44, 46, 48, 51, 53, 54, 56, 57,
- 59, 59, 60, 60, 61, 62, 62, 63, 63, 64, 65, 65, 66, 67, 68, 69, 70, 70,
- 70, 70, 50, 49, 47, 46, 44, 46, 48, 51, 53, 55, 56, 58, 59, 60, 61, 62,
- 62, 63, 63, 64, 65, 65, 66, 67, 68, 69, 69, 70, 71, 71, 71, 71, 51, 49,
- 48, 46, 45, 47, 49, 51, 53, 55, 56, 58, 60, 61, 62, 63, 64, 64, 65, 66,
- 66, 67, 68, 69, 69, 70, 71, 72, 73, 73, 73, 73, 52, 50, 48, 47, 45, 47,
- 49, 51, 53, 55, 56, 58, 60, 62, 63, 64, 65, 66, 67, 67, 68, 69, 70, 70,
- 71, 72, 73, 74, 75, 75, 75, 75, 52, 50, 49, 47, 45, 47, 49, 51, 53, 55,
- 57, 59, 61, 62, 64, 65, 66, 67, 68, 69, 70, 71, 72, 72, 73, 74, 75, 76,
- 76, 76, 76, 76, 54, 52, 50, 48, 46, 48, 50, 51, 54, 55, 57, 59, 62, 63,
- 64, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 78, 78, 78,
- 55, 53, 51, 49, 47, 49, 50, 52, 54, 56, 58, 60, 62, 63, 65, 67, 68, 69,
- 70, 71, 73, 73, 74, 75, 76, 77, 78, 78, 79, 79, 79, 79, 56, 54, 52, 50,
- 48, 50, 51, 53, 55, 56, 58, 60, 63, 64, 66, 67, 69, 70, 71, 73, 74, 75,
- 76, 77, 77, 78, 79, 80, 81, 81, 81, 81, 57, 55, 53, 51, 49, 50, 52, 54,
- 55, 57, 59, 61, 63, 65, 66, 68, 70, 71, 73, 74, 75, 76, 77, 78, 79, 80,
- 81, 82, 82, 82, 82, 82, 59, 56, 54, 52, 50, 52, 53, 55, 56, 58, 60, 62,
- 64, 65, 67, 69, 71, 72, 73, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 84,
- 84, 84, 60, 58, 55, 53, 51, 53, 54, 56, 57, 59, 61, 63, 65, 66, 68, 70,
- 72, 73, 74, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 85, 85, 85, 62, 59,
- 57, 55, 53, 54, 55, 57, 58, 60, 61, 63, 65, 67, 69, 70, 72, 74, 75, 77,
- 78, 79, 80, 81, 82, 83, 84, 85, 86, 86, 86, 86, 63, 61, 58, 56, 54, 55,
- 57, 58, 59, 61, 62, 64, 66, 68, 69, 71, 73, 75, 76, 77, 79, 80, 81, 82,
- 84, 85, 86, 86, 87, 87, 87, 87, 65, 62, 60, 57, 55, 57, 58, 59, 60, 62,
- 63, 65, 67, 69, 70, 72, 74, 75, 77, 78, 80, 81, 82, 83, 85, 86, 86, 87,
- 88, 88, 88, 88, 66, 64, 61, 59, 57, 58, 59, 60, 61, 63, 65, 66, 68, 69,
- 71, 73, 75, 76, 78, 79, 81, 82, 83, 84, 86, 86, 87, 88, 89, 89, 89, 89,
- 68, 65, 63, 60, 58, 59, 60, 62, 63, 64, 66, 67, 69, 70, 72, 74, 76, 77,
- 78, 80, 82, 83, 84, 85, 86, 87, 88, 89, 90, 90, 90, 90, 70, 67, 64, 62,
- 60, 61, 62, 63, 64, 65, 67, 68, 70, 71, 73, 75, 76, 78, 79, 81, 82, 84,
- 85, 86, 87, 88, 89, 90, 91, 91, 91, 91, 70, 67, 64, 62, 60, 61, 62, 63,
- 64, 65, 67, 68, 70, 71, 73, 75, 76, 78, 79, 81, 82, 84, 85, 86, 87, 88,
- 89, 90, 91, 91, 91, 91, 70, 67, 64, 62, 60, 61, 62, 63, 64, 65, 67, 68,
- 70, 71, 73, 75, 76, 78, 79, 81, 82, 84, 85, 86, 87, 88, 89, 90, 91, 91,
- 91, 91, 70, 67, 64, 62, 60, 61, 62, 63, 64, 65, 67, 68, 70, 71, 73, 75,
- 76, 78, 79, 81, 82, 84, 85, 86, 87, 88, 89, 90, 91, 91, 91, 91 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 69, 100, 132, 69, 93, 117, 139, 100, 117, 142, 157, 132, 139, 157,
- 169,
- /* Size 8 */
- 64, 51, 54, 67, 84, 100, 114, 126, 51, 57, 55, 62, 75, 89, 104, 116, 54,
- 55, 71, 80, 89, 100, 111, 121, 67, 62, 80, 94, 104, 113, 121, 129, 84,
- 75, 89, 104, 115, 123, 130, 136, 100, 89, 100, 113, 123, 131, 137, 142,
- 114, 104, 111, 121, 130, 137, 142, 146, 126, 116, 121, 129, 136, 142,
- 146, 150,
- /* Size 16 */
- 64, 57, 51, 53, 54, 60, 67, 75, 84, 91, 100, 106, 114, 119, 126, 126,
- 57, 55, 54, 54, 55, 59, 65, 71, 79, 86, 94, 101, 108, 114, 121, 121, 51,
- 54, 57, 56, 55, 58, 62, 68, 75, 82, 89, 96, 104, 109, 116, 116, 53, 54,
- 56, 59, 62, 66, 70, 75, 82, 88, 94, 100, 107, 113, 119, 119, 54, 55, 55,
- 62, 71, 76, 80, 84, 89, 94, 100, 105, 111, 116, 121, 121, 60, 59, 58,
- 66, 76, 81, 87, 91, 96, 101, 106, 111, 116, 120, 125, 125, 67, 65, 62,
- 70, 80, 87, 94, 99, 104, 108, 113, 116, 121, 125, 129, 129, 75, 71, 68,
- 75, 84, 91, 99, 104, 109, 113, 118, 121, 125, 128, 132, 132, 84, 79, 75,
- 82, 89, 96, 104, 109, 115, 119, 123, 126, 130, 133, 136, 136, 91, 86,
- 82, 88, 94, 101, 108, 113, 119, 123, 127, 130, 133, 136, 139, 139, 100,
- 94, 89, 94, 100, 106, 113, 118, 123, 127, 131, 134, 137, 139, 142, 142,
- 106, 101, 96, 100, 105, 111, 116, 121, 126, 130, 134, 137, 140, 142,
- 144, 144, 114, 108, 104, 107, 111, 116, 121, 125, 130, 133, 137, 140,
- 142, 144, 146, 146, 119, 114, 109, 113, 116, 120, 125, 128, 133, 136,
- 139, 142, 144, 146, 148, 148, 126, 121, 116, 119, 121, 125, 129, 132,
- 136, 139, 142, 144, 146, 148, 150, 150, 126, 121, 116, 119, 121, 125,
- 129, 132, 136, 139, 142, 144, 146, 148, 150, 150,
- /* Size 32 */
- 64, 60, 57, 54, 51, 52, 53, 54, 54, 57, 60, 64, 67, 71, 75, 79, 84, 87,
- 91, 95, 100, 103, 106, 110, 114, 117, 119, 122, 126, 126, 126, 126, 60,
- 58, 56, 54, 52, 53, 53, 54, 55, 57, 60, 63, 66, 69, 73, 77, 81, 85, 88,
- 92, 97, 100, 103, 107, 111, 114, 117, 120, 123, 123, 123, 123, 57, 56,
- 55, 55, 54, 54, 54, 54, 55, 57, 59, 62, 65, 68, 71, 75, 79, 82, 86, 90,
- 94, 97, 101, 104, 108, 111, 114, 117, 121, 121, 121, 121, 54, 54, 55,
- 55, 55, 55, 55, 55, 55, 57, 59, 61, 64, 66, 70, 73, 77, 80, 84, 88, 92,
- 95, 98, 102, 106, 109, 112, 115, 118, 118, 118, 118, 51, 52, 54, 55, 57,
- 56, 56, 56, 55, 57, 58, 60, 62, 65, 68, 71, 75, 78, 82, 85, 89, 93, 96,
- 100, 104, 106, 109, 113, 116, 116, 116, 116, 52, 53, 54, 55, 56, 57, 57,
- 58, 58, 60, 62, 64, 66, 69, 72, 75, 78, 81, 84, 88, 92, 95, 98, 102,
- 105, 108, 111, 114, 117, 117, 117, 117, 53, 53, 54, 55, 56, 57, 59, 61,
- 62, 64, 66, 68, 70, 73, 75, 78, 82, 84, 88, 91, 94, 97, 100, 104, 107,
- 110, 113, 116, 119, 119, 119, 119, 54, 54, 54, 55, 56, 58, 61, 63, 67,
- 68, 70, 72, 75, 77, 80, 82, 85, 88, 91, 94, 97, 100, 103, 106, 109, 112,
- 114, 117, 120, 120, 120, 120, 54, 55, 55, 55, 55, 58, 62, 67, 71, 73,
- 76, 78, 80, 82, 84, 87, 89, 92, 94, 97, 100, 103, 105, 108, 111, 114,
- 116, 119, 121, 121, 121, 121, 57, 57, 57, 57, 57, 60, 64, 68, 73, 76,
- 78, 80, 83, 85, 88, 90, 92, 95, 97, 100, 103, 105, 108, 111, 113, 116,
- 118, 121, 123, 123, 123, 123, 60, 60, 59, 59, 58, 62, 66, 70, 76, 78,
- 81, 84, 87, 89, 91, 93, 96, 98, 101, 103, 106, 108, 111, 113, 116, 118,
- 120, 122, 125, 125, 125, 125, 64, 63, 62, 61, 60, 64, 68, 72, 78, 80,
- 84, 87, 90, 92, 95, 97, 100, 102, 104, 107, 109, 111, 113, 116, 118,
- 120, 122, 124, 127, 127, 127, 127, 67, 66, 65, 64, 62, 66, 70, 75, 80,
- 83, 87, 90, 94, 97, 99, 101, 104, 106, 108, 110, 113, 114, 116, 119,
- 121, 123, 125, 127, 129, 129, 129, 129, 71, 69, 68, 66, 65, 69, 73, 77,
- 82, 85, 89, 92, 97, 99, 101, 104, 107, 109, 111, 113, 115, 117, 119,
- 121, 123, 125, 126, 128, 130, 130, 130, 130, 75, 73, 71, 70, 68, 72, 75,
- 80, 84, 88, 91, 95, 99, 101, 104, 106, 109, 111, 113, 115, 118, 119,
- 121, 123, 125, 127, 128, 130, 132, 132, 132, 132, 79, 77, 75, 73, 71,
- 75, 78, 82, 87, 90, 93, 97, 101, 104, 106, 109, 112, 114, 116, 118, 120,
- 122, 124, 126, 127, 129, 131, 132, 134, 134, 134, 134, 84, 81, 79, 77,
- 75, 78, 82, 85, 89, 92, 96, 100, 104, 107, 109, 112, 115, 117, 119, 121,
- 123, 125, 126, 128, 130, 131, 133, 134, 136, 136, 136, 136, 87, 85, 82,
- 80, 78, 81, 84, 88, 92, 95, 98, 102, 106, 109, 111, 114, 117, 119, 121,
- 123, 125, 127, 128, 130, 132, 133, 134, 136, 137, 137, 137, 137, 91, 88,
- 86, 84, 82, 84, 88, 91, 94, 97, 101, 104, 108, 111, 113, 116, 119, 121,
- 123, 125, 127, 129, 130, 132, 133, 135, 136, 137, 139, 139, 139, 139,
- 95, 92, 90, 88, 85, 88, 91, 94, 97, 100, 103, 107, 110, 113, 115, 118,
- 121, 123, 125, 127, 129, 131, 132, 134, 135, 136, 138, 139, 140, 140,
- 140, 140, 100, 97, 94, 92, 89, 92, 94, 97, 100, 103, 106, 109, 113, 115,
- 118, 120, 123, 125, 127, 129, 131, 133, 134, 135, 137, 138, 139, 141,
- 142, 142, 142, 142, 103, 100, 97, 95, 93, 95, 97, 100, 103, 105, 108,
- 111, 114, 117, 119, 122, 125, 127, 129, 131, 133, 134, 135, 137, 138,
- 139, 141, 142, 143, 143, 143, 143, 106, 103, 101, 98, 96, 98, 100, 103,
- 105, 108, 111, 113, 116, 119, 121, 124, 126, 128, 130, 132, 134, 135,
- 137, 138, 140, 141, 142, 143, 144, 144, 144, 144, 110, 107, 104, 102,
- 100, 102, 104, 106, 108, 111, 113, 116, 119, 121, 123, 126, 128, 130,
- 132, 134, 135, 137, 138, 140, 141, 142, 143, 144, 145, 145, 145, 145,
- 114, 111, 108, 106, 104, 105, 107, 109, 111, 113, 116, 118, 121, 123,
- 125, 127, 130, 132, 133, 135, 137, 138, 140, 141, 142, 143, 144, 145,
- 146, 146, 146, 146, 117, 114, 111, 109, 106, 108, 110, 112, 114, 116,
- 118, 120, 123, 125, 127, 129, 131, 133, 135, 136, 138, 139, 141, 142,
- 143, 144, 145, 146, 147, 147, 147, 147, 119, 117, 114, 112, 109, 111,
- 113, 114, 116, 118, 120, 122, 125, 126, 128, 131, 133, 134, 136, 138,
- 139, 141, 142, 143, 144, 145, 146, 147, 148, 148, 148, 148, 122, 120,
- 117, 115, 113, 114, 116, 117, 119, 121, 122, 124, 127, 128, 130, 132,
- 134, 136, 137, 139, 141, 142, 143, 144, 145, 146, 147, 148, 149, 149,
- 149, 149, 126, 123, 121, 118, 116, 117, 119, 120, 121, 123, 125, 127,
- 129, 130, 132, 134, 136, 137, 139, 140, 142, 143, 144, 145, 146, 147,
- 148, 149, 150, 150, 150, 150, 126, 123, 121, 118, 116, 117, 119, 120,
- 121, 123, 125, 127, 129, 130, 132, 134, 136, 137, 139, 140, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 150, 150, 150, 126, 123, 121, 118,
- 116, 117, 119, 120, 121, 123, 125, 127, 129, 130, 132, 134, 136, 137,
- 139, 140, 142, 143, 144, 145, 146, 147, 148, 149, 150, 150, 150, 150,
- 126, 123, 121, 118, 116, 117, 119, 120, 121, 123, 125, 127, 129, 130,
- 132, 134, 136, 137, 139, 140, 142, 143, 144, 145, 146, 147, 148, 149,
- 150, 150, 150, 150 },
- { /* Intra matrices */
- /* Size 4 */
- 32, 34, 51, 69, 34, 47, 60, 73, 51, 60, 75, 83, 69, 73, 83, 90,
- /* Size 8 */
- 37, 29, 31, 39, 49, 59, 68, 76, 29, 33, 31, 36, 44, 53, 61, 70, 31, 31,
- 41, 47, 52, 59, 66, 73, 39, 36, 47, 56, 62, 67, 73, 78, 49, 44, 52, 62,
- 69, 74, 79, 83, 59, 53, 59, 67, 74, 79, 83, 87, 68, 61, 66, 73, 79, 83,
- 87, 90, 76, 70, 73, 78, 83, 87, 90, 92,
- /* Size 16 */
- 36, 32, 28, 29, 30, 34, 38, 42, 48, 52, 57, 61, 66, 70, 74, 74, 32, 31,
- 30, 30, 30, 33, 36, 40, 45, 49, 54, 58, 63, 67, 71, 71, 28, 30, 32, 31,
- 31, 33, 35, 38, 42, 46, 51, 55, 60, 64, 68, 68, 29, 30, 31, 33, 35, 37,
- 40, 43, 46, 50, 54, 58, 62, 66, 69, 69, 30, 30, 31, 35, 40, 43, 45, 48,
- 51, 54, 58, 61, 65, 68, 71, 71, 34, 33, 33, 37, 43, 46, 49, 52, 55, 58,
- 61, 64, 68, 70, 73, 73, 38, 36, 35, 40, 45, 49, 54, 57, 60, 63, 65, 68,
- 71, 73, 76, 76, 42, 40, 38, 43, 48, 52, 57, 60, 63, 66, 69, 71, 74, 76,
- 78, 78, 48, 45, 42, 46, 51, 55, 60, 63, 67, 70, 72, 74, 77, 78, 80, 80,
- 52, 49, 46, 50, 54, 58, 63, 66, 70, 72, 75, 77, 79, 81, 82, 82, 57, 54,
- 51, 54, 58, 61, 65, 69, 72, 75, 77, 79, 81, 83, 84, 84, 61, 58, 55, 58,
- 61, 64, 68, 71, 74, 77, 79, 81, 83, 84, 86, 86, 66, 63, 60, 62, 65, 68,
- 71, 74, 77, 79, 81, 83, 85, 86, 87, 87, 70, 67, 64, 66, 68, 70, 73, 76,
- 78, 81, 83, 84, 86, 87, 89, 89, 74, 71, 68, 69, 71, 73, 76, 78, 80, 82,
- 84, 86, 87, 89, 90, 90, 74, 71, 68, 69, 71, 73, 76, 78, 80, 82, 84, 86,
- 87, 89, 90, 90,
- /* Size 32 */
- 35, 33, 31, 30, 28, 28, 29, 29, 30, 31, 33, 35, 37, 39, 42, 44, 47, 49,
- 51, 54, 57, 59, 61, 63, 65, 67, 69, 71, 73, 73, 73, 73, 33, 32, 31, 30,
- 29, 29, 29, 30, 30, 31, 33, 35, 37, 39, 41, 43, 46, 48, 50, 52, 55, 57,
- 59, 61, 64, 65, 67, 69, 71, 71, 71, 71, 31, 31, 30, 30, 30, 30, 30, 30,
- 30, 31, 33, 34, 36, 38, 40, 42, 44, 46, 48, 51, 53, 55, 57, 60, 62, 64,
- 66, 68, 70, 70, 70, 70, 30, 30, 30, 30, 30, 30, 30, 30, 30, 31, 32, 34,
- 35, 37, 39, 41, 43, 45, 47, 49, 52, 54, 56, 58, 61, 62, 64, 66, 68, 68,
- 68, 68, 28, 29, 30, 30, 31, 31, 31, 31, 30, 31, 32, 33, 34, 36, 38, 40,
- 42, 44, 46, 48, 50, 52, 54, 57, 59, 61, 63, 65, 67, 67, 67, 67, 28, 29,
- 30, 30, 31, 31, 32, 32, 32, 33, 34, 35, 37, 38, 40, 42, 44, 46, 47, 50,
- 52, 54, 56, 58, 60, 62, 64, 66, 68, 68, 68, 68, 29, 29, 30, 30, 31, 32,
- 33, 33, 34, 35, 37, 38, 39, 40, 42, 44, 46, 47, 49, 51, 53, 55, 57, 59,
- 61, 63, 65, 67, 68, 68, 68, 68, 29, 30, 30, 30, 31, 32, 33, 35, 37, 38,
- 39, 40, 42, 43, 45, 46, 48, 50, 51, 53, 55, 57, 59, 60, 62, 64, 66, 67,
- 69, 69, 69, 69, 30, 30, 30, 30, 30, 32, 34, 37, 40, 41, 42, 43, 45, 46,
- 47, 49, 50, 52, 53, 55, 57, 58, 60, 62, 64, 65, 67, 68, 70, 70, 70, 70,
- 31, 31, 31, 31, 31, 33, 35, 38, 41, 42, 44, 45, 47, 48, 49, 51, 52, 54,
- 55, 57, 59, 60, 62, 63, 65, 67, 68, 70, 71, 71, 71, 71, 33, 33, 33, 32,
- 32, 34, 37, 39, 42, 44, 45, 47, 49, 50, 51, 53, 54, 56, 57, 59, 60, 62,
- 63, 65, 67, 68, 69, 71, 72, 72, 72, 72, 35, 35, 34, 34, 33, 35, 38, 40,
- 43, 45, 47, 49, 51, 52, 54, 55, 57, 58, 59, 61, 62, 64, 65, 67, 68, 69,
- 71, 72, 74, 74, 74, 74, 37, 37, 36, 35, 34, 37, 39, 42, 45, 47, 49, 51,
- 53, 55, 56, 58, 59, 61, 62, 63, 65, 66, 67, 68, 70, 71, 72, 73, 75, 75,
- 75, 75, 39, 39, 38, 37, 36, 38, 40, 43, 46, 48, 50, 52, 55, 56, 58, 59,
- 61, 62, 63, 65, 66, 67, 69, 70, 71, 72, 73, 75, 76, 76, 76, 76, 42, 41,
- 40, 39, 38, 40, 42, 45, 47, 49, 51, 54, 56, 58, 59, 61, 63, 64, 65, 66,
- 68, 69, 70, 71, 73, 74, 75, 76, 77, 77, 77, 77, 44, 43, 42, 41, 40, 42,
- 44, 46, 49, 51, 53, 55, 58, 59, 61, 63, 64, 66, 67, 68, 69, 71, 72, 73,
- 74, 75, 76, 77, 78, 78, 78, 78, 47, 46, 44, 43, 42, 44, 46, 48, 50, 52,
- 54, 57, 59, 61, 63, 64, 66, 67, 69, 70, 71, 72, 73, 74, 76, 76, 77, 78,
- 79, 79, 79, 79, 49, 48, 46, 45, 44, 46, 47, 50, 52, 54, 56, 58, 61, 62,
- 64, 66, 67, 69, 70, 71, 73, 73, 75, 76, 77, 78, 78, 79, 80, 80, 80, 80,
- 51, 50, 48, 47, 46, 47, 49, 51, 53, 55, 57, 59, 62, 63, 65, 67, 69, 70,
- 71, 72, 74, 75, 76, 77, 78, 79, 79, 80, 81, 81, 81, 81, 54, 52, 51, 49,
- 48, 50, 51, 53, 55, 57, 59, 61, 63, 65, 66, 68, 70, 71, 72, 74, 75, 76,
- 77, 78, 79, 80, 81, 81, 82, 82, 82, 82, 57, 55, 53, 52, 50, 52, 53, 55,
- 57, 59, 60, 62, 65, 66, 68, 69, 71, 73, 74, 75, 76, 77, 78, 79, 80, 81,
- 82, 82, 83, 83, 83, 83, 59, 57, 55, 54, 52, 54, 55, 57, 58, 60, 62, 64,
- 66, 67, 69, 71, 72, 73, 75, 76, 77, 78, 79, 80, 81, 82, 82, 83, 84, 84,
- 84, 84, 61, 59, 57, 56, 54, 56, 57, 59, 60, 62, 63, 65, 67, 69, 70, 72,
- 73, 75, 76, 77, 78, 79, 80, 81, 82, 83, 83, 84, 85, 85, 85, 85, 63, 61,
- 60, 58, 57, 58, 59, 60, 62, 63, 65, 67, 68, 70, 71, 73, 74, 76, 77, 78,
- 79, 80, 81, 82, 83, 83, 84, 85, 85, 85, 85, 85, 65, 64, 62, 61, 59, 60,
- 61, 62, 64, 65, 67, 68, 70, 71, 73, 74, 76, 77, 78, 79, 80, 81, 82, 83,
- 84, 84, 85, 86, 86, 86, 86, 86, 67, 65, 64, 62, 61, 62, 63, 64, 65, 67,
- 68, 69, 71, 72, 74, 75, 76, 78, 79, 80, 81, 82, 83, 83, 84, 85, 86, 86,
- 87, 87, 87, 87, 69, 67, 66, 64, 63, 64, 65, 66, 67, 68, 69, 71, 72, 73,
- 75, 76, 77, 78, 79, 81, 82, 82, 83, 84, 85, 86, 86, 87, 87, 87, 87, 87,
- 71, 69, 68, 66, 65, 66, 67, 67, 68, 70, 71, 72, 73, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 86, 87, 87, 88, 88, 88, 88, 73, 71, 70, 68,
- 67, 68, 68, 69, 70, 71, 72, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
- 85, 85, 86, 87, 87, 88, 89, 89, 89, 89, 73, 71, 70, 68, 67, 68, 68, 69,
- 70, 71, 72, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 85, 86, 87,
- 87, 88, 89, 89, 89, 89, 73, 71, 70, 68, 67, 68, 68, 69, 70, 71, 72, 74,
- 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 85, 86, 87, 87, 88, 89, 89,
- 89, 89, 73, 71, 70, 68, 67, 68, 68, 69, 70, 71, 72, 74, 75, 76, 77, 78,
- 79, 80, 81, 82, 83, 84, 85, 85, 86, 87, 87, 88, 89, 89, 89, 89 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 91, 97, 113, 91, 104, 108, 119, 97, 108, 127, 138, 113, 119, 138,
- 151,
- /* Size 8 */
- 64, 54, 86, 89, 93, 101, 109, 118, 54, 72, 87, 81, 82, 88, 96, 104, 86,
- 87, 97, 95, 94, 98, 103, 110, 89, 81, 95, 103, 106, 109, 113, 119, 93,
- 82, 94, 106, 114, 119, 123, 127, 101, 88, 98, 109, 119, 126, 131, 135,
- 109, 96, 103, 113, 123, 131, 137, 142, 118, 104, 110, 119, 127, 135,
- 142, 147,
- /* Size 16 */
- 64, 58, 54, 66, 86, 87, 89, 91, 93, 97, 101, 105, 109, 114, 118, 118,
- 58, 60, 62, 72, 86, 85, 85, 86, 88, 91, 94, 98, 102, 106, 111, 111, 54,
- 62, 72, 79, 87, 84, 81, 81, 82, 85, 88, 92, 96, 100, 104, 104, 66, 72,
- 79, 85, 91, 89, 87, 87, 88, 90, 93, 96, 100, 103, 107, 107, 86, 86, 87,
- 91, 97, 96, 95, 94, 94, 96, 98, 100, 103, 107, 110, 110, 87, 85, 84, 89,
- 96, 97, 98, 99, 100, 101, 103, 106, 108, 111, 114, 114, 89, 85, 81, 87,
- 95, 98, 103, 104, 106, 108, 109, 111, 113, 116, 119, 119, 91, 86, 81,
- 87, 94, 99, 104, 107, 110, 112, 114, 116, 118, 120, 123, 123, 93, 88,
- 82, 88, 94, 100, 106, 110, 114, 116, 119, 121, 123, 125, 127, 127, 97,
- 91, 85, 90, 96, 101, 108, 112, 116, 119, 122, 124, 127, 129, 131, 131,
- 101, 94, 88, 93, 98, 103, 109, 114, 119, 122, 126, 128, 131, 133, 135,
- 135, 105, 98, 92, 96, 100, 106, 111, 116, 121, 124, 128, 131, 134, 136,
- 138, 138, 109, 102, 96, 100, 103, 108, 113, 118, 123, 127, 131, 134,
- 137, 139, 142, 142, 114, 106, 100, 103, 107, 111, 116, 120, 125, 129,
- 133, 136, 139, 142, 144, 144, 118, 111, 104, 107, 110, 114, 119, 123,
- 127, 131, 135, 138, 142, 144, 147, 147, 118, 111, 104, 107, 110, 114,
- 119, 123, 127, 131, 135, 138, 142, 144, 147, 147,
- /* Size 32 */
- 64, 61, 58, 56, 54, 59, 66, 75, 86, 86, 87, 88, 89, 90, 91, 92, 93, 95,
- 97, 99, 101, 103, 105, 107, 109, 111, 114, 116, 118, 118, 118, 118, 61,
- 60, 59, 58, 57, 63, 69, 76, 86, 86, 86, 87, 87, 88, 89, 90, 90, 92, 94,
- 96, 97, 99, 101, 103, 106, 108, 110, 112, 114, 114, 114, 114, 58, 59,
- 60, 61, 62, 66, 72, 78, 86, 86, 85, 85, 85, 85, 86, 87, 88, 89, 91, 92,
- 94, 96, 98, 100, 102, 104, 106, 109, 111, 111, 111, 111, 56, 58, 61, 63,
- 66, 71, 75, 80, 86, 85, 84, 84, 83, 83, 84, 84, 85, 86, 88, 89, 91, 93,
- 95, 97, 99, 101, 103, 105, 108, 108, 108, 108, 54, 57, 62, 66, 72, 75,
- 79, 83, 87, 85, 84, 82, 81, 81, 81, 82, 82, 84, 85, 87, 88, 90, 92, 94,
- 96, 98, 100, 102, 104, 104, 104, 104, 59, 63, 66, 71, 75, 78, 82, 85,
- 89, 88, 86, 85, 84, 84, 84, 85, 85, 86, 88, 89, 90, 92, 94, 96, 98, 100,
- 102, 104, 106, 106, 106, 106, 66, 69, 72, 75, 79, 82, 85, 88, 91, 90,
- 89, 88, 87, 87, 87, 88, 88, 89, 90, 91, 93, 94, 96, 98, 100, 101, 103,
- 105, 107, 107, 107, 107, 75, 76, 78, 80, 83, 85, 88, 91, 94, 93, 92, 91,
- 91, 91, 91, 91, 91, 92, 93, 94, 95, 97, 98, 100, 101, 103, 105, 107,
- 109, 109, 109, 109, 86, 86, 86, 86, 87, 89, 91, 94, 97, 96, 96, 95, 95,
- 94, 94, 94, 94, 95, 96, 97, 98, 99, 100, 102, 103, 105, 107, 109, 110,
- 110, 110, 110, 86, 86, 86, 85, 85, 88, 90, 93, 96, 96, 96, 96, 96, 97,
- 97, 97, 97, 98, 99, 99, 100, 102, 103, 104, 106, 107, 109, 111, 112,
- 112, 112, 112, 87, 86, 85, 84, 84, 86, 89, 92, 96, 96, 97, 98, 98, 99,
- 99, 100, 100, 101, 101, 102, 103, 104, 106, 107, 108, 110, 111, 113,
- 114, 114, 114, 114, 88, 87, 85, 84, 82, 85, 88, 91, 95, 96, 98, 99, 101,
- 101, 102, 102, 103, 104, 104, 105, 106, 107, 108, 109, 111, 112, 113,
- 115, 116, 116, 116, 116, 89, 87, 85, 83, 81, 84, 87, 91, 95, 96, 98,
- 101, 103, 104, 104, 105, 106, 107, 108, 108, 109, 110, 111, 112, 113,
- 115, 116, 117, 119, 119, 119, 119, 90, 88, 85, 83, 81, 84, 87, 91, 94,
- 97, 99, 101, 104, 105, 106, 107, 108, 109, 110, 110, 111, 112, 113, 114,
- 116, 117, 118, 119, 121, 121, 121, 121, 91, 89, 86, 84, 81, 84, 87, 91,
- 94, 97, 99, 102, 104, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116,
- 117, 118, 119, 120, 122, 123, 123, 123, 123, 92, 90, 87, 84, 82, 85, 88,
- 91, 94, 97, 100, 102, 105, 107, 108, 110, 112, 113, 114, 115, 116, 117,
- 118, 119, 120, 122, 123, 124, 125, 125, 125, 125, 93, 90, 88, 85, 82,
- 85, 88, 91, 94, 97, 100, 103, 106, 108, 110, 112, 114, 115, 116, 118,
- 119, 120, 121, 122, 123, 124, 125, 126, 127, 127, 127, 127, 95, 92, 89,
- 86, 84, 86, 89, 92, 95, 98, 101, 104, 107, 109, 111, 113, 115, 116, 118,
- 119, 120, 122, 123, 124, 125, 126, 127, 128, 129, 129, 129, 129, 97, 94,
- 91, 88, 85, 88, 90, 93, 96, 99, 101, 104, 108, 110, 112, 114, 116, 118,
- 119, 121, 122, 123, 124, 126, 127, 128, 129, 130, 131, 131, 131, 131,
- 99, 96, 92, 89, 87, 89, 91, 94, 97, 99, 102, 105, 108, 110, 113, 115,
- 118, 119, 121, 122, 124, 125, 126, 128, 129, 130, 131, 132, 133, 133,
- 133, 133, 101, 97, 94, 91, 88, 90, 93, 95, 98, 100, 103, 106, 109, 111,
- 114, 116, 119, 120, 122, 124, 126, 127, 128, 130, 131, 132, 133, 134,
- 135, 135, 135, 135, 103, 99, 96, 93, 90, 92, 94, 97, 99, 102, 104, 107,
- 110, 112, 115, 117, 120, 122, 123, 125, 127, 128, 130, 131, 132, 133,
- 134, 136, 137, 137, 137, 137, 105, 101, 98, 95, 92, 94, 96, 98, 100,
- 103, 106, 108, 111, 113, 116, 118, 121, 123, 124, 126, 128, 130, 131,
- 132, 134, 135, 136, 137, 138, 138, 138, 138, 107, 103, 100, 97, 94, 96,
- 98, 100, 102, 104, 107, 109, 112, 114, 117, 119, 122, 124, 126, 128,
- 130, 131, 132, 134, 135, 136, 138, 139, 140, 140, 140, 140, 109, 106,
- 102, 99, 96, 98, 100, 101, 103, 106, 108, 111, 113, 116, 118, 120, 123,
- 125, 127, 129, 131, 132, 134, 135, 137, 138, 139, 140, 142, 142, 142,
- 142, 111, 108, 104, 101, 98, 100, 101, 103, 105, 107, 110, 112, 115,
- 117, 119, 122, 124, 126, 128, 130, 132, 133, 135, 136, 138, 139, 140,
- 142, 143, 143, 143, 143, 114, 110, 106, 103, 100, 102, 103, 105, 107,
- 109, 111, 113, 116, 118, 120, 123, 125, 127, 129, 131, 133, 134, 136,
- 138, 139, 140, 142, 143, 144, 144, 144, 144, 116, 112, 109, 105, 102,
- 104, 105, 107, 109, 111, 113, 115, 117, 119, 122, 124, 126, 128, 130,
- 132, 134, 136, 137, 139, 140, 142, 143, 144, 145, 145, 145, 145, 118,
- 114, 111, 108, 104, 106, 107, 109, 110, 112, 114, 116, 119, 121, 123,
- 125, 127, 129, 131, 133, 135, 137, 138, 140, 142, 143, 144, 145, 147,
- 147, 147, 147, 118, 114, 111, 108, 104, 106, 107, 109, 110, 112, 114,
- 116, 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, 138, 140, 142,
- 143, 144, 145, 147, 147, 147, 147, 118, 114, 111, 108, 104, 106, 107,
- 109, 110, 112, 114, 116, 119, 121, 123, 125, 127, 129, 131, 133, 135,
- 137, 138, 140, 142, 143, 144, 145, 147, 147, 147, 147, 118, 114, 111,
- 108, 104, 106, 107, 109, 110, 112, 114, 116, 119, 121, 123, 125, 127,
- 129, 131, 133, 135, 137, 138, 140, 142, 143, 144, 145, 147, 147, 147,
- 147 },
- { /* Intra matrices */
- /* Size 4 */
- 35, 51, 54, 64, 51, 58, 61, 67, 54, 61, 72, 79, 64, 67, 79, 87,
- /* Size 8 */
- 37, 31, 51, 53, 56, 60, 66, 71, 31, 42, 51, 48, 49, 52, 57, 63, 51, 51,
- 58, 56, 56, 58, 62, 66, 53, 48, 56, 61, 64, 66, 68, 72, 56, 49, 56, 64,
- 69, 72, 75, 77, 60, 52, 58, 66, 72, 76, 80, 83, 66, 57, 62, 68, 75, 80,
- 84, 87, 71, 63, 66, 72, 77, 83, 87, 90,
- /* Size 16 */
- 37, 33, 31, 38, 50, 51, 52, 53, 55, 57, 59, 62, 64, 67, 70, 70, 33, 34,
- 35, 41, 50, 50, 49, 50, 51, 53, 55, 57, 60, 63, 65, 65, 31, 35, 41, 45,
- 50, 48, 47, 47, 48, 49, 51, 54, 56, 59, 61, 61, 38, 41, 45, 49, 53, 52,
- 51, 51, 51, 53, 54, 56, 58, 61, 63, 63, 50, 50, 50, 53, 57, 56, 55, 55,
- 55, 56, 57, 59, 61, 63, 65, 65, 51, 50, 48, 52, 56, 57, 58, 58, 58, 59,
- 60, 62, 64, 66, 68, 68, 52, 49, 47, 51, 55, 58, 60, 61, 62, 63, 64, 66,
- 67, 69, 70, 70, 53, 50, 47, 51, 55, 58, 61, 63, 65, 66, 67, 69, 70, 71,
- 73, 73, 55, 51, 48, 51, 55, 58, 62, 65, 67, 69, 70, 72, 73, 75, 76, 76,
- 57, 53, 49, 53, 56, 59, 63, 66, 69, 71, 73, 74, 76, 77, 78, 78, 59, 55,
- 51, 54, 57, 60, 64, 67, 70, 73, 75, 77, 78, 80, 81, 81, 62, 57, 54, 56,
- 59, 62, 66, 69, 72, 74, 77, 78, 80, 82, 83, 83, 64, 60, 56, 58, 61, 64,
- 67, 70, 73, 76, 78, 80, 82, 84, 85, 85, 67, 63, 59, 61, 63, 66, 69, 71,
- 75, 77, 80, 82, 84, 85, 87, 87, 70, 65, 61, 63, 65, 68, 70, 73, 76, 78,
- 81, 83, 85, 87, 89, 89, 70, 65, 61, 63, 65, 68, 70, 73, 76, 78, 81, 83,
- 85, 87, 89, 89,
- /* Size 32 */
- 36, 35, 33, 32, 30, 33, 37, 43, 49, 50, 50, 51, 51, 52, 53, 53, 54, 55,
- 56, 57, 58, 60, 61, 62, 64, 65, 66, 68, 69, 69, 69, 69, 35, 34, 33, 33,
- 32, 35, 39, 44, 49, 49, 50, 50, 50, 50, 51, 52, 52, 53, 54, 55, 56, 58,
- 59, 60, 62, 63, 64, 66, 67, 67, 67, 67, 33, 33, 34, 34, 35, 38, 41, 45,
- 49, 49, 49, 49, 49, 49, 49, 50, 50, 51, 52, 53, 54, 56, 57, 58, 59, 61,
- 62, 63, 65, 65, 65, 65, 32, 33, 34, 36, 38, 40, 43, 46, 50, 49, 48, 48,
- 47, 48, 48, 48, 49, 50, 51, 51, 52, 54, 55, 56, 57, 59, 60, 61, 63, 63,
- 63, 63, 30, 32, 35, 38, 41, 43, 45, 47, 50, 49, 48, 47, 46, 46, 47, 47,
- 47, 48, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 61, 61, 61, 61, 33, 35,
- 38, 40, 43, 45, 47, 49, 51, 50, 50, 49, 48, 48, 48, 49, 49, 50, 50, 51,
- 52, 53, 54, 55, 57, 58, 59, 60, 62, 62, 62, 62, 37, 39, 41, 43, 45, 47,
- 49, 51, 53, 52, 51, 51, 50, 50, 50, 50, 51, 51, 52, 53, 54, 54, 56, 57,
- 58, 59, 60, 61, 63, 63, 63, 63, 43, 44, 45, 46, 47, 49, 51, 52, 54, 54,
- 53, 53, 52, 52, 52, 52, 52, 53, 54, 54, 55, 56, 57, 58, 59, 60, 61, 62,
- 63, 63, 63, 63, 49, 49, 49, 50, 50, 51, 53, 54, 56, 56, 55, 55, 55, 55,
- 55, 55, 54, 55, 56, 56, 57, 57, 58, 59, 60, 61, 62, 63, 64, 64, 64, 64,
- 50, 49, 49, 49, 49, 50, 52, 54, 56, 56, 56, 56, 56, 56, 56, 56, 56, 57,
- 57, 58, 58, 59, 60, 61, 62, 63, 64, 65, 66, 66, 66, 66, 50, 50, 49, 48,
- 48, 50, 51, 53, 55, 56, 56, 57, 57, 57, 57, 58, 58, 58, 59, 59, 60, 61,
- 61, 62, 63, 64, 65, 66, 67, 67, 67, 67, 51, 50, 49, 48, 47, 49, 51, 53,
- 55, 56, 57, 57, 58, 59, 59, 59, 60, 60, 61, 61, 62, 62, 63, 64, 65, 65,
- 66, 67, 68, 68, 68, 68, 51, 50, 49, 47, 46, 48, 50, 52, 55, 56, 57, 58,
- 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 66, 66, 67, 68, 69, 70, 70,
- 70, 70, 52, 50, 49, 48, 46, 48, 50, 52, 55, 56, 57, 59, 60, 61, 62, 62,
- 63, 63, 64, 65, 65, 66, 66, 67, 68, 68, 69, 70, 71, 71, 71, 71, 53, 51,
- 49, 48, 47, 48, 50, 52, 55, 56, 57, 59, 61, 62, 62, 63, 64, 65, 65, 66,
- 67, 67, 68, 69, 69, 70, 71, 71, 72, 72, 72, 72, 53, 52, 50, 48, 47, 49,
- 50, 52, 55, 56, 58, 59, 61, 62, 63, 64, 65, 66, 67, 67, 68, 69, 69, 70,
- 71, 71, 72, 73, 74, 74, 74, 74, 54, 52, 50, 49, 47, 49, 51, 52, 54, 56,
- 58, 60, 62, 63, 64, 65, 67, 67, 68, 69, 70, 70, 71, 72, 72, 73, 74, 74,
- 75, 75, 75, 75, 55, 53, 51, 50, 48, 50, 51, 53, 55, 57, 58, 60, 62, 63,
- 65, 66, 67, 68, 69, 70, 71, 71, 72, 73, 74, 74, 75, 76, 76, 76, 76, 76,
- 56, 54, 52, 51, 49, 50, 52, 54, 56, 57, 59, 61, 63, 64, 65, 67, 68, 69,
- 70, 71, 72, 73, 73, 74, 75, 76, 76, 77, 78, 78, 78, 78, 57, 55, 53, 51,
- 50, 51, 53, 54, 56, 58, 59, 61, 63, 65, 66, 67, 69, 70, 71, 72, 73, 74,
- 75, 75, 76, 77, 78, 78, 79, 79, 79, 79, 58, 56, 54, 52, 51, 52, 54, 55,
- 57, 58, 60, 62, 64, 65, 67, 68, 70, 71, 72, 73, 74, 75, 76, 77, 77, 78,
- 79, 80, 80, 80, 80, 80, 60, 58, 56, 54, 52, 53, 54, 56, 57, 59, 61, 62,
- 64, 66, 67, 69, 70, 71, 73, 74, 75, 76, 77, 78, 78, 79, 80, 81, 81, 81,
- 81, 81, 61, 59, 57, 55, 53, 54, 56, 57, 58, 60, 61, 63, 65, 66, 68, 69,
- 71, 72, 73, 75, 76, 77, 78, 78, 79, 80, 81, 82, 82, 82, 82, 82, 62, 60,
- 58, 56, 54, 55, 57, 58, 59, 61, 62, 64, 66, 67, 69, 70, 72, 73, 74, 75,
- 77, 78, 78, 79, 80, 81, 82, 83, 83, 83, 83, 83, 64, 62, 59, 57, 55, 57,
- 58, 59, 60, 62, 63, 65, 66, 68, 69, 71, 72, 74, 75, 76, 77, 78, 79, 80,
- 81, 82, 83, 84, 84, 84, 84, 84, 65, 63, 61, 59, 57, 58, 59, 60, 61, 63,
- 64, 65, 67, 68, 70, 71, 73, 74, 76, 77, 78, 79, 80, 81, 82, 83, 84, 84,
- 85, 85, 85, 85, 66, 64, 62, 60, 58, 59, 60, 61, 62, 64, 65, 66, 68, 69,
- 71, 72, 74, 75, 76, 78, 79, 80, 81, 82, 83, 84, 84, 85, 86, 86, 86, 86,
- 68, 66, 63, 61, 59, 60, 61, 62, 63, 65, 66, 67, 69, 70, 71, 73, 74, 76,
- 77, 78, 80, 81, 82, 83, 84, 84, 85, 86, 87, 87, 87, 87, 69, 67, 65, 63,
- 61, 62, 63, 63, 64, 66, 67, 68, 70, 71, 72, 74, 75, 76, 78, 79, 80, 81,
- 82, 83, 84, 85, 86, 87, 88, 88, 88, 88, 69, 67, 65, 63, 61, 62, 63, 63,
- 64, 66, 67, 68, 70, 71, 72, 74, 75, 76, 78, 79, 80, 81, 82, 83, 84, 85,
- 86, 87, 88, 88, 88, 88, 69, 67, 65, 63, 61, 62, 63, 63, 64, 66, 67, 68,
- 70, 71, 72, 74, 75, 76, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 88,
- 88, 88, 69, 67, 65, 63, 61, 62, 63, 63, 64, 66, 67, 68, 70, 71, 72, 74,
- 75, 76, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 88, 88, 88 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 68, 96, 122, 68, 90, 110, 128, 96, 110, 130, 142, 122, 128, 142,
- 150,
- /* Size 8 */
- 64, 52, 55, 67, 81, 95, 107, 116, 52, 58, 56, 63, 74, 86, 98, 108, 55,
- 56, 71, 78, 86, 95, 104, 113, 67, 63, 78, 91, 99, 106, 112, 118, 81, 74,
- 86, 99, 108, 114, 119, 124, 95, 86, 95, 106, 114, 120, 125, 128, 107,
- 98, 104, 112, 119, 125, 129, 132, 116, 108, 113, 118, 124, 128, 132,
- 134,
- /* Size 16 */
- 64, 57, 52, 53, 55, 61, 67, 74, 81, 88, 95, 100, 107, 111, 116, 116, 57,
- 56, 55, 55, 55, 60, 65, 71, 77, 84, 91, 96, 102, 107, 112, 112, 52, 55,
- 58, 57, 56, 59, 63, 68, 74, 80, 86, 92, 98, 103, 108, 108, 53, 55, 57,
- 59, 62, 66, 70, 74, 80, 85, 91, 96, 101, 106, 110, 110, 55, 55, 56, 62,
- 71, 74, 78, 82, 86, 91, 95, 100, 104, 108, 113, 113, 61, 60, 59, 66, 74,
- 79, 84, 88, 92, 96, 100, 104, 108, 112, 115, 115, 67, 65, 63, 70, 78,
- 84, 91, 94, 99, 102, 106, 109, 112, 115, 118, 118, 74, 71, 68, 74, 82,
- 88, 94, 98, 103, 106, 110, 112, 116, 118, 121, 121, 81, 77, 74, 80, 86,
- 92, 99, 103, 108, 111, 114, 117, 119, 121, 124, 124, 88, 84, 80, 85, 91,
- 96, 102, 106, 111, 114, 117, 119, 122, 124, 126, 126, 95, 91, 86, 91,
- 95, 100, 106, 110, 114, 117, 120, 122, 125, 126, 128, 128, 100, 96, 92,
- 96, 100, 104, 109, 112, 117, 119, 122, 124, 127, 128, 130, 130, 107,
- 102, 98, 101, 104, 108, 112, 116, 119, 122, 125, 127, 129, 130, 132,
- 132, 111, 107, 103, 106, 108, 112, 115, 118, 121, 124, 126, 128, 130,
- 131, 133, 133, 116, 112, 108, 110, 113, 115, 118, 121, 124, 126, 128,
- 130, 132, 133, 134, 134, 116, 112, 108, 110, 113, 115, 118, 121, 124,
- 126, 128, 130, 132, 133, 134, 134,
- /* Size 32 */
- 64, 60, 57, 55, 52, 53, 53, 54, 55, 58, 61, 64, 67, 70, 74, 77, 81, 84,
- 88, 91, 95, 98, 100, 103, 107, 109, 111, 113, 116, 116, 116, 116, 60,
- 58, 57, 55, 53, 54, 54, 55, 55, 58, 60, 63, 66, 69, 72, 76, 79, 82, 86,
- 89, 93, 95, 98, 101, 104, 107, 109, 111, 114, 114, 114, 114, 57, 57, 56,
- 55, 55, 55, 55, 55, 55, 57, 60, 62, 65, 68, 71, 74, 77, 80, 84, 87, 91,
- 93, 96, 99, 102, 105, 107, 109, 112, 112, 112, 112, 55, 55, 55, 56, 56,
- 56, 56, 56, 56, 57, 59, 61, 64, 66, 69, 72, 76, 79, 82, 85, 88, 91, 94,
- 97, 100, 103, 105, 108, 110, 110, 110, 110, 52, 53, 55, 56, 58, 57, 57,
- 56, 56, 57, 59, 61, 63, 65, 68, 71, 74, 77, 80, 83, 86, 89, 92, 95, 98,
- 101, 103, 106, 108, 108, 108, 108, 53, 54, 55, 56, 57, 58, 58, 58, 59,
- 60, 62, 64, 66, 68, 71, 74, 77, 79, 82, 85, 89, 91, 94, 97, 100, 102,
- 104, 107, 109, 109, 109, 109, 53, 54, 55, 56, 57, 58, 59, 61, 62, 64,
- 66, 68, 70, 72, 74, 77, 80, 82, 85, 88, 91, 93, 96, 98, 101, 103, 106,
- 108, 110, 110, 110, 110, 54, 55, 55, 56, 56, 58, 61, 63, 66, 68, 70, 72,
- 74, 76, 78, 80, 83, 85, 88, 90, 93, 95, 98, 100, 103, 105, 107, 109,
- 112, 112, 112, 112, 55, 55, 55, 56, 56, 59, 62, 66, 71, 73, 74, 76, 78,
- 80, 82, 84, 86, 88, 91, 93, 95, 97, 100, 102, 104, 106, 108, 110, 113,
- 113, 113, 113, 58, 58, 57, 57, 57, 60, 64, 68, 73, 74, 77, 79, 81, 83,
- 85, 87, 89, 91, 93, 95, 98, 100, 102, 104, 106, 108, 110, 112, 114, 114,
- 114, 114, 61, 60, 60, 59, 59, 62, 66, 70, 74, 77, 79, 81, 84, 86, 88,
- 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 113, 115, 115,
- 115, 115, 64, 63, 62, 61, 61, 64, 68, 72, 76, 79, 81, 84, 87, 89, 91,
- 93, 95, 97, 99, 101, 103, 105, 106, 108, 110, 112, 113, 115, 117, 117,
- 117, 117, 67, 66, 65, 64, 63, 66, 70, 74, 78, 81, 84, 87, 91, 92, 94,
- 96, 99, 100, 102, 104, 106, 107, 109, 110, 112, 114, 115, 117, 118, 118,
- 118, 118, 70, 69, 68, 66, 65, 68, 72, 76, 80, 83, 86, 89, 92, 94, 96,
- 99, 101, 102, 104, 106, 108, 109, 111, 112, 114, 115, 117, 118, 119,
- 119, 119, 119, 74, 72, 71, 69, 68, 71, 74, 78, 82, 85, 88, 91, 94, 96,
- 98, 101, 103, 105, 106, 108, 110, 111, 112, 114, 116, 117, 118, 119,
- 121, 121, 121, 121, 77, 76, 74, 72, 71, 74, 77, 80, 84, 87, 90, 93, 96,
- 99, 101, 103, 105, 107, 108, 110, 112, 113, 114, 116, 117, 118, 120,
- 121, 122, 122, 122, 122, 81, 79, 77, 76, 74, 77, 80, 83, 86, 89, 92, 95,
- 99, 101, 103, 105, 108, 109, 111, 112, 114, 115, 117, 118, 119, 120,
- 121, 122, 124, 124, 124, 124, 84, 82, 80, 79, 77, 79, 82, 85, 88, 91,
- 94, 97, 100, 102, 105, 107, 109, 111, 112, 114, 115, 117, 118, 119, 120,
- 121, 123, 124, 125, 125, 125, 125, 88, 86, 84, 82, 80, 82, 85, 88, 91,
- 93, 96, 99, 102, 104, 106, 108, 111, 112, 114, 115, 117, 118, 119, 121,
- 122, 123, 124, 125, 126, 126, 126, 126, 91, 89, 87, 85, 83, 85, 88, 90,
- 93, 95, 98, 101, 104, 106, 108, 110, 112, 114, 115, 117, 119, 120, 121,
- 122, 123, 124, 125, 126, 127, 127, 127, 127, 95, 93, 91, 88, 86, 89, 91,
- 93, 95, 98, 100, 103, 106, 108, 110, 112, 114, 115, 117, 119, 120, 121,
- 122, 123, 125, 125, 126, 127, 128, 128, 128, 128, 98, 95, 93, 91, 89,
- 91, 93, 95, 97, 100, 102, 105, 107, 109, 111, 113, 115, 117, 118, 120,
- 121, 122, 123, 124, 126, 126, 127, 128, 129, 129, 129, 129, 100, 98, 96,
- 94, 92, 94, 96, 98, 100, 102, 104, 106, 109, 111, 112, 114, 117, 118,
- 119, 121, 122, 123, 124, 125, 127, 127, 128, 129, 130, 130, 130, 130,
- 103, 101, 99, 97, 95, 97, 98, 100, 102, 104, 106, 108, 110, 112, 114,
- 116, 118, 119, 121, 122, 123, 124, 125, 127, 128, 128, 129, 130, 131,
- 131, 131, 131, 107, 104, 102, 100, 98, 100, 101, 103, 104, 106, 108,
- 110, 112, 114, 116, 117, 119, 120, 122, 123, 125, 126, 127, 128, 129,
- 129, 130, 131, 132, 132, 132, 132, 109, 107, 105, 103, 101, 102, 103,
- 105, 106, 108, 110, 112, 114, 115, 117, 118, 120, 121, 123, 124, 125,
- 126, 127, 128, 129, 130, 131, 131, 132, 132, 132, 132, 111, 109, 107,
- 105, 103, 104, 106, 107, 108, 110, 112, 113, 115, 117, 118, 120, 121,
- 123, 124, 125, 126, 127, 128, 129, 130, 131, 131, 132, 133, 133, 133,
- 133, 113, 111, 109, 108, 106, 107, 108, 109, 110, 112, 113, 115, 117,
- 118, 119, 121, 122, 124, 125, 126, 127, 128, 129, 130, 131, 131, 132,
- 133, 134, 134, 134, 134, 116, 114, 112, 110, 108, 109, 110, 112, 113,
- 114, 115, 117, 118, 119, 121, 122, 124, 125, 126, 127, 128, 129, 130,
- 131, 132, 132, 133, 134, 134, 134, 134, 134, 116, 114, 112, 110, 108,
- 109, 110, 112, 113, 114, 115, 117, 118, 119, 121, 122, 124, 125, 126,
- 127, 128, 129, 130, 131, 132, 132, 133, 134, 134, 134, 134, 134, 116,
- 114, 112, 110, 108, 109, 110, 112, 113, 114, 115, 117, 118, 119, 121,
- 122, 124, 125, 126, 127, 128, 129, 130, 131, 132, 132, 133, 134, 134,
- 134, 134, 134, 116, 114, 112, 110, 108, 109, 110, 112, 113, 114, 115,
- 117, 118, 119, 121, 122, 124, 125, 126, 127, 128, 129, 130, 131, 132,
- 132, 133, 134, 134, 134, 134, 134 },
- { /* Intra matrices */
- /* Size 4 */
- 35, 37, 53, 69, 37, 50, 61, 72, 53, 61, 74, 81, 69, 72, 81, 86,
- /* Size 8 */
- 40, 32, 34, 42, 51, 60, 68, 75, 32, 36, 34, 39, 46, 55, 63, 70, 34, 34,
- 44, 49, 54, 61, 67, 73, 42, 39, 49, 57, 63, 68, 72, 76, 51, 46, 54, 63,
- 69, 74, 77, 80, 60, 55, 61, 68, 74, 78, 81, 84, 68, 63, 67, 72, 77, 81,
- 84, 86, 75, 70, 73, 76, 80, 84, 86, 88,
- /* Size 16 */
- 39, 35, 31, 32, 33, 37, 41, 45, 50, 54, 59, 63, 67, 70, 73, 73, 35, 34,
- 33, 33, 33, 36, 39, 43, 47, 51, 56, 60, 64, 67, 70, 70, 31, 33, 35, 34,
- 34, 36, 38, 41, 45, 49, 53, 57, 61, 64, 68, 68, 32, 33, 34, 36, 38, 40,
- 42, 45, 49, 52, 56, 59, 63, 66, 69, 69, 33, 33, 34, 38, 43, 45, 48, 50,
- 53, 56, 59, 62, 65, 68, 71, 71, 37, 36, 36, 40, 45, 48, 52, 54, 57, 60,
- 62, 65, 68, 70, 73, 73, 41, 39, 38, 42, 48, 52, 56, 59, 61, 64, 66, 68,
- 71, 73, 75, 75, 45, 43, 41, 45, 50, 54, 59, 61, 64, 66, 69, 71, 73, 75,
- 77, 77, 50, 47, 45, 49, 53, 57, 61, 64, 67, 70, 72, 74, 75, 77, 78, 78,
- 54, 51, 49, 52, 56, 60, 64, 66, 70, 72, 74, 76, 77, 79, 80, 80, 59, 56,
- 53, 56, 59, 62, 66, 69, 72, 74, 76, 78, 79, 80, 82, 82, 63, 60, 57, 59,
- 62, 65, 68, 71, 74, 76, 78, 79, 81, 82, 83, 83, 67, 64, 61, 63, 65, 68,
- 71, 73, 75, 77, 79, 81, 82, 83, 84, 84, 70, 67, 64, 66, 68, 70, 73, 75,
- 77, 79, 80, 82, 83, 84, 85, 85, 73, 70, 68, 69, 71, 73, 75, 77, 78, 80,
- 82, 83, 84, 85, 86, 86, 73, 70, 68, 69, 71, 73, 75, 77, 78, 80, 82, 83,
- 84, 85, 86, 86,
- /* Size 32 */
- 38, 36, 34, 32, 31, 31, 32, 32, 33, 34, 36, 38, 40, 42, 44, 47, 49, 51,
- 53, 56, 58, 60, 62, 64, 66, 67, 69, 71, 72, 72, 72, 72, 36, 35, 34, 33,
- 32, 32, 32, 33, 33, 34, 36, 38, 40, 41, 43, 46, 48, 50, 52, 54, 57, 59,
- 60, 62, 64, 66, 68, 69, 71, 71, 71, 71, 34, 34, 33, 33, 32, 33, 33, 33,
- 33, 34, 36, 37, 39, 41, 42, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65,
- 66, 68, 70, 70, 70, 70, 32, 33, 33, 33, 33, 33, 33, 33, 33, 34, 35, 37,
- 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 63, 65, 67, 68, 68,
- 68, 68, 31, 32, 32, 33, 34, 34, 34, 33, 33, 34, 35, 36, 37, 39, 41, 43,
- 45, 46, 48, 50, 53, 54, 56, 58, 60, 62, 64, 65, 67, 67, 67, 67, 31, 32,
- 33, 33, 34, 34, 35, 35, 35, 36, 37, 38, 40, 41, 43, 44, 46, 48, 50, 52,
- 54, 56, 57, 59, 61, 63, 64, 66, 68, 68, 68, 68, 32, 32, 33, 33, 34, 35,
- 35, 36, 37, 38, 39, 41, 42, 43, 45, 46, 48, 50, 52, 53, 55, 57, 59, 61,
- 62, 64, 65, 67, 69, 69, 69, 69, 32, 33, 33, 33, 33, 35, 36, 38, 40, 41,
- 42, 43, 44, 46, 47, 49, 50, 52, 53, 55, 57, 58, 60, 62, 63, 65, 66, 68,
- 69, 69, 69, 69, 33, 33, 33, 33, 33, 35, 37, 40, 43, 44, 45, 46, 47, 49,
- 50, 51, 53, 54, 55, 57, 58, 60, 61, 63, 65, 66, 67, 69, 70, 70, 70, 70,
- 34, 34, 34, 34, 34, 36, 38, 41, 44, 45, 46, 48, 49, 50, 52, 53, 54, 56,
- 57, 59, 60, 61, 63, 64, 66, 67, 68, 70, 71, 71, 71, 71, 36, 36, 36, 35,
- 35, 37, 39, 42, 45, 46, 48, 49, 51, 52, 54, 55, 56, 58, 59, 60, 62, 63,
- 64, 66, 67, 68, 69, 71, 72, 72, 72, 72, 38, 38, 37, 37, 36, 38, 41, 43,
- 46, 48, 49, 51, 53, 54, 56, 57, 58, 60, 61, 62, 63, 65, 66, 67, 68, 69,
- 71, 72, 73, 73, 73, 73, 40, 40, 39, 38, 37, 40, 42, 44, 47, 49, 51, 53,
- 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 67, 69, 70, 71, 72, 73, 74, 74,
- 74, 74, 42, 41, 41, 40, 39, 41, 43, 46, 49, 50, 52, 54, 57, 58, 59, 61,
- 62, 63, 64, 65, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 75, 75, 44, 43,
- 42, 42, 41, 43, 45, 47, 50, 52, 54, 56, 58, 59, 61, 62, 64, 65, 66, 67,
- 68, 69, 70, 71, 72, 73, 74, 75, 76, 76, 76, 76, 47, 46, 45, 44, 43, 44,
- 46, 49, 51, 53, 55, 57, 59, 61, 62, 64, 65, 66, 67, 68, 69, 70, 71, 72,
- 73, 74, 75, 76, 77, 77, 77, 77, 49, 48, 47, 46, 45, 46, 48, 50, 53, 54,
- 56, 58, 61, 62, 64, 65, 67, 68, 69, 70, 71, 72, 73, 74, 74, 75, 76, 77,
- 78, 78, 78, 78, 51, 50, 49, 48, 46, 48, 50, 52, 54, 56, 58, 60, 62, 63,
- 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 78, 78, 78, 78,
- 53, 52, 51, 50, 48, 50, 52, 53, 55, 57, 59, 61, 63, 64, 66, 67, 69, 70,
- 71, 72, 73, 74, 75, 75, 76, 77, 78, 78, 79, 79, 79, 79, 56, 54, 53, 52,
- 50, 52, 53, 55, 57, 59, 60, 62, 64, 65, 67, 68, 70, 71, 72, 73, 74, 75,
- 76, 76, 77, 78, 79, 79, 80, 80, 80, 80, 58, 57, 55, 54, 53, 54, 55, 57,
- 58, 60, 62, 63, 65, 67, 68, 69, 71, 72, 73, 74, 75, 76, 77, 77, 78, 79,
- 79, 80, 81, 81, 81, 81, 60, 59, 57, 56, 54, 56, 57, 58, 60, 61, 63, 65,
- 66, 68, 69, 70, 72, 73, 74, 75, 76, 77, 77, 78, 79, 79, 80, 81, 81, 81,
- 81, 81, 62, 60, 59, 58, 56, 57, 59, 60, 61, 63, 64, 66, 67, 69, 70, 71,
- 73, 74, 75, 76, 77, 77, 78, 79, 80, 80, 81, 81, 82, 82, 82, 82, 64, 62,
- 61, 60, 58, 59, 61, 62, 63, 64, 66, 67, 69, 70, 71, 72, 74, 75, 75, 76,
- 77, 78, 79, 80, 80, 81, 81, 82, 82, 82, 82, 82, 66, 64, 63, 62, 60, 61,
- 62, 63, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 80,
- 81, 82, 82, 83, 83, 83, 83, 83, 67, 66, 65, 63, 62, 63, 64, 65, 66, 67,
- 68, 69, 71, 72, 73, 74, 75, 76, 77, 78, 79, 79, 80, 81, 82, 82, 83, 83,
- 84, 84, 84, 84, 69, 68, 66, 65, 64, 64, 65, 66, 67, 68, 69, 71, 72, 73,
- 74, 75, 76, 77, 78, 79, 79, 80, 81, 81, 82, 83, 83, 84, 84, 84, 84, 84,
- 71, 69, 68, 67, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
- 78, 79, 80, 81, 81, 82, 83, 83, 84, 84, 84, 84, 84, 84, 72, 71, 70, 68,
- 67, 68, 69, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 78, 79, 80, 81, 81,
- 82, 82, 83, 84, 84, 84, 85, 85, 85, 85, 72, 71, 70, 68, 67, 68, 69, 69,
- 70, 71, 72, 73, 74, 75, 76, 77, 78, 78, 79, 80, 81, 81, 82, 82, 83, 84,
- 84, 84, 85, 85, 85, 85, 72, 71, 70, 68, 67, 68, 69, 69, 70, 71, 72, 73,
- 74, 75, 76, 77, 78, 78, 79, 80, 81, 81, 82, 82, 83, 84, 84, 84, 85, 85,
- 85, 85, 72, 71, 70, 68, 67, 68, 69, 69, 70, 71, 72, 73, 74, 75, 76, 77,
- 78, 78, 79, 80, 81, 81, 82, 82, 83, 84, 84, 84, 85, 85, 85, 85 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 88, 93, 107, 88, 99, 103, 112, 93, 103, 119, 127, 107, 112, 127,
- 137,
- /* Size 8 */
- 64, 54, 83, 87, 90, 97, 104, 111, 54, 71, 84, 79, 81, 86, 92, 100, 83,
- 84, 93, 91, 91, 94, 99, 104, 87, 79, 91, 98, 101, 103, 107, 111, 90, 81,
- 91, 101, 107, 111, 115, 118, 97, 86, 94, 103, 111, 117, 121, 124, 104,
- 92, 99, 107, 115, 121, 126, 129, 111, 100, 104, 111, 118, 124, 129, 133,
- /* Size 16 */
- 64, 59, 54, 66, 83, 85, 87, 88, 90, 93, 97, 100, 104, 107, 111, 111, 59,
- 60, 62, 71, 84, 83, 83, 84, 85, 88, 91, 94, 98, 101, 105, 105, 54, 62,
- 71, 77, 84, 82, 79, 80, 81, 83, 86, 89, 92, 96, 100, 100, 66, 71, 77,
- 83, 88, 87, 85, 85, 85, 87, 90, 92, 95, 99, 102, 102, 83, 84, 84, 88,
- 93, 92, 91, 91, 91, 92, 94, 96, 99, 101, 104, 104, 85, 83, 82, 87, 92,
- 93, 95, 95, 96, 97, 98, 100, 103, 105, 108, 108, 87, 83, 79, 85, 91, 95,
- 98, 100, 101, 102, 103, 105, 107, 109, 111, 111, 88, 84, 80, 85, 91, 95,
- 100, 102, 104, 106, 107, 109, 111, 113, 115, 115, 90, 85, 81, 85, 91,
- 96, 101, 104, 107, 109, 111, 113, 115, 116, 118, 118, 93, 88, 83, 87,
- 92, 97, 102, 106, 109, 112, 114, 116, 118, 120, 121, 121, 97, 91, 86,
- 90, 94, 98, 103, 107, 111, 114, 117, 119, 121, 123, 124, 124, 100, 94,
- 89, 92, 96, 100, 105, 109, 113, 116, 119, 121, 123, 125, 127, 127, 104,
- 98, 92, 95, 99, 103, 107, 111, 115, 118, 121, 123, 126, 128, 129, 129,
- 107, 101, 96, 99, 101, 105, 109, 113, 116, 120, 123, 125, 128, 129, 131,
- 131, 111, 105, 100, 102, 104, 108, 111, 115, 118, 121, 124, 127, 129,
- 131, 133, 133, 111, 105, 100, 102, 104, 108, 111, 115, 118, 121, 124,
- 127, 129, 131, 133, 133,
- /* Size 32 */
- 64, 61, 59, 57, 54, 60, 66, 74, 83, 84, 85, 86, 87, 87, 88, 89, 90, 92,
- 93, 95, 97, 98, 100, 102, 104, 105, 107, 109, 111, 111, 111, 111, 61,
- 60, 60, 59, 58, 63, 68, 75, 84, 84, 84, 84, 85, 85, 86, 87, 88, 89, 90,
- 92, 94, 95, 97, 99, 101, 102, 104, 106, 108, 108, 108, 108, 59, 60, 60,
- 61, 62, 66, 71, 77, 84, 84, 83, 83, 83, 83, 84, 84, 85, 86, 88, 89, 91,
- 92, 94, 96, 98, 99, 101, 103, 105, 105, 105, 105, 57, 59, 61, 64, 66,
- 70, 74, 79, 84, 83, 82, 82, 81, 81, 82, 82, 83, 84, 85, 87, 88, 90, 91,
- 93, 95, 97, 98, 100, 102, 102, 102, 102, 54, 58, 62, 66, 71, 74, 77, 81,
- 84, 83, 82, 80, 79, 79, 80, 80, 81, 82, 83, 84, 86, 87, 89, 91, 92, 94,
- 96, 98, 100, 100, 100, 100, 60, 63, 66, 70, 74, 77, 80, 83, 86, 85, 84,
- 83, 82, 82, 82, 83, 83, 84, 85, 86, 88, 89, 91, 92, 94, 95, 97, 99, 101,
- 101, 101, 101, 66, 68, 71, 74, 77, 80, 83, 85, 88, 88, 87, 86, 85, 85,
- 85, 85, 85, 86, 87, 89, 90, 91, 92, 94, 95, 97, 99, 100, 102, 102, 102,
- 102, 74, 75, 77, 79, 81, 83, 85, 88, 91, 90, 89, 89, 88, 88, 88, 88, 88,
- 89, 90, 91, 92, 93, 94, 96, 97, 98, 100, 102, 103, 103, 103, 103, 83,
- 84, 84, 84, 84, 86, 88, 91, 93, 93, 92, 92, 91, 91, 91, 91, 91, 92, 92,
- 93, 94, 95, 96, 97, 99, 100, 101, 103, 104, 104, 104, 104, 84, 84, 84,
- 83, 83, 85, 88, 90, 93, 93, 93, 93, 93, 93, 93, 93, 93, 94, 95, 95, 96,
- 97, 98, 99, 101, 102, 103, 105, 106, 106, 106, 106, 85, 84, 83, 82, 82,
- 84, 87, 89, 92, 93, 93, 94, 95, 95, 95, 95, 96, 96, 97, 98, 98, 99, 100,
- 102, 103, 104, 105, 106, 108, 108, 108, 108, 86, 84, 83, 82, 80, 83, 86,
- 89, 92, 93, 94, 95, 96, 97, 97, 98, 98, 99, 100, 100, 101, 102, 103,
- 104, 105, 106, 107, 108, 109, 109, 109, 109, 87, 85, 83, 81, 79, 82, 85,
- 88, 91, 93, 95, 96, 98, 99, 100, 100, 101, 102, 102, 103, 103, 104, 105,
- 106, 107, 108, 109, 110, 111, 111, 111, 111, 87, 85, 83, 81, 79, 82, 85,
- 88, 91, 93, 95, 97, 99, 100, 101, 102, 102, 103, 104, 105, 105, 106,
- 107, 108, 109, 110, 111, 112, 113, 113, 113, 113, 88, 86, 84, 82, 80,
- 82, 85, 88, 91, 93, 95, 97, 100, 101, 102, 103, 104, 105, 106, 106, 107,
- 108, 109, 110, 111, 112, 113, 114, 115, 115, 115, 115, 89, 87, 84, 82,
- 80, 83, 85, 88, 91, 93, 95, 98, 100, 102, 103, 104, 106, 107, 107, 108,
- 109, 110, 111, 112, 113, 114, 115, 115, 116, 116, 116, 116, 90, 88, 85,
- 83, 81, 83, 85, 88, 91, 93, 96, 98, 101, 102, 104, 106, 107, 108, 109,
- 110, 111, 112, 113, 114, 115, 116, 116, 117, 118, 118, 118, 118, 92, 89,
- 86, 84, 82, 84, 86, 89, 92, 94, 96, 99, 102, 103, 105, 107, 108, 109,
- 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 120, 120, 120,
- 93, 90, 88, 85, 83, 85, 87, 90, 92, 95, 97, 100, 102, 104, 106, 107,
- 109, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 120, 121, 121,
- 121, 121, 95, 92, 89, 87, 84, 86, 89, 91, 93, 95, 98, 100, 103, 105,
- 106, 108, 110, 112, 113, 114, 116, 116, 117, 118, 119, 120, 121, 122,
- 123, 123, 123, 123, 97, 94, 91, 88, 86, 88, 90, 92, 94, 96, 98, 101,
- 103, 105, 107, 109, 111, 113, 114, 116, 117, 118, 119, 120, 121, 122,
- 123, 124, 124, 124, 124, 124, 98, 95, 92, 90, 87, 89, 91, 93, 95, 97,
- 99, 102, 104, 106, 108, 110, 112, 114, 115, 116, 118, 119, 120, 121,
- 122, 123, 124, 125, 126, 126, 126, 126, 100, 97, 94, 91, 89, 91, 92, 94,
- 96, 98, 100, 103, 105, 107, 109, 111, 113, 114, 116, 117, 119, 120, 121,
- 122, 123, 124, 125, 126, 127, 127, 127, 127, 102, 99, 96, 93, 91, 92,
- 94, 96, 97, 99, 102, 104, 106, 108, 110, 112, 114, 115, 117, 118, 120,
- 121, 122, 123, 125, 125, 126, 127, 128, 128, 128, 128, 104, 101, 98, 95,
- 92, 94, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 116, 118,
- 119, 121, 122, 123, 125, 126, 127, 128, 128, 129, 129, 129, 129, 105,
- 102, 99, 97, 94, 95, 97, 98, 100, 102, 104, 106, 108, 110, 112, 114,
- 116, 117, 119, 120, 122, 123, 124, 125, 127, 128, 128, 129, 130, 130,
- 130, 130, 107, 104, 101, 98, 96, 97, 99, 100, 101, 103, 105, 107, 109,
- 111, 113, 115, 116, 118, 120, 121, 123, 124, 125, 126, 128, 128, 129,
- 130, 131, 131, 131, 131, 109, 106, 103, 100, 98, 99, 100, 102, 103, 105,
- 106, 108, 110, 112, 114, 115, 117, 119, 120, 122, 124, 125, 126, 127,
- 128, 129, 130, 131, 132, 132, 132, 132, 111, 108, 105, 102, 100, 101,
- 102, 103, 104, 106, 108, 109, 111, 113, 115, 116, 118, 120, 121, 123,
- 124, 126, 127, 128, 129, 130, 131, 132, 133, 133, 133, 133, 111, 108,
- 105, 102, 100, 101, 102, 103, 104, 106, 108, 109, 111, 113, 115, 116,
- 118, 120, 121, 123, 124, 126, 127, 128, 129, 130, 131, 132, 133, 133,
- 133, 133, 111, 108, 105, 102, 100, 101, 102, 103, 104, 106, 108, 109,
- 111, 113, 115, 116, 118, 120, 121, 123, 124, 126, 127, 128, 129, 130,
- 131, 132, 133, 133, 133, 133, 111, 108, 105, 102, 100, 101, 102, 103,
- 104, 106, 108, 109, 111, 113, 115, 116, 118, 120, 121, 123, 124, 126,
- 127, 128, 129, 130, 131, 132, 133, 133, 133, 133 },
- { /* Intra matrices */
- /* Size 4 */
- 37, 52, 55, 64, 52, 59, 62, 67, 55, 62, 72, 77, 64, 67, 77, 84,
- /* Size 8 */
- 40, 33, 52, 54, 57, 61, 66, 71, 33, 44, 53, 49, 50, 54, 58, 63, 52, 53,
- 59, 57, 57, 59, 63, 66, 54, 49, 57, 62, 64, 66, 68, 71, 57, 50, 57, 64,
- 68, 71, 74, 76, 61, 54, 59, 66, 71, 75, 78, 80, 66, 58, 63, 68, 74, 78,
- 81, 84, 71, 63, 66, 71, 76, 80, 84, 86,
- /* Size 16 */
- 39, 36, 33, 40, 51, 52, 53, 55, 56, 58, 60, 62, 65, 67, 70, 70, 36, 37,
- 38, 43, 52, 51, 51, 52, 53, 54, 56, 58, 61, 63, 66, 66, 33, 38, 44, 47,
- 52, 50, 49, 49, 50, 51, 53, 55, 57, 60, 62, 62, 40, 43, 47, 51, 55, 53,
- 52, 52, 53, 54, 55, 57, 59, 61, 64, 64, 51, 52, 52, 55, 58, 57, 56, 56,
- 56, 57, 58, 60, 61, 63, 65, 65, 52, 51, 50, 53, 57, 58, 59, 59, 59, 60,
- 61, 63, 64, 66, 68, 68, 53, 51, 49, 52, 56, 59, 61, 62, 63, 64, 65, 66,
- 67, 68, 70, 70, 55, 52, 49, 52, 56, 59, 62, 64, 65, 66, 67, 68, 70, 71,
- 72, 72, 56, 53, 50, 53, 56, 59, 63, 65, 67, 69, 70, 71, 72, 73, 75, 75,
- 58, 54, 51, 54, 57, 60, 64, 66, 69, 70, 72, 73, 74, 76, 77, 77, 60, 56,
- 53, 55, 58, 61, 65, 67, 70, 72, 74, 75, 77, 78, 79, 79, 62, 58, 55, 57,
- 60, 63, 66, 68, 71, 73, 75, 77, 78, 79, 81, 81, 65, 61, 57, 59, 61, 64,
- 67, 70, 72, 74, 77, 78, 80, 81, 82, 82, 67, 63, 60, 61, 63, 66, 68, 71,
- 73, 76, 78, 79, 81, 82, 84, 84, 70, 66, 62, 64, 65, 68, 70, 72, 75, 77,
- 79, 81, 82, 84, 85, 85, 70, 66, 62, 64, 65, 68, 70, 72, 75, 77, 79, 81,
- 82, 84, 85, 85,
- /* Size 32 */
- 39, 37, 35, 34, 33, 36, 40, 45, 51, 51, 52, 52, 53, 54, 54, 55, 55, 56,
- 57, 58, 59, 61, 62, 63, 64, 65, 67, 68, 69, 69, 69, 69, 37, 36, 36, 35,
- 35, 38, 41, 46, 51, 51, 51, 52, 52, 52, 53, 53, 54, 55, 56, 57, 58, 59,
- 60, 61, 62, 63, 64, 66, 67, 67, 67, 67, 35, 36, 36, 37, 37, 40, 43, 47,
- 51, 51, 51, 51, 50, 51, 51, 52, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
- 63, 64, 65, 65, 65, 65, 34, 35, 37, 38, 40, 42, 45, 48, 51, 51, 50, 50,
- 49, 50, 50, 50, 51, 51, 52, 53, 54, 55, 56, 57, 58, 60, 61, 62, 63, 63,
- 63, 63, 33, 35, 37, 40, 43, 45, 47, 49, 52, 51, 50, 49, 48, 48, 49, 49,
- 49, 50, 51, 52, 52, 53, 55, 56, 57, 58, 59, 60, 62, 62, 62, 62, 36, 38,
- 40, 42, 45, 47, 49, 51, 53, 52, 51, 51, 50, 50, 50, 50, 51, 51, 52, 53,
- 54, 55, 56, 57, 58, 59, 60, 61, 62, 62, 62, 62, 40, 41, 43, 45, 47, 49,
- 50, 52, 54, 54, 53, 52, 52, 52, 52, 52, 52, 53, 54, 54, 55, 56, 57, 58,
- 59, 60, 61, 62, 63, 63, 63, 63, 45, 46, 47, 48, 49, 51, 52, 54, 56, 55,
- 55, 54, 54, 54, 54, 54, 54, 55, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 64, 64, 64, 51, 51, 51, 51, 52, 53, 54, 56, 57, 57, 57, 56, 56, 56,
- 56, 56, 56, 56, 57, 57, 58, 59, 59, 60, 61, 62, 63, 64, 65, 65, 65, 65,
- 51, 51, 51, 51, 51, 52, 54, 55, 57, 57, 57, 57, 57, 57, 57, 57, 57, 58,
- 58, 59, 59, 60, 61, 61, 62, 63, 64, 65, 66, 66, 66, 66, 52, 51, 51, 50,
- 50, 51, 53, 55, 57, 57, 57, 58, 58, 58, 59, 59, 59, 59, 60, 60, 61, 61,
- 62, 63, 64, 64, 65, 66, 67, 67, 67, 67, 52, 52, 51, 50, 49, 51, 52, 54,
- 56, 57, 58, 59, 59, 60, 60, 60, 61, 61, 61, 62, 62, 63, 64, 64, 65, 66,
- 66, 67, 68, 68, 68, 68, 53, 52, 50, 49, 48, 50, 52, 54, 56, 57, 58, 59,
- 61, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 68, 69, 69, 69,
- 69, 69, 54, 52, 51, 50, 48, 50, 52, 54, 56, 57, 58, 60, 61, 62, 62, 63,
- 63, 64, 64, 65, 65, 66, 66, 67, 68, 68, 69, 70, 70, 70, 70, 70, 54, 53,
- 51, 50, 49, 50, 52, 54, 56, 57, 59, 60, 61, 62, 63, 64, 64, 65, 66, 66,
- 67, 67, 68, 68, 69, 70, 70, 71, 72, 72, 72, 72, 55, 53, 52, 50, 49, 50,
- 52, 54, 56, 57, 59, 60, 62, 63, 64, 65, 66, 66, 67, 67, 68, 69, 69, 70,
- 70, 71, 71, 72, 73, 73, 73, 73, 55, 54, 52, 51, 49, 51, 52, 54, 56, 57,
- 59, 61, 62, 63, 64, 66, 67, 67, 68, 69, 69, 70, 70, 71, 72, 72, 73, 73,
- 74, 74, 74, 74, 56, 55, 53, 51, 50, 51, 53, 55, 56, 58, 59, 61, 63, 64,
- 65, 66, 67, 68, 69, 70, 70, 71, 71, 72, 73, 73, 74, 74, 75, 75, 75, 75,
- 57, 56, 54, 52, 51, 52, 54, 55, 57, 58, 60, 61, 63, 64, 66, 67, 68, 69,
- 70, 70, 71, 72, 72, 73, 74, 74, 75, 75, 76, 76, 76, 76, 58, 57, 55, 53,
- 52, 53, 54, 56, 57, 59, 60, 62, 64, 65, 66, 67, 69, 70, 70, 71, 72, 73,
- 73, 74, 75, 75, 76, 77, 77, 77, 77, 77, 59, 58, 56, 54, 52, 54, 55, 56,
- 58, 59, 61, 62, 64, 65, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 76,
- 77, 78, 78, 78, 78, 78, 61, 59, 57, 55, 53, 55, 56, 57, 59, 60, 61, 63,
- 65, 66, 67, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 77, 78, 78, 79, 79,
- 79, 79, 62, 60, 58, 56, 55, 56, 57, 58, 59, 61, 62, 64, 65, 66, 68, 69,
- 70, 71, 72, 73, 75, 75, 76, 77, 77, 78, 79, 79, 80, 80, 80, 80, 63, 61,
- 59, 57, 56, 57, 58, 59, 60, 61, 63, 64, 66, 67, 68, 70, 71, 72, 73, 74,
- 75, 76, 77, 77, 78, 79, 79, 80, 81, 81, 81, 81, 64, 62, 60, 58, 57, 58,
- 59, 60, 61, 62, 64, 65, 66, 68, 69, 70, 72, 73, 74, 75, 76, 77, 77, 78,
- 79, 80, 80, 81, 82, 82, 82, 82, 65, 63, 61, 60, 58, 59, 60, 61, 62, 63,
- 64, 66, 67, 68, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 80, 81, 82,
- 82, 82, 82, 82, 67, 64, 63, 61, 59, 60, 61, 62, 63, 64, 65, 66, 68, 69,
- 70, 71, 73, 74, 75, 76, 77, 78, 79, 79, 80, 81, 82, 82, 83, 83, 83, 83,
- 68, 66, 64, 62, 60, 61, 62, 63, 64, 65, 66, 67, 69, 70, 71, 72, 73, 74,
- 75, 77, 78, 78, 79, 80, 81, 82, 82, 83, 84, 84, 84, 84, 69, 67, 65, 63,
- 62, 62, 63, 64, 65, 66, 67, 68, 69, 70, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 82, 83, 84, 84, 84, 84, 84, 69, 67, 65, 63, 62, 62, 63, 64,
- 65, 66, 67, 68, 69, 70, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 82,
- 83, 84, 84, 84, 84, 84, 69, 67, 65, 63, 62, 62, 63, 64, 65, 66, 67, 68,
- 69, 70, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 82, 83, 84, 84, 84,
- 84, 84, 69, 67, 65, 63, 62, 62, 63, 64, 65, 66, 67, 68, 69, 70, 72, 73,
- 74, 75, 76, 77, 78, 79, 80, 81, 82, 82, 83, 84, 84, 84, 84, 84 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 68, 92, 113, 68, 87, 103, 117, 92, 103, 119, 128, 113, 117, 128,
- 134,
- /* Size 8 */
- 64, 53, 56, 67, 79, 91, 100, 107, 53, 58, 56, 63, 73, 84, 93, 101, 56,
- 56, 70, 77, 83, 91, 98, 105, 67, 63, 77, 87, 94, 99, 104, 109, 79, 73,
- 83, 94, 101, 106, 110, 113, 91, 84, 91, 99, 106, 110, 114, 116, 100, 93,
- 98, 104, 110, 114, 117, 119, 107, 101, 105, 109, 113, 116, 119, 121,
- /* Size 16 */
- 64, 58, 53, 54, 56, 61, 67, 72, 79, 84, 91, 95, 100, 103, 107, 107, 58,
- 57, 55, 56, 56, 60, 65, 70, 76, 81, 87, 91, 96, 100, 104, 104, 53, 55,
- 58, 57, 56, 59, 63, 67, 73, 78, 84, 88, 93, 97, 101, 101, 54, 56, 57,
- 60, 63, 66, 69, 73, 78, 82, 87, 91, 96, 99, 103, 103, 56, 56, 56, 63,
- 70, 73, 77, 80, 83, 87, 91, 94, 98, 101, 105, 105, 61, 60, 59, 66, 73,
- 77, 81, 85, 88, 91, 95, 98, 101, 104, 107, 107, 67, 65, 63, 69, 77, 81,
- 87, 90, 94, 96, 99, 102, 104, 106, 109, 109, 72, 70, 67, 73, 80, 85, 90,
- 93, 97, 100, 102, 104, 107, 109, 111, 111, 79, 76, 73, 78, 83, 88, 94,
- 97, 101, 103, 106, 108, 110, 111, 113, 113, 84, 81, 78, 82, 87, 91, 96,
- 100, 103, 105, 108, 110, 112, 113, 115, 115, 91, 87, 84, 87, 91, 95, 99,
- 102, 106, 108, 110, 112, 114, 115, 116, 116, 95, 91, 88, 91, 94, 98,
- 102, 104, 108, 110, 112, 114, 115, 116, 118, 118, 100, 96, 93, 96, 98,
- 101, 104, 107, 110, 112, 114, 115, 117, 118, 119, 119, 103, 100, 97, 99,
- 101, 104, 106, 109, 111, 113, 115, 116, 118, 119, 120, 120, 107, 104,
- 101, 103, 105, 107, 109, 111, 113, 115, 116, 118, 119, 120, 121, 121,
- 107, 104, 101, 103, 105, 107, 109, 111, 113, 115, 116, 118, 119, 120,
- 121, 121,
- /* Size 32 */
- 64, 61, 58, 55, 53, 54, 54, 55, 56, 58, 61, 64, 67, 70, 72, 76, 79, 82,
- 84, 87, 91, 93, 95, 97, 100, 102, 103, 105, 107, 107, 107, 107, 61, 59,
- 57, 56, 54, 55, 55, 56, 56, 58, 60, 63, 66, 68, 71, 74, 78, 80, 83, 86,
- 89, 91, 93, 96, 98, 100, 102, 104, 106, 106, 106, 106, 58, 57, 57, 56,
- 55, 56, 56, 56, 56, 58, 60, 62, 65, 67, 70, 73, 76, 78, 81, 84, 87, 89,
- 91, 94, 96, 98, 100, 102, 104, 104, 104, 104, 55, 56, 56, 56, 57, 57,
- 57, 56, 56, 58, 60, 62, 64, 66, 69, 71, 74, 77, 79, 82, 85, 87, 90, 92,
- 95, 97, 99, 101, 103, 103, 103, 103, 53, 54, 55, 57, 58, 58, 57, 57, 56,
- 58, 59, 61, 63, 65, 67, 70, 73, 75, 78, 81, 84, 86, 88, 91, 93, 95, 97,
- 99, 101, 101, 101, 101, 54, 55, 56, 57, 58, 58, 59, 59, 59, 61, 62, 64,
- 66, 68, 70, 73, 75, 77, 80, 82, 85, 87, 90, 92, 94, 96, 98, 100, 102,
- 102, 102, 102, 54, 55, 56, 57, 57, 59, 60, 61, 63, 64, 66, 67, 69, 71,
- 73, 75, 78, 80, 82, 84, 87, 89, 91, 93, 96, 97, 99, 101, 103, 103, 103,
- 103, 55, 56, 56, 56, 57, 59, 61, 63, 66, 68, 69, 71, 73, 74, 76, 78, 80,
- 82, 84, 87, 89, 91, 93, 95, 97, 99, 100, 102, 104, 104, 104, 104, 56,
- 56, 56, 56, 56, 59, 63, 66, 70, 72, 73, 75, 77, 78, 80, 81, 83, 85, 87,
- 89, 91, 93, 94, 96, 98, 100, 101, 103, 105, 105, 105, 105, 58, 58, 58,
- 58, 58, 61, 64, 68, 72, 73, 75, 77, 79, 80, 82, 84, 86, 87, 89, 91, 93,
- 94, 96, 98, 100, 101, 103, 104, 106, 106, 106, 106, 61, 60, 60, 60, 59,
- 62, 66, 69, 73, 75, 77, 79, 81, 83, 85, 86, 88, 90, 91, 93, 95, 96, 98,
- 99, 101, 102, 104, 105, 107, 107, 107, 107, 64, 63, 62, 62, 61, 64, 67,
- 71, 75, 77, 79, 82, 84, 86, 87, 89, 91, 92, 94, 95, 97, 98, 100, 101,
- 103, 104, 105, 106, 108, 108, 108, 108, 67, 66, 65, 64, 63, 66, 69, 73,
- 77, 79, 81, 84, 87, 88, 90, 92, 94, 95, 96, 98, 99, 100, 102, 103, 104,
- 105, 106, 108, 109, 109, 109, 109, 70, 68, 67, 66, 65, 68, 71, 74, 78,
- 80, 83, 86, 88, 90, 92, 93, 95, 97, 98, 99, 101, 102, 103, 104, 106,
- 107, 108, 109, 110, 110, 110, 110, 72, 71, 70, 69, 67, 70, 73, 76, 80,
- 82, 85, 87, 90, 92, 93, 95, 97, 98, 100, 101, 102, 103, 104, 106, 107,
- 108, 109, 110, 111, 111, 111, 111, 76, 74, 73, 71, 70, 73, 75, 78, 81,
- 84, 86, 89, 92, 93, 95, 97, 99, 100, 101, 103, 104, 105, 106, 107, 108,
- 109, 110, 111, 112, 112, 112, 112, 79, 78, 76, 74, 73, 75, 78, 80, 83,
- 86, 88, 91, 94, 95, 97, 99, 101, 102, 103, 104, 106, 107, 108, 109, 110,
- 110, 111, 112, 113, 113, 113, 113, 82, 80, 78, 77, 75, 77, 80, 82, 85,
- 87, 90, 92, 95, 97, 98, 100, 102, 103, 104, 106, 107, 108, 109, 110,
- 111, 111, 112, 113, 114, 114, 114, 114, 84, 83, 81, 79, 78, 80, 82, 84,
- 87, 89, 91, 94, 96, 98, 100, 101, 103, 104, 105, 107, 108, 109, 110,
- 111, 112, 112, 113, 114, 115, 115, 115, 115, 87, 86, 84, 82, 81, 82, 84,
- 87, 89, 91, 93, 95, 98, 99, 101, 103, 104, 106, 107, 108, 109, 110, 111,
- 112, 113, 113, 114, 115, 116, 116, 116, 116, 91, 89, 87, 85, 84, 85, 87,
- 89, 91, 93, 95, 97, 99, 101, 102, 104, 106, 107, 108, 109, 110, 111,
- 112, 113, 114, 114, 115, 116, 116, 116, 116, 116, 93, 91, 89, 87, 86,
- 87, 89, 91, 93, 94, 96, 98, 100, 102, 103, 105, 107, 108, 109, 110, 111,
- 112, 113, 114, 114, 115, 116, 116, 117, 117, 117, 117, 95, 93, 91, 90,
- 88, 90, 91, 93, 94, 96, 98, 100, 102, 103, 104, 106, 108, 109, 110, 111,
- 112, 113, 114, 114, 115, 116, 116, 117, 118, 118, 118, 118, 97, 96, 94,
- 92, 91, 92, 93, 95, 96, 98, 99, 101, 103, 104, 106, 107, 109, 110, 111,
- 112, 113, 114, 114, 115, 116, 117, 117, 118, 118, 118, 118, 118, 100,
- 98, 96, 95, 93, 94, 96, 97, 98, 100, 101, 103, 104, 106, 107, 108, 110,
- 111, 112, 113, 114, 114, 115, 116, 117, 117, 118, 118, 119, 119, 119,
- 119, 102, 100, 98, 97, 95, 96, 97, 99, 100, 101, 102, 104, 105, 107,
- 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 117, 118, 118, 119,
- 119, 119, 119, 119, 103, 102, 100, 99, 97, 98, 99, 100, 101, 103, 104,
- 105, 106, 108, 109, 110, 111, 112, 113, 114, 115, 116, 116, 117, 118,
- 118, 119, 119, 120, 120, 120, 120, 105, 104, 102, 101, 99, 100, 101,
- 102, 103, 104, 105, 106, 108, 109, 110, 111, 112, 113, 114, 115, 116,
- 116, 117, 118, 118, 119, 119, 120, 120, 120, 120, 120, 107, 106, 104,
- 103, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
- 114, 115, 116, 116, 117, 118, 118, 119, 119, 120, 120, 121, 121, 121,
- 121, 107, 106, 104, 103, 101, 102, 103, 104, 105, 106, 107, 108, 109,
- 110, 111, 112, 113, 114, 115, 116, 116, 117, 118, 118, 119, 119, 120,
- 120, 121, 121, 121, 121, 107, 106, 104, 103, 101, 102, 103, 104, 105,
- 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 116, 117, 118,
- 118, 119, 119, 120, 120, 121, 121, 121, 121, 107, 106, 104, 103, 101,
- 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
- 116, 116, 117, 118, 118, 119, 119, 120, 120, 121, 121, 121, 121 },
- { /* Intra matrices */
- /* Size 4 */
- 38, 40, 55, 69, 40, 52, 62, 72, 55, 62, 73, 79, 69, 72, 79, 83,
- /* Size 8 */
- 43, 35, 37, 45, 53, 62, 68, 74, 35, 39, 37, 42, 49, 56, 64, 70, 37, 37,
- 47, 52, 56, 62, 67, 72, 45, 42, 52, 59, 64, 68, 72, 75, 53, 49, 56, 64,
- 69, 73, 76, 78, 62, 56, 62, 68, 73, 76, 79, 81, 68, 64, 67, 72, 76, 79,
- 81, 83, 74, 70, 72, 75, 78, 81, 83, 84,
- /* Size 16 */
- 42, 38, 34, 35, 36, 40, 44, 48, 52, 56, 60, 63, 67, 70, 72, 72, 38, 37,
- 36, 36, 36, 39, 42, 46, 50, 54, 58, 61, 65, 67, 70, 70, 34, 36, 38, 37,
- 37, 39, 41, 44, 48, 51, 55, 59, 62, 65, 68, 68, 35, 36, 37, 39, 41, 43,
- 45, 48, 51, 54, 58, 61, 64, 67, 69, 69, 36, 36, 37, 41, 46, 48, 50, 53,
- 55, 58, 61, 63, 66, 68, 70, 70, 40, 39, 39, 43, 48, 51, 54, 56, 59, 61,
- 63, 66, 68, 70, 72, 72, 44, 42, 41, 45, 50, 54, 58, 60, 62, 64, 66, 68,
- 70, 72, 74, 74, 48, 46, 44, 48, 53, 56, 60, 62, 65, 67, 69, 70, 72, 74,
- 75, 75, 52, 50, 48, 51, 55, 59, 62, 65, 68, 69, 71, 73, 74, 75, 77, 77,
- 56, 54, 51, 54, 58, 61, 64, 67, 69, 71, 73, 74, 76, 77, 78, 78, 60, 58,
- 55, 58, 61, 63, 66, 69, 71, 73, 75, 76, 77, 78, 79, 79, 63, 61, 59, 61,
- 63, 66, 68, 70, 73, 74, 76, 77, 78, 79, 80, 80, 67, 65, 62, 64, 66, 68,
- 70, 72, 74, 76, 77, 78, 79, 80, 81, 81, 70, 67, 65, 67, 68, 70, 72, 74,
- 75, 77, 78, 79, 80, 81, 82, 82, 72, 70, 68, 69, 70, 72, 74, 75, 77, 78,
- 79, 80, 81, 82, 82, 82, 72, 70, 68, 69, 70, 72, 74, 75, 77, 78, 79, 80,
- 81, 82, 82, 82,
- /* Size 32 */
- 41, 39, 37, 35, 34, 34, 35, 35, 36, 37, 39, 41, 43, 45, 47, 49, 52, 54,
- 55, 57, 60, 61, 63, 65, 66, 68, 69, 70, 72, 72, 72, 72, 39, 38, 37, 36,
- 35, 35, 35, 36, 36, 37, 39, 41, 43, 44, 46, 48, 51, 52, 54, 56, 58, 60,
- 62, 63, 65, 66, 68, 69, 70, 70, 70, 70, 37, 37, 36, 36, 36, 36, 36, 36,
- 36, 37, 39, 40, 42, 43, 45, 47, 49, 51, 53, 55, 57, 59, 60, 62, 64, 65,
- 67, 68, 69, 69, 69, 69, 35, 36, 36, 36, 36, 36, 36, 36, 36, 37, 38, 40,
- 41, 43, 44, 46, 48, 50, 52, 54, 56, 57, 59, 61, 63, 64, 65, 67, 68, 68,
- 68, 68, 34, 35, 36, 36, 37, 37, 37, 37, 36, 37, 38, 39, 40, 42, 44, 45,
- 47, 49, 51, 53, 55, 56, 58, 60, 62, 63, 64, 66, 67, 67, 67, 67, 34, 35,
- 36, 36, 37, 37, 38, 38, 38, 39, 40, 41, 42, 44, 45, 47, 49, 51, 52, 54,
- 56, 57, 59, 61, 62, 64, 65, 66, 68, 68, 68, 68, 35, 35, 36, 36, 37, 38,
- 38, 39, 40, 41, 42, 44, 45, 46, 48, 49, 51, 52, 54, 55, 57, 59, 60, 62,
- 63, 65, 66, 67, 69, 69, 69, 69, 35, 36, 36, 36, 37, 38, 39, 41, 43, 44,
- 45, 46, 47, 48, 50, 51, 53, 54, 55, 57, 59, 60, 61, 63, 64, 65, 67, 68,
- 69, 69, 69, 69, 36, 36, 36, 36, 36, 38, 40, 43, 45, 46, 48, 49, 50, 51,
- 52, 53, 55, 56, 57, 58, 60, 61, 62, 64, 65, 66, 67, 69, 70, 70, 70, 70,
- 37, 37, 37, 37, 37, 39, 41, 44, 46, 48, 49, 50, 52, 53, 54, 55, 56, 57,
- 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 71, 71, 71, 71, 39, 39, 39, 38,
- 38, 40, 42, 45, 48, 49, 50, 52, 53, 54, 56, 57, 58, 59, 60, 61, 63, 64,
- 65, 66, 67, 68, 69, 70, 71, 71, 71, 71, 41, 41, 40, 40, 39, 41, 44, 46,
- 49, 50, 52, 53, 55, 56, 57, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
- 70, 71, 72, 72, 72, 72, 43, 43, 42, 41, 40, 42, 45, 47, 50, 52, 53, 55,
- 57, 58, 59, 61, 62, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 73,
- 73, 73, 45, 44, 43, 43, 42, 44, 46, 48, 51, 53, 54, 56, 58, 59, 61, 62,
- 63, 64, 65, 66, 67, 68, 69, 69, 70, 71, 72, 73, 74, 74, 74, 74, 47, 46,
- 45, 44, 44, 45, 48, 50, 52, 54, 56, 57, 59, 61, 62, 63, 64, 65, 66, 67,
- 68, 69, 70, 71, 71, 72, 73, 74, 74, 74, 74, 74, 49, 48, 47, 46, 45, 47,
- 49, 51, 53, 55, 57, 59, 61, 62, 63, 64, 66, 66, 67, 68, 69, 70, 71, 72,
- 72, 73, 74, 74, 75, 75, 75, 75, 52, 51, 49, 48, 47, 49, 51, 53, 55, 56,
- 58, 60, 62, 63, 64, 66, 67, 68, 69, 70, 71, 71, 72, 73, 73, 74, 75, 75,
- 76, 76, 76, 76, 54, 52, 51, 50, 49, 51, 52, 54, 56, 57, 59, 61, 63, 64,
- 65, 66, 68, 69, 70, 70, 71, 72, 73, 73, 74, 75, 75, 76, 76, 76, 76, 76,
- 55, 54, 53, 52, 51, 52, 54, 55, 57, 59, 60, 62, 64, 65, 66, 67, 69, 70,
- 70, 71, 72, 73, 73, 74, 75, 75, 76, 77, 77, 77, 77, 77, 57, 56, 55, 54,
- 53, 54, 55, 57, 58, 60, 61, 63, 65, 66, 67, 68, 70, 70, 71, 72, 73, 74,
- 74, 75, 76, 76, 77, 77, 78, 78, 78, 78, 60, 58, 57, 56, 55, 56, 57, 59,
- 60, 61, 63, 64, 66, 67, 68, 69, 71, 71, 72, 73, 74, 75, 75, 76, 76, 77,
- 77, 78, 78, 78, 78, 78, 61, 60, 59, 57, 56, 57, 59, 60, 61, 62, 64, 65,
- 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79,
- 79, 79, 63, 62, 60, 59, 58, 59, 60, 61, 62, 64, 65, 66, 68, 69, 70, 71,
- 72, 73, 73, 74, 75, 76, 76, 77, 77, 78, 78, 79, 79, 79, 79, 79, 65, 63,
- 62, 61, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 71, 72, 73, 73, 74, 75,
- 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 80, 80, 66, 65, 64, 63, 62, 62,
- 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 76, 77, 77, 78,
- 79, 79, 79, 80, 80, 80, 80, 80, 68, 66, 65, 64, 63, 64, 65, 65, 66, 67,
- 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 77, 78, 78, 79, 79, 80, 80,
- 81, 81, 81, 81, 69, 68, 67, 65, 64, 65, 66, 67, 67, 68, 69, 70, 71, 72,
- 73, 74, 75, 75, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 81, 81, 81,
- 70, 69, 68, 67, 66, 66, 67, 68, 69, 69, 70, 71, 72, 73, 74, 74, 75, 76,
- 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 81, 81, 81, 81, 72, 70, 69, 68,
- 67, 68, 69, 69, 70, 71, 71, 72, 73, 74, 74, 75, 76, 76, 77, 78, 78, 79,
- 79, 80, 80, 81, 81, 81, 82, 82, 82, 82, 72, 70, 69, 68, 67, 68, 69, 69,
- 70, 71, 71, 72, 73, 74, 74, 75, 76, 76, 77, 78, 78, 79, 79, 80, 80, 81,
- 81, 81, 82, 82, 82, 82, 72, 70, 69, 68, 67, 68, 69, 69, 70, 71, 71, 72,
- 73, 74, 74, 75, 76, 76, 77, 78, 78, 79, 79, 80, 80, 81, 81, 81, 82, 82,
- 82, 82, 72, 70, 69, 68, 67, 68, 69, 69, 70, 71, 71, 72, 73, 74, 74, 75,
- 76, 76, 77, 78, 78, 79, 79, 80, 80, 81, 81, 81, 82, 82, 82, 82 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 86, 90, 101, 86, 95, 98, 105, 90, 98, 110, 117, 101, 105, 117, 125,
- /* Size 8 */
- 64, 55, 81, 84, 87, 92, 98, 104, 55, 71, 82, 77, 79, 83, 89, 95, 81, 82,
- 89, 88, 88, 90, 94, 99, 84, 77, 88, 94, 96, 98, 101, 104, 87, 79, 88,
- 96, 101, 104, 107, 110, 92, 83, 90, 98, 104, 109, 112, 115, 98, 89, 94,
- 101, 107, 112, 116, 118, 104, 95, 99, 104, 110, 115, 118, 121,
- /* Size 16 */
- 64, 59, 55, 66, 81, 82, 84, 85, 87, 90, 92, 95, 98, 101, 104, 104, 59,
- 61, 62, 70, 82, 81, 80, 82, 83, 85, 87, 90, 93, 96, 99, 99, 55, 62, 71,
- 76, 82, 80, 77, 78, 79, 81, 83, 86, 89, 92, 95, 95, 66, 70, 76, 80, 86,
- 84, 82, 83, 83, 85, 86, 89, 91, 94, 97, 97, 81, 82, 82, 86, 89, 89, 88,
- 88, 88, 89, 90, 92, 94, 96, 99, 99, 82, 81, 80, 84, 89, 90, 91, 91, 92,
- 93, 94, 96, 97, 99, 101, 101, 84, 80, 77, 82, 88, 91, 94, 95, 96, 97,
- 98, 99, 101, 102, 104, 104, 85, 82, 78, 83, 88, 91, 95, 97, 98, 100,
- 101, 102, 104, 105, 107, 107, 87, 83, 79, 83, 88, 92, 96, 98, 101, 103,
- 104, 106, 107, 108, 110, 110, 90, 85, 81, 85, 89, 93, 97, 100, 103, 105,
- 107, 108, 109, 111, 112, 112, 92, 87, 83, 86, 90, 94, 98, 101, 104, 107,
- 109, 110, 112, 113, 115, 115, 95, 90, 86, 89, 92, 96, 99, 102, 106, 108,
- 110, 112, 114, 115, 116, 116, 98, 93, 89, 91, 94, 97, 101, 104, 107,
- 109, 112, 114, 116, 117, 118, 118, 101, 96, 92, 94, 96, 99, 102, 105,
- 108, 111, 113, 115, 117, 118, 120, 120, 104, 99, 95, 97, 99, 101, 104,
- 107, 110, 112, 115, 116, 118, 120, 121, 121, 104, 99, 95, 97, 99, 101,
- 104, 107, 110, 112, 115, 116, 118, 120, 121, 121,
- /* Size 32 */
- 64, 62, 59, 57, 55, 60, 66, 73, 81, 82, 82, 83, 84, 85, 85, 86, 87, 88,
- 90, 91, 92, 94, 95, 97, 98, 100, 101, 102, 104, 104, 104, 104, 62, 61,
- 60, 59, 58, 63, 68, 74, 81, 82, 82, 82, 82, 83, 83, 84, 85, 86, 87, 88,
- 90, 91, 93, 94, 96, 97, 98, 100, 101, 101, 101, 101, 59, 60, 61, 61, 62,
- 66, 70, 76, 82, 81, 81, 81, 80, 81, 82, 82, 83, 84, 85, 86, 87, 89, 90,
- 92, 93, 95, 96, 98, 99, 99, 99, 99, 57, 59, 61, 64, 66, 69, 73, 77, 82,
- 81, 80, 80, 79, 79, 80, 80, 81, 82, 83, 84, 85, 87, 88, 89, 91, 92, 94,
- 95, 97, 97, 97, 97, 55, 58, 62, 66, 71, 73, 76, 79, 82, 81, 80, 78, 77,
- 78, 78, 78, 79, 80, 81, 82, 83, 84, 86, 87, 89, 90, 92, 93, 95, 95, 95,
- 95, 60, 63, 66, 69, 73, 76, 78, 81, 84, 83, 82, 81, 80, 80, 80, 81, 81,
- 82, 83, 84, 85, 86, 87, 89, 90, 91, 93, 94, 96, 96, 96, 96, 66, 68, 70,
- 73, 76, 78, 80, 83, 86, 85, 84, 83, 82, 82, 83, 83, 83, 84, 85, 86, 86,
- 88, 89, 90, 91, 93, 94, 95, 97, 97, 97, 97, 73, 74, 76, 77, 79, 81, 83,
- 85, 87, 87, 86, 86, 85, 85, 85, 85, 85, 86, 87, 87, 88, 89, 90, 92, 93,
- 94, 95, 96, 98, 98, 98, 98, 81, 81, 82, 82, 82, 84, 86, 87, 89, 89, 89,
- 88, 88, 88, 88, 88, 88, 88, 89, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99,
- 99, 99, 99, 82, 82, 81, 81, 81, 83, 85, 87, 89, 89, 89, 89, 89, 89, 89,
- 89, 90, 90, 91, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 100, 100, 100,
- 82, 82, 81, 80, 80, 82, 84, 86, 89, 89, 90, 90, 91, 91, 91, 91, 92, 92,
- 93, 93, 94, 95, 96, 96, 97, 98, 99, 100, 101, 101, 101, 101, 83, 82, 81,
- 80, 78, 81, 83, 86, 88, 89, 90, 91, 92, 92, 93, 93, 94, 94, 95, 95, 96,
- 97, 97, 98, 99, 100, 101, 102, 103, 103, 103, 103, 84, 82, 80, 79, 77,
- 80, 82, 85, 88, 89, 91, 92, 94, 94, 95, 95, 96, 96, 97, 97, 98, 99, 99,
- 100, 101, 102, 102, 103, 104, 104, 104, 104, 85, 83, 81, 79, 78, 80, 82,
- 85, 88, 89, 91, 92, 94, 95, 96, 96, 97, 98, 98, 99, 99, 100, 101, 102,
- 102, 103, 104, 105, 106, 106, 106, 106, 85, 83, 82, 80, 78, 80, 83, 85,
- 88, 89, 91, 93, 95, 96, 97, 98, 98, 99, 100, 100, 101, 102, 102, 103,
- 104, 105, 105, 106, 107, 107, 107, 107, 86, 84, 82, 80, 78, 81, 83, 85,
- 88, 89, 91, 93, 95, 96, 98, 99, 100, 100, 101, 102, 103, 103, 104, 105,
- 105, 106, 107, 108, 108, 108, 108, 108, 87, 85, 83, 81, 79, 81, 83, 85,
- 88, 90, 92, 94, 96, 97, 98, 100, 101, 102, 103, 104, 104, 105, 106, 106,
- 107, 108, 108, 109, 110, 110, 110, 110, 88, 86, 84, 82, 80, 82, 84, 86,
- 88, 90, 92, 94, 96, 98, 99, 100, 102, 103, 104, 105, 105, 106, 107, 108,
- 108, 109, 110, 110, 111, 111, 111, 111, 90, 87, 85, 83, 81, 83, 85, 87,
- 89, 91, 93, 95, 97, 98, 100, 101, 103, 104, 105, 106, 107, 107, 108,
- 109, 109, 110, 111, 111, 112, 112, 112, 112, 91, 88, 86, 84, 82, 84, 86,
- 87, 89, 91, 93, 95, 97, 99, 100, 102, 104, 105, 106, 107, 108, 108, 109,
- 110, 111, 111, 112, 113, 113, 113, 113, 113, 92, 90, 87, 85, 83, 85, 86,
- 88, 90, 92, 94, 96, 98, 99, 101, 103, 104, 105, 107, 108, 109, 110, 110,
- 111, 112, 113, 113, 114, 115, 115, 115, 115, 94, 91, 89, 87, 84, 86, 88,
- 89, 91, 93, 95, 97, 99, 100, 102, 103, 105, 106, 107, 108, 110, 110,
- 111, 112, 113, 114, 114, 115, 116, 116, 116, 116, 95, 93, 90, 88, 86,
- 87, 89, 90, 92, 94, 96, 97, 99, 101, 102, 104, 106, 107, 108, 109, 110,
- 111, 112, 113, 114, 114, 115, 116, 116, 116, 116, 116, 97, 94, 92, 89,
- 87, 89, 90, 92, 93, 95, 96, 98, 100, 102, 103, 105, 106, 108, 109, 110,
- 111, 112, 113, 114, 115, 115, 116, 117, 117, 117, 117, 117, 98, 96, 93,
- 91, 89, 90, 91, 93, 94, 96, 97, 99, 101, 102, 104, 105, 107, 108, 109,
- 111, 112, 113, 114, 115, 116, 116, 117, 118, 118, 118, 118, 118, 100,
- 97, 95, 92, 90, 91, 93, 94, 95, 97, 98, 100, 102, 103, 105, 106, 108,
- 109, 110, 111, 113, 114, 114, 115, 116, 117, 118, 118, 119, 119, 119,
- 119, 101, 98, 96, 94, 92, 93, 94, 95, 96, 98, 99, 101, 102, 104, 105,
- 107, 108, 110, 111, 112, 113, 114, 115, 116, 117, 118, 118, 119, 120,
- 120, 120, 120, 102, 100, 98, 95, 93, 94, 95, 96, 98, 99, 100, 102, 103,
- 105, 106, 108, 109, 110, 111, 113, 114, 115, 116, 117, 118, 118, 119,
- 120, 121, 121, 121, 121, 104, 101, 99, 97, 95, 96, 97, 98, 99, 100, 101,
- 103, 104, 106, 107, 108, 110, 111, 112, 113, 115, 116, 116, 117, 118,
- 119, 120, 121, 121, 121, 121, 121, 104, 101, 99, 97, 95, 96, 97, 98, 99,
- 100, 101, 103, 104, 106, 107, 108, 110, 111, 112, 113, 115, 116, 116,
- 117, 118, 119, 120, 121, 121, 121, 121, 121, 104, 101, 99, 97, 95, 96,
- 97, 98, 99, 100, 101, 103, 104, 106, 107, 108, 110, 111, 112, 113, 115,
- 116, 116, 117, 118, 119, 120, 121, 121, 121, 121, 121, 104, 101, 99, 97,
- 95, 96, 97, 98, 99, 100, 101, 103, 104, 106, 107, 108, 110, 111, 112,
- 113, 115, 116, 116, 117, 118, 119, 120, 121, 121, 121, 121, 121 },
- { /* Intra matrices */
- /* Size 4 */
- 40, 54, 57, 65, 54, 60, 62, 67, 57, 62, 71, 75, 65, 67, 75, 81,
- /* Size 8 */
- 42, 36, 54, 56, 58, 62, 66, 70, 36, 47, 54, 51, 52, 55, 59, 64, 54, 54,
- 60, 59, 58, 60, 63, 66, 56, 51, 59, 63, 64, 66, 68, 70, 58, 52, 58, 64,
- 68, 70, 72, 74, 62, 55, 60, 66, 70, 74, 76, 78, 66, 59, 63, 68, 72, 76,
- 79, 81, 70, 64, 66, 70, 74, 78, 81, 83,
- /* Size 16 */
- 41, 38, 35, 43, 53, 54, 55, 56, 57, 59, 61, 63, 65, 67, 69, 69, 38, 39,
- 40, 46, 53, 53, 53, 53, 54, 56, 57, 59, 62, 64, 66, 66, 35, 40, 46, 49,
- 54, 52, 51, 51, 51, 53, 54, 56, 58, 60, 63, 63, 43, 46, 49, 53, 56, 55,
- 54, 54, 54, 56, 57, 58, 60, 62, 64, 64, 53, 53, 54, 56, 59, 58, 58, 58,
- 58, 58, 59, 61, 62, 64, 65, 65, 54, 53, 52, 55, 58, 59, 60, 60, 60, 61,
- 62, 63, 64, 66, 67, 67, 55, 53, 51, 54, 58, 60, 62, 63, 63, 64, 65, 66,
- 67, 68, 69, 69, 56, 53, 51, 54, 58, 60, 63, 64, 65, 66, 67, 68, 69, 70,
- 71, 71, 57, 54, 51, 54, 58, 60, 63, 65, 67, 68, 69, 70, 71, 72, 73, 73,
- 59, 56, 53, 56, 58, 61, 64, 66, 68, 70, 71, 72, 73, 74, 75, 75, 61, 57,
- 54, 57, 59, 62, 65, 67, 69, 71, 73, 74, 75, 76, 77, 77, 63, 59, 56, 58,
- 61, 63, 66, 68, 70, 72, 74, 75, 76, 77, 78, 78, 65, 62, 58, 60, 62, 64,
- 67, 69, 71, 73, 75, 76, 78, 79, 80, 80, 67, 64, 60, 62, 64, 66, 68, 70,
- 72, 74, 76, 77, 79, 80, 81, 81, 69, 66, 63, 64, 65, 67, 69, 71, 73, 75,
- 77, 78, 80, 81, 82, 82, 69, 66, 63, 64, 65, 67, 69, 71, 73, 75, 77, 78,
- 80, 81, 82, 82,
- /* Size 32 */
- 41, 39, 38, 37, 35, 38, 42, 47, 53, 53, 54, 54, 55, 55, 56, 56, 57, 58,
- 59, 59, 60, 61, 62, 63, 65, 65, 66, 68, 69, 69, 69, 69, 39, 39, 38, 38,
- 37, 40, 44, 48, 53, 53, 53, 53, 53, 54, 54, 55, 55, 56, 57, 58, 59, 60,
- 61, 62, 63, 64, 65, 66, 67, 67, 67, 67, 38, 38, 39, 39, 40, 42, 45, 49,
- 53, 53, 53, 52, 52, 53, 53, 53, 54, 55, 55, 56, 57, 58, 59, 60, 61, 62,
- 63, 64, 65, 65, 65, 65, 37, 38, 39, 41, 42, 45, 47, 50, 53, 53, 52, 52,
- 51, 51, 52, 52, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 63, 64, 64,
- 64, 64, 35, 37, 40, 42, 46, 47, 49, 51, 53, 52, 52, 51, 50, 50, 51, 51,
- 51, 52, 53, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 62, 62, 62, 38, 40,
- 42, 45, 47, 49, 51, 52, 54, 54, 53, 52, 52, 52, 52, 52, 52, 53, 54, 54,
- 55, 56, 57, 58, 59, 60, 61, 62, 63, 63, 63, 63, 42, 44, 45, 47, 49, 51,
- 52, 54, 56, 55, 55, 54, 53, 54, 54, 54, 54, 55, 55, 56, 56, 57, 58, 59,
- 60, 61, 62, 63, 64, 64, 64, 64, 47, 48, 49, 50, 51, 52, 54, 55, 57, 57,
- 56, 56, 55, 55, 55, 55, 55, 56, 57, 57, 58, 58, 59, 60, 61, 62, 62, 63,
- 64, 64, 64, 64, 53, 53, 53, 53, 53, 54, 56, 57, 58, 58, 58, 58, 57, 57,
- 57, 57, 57, 58, 58, 58, 59, 60, 60, 61, 62, 62, 63, 64, 65, 65, 65, 65,
- 53, 53, 53, 53, 52, 54, 55, 57, 58, 58, 58, 58, 58, 58, 58, 58, 59, 59,
- 59, 60, 60, 61, 61, 62, 63, 64, 64, 65, 66, 66, 66, 66, 54, 53, 53, 52,
- 52, 53, 55, 56, 58, 58, 59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 62,
- 63, 63, 64, 65, 65, 66, 67, 67, 67, 67, 54, 53, 52, 52, 51, 52, 54, 56,
- 58, 58, 59, 60, 60, 61, 61, 61, 61, 62, 62, 63, 63, 63, 64, 65, 65, 66,
- 66, 67, 68, 68, 68, 68, 55, 53, 52, 51, 50, 52, 53, 55, 57, 58, 59, 60,
- 61, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 66, 66, 67, 68, 68, 69, 69,
- 69, 69, 55, 54, 53, 51, 50, 52, 54, 55, 57, 58, 59, 61, 62, 62, 63, 63,
- 64, 64, 65, 65, 65, 66, 66, 67, 67, 68, 69, 69, 70, 70, 70, 70, 56, 54,
- 53, 52, 51, 52, 54, 55, 57, 58, 60, 61, 62, 63, 63, 64, 65, 65, 66, 66,
- 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 71, 71, 56, 55, 53, 52, 51, 52,
- 54, 55, 57, 58, 60, 61, 63, 63, 64, 65, 66, 66, 67, 67, 68, 68, 69, 69,
- 70, 70, 71, 71, 72, 72, 72, 72, 57, 55, 54, 52, 51, 52, 54, 55, 57, 59,
- 60, 61, 63, 64, 65, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72,
- 73, 73, 73, 73, 58, 56, 55, 53, 52, 53, 55, 56, 58, 59, 60, 62, 63, 64,
- 65, 66, 67, 68, 68, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 74, 74,
- 59, 57, 55, 54, 53, 54, 55, 57, 58, 59, 61, 62, 64, 65, 66, 67, 68, 68,
- 69, 70, 70, 71, 71, 72, 73, 73, 73, 74, 74, 74, 74, 74, 59, 58, 56, 55,
- 53, 54, 56, 57, 58, 60, 61, 63, 64, 65, 66, 67, 68, 69, 70, 71, 71, 72,
- 72, 73, 73, 74, 74, 75, 75, 75, 75, 75, 60, 59, 57, 56, 54, 55, 56, 58,
- 59, 60, 61, 63, 64, 65, 67, 68, 69, 70, 70, 71, 72, 73, 73, 74, 74, 75,
- 75, 76, 76, 76, 76, 76, 61, 60, 58, 56, 55, 56, 57, 58, 60, 61, 62, 63,
- 65, 66, 67, 68, 69, 70, 71, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77,
- 77, 77, 62, 61, 59, 57, 56, 57, 58, 59, 60, 61, 63, 64, 65, 66, 68, 69,
- 70, 71, 71, 72, 73, 74, 74, 75, 76, 76, 77, 77, 78, 78, 78, 78, 63, 62,
- 60, 58, 57, 58, 59, 60, 61, 62, 63, 65, 66, 67, 68, 69, 70, 71, 72, 73,
- 74, 74, 75, 76, 76, 77, 77, 78, 78, 78, 78, 78, 65, 63, 61, 59, 58, 59,
- 60, 61, 62, 63, 64, 65, 66, 67, 69, 70, 71, 72, 73, 73, 74, 75, 76, 76,
- 77, 77, 78, 78, 79, 79, 79, 79, 65, 64, 62, 60, 59, 60, 61, 62, 62, 64,
- 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 77, 78, 78, 79,
- 79, 79, 79, 79, 66, 65, 63, 61, 60, 61, 62, 62, 63, 64, 65, 66, 68, 69,
- 70, 71, 72, 73, 73, 74, 75, 76, 77, 77, 78, 78, 79, 79, 80, 80, 80, 80,
- 68, 66, 64, 63, 61, 62, 63, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
- 74, 75, 76, 76, 77, 78, 78, 79, 79, 80, 81, 81, 81, 81, 69, 67, 65, 64,
- 62, 63, 64, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 74, 75, 76, 77,
- 78, 78, 79, 79, 80, 81, 81, 81, 81, 81, 69, 67, 65, 64, 62, 63, 64, 64,
- 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 74, 75, 76, 77, 78, 78, 79, 79,
- 80, 81, 81, 81, 81, 81, 69, 67, 65, 64, 62, 63, 64, 64, 65, 66, 67, 68,
- 69, 70, 71, 72, 73, 74, 74, 75, 76, 77, 78, 78, 79, 79, 80, 81, 81, 81,
- 81, 81, 69, 67, 65, 64, 62, 63, 64, 64, 65, 66, 67, 68, 69, 70, 71, 72,
- 73, 74, 74, 75, 76, 77, 78, 78, 79, 79, 80, 81, 81, 81, 81, 81 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 67, 88, 105, 67, 84, 97, 108, 88, 97, 109, 116, 105, 108, 116, 120,
- /* Size 8 */
- 64, 54, 57, 66, 77, 86, 94, 99, 54, 59, 57, 63, 72, 81, 88, 95, 57, 57,
- 69, 75, 80, 87, 92, 97, 66, 63, 75, 83, 89, 93, 97, 101, 77, 72, 80, 89,
- 94, 98, 101, 104, 86, 81, 87, 93, 98, 102, 104, 106, 94, 88, 92, 97,
- 101, 104, 106, 108, 99, 95, 97, 101, 104, 106, 108, 109,
- /* Size 16 */
- 64, 59, 54, 55, 57, 61, 66, 71, 77, 81, 86, 90, 94, 96, 99, 99, 59, 57,
- 56, 57, 57, 61, 65, 69, 74, 79, 83, 87, 91, 94, 97, 97, 54, 56, 59, 58,
- 57, 60, 63, 67, 72, 76, 81, 84, 88, 91, 95, 95, 55, 57, 58, 60, 63, 65,
- 68, 72, 76, 79, 83, 87, 90, 93, 96, 96, 57, 57, 57, 63, 69, 72, 75, 78,
- 80, 83, 87, 89, 92, 95, 97, 97, 61, 61, 60, 65, 72, 75, 79, 82, 84, 87,
- 90, 92, 95, 97, 99, 99, 66, 65, 63, 68, 75, 79, 83, 86, 89, 91, 93, 95,
- 97, 99, 101, 101, 71, 69, 67, 72, 78, 82, 86, 89, 91, 93, 95, 97, 99,
- 100, 102, 102, 77, 74, 72, 76, 80, 84, 89, 91, 94, 96, 98, 100, 101,
- 102, 104, 104, 81, 79, 76, 79, 83, 87, 91, 93, 96, 98, 100, 101, 103,
- 104, 105, 105, 86, 83, 81, 83, 87, 90, 93, 95, 98, 100, 102, 103, 104,
- 105, 106, 106, 90, 87, 84, 87, 89, 92, 95, 97, 100, 101, 103, 104, 105,
- 106, 107, 107, 94, 91, 88, 90, 92, 95, 97, 99, 101, 103, 104, 105, 106,
- 107, 108, 108, 96, 94, 91, 93, 95, 97, 99, 100, 102, 104, 105, 106, 107,
- 108, 109, 109, 99, 97, 95, 96, 97, 99, 101, 102, 104, 105, 106, 107,
- 108, 109, 109, 109, 99, 97, 95, 96, 97, 99, 101, 102, 104, 105, 106,
- 107, 108, 109, 109, 109,
- /* Size 32 */
- 64, 61, 59, 56, 54, 55, 55, 56, 57, 59, 61, 64, 66, 69, 71, 74, 77, 79,
- 81, 84, 86, 88, 90, 92, 94, 95, 96, 98, 99, 99, 99, 99, 61, 60, 58, 57,
- 55, 56, 56, 56, 57, 59, 61, 63, 66, 68, 70, 73, 76, 78, 80, 82, 85, 87,
- 88, 90, 92, 94, 95, 97, 98, 98, 98, 98, 59, 58, 57, 57, 56, 56, 57, 57,
- 57, 59, 61, 63, 65, 67, 69, 72, 74, 76, 79, 81, 83, 85, 87, 89, 91, 92,
- 94, 95, 97, 97, 97, 97, 56, 57, 57, 57, 58, 57, 57, 57, 57, 59, 60, 62,
- 64, 66, 68, 70, 73, 75, 77, 79, 82, 84, 86, 88, 90, 91, 93, 94, 96, 96,
- 96, 96, 54, 55, 56, 58, 59, 58, 58, 58, 57, 59, 60, 61, 63, 65, 67, 69,
- 72, 74, 76, 78, 81, 82, 84, 86, 88, 90, 91, 93, 95, 95, 95, 95, 55, 56,
- 56, 57, 58, 59, 59, 59, 60, 61, 63, 64, 65, 67, 69, 71, 74, 76, 78, 80,
- 82, 84, 86, 87, 89, 91, 92, 94, 95, 95, 95, 95, 55, 56, 57, 57, 58, 59,
- 60, 61, 63, 64, 65, 67, 68, 70, 72, 74, 76, 78, 79, 81, 83, 85, 87, 89,
- 90, 92, 93, 95, 96, 96, 96, 96, 56, 56, 57, 57, 58, 59, 61, 64, 66, 67,
- 68, 70, 71, 73, 75, 76, 78, 80, 81, 83, 85, 86, 88, 90, 91, 93, 94, 95,
- 97, 97, 97, 97, 57, 57, 57, 57, 57, 60, 63, 66, 69, 71, 72, 73, 75, 76,
- 78, 79, 80, 82, 83, 85, 87, 88, 89, 91, 92, 94, 95, 96, 97, 97, 97, 97,
- 59, 59, 59, 59, 59, 61, 64, 67, 71, 72, 74, 75, 77, 78, 79, 81, 82, 84,
- 85, 87, 88, 89, 91, 92, 93, 95, 96, 97, 98, 98, 98, 98, 61, 61, 61, 60,
- 60, 63, 65, 68, 72, 74, 75, 77, 79, 80, 82, 83, 84, 86, 87, 88, 90, 91,
- 92, 93, 95, 96, 97, 98, 99, 99, 99, 99, 64, 63, 63, 62, 61, 64, 67, 70,
- 73, 75, 77, 79, 81, 82, 84, 85, 86, 88, 89, 90, 91, 92, 93, 95, 96, 97,
- 98, 99, 100, 100, 100, 100, 66, 66, 65, 64, 63, 65, 68, 71, 75, 77, 79,
- 81, 83, 85, 86, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
- 101, 101, 101, 101, 69, 68, 67, 66, 65, 67, 70, 73, 76, 78, 80, 82, 85,
- 86, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 100, 101, 101,
- 101, 101, 71, 70, 69, 68, 67, 69, 72, 75, 78, 79, 82, 84, 86, 87, 89,
- 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 100, 101, 102, 102, 102,
- 102, 74, 73, 72, 70, 69, 71, 74, 76, 79, 81, 83, 85, 87, 89, 90, 91, 93,
- 94, 95, 96, 97, 98, 98, 99, 100, 101, 101, 102, 103, 103, 103, 103, 77,
- 76, 74, 73, 72, 74, 76, 78, 80, 82, 84, 86, 89, 90, 91, 93, 94, 95, 96,
- 97, 98, 99, 100, 100, 101, 102, 102, 103, 104, 104, 104, 104, 79, 78,
- 76, 75, 74, 76, 78, 80, 82, 84, 86, 88, 90, 91, 92, 94, 95, 96, 97, 98,
- 99, 100, 100, 101, 102, 102, 103, 104, 104, 104, 104, 104, 81, 80, 79,
- 77, 76, 78, 79, 81, 83, 85, 87, 89, 91, 92, 93, 95, 96, 97, 98, 99, 100,
- 101, 101, 102, 103, 103, 104, 104, 105, 105, 105, 105, 84, 82, 81, 79,
- 78, 80, 81, 83, 85, 87, 88, 90, 92, 93, 94, 96, 97, 98, 99, 100, 101,
- 101, 102, 103, 103, 104, 104, 105, 105, 105, 105, 105, 86, 85, 83, 82,
- 81, 82, 83, 85, 87, 88, 90, 91, 93, 94, 95, 97, 98, 99, 100, 101, 102,
- 102, 103, 103, 104, 105, 105, 106, 106, 106, 106, 106, 88, 87, 85, 84,
- 82, 84, 85, 86, 88, 89, 91, 92, 94, 95, 96, 98, 99, 100, 101, 101, 102,
- 103, 103, 104, 105, 105, 106, 106, 107, 107, 107, 107, 90, 88, 87, 86,
- 84, 86, 87, 88, 89, 91, 92, 93, 95, 96, 97, 98, 100, 100, 101, 102, 103,
- 103, 104, 105, 105, 106, 106, 107, 107, 107, 107, 107, 92, 90, 89, 88,
- 86, 87, 89, 90, 91, 92, 93, 95, 96, 97, 98, 99, 100, 101, 102, 103, 103,
- 104, 105, 105, 106, 106, 107, 107, 107, 107, 107, 107, 94, 92, 91, 90,
- 88, 89, 90, 91, 92, 93, 95, 96, 97, 98, 99, 100, 101, 102, 103, 103,
- 104, 105, 105, 106, 106, 107, 107, 108, 108, 108, 108, 108, 95, 94, 92,
- 91, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 102, 103,
- 104, 105, 105, 106, 106, 107, 107, 107, 108, 108, 108, 108, 108, 96, 95,
- 94, 93, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 100, 101, 102, 103,
- 104, 104, 105, 106, 106, 107, 107, 107, 108, 108, 109, 109, 109, 109,
- 98, 97, 95, 94, 93, 94, 95, 95, 96, 97, 98, 99, 100, 100, 101, 102, 103,
- 104, 104, 105, 106, 106, 107, 107, 108, 108, 108, 109, 109, 109, 109,
- 109, 99, 98, 97, 96, 95, 95, 96, 97, 97, 98, 99, 100, 101, 101, 102,
- 103, 104, 104, 105, 105, 106, 107, 107, 107, 108, 108, 109, 109, 109,
- 109, 109, 109, 99, 98, 97, 96, 95, 95, 96, 97, 97, 98, 99, 100, 101,
- 101, 102, 103, 104, 104, 105, 105, 106, 107, 107, 107, 108, 108, 109,
- 109, 109, 109, 109, 109, 99, 98, 97, 96, 95, 95, 96, 97, 97, 98, 99,
- 100, 101, 101, 102, 103, 104, 104, 105, 105, 106, 107, 107, 107, 108,
- 108, 109, 109, 109, 109, 109, 109, 99, 98, 97, 96, 95, 95, 96, 97, 97,
- 98, 99, 100, 101, 101, 102, 103, 104, 104, 105, 105, 106, 107, 107, 107,
- 108, 108, 109, 109, 109, 109, 109, 109 },
- { /* Intra matrices */
- /* Size 4 */
- 41, 43, 57, 69, 43, 54, 63, 71, 57, 63, 72, 77, 69, 71, 77, 80,
- /* Size 8 */
- 46, 38, 40, 47, 55, 63, 68, 73, 38, 42, 41, 45, 51, 58, 64, 69, 40, 41,
- 50, 54, 58, 63, 67, 71, 47, 45, 54, 60, 64, 68, 71, 74, 55, 51, 58, 64,
- 69, 72, 74, 76, 63, 58, 63, 68, 72, 75, 77, 78, 68, 64, 67, 71, 74, 77,
- 78, 80, 73, 69, 71, 74, 76, 78, 80, 81,
- /* Size 16 */
- 45, 41, 38, 38, 39, 43, 47, 50, 54, 58, 61, 64, 67, 69, 71, 71, 41, 40,
- 39, 39, 40, 42, 45, 49, 52, 56, 59, 62, 65, 67, 70, 70, 38, 39, 41, 40,
- 40, 42, 44, 47, 50, 54, 57, 60, 63, 65, 68, 68, 38, 39, 40, 42, 44, 46,
- 48, 51, 54, 56, 59, 62, 65, 67, 69, 69, 39, 40, 40, 44, 49, 51, 53, 55,
- 57, 59, 62, 64, 66, 68, 70, 70, 43, 42, 42, 46, 51, 53, 56, 58, 60, 62,
- 64, 66, 68, 69, 71, 71, 47, 45, 44, 48, 53, 56, 59, 61, 63, 65, 67, 68,
- 70, 71, 72, 72, 50, 49, 47, 51, 55, 58, 61, 63, 65, 67, 69, 70, 71, 72,
- 74, 74, 54, 52, 50, 54, 57, 60, 63, 65, 68, 69, 71, 72, 73, 74, 75, 75,
- 58, 56, 54, 56, 59, 62, 65, 67, 69, 70, 72, 73, 74, 75, 76, 76, 61, 59,
- 57, 59, 62, 64, 67, 69, 71, 72, 73, 74, 75, 76, 77, 77, 64, 62, 60, 62,
- 64, 66, 68, 70, 72, 73, 74, 75, 76, 77, 78, 78, 67, 65, 63, 65, 66, 68,
- 70, 71, 73, 74, 75, 76, 77, 78, 78, 78, 69, 67, 65, 67, 68, 69, 71, 72,
- 74, 75, 76, 77, 78, 78, 79, 79, 71, 70, 68, 69, 70, 71, 72, 74, 75, 76,
- 77, 78, 78, 79, 79, 79, 71, 70, 68, 69, 70, 71, 72, 74, 75, 76, 77, 78,
- 78, 79, 79, 79,
- /* Size 32 */
- 44, 42, 40, 39, 37, 38, 38, 39, 39, 41, 42, 44, 46, 48, 50, 52, 54, 56,
- 57, 59, 61, 62, 64, 65, 66, 68, 69, 70, 71, 71, 71, 71, 42, 41, 40, 39,
- 38, 38, 39, 39, 39, 41, 42, 44, 45, 47, 49, 51, 53, 54, 56, 58, 60, 61,
- 62, 64, 65, 67, 68, 69, 70, 70, 70, 70, 40, 40, 40, 39, 39, 39, 39, 39,
- 39, 41, 42, 43, 45, 46, 48, 50, 52, 53, 55, 57, 59, 60, 61, 63, 64, 66,
- 67, 68, 69, 69, 69, 69, 39, 39, 39, 39, 40, 40, 40, 39, 39, 40, 42, 43,
- 44, 46, 47, 49, 51, 52, 54, 56, 58, 59, 60, 62, 63, 65, 66, 67, 68, 68,
- 68, 68, 37, 38, 39, 40, 41, 40, 40, 40, 39, 40, 41, 42, 44, 45, 47, 48,
- 50, 51, 53, 55, 57, 58, 59, 61, 63, 64, 65, 66, 67, 67, 67, 67, 38, 38,
- 39, 40, 40, 41, 41, 41, 41, 42, 43, 44, 45, 47, 48, 50, 51, 53, 54, 56,
- 58, 59, 60, 62, 63, 64, 65, 67, 68, 68, 68, 68, 38, 39, 39, 40, 40, 41,
- 42, 43, 43, 44, 45, 46, 48, 49, 50, 52, 53, 54, 56, 57, 59, 60, 61, 63,
- 64, 65, 66, 67, 68, 68, 68, 68, 39, 39, 39, 39, 40, 41, 43, 44, 46, 47,
- 48, 49, 50, 51, 52, 53, 55, 56, 57, 59, 60, 61, 62, 63, 65, 66, 67, 68,
- 69, 69, 69, 69, 39, 39, 39, 39, 39, 41, 43, 46, 48, 49, 50, 51, 52, 53,
- 54, 55, 56, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 69, 69, 69,
- 41, 41, 41, 40, 40, 42, 44, 47, 49, 50, 51, 53, 54, 55, 56, 57, 58, 59,
- 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 70, 70, 70, 42, 42, 42, 42,
- 41, 43, 45, 48, 50, 51, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 70, 71, 71, 71, 71, 44, 44, 43, 43, 42, 44, 46, 49,
- 51, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 66, 67, 68, 69,
- 70, 70, 71, 71, 71, 71, 46, 45, 45, 44, 44, 45, 48, 50, 52, 54, 55, 57,
- 59, 60, 61, 62, 63, 63, 64, 65, 66, 67, 67, 68, 69, 70, 70, 71, 72, 72,
- 72, 72, 48, 47, 46, 46, 45, 47, 49, 51, 53, 55, 56, 58, 60, 61, 62, 63,
- 64, 64, 65, 66, 67, 68, 68, 69, 70, 70, 71, 72, 72, 72, 72, 72, 50, 49,
- 48, 47, 47, 48, 50, 52, 54, 56, 57, 59, 61, 62, 63, 64, 65, 66, 66, 67,
- 68, 69, 69, 70, 71, 71, 72, 72, 73, 73, 73, 73, 52, 51, 50, 49, 48, 50,
- 52, 53, 55, 57, 58, 60, 62, 63, 64, 65, 66, 67, 67, 68, 69, 69, 70, 71,
- 71, 72, 72, 73, 74, 74, 74, 74, 54, 53, 52, 51, 50, 51, 53, 55, 56, 58,
- 59, 61, 63, 64, 65, 66, 67, 68, 68, 69, 70, 70, 71, 72, 72, 73, 73, 74,
- 74, 74, 74, 74, 56, 54, 53, 52, 51, 53, 54, 56, 58, 59, 60, 62, 63, 64,
- 66, 67, 68, 68, 69, 70, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 75, 75,
- 57, 56, 55, 54, 53, 54, 56, 57, 59, 60, 61, 63, 64, 65, 66, 67, 68, 69,
- 70, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 75, 75, 75, 59, 58, 57, 56,
- 55, 56, 57, 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 70, 71, 71, 72, 72,
- 73, 73, 74, 74, 75, 75, 76, 76, 76, 76, 61, 60, 59, 58, 57, 58, 59, 60,
- 61, 62, 63, 65, 66, 67, 68, 69, 70, 71, 71, 72, 73, 73, 74, 74, 75, 75,
- 75, 76, 76, 76, 76, 76, 62, 61, 60, 59, 58, 59, 60, 61, 62, 63, 64, 66,
- 67, 68, 69, 69, 70, 71, 72, 72, 73, 74, 74, 75, 75, 75, 76, 76, 76, 76,
- 76, 76, 64, 62, 61, 60, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
- 71, 72, 72, 73, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 77, 77, 65, 64,
- 63, 62, 61, 62, 63, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 72, 73, 73,
- 74, 75, 75, 75, 76, 76, 77, 77, 77, 77, 77, 77, 66, 65, 64, 63, 63, 63,
- 64, 65, 65, 66, 67, 68, 69, 70, 71, 71, 72, 73, 73, 74, 75, 75, 75, 76,
- 76, 77, 77, 77, 78, 78, 78, 78, 68, 67, 66, 65, 64, 64, 65, 66, 66, 67,
- 68, 69, 70, 70, 71, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 77, 78,
- 78, 78, 78, 78, 69, 68, 67, 66, 65, 65, 66, 67, 67, 68, 69, 70, 70, 71,
- 72, 72, 73, 74, 74, 75, 75, 76, 76, 77, 77, 77, 77, 78, 78, 78, 78, 78,
- 70, 69, 68, 67, 66, 67, 67, 68, 68, 69, 70, 70, 71, 72, 72, 73, 74, 74,
- 75, 75, 76, 76, 76, 77, 77, 78, 78, 78, 78, 78, 78, 78, 71, 70, 69, 68,
- 67, 68, 68, 69, 69, 70, 71, 71, 72, 72, 73, 74, 74, 75, 75, 76, 76, 76,
- 77, 77, 78, 78, 78, 78, 79, 79, 79, 79, 71, 70, 69, 68, 67, 68, 68, 69,
- 69, 70, 71, 71, 72, 72, 73, 74, 74, 75, 75, 76, 76, 76, 77, 77, 78, 78,
- 78, 78, 79, 79, 79, 79, 71, 70, 69, 68, 67, 68, 68, 69, 69, 70, 71, 71,
- 72, 72, 73, 74, 74, 75, 75, 76, 76, 76, 77, 77, 78, 78, 78, 78, 79, 79,
- 79, 79, 71, 70, 69, 68, 67, 68, 68, 69, 69, 70, 71, 71, 72, 72, 73, 74,
- 74, 75, 75, 76, 76, 76, 77, 77, 78, 78, 78, 78, 79, 79, 79, 79 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 83, 86, 96, 83, 90, 93, 98, 86, 93, 103, 108, 96, 98, 108, 114,
- /* Size 8 */
- 64, 56, 79, 81, 84, 88, 93, 97, 56, 70, 80, 76, 77, 81, 85, 90, 79, 80,
- 86, 84, 84, 86, 90, 93, 81, 76, 84, 89, 91, 93, 95, 98, 84, 77, 84, 91,
- 95, 98, 100, 102, 88, 81, 86, 93, 98, 101, 104, 106, 93, 85, 90, 95,
- 100, 104, 106, 108, 97, 90, 93, 98, 102, 106, 108, 111,
- /* Size 16 */
- 64, 60, 56, 66, 79, 80, 81, 82, 84, 86, 88, 90, 93, 95, 97, 97, 60, 61,
- 62, 70, 79, 79, 78, 79, 80, 82, 84, 86, 89, 91, 94, 94, 56, 62, 70, 74,
- 80, 78, 76, 76, 77, 79, 81, 83, 85, 88, 90, 90, 66, 70, 74, 78, 83, 81,
- 80, 80, 80, 82, 83, 85, 87, 89, 92, 92, 79, 79, 80, 83, 86, 85, 84, 84,
- 84, 85, 86, 88, 90, 91, 93, 93, 80, 79, 78, 81, 85, 86, 87, 87, 88, 88,
- 89, 91, 92, 94, 95, 95, 81, 78, 76, 80, 84, 87, 89, 90, 91, 92, 93, 94,
- 95, 96, 98, 98, 82, 79, 76, 80, 84, 87, 90, 92, 93, 94, 95, 96, 97, 98,
- 100, 100, 84, 80, 77, 80, 84, 88, 91, 93, 95, 96, 98, 99, 100, 101, 102,
- 102, 86, 82, 79, 82, 85, 88, 92, 94, 96, 98, 99, 101, 102, 103, 104,
- 104, 88, 84, 81, 83, 86, 89, 93, 95, 98, 99, 101, 102, 104, 105, 106,
- 106, 90, 86, 83, 85, 88, 91, 94, 96, 99, 101, 102, 104, 105, 106, 107,
- 107, 93, 89, 85, 87, 90, 92, 95, 97, 100, 102, 104, 105, 106, 107, 108,
- 108, 95, 91, 88, 89, 91, 94, 96, 98, 101, 103, 105, 106, 107, 108, 109,
- 109, 97, 94, 90, 92, 93, 95, 98, 100, 102, 104, 106, 107, 108, 109, 111,
- 111, 97, 94, 90, 92, 93, 95, 98, 100, 102, 104, 106, 107, 108, 109, 111,
- 111,
- /* Size 32 */
- 64, 62, 60, 58, 56, 60, 66, 72, 79, 79, 80, 81, 81, 82, 82, 83, 84, 85,
- 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 97, 97, 97, 97, 62, 61, 60, 60,
- 59, 63, 68, 73, 79, 79, 79, 80, 80, 80, 81, 81, 82, 83, 84, 85, 86, 87,
- 88, 90, 91, 92, 93, 94, 95, 95, 95, 95, 60, 60, 61, 62, 62, 66, 70, 74,
- 79, 79, 79, 79, 78, 79, 79, 80, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90,
- 91, 92, 94, 94, 94, 94, 58, 60, 62, 64, 66, 69, 72, 75, 79, 79, 78, 78,
- 77, 77, 78, 78, 78, 79, 80, 81, 82, 83, 85, 86, 87, 88, 89, 91, 92, 92,
- 92, 92, 56, 59, 62, 66, 70, 72, 74, 77, 80, 79, 78, 77, 76, 76, 76, 77,
- 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 90, 90, 90, 60, 63,
- 66, 69, 72, 74, 76, 79, 81, 80, 79, 78, 78, 78, 78, 78, 79, 79, 80, 81,
- 82, 83, 84, 85, 86, 87, 89, 90, 91, 91, 91, 91, 66, 68, 70, 72, 74, 76,
- 78, 80, 83, 82, 81, 80, 80, 80, 80, 80, 80, 81, 82, 83, 83, 84, 85, 86,
- 87, 88, 89, 91, 92, 92, 92, 92, 72, 73, 74, 75, 77, 79, 80, 82, 84, 84,
- 83, 83, 82, 82, 82, 82, 82, 83, 83, 84, 85, 86, 87, 87, 88, 89, 90, 91,
- 92, 92, 92, 92, 79, 79, 79, 79, 80, 81, 83, 84, 86, 85, 85, 85, 84, 84,
- 84, 84, 84, 85, 85, 86, 86, 87, 88, 89, 90, 90, 91, 92, 93, 93, 93, 93,
- 79, 79, 79, 79, 79, 80, 82, 84, 85, 85, 85, 85, 86, 86, 86, 86, 86, 86,
- 87, 87, 88, 88, 89, 90, 91, 92, 93, 93, 94, 94, 94, 94, 80, 79, 79, 78,
- 78, 79, 81, 83, 85, 85, 86, 86, 87, 87, 87, 87, 88, 88, 88, 89, 89, 90,
- 91, 91, 92, 93, 94, 95, 95, 95, 95, 95, 81, 80, 79, 78, 77, 78, 80, 83,
- 85, 85, 86, 87, 88, 88, 89, 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 94,
- 95, 96, 96, 96, 96, 96, 81, 80, 78, 77, 76, 78, 80, 82, 84, 86, 87, 88,
- 89, 90, 90, 91, 91, 91, 92, 92, 93, 93, 94, 94, 95, 96, 96, 97, 98, 98,
- 98, 98, 82, 80, 79, 77, 76, 78, 80, 82, 84, 86, 87, 88, 90, 90, 91, 91,
- 92, 92, 93, 93, 94, 94, 95, 95, 96, 97, 97, 98, 99, 99, 99, 99, 82, 81,
- 79, 78, 76, 78, 80, 82, 84, 86, 87, 89, 90, 91, 92, 92, 93, 94, 94, 95,
- 95, 96, 96, 97, 97, 98, 98, 99, 100, 100, 100, 100, 83, 81, 80, 78, 77,
- 78, 80, 82, 84, 86, 87, 89, 91, 91, 92, 93, 94, 95, 95, 96, 96, 97, 97,
- 98, 99, 99, 100, 100, 101, 101, 101, 101, 84, 82, 80, 78, 77, 79, 80,
- 82, 84, 86, 88, 89, 91, 92, 93, 94, 95, 96, 96, 97, 98, 98, 99, 99, 100,
- 100, 101, 101, 102, 102, 102, 102, 85, 83, 81, 79, 78, 79, 81, 83, 85,
- 86, 88, 90, 91, 92, 94, 95, 96, 96, 97, 98, 99, 99, 100, 100, 101, 101,
- 102, 102, 103, 103, 103, 103, 86, 84, 82, 80, 79, 80, 82, 83, 85, 87,
- 88, 90, 92, 93, 94, 95, 96, 97, 98, 99, 99, 100, 101, 101, 102, 102,
- 103, 103, 104, 104, 104, 104, 87, 85, 83, 81, 80, 81, 83, 84, 86, 87,
- 89, 91, 92, 93, 95, 96, 97, 98, 99, 99, 100, 101, 101, 102, 103, 103,
- 104, 104, 105, 105, 105, 105, 88, 86, 84, 82, 81, 82, 83, 85, 86, 88,
- 89, 91, 93, 94, 95, 96, 98, 99, 99, 100, 101, 102, 102, 103, 104, 104,
- 105, 105, 106, 106, 106, 106, 89, 87, 85, 83, 82, 83, 84, 86, 87, 88,
- 90, 92, 93, 94, 96, 97, 98, 99, 100, 101, 102, 102, 103, 104, 104, 105,
- 105, 106, 106, 106, 106, 106, 90, 88, 86, 85, 83, 84, 85, 87, 88, 89,
- 91, 92, 94, 95, 96, 97, 99, 100, 101, 101, 102, 103, 104, 104, 105, 105,
- 106, 106, 107, 107, 107, 107, 92, 90, 88, 86, 84, 85, 86, 87, 89, 90,
- 91, 93, 94, 95, 97, 98, 99, 100, 101, 102, 103, 104, 104, 105, 106, 106,
- 107, 107, 108, 108, 108, 108, 93, 91, 89, 87, 85, 86, 87, 88, 90, 91,
- 92, 93, 95, 96, 97, 99, 100, 101, 102, 103, 104, 104, 105, 106, 106,
- 107, 107, 108, 108, 108, 108, 108, 94, 92, 90, 88, 86, 87, 88, 89, 90,
- 92, 93, 94, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 105, 106, 107,
- 107, 108, 108, 109, 109, 109, 109, 95, 93, 91, 89, 88, 89, 89, 90, 91,
- 93, 94, 95, 96, 97, 98, 100, 101, 102, 103, 104, 105, 105, 106, 107,
- 107, 108, 108, 109, 109, 109, 109, 109, 96, 94, 92, 91, 89, 90, 91, 91,
- 92, 93, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 106, 107,
- 108, 108, 109, 109, 110, 110, 110, 110, 97, 95, 94, 92, 90, 91, 92, 92,
- 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 106, 107,
- 108, 108, 109, 109, 110, 111, 111, 111, 111, 97, 95, 94, 92, 90, 91, 92,
- 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 106, 107,
- 108, 108, 109, 109, 110, 111, 111, 111, 111, 97, 95, 94, 92, 90, 91, 92,
- 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 106, 107,
- 108, 108, 109, 109, 110, 111, 111, 111, 111, 97, 95, 94, 92, 90, 91, 92,
- 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 106, 107,
- 108, 108, 109, 109, 110, 111, 111, 111, 111 },
- { /* Intra matrices */
- /* Size 4 */
- 42, 56, 58, 65, 56, 61, 63, 67, 58, 63, 70, 74, 65, 67, 74, 78,
- /* Size 8 */
- 45, 39, 55, 57, 59, 62, 66, 69, 39, 49, 56, 53, 54, 57, 60, 64, 55, 56,
- 61, 60, 60, 61, 63, 66, 57, 53, 60, 63, 65, 66, 68, 70, 59, 54, 60, 65,
- 68, 70, 71, 73, 62, 57, 61, 66, 70, 72, 74, 76, 66, 60, 63, 68, 71, 74,
- 76, 78, 69, 64, 66, 70, 73, 76, 78, 80,
- /* Size 16 */
- 44, 41, 38, 45, 55, 56, 56, 57, 58, 60, 62, 63, 65, 67, 69, 69, 41, 42,
- 43, 48, 55, 55, 54, 55, 56, 57, 59, 60, 62, 64, 66, 66, 38, 43, 48, 52,
- 55, 54, 52, 53, 53, 55, 56, 58, 59, 61, 63, 63, 45, 48, 52, 54, 57, 56,
- 55, 56, 56, 57, 58, 60, 61, 63, 64, 64, 55, 55, 55, 57, 60, 59, 59, 59,
- 59, 59, 60, 61, 63, 64, 66, 66, 56, 55, 54, 56, 59, 60, 61, 61, 61, 62,
- 63, 64, 65, 66, 67, 67, 56, 54, 52, 55, 59, 61, 62, 63, 64, 64, 65, 66,
- 67, 68, 69, 69, 57, 55, 53, 56, 59, 61, 63, 64, 65, 66, 67, 68, 69, 69,
- 70, 70, 58, 56, 53, 56, 59, 61, 64, 65, 67, 68, 69, 70, 70, 71, 72, 72,
- 60, 57, 55, 57, 59, 62, 64, 66, 68, 69, 70, 71, 72, 73, 73, 73, 62, 59,
- 56, 58, 60, 63, 65, 67, 69, 70, 71, 72, 73, 74, 75, 75, 63, 60, 58, 60,
- 61, 64, 66, 68, 70, 71, 72, 73, 74, 75, 76, 76, 65, 62, 59, 61, 63, 65,
- 67, 69, 70, 72, 73, 74, 75, 76, 77, 77, 67, 64, 61, 63, 64, 66, 68, 69,
- 71, 73, 74, 75, 76, 77, 78, 78, 69, 66, 63, 64, 66, 67, 69, 70, 72, 73,
- 75, 76, 77, 78, 79, 79, 69, 66, 63, 64, 66, 67, 69, 70, 72, 73, 75, 76,
- 77, 78, 79, 79,
- /* Size 32 */
- 44, 42, 41, 39, 38, 41, 45, 49, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59,
- 60, 60, 61, 62, 63, 64, 65, 66, 66, 67, 68, 68, 68, 68, 42, 42, 41, 41,
- 40, 43, 46, 50, 55, 55, 55, 55, 55, 55, 56, 56, 57, 57, 58, 59, 60, 61,
- 61, 62, 63, 64, 65, 66, 67, 67, 67, 67, 41, 41, 42, 42, 42, 45, 48, 51,
- 55, 55, 54, 54, 54, 54, 55, 55, 55, 56, 57, 58, 58, 59, 60, 61, 62, 63,
- 63, 64, 65, 65, 65, 65, 39, 41, 42, 43, 45, 47, 49, 52, 55, 54, 54, 53,
- 53, 53, 54, 54, 54, 55, 55, 56, 57, 58, 59, 59, 60, 61, 62, 63, 64, 64,
- 64, 64, 38, 40, 42, 45, 48, 49, 51, 53, 55, 54, 53, 53, 52, 52, 53, 53,
- 53, 54, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 63, 63, 63, 41, 43,
- 45, 47, 49, 51, 53, 54, 56, 55, 55, 54, 54, 54, 54, 54, 54, 55, 55, 56,
- 57, 57, 58, 59, 60, 61, 62, 62, 63, 63, 63, 63, 45, 46, 48, 49, 51, 53,
- 54, 56, 57, 57, 56, 56, 55, 55, 55, 55, 56, 56, 57, 57, 58, 58, 59, 60,
- 61, 61, 62, 63, 64, 64, 64, 64, 49, 50, 51, 52, 53, 54, 56, 57, 58, 58,
- 57, 57, 57, 57, 57, 57, 57, 57, 58, 58, 59, 59, 60, 61, 61, 62, 63, 64,
- 64, 64, 64, 64, 54, 55, 55, 55, 55, 56, 57, 58, 59, 59, 59, 59, 58, 58,
- 58, 58, 58, 59, 59, 59, 60, 60, 61, 62, 62, 63, 64, 64, 65, 65, 65, 65,
- 55, 55, 55, 54, 54, 55, 57, 58, 59, 59, 59, 59, 59, 59, 59, 59, 60, 60,
- 60, 61, 61, 62, 62, 63, 63, 64, 65, 65, 66, 66, 66, 66, 55, 55, 54, 54,
- 53, 55, 56, 57, 59, 59, 60, 60, 60, 60, 60, 61, 61, 61, 61, 62, 62, 63,
- 63, 64, 64, 65, 65, 66, 67, 67, 67, 67, 56, 55, 54, 53, 53, 54, 56, 57,
- 59, 59, 60, 60, 61, 61, 62, 62, 62, 62, 63, 63, 63, 64, 64, 65, 65, 66,
- 66, 67, 67, 67, 67, 67, 56, 55, 54, 53, 52, 54, 55, 57, 58, 59, 60, 61,
- 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 67, 67, 68, 68, 68,
- 68, 68, 57, 55, 54, 53, 52, 54, 55, 57, 58, 59, 60, 61, 62, 63, 63, 64,
- 64, 64, 65, 65, 66, 66, 66, 67, 67, 68, 68, 69, 69, 69, 69, 69, 57, 56,
- 55, 54, 53, 54, 55, 57, 58, 59, 60, 62, 63, 63, 64, 64, 65, 65, 66, 66,
- 66, 67, 67, 68, 68, 69, 69, 69, 70, 70, 70, 70, 58, 56, 55, 54, 53, 54,
- 55, 57, 58, 59, 61, 62, 63, 64, 64, 65, 66, 66, 67, 67, 67, 68, 68, 69,
- 69, 69, 70, 70, 71, 71, 71, 71, 58, 57, 55, 54, 53, 54, 56, 57, 58, 60,
- 61, 62, 63, 64, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 70, 71, 71,
- 72, 72, 72, 72, 59, 57, 56, 55, 54, 55, 56, 57, 59, 60, 61, 62, 64, 64,
- 65, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 71, 72, 72, 72, 72, 72,
- 60, 58, 57, 55, 54, 55, 57, 58, 59, 60, 61, 63, 64, 65, 66, 67, 67, 68,
- 69, 69, 70, 70, 71, 71, 71, 72, 72, 73, 73, 73, 73, 73, 60, 59, 58, 56,
- 55, 56, 57, 58, 59, 61, 62, 63, 64, 65, 66, 67, 68, 68, 69, 70, 70, 71,
- 71, 72, 72, 72, 73, 73, 74, 74, 74, 74, 61, 60, 58, 57, 56, 57, 58, 59,
- 60, 61, 62, 63, 65, 66, 66, 67, 68, 69, 70, 70, 71, 71, 72, 72, 73, 73,
- 74, 74, 74, 74, 74, 74, 62, 61, 59, 58, 56, 57, 58, 59, 60, 62, 63, 64,
- 65, 66, 67, 68, 69, 69, 70, 71, 71, 72, 72, 73, 73, 74, 74, 74, 75, 75,
- 75, 75, 63, 61, 60, 59, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
- 69, 70, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 75, 75, 75, 75, 64, 62,
- 61, 59, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 70, 71, 72,
- 72, 73, 73, 74, 74, 75, 75, 76, 76, 76, 76, 76, 65, 63, 62, 60, 59, 60,
- 61, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 71, 72, 73, 73, 74, 74,
- 75, 75, 76, 76, 76, 76, 76, 76, 66, 64, 63, 61, 60, 61, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 69, 70, 71, 72, 72, 73, 74, 74, 75, 75, 76, 76, 76,
- 77, 77, 77, 77, 66, 65, 63, 62, 61, 62, 62, 63, 64, 65, 65, 66, 67, 68,
- 69, 70, 71, 71, 72, 73, 74, 74, 75, 75, 76, 76, 76, 77, 77, 77, 77, 77,
- 67, 66, 64, 63, 62, 62, 63, 64, 64, 65, 66, 67, 68, 69, 69, 70, 71, 72,
- 73, 73, 74, 74, 75, 76, 76, 76, 77, 77, 78, 78, 78, 78, 68, 67, 65, 64,
- 63, 63, 64, 64, 65, 66, 67, 67, 68, 69, 70, 71, 72, 72, 73, 74, 74, 75,
- 75, 76, 76, 77, 77, 78, 78, 78, 78, 78, 68, 67, 65, 64, 63, 63, 64, 64,
- 65, 66, 67, 67, 68, 69, 70, 71, 72, 72, 73, 74, 74, 75, 75, 76, 76, 77,
- 77, 78, 78, 78, 78, 78, 68, 67, 65, 64, 63, 63, 64, 64, 65, 66, 67, 67,
- 68, 69, 70, 71, 72, 72, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 78,
- 78, 78, 68, 67, 65, 64, 63, 63, 64, 64, 65, 66, 67, 67, 68, 69, 70, 71,
- 72, 72, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 78, 78, 78 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 67, 84, 97, 67, 81, 91, 99, 84, 91, 100, 105, 97, 99, 105, 108,
- /* Size 8 */
- 64, 55, 58, 66, 75, 82, 88, 92, 55, 59, 58, 63, 70, 78, 84, 89, 58, 58,
- 68, 73, 78, 82, 87, 91, 66, 63, 73, 80, 84, 87, 90, 93, 75, 70, 78, 84,
- 88, 91, 93, 95, 82, 78, 82, 87, 91, 94, 96, 97, 88, 84, 87, 90, 93, 96,
- 97, 98, 92, 89, 91, 93, 95, 97, 98, 99,
- /* Size 16 */
- 64, 59, 55, 56, 58, 62, 66, 70, 75, 78, 82, 85, 88, 90, 92, 92, 59, 58,
- 57, 58, 58, 61, 65, 68, 73, 76, 80, 83, 86, 88, 90, 90, 55, 57, 59, 59,
- 58, 60, 63, 67, 70, 74, 78, 81, 84, 86, 89, 89, 56, 58, 59, 61, 63, 65,
- 68, 71, 74, 77, 80, 83, 85, 87, 90, 90, 58, 58, 58, 63, 68, 71, 73, 75,
- 78, 80, 82, 85, 87, 89, 91, 91, 62, 61, 60, 65, 71, 73, 76, 78, 81, 83,
- 85, 87, 89, 90, 92, 92, 66, 65, 63, 68, 73, 76, 80, 82, 84, 86, 87, 89,
- 90, 92, 93, 93, 70, 68, 67, 71, 75, 78, 82, 84, 86, 88, 89, 91, 92, 93,
- 94, 94, 75, 73, 70, 74, 78, 81, 84, 86, 88, 90, 91, 92, 93, 94, 95, 95,
- 78, 76, 74, 77, 80, 83, 86, 88, 90, 91, 92, 93, 94, 95, 96, 96, 82, 80,
- 78, 80, 82, 85, 87, 89, 91, 92, 94, 95, 96, 96, 97, 97, 85, 83, 81, 83,
- 85, 87, 89, 91, 92, 93, 95, 96, 96, 97, 98, 98, 88, 86, 84, 85, 87, 89,
- 90, 92, 93, 94, 96, 96, 97, 98, 98, 98, 90, 88, 86, 87, 89, 90, 92, 93,
- 94, 95, 96, 97, 98, 98, 99, 99, 92, 90, 89, 90, 91, 92, 93, 94, 95, 96,
- 97, 98, 98, 99, 99, 99, 92, 90, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
- 98, 99, 99, 99,
- /* Size 32 */
- 64, 62, 59, 57, 55, 56, 56, 57, 58, 60, 62, 64, 66, 68, 70, 72, 75, 77,
- 78, 80, 82, 84, 85, 86, 88, 89, 90, 91, 92, 92, 92, 92, 62, 60, 59, 58,
- 56, 57, 57, 57, 58, 60, 61, 63, 65, 67, 69, 71, 74, 75, 77, 79, 81, 82,
- 84, 85, 87, 88, 89, 90, 91, 91, 91, 91, 59, 59, 58, 58, 57, 57, 58, 58,
- 58, 59, 61, 63, 65, 66, 68, 70, 73, 74, 76, 78, 80, 81, 83, 84, 86, 87,
- 88, 89, 90, 90, 90, 90, 57, 58, 58, 58, 58, 58, 58, 58, 58, 59, 61, 62,
- 64, 66, 67, 69, 72, 73, 75, 77, 79, 80, 82, 83, 85, 86, 87, 88, 90, 90,
- 90, 90, 55, 56, 57, 58, 59, 59, 59, 58, 58, 59, 60, 62, 63, 65, 67, 68,
- 70, 72, 74, 76, 78, 79, 81, 82, 84, 85, 86, 87, 89, 89, 89, 89, 56, 57,
- 57, 58, 59, 59, 60, 60, 60, 62, 63, 64, 65, 67, 69, 70, 72, 74, 75, 77,
- 79, 80, 82, 83, 85, 86, 87, 88, 89, 89, 89, 89, 56, 57, 58, 58, 59, 60,
- 61, 62, 63, 64, 65, 66, 68, 69, 71, 72, 74, 75, 77, 78, 80, 81, 83, 84,
- 85, 86, 87, 89, 90, 90, 90, 90, 57, 57, 58, 58, 58, 60, 62, 64, 66, 67,
- 68, 69, 70, 72, 73, 74, 76, 77, 78, 80, 81, 82, 84, 85, 86, 87, 88, 89,
- 90, 90, 90, 90, 58, 58, 58, 58, 58, 60, 63, 66, 68, 70, 71, 72, 73, 74,
- 75, 76, 78, 79, 80, 81, 82, 83, 85, 86, 87, 88, 89, 90, 91, 91, 91, 91,
- 60, 60, 59, 59, 59, 62, 64, 67, 70, 71, 72, 73, 75, 76, 77, 78, 79, 80,
- 81, 82, 84, 85, 86, 87, 88, 89, 89, 90, 91, 91, 91, 91, 62, 61, 61, 61,
- 60, 63, 65, 68, 71, 72, 73, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86,
- 87, 88, 89, 89, 90, 91, 92, 92, 92, 92, 64, 63, 63, 62, 62, 64, 66, 69,
- 72, 73, 75, 76, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 89, 90,
- 91, 92, 92, 92, 92, 92, 66, 65, 65, 64, 63, 65, 68, 70, 73, 75, 76, 78,
- 80, 81, 82, 83, 84, 85, 86, 87, 87, 88, 89, 90, 90, 91, 92, 92, 93, 93,
- 93, 93, 68, 67, 66, 66, 65, 67, 69, 72, 74, 76, 77, 79, 81, 82, 83, 84,
- 85, 86, 87, 87, 88, 89, 90, 90, 91, 92, 92, 93, 94, 94, 94, 94, 70, 69,
- 68, 67, 67, 69, 71, 73, 75, 77, 78, 80, 82, 83, 84, 85, 86, 87, 88, 88,
- 89, 90, 91, 91, 92, 92, 93, 94, 94, 94, 94, 94, 72, 71, 70, 69, 68, 70,
- 72, 74, 76, 78, 80, 81, 83, 84, 85, 86, 87, 88, 89, 89, 90, 91, 91, 92,
- 93, 93, 94, 94, 95, 95, 95, 95, 75, 74, 73, 72, 70, 72, 74, 76, 78, 79,
- 81, 82, 84, 85, 86, 87, 88, 89, 90, 90, 91, 92, 92, 93, 93, 94, 94, 95,
- 95, 95, 95, 95, 77, 75, 74, 73, 72, 74, 75, 77, 79, 80, 82, 83, 85, 86,
- 87, 88, 89, 90, 90, 91, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96, 96, 96,
- 78, 77, 76, 75, 74, 75, 77, 78, 80, 81, 83, 84, 86, 87, 88, 89, 90, 90,
- 91, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96, 96, 96, 96, 80, 79, 78, 77,
- 76, 77, 78, 80, 81, 82, 84, 85, 87, 87, 88, 89, 90, 91, 92, 92, 93, 94,
- 94, 95, 95, 95, 96, 96, 97, 97, 97, 97, 82, 81, 80, 79, 78, 79, 80, 81,
- 82, 84, 85, 86, 87, 88, 89, 90, 91, 92, 92, 93, 94, 94, 95, 95, 96, 96,
- 96, 97, 97, 97, 97, 97, 84, 82, 81, 80, 79, 80, 81, 82, 83, 85, 86, 87,
- 88, 89, 90, 91, 92, 92, 93, 94, 94, 95, 95, 96, 96, 96, 97, 97, 97, 97,
- 97, 97, 85, 84, 83, 82, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 91,
- 92, 93, 93, 94, 95, 95, 96, 96, 96, 97, 97, 97, 98, 98, 98, 98, 86, 85,
- 84, 83, 82, 83, 84, 85, 86, 87, 88, 89, 90, 90, 91, 92, 93, 93, 94, 95,
- 95, 96, 96, 96, 97, 97, 97, 98, 98, 98, 98, 98, 88, 87, 86, 85, 84, 85,
- 85, 86, 87, 88, 89, 89, 90, 91, 92, 93, 93, 94, 94, 95, 96, 96, 96, 97,
- 97, 97, 98, 98, 98, 98, 98, 98, 89, 88, 87, 86, 85, 86, 86, 87, 88, 89,
- 89, 90, 91, 92, 92, 93, 94, 94, 95, 95, 96, 96, 97, 97, 97, 98, 98, 98,
- 99, 99, 99, 99, 90, 89, 88, 87, 86, 87, 87, 88, 89, 89, 90, 91, 92, 92,
- 93, 94, 94, 95, 95, 96, 96, 97, 97, 97, 98, 98, 98, 99, 99, 99, 99, 99,
- 91, 90, 89, 88, 87, 88, 89, 89, 90, 90, 91, 92, 92, 93, 94, 94, 95, 95,
- 96, 96, 97, 97, 97, 98, 98, 98, 99, 99, 99, 99, 99, 99, 92, 91, 90, 90,
- 89, 89, 90, 90, 91, 91, 92, 92, 93, 94, 94, 95, 95, 96, 96, 97, 97, 97,
- 98, 98, 98, 99, 99, 99, 99, 99, 99, 99, 92, 91, 90, 90, 89, 89, 90, 90,
- 91, 91, 92, 92, 93, 94, 94, 95, 95, 96, 96, 97, 97, 97, 98, 98, 98, 99,
- 99, 99, 99, 99, 99, 99, 92, 91, 90, 90, 89, 89, 90, 90, 91, 91, 92, 92,
- 93, 94, 94, 95, 95, 96, 96, 97, 97, 97, 98, 98, 98, 99, 99, 99, 99, 99,
- 99, 99, 92, 91, 90, 90, 89, 89, 90, 90, 91, 91, 92, 92, 93, 94, 94, 95,
- 95, 96, 96, 97, 97, 97, 98, 98, 98, 99, 99, 99, 99, 99, 99, 99 },
- { /* Intra matrices */
- /* Size 4 */
- 44, 46, 58, 68, 46, 56, 64, 70, 58, 64, 71, 74, 68, 70, 74, 77,
- /* Size 8 */
- 49, 42, 44, 50, 57, 63, 68, 71, 42, 45, 44, 48, 54, 60, 65, 69, 44, 44,
- 52, 56, 60, 63, 67, 70, 50, 48, 56, 61, 65, 68, 70, 72, 57, 54, 60, 65,
- 68, 71, 73, 74, 63, 60, 63, 68, 71, 73, 74, 76, 68, 65, 67, 70, 73, 74,
- 76, 77, 71, 69, 70, 72, 74, 76, 77, 78,
- /* Size 16 */
- 48, 44, 41, 42, 43, 46, 49, 53, 56, 59, 62, 65, 67, 69, 70, 70, 44, 43,
- 43, 43, 43, 45, 48, 51, 55, 57, 61, 63, 65, 67, 69, 69, 41, 43, 44, 44,
- 43, 45, 47, 50, 53, 56, 59, 61, 64, 66, 68, 68, 42, 43, 44, 45, 47, 49,
- 51, 53, 56, 58, 61, 63, 65, 67, 68, 68, 43, 43, 43, 47, 51, 53, 55, 57,
- 59, 61, 63, 64, 66, 68, 69, 69, 46, 45, 45, 49, 53, 55, 58, 59, 61, 63,
- 64, 66, 68, 69, 70, 70, 49, 48, 47, 51, 55, 58, 61, 62, 64, 65, 67, 68,
- 69, 70, 71, 71, 53, 51, 50, 53, 57, 59, 62, 64, 66, 67, 68, 69, 70, 71,
- 72, 72, 56, 55, 53, 56, 59, 61, 64, 66, 67, 69, 70, 71, 72, 72, 73, 73,
- 59, 57, 56, 58, 61, 63, 65, 67, 69, 70, 71, 72, 72, 73, 74, 74, 62, 61,
- 59, 61, 63, 64, 67, 68, 70, 71, 72, 73, 73, 74, 75, 75, 65, 63, 61, 63,
- 64, 66, 68, 69, 71, 72, 73, 73, 74, 75, 75, 75, 67, 65, 64, 65, 66, 68,
- 69, 70, 72, 72, 73, 74, 75, 75, 76, 76, 69, 67, 66, 67, 68, 69, 70, 71,
- 72, 73, 74, 75, 75, 76, 76, 76, 70, 69, 68, 68, 69, 70, 71, 72, 73, 74,
- 75, 75, 76, 76, 76, 76, 70, 69, 68, 68, 69, 70, 71, 72, 73, 74, 75, 75,
- 76, 76, 76, 76,
- /* Size 32 */
- 47, 46, 44, 42, 41, 41, 42, 42, 43, 44, 46, 47, 49, 51, 52, 54, 56, 57,
- 59, 60, 62, 63, 64, 65, 66, 67, 68, 69, 70, 70, 70, 70, 46, 44, 43, 42,
- 41, 42, 42, 42, 43, 44, 45, 47, 48, 50, 52, 53, 55, 56, 58, 59, 61, 62,
- 63, 64, 66, 66, 67, 68, 69, 69, 69, 69, 44, 43, 43, 43, 42, 42, 42, 43,
- 43, 44, 45, 46, 48, 49, 51, 52, 54, 56, 57, 58, 60, 61, 62, 64, 65, 66,
- 67, 68, 68, 68, 68, 68, 42, 42, 43, 43, 43, 43, 43, 43, 43, 44, 45, 46,
- 47, 49, 50, 52, 53, 55, 56, 58, 59, 60, 61, 63, 64, 65, 66, 67, 68, 68,
- 68, 68, 41, 41, 42, 43, 44, 44, 43, 43, 43, 44, 45, 46, 47, 48, 49, 51,
- 53, 54, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 67, 67, 67, 67, 41, 42,
- 42, 43, 44, 44, 44, 44, 45, 46, 46, 47, 48, 50, 51, 52, 54, 55, 56, 58,
- 59, 60, 61, 63, 64, 65, 66, 67, 68, 68, 68, 68, 42, 42, 42, 43, 43, 44,
- 45, 46, 47, 47, 48, 49, 50, 51, 53, 54, 55, 56, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 68, 68, 68, 42, 42, 43, 43, 43, 44, 46, 47, 49, 50,
- 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 67,
- 68, 68, 68, 68, 43, 43, 43, 43, 43, 45, 47, 49, 51, 52, 53, 54, 55, 55,
- 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 66, 67, 68, 69, 69, 69, 69,
- 44, 44, 44, 44, 44, 46, 47, 50, 52, 53, 54, 55, 56, 57, 58, 58, 59, 60,
- 61, 62, 63, 64, 65, 65, 66, 67, 68, 68, 69, 69, 69, 69, 46, 45, 45, 45,
- 45, 46, 48, 50, 53, 54, 55, 56, 57, 58, 59, 60, 61, 61, 62, 63, 64, 65,
- 65, 66, 67, 68, 68, 69, 70, 70, 70, 70, 47, 47, 46, 46, 46, 47, 49, 51,
- 54, 55, 56, 57, 59, 59, 60, 61, 62, 63, 63, 64, 65, 66, 66, 67, 68, 68,
- 69, 70, 70, 70, 70, 70, 49, 48, 48, 47, 47, 48, 50, 52, 55, 56, 57, 59,
- 60, 61, 62, 63, 63, 64, 65, 65, 66, 67, 67, 68, 69, 69, 70, 70, 71, 71,
- 71, 71, 51, 50, 49, 49, 48, 50, 51, 53, 55, 57, 58, 59, 61, 62, 63, 63,
- 64, 65, 65, 66, 67, 67, 68, 69, 69, 70, 70, 71, 71, 71, 71, 71, 52, 52,
- 51, 50, 49, 51, 53, 54, 56, 58, 59, 60, 62, 63, 63, 64, 65, 66, 66, 67,
- 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 72, 72, 54, 53, 52, 52, 51, 52,
- 54, 56, 57, 58, 60, 61, 63, 63, 64, 65, 66, 67, 67, 68, 68, 69, 69, 70,
- 70, 71, 71, 72, 72, 72, 72, 72, 56, 55, 54, 53, 53, 54, 55, 57, 58, 59,
- 61, 62, 63, 64, 65, 66, 67, 67, 68, 69, 69, 70, 70, 71, 71, 71, 72, 72,
- 72, 72, 72, 72, 57, 56, 56, 55, 54, 55, 56, 58, 59, 60, 61, 63, 64, 65,
- 66, 67, 67, 68, 69, 69, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73, 73,
- 59, 58, 57, 56, 55, 56, 58, 59, 60, 61, 62, 63, 65, 65, 66, 67, 68, 69,
- 69, 70, 70, 71, 71, 71, 72, 72, 73, 73, 73, 73, 73, 73, 60, 59, 58, 58,
- 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 69, 70, 70, 71, 71,
- 72, 72, 72, 73, 73, 73, 74, 74, 74, 74, 62, 61, 60, 59, 58, 59, 60, 61,
- 62, 63, 64, 65, 66, 67, 68, 68, 69, 70, 70, 71, 71, 72, 72, 72, 73, 73,
- 73, 74, 74, 74, 74, 74, 63, 62, 61, 60, 59, 60, 61, 62, 63, 64, 65, 66,
- 67, 67, 68, 69, 70, 70, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 74, 74,
- 74, 74, 64, 63, 62, 61, 61, 61, 62, 63, 64, 65, 65, 66, 67, 68, 69, 69,
- 70, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 75, 75, 65, 64,
- 64, 63, 62, 63, 63, 64, 65, 65, 66, 67, 68, 69, 69, 70, 71, 71, 71, 72,
- 72, 73, 73, 73, 74, 74, 74, 75, 75, 75, 75, 75, 66, 66, 65, 64, 63, 64,
- 64, 65, 66, 66, 67, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 73, 74,
- 74, 74, 75, 75, 75, 75, 75, 75, 67, 66, 66, 65, 64, 65, 65, 66, 66, 67,
- 68, 68, 69, 70, 70, 71, 71, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 75,
- 75, 75, 75, 75, 68, 67, 67, 66, 65, 66, 66, 67, 67, 68, 68, 69, 70, 70,
- 71, 71, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 75,
- 69, 68, 68, 67, 66, 67, 67, 67, 68, 68, 69, 70, 70, 71, 71, 72, 72, 72,
- 73, 73, 74, 74, 74, 75, 75, 75, 75, 75, 76, 76, 76, 76, 70, 69, 68, 68,
- 67, 68, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 72, 73, 73, 74, 74, 74,
- 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, 70, 69, 68, 68, 67, 68, 68, 68,
- 69, 69, 70, 70, 71, 71, 72, 72, 72, 73, 73, 74, 74, 74, 75, 75, 75, 75,
- 75, 76, 76, 76, 76, 76, 70, 69, 68, 68, 67, 68, 68, 68, 69, 69, 70, 70,
- 71, 71, 72, 72, 72, 73, 73, 74, 74, 74, 75, 75, 75, 75, 75, 76, 76, 76,
- 76, 76, 70, 69, 68, 68, 67, 68, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72,
- 72, 73, 73, 74, 74, 74, 75, 75, 75, 75, 75, 76, 76, 76, 76, 76 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 80, 83, 90, 80, 86, 88, 92, 83, 88, 96, 99, 90, 92, 99, 104,
- /* Size 8 */
- 64, 57, 77, 78, 80, 84, 88, 91, 57, 69, 77, 74, 75, 78, 82, 86, 77, 77,
- 82, 81, 81, 82, 85, 88, 78, 74, 81, 85, 86, 87, 89, 91, 80, 75, 81, 86,
- 89, 91, 93, 95, 84, 78, 82, 87, 91, 94, 96, 97, 88, 82, 85, 89, 93, 96,
- 98, 99, 91, 86, 88, 91, 95, 97, 99, 101,
- /* Size 16 */
- 64, 60, 57, 65, 77, 77, 78, 79, 80, 82, 84, 86, 88, 89, 91, 91, 60, 61,
- 62, 69, 77, 76, 76, 77, 78, 79, 81, 83, 85, 86, 88, 88, 57, 62, 69, 73,
- 77, 75, 74, 74, 75, 76, 78, 80, 82, 84, 86, 86, 65, 69, 73, 76, 80, 78,
- 77, 78, 78, 79, 80, 82, 83, 85, 87, 87, 77, 77, 77, 80, 82, 82, 81, 81,
- 81, 82, 82, 84, 85, 87, 88, 88, 77, 76, 75, 78, 82, 82, 83, 83, 83, 84,
- 85, 86, 87, 88, 90, 90, 78, 76, 74, 77, 81, 83, 85, 85, 86, 87, 87, 88,
- 89, 90, 91, 91, 79, 77, 74, 78, 81, 83, 85, 87, 88, 89, 89, 90, 91, 92,
- 93, 93, 80, 78, 75, 78, 81, 83, 86, 88, 89, 90, 91, 92, 93, 94, 95, 95,
- 82, 79, 76, 79, 82, 84, 87, 89, 90, 92, 93, 94, 94, 95, 96, 96, 84, 81,
- 78, 80, 82, 85, 87, 89, 91, 93, 94, 95, 96, 97, 97, 97, 86, 83, 80, 82,
- 84, 86, 88, 90, 92, 94, 95, 96, 97, 98, 98, 98, 88, 85, 82, 83, 85, 87,
- 89, 91, 93, 94, 96, 97, 98, 99, 99, 99, 89, 86, 84, 85, 87, 88, 90, 92,
- 94, 95, 97, 98, 99, 99, 100, 100, 91, 88, 86, 87, 88, 90, 91, 93, 95,
- 96, 97, 98, 99, 100, 101, 101, 91, 88, 86, 87, 88, 90, 91, 93, 95, 96,
- 97, 98, 99, 100, 101, 101,
- /* Size 32 */
- 64, 62, 60, 59, 57, 61, 65, 70, 77, 77, 77, 78, 78, 79, 79, 80, 80, 81,
- 82, 83, 84, 85, 86, 87, 88, 88, 89, 90, 91, 91, 91, 91, 62, 61, 61, 60,
- 60, 63, 67, 72, 77, 77, 77, 77, 77, 78, 78, 79, 79, 80, 81, 81, 82, 83,
- 84, 85, 86, 87, 88, 89, 90, 90, 90, 90, 60, 61, 61, 62, 62, 65, 69, 73,
- 77, 77, 76, 76, 76, 76, 77, 77, 78, 78, 79, 80, 81, 82, 83, 84, 85, 85,
- 86, 87, 88, 88, 88, 88, 59, 60, 62, 64, 66, 68, 71, 74, 77, 76, 76, 75,
- 75, 75, 76, 76, 76, 77, 78, 79, 79, 80, 81, 82, 83, 84, 85, 86, 87, 87,
- 87, 87, 57, 60, 62, 66, 69, 71, 73, 75, 77, 76, 75, 75, 74, 74, 74, 75,
- 75, 76, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 86, 86, 86, 61, 63,
- 65, 68, 71, 73, 74, 76, 78, 78, 77, 76, 76, 76, 76, 76, 76, 77, 78, 78,
- 79, 80, 81, 82, 82, 83, 84, 85, 86, 86, 86, 86, 65, 67, 69, 71, 73, 74,
- 76, 78, 80, 79, 78, 78, 77, 77, 78, 78, 78, 78, 79, 80, 80, 81, 82, 82,
- 83, 84, 85, 86, 87, 87, 87, 87, 70, 72, 73, 74, 75, 76, 78, 79, 81, 80,
- 80, 80, 79, 79, 79, 79, 79, 80, 80, 81, 81, 82, 83, 83, 84, 85, 86, 87,
- 87, 87, 87, 87, 77, 77, 77, 77, 77, 78, 80, 81, 82, 82, 82, 81, 81, 81,
- 81, 81, 81, 81, 82, 82, 82, 83, 84, 84, 85, 86, 87, 87, 88, 88, 88, 88,
- 77, 77, 77, 76, 76, 78, 79, 80, 82, 82, 82, 82, 82, 82, 82, 82, 82, 83,
- 83, 83, 84, 84, 85, 85, 86, 87, 87, 88, 89, 89, 89, 89, 77, 77, 76, 76,
- 75, 77, 78, 80, 82, 82, 82, 83, 83, 83, 83, 83, 83, 84, 84, 85, 85, 85,
- 86, 87, 87, 88, 88, 89, 90, 90, 90, 90, 78, 77, 76, 75, 75, 76, 78, 80,
- 81, 82, 83, 83, 84, 84, 84, 85, 85, 85, 86, 86, 86, 87, 87, 88, 88, 89,
- 89, 90, 90, 90, 90, 90, 78, 77, 76, 75, 74, 76, 77, 79, 81, 82, 83, 84,
- 85, 85, 85, 86, 86, 87, 87, 87, 87, 88, 88, 89, 89, 90, 90, 91, 91, 91,
- 91, 91, 79, 78, 76, 75, 74, 76, 77, 79, 81, 82, 83, 84, 85, 86, 86, 87,
- 87, 87, 88, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 92, 92, 92, 79, 78,
- 77, 76, 74, 76, 78, 79, 81, 82, 83, 84, 85, 86, 87, 87, 88, 88, 89, 89,
- 89, 90, 90, 91, 91, 92, 92, 92, 93, 93, 93, 93, 80, 79, 77, 76, 75, 76,
- 78, 79, 81, 82, 83, 85, 86, 87, 87, 88, 89, 89, 89, 90, 90, 91, 91, 92,
- 92, 92, 93, 93, 94, 94, 94, 94, 80, 79, 78, 76, 75, 76, 78, 79, 81, 82,
- 83, 85, 86, 87, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 93, 94, 94,
- 95, 95, 95, 95, 81, 80, 78, 77, 76, 77, 78, 80, 81, 83, 84, 85, 87, 87,
- 88, 89, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 94, 95, 95, 95, 95, 95,
- 82, 81, 79, 78, 76, 78, 79, 80, 82, 83, 84, 86, 87, 88, 89, 89, 90, 91,
- 92, 92, 93, 93, 94, 94, 94, 95, 95, 96, 96, 96, 96, 96, 83, 81, 80, 79,
- 77, 78, 80, 81, 82, 83, 85, 86, 87, 88, 89, 90, 91, 91, 92, 93, 93, 94,
- 94, 95, 95, 95, 96, 96, 97, 97, 97, 97, 84, 82, 81, 79, 78, 79, 80, 81,
- 82, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 93, 94, 94, 95, 95, 96, 96,
- 97, 97, 97, 97, 97, 97, 85, 83, 82, 80, 79, 80, 81, 82, 83, 84, 85, 87,
- 88, 89, 90, 91, 92, 92, 93, 94, 94, 95, 95, 96, 96, 97, 97, 97, 98, 98,
- 98, 98, 86, 84, 83, 81, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
- 92, 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 98, 98, 98, 98, 87, 85,
- 84, 82, 81, 82, 82, 83, 84, 85, 87, 88, 89, 90, 91, 92, 93, 93, 94, 95,
- 95, 96, 96, 97, 97, 98, 98, 98, 99, 99, 99, 99, 88, 86, 85, 83, 82, 82,
- 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 96, 97, 97,
- 98, 98, 99, 99, 99, 99, 99, 99, 88, 87, 85, 84, 83, 83, 84, 85, 86, 87,
- 88, 89, 90, 91, 92, 92, 93, 94, 95, 95, 96, 97, 97, 98, 98, 99, 99, 99,
- 100, 100, 100, 100, 89, 88, 86, 85, 84, 84, 85, 86, 87, 87, 88, 89, 90,
- 91, 92, 93, 94, 94, 95, 96, 97, 97, 98, 98, 99, 99, 99, 100, 100, 100,
- 100, 100, 90, 89, 87, 86, 85, 85, 86, 87, 87, 88, 89, 90, 91, 92, 92,
- 93, 94, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 101,
- 101, 91, 90, 88, 87, 86, 86, 87, 87, 88, 89, 90, 90, 91, 92, 93, 94, 95,
- 95, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 101, 101, 101, 91,
- 90, 88, 87, 86, 86, 87, 87, 88, 89, 90, 90, 91, 92, 93, 94, 95, 95, 96,
- 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 101, 101, 101, 91, 90, 88,
- 87, 86, 86, 87, 87, 88, 89, 90, 90, 91, 92, 93, 94, 95, 95, 96, 97, 97,
- 98, 98, 99, 99, 100, 100, 101, 101, 101, 101, 101, 91, 90, 88, 87, 86,
- 86, 87, 87, 88, 89, 90, 90, 91, 92, 93, 94, 95, 95, 96, 97, 97, 98, 98,
- 99, 99, 100, 100, 101, 101, 101, 101, 101 },
- { /* Intra matrices */
- /* Size 4 */
- 45, 57, 59, 65, 57, 62, 63, 67, 59, 63, 69, 72, 65, 67, 72, 76,
- /* Size 8 */
- 47, 42, 57, 59, 60, 63, 66, 69, 42, 51, 57, 55, 56, 58, 61, 64, 57, 57,
- 61, 61, 61, 62, 64, 66, 59, 55, 61, 64, 65, 66, 67, 69, 60, 56, 61, 65,
- 67, 69, 70, 71, 63, 58, 62, 66, 69, 71, 72, 74, 66, 61, 64, 67, 70, 72,
- 74, 75, 69, 64, 66, 69, 71, 74, 75, 77,
- /* Size 16 */
- 47, 44, 41, 48, 56, 57, 58, 59, 60, 61, 62, 64, 65, 67, 68, 68, 44, 45,
- 46, 50, 57, 56, 56, 57, 57, 58, 60, 61, 63, 64, 66, 66, 41, 46, 51, 54,
- 57, 56, 54, 55, 55, 56, 57, 59, 60, 62, 63, 63, 48, 50, 54, 56, 59, 58,
- 57, 57, 57, 58, 59, 60, 62, 63, 64, 64, 56, 57, 57, 59, 61, 60, 60, 60,
- 60, 60, 61, 62, 63, 64, 65, 65, 57, 56, 56, 58, 60, 61, 61, 62, 62, 62,
- 63, 64, 65, 66, 67, 67, 58, 56, 54, 57, 60, 61, 63, 63, 64, 65, 65, 66,
- 66, 67, 68, 68, 59, 57, 55, 57, 60, 62, 63, 64, 65, 66, 67, 67, 68, 69,
- 69, 69, 60, 57, 55, 57, 60, 62, 64, 65, 67, 67, 68, 69, 69, 70, 71, 71,
- 61, 58, 56, 58, 60, 62, 65, 66, 67, 68, 69, 70, 71, 71, 72, 72, 62, 60,
- 57, 59, 61, 63, 65, 67, 68, 69, 70, 71, 72, 72, 73, 73, 64, 61, 59, 60,
- 62, 64, 66, 67, 69, 70, 71, 72, 73, 73, 74, 74, 65, 63, 60, 62, 63, 65,
- 66, 68, 69, 71, 72, 73, 73, 74, 75, 75, 67, 64, 62, 63, 64, 66, 67, 69,
- 70, 71, 72, 73, 74, 75, 75, 75, 68, 66, 63, 64, 65, 67, 68, 69, 71, 72,
- 73, 74, 75, 75, 76, 76, 68, 66, 63, 64, 65, 67, 68, 69, 71, 72, 73, 74,
- 75, 75, 76, 76,
- /* Size 32 */
- 46, 45, 44, 42, 41, 44, 47, 51, 56, 56, 57, 57, 58, 58, 58, 59, 59, 60,
- 61, 61, 62, 63, 63, 64, 65, 65, 66, 67, 68, 68, 68, 68, 45, 45, 44, 44,
- 43, 46, 49, 52, 56, 56, 56, 57, 57, 57, 57, 58, 58, 59, 59, 60, 61, 61,
- 62, 63, 64, 64, 65, 66, 66, 66, 66, 66, 44, 44, 44, 45, 45, 48, 50, 53,
- 56, 56, 56, 56, 56, 56, 56, 57, 57, 58, 58, 59, 59, 60, 61, 62, 62, 63,
- 64, 65, 65, 65, 65, 65, 42, 44, 45, 46, 48, 50, 52, 54, 56, 56, 56, 55,
- 55, 55, 55, 56, 56, 56, 57, 58, 58, 59, 60, 60, 61, 62, 63, 63, 64, 64,
- 64, 64, 41, 43, 45, 48, 50, 52, 53, 55, 57, 56, 55, 55, 54, 54, 54, 55,
- 55, 55, 56, 57, 57, 58, 59, 59, 60, 61, 62, 62, 63, 63, 63, 63, 44, 46,
- 48, 50, 52, 53, 54, 56, 57, 57, 56, 56, 55, 56, 56, 56, 56, 56, 57, 57,
- 58, 59, 59, 60, 61, 61, 62, 63, 64, 64, 64, 64, 47, 49, 50, 52, 53, 54,
- 56, 57, 58, 58, 58, 57, 57, 57, 57, 57, 57, 58, 58, 58, 59, 60, 60, 61,
- 61, 62, 63, 63, 64, 64, 64, 64, 51, 52, 53, 54, 55, 56, 57, 58, 59, 59,
- 59, 58, 58, 58, 58, 58, 58, 59, 59, 59, 60, 60, 61, 62, 62, 63, 63, 64,
- 65, 65, 65, 65, 56, 56, 56, 56, 57, 57, 58, 59, 60, 60, 60, 60, 60, 60,
- 60, 60, 60, 60, 60, 60, 61, 61, 62, 62, 63, 63, 64, 65, 65, 65, 65, 65,
- 56, 56, 56, 56, 56, 57, 58, 59, 60, 60, 60, 60, 60, 60, 60, 60, 61, 61,
- 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 66, 66, 57, 56, 56, 56,
- 55, 56, 58, 59, 60, 60, 61, 61, 61, 61, 61, 61, 62, 62, 62, 62, 63, 63,
- 64, 64, 64, 65, 65, 66, 66, 66, 66, 66, 57, 57, 56, 55, 55, 56, 57, 58,
- 60, 60, 61, 61, 62, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 65, 65, 66,
- 66, 67, 67, 67, 67, 67, 58, 57, 56, 55, 54, 55, 57, 58, 60, 60, 61, 62,
- 63, 63, 63, 63, 64, 64, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 68, 68,
- 68, 68, 58, 57, 56, 55, 54, 56, 57, 58, 60, 60, 61, 62, 63, 63, 64, 64,
- 64, 65, 65, 65, 65, 66, 66, 66, 67, 67, 68, 68, 68, 68, 68, 68, 58, 57,
- 56, 55, 54, 56, 57, 58, 60, 60, 61, 62, 63, 64, 64, 64, 65, 65, 66, 66,
- 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 69, 69, 59, 58, 57, 56, 55, 56,
- 57, 58, 60, 60, 61, 62, 63, 64, 64, 65, 66, 66, 66, 67, 67, 67, 68, 68,
- 68, 69, 69, 69, 70, 70, 70, 70, 59, 58, 57, 56, 55, 56, 57, 58, 60, 61,
- 62, 63, 64, 64, 65, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70,
- 70, 70, 70, 70, 60, 59, 58, 56, 55, 56, 58, 59, 60, 61, 62, 63, 64, 65,
- 65, 66, 67, 67, 67, 68, 68, 69, 69, 69, 70, 70, 70, 71, 71, 71, 71, 71,
- 61, 59, 58, 57, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 66, 67, 67,
- 68, 68, 69, 69, 69, 70, 70, 70, 71, 71, 71, 71, 71, 71, 61, 60, 59, 58,
- 57, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 67, 68, 68, 69, 69, 70,
- 70, 70, 71, 71, 71, 72, 72, 72, 72, 72, 62, 61, 59, 58, 57, 58, 59, 60,
- 61, 62, 63, 64, 65, 65, 66, 67, 68, 68, 69, 69, 70, 70, 71, 71, 71, 72,
- 72, 72, 72, 72, 72, 72, 63, 61, 60, 59, 58, 59, 60, 60, 61, 62, 63, 64,
- 65, 66, 67, 67, 68, 69, 69, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73,
- 73, 73, 63, 62, 61, 60, 59, 59, 60, 61, 62, 63, 64, 64, 65, 66, 67, 68,
- 68, 69, 69, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73, 73, 73, 73, 64, 63,
- 62, 60, 59, 60, 61, 62, 62, 63, 64, 65, 66, 66, 67, 68, 69, 69, 70, 70,
- 71, 71, 72, 72, 73, 73, 73, 73, 74, 74, 74, 74, 65, 64, 62, 61, 60, 61,
- 61, 62, 63, 64, 64, 65, 66, 67, 68, 68, 69, 70, 70, 71, 71, 72, 72, 73,
- 73, 73, 74, 74, 74, 74, 74, 74, 65, 64, 63, 62, 61, 61, 62, 63, 63, 64,
- 65, 66, 66, 67, 68, 69, 69, 70, 70, 71, 72, 72, 72, 73, 73, 74, 74, 74,
- 74, 74, 74, 74, 66, 65, 64, 63, 62, 62, 63, 63, 64, 65, 65, 66, 67, 68,
- 68, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 74, 74, 75, 75, 75, 75,
- 67, 66, 65, 63, 62, 63, 63, 64, 65, 65, 66, 67, 67, 68, 69, 69, 70, 71,
- 71, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 75, 75, 75, 68, 66, 65, 64,
- 63, 64, 64, 65, 65, 66, 66, 67, 68, 68, 69, 70, 70, 71, 71, 72, 72, 73,
- 73, 74, 74, 74, 75, 75, 75, 75, 75, 75, 68, 66, 65, 64, 63, 64, 64, 65,
- 65, 66, 66, 67, 68, 68, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 74,
- 75, 75, 75, 75, 75, 75, 68, 66, 65, 64, 63, 64, 64, 65, 65, 66, 66, 67,
- 68, 68, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 74, 75, 75, 75, 75,
- 75, 75, 68, 66, 65, 64, 63, 64, 64, 65, 65, 66, 66, 67, 68, 68, 69, 70,
- 70, 71, 71, 72, 72, 73, 73, 74, 74, 74, 75, 75, 75, 75, 75, 75 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 67, 80, 89, 67, 77, 85, 91, 80, 85, 92, 95, 89, 91, 95, 97,
- /* Size 8 */
- 64, 57, 59, 66, 73, 78, 82, 85, 57, 60, 59, 63, 69, 75, 80, 83, 59, 59,
- 68, 71, 75, 78, 82, 84, 66, 63, 71, 77, 80, 82, 84, 86, 73, 69, 75, 80,
- 83, 85, 86, 88, 78, 75, 78, 82, 85, 87, 88, 89, 82, 80, 82, 84, 86, 88,
- 89, 90, 85, 83, 84, 86, 88, 89, 90, 91,
- /* Size 16 */
- 64, 60, 57, 58, 59, 62, 66, 69, 73, 75, 78, 80, 82, 84, 85, 85, 60, 59,
- 58, 59, 59, 62, 64, 68, 71, 74, 77, 79, 81, 83, 84, 84, 57, 58, 60, 60,
- 59, 61, 63, 66, 69, 72, 75, 77, 80, 81, 83, 83, 58, 59, 60, 61, 63, 65,
- 67, 69, 72, 74, 77, 79, 81, 82, 84, 84, 59, 59, 59, 63, 68, 69, 71, 73,
- 75, 77, 78, 80, 82, 83, 84, 84, 62, 62, 61, 65, 69, 72, 74, 75, 77, 79,
- 80, 82, 83, 84, 85, 85, 66, 64, 63, 67, 71, 74, 77, 78, 80, 81, 82, 83,
- 84, 85, 86, 86, 69, 68, 66, 69, 73, 75, 78, 80, 81, 82, 83, 84, 85, 86,
- 87, 87, 73, 71, 69, 72, 75, 77, 80, 81, 83, 84, 85, 86, 86, 87, 88, 88,
- 75, 74, 72, 74, 77, 79, 81, 82, 84, 85, 86, 86, 87, 88, 88, 88, 78, 77,
- 75, 77, 78, 80, 82, 83, 85, 86, 87, 87, 88, 88, 89, 89, 80, 79, 77, 79,
- 80, 82, 83, 84, 86, 86, 87, 88, 89, 89, 89, 89, 82, 81, 80, 81, 82, 83,
- 84, 85, 86, 87, 88, 89, 89, 89, 90, 90, 84, 83, 81, 82, 83, 84, 85, 86,
- 87, 88, 88, 89, 89, 90, 90, 90, 85, 84, 83, 84, 84, 85, 86, 87, 88, 88,
- 89, 89, 90, 90, 91, 91, 85, 84, 83, 84, 84, 85, 86, 87, 88, 88, 89, 89,
- 90, 90, 91, 91,
- /* Size 32 */
- 64, 62, 60, 58, 57, 57, 58, 58, 59, 60, 62, 64, 66, 67, 69, 71, 73, 74,
- 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 85, 85, 85, 85, 62, 61, 60, 59,
- 57, 58, 58, 58, 59, 60, 62, 63, 65, 67, 68, 70, 72, 73, 75, 76, 77, 78,
- 79, 81, 82, 82, 83, 84, 85, 85, 85, 85, 60, 60, 59, 59, 58, 58, 59, 59,
- 59, 60, 62, 63, 64, 66, 68, 69, 71, 72, 74, 75, 77, 78, 79, 80, 81, 82,
- 83, 83, 84, 84, 84, 84, 58, 59, 59, 59, 59, 59, 59, 59, 59, 60, 61, 63,
- 64, 65, 67, 68, 70, 71, 73, 74, 76, 77, 78, 79, 80, 81, 82, 83, 84, 84,
- 84, 84, 57, 57, 58, 59, 60, 60, 60, 59, 59, 60, 61, 62, 63, 65, 66, 68,
- 69, 71, 72, 73, 75, 76, 77, 78, 80, 80, 81, 82, 83, 83, 83, 83, 57, 58,
- 58, 59, 60, 60, 60, 61, 61, 62, 63, 64, 65, 66, 68, 69, 71, 72, 73, 74,
- 76, 77, 78, 79, 80, 81, 82, 83, 83, 83, 83, 83, 58, 58, 59, 59, 60, 60,
- 61, 62, 63, 64, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 77, 78, 79, 80,
- 81, 81, 82, 83, 84, 84, 84, 84, 58, 58, 59, 59, 59, 61, 62, 64, 65, 66,
- 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 78, 78, 79, 80, 81, 82, 83, 83,
- 84, 84, 84, 84, 59, 59, 59, 59, 59, 61, 63, 65, 68, 69, 69, 70, 71, 72,
- 73, 74, 75, 76, 77, 77, 78, 79, 80, 81, 82, 82, 83, 84, 84, 84, 84, 84,
- 60, 60, 60, 60, 60, 62, 64, 66, 69, 69, 70, 71, 73, 73, 74, 75, 76, 77,
- 78, 78, 79, 80, 81, 82, 82, 83, 84, 84, 85, 85, 85, 85, 62, 62, 62, 61,
- 61, 63, 65, 67, 69, 70, 72, 73, 74, 75, 75, 76, 77, 78, 79, 79, 80, 81,
- 82, 82, 83, 84, 84, 85, 85, 85, 85, 85, 64, 63, 63, 63, 62, 64, 66, 68,
- 70, 71, 73, 74, 75, 76, 77, 78, 78, 79, 80, 80, 81, 82, 82, 83, 84, 84,
- 85, 85, 86, 86, 86, 86, 66, 65, 64, 64, 63, 65, 67, 69, 71, 73, 74, 75,
- 77, 77, 78, 79, 80, 80, 81, 81, 82, 83, 83, 84, 84, 85, 85, 86, 86, 86,
- 86, 86, 67, 67, 66, 65, 65, 66, 68, 70, 72, 73, 75, 76, 77, 78, 79, 80,
- 80, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, 86, 86, 86, 86, 69, 68,
- 68, 67, 66, 68, 69, 71, 73, 74, 75, 77, 78, 79, 80, 80, 81, 82, 82, 83,
- 83, 84, 84, 85, 85, 86, 86, 86, 87, 87, 87, 87, 71, 70, 69, 68, 68, 69,
- 71, 72, 74, 75, 76, 78, 79, 80, 80, 81, 82, 83, 83, 84, 84, 85, 85, 85,
- 86, 86, 87, 87, 87, 87, 87, 87, 73, 72, 71, 70, 69, 71, 72, 73, 75, 76,
- 77, 78, 80, 80, 81, 82, 83, 83, 84, 84, 85, 85, 86, 86, 86, 87, 87, 87,
- 88, 88, 88, 88, 74, 73, 72, 71, 71, 72, 73, 74, 76, 77, 78, 79, 80, 81,
- 82, 83, 83, 84, 84, 85, 85, 86, 86, 86, 87, 87, 87, 88, 88, 88, 88, 88,
- 75, 75, 74, 73, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 82, 83, 84, 84,
- 85, 85, 86, 86, 86, 87, 87, 87, 88, 88, 88, 88, 88, 88, 77, 76, 75, 74,
- 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 84, 85, 85, 86, 86, 87,
- 87, 87, 88, 88, 88, 88, 89, 89, 89, 89, 78, 77, 77, 76, 75, 76, 77, 78,
- 78, 79, 80, 81, 82, 83, 83, 84, 85, 85, 86, 86, 87, 87, 87, 88, 88, 88,
- 88, 89, 89, 89, 89, 89, 79, 78, 78, 77, 76, 77, 78, 78, 79, 80, 81, 82,
- 83, 83, 84, 85, 85, 86, 86, 87, 87, 87, 88, 88, 88, 88, 89, 89, 89, 89,
- 89, 89, 80, 79, 79, 78, 77, 78, 79, 79, 80, 81, 82, 82, 83, 84, 84, 85,
- 86, 86, 86, 87, 87, 88, 88, 88, 89, 89, 89, 89, 89, 89, 89, 89, 81, 81,
- 80, 79, 78, 79, 80, 80, 81, 82, 82, 83, 84, 84, 85, 85, 86, 86, 87, 87,
- 88, 88, 88, 88, 89, 89, 89, 89, 90, 90, 90, 90, 82, 82, 81, 80, 80, 80,
- 81, 81, 82, 82, 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 88, 89, 89,
- 89, 89, 89, 90, 90, 90, 90, 90, 83, 82, 82, 81, 80, 81, 81, 82, 82, 83,
- 84, 84, 85, 85, 86, 86, 87, 87, 87, 88, 88, 88, 89, 89, 89, 89, 90, 90,
- 90, 90, 90, 90, 84, 83, 83, 82, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86,
- 86, 87, 87, 87, 88, 88, 88, 89, 89, 89, 89, 90, 90, 90, 90, 90, 90, 90,
- 85, 84, 83, 83, 82, 83, 83, 83, 84, 84, 85, 85, 86, 86, 86, 87, 87, 88,
- 88, 88, 89, 89, 89, 89, 90, 90, 90, 90, 90, 90, 90, 90, 85, 85, 84, 84,
- 83, 83, 84, 84, 84, 85, 85, 86, 86, 86, 87, 87, 88, 88, 88, 89, 89, 89,
- 89, 90, 90, 90, 90, 90, 91, 91, 91, 91, 85, 85, 84, 84, 83, 83, 84, 84,
- 84, 85, 85, 86, 86, 86, 87, 87, 88, 88, 88, 89, 89, 89, 89, 90, 90, 90,
- 90, 90, 91, 91, 91, 91, 85, 85, 84, 84, 83, 83, 84, 84, 84, 85, 85, 86,
- 86, 86, 87, 87, 88, 88, 88, 89, 89, 89, 89, 90, 90, 90, 90, 90, 91, 91,
- 91, 91, 85, 85, 84, 84, 83, 83, 84, 84, 84, 85, 85, 86, 86, 86, 87, 87,
- 88, 88, 88, 89, 89, 89, 89, 90, 90, 90, 90, 90, 91, 91, 91, 91 },
- { /* Intra matrices */
- /* Size 4 */
- 48, 50, 60, 68, 50, 58, 64, 69, 60, 64, 70, 72, 68, 69, 72, 74,
- /* Size 8 */
- 52, 45, 47, 53, 59, 64, 68, 70, 45, 48, 47, 51, 56, 61, 65, 68, 47, 47,
- 55, 58, 61, 64, 67, 69, 53, 51, 58, 62, 65, 67, 69, 71, 59, 56, 61, 65,
- 68, 70, 71, 72, 64, 61, 64, 67, 70, 71, 72, 73, 68, 65, 67, 69, 71, 72,
- 73, 74, 70, 68, 69, 71, 72, 73, 74, 75,
- /* Size 16 */
- 51, 48, 45, 46, 47, 49, 52, 55, 58, 61, 63, 65, 67, 68, 69, 69, 48, 47,
- 46, 46, 47, 49, 51, 54, 57, 59, 62, 63, 65, 67, 68, 68, 45, 46, 48, 47,
- 47, 48, 50, 53, 55, 58, 60, 62, 64, 66, 67, 67, 46, 46, 47, 49, 50, 52,
- 53, 55, 58, 60, 62, 63, 65, 66, 68, 68, 47, 47, 47, 50, 54, 56, 57, 59,
- 60, 62, 63, 65, 66, 67, 68, 68, 49, 49, 48, 52, 56, 57, 59, 61, 62, 63,
- 65, 66, 67, 68, 69, 69, 52, 51, 50, 53, 57, 59, 62, 63, 64, 65, 66, 67,
- 68, 69, 70, 70, 55, 54, 53, 55, 59, 61, 63, 64, 66, 67, 68, 68, 69, 70,
- 71, 71, 58, 57, 55, 58, 60, 62, 64, 66, 67, 68, 69, 69, 70, 71, 71, 71,
- 61, 59, 58, 60, 62, 63, 65, 67, 68, 69, 70, 70, 71, 71, 72, 72, 63, 62,
- 60, 62, 63, 65, 66, 68, 69, 70, 70, 71, 71, 72, 72, 72, 65, 63, 62, 63,
- 65, 66, 67, 68, 69, 70, 71, 71, 72, 72, 73, 73, 67, 65, 64, 65, 66, 67,
- 68, 69, 70, 71, 71, 72, 72, 73, 73, 73, 68, 67, 66, 66, 67, 68, 69, 70,
- 71, 71, 72, 72, 73, 73, 73, 73, 69, 68, 67, 68, 68, 69, 70, 71, 71, 72,
- 72, 73, 73, 73, 74, 74, 69, 68, 67, 68, 68, 69, 70, 71, 71, 72, 72, 73,
- 73, 73, 74, 74,
- /* Size 32 */
- 51, 49, 47, 46, 45, 45, 45, 46, 46, 48, 49, 50, 52, 53, 55, 56, 58, 59,
- 60, 61, 63, 64, 64, 65, 66, 67, 68, 68, 69, 69, 69, 69, 49, 48, 47, 46,
- 45, 46, 46, 46, 46, 48, 49, 50, 52, 53, 54, 56, 57, 58, 59, 61, 62, 63,
- 64, 65, 66, 66, 67, 68, 68, 68, 68, 68, 47, 47, 47, 46, 46, 46, 46, 46,
- 46, 47, 49, 50, 51, 52, 54, 55, 56, 58, 59, 60, 61, 62, 63, 64, 65, 66,
- 66, 67, 68, 68, 68, 68, 46, 46, 46, 47, 47, 47, 47, 47, 46, 47, 48, 49,
- 50, 52, 53, 54, 56, 57, 58, 59, 61, 61, 62, 63, 64, 65, 66, 67, 67, 67,
- 67, 67, 45, 45, 46, 47, 47, 47, 47, 47, 47, 47, 48, 49, 50, 51, 52, 54,
- 55, 56, 57, 59, 60, 61, 62, 63, 64, 65, 65, 66, 67, 67, 67, 67, 45, 46,
- 46, 47, 47, 47, 48, 48, 48, 49, 50, 51, 51, 53, 54, 55, 56, 57, 58, 59,
- 61, 61, 62, 63, 64, 65, 66, 66, 67, 67, 67, 67, 45, 46, 46, 47, 47, 48,
- 48, 49, 50, 51, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
- 65, 65, 66, 67, 67, 67, 67, 67, 46, 46, 46, 47, 47, 48, 49, 50, 52, 52,
- 53, 54, 55, 56, 57, 58, 58, 59, 60, 61, 62, 63, 64, 64, 65, 66, 66, 67,
- 68, 68, 68, 68, 46, 46, 46, 46, 47, 48, 50, 52, 54, 54, 55, 56, 57, 57,
- 58, 59, 60, 60, 61, 62, 63, 64, 64, 65, 66, 66, 67, 67, 68, 68, 68, 68,
- 48, 48, 47, 47, 47, 49, 51, 52, 54, 55, 56, 57, 58, 59, 59, 60, 61, 61,
- 62, 63, 64, 64, 65, 66, 66, 67, 67, 68, 68, 68, 68, 68, 49, 49, 49, 48,
- 48, 50, 51, 53, 55, 56, 57, 58, 59, 60, 60, 61, 62, 62, 63, 64, 64, 65,
- 66, 66, 67, 67, 68, 68, 69, 69, 69, 69, 50, 50, 50, 49, 49, 51, 52, 54,
- 56, 57, 58, 59, 60, 61, 61, 62, 63, 63, 64, 65, 65, 66, 66, 67, 67, 68,
- 68, 69, 69, 69, 69, 69, 52, 52, 51, 50, 50, 51, 53, 55, 57, 58, 59, 60,
- 61, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 69, 69,
- 69, 69, 53, 53, 52, 52, 51, 53, 54, 56, 57, 59, 60, 61, 62, 63, 63, 64,
- 65, 65, 66, 66, 67, 67, 67, 68, 68, 69, 69, 69, 70, 70, 70, 70, 55, 54,
- 54, 53, 52, 54, 55, 57, 58, 59, 60, 61, 63, 63, 64, 65, 65, 66, 66, 67,
- 67, 68, 68, 68, 69, 69, 69, 70, 70, 70, 70, 70, 56, 56, 55, 54, 54, 55,
- 56, 58, 59, 60, 61, 62, 63, 64, 65, 65, 66, 66, 67, 67, 68, 68, 68, 69,
- 69, 70, 70, 70, 70, 70, 70, 70, 58, 57, 56, 56, 55, 56, 57, 58, 60, 61,
- 62, 63, 64, 65, 65, 66, 67, 67, 67, 68, 68, 69, 69, 69, 70, 70, 70, 71,
- 71, 71, 71, 71, 59, 58, 58, 57, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
- 66, 66, 67, 67, 68, 68, 69, 69, 69, 70, 70, 70, 71, 71, 71, 71, 71, 71,
- 60, 59, 59, 58, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 66, 67, 67, 68,
- 68, 69, 69, 69, 70, 70, 70, 71, 71, 71, 71, 71, 71, 71, 61, 61, 60, 59,
- 59, 59, 60, 61, 62, 63, 64, 65, 65, 66, 67, 67, 68, 68, 69, 69, 70, 70,
- 70, 70, 71, 71, 71, 71, 72, 72, 72, 72, 63, 62, 61, 61, 60, 61, 61, 62,
- 63, 64, 64, 65, 66, 67, 67, 68, 68, 69, 69, 70, 70, 70, 70, 71, 71, 71,
- 71, 72, 72, 72, 72, 72, 64, 63, 62, 61, 61, 61, 62, 63, 64, 64, 65, 66,
- 66, 67, 68, 68, 69, 69, 69, 70, 70, 70, 71, 71, 71, 71, 72, 72, 72, 72,
- 72, 72, 64, 64, 63, 62, 62, 62, 63, 64, 64, 65, 66, 66, 67, 67, 68, 68,
- 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 72, 72, 72, 72, 72, 72, 65, 65,
- 64, 63, 63, 63, 64, 64, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 70,
- 71, 71, 71, 72, 72, 72, 72, 72, 72, 72, 72, 72, 66, 66, 65, 64, 64, 64,
- 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72,
- 72, 72, 72, 73, 73, 73, 73, 73, 67, 66, 66, 65, 65, 65, 65, 66, 66, 67,
- 67, 68, 68, 69, 69, 70, 70, 70, 71, 71, 71, 71, 72, 72, 72, 72, 73, 73,
- 73, 73, 73, 73, 68, 67, 66, 66, 65, 66, 66, 66, 67, 67, 68, 68, 69, 69,
- 69, 70, 70, 71, 71, 71, 71, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73,
- 68, 68, 67, 67, 66, 66, 67, 67, 67, 68, 68, 69, 69, 69, 70, 70, 71, 71,
- 71, 71, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73, 73, 69, 68, 68, 67,
- 67, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 72,
- 72, 72, 73, 73, 73, 73, 73, 73, 73, 73, 69, 68, 68, 67, 67, 67, 67, 68,
- 68, 68, 69, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 72, 72, 72, 73, 73,
- 73, 73, 73, 73, 73, 73, 69, 68, 68, 67, 67, 67, 67, 68, 68, 68, 69, 69,
- 69, 70, 70, 70, 71, 71, 71, 72, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73,
- 73, 73, 69, 68, 68, 67, 67, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 70,
- 71, 71, 71, 72, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73, 73 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 77, 79, 85, 77, 81, 83, 86, 79, 83, 89, 91, 85, 86, 91, 94,
- /* Size 8 */
- 64, 58, 74, 76, 77, 80, 83, 85, 58, 68, 75, 72, 73, 75, 78, 81, 74, 75,
- 78, 78, 78, 79, 81, 83, 76, 72, 78, 80, 82, 83, 84, 85, 77, 73, 78, 82,
- 84, 85, 87, 88, 80, 75, 79, 83, 85, 87, 89, 90, 83, 78, 81, 84, 87, 89,
- 90, 91, 85, 81, 83, 85, 88, 90, 91, 92,
- /* Size 16 */
- 64, 61, 58, 65, 74, 75, 76, 76, 77, 78, 80, 81, 83, 84, 85, 85, 61, 62,
- 63, 68, 74, 74, 74, 74, 75, 76, 77, 79, 80, 82, 83, 83, 58, 63, 68, 71,
- 75, 73, 72, 72, 73, 74, 75, 77, 78, 80, 81, 81, 65, 68, 71, 74, 76, 76,
- 75, 75, 75, 76, 77, 78, 79, 81, 82, 82, 74, 74, 75, 76, 78, 78, 78, 78,
- 78, 78, 79, 80, 81, 82, 83, 83, 75, 74, 73, 76, 78, 79, 79, 79, 79, 80,
- 81, 81, 82, 83, 84, 84, 76, 74, 72, 75, 78, 79, 80, 81, 82, 82, 83, 83,
- 84, 85, 85, 85, 76, 74, 72, 75, 78, 79, 81, 82, 83, 83, 84, 85, 85, 86,
- 86, 86, 77, 75, 73, 75, 78, 79, 82, 83, 84, 85, 85, 86, 87, 87, 88, 88,
- 78, 76, 74, 76, 78, 80, 82, 83, 85, 85, 86, 87, 88, 88, 89, 89, 80, 77,
- 75, 77, 79, 81, 83, 84, 85, 86, 87, 88, 89, 89, 90, 90, 81, 79, 77, 78,
- 80, 81, 83, 85, 86, 87, 88, 89, 89, 90, 90, 90, 83, 80, 78, 79, 81, 82,
- 84, 85, 87, 88, 89, 89, 90, 91, 91, 91, 84, 82, 80, 81, 82, 83, 85, 86,
- 87, 88, 89, 90, 91, 91, 92, 92, 85, 83, 81, 82, 83, 84, 85, 86, 88, 89,
- 90, 90, 91, 92, 92, 92, 85, 83, 81, 82, 83, 84, 85, 86, 88, 89, 90, 90,
- 91, 92, 92, 92,
- /* Size 32 */
- 64, 62, 61, 59, 58, 61, 65, 69, 74, 74, 75, 75, 76, 76, 76, 77, 77, 78,
- 78, 79, 80, 80, 81, 82, 83, 83, 84, 85, 85, 85, 85, 85, 62, 62, 61, 61,
- 60, 63, 67, 70, 74, 74, 74, 75, 75, 75, 75, 76, 76, 77, 77, 78, 79, 79,
- 80, 81, 81, 82, 83, 83, 84, 84, 84, 84, 61, 61, 62, 62, 63, 65, 68, 71,
- 74, 74, 74, 74, 74, 74, 74, 75, 75, 76, 76, 77, 77, 78, 79, 80, 80, 81,
- 82, 82, 83, 83, 83, 83, 59, 61, 62, 64, 65, 67, 70, 72, 74, 74, 74, 73,
- 73, 73, 73, 74, 74, 74, 75, 76, 76, 77, 78, 78, 79, 80, 81, 81, 82, 82,
- 82, 82, 58, 60, 63, 65, 68, 70, 71, 73, 75, 74, 73, 73, 72, 72, 72, 73,
- 73, 73, 74, 75, 75, 76, 77, 77, 78, 79, 80, 80, 81, 81, 81, 81, 61, 63,
- 65, 67, 70, 71, 72, 74, 76, 75, 74, 74, 73, 74, 74, 74, 74, 74, 75, 76,
- 76, 77, 77, 78, 79, 79, 80, 81, 81, 81, 81, 81, 65, 67, 68, 70, 71, 72,
- 74, 75, 76, 76, 76, 75, 75, 75, 75, 75, 75, 76, 76, 76, 77, 78, 78, 79,
- 79, 80, 81, 81, 82, 82, 82, 82, 69, 70, 71, 72, 73, 74, 75, 76, 77, 77,
- 77, 76, 76, 76, 76, 76, 76, 77, 77, 77, 78, 78, 79, 79, 80, 81, 81, 82,
- 82, 82, 82, 82, 74, 74, 74, 74, 75, 76, 76, 77, 78, 78, 78, 78, 78, 78,
- 78, 78, 78, 78, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 83, 83,
- 74, 74, 74, 74, 74, 75, 76, 77, 78, 78, 78, 78, 78, 78, 78, 78, 78, 79,
- 79, 79, 80, 80, 81, 81, 81, 82, 82, 83, 83, 83, 83, 83, 75, 74, 74, 74,
- 73, 74, 76, 77, 78, 78, 79, 79, 79, 79, 79, 79, 79, 80, 80, 80, 81, 81,
- 81, 82, 82, 83, 83, 84, 84, 84, 84, 84, 75, 75, 74, 73, 73, 74, 75, 76,
- 78, 78, 79, 79, 80, 80, 80, 80, 81, 81, 81, 81, 82, 82, 82, 83, 83, 83,
- 84, 84, 85, 85, 85, 85, 76, 75, 74, 73, 72, 73, 75, 76, 78, 78, 79, 80,
- 80, 81, 81, 81, 82, 82, 82, 82, 83, 83, 83, 83, 84, 84, 85, 85, 85, 85,
- 85, 85, 76, 75, 74, 73, 72, 74, 75, 76, 78, 78, 79, 80, 81, 81, 81, 82,
- 82, 82, 83, 83, 83, 84, 84, 84, 84, 85, 85, 86, 86, 86, 86, 86, 76, 75,
- 74, 73, 72, 74, 75, 76, 78, 78, 79, 80, 81, 81, 82, 82, 83, 83, 83, 84,
- 84, 84, 85, 85, 85, 85, 86, 86, 86, 86, 86, 86, 77, 76, 75, 74, 73, 74,
- 75, 76, 78, 78, 79, 80, 81, 82, 82, 83, 83, 84, 84, 84, 85, 85, 85, 86,
- 86, 86, 86, 87, 87, 87, 87, 87, 77, 76, 75, 74, 73, 74, 75, 76, 78, 78,
- 79, 81, 82, 82, 83, 83, 84, 84, 85, 85, 85, 86, 86, 86, 87, 87, 87, 87,
- 88, 88, 88, 88, 78, 77, 76, 74, 73, 74, 76, 77, 78, 79, 80, 81, 82, 82,
- 83, 84, 84, 85, 85, 85, 86, 86, 86, 87, 87, 87, 88, 88, 88, 88, 88, 88,
- 78, 77, 76, 75, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 83, 84, 85, 85,
- 85, 86, 86, 87, 87, 87, 88, 88, 88, 88, 89, 89, 89, 89, 79, 78, 77, 76,
- 75, 76, 76, 77, 78, 79, 80, 81, 82, 83, 84, 84, 85, 85, 86, 86, 87, 87,
- 87, 88, 88, 88, 89, 89, 89, 89, 89, 89, 80, 79, 77, 76, 75, 76, 77, 78,
- 79, 80, 81, 82, 83, 83, 84, 85, 85, 86, 86, 87, 87, 88, 88, 88, 89, 89,
- 89, 89, 90, 90, 90, 90, 80, 79, 78, 77, 76, 77, 78, 78, 79, 80, 81, 82,
- 83, 84, 84, 85, 86, 86, 87, 87, 88, 88, 88, 89, 89, 89, 89, 90, 90, 90,
- 90, 90, 81, 80, 79, 78, 77, 77, 78, 79, 80, 81, 81, 82, 83, 84, 85, 85,
- 86, 86, 87, 87, 88, 88, 89, 89, 89, 90, 90, 90, 90, 90, 90, 90, 82, 81,
- 80, 78, 77, 78, 79, 79, 80, 81, 82, 83, 83, 84, 85, 86, 86, 87, 87, 88,
- 88, 89, 89, 89, 90, 90, 90, 90, 91, 91, 91, 91, 83, 81, 80, 79, 78, 79,
- 79, 80, 81, 81, 82, 83, 84, 84, 85, 86, 87, 87, 88, 88, 89, 89, 89, 90,
- 90, 90, 91, 91, 91, 91, 91, 91, 83, 82, 81, 80, 79, 79, 80, 81, 81, 82,
- 83, 83, 84, 85, 85, 86, 87, 87, 88, 88, 89, 89, 90, 90, 90, 91, 91, 91,
- 91, 91, 91, 91, 84, 83, 82, 81, 80, 80, 81, 81, 82, 82, 83, 84, 85, 85,
- 86, 86, 87, 88, 88, 89, 89, 89, 90, 90, 91, 91, 91, 91, 92, 92, 92, 92,
- 85, 83, 82, 81, 80, 81, 81, 82, 82, 83, 84, 84, 85, 86, 86, 87, 87, 88,
- 88, 89, 89, 90, 90, 90, 91, 91, 91, 92, 92, 92, 92, 92, 85, 84, 83, 82,
- 81, 81, 82, 82, 83, 83, 84, 85, 85, 86, 86, 87, 88, 88, 89, 89, 90, 90,
- 90, 91, 91, 91, 92, 92, 92, 92, 92, 92, 85, 84, 83, 82, 81, 81, 82, 82,
- 83, 83, 84, 85, 85, 86, 86, 87, 88, 88, 89, 89, 90, 90, 90, 91, 91, 91,
- 92, 92, 92, 92, 92, 92, 85, 84, 83, 82, 81, 81, 82, 82, 83, 83, 84, 85,
- 85, 86, 86, 87, 88, 88, 89, 89, 90, 90, 90, 91, 91, 91, 92, 92, 92, 92,
- 92, 92, 85, 84, 83, 82, 81, 81, 82, 82, 83, 83, 84, 85, 85, 86, 86, 87,
- 88, 88, 89, 89, 90, 90, 90, 91, 91, 91, 92, 92, 92, 92, 92, 92 },
- { /* Intra matrices */
- /* Size 4 */
- 48, 59, 60, 65, 59, 62, 64, 66, 60, 64, 68, 70, 65, 66, 70, 73,
- /* Size 8 */
- 50, 45, 59, 60, 61, 63, 66, 68, 45, 54, 59, 57, 57, 59, 62, 64, 59, 59,
- 62, 61, 61, 62, 64, 66, 60, 57, 61, 64, 65, 66, 67, 68, 61, 57, 61, 65,
- 67, 68, 69, 70, 63, 59, 62, 66, 68, 70, 71, 72, 66, 62, 64, 67, 69, 71,
- 72, 73, 68, 64, 66, 68, 70, 72, 73, 74,
- /* Size 16 */
- 50, 47, 45, 51, 58, 59, 59, 60, 61, 62, 63, 64, 65, 66, 67, 67, 47, 48,
- 49, 53, 58, 58, 58, 58, 59, 60, 61, 62, 63, 64, 65, 65, 45, 49, 53, 56,
- 58, 57, 56, 57, 57, 58, 59, 60, 61, 63, 64, 64, 51, 53, 56, 58, 60, 59,
- 59, 59, 59, 60, 60, 61, 62, 63, 65, 65, 58, 58, 58, 60, 62, 61, 61, 61,
- 61, 61, 62, 63, 63, 64, 65, 65, 59, 58, 57, 59, 61, 62, 62, 62, 62, 63,
- 63, 64, 65, 66, 66, 66, 59, 58, 56, 59, 61, 62, 63, 64, 64, 65, 65, 66,
- 66, 67, 67, 67, 60, 58, 57, 59, 61, 62, 64, 64, 65, 66, 66, 67, 67, 68,
- 68, 68, 61, 59, 57, 59, 61, 62, 64, 65, 66, 67, 67, 68, 68, 69, 69, 69,
- 62, 60, 58, 60, 61, 63, 65, 66, 67, 68, 68, 69, 69, 70, 70, 70, 63, 61,
- 59, 60, 62, 63, 65, 66, 67, 68, 69, 70, 70, 71, 71, 71, 64, 62, 60, 61,
- 63, 64, 66, 67, 68, 69, 70, 70, 71, 71, 72, 72, 65, 63, 61, 62, 63, 65,
- 66, 67, 68, 69, 70, 71, 71, 72, 72, 72, 66, 64, 63, 63, 64, 66, 67, 68,
- 69, 70, 71, 71, 72, 72, 73, 73, 67, 65, 64, 65, 65, 66, 67, 68, 69, 70,
- 71, 72, 72, 73, 73, 73, 67, 65, 64, 65, 65, 66, 67, 68, 69, 70, 71, 72,
- 72, 73, 73, 73,
- /* Size 32 */
- 49, 48, 47, 46, 45, 47, 50, 54, 58, 58, 58, 59, 59, 59, 60, 60, 60, 61,
- 61, 62, 62, 63, 64, 64, 65, 65, 66, 66, 67, 67, 67, 67, 48, 48, 47, 47,
- 46, 49, 52, 55, 58, 58, 58, 58, 58, 58, 59, 59, 59, 60, 60, 61, 61, 62,
- 63, 63, 64, 64, 65, 65, 66, 66, 66, 66, 47, 47, 48, 48, 48, 50, 53, 55,
- 58, 58, 58, 58, 57, 58, 58, 58, 58, 59, 59, 60, 61, 61, 62, 62, 63, 63,
- 64, 65, 65, 65, 65, 65, 46, 47, 48, 49, 51, 52, 54, 56, 58, 58, 57, 57,
- 57, 57, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 63, 63, 64, 64, 64,
- 64, 64, 45, 46, 48, 51, 53, 54, 55, 57, 58, 58, 57, 57, 56, 56, 56, 57,
- 57, 57, 58, 58, 59, 59, 60, 60, 61, 62, 62, 63, 63, 63, 63, 63, 47, 49,
- 50, 52, 54, 55, 56, 58, 59, 58, 58, 58, 57, 57, 57, 57, 58, 58, 58, 59,
- 59, 60, 60, 61, 62, 62, 63, 63, 64, 64, 64, 64, 50, 52, 53, 54, 55, 56,
- 57, 59, 60, 59, 59, 59, 58, 58, 58, 58, 59, 59, 59, 60, 60, 61, 61, 62,
- 62, 63, 63, 64, 64, 64, 64, 64, 54, 55, 55, 56, 57, 58, 59, 60, 60, 60,
- 60, 60, 59, 59, 59, 60, 60, 60, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64,
- 65, 65, 65, 65, 58, 58, 58, 58, 58, 59, 60, 60, 61, 61, 61, 61, 61, 61,
- 61, 61, 61, 61, 61, 61, 62, 62, 62, 63, 63, 64, 64, 65, 65, 65, 65, 65,
- 58, 58, 58, 58, 58, 58, 59, 60, 61, 61, 61, 61, 61, 61, 61, 61, 61, 62,
- 62, 62, 62, 63, 63, 63, 64, 64, 65, 65, 66, 66, 66, 66, 58, 58, 58, 57,
- 57, 58, 59, 60, 61, 61, 61, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63,
- 64, 64, 64, 65, 65, 66, 66, 66, 66, 66, 59, 58, 58, 57, 57, 58, 59, 60,
- 61, 61, 62, 62, 62, 63, 63, 63, 63, 63, 63, 64, 64, 64, 65, 65, 65, 65,
- 66, 66, 67, 67, 67, 67, 59, 58, 57, 57, 56, 57, 58, 59, 61, 61, 62, 62,
- 63, 63, 63, 64, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67,
- 67, 67, 59, 58, 58, 57, 56, 57, 58, 59, 61, 61, 62, 63, 63, 64, 64, 64,
- 64, 65, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 68, 68, 68, 68, 60, 59,
- 58, 57, 56, 57, 58, 59, 61, 61, 62, 63, 63, 64, 64, 65, 65, 65, 65, 66,
- 66, 66, 66, 67, 67, 67, 67, 68, 68, 68, 68, 68, 60, 59, 58, 57, 57, 57,
- 58, 60, 61, 61, 62, 63, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, 67,
- 68, 68, 68, 68, 69, 69, 69, 69, 60, 59, 58, 58, 57, 58, 59, 60, 61, 61,
- 62, 63, 64, 64, 65, 65, 66, 66, 67, 67, 67, 67, 68, 68, 68, 68, 69, 69,
- 69, 69, 69, 69, 61, 60, 59, 58, 57, 58, 59, 60, 61, 62, 62, 63, 64, 65,
- 65, 66, 66, 67, 67, 67, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69,
- 61, 60, 59, 59, 58, 58, 59, 60, 61, 62, 63, 63, 64, 65, 65, 66, 67, 67,
- 67, 68, 68, 68, 68, 69, 69, 69, 69, 70, 70, 70, 70, 70, 62, 61, 60, 59,
- 58, 59, 60, 60, 61, 62, 63, 64, 65, 65, 66, 66, 67, 67, 68, 68, 68, 69,
- 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 62, 61, 61, 60, 59, 59, 60, 61,
- 62, 62, 63, 64, 65, 65, 66, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 70,
- 70, 70, 71, 71, 71, 71, 63, 62, 61, 60, 59, 60, 61, 61, 62, 63, 63, 64,
- 65, 66, 66, 67, 67, 68, 68, 69, 69, 69, 70, 70, 70, 70, 71, 71, 71, 71,
- 71, 71, 64, 63, 62, 61, 60, 60, 61, 62, 62, 63, 64, 65, 65, 66, 66, 67,
- 68, 68, 68, 69, 69, 70, 70, 70, 70, 71, 71, 71, 71, 71, 71, 71, 64, 63,
- 62, 61, 60, 61, 62, 62, 63, 63, 64, 65, 66, 66, 67, 67, 68, 68, 69, 69,
- 70, 70, 70, 70, 71, 71, 71, 71, 72, 72, 72, 72, 65, 64, 63, 62, 61, 62,
- 62, 63, 63, 64, 64, 65, 66, 66, 67, 68, 68, 69, 69, 69, 70, 70, 70, 71,
- 71, 71, 71, 72, 72, 72, 72, 72, 65, 64, 63, 63, 62, 62, 63, 63, 64, 64,
- 65, 65, 66, 67, 67, 68, 68, 69, 69, 70, 70, 70, 71, 71, 71, 71, 72, 72,
- 72, 72, 72, 72, 66, 65, 64, 63, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67,
- 67, 68, 69, 69, 69, 70, 70, 71, 71, 71, 71, 72, 72, 72, 72, 72, 72, 72,
- 66, 65, 65, 64, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69,
- 70, 70, 70, 71, 71, 71, 72, 72, 72, 72, 73, 73, 73, 73, 67, 66, 65, 64,
- 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 69, 70, 70, 71, 71,
- 71, 72, 72, 72, 72, 73, 73, 73, 73, 73, 67, 66, 65, 64, 63, 64, 64, 65,
- 65, 66, 66, 67, 67, 68, 68, 69, 69, 69, 70, 70, 71, 71, 71, 72, 72, 72,
- 72, 73, 73, 73, 73, 73, 67, 66, 65, 64, 63, 64, 64, 65, 65, 66, 66, 67,
- 67, 68, 68, 69, 69, 69, 70, 70, 71, 71, 71, 72, 72, 72, 72, 73, 73, 73,
- 73, 73, 67, 66, 65, 64, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69,
- 69, 69, 70, 70, 71, 71, 71, 72, 72, 72, 72, 73, 73, 73, 73, 73 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 66, 76, 82, 66, 74, 79, 83, 76, 79, 84, 86, 82, 83, 86, 87,
- /* Size 8 */
- 64, 58, 60, 65, 71, 75, 77, 79, 58, 61, 60, 63, 68, 72, 75, 78, 60, 60,
- 67, 69, 72, 75, 77, 79, 65, 63, 69, 73, 75, 77, 79, 80, 71, 68, 72, 75,
- 78, 79, 80, 81, 75, 72, 75, 77, 79, 80, 81, 82, 77, 75, 77, 79, 80, 81,
- 82, 82, 79, 78, 79, 80, 81, 82, 82, 83,
- /* Size 16 */
- 64, 61, 58, 59, 60, 62, 65, 68, 71, 72, 75, 76, 77, 78, 79, 79, 61, 60,
- 60, 60, 60, 62, 64, 67, 69, 71, 73, 75, 76, 77, 79, 79, 58, 60, 61, 61,
- 60, 62, 63, 66, 68, 70, 72, 74, 75, 77, 78, 78, 59, 60, 61, 62, 63, 65,
- 66, 68, 70, 72, 73, 75, 76, 77, 78, 78, 60, 60, 60, 63, 67, 68, 69, 71,
- 72, 73, 75, 76, 77, 78, 79, 79, 62, 62, 62, 65, 68, 70, 71, 73, 74, 75,
- 76, 77, 78, 79, 79, 79, 65, 64, 63, 66, 69, 71, 73, 74, 75, 76, 77, 78,
- 79, 79, 80, 80, 68, 67, 66, 68, 71, 73, 74, 75, 77, 77, 78, 79, 79, 80,
- 80, 80, 71, 69, 68, 70, 72, 74, 75, 77, 78, 78, 79, 80, 80, 80, 81, 81,
- 72, 71, 70, 72, 73, 75, 76, 77, 78, 79, 80, 80, 81, 81, 81, 81, 75, 73,
- 72, 73, 75, 76, 77, 78, 79, 80, 80, 81, 81, 81, 82, 82, 76, 75, 74, 75,
- 76, 77, 78, 79, 80, 80, 81, 81, 81, 82, 82, 82, 77, 76, 75, 76, 77, 78,
- 79, 79, 80, 81, 81, 81, 82, 82, 82, 82, 78, 77, 77, 77, 78, 79, 79, 80,
- 80, 81, 81, 82, 82, 82, 83, 83, 79, 79, 78, 78, 79, 79, 80, 80, 81, 81,
- 82, 82, 82, 83, 83, 83, 79, 79, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82,
- 82, 83, 83, 83,
- /* Size 32 */
- 64, 62, 61, 60, 58, 59, 59, 59, 60, 61, 62, 64, 65, 67, 68, 69, 71, 71,
- 72, 73, 75, 75, 76, 77, 77, 78, 78, 79, 79, 79, 79, 79, 62, 61, 61, 60,
- 59, 59, 59, 60, 60, 61, 62, 64, 65, 66, 67, 69, 70, 71, 72, 73, 74, 75,
- 75, 76, 77, 77, 78, 78, 79, 79, 79, 79, 61, 61, 60, 60, 60, 60, 60, 60,
- 60, 61, 62, 63, 64, 65, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 76, 77,
- 77, 78, 79, 79, 79, 79, 60, 60, 60, 60, 60, 60, 60, 60, 60, 61, 62, 63,
- 64, 65, 66, 67, 69, 70, 71, 72, 73, 73, 74, 75, 76, 76, 77, 78, 78, 78,
- 78, 78, 58, 59, 60, 60, 61, 61, 61, 60, 60, 61, 62, 63, 63, 64, 66, 67,
- 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 77, 78, 78, 78, 78, 59, 59,
- 60, 60, 61, 61, 61, 61, 62, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
- 73, 73, 74, 75, 76, 76, 77, 77, 78, 78, 78, 78, 59, 59, 60, 60, 61, 61,
- 62, 63, 63, 64, 65, 66, 66, 67, 68, 69, 70, 71, 72, 72, 73, 74, 75, 75,
- 76, 77, 77, 78, 78, 78, 78, 78, 59, 60, 60, 60, 60, 61, 63, 64, 65, 66,
- 66, 67, 68, 69, 69, 70, 71, 72, 72, 73, 74, 75, 75, 76, 77, 77, 77, 78,
- 78, 78, 78, 78, 60, 60, 60, 60, 60, 62, 63, 65, 67, 67, 68, 69, 69, 70,
- 71, 71, 72, 73, 73, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 79, 79,
- 61, 61, 61, 61, 61, 62, 64, 66, 67, 68, 69, 70, 70, 71, 72, 72, 73, 73,
- 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 79, 79, 79, 62, 62, 62, 62,
- 62, 63, 65, 66, 68, 69, 70, 71, 71, 72, 73, 73, 74, 74, 75, 75, 76, 76,
- 77, 77, 78, 78, 79, 79, 79, 79, 79, 79, 64, 64, 63, 63, 63, 64, 66, 67,
- 69, 70, 71, 71, 72, 73, 73, 74, 75, 75, 76, 76, 76, 77, 77, 78, 78, 79,
- 79, 79, 80, 80, 80, 80, 65, 65, 64, 64, 63, 65, 66, 68, 69, 70, 71, 72,
- 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 80,
- 80, 80, 67, 66, 65, 65, 64, 66, 67, 69, 70, 71, 72, 73, 74, 74, 75, 75,
- 76, 76, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 80, 80, 80, 80, 68, 67,
- 67, 66, 66, 67, 68, 69, 71, 72, 73, 73, 74, 75, 75, 76, 77, 77, 77, 78,
- 78, 78, 79, 79, 79, 80, 80, 80, 80, 80, 80, 80, 69, 69, 68, 67, 67, 68,
- 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 77, 77, 78, 78, 79, 79, 79, 79,
- 80, 80, 80, 80, 81, 81, 81, 81, 71, 70, 69, 69, 68, 69, 70, 71, 72, 73,
- 74, 75, 75, 76, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 80, 80, 80, 81,
- 81, 81, 81, 81, 71, 71, 70, 70, 69, 70, 71, 72, 73, 73, 74, 75, 76, 76,
- 77, 77, 78, 78, 79, 79, 79, 80, 80, 80, 80, 80, 81, 81, 81, 81, 81, 81,
- 72, 72, 71, 71, 70, 71, 72, 72, 73, 74, 75, 76, 76, 77, 77, 78, 78, 79,
- 79, 79, 80, 80, 80, 80, 81, 81, 81, 81, 81, 81, 81, 81, 73, 73, 72, 72,
- 71, 72, 72, 73, 74, 75, 75, 76, 77, 77, 78, 78, 79, 79, 79, 80, 80, 80,
- 80, 81, 81, 81, 81, 81, 82, 82, 82, 82, 75, 74, 73, 73, 72, 73, 73, 74,
- 75, 75, 76, 76, 77, 78, 78, 79, 79, 79, 80, 80, 80, 80, 81, 81, 81, 81,
- 81, 82, 82, 82, 82, 82, 75, 75, 74, 73, 73, 73, 74, 75, 75, 76, 76, 77,
- 78, 78, 78, 79, 79, 80, 80, 80, 80, 81, 81, 81, 81, 81, 82, 82, 82, 82,
- 82, 82, 76, 75, 75, 74, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79,
- 80, 80, 80, 80, 81, 81, 81, 81, 81, 82, 82, 82, 82, 82, 82, 82, 77, 76,
- 76, 75, 75, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 79, 80, 80, 80, 81,
- 81, 81, 81, 81, 82, 82, 82, 82, 82, 82, 82, 82, 77, 77, 76, 76, 75, 76,
- 76, 77, 77, 77, 78, 78, 79, 79, 79, 80, 80, 80, 81, 81, 81, 81, 81, 82,
- 82, 82, 82, 82, 82, 82, 82, 82, 78, 77, 77, 76, 76, 76, 77, 77, 77, 78,
- 78, 79, 79, 79, 80, 80, 80, 80, 81, 81, 81, 81, 82, 82, 82, 82, 82, 82,
- 82, 82, 82, 82, 78, 78, 77, 77, 77, 77, 77, 77, 78, 78, 79, 79, 79, 80,
- 80, 80, 80, 81, 81, 81, 81, 82, 82, 82, 82, 82, 82, 82, 83, 83, 83, 83,
- 79, 78, 78, 78, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 80, 80, 81, 81,
- 81, 81, 82, 82, 82, 82, 82, 82, 82, 83, 83, 83, 83, 83, 79, 79, 79, 78,
- 78, 78, 78, 78, 79, 79, 79, 80, 80, 80, 80, 81, 81, 81, 81, 82, 82, 82,
- 82, 82, 82, 82, 83, 83, 83, 83, 83, 83, 79, 79, 79, 78, 78, 78, 78, 78,
- 79, 79, 79, 80, 80, 80, 80, 81, 81, 81, 81, 82, 82, 82, 82, 82, 82, 82,
- 83, 83, 83, 83, 83, 83, 79, 79, 79, 78, 78, 78, 78, 78, 79, 79, 79, 80,
- 80, 80, 80, 81, 81, 81, 81, 82, 82, 82, 82, 82, 82, 82, 83, 83, 83, 83,
- 83, 83, 79, 79, 79, 78, 78, 78, 78, 78, 79, 79, 79, 80, 80, 80, 80, 81,
- 81, 81, 81, 82, 82, 82, 82, 82, 82, 82, 83, 83, 83, 83, 83, 83 },
- { /* Intra matrices */
- /* Size 4 */
- 51, 53, 61, 67, 53, 60, 65, 68, 61, 65, 68, 70, 67, 68, 70, 71,
- /* Size 8 */
- 55, 49, 51, 56, 61, 64, 67, 69, 49, 52, 51, 54, 58, 62, 65, 67, 51, 51,
- 57, 60, 62, 64, 66, 68, 56, 54, 60, 63, 65, 67, 68, 69, 61, 58, 62, 65,
- 67, 68, 69, 70, 64, 62, 64, 67, 68, 70, 70, 71, 67, 65, 66, 68, 69, 70,
- 71, 71, 69, 67, 68, 69, 70, 71, 71, 72,
- /* Size 16 */
- 54, 51, 49, 50, 50, 53, 55, 58, 60, 62, 64, 65, 66, 67, 68, 68, 51, 51,
- 50, 50, 51, 52, 54, 57, 59, 61, 63, 64, 65, 66, 67, 67, 49, 50, 51, 51,
- 51, 52, 54, 56, 58, 60, 61, 63, 64, 65, 67, 67, 50, 50, 51, 52, 53, 55,
- 56, 58, 59, 61, 63, 64, 65, 66, 67, 67, 50, 51, 51, 53, 57, 58, 59, 60,
- 61, 63, 64, 65, 66, 67, 67, 67, 53, 52, 52, 55, 58, 59, 61, 62, 63, 64,
- 65, 66, 67, 67, 68, 68, 55, 54, 54, 56, 59, 61, 63, 63, 64, 65, 66, 67,
- 67, 68, 69, 69, 58, 57, 56, 58, 60, 62, 63, 64, 65, 66, 67, 67, 68, 68,
- 69, 69, 60, 59, 58, 59, 61, 63, 64, 65, 66, 67, 68, 68, 69, 69, 69, 69,
- 62, 61, 60, 61, 63, 64, 65, 66, 67, 68, 68, 69, 69, 69, 70, 70, 64, 63,
- 61, 63, 64, 65, 66, 67, 68, 68, 69, 69, 70, 70, 70, 70, 65, 64, 63, 64,
- 65, 66, 67, 67, 68, 69, 69, 70, 70, 70, 70, 70, 66, 65, 64, 65, 66, 67,
- 67, 68, 69, 69, 70, 70, 70, 71, 71, 71, 67, 66, 65, 66, 67, 67, 68, 68,
- 69, 69, 70, 70, 71, 71, 71, 71, 68, 67, 67, 67, 67, 68, 69, 69, 69, 70,
- 70, 70, 71, 71, 71, 71, 68, 67, 67, 67, 67, 68, 69, 69, 69, 70, 70, 70,
- 71, 71, 71, 71,
- /* Size 32 */
- 54, 52, 51, 50, 49, 49, 49, 50, 50, 51, 53, 54, 55, 56, 57, 58, 60, 61,
- 61, 62, 63, 64, 65, 65, 66, 66, 67, 67, 68, 68, 68, 68, 52, 52, 51, 50,
- 49, 50, 50, 50, 50, 51, 52, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 63,
- 64, 65, 65, 66, 66, 67, 67, 67, 67, 67, 51, 51, 51, 50, 50, 50, 50, 50,
- 50, 51, 52, 53, 54, 55, 56, 57, 59, 59, 60, 61, 62, 63, 64, 64, 65, 65,
- 66, 67, 67, 67, 67, 67, 50, 50, 50, 50, 51, 51, 50, 50, 50, 51, 52, 53,
- 54, 55, 56, 57, 58, 59, 60, 61, 62, 62, 63, 64, 65, 65, 66, 66, 67, 67,
- 67, 67, 49, 49, 50, 51, 51, 51, 51, 51, 50, 51, 52, 53, 53, 54, 55, 56,
- 57, 58, 59, 60, 61, 62, 63, 63, 64, 65, 65, 66, 66, 66, 66, 66, 49, 50,
- 50, 51, 51, 51, 51, 52, 52, 52, 53, 54, 55, 55, 56, 57, 58, 59, 60, 61,
- 62, 62, 63, 64, 64, 65, 65, 66, 67, 67, 67, 67, 49, 50, 50, 50, 51, 51,
- 52, 53, 53, 54, 55, 55, 56, 57, 58, 58, 59, 60, 61, 61, 62, 63, 63, 64,
- 65, 65, 66, 66, 67, 67, 67, 67, 50, 50, 50, 50, 51, 52, 53, 54, 55, 55,
- 56, 57, 57, 58, 59, 59, 60, 61, 61, 62, 63, 63, 64, 65, 65, 66, 66, 66,
- 67, 67, 67, 67, 50, 50, 50, 50, 50, 52, 53, 55, 56, 57, 58, 58, 59, 59,
- 60, 60, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 67, 67, 67,
- 51, 51, 51, 51, 51, 52, 54, 55, 57, 58, 58, 59, 60, 60, 61, 61, 62, 62,
- 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 67, 67, 67, 67, 53, 52, 52, 52,
- 52, 53, 55, 56, 58, 58, 59, 60, 60, 61, 62, 62, 63, 63, 64, 64, 65, 65,
- 65, 66, 66, 67, 67, 67, 68, 68, 68, 68, 54, 53, 53, 53, 53, 54, 55, 57,
- 58, 59, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 65, 66, 66, 67, 67,
- 67, 68, 68, 68, 68, 68, 55, 55, 54, 54, 53, 55, 56, 57, 59, 60, 60, 61,
- 62, 63, 63, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 68, 68,
- 68, 68, 56, 56, 55, 55, 54, 55, 57, 58, 59, 60, 61, 62, 63, 63, 64, 64,
- 65, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 57, 57,
- 56, 56, 55, 56, 58, 59, 60, 61, 62, 62, 63, 64, 64, 65, 65, 65, 66, 66,
- 67, 67, 67, 67, 68, 68, 68, 68, 69, 69, 69, 69, 58, 58, 57, 57, 56, 57,
- 58, 59, 60, 61, 62, 63, 64, 64, 65, 65, 66, 66, 66, 67, 67, 67, 67, 68,
- 68, 68, 68, 69, 69, 69, 69, 69, 60, 59, 59, 58, 57, 58, 59, 60, 61, 62,
- 63, 63, 64, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 68, 68, 69, 69, 69,
- 69, 69, 69, 69, 61, 60, 59, 59, 58, 59, 60, 61, 62, 62, 63, 64, 65, 65,
- 65, 66, 66, 67, 67, 67, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69,
- 61, 61, 60, 60, 59, 60, 61, 61, 62, 63, 64, 64, 65, 65, 66, 66, 67, 67,
- 67, 68, 68, 68, 68, 69, 69, 69, 69, 69, 70, 70, 70, 70, 62, 62, 61, 61,
- 60, 61, 61, 62, 63, 63, 64, 65, 65, 66, 66, 67, 67, 67, 68, 68, 68, 68,
- 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 63, 63, 62, 62, 61, 62, 62, 63,
- 63, 64, 65, 65, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 69, 69, 69,
- 70, 70, 70, 70, 70, 70, 64, 63, 63, 62, 62, 62, 63, 63, 64, 64, 65, 65,
- 66, 66, 67, 67, 68, 68, 68, 68, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70,
- 70, 70, 65, 64, 64, 63, 63, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 67,
- 68, 68, 68, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 70, 65, 65,
- 64, 64, 63, 64, 64, 65, 65, 65, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69,
- 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 70, 70, 66, 65, 65, 65, 64, 64,
- 65, 65, 65, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 69, 69, 70, 70,
- 70, 70, 70, 70, 70, 70, 70, 70, 66, 66, 65, 65, 65, 65, 65, 66, 66, 66,
- 67, 67, 67, 68, 68, 68, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70,
- 71, 71, 71, 71, 67, 66, 66, 66, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68,
- 68, 68, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 71, 71, 71, 71, 71,
- 67, 67, 67, 66, 66, 66, 66, 66, 67, 67, 67, 68, 68, 68, 68, 69, 69, 69,
- 69, 70, 70, 70, 70, 70, 70, 70, 71, 71, 71, 71, 71, 71, 68, 67, 67, 67,
- 66, 67, 67, 67, 67, 67, 68, 68, 68, 68, 69, 69, 69, 69, 70, 70, 70, 70,
- 70, 70, 70, 71, 71, 71, 71, 71, 71, 71, 68, 67, 67, 67, 66, 67, 67, 67,
- 67, 67, 68, 68, 68, 68, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 71,
- 71, 71, 71, 71, 71, 71, 68, 67, 67, 67, 66, 67, 67, 67, 67, 67, 68, 68,
- 68, 68, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 71, 71, 71, 71, 71,
- 71, 71, 68, 67, 67, 67, 66, 67, 67, 67, 67, 67, 68, 68, 68, 68, 69, 69,
- 69, 69, 70, 70, 70, 70, 70, 70, 70, 71, 71, 71, 71, 71, 71, 71 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 74, 75, 79, 74, 77, 78, 80, 75, 78, 82, 84, 79, 80, 84, 86,
- /* Size 8 */
- 64, 59, 72, 73, 74, 76, 78, 80, 59, 67, 72, 70, 71, 72, 75, 77, 72, 72,
- 75, 74, 74, 75, 76, 78, 73, 70, 74, 76, 77, 78, 79, 80, 74, 71, 74, 77,
- 79, 80, 80, 81, 76, 72, 75, 78, 80, 81, 82, 82, 78, 75, 76, 79, 80, 82,
- 83, 83, 80, 77, 78, 80, 81, 82, 83, 84,
- /* Size 16 */
- 64, 62, 59, 65, 72, 72, 73, 73, 74, 75, 76, 77, 78, 79, 80, 80, 62, 62,
- 63, 67, 72, 72, 71, 72, 72, 73, 74, 75, 76, 77, 78, 78, 59, 63, 67, 70,
- 72, 71, 70, 70, 71, 72, 72, 74, 75, 76, 77, 77, 65, 67, 70, 71, 73, 73,
- 72, 72, 72, 73, 74, 75, 75, 76, 77, 77, 72, 72, 72, 73, 75, 74, 74, 74,
- 74, 75, 75, 76, 76, 77, 78, 78, 72, 72, 71, 73, 74, 75, 75, 75, 76, 76,
- 76, 77, 77, 78, 79, 79, 73, 71, 70, 72, 74, 75, 76, 77, 77, 77, 78, 78,
- 79, 79, 80, 80, 73, 72, 70, 72, 74, 75, 77, 77, 78, 78, 79, 79, 79, 80,
- 80, 80, 74, 72, 71, 72, 74, 76, 77, 78, 79, 79, 80, 80, 80, 81, 81, 81,
- 75, 73, 72, 73, 75, 76, 77, 78, 79, 80, 80, 81, 81, 81, 82, 82, 76, 74,
- 72, 74, 75, 76, 78, 79, 80, 80, 81, 81, 82, 82, 82, 82, 77, 75, 74, 75,
- 76, 77, 78, 79, 80, 81, 81, 82, 82, 83, 83, 83, 78, 76, 75, 75, 76, 77,
- 79, 79, 80, 81, 82, 82, 83, 83, 83, 83, 79, 77, 76, 76, 77, 78, 79, 80,
- 81, 81, 82, 83, 83, 83, 84, 84, 80, 78, 77, 77, 78, 79, 80, 80, 81, 82,
- 82, 83, 83, 84, 84, 84, 80, 78, 77, 77, 78, 79, 80, 80, 81, 82, 82, 83,
- 83, 84, 84, 84,
- /* Size 32 */
- 64, 63, 62, 60, 59, 62, 65, 68, 72, 72, 72, 72, 73, 73, 73, 74, 74, 74,
- 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 80, 80, 63, 62, 62, 61,
- 61, 63, 66, 69, 72, 72, 72, 72, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75,
- 76, 76, 77, 77, 78, 78, 79, 79, 79, 79, 62, 62, 62, 63, 63, 65, 67, 69,
- 72, 72, 72, 72, 71, 72, 72, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77,
- 77, 78, 78, 78, 78, 78, 60, 61, 63, 64, 65, 67, 68, 70, 72, 72, 71, 71,
- 71, 71, 71, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 77,
- 77, 77, 59, 61, 63, 65, 67, 68, 70, 71, 72, 72, 71, 71, 70, 70, 70, 71,
- 71, 71, 72, 72, 72, 73, 74, 74, 75, 75, 76, 76, 77, 77, 77, 77, 62, 63,
- 65, 67, 68, 69, 70, 72, 73, 72, 72, 72, 71, 71, 71, 71, 72, 72, 72, 73,
- 73, 74, 74, 75, 75, 75, 76, 76, 77, 77, 77, 77, 65, 66, 67, 68, 70, 70,
- 71, 72, 73, 73, 73, 72, 72, 72, 72, 72, 72, 73, 73, 73, 74, 74, 75, 75,
- 75, 76, 76, 77, 77, 77, 77, 77, 68, 69, 69, 70, 71, 72, 72, 73, 74, 74,
- 74, 73, 73, 73, 73, 73, 73, 74, 74, 74, 74, 75, 75, 76, 76, 76, 77, 77,
- 78, 78, 78, 78, 72, 72, 72, 72, 72, 73, 73, 74, 75, 75, 74, 74, 74, 74,
- 74, 74, 74, 74, 75, 75, 75, 75, 76, 76, 76, 77, 77, 78, 78, 78, 78, 78,
- 72, 72, 72, 72, 72, 72, 73, 74, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
- 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 78, 78, 78, 78, 72, 72, 72, 71,
- 71, 72, 73, 74, 74, 75, 75, 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, 77,
- 77, 77, 77, 78, 78, 78, 79, 79, 79, 79, 72, 72, 72, 71, 71, 72, 72, 73,
- 74, 75, 75, 75, 76, 76, 76, 76, 76, 76, 77, 77, 77, 77, 77, 78, 78, 78,
- 79, 79, 79, 79, 79, 79, 73, 72, 71, 71, 70, 71, 72, 73, 74, 75, 75, 76,
- 76, 76, 77, 77, 77, 77, 77, 78, 78, 78, 78, 78, 79, 79, 79, 79, 80, 80,
- 80, 80, 73, 72, 72, 71, 70, 71, 72, 73, 74, 75, 75, 76, 76, 77, 77, 77,
- 77, 78, 78, 78, 78, 78, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 73, 73,
- 72, 71, 70, 71, 72, 73, 74, 75, 75, 76, 77, 77, 77, 78, 78, 78, 78, 78,
- 79, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 80, 74, 73, 72, 71, 71, 71,
- 72, 73, 74, 75, 75, 76, 77, 77, 78, 78, 78, 78, 79, 79, 79, 79, 80, 80,
- 80, 80, 80, 81, 81, 81, 81, 81, 74, 73, 72, 71, 71, 72, 72, 73, 74, 75,
- 76, 76, 77, 77, 78, 78, 79, 79, 79, 79, 80, 80, 80, 80, 80, 81, 81, 81,
- 81, 81, 81, 81, 74, 74, 73, 72, 71, 72, 73, 74, 74, 75, 76, 76, 77, 78,
- 78, 78, 79, 79, 79, 80, 80, 80, 80, 81, 81, 81, 81, 81, 82, 82, 82, 82,
- 75, 74, 73, 72, 72, 72, 73, 74, 75, 75, 76, 77, 77, 78, 78, 79, 79, 79,
- 80, 80, 80, 80, 81, 81, 81, 81, 81, 82, 82, 82, 82, 82, 75, 74, 74, 73,
- 72, 73, 73, 74, 75, 75, 76, 77, 78, 78, 78, 79, 79, 80, 80, 80, 81, 81,
- 81, 81, 81, 82, 82, 82, 82, 82, 82, 82, 76, 75, 74, 73, 72, 73, 74, 74,
- 75, 76, 76, 77, 78, 78, 79, 79, 80, 80, 80, 81, 81, 81, 81, 82, 82, 82,
- 82, 82, 82, 82, 82, 82, 76, 75, 75, 74, 73, 74, 74, 75, 75, 76, 77, 77,
- 78, 78, 79, 79, 80, 80, 80, 81, 81, 81, 82, 82, 82, 82, 82, 83, 83, 83,
- 83, 83, 77, 76, 75, 74, 74, 74, 75, 75, 76, 76, 77, 77, 78, 79, 79, 80,
- 80, 80, 81, 81, 81, 82, 82, 82, 82, 82, 83, 83, 83, 83, 83, 83, 77, 76,
- 76, 75, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 81,
- 82, 82, 82, 82, 83, 83, 83, 83, 83, 83, 83, 83, 78, 77, 76, 75, 75, 75,
- 75, 76, 76, 77, 77, 78, 79, 79, 79, 80, 80, 81, 81, 81, 82, 82, 82, 83,
- 83, 83, 83, 83, 83, 83, 83, 83, 78, 77, 77, 76, 75, 75, 76, 76, 77, 77,
- 78, 78, 79, 79, 80, 80, 81, 81, 81, 82, 82, 82, 82, 83, 83, 83, 83, 83,
- 84, 84, 84, 84, 79, 78, 77, 76, 76, 76, 76, 77, 77, 78, 78, 79, 79, 80,
- 80, 80, 81, 81, 81, 82, 82, 82, 83, 83, 83, 83, 83, 84, 84, 84, 84, 84,
- 79, 78, 78, 77, 76, 76, 77, 77, 78, 78, 78, 79, 79, 80, 80, 81, 81, 81,
- 82, 82, 82, 83, 83, 83, 83, 83, 84, 84, 84, 84, 84, 84, 80, 79, 78, 77,
- 77, 77, 77, 78, 78, 78, 79, 79, 80, 80, 80, 81, 81, 82, 82, 82, 82, 83,
- 83, 83, 83, 84, 84, 84, 84, 84, 84, 84, 80, 79, 78, 77, 77, 77, 77, 78,
- 78, 78, 79, 79, 80, 80, 80, 81, 81, 82, 82, 82, 82, 83, 83, 83, 83, 84,
- 84, 84, 84, 84, 84, 84, 80, 79, 78, 77, 77, 77, 77, 78, 78, 78, 79, 79,
- 80, 80, 80, 81, 81, 82, 82, 82, 82, 83, 83, 83, 83, 84, 84, 84, 84, 84,
- 84, 84, 80, 79, 78, 77, 77, 77, 77, 78, 78, 78, 79, 79, 80, 80, 80, 81,
- 81, 82, 82, 82, 82, 83, 83, 83, 83, 84, 84, 84, 84, 84, 84, 84 },
- { /* Intra matrices */
- /* Size 4 */
- 52, 60, 61, 65, 60, 63, 64, 66, 61, 64, 67, 69, 65, 66, 69, 71,
- /* Size 8 */
- 53, 49, 60, 61, 62, 64, 65, 67, 49, 56, 60, 59, 59, 61, 63, 64, 60, 60,
- 63, 62, 62, 63, 64, 66, 61, 59, 62, 64, 65, 65, 66, 67, 62, 59, 62, 65,
- 66, 67, 68, 69, 64, 61, 63, 65, 67, 68, 69, 70, 65, 63, 64, 66, 68, 69,
- 70, 71, 67, 64, 66, 67, 69, 70, 71, 71,
- /* Size 16 */
- 53, 51, 49, 54, 60, 60, 61, 61, 62, 62, 63, 64, 65, 66, 67, 67, 51, 51,
- 52, 56, 60, 60, 59, 60, 60, 61, 62, 63, 64, 64, 65, 65, 49, 52, 56, 58,
- 60, 59, 58, 58, 59, 59, 60, 61, 62, 63, 64, 64, 54, 56, 58, 59, 61, 61,
- 60, 60, 60, 61, 61, 62, 63, 64, 65, 65, 60, 60, 60, 61, 62, 62, 62, 62,
- 62, 62, 63, 63, 64, 64, 65, 65, 60, 60, 59, 61, 62, 62, 63, 63, 63, 63,
- 64, 64, 65, 65, 66, 66, 61, 59, 58, 60, 62, 63, 64, 64, 64, 65, 65, 65,
- 66, 66, 67, 67, 61, 60, 58, 60, 62, 63, 64, 64, 65, 65, 66, 66, 67, 67,
- 67, 67, 62, 60, 59, 60, 62, 63, 64, 65, 66, 66, 67, 67, 67, 68, 68, 68,
- 62, 61, 59, 61, 62, 63, 65, 65, 66, 67, 67, 68, 68, 68, 69, 69, 63, 62,
- 60, 61, 63, 64, 65, 66, 67, 67, 68, 68, 69, 69, 69, 69, 64, 63, 61, 62,
- 63, 64, 65, 66, 67, 68, 68, 69, 69, 69, 70, 70, 65, 64, 62, 63, 64, 65,
- 66, 67, 67, 68, 69, 69, 69, 70, 70, 70, 66, 64, 63, 64, 64, 65, 66, 67,
- 68, 68, 69, 69, 70, 70, 70, 70, 67, 65, 64, 65, 65, 66, 67, 67, 68, 69,
- 69, 70, 70, 70, 71, 71, 67, 65, 64, 65, 65, 66, 67, 67, 68, 69, 69, 70,
- 70, 70, 71, 71,
- /* Size 32 */
- 53, 52, 51, 50, 49, 51, 53, 56, 59, 60, 60, 60, 60, 61, 61, 61, 61, 62,
- 62, 63, 63, 63, 64, 64, 65, 65, 66, 66, 66, 66, 66, 66, 52, 51, 51, 50,
- 50, 52, 54, 57, 59, 60, 60, 60, 60, 60, 60, 60, 61, 61, 61, 62, 62, 63,
- 63, 64, 64, 64, 65, 65, 66, 66, 66, 66, 51, 51, 51, 51, 52, 54, 55, 57,
- 60, 59, 59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 62, 62, 62, 63, 63, 64,
- 64, 65, 65, 65, 65, 65, 50, 50, 51, 52, 54, 55, 56, 58, 60, 59, 59, 59,
- 59, 59, 59, 59, 59, 60, 60, 60, 61, 61, 62, 62, 63, 63, 63, 64, 64, 64,
- 64, 64, 49, 50, 52, 54, 55, 56, 58, 59, 60, 59, 59, 58, 58, 58, 58, 58,
- 59, 59, 59, 60, 60, 61, 61, 61, 62, 62, 63, 63, 64, 64, 64, 64, 51, 52,
- 54, 55, 56, 57, 58, 59, 60, 60, 60, 59, 59, 59, 59, 59, 59, 60, 60, 60,
- 61, 61, 61, 62, 62, 63, 63, 64, 64, 64, 64, 64, 53, 54, 55, 56, 58, 58,
- 59, 60, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 61, 61, 61, 62, 62, 62,
- 63, 63, 64, 64, 64, 64, 64, 64, 56, 57, 57, 58, 59, 59, 60, 61, 61, 61,
- 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64,
- 65, 65, 65, 65, 59, 59, 60, 60, 60, 60, 61, 61, 62, 62, 62, 62, 62, 62,
- 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 65, 65,
- 60, 60, 59, 59, 59, 60, 61, 61, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
- 63, 63, 63, 63, 63, 64, 64, 64, 65, 65, 65, 65, 65, 65, 60, 60, 59, 59,
- 59, 60, 60, 61, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 64,
- 64, 64, 64, 65, 65, 65, 66, 66, 66, 66, 60, 60, 59, 59, 58, 59, 60, 61,
- 62, 62, 62, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65,
- 65, 66, 66, 66, 66, 66, 60, 60, 59, 59, 58, 59, 60, 61, 62, 62, 62, 63,
- 63, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66,
- 66, 66, 61, 60, 59, 59, 58, 59, 60, 61, 62, 62, 63, 63, 64, 64, 64, 64,
- 64, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 67, 67, 61, 60,
- 60, 59, 58, 59, 60, 61, 62, 62, 63, 63, 64, 64, 64, 65, 65, 65, 65, 65,
- 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 61, 60, 60, 59, 58, 59,
- 60, 61, 62, 62, 63, 63, 64, 64, 65, 65, 65, 65, 66, 66, 66, 66, 66, 67,
- 67, 67, 67, 67, 67, 67, 67, 67, 61, 61, 60, 59, 59, 59, 60, 61, 62, 62,
- 63, 63, 64, 64, 65, 65, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 68,
- 68, 68, 68, 68, 62, 61, 60, 60, 59, 60, 60, 61, 62, 62, 63, 64, 64, 65,
- 65, 65, 66, 66, 66, 66, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68,
- 62, 61, 61, 60, 59, 60, 61, 61, 62, 63, 63, 64, 64, 65, 65, 66, 66, 66,
- 66, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 63, 62, 61, 60,
- 60, 60, 61, 61, 62, 63, 63, 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, 67,
- 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 63, 62, 62, 61, 60, 61, 61, 62,
- 62, 63, 63, 64, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 68, 68, 68, 68,
- 69, 69, 69, 69, 69, 69, 63, 63, 62, 61, 61, 61, 62, 62, 63, 63, 64, 64,
- 65, 65, 66, 66, 67, 67, 67, 67, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69,
- 69, 69, 64, 63, 62, 62, 61, 61, 62, 62, 63, 63, 64, 65, 65, 65, 66, 66,
- 67, 67, 67, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 64, 64,
- 63, 62, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 67, 68, 68,
- 68, 68, 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, 65, 64, 63, 63, 62, 62,
- 63, 63, 64, 64, 64, 65, 65, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69,
- 69, 69, 70, 70, 70, 70, 70, 70, 65, 64, 64, 63, 62, 63, 63, 63, 64, 64,
- 65, 65, 66, 66, 66, 67, 67, 68, 68, 68, 68, 69, 69, 69, 69, 70, 70, 70,
- 70, 70, 70, 70, 66, 65, 64, 63, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66,
- 67, 67, 67, 68, 68, 68, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 70,
- 66, 65, 65, 64, 63, 64, 64, 64, 65, 65, 65, 66, 66, 67, 67, 67, 68, 68,
- 68, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 70, 66, 66, 65, 64,
- 64, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69,
- 69, 70, 70, 70, 70, 70, 70, 70, 70, 70, 66, 66, 65, 64, 64, 64, 64, 65,
- 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 69, 70, 70, 70,
- 70, 70, 70, 70, 70, 70, 66, 66, 65, 64, 64, 64, 64, 65, 65, 65, 66, 66,
- 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70,
- 70, 70, 66, 66, 65, 64, 64, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 67,
- 68, 68, 68, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 70, 70 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 65, 72, 76, 65, 71, 74, 76, 72, 74, 77, 78, 76, 76, 78, 79,
- /* Size 8 */
- 64, 60, 61, 65, 68, 71, 73, 74, 60, 62, 61, 64, 67, 69, 71, 73, 61, 61,
- 66, 68, 69, 71, 72, 73, 65, 64, 68, 70, 71, 72, 73, 74, 68, 67, 69, 71,
- 73, 74, 74, 75, 71, 69, 71, 72, 74, 74, 75, 75, 73, 71, 72, 73, 74, 75,
- 75, 76, 74, 73, 73, 74, 75, 75, 76, 76,
- /* Size 16 */
- 64, 62, 60, 60, 61, 63, 65, 67, 68, 70, 71, 72, 73, 73, 74, 74, 62, 61,
- 61, 61, 61, 63, 64, 66, 68, 69, 70, 71, 72, 73, 73, 73, 60, 61, 62, 62,
- 61, 62, 64, 65, 67, 68, 69, 70, 71, 72, 73, 73, 60, 61, 62, 63, 64, 65,
- 66, 67, 68, 69, 70, 71, 72, 73, 73, 73, 61, 61, 61, 64, 66, 67, 68, 68,
- 69, 70, 71, 72, 72, 73, 73, 73, 63, 63, 62, 65, 67, 68, 69, 70, 70, 71,
- 72, 72, 73, 73, 74, 74, 65, 64, 64, 66, 68, 69, 70, 71, 71, 72, 72, 73,
- 73, 74, 74, 74, 67, 66, 65, 67, 68, 70, 71, 71, 72, 73, 73, 73, 74, 74,
- 74, 74, 68, 68, 67, 68, 69, 70, 71, 72, 73, 73, 74, 74, 74, 74, 75, 75,
- 70, 69, 68, 69, 70, 71, 72, 73, 73, 74, 74, 74, 75, 75, 75, 75, 71, 70,
- 69, 70, 71, 72, 72, 73, 74, 74, 74, 75, 75, 75, 75, 75, 72, 71, 70, 71,
- 72, 72, 73, 73, 74, 74, 75, 75, 75, 75, 75, 75, 73, 72, 71, 72, 72, 73,
- 73, 74, 74, 75, 75, 75, 75, 75, 76, 76, 73, 73, 72, 73, 73, 73, 74, 74,
- 74, 75, 75, 75, 75, 76, 76, 76, 74, 73, 73, 73, 73, 74, 74, 74, 75, 75,
- 75, 75, 76, 76, 76, 76, 74, 73, 73, 73, 73, 74, 74, 74, 75, 75, 75, 75,
- 76, 76, 76, 76,
- /* Size 32 */
- 64, 63, 62, 61, 60, 60, 60, 61, 61, 62, 63, 64, 65, 66, 67, 67, 68, 69,
- 70, 70, 71, 71, 72, 72, 73, 73, 73, 74, 74, 74, 74, 74, 63, 62, 62, 61,
- 60, 61, 61, 61, 61, 62, 63, 64, 65, 65, 66, 67, 68, 69, 69, 70, 70, 71,
- 71, 72, 72, 73, 73, 73, 74, 74, 74, 74, 62, 62, 61, 61, 61, 61, 61, 61,
- 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 69, 70, 71, 71, 72, 72, 72,
- 73, 73, 73, 73, 73, 73, 61, 61, 61, 61, 61, 61, 61, 61, 61, 62, 63, 63,
- 64, 65, 65, 66, 67, 68, 68, 69, 70, 70, 71, 71, 72, 72, 72, 73, 73, 73,
- 73, 73, 60, 60, 61, 61, 62, 62, 62, 61, 61, 62, 62, 63, 64, 64, 65, 66,
- 67, 67, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 73, 73, 73, 60, 61,
- 61, 61, 62, 62, 62, 62, 62, 63, 63, 64, 65, 65, 66, 67, 67, 68, 69, 69,
- 70, 70, 71, 71, 72, 72, 72, 73, 73, 73, 73, 73, 60, 61, 61, 61, 62, 62,
- 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 69, 69, 70, 70, 71, 71, 71,
- 72, 72, 73, 73, 73, 73, 73, 73, 61, 61, 61, 61, 61, 62, 63, 64, 65, 65,
- 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73,
- 73, 73, 73, 73, 61, 61, 61, 61, 61, 62, 64, 65, 66, 66, 67, 67, 68, 68,
- 68, 69, 69, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73,
- 62, 62, 62, 62, 62, 63, 64, 65, 66, 67, 67, 68, 68, 69, 69, 69, 70, 70,
- 71, 71, 71, 72, 72, 72, 73, 73, 73, 73, 74, 74, 74, 74, 63, 63, 63, 63,
- 62, 63, 65, 66, 67, 67, 68, 68, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72,
- 72, 73, 73, 73, 73, 74, 74, 74, 74, 74, 64, 64, 63, 63, 63, 64, 65, 66,
- 67, 68, 68, 69, 69, 70, 70, 71, 71, 71, 72, 72, 72, 72, 73, 73, 73, 73,
- 74, 74, 74, 74, 74, 74, 65, 65, 64, 64, 64, 65, 66, 67, 68, 68, 69, 69,
- 70, 70, 71, 71, 71, 72, 72, 72, 72, 73, 73, 73, 73, 74, 74, 74, 74, 74,
- 74, 74, 66, 65, 65, 65, 64, 65, 66, 67, 68, 69, 69, 70, 70, 71, 71, 71,
- 72, 72, 72, 73, 73, 73, 73, 73, 74, 74, 74, 74, 74, 74, 74, 74, 67, 66,
- 66, 65, 65, 66, 67, 68, 68, 69, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73,
- 73, 73, 73, 74, 74, 74, 74, 74, 74, 74, 74, 74, 67, 67, 67, 66, 66, 67,
- 67, 68, 69, 69, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73, 73, 74, 74, 74,
- 74, 74, 74, 74, 75, 75, 75, 75, 68, 68, 68, 67, 67, 67, 68, 69, 69, 70,
- 70, 71, 71, 72, 72, 72, 73, 73, 73, 73, 74, 74, 74, 74, 74, 74, 74, 75,
- 75, 75, 75, 75, 69, 69, 68, 68, 67, 68, 69, 69, 70, 70, 71, 71, 72, 72,
- 72, 73, 73, 73, 73, 74, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75,
- 70, 69, 69, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 72, 73, 73, 73, 73,
- 74, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 75, 70, 70, 69, 69,
- 69, 69, 70, 70, 71, 71, 71, 72, 72, 73, 73, 73, 73, 74, 74, 74, 74, 74,
- 74, 75, 75, 75, 75, 75, 75, 75, 75, 75, 71, 70, 70, 70, 69, 70, 70, 71,
- 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 74, 74, 74, 74, 75, 75, 75, 75,
- 75, 75, 75, 75, 75, 75, 71, 71, 71, 70, 70, 70, 71, 71, 71, 72, 72, 72,
- 73, 73, 73, 74, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 75, 75,
- 75, 75, 72, 71, 71, 71, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73, 73, 74,
- 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 72, 72,
- 72, 71, 71, 71, 71, 72, 72, 72, 73, 73, 73, 73, 74, 74, 74, 74, 74, 75,
- 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 73, 72, 72, 72, 71, 72,
- 72, 72, 72, 73, 73, 73, 73, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75,
- 75, 75, 75, 75, 76, 76, 76, 76, 73, 73, 72, 72, 72, 72, 72, 72, 73, 73,
- 73, 73, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 76,
- 76, 76, 76, 76, 73, 73, 73, 72, 72, 72, 73, 73, 73, 73, 73, 74, 74, 74,
- 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, 76,
- 74, 73, 73, 73, 73, 73, 73, 73, 73, 73, 74, 74, 74, 74, 74, 74, 75, 75,
- 75, 75, 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, 76, 76, 74, 74, 73, 73,
- 73, 73, 73, 73, 73, 74, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75,
- 75, 75, 76, 76, 76, 76, 76, 76, 76, 76, 74, 74, 73, 73, 73, 73, 73, 73,
- 73, 74, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 75, 75, 76, 76,
- 76, 76, 76, 76, 76, 76, 74, 74, 73, 73, 73, 73, 73, 73, 73, 74, 74, 74,
- 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, 76,
- 76, 76, 74, 74, 73, 73, 73, 73, 73, 73, 73, 74, 74, 74, 74, 74, 74, 75,
- 75, 75, 75, 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, 76, 76, 76 },
- { /* Intra matrices */
- /* Size 4 */
- 55, 57, 62, 66, 57, 61, 65, 67, 62, 65, 67, 68, 66, 67, 68, 69,
- /* Size 8 */
- 58, 54, 55, 59, 62, 64, 66, 67, 54, 56, 55, 57, 60, 63, 65, 66, 55, 55,
- 60, 61, 63, 64, 66, 67, 59, 57, 61, 64, 65, 66, 67, 68, 62, 60, 63, 65,
- 66, 67, 68, 68, 64, 63, 64, 66, 67, 68, 68, 69, 66, 65, 66, 67, 68, 68,
- 69, 69, 67, 66, 67, 68, 68, 69, 69, 69,
- /* Size 16 */
- 57, 55, 53, 54, 55, 56, 58, 60, 62, 63, 64, 65, 66, 66, 67, 67, 55, 55,
- 54, 55, 55, 56, 58, 59, 61, 62, 63, 64, 65, 66, 66, 66, 53, 54, 55, 55,
- 55, 56, 57, 58, 60, 61, 63, 63, 64, 65, 66, 66, 54, 55, 55, 56, 57, 58,
- 59, 60, 61, 62, 63, 64, 65, 66, 66, 66, 55, 55, 55, 57, 59, 60, 61, 62,
- 62, 63, 64, 65, 65, 66, 66, 66, 56, 56, 56, 58, 60, 61, 62, 63, 63, 64,
- 65, 65, 66, 66, 67, 67, 58, 58, 57, 59, 61, 62, 63, 64, 65, 65, 66, 66,
- 66, 67, 67, 67, 60, 59, 58, 60, 62, 63, 64, 65, 65, 66, 66, 66, 67, 67,
- 67, 67, 62, 61, 60, 61, 62, 63, 65, 65, 66, 66, 67, 67, 67, 67, 68, 68,
- 63, 62, 61, 62, 63, 64, 65, 66, 66, 67, 67, 67, 67, 68, 68, 68, 64, 63,
- 63, 63, 64, 65, 66, 66, 67, 67, 67, 68, 68, 68, 68, 68, 65, 64, 63, 64,
- 65, 65, 66, 66, 67, 67, 68, 68, 68, 68, 68, 68, 66, 65, 64, 65, 65, 66,
- 66, 67, 67, 67, 68, 68, 68, 68, 68, 68, 66, 66, 65, 66, 66, 66, 67, 67,
- 67, 68, 68, 68, 68, 68, 69, 69, 67, 66, 66, 66, 66, 67, 67, 67, 68, 68,
- 68, 68, 68, 69, 69, 69, 67, 66, 66, 66, 66, 67, 67, 67, 68, 68, 68, 68,
- 68, 69, 69, 69,
- /* Size 32 */
- 57, 56, 55, 54, 53, 54, 54, 54, 54, 55, 56, 57, 58, 59, 60, 60, 61, 62,
- 63, 63, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, 67, 56, 56, 55, 54,
- 54, 54, 54, 54, 54, 55, 56, 57, 58, 58, 59, 60, 61, 62, 62, 63, 63, 64,
- 64, 65, 65, 65, 66, 66, 66, 66, 66, 66, 55, 55, 55, 54, 54, 54, 54, 54,
- 55, 55, 56, 57, 57, 58, 59, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65,
- 65, 66, 66, 66, 66, 66, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 56, 56,
- 57, 58, 59, 59, 60, 61, 61, 62, 63, 63, 64, 64, 65, 65, 65, 66, 66, 66,
- 66, 66, 53, 54, 54, 55, 55, 55, 55, 55, 55, 55, 56, 56, 57, 57, 58, 59,
- 60, 60, 61, 62, 62, 63, 63, 64, 64, 65, 65, 65, 66, 66, 66, 66, 54, 54,
- 54, 55, 55, 55, 55, 56, 56, 56, 57, 57, 58, 58, 59, 60, 60, 61, 61, 62,
- 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 66, 66, 54, 54, 54, 55, 55, 55,
- 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 63, 63, 63, 64, 64,
- 65, 65, 65, 66, 66, 66, 66, 66, 54, 54, 54, 55, 55, 56, 56, 57, 58, 58,
- 59, 59, 60, 60, 61, 61, 62, 62, 62, 63, 63, 64, 64, 65, 65, 65, 65, 66,
- 66, 66, 66, 66, 54, 54, 55, 55, 55, 56, 57, 58, 59, 59, 60, 60, 61, 61,
- 61, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 66, 66, 66, 66,
- 55, 55, 55, 55, 55, 56, 57, 58, 59, 60, 60, 61, 61, 62, 62, 62, 63, 63,
- 63, 64, 64, 64, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 56, 56, 56, 56,
- 56, 57, 58, 59, 60, 60, 61, 61, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65,
- 65, 65, 66, 66, 66, 66, 67, 67, 67, 67, 57, 57, 57, 56, 56, 57, 58, 59,
- 60, 61, 61, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66,
- 66, 66, 67, 67, 67, 67, 58, 58, 57, 57, 57, 58, 59, 60, 61, 61, 62, 62,
- 63, 63, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 67, 67, 67,
- 67, 67, 59, 58, 58, 58, 57, 58, 59, 60, 61, 62, 62, 63, 63, 64, 64, 64,
- 65, 65, 65, 65, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 60, 59,
- 59, 59, 58, 59, 60, 61, 61, 62, 63, 63, 64, 64, 64, 65, 65, 65, 65, 66,
- 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 67, 60, 60, 60, 59, 59, 60,
- 60, 61, 62, 62, 63, 63, 64, 64, 65, 65, 65, 65, 66, 66, 66, 66, 66, 67,
- 67, 67, 67, 67, 67, 67, 67, 67, 61, 61, 61, 60, 60, 60, 61, 62, 62, 63,
- 63, 64, 64, 65, 65, 65, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67,
- 67, 67, 67, 67, 62, 62, 61, 61, 60, 61, 61, 62, 63, 63, 64, 64, 65, 65,
- 65, 65, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68,
- 63, 62, 62, 61, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 65, 66, 66, 66,
- 66, 67, 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 63, 63, 62, 62,
- 62, 62, 63, 63, 63, 64, 64, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 67,
- 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 64, 63, 63, 63, 62, 63, 63, 63,
- 64, 64, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 68, 68,
- 68, 68, 68, 68, 68, 68, 64, 64, 63, 63, 63, 63, 63, 64, 64, 64, 65, 65,
- 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68,
- 68, 68, 65, 64, 64, 64, 63, 64, 64, 64, 64, 65, 65, 65, 66, 66, 66, 66,
- 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 65, 65,
- 64, 64, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 67, 67,
- 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 65, 65, 65, 65, 64, 64,
- 65, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68,
- 68, 68, 68, 68, 68, 68, 68, 68, 66, 65, 65, 65, 65, 65, 65, 65, 65, 66,
- 66, 66, 66, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68,
- 68, 68, 68, 68, 66, 66, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 67,
- 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
- 66, 66, 66, 66, 65, 65, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67,
- 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 67, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68,
- 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 67, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68,
- 68, 68, 68, 68, 68, 68, 67, 66, 66, 66, 66, 66, 66, 66, 66, 66, 67, 67,
- 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
- 68, 68, 67, 66, 66, 66, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67,
- 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 71, 72, 74, 71, 73, 73, 75, 72, 73, 76, 77, 74, 75, 77, 78,
- /* Size 8 */
- 64, 61, 69, 70, 71, 72, 73, 74, 61, 66, 69, 68, 69, 70, 71, 72, 69, 69,
- 71, 71, 71, 71, 72, 73, 70, 68, 71, 72, 73, 73, 74, 74, 71, 69, 71, 73,
- 74, 74, 75, 75, 72, 70, 71, 73, 74, 75, 75, 76, 73, 71, 72, 74, 75, 75,
- 76, 76, 74, 72, 73, 74, 75, 76, 76, 77,
- /* Size 16 */
- 64, 62, 61, 65, 69, 70, 70, 70, 71, 71, 72, 72, 73, 74, 74, 74, 62, 63,
- 63, 66, 69, 69, 69, 69, 70, 70, 71, 71, 72, 73, 73, 73, 61, 63, 66, 68,
- 69, 69, 68, 68, 69, 69, 70, 70, 71, 72, 72, 72, 65, 66, 68, 69, 70, 70,
- 69, 70, 70, 70, 70, 71, 72, 72, 73, 73, 69, 69, 69, 70, 71, 71, 71, 71,
- 71, 71, 71, 72, 72, 73, 73, 73, 70, 69, 69, 70, 71, 71, 71, 72, 72, 72,
- 72, 72, 73, 73, 74, 74, 70, 69, 68, 69, 71, 71, 72, 72, 73, 73, 73, 73,
- 74, 74, 74, 74, 70, 69, 68, 70, 71, 72, 72, 73, 73, 73, 74, 74, 74, 74,
- 75, 75, 71, 70, 69, 70, 71, 72, 73, 73, 74, 74, 74, 74, 75, 75, 75, 75,
- 71, 70, 69, 70, 71, 72, 73, 73, 74, 74, 75, 75, 75, 75, 76, 76, 72, 71,
- 70, 70, 71, 72, 73, 74, 74, 75, 75, 75, 75, 76, 76, 76, 72, 71, 70, 71,
- 72, 72, 73, 74, 74, 75, 75, 75, 76, 76, 76, 76, 73, 72, 71, 72, 72, 73,
- 74, 74, 75, 75, 75, 76, 76, 76, 76, 76, 74, 73, 72, 72, 73, 73, 74, 74,
- 75, 75, 76, 76, 76, 76, 77, 77, 74, 73, 72, 73, 73, 74, 74, 75, 75, 76,
- 76, 76, 76, 77, 77, 77, 74, 73, 72, 73, 73, 74, 74, 75, 75, 76, 76, 76,
- 76, 77, 77, 77,
- /* Size 32 */
- 64, 63, 62, 61, 61, 63, 65, 67, 69, 69, 70, 70, 70, 70, 70, 70, 71, 71,
- 71, 72, 72, 72, 72, 73, 73, 73, 74, 74, 74, 74, 74, 74, 63, 63, 62, 62,
- 62, 64, 65, 67, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 71, 71, 71, 72,
- 72, 72, 73, 73, 73, 73, 74, 74, 74, 74, 62, 62, 63, 63, 63, 65, 66, 68,
- 69, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, 71, 71, 71, 72, 72, 72,
- 73, 73, 73, 73, 73, 73, 61, 62, 63, 64, 65, 66, 67, 68, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 72, 72, 73, 73,
- 73, 73, 61, 62, 63, 65, 66, 67, 68, 69, 69, 69, 69, 68, 68, 68, 68, 68,
- 69, 69, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 72, 72, 72, 72, 63, 64,
- 65, 66, 67, 68, 68, 69, 70, 70, 69, 69, 69, 69, 69, 69, 69, 69, 70, 70,
- 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73, 73, 65, 65, 66, 67, 68, 68,
- 69, 70, 70, 70, 70, 70, 69, 70, 70, 70, 70, 70, 70, 70, 70, 71, 71, 71,
- 72, 72, 72, 72, 73, 73, 73, 73, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71,
- 70, 70, 70, 70, 70, 70, 70, 70, 71, 71, 71, 71, 71, 72, 72, 72, 72, 73,
- 73, 73, 73, 73, 69, 69, 69, 69, 69, 70, 70, 71, 71, 71, 71, 71, 71, 71,
- 71, 71, 71, 71, 71, 71, 71, 72, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73,
- 69, 69, 69, 69, 69, 70, 70, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
- 71, 72, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73, 73, 70, 69, 69, 69,
- 69, 69, 70, 70, 71, 71, 71, 71, 71, 72, 72, 72, 72, 72, 72, 72, 72, 72,
- 72, 73, 73, 73, 73, 73, 74, 74, 74, 74, 70, 69, 69, 69, 68, 69, 70, 70,
- 71, 71, 71, 72, 72, 72, 72, 72, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73,
- 74, 74, 74, 74, 74, 74, 70, 69, 69, 69, 68, 69, 69, 70, 71, 71, 71, 72,
- 72, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73, 73, 74, 74, 74, 74, 74, 74,
- 74, 74, 70, 70, 69, 69, 68, 69, 70, 70, 71, 71, 72, 72, 72, 72, 73, 73,
- 73, 73, 73, 73, 73, 73, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 70, 70,
- 69, 69, 68, 69, 70, 70, 71, 71, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73,
- 74, 74, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 70, 70, 69, 69, 68, 69,
- 70, 70, 71, 71, 72, 72, 72, 73, 73, 73, 73, 73, 74, 74, 74, 74, 74, 74,
- 74, 74, 75, 75, 75, 75, 75, 75, 71, 70, 70, 69, 69, 69, 70, 70, 71, 71,
- 72, 72, 73, 73, 73, 73, 74, 74, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75,
- 75, 75, 75, 75, 71, 70, 70, 69, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73,
- 73, 73, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
- 71, 71, 70, 70, 69, 70, 70, 71, 71, 71, 72, 72, 73, 73, 73, 74, 74, 74,
- 74, 74, 75, 75, 75, 75, 75, 75, 75, 75, 76, 76, 76, 76, 72, 71, 70, 70,
- 69, 70, 70, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 74, 74, 75, 75, 75,
- 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, 72, 71, 71, 70, 70, 70, 70, 71,
- 71, 72, 72, 73, 73, 73, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 76,
- 76, 76, 76, 76, 76, 76, 72, 72, 71, 71, 70, 70, 71, 71, 72, 72, 72, 73,
- 73, 73, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, 76,
- 76, 76, 72, 72, 71, 71, 70, 71, 71, 71, 72, 72, 72, 73, 73, 74, 74, 74,
- 74, 75, 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, 76, 76, 76, 76, 73, 72,
- 72, 71, 71, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 75, 75,
- 75, 75, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 73, 73, 72, 72, 71, 71,
- 72, 72, 72, 73, 73, 73, 74, 74, 74, 74, 75, 75, 75, 75, 75, 76, 76, 76,
- 76, 76, 76, 76, 76, 76, 76, 76, 73, 73, 72, 72, 71, 72, 72, 72, 72, 73,
- 73, 73, 74, 74, 74, 74, 75, 75, 75, 75, 76, 76, 76, 76, 76, 76, 76, 76,
- 77, 77, 77, 77, 74, 73, 73, 72, 72, 72, 72, 72, 73, 73, 73, 74, 74, 74,
- 74, 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, 76, 76, 77, 77, 77, 77, 77,
- 74, 73, 73, 72, 72, 72, 72, 73, 73, 73, 73, 74, 74, 74, 75, 75, 75, 75,
- 75, 76, 76, 76, 76, 76, 76, 76, 77, 77, 77, 77, 77, 77, 74, 74, 73, 73,
- 72, 73, 73, 73, 73, 73, 74, 74, 74, 74, 75, 75, 75, 75, 76, 76, 76, 76,
- 76, 76, 76, 77, 77, 77, 77, 77, 77, 77, 74, 74, 73, 73, 72, 73, 73, 73,
- 73, 73, 74, 74, 74, 74, 75, 75, 75, 75, 76, 76, 76, 76, 76, 76, 76, 77,
- 77, 77, 77, 77, 77, 77, 74, 74, 73, 73, 72, 73, 73, 73, 73, 73, 74, 74,
- 74, 74, 75, 75, 75, 75, 76, 76, 76, 76, 76, 76, 76, 77, 77, 77, 77, 77,
- 77, 77, 74, 74, 73, 73, 72, 73, 73, 73, 73, 73, 74, 74, 74, 74, 75, 75,
- 75, 75, 76, 76, 76, 76, 76, 76, 76, 77, 77, 77, 77, 77, 77, 77 },
- { /* Intra matrices */
- /* Size 4 */
- 55, 61, 62, 65, 61, 63, 64, 65, 62, 64, 66, 67, 65, 65, 67, 68,
- /* Size 8 */
- 57, 53, 61, 62, 63, 64, 65, 66, 53, 59, 62, 60, 61, 62, 63, 64, 61, 62,
- 63, 63, 63, 63, 64, 65, 62, 60, 63, 64, 65, 65, 66, 66, 63, 61, 63, 65,
- 66, 66, 67, 67, 64, 62, 63, 65, 66, 67, 67, 68, 65, 63, 64, 66, 67, 67,
- 68, 68, 66, 64, 65, 66, 67, 68, 68, 69,
- /* Size 16 */
- 56, 55, 53, 57, 61, 61, 62, 62, 62, 63, 64, 64, 65, 65, 66, 66, 55, 55,
- 56, 58, 61, 61, 61, 61, 61, 62, 63, 63, 64, 64, 65, 65, 53, 56, 58, 60,
- 61, 61, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 57, 58, 60, 61, 62, 62,
- 61, 61, 62, 62, 62, 63, 63, 64, 64, 64, 61, 61, 61, 62, 63, 63, 63, 63,
- 63, 63, 63, 64, 64, 64, 65, 65, 61, 61, 61, 62, 63, 63, 63, 63, 63, 64,
- 64, 64, 65, 65, 65, 65, 62, 61, 60, 61, 63, 63, 64, 64, 64, 64, 65, 65,
- 65, 65, 66, 66, 62, 61, 60, 61, 63, 63, 64, 64, 65, 65, 65, 65, 66, 66,
- 66, 66, 62, 61, 61, 62, 63, 63, 64, 65, 65, 66, 66, 66, 66, 66, 67, 67,
- 63, 62, 61, 62, 63, 64, 64, 65, 66, 66, 66, 66, 67, 67, 67, 67, 64, 63,
- 62, 62, 63, 64, 65, 65, 66, 66, 67, 67, 67, 67, 67, 67, 64, 63, 62, 63,
- 64, 64, 65, 65, 66, 66, 67, 67, 67, 68, 68, 68, 65, 64, 63, 63, 64, 65,
- 65, 66, 66, 67, 67, 67, 68, 68, 68, 68, 65, 64, 63, 64, 64, 65, 65, 66,
- 66, 67, 67, 68, 68, 68, 68, 68, 66, 65, 64, 64, 65, 65, 66, 66, 67, 67,
- 67, 68, 68, 68, 68, 68, 66, 65, 64, 64, 65, 65, 66, 66, 67, 67, 67, 68,
- 68, 68, 68, 68,
- /* Size 32 */
- 56, 55, 55, 54, 53, 55, 57, 59, 61, 61, 61, 61, 62, 62, 62, 62, 62, 63,
- 63, 63, 63, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 66, 55, 55, 55, 54,
- 54, 56, 57, 59, 61, 61, 61, 61, 61, 61, 62, 62, 62, 62, 62, 63, 63, 63,
- 63, 64, 64, 64, 65, 65, 65, 65, 65, 65, 55, 55, 55, 55, 55, 57, 58, 60,
- 61, 61, 61, 61, 61, 61, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 64, 64,
- 64, 64, 65, 65, 65, 65, 54, 54, 55, 56, 57, 58, 59, 60, 61, 61, 61, 61,
- 60, 61, 61, 61, 61, 61, 61, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64,
- 64, 64, 53, 54, 55, 57, 58, 59, 60, 60, 61, 61, 61, 60, 60, 60, 60, 60,
- 60, 61, 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 64, 64, 55, 56,
- 57, 58, 59, 60, 60, 61, 62, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 62,
- 62, 62, 62, 63, 63, 63, 64, 64, 64, 64, 64, 64, 57, 57, 58, 59, 60, 60,
- 61, 61, 62, 62, 62, 61, 61, 61, 61, 61, 61, 62, 62, 62, 62, 62, 63, 63,
- 63, 64, 64, 64, 64, 64, 64, 64, 59, 59, 60, 60, 60, 61, 61, 62, 62, 62,
- 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64,
- 64, 64, 64, 64, 61, 61, 61, 61, 61, 62, 62, 62, 63, 63, 63, 63, 62, 62,
- 62, 62, 62, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65,
- 61, 61, 61, 61, 61, 61, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
- 63, 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 61, 61, 61, 61,
- 61, 61, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64,
- 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 61, 61, 61, 61, 60, 61, 61, 62,
- 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 62, 61, 61, 60, 60, 61, 61, 62, 62, 63, 63, 63,
- 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66,
- 66, 66, 62, 61, 61, 61, 60, 61, 61, 62, 62, 63, 63, 63, 64, 64, 64, 64,
- 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 62, 62,
- 61, 61, 60, 61, 61, 62, 62, 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65,
- 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 62, 62, 61, 61, 60, 61,
- 61, 62, 62, 63, 63, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66, 62, 62, 61, 61, 60, 61, 61, 62, 62, 63,
- 63, 64, 64, 64, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66,
- 67, 67, 67, 67, 63, 62, 62, 61, 61, 61, 62, 62, 63, 63, 63, 64, 64, 64,
- 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67,
- 63, 62, 62, 61, 61, 61, 62, 62, 63, 63, 64, 64, 64, 65, 65, 65, 65, 66,
- 66, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 63, 63, 62, 62,
- 61, 62, 62, 62, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 66, 66, 66, 66,
- 66, 67, 67, 67, 67, 67, 67, 67, 67, 67, 63, 63, 62, 62, 61, 62, 62, 63,
- 63, 63, 64, 64, 65, 65, 65, 65, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67,
- 67, 67, 67, 67, 67, 67, 64, 63, 63, 62, 62, 62, 62, 63, 63, 64, 64, 64,
- 65, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
- 67, 67, 64, 63, 63, 63, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 66,
- 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 64, 64,
- 63, 63, 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 66, 67,
- 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 65, 64, 64, 63, 63, 63,
- 63, 64, 64, 64, 64, 65, 65, 65, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67,
- 67, 68, 68, 68, 68, 68, 68, 68, 65, 64, 64, 63, 63, 63, 64, 64, 64, 64,
- 65, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68,
- 68, 68, 68, 68, 65, 65, 64, 64, 63, 64, 64, 64, 64, 65, 65, 65, 65, 66,
- 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68,
- 65, 65, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 66, 67,
- 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 66, 65, 65, 64,
- 64, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67,
- 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 66, 65, 65, 64, 64, 64, 64, 64,
- 65, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68,
- 68, 68, 68, 68, 68, 68, 66, 65, 65, 64, 64, 64, 64, 64, 65, 65, 65, 65,
- 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68,
- 68, 68, 66, 65, 65, 64, 64, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 66,
- 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 65, 68, 70, 65, 67, 69, 70, 68, 69, 70, 71, 70, 70, 71, 71,
- /* Size 8 */
- 64, 62, 62, 64, 66, 67, 68, 69, 62, 63, 63, 64, 65, 67, 68, 68, 62, 63,
- 65, 66, 67, 67, 68, 69, 64, 64, 66, 67, 68, 68, 69, 69, 66, 65, 67, 68,
- 68, 69, 69, 69, 67, 67, 67, 68, 69, 69, 69, 69, 68, 68, 68, 69, 69, 69,
- 69, 69, 69, 68, 69, 69, 69, 69, 69, 70,
- /* Size 16 */
- 64, 63, 62, 62, 62, 63, 64, 65, 66, 67, 67, 68, 68, 68, 69, 69, 63, 63,
- 62, 62, 63, 63, 64, 65, 66, 66, 67, 67, 68, 68, 69, 69, 62, 62, 63, 63,
- 63, 63, 64, 65, 65, 66, 67, 67, 68, 68, 68, 68, 62, 62, 63, 63, 64, 64,
- 65, 65, 66, 67, 67, 67, 68, 68, 68, 68, 62, 63, 63, 64, 65, 65, 66, 66,
- 67, 67, 67, 68, 68, 68, 69, 69, 63, 63, 63, 64, 65, 66, 66, 67, 67, 67,
- 68, 68, 68, 68, 69, 69, 64, 64, 64, 65, 66, 66, 67, 67, 68, 68, 68, 68,
- 69, 69, 69, 69, 65, 65, 65, 65, 66, 67, 67, 68, 68, 68, 68, 69, 69, 69,
- 69, 69, 66, 66, 65, 66, 67, 67, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69,
- 67, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 67, 67,
- 67, 67, 67, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 68, 67, 67, 67,
- 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 68, 68, 68, 68, 68, 68,
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 68, 68, 68, 68, 68, 68, 69, 69,
- 69, 69, 69, 69, 69, 69, 70, 70, 69, 69, 68, 68, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 70, 70, 70, 69, 69, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 70, 70, 70,
- /* Size 32 */
- 64, 63, 63, 62, 62, 62, 62, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 66,
- 67, 67, 67, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 63, 63, 63, 62,
- 62, 62, 62, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 66, 67, 67, 67, 67,
- 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 63, 63, 63, 62, 62, 62, 62, 62,
- 63, 63, 63, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, 67, 68, 68, 68,
- 68, 68, 69, 69, 69, 69, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 64,
- 64, 64, 65, 65, 66, 66, 66, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68,
- 68, 68, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 65, 65,
- 65, 66, 66, 66, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 62, 62,
- 62, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 66, 67,
- 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 62, 62, 62, 63, 63, 63,
- 63, 63, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 67, 67, 67, 67, 67, 68,
- 68, 68, 68, 68, 68, 68, 68, 68, 62, 62, 62, 63, 63, 63, 63, 64, 64, 65,
- 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68,
- 68, 68, 68, 68, 62, 62, 63, 63, 63, 63, 64, 64, 65, 65, 65, 66, 66, 66,
- 66, 66, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69,
- 63, 63, 63, 63, 63, 63, 64, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 67,
- 67, 67, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 63, 63, 63, 63,
- 63, 64, 64, 65, 65, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 68, 68, 68,
- 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 64, 64, 64, 64, 63, 64, 65, 65,
- 66, 66, 66, 66, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68,
- 69, 69, 69, 69, 69, 69, 64, 64, 64, 64, 64, 64, 65, 65, 66, 66, 66, 67,
- 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69,
- 69, 69, 65, 65, 65, 64, 64, 65, 65, 66, 66, 66, 67, 67, 67, 67, 67, 68,
- 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 65, 65,
- 65, 65, 65, 65, 65, 66, 66, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68,
- 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 66, 66, 65, 65, 65, 65,
- 66, 66, 66, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 69, 69, 66, 66, 66, 66, 65, 66, 66, 66, 67, 67,
- 67, 67, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 69, 66, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 68, 68, 68,
- 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
- 67, 67, 66, 66, 66, 66, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 69,
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 67, 67, 67, 67,
- 66, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 67, 67, 67, 67, 67, 67, 67, 67,
- 67, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 68, 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68,
- 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 68, 68, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 69, 69,
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 68, 68,
- 68, 68, 67, 68, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 68, 68, 68, 68, 68, 68,
- 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 69, 69, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
- 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
- 70, 70, 70, 70, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70,
- 69, 68, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 69, 69, 69, 68,
- 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 69, 69, 69, 68, 68, 68, 68, 68,
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 70,
- 70, 70, 70, 70, 70, 70, 69, 69, 69, 68, 68, 68, 68, 68, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70,
- 70, 70, 69, 69, 69, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70 },
- { /* Intra matrices */
- /* Size 4 */
- 59, 60, 63, 65, 60, 63, 64, 65, 63, 64, 66, 66, 65, 65, 66, 66,
- /* Size 8 */
- 61, 59, 59, 61, 63, 64, 65, 66, 59, 60, 59, 61, 62, 64, 65, 65, 59, 59,
- 62, 63, 64, 64, 65, 65, 61, 61, 63, 64, 65, 65, 65, 66, 63, 62, 64, 65,
- 65, 66, 66, 66, 64, 64, 64, 65, 66, 66, 66, 66, 65, 65, 65, 65, 66, 66,
- 66, 66, 66, 65, 65, 66, 66, 66, 66, 67,
- /* Size 16 */
- 61, 60, 58, 59, 59, 60, 61, 62, 63, 63, 64, 64, 65, 65, 65, 65, 60, 59,
- 59, 59, 59, 60, 61, 62, 62, 63, 64, 64, 65, 65, 65, 65, 58, 59, 60, 59,
- 59, 60, 60, 61, 62, 63, 63, 64, 64, 65, 65, 65, 59, 59, 59, 60, 60, 61,
- 61, 62, 63, 63, 64, 64, 65, 65, 65, 65, 59, 59, 59, 60, 62, 62, 63, 63,
- 63, 64, 64, 64, 65, 65, 65, 65, 60, 60, 60, 61, 62, 63, 63, 63, 64, 64,
- 64, 65, 65, 65, 65, 65, 61, 61, 60, 61, 63, 63, 64, 64, 64, 65, 65, 65,
- 65, 65, 66, 66, 62, 62, 61, 62, 63, 63, 64, 64, 65, 65, 65, 65, 65, 66,
- 66, 66, 63, 62, 62, 63, 63, 64, 64, 65, 65, 65, 65, 65, 66, 66, 66, 66,
- 63, 63, 63, 63, 64, 64, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 64, 64,
- 63, 64, 64, 64, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 64, 64, 64, 64,
- 64, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 65, 65, 64, 65, 65, 65,
- 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 66,
- 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66,
- /* Size 32 */
- 61, 60, 59, 59, 58, 59, 59, 59, 59, 60, 60, 61, 61, 61, 62, 62, 63, 63,
- 63, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 60, 60, 59, 59,
- 59, 59, 59, 59, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 63, 63, 64, 64,
- 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 59, 59, 59, 59, 59, 59, 59, 59,
- 59, 59, 60, 60, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 64, 65, 65,
- 65, 65, 65, 65, 65, 65, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 60, 60,
- 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 64, 65, 65, 65, 65, 65,
- 65, 65, 58, 59, 59, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 61, 61, 62,
- 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 59, 59,
- 59, 59, 59, 59, 60, 60, 60, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63,
- 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 59, 59, 59, 59, 59, 60,
- 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64,
- 64, 65, 65, 65, 65, 65, 65, 65, 59, 59, 59, 59, 59, 60, 60, 60, 61, 61,
- 61, 62, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65,
- 65, 65, 65, 65, 59, 59, 59, 59, 59, 60, 60, 61, 62, 62, 62, 62, 62, 63,
- 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65,
- 60, 59, 59, 59, 59, 60, 61, 61, 62, 62, 62, 62, 63, 63, 63, 63, 63, 64,
- 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 60, 60, 60, 60,
- 60, 60, 61, 61, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64,
- 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 61, 60, 60, 60, 60, 61, 61, 62,
- 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 61, 61, 61, 61, 60, 61, 61, 62, 62, 63, 63, 63,
+ /* Size 8x8 */
+ 63, 69, 85, 94, 99, 109, 121, 128, 69, 78, 90, 92, 95, 102, 113, 119,
+ 85, 90, 97, 99, 101, 107, 115, 121, 94, 92, 99, 110, 116, 122, 130, 133,
+ 99, 95, 101, 116, 130, 139, 147, 149, 109, 102, 107, 122, 139, 153, 164,
+ 167, 121, 113, 115, 130, 147, 164, 178, 186, 128, 119, 121, 133, 149,
+ 167, 186, 194,
+ /* Size 16x16 */
+ 64, 62, 63, 71, 81, 98, 97, 98, 101, 104, 109, 115, 123, 129, 133, 138,
+ 62, 63, 65, 74, 83, 95, 94, 93, 96, 99, 103, 109, 115, 121, 125, 129,
+ 63, 65, 69, 79, 86, 93, 92, 90, 93, 95, 99, 104, 110, 115, 119, 123, 71,
+ 74, 79, 88, 92, 95, 93, 91, 93, 94, 97, 102, 107, 112, 115, 119, 81, 83,
+ 86, 92, 96, 100, 98, 97, 98, 99, 102, 106, 111, 115, 118, 120, 98, 95,
+ 93, 95, 100, 106, 106, 107, 108, 109, 111, 114, 119, 122, 125, 126, 97,
+ 94, 92, 93, 98, 106, 109, 111, 113, 115, 117, 121, 125, 129, 131, 133,
+ 98, 93, 90, 91, 97, 107, 111, 117, 120, 123, 125, 128, 132, 136, 138,
+ 140, 101, 96, 93, 93, 98, 108, 113, 120, 123, 127, 130, 135, 139, 143,
+ 145, 148, 104, 99, 95, 94, 99, 109, 115, 123, 127, 133, 137, 142, 147,
+ 151, 153, 157, 109, 103, 99, 97, 102, 111, 117, 125, 130, 137, 142, 148,
+ 153, 157, 160, 165, 115, 109, 104, 102, 106, 114, 121, 128, 135, 142,
+ 148, 155, 161, 166, 169, 175, 123, 115, 110, 107, 111, 119, 125, 132,
+ 139, 147, 153, 161, 169, 175, 178, 183, 129, 121, 115, 112, 115, 122,
+ 129, 136, 143, 151, 157, 166, 175, 181, 185, 194, 133, 125, 119, 115,
+ 118, 125, 131, 138, 145, 153, 160, 169, 178, 185, 189, 193, 138, 129,
+ 123, 119, 120, 126, 133, 140, 148, 157, 165, 175, 183, 194, 193, 199,
+ /* Size 32x32 */
+ 64, 62, 62, 61, 63, 67, 71, 73, 81, 83, 98, 98, 97, 97, 98, 100, 101,
+ 104, 104, 109, 109, 114, 115, 120, 123, 127, 129, 130, 133, 135, 138,
+ 140, 62, 63, 63, 62, 65, 69, 74, 77, 83, 85, 95, 95, 94, 94, 94, 95, 97,
+ 99, 100, 104, 104, 109, 110, 114, 117, 121, 122, 123, 126, 128, 130,
+ 132, 62, 63, 63, 63, 65, 70, 74, 78, 83, 85, 95, 95, 94, 93, 93, 95, 96,
+ 98, 99, 103, 103, 108, 109, 113, 115, 119, 121, 122, 125, 127, 129, 132,
+ 61, 62, 63, 64, 66, 71, 76, 80, 84, 85, 93, 93, 91, 91, 90, 91, 93, 95,
+ 95, 99, 99, 104, 105, 109, 111, 115, 116, 117, 120, 122, 124, 125, 63,
+ 65, 65, 66, 69, 74, 79, 83, 86, 87, 93, 93, 92, 91, 90, 92, 93, 95, 95,
+ 99, 99, 103, 104, 108, 110, 114, 115, 116, 119, 121, 123, 126, 67, 69,
+ 70, 71, 74, 78, 83, 87, 89, 90, 95, 94, 93, 92, 91, 92, 93, 95, 95, 98,
+ 99, 102, 103, 107, 109, 113, 114, 115, 117, 119, 121, 122, 71, 74, 74,
+ 76, 79, 83, 88, 92, 92, 93, 95, 95, 93, 92, 91, 92, 93, 94, 94, 97, 97,
+ 101, 102, 105, 107, 110, 112, 113, 115, 117, 119, 123, 73, 77, 78, 80,
+ 83, 87, 92, 95, 95, 95, 96, 95, 93, 92, 91, 92, 92, 93, 94, 96, 97, 100,
+ 101, 104, 106, 109, 110, 111, 113, 115, 117, 117, 81, 83, 83, 84, 86,
+ 89, 92, 95, 96, 97, 100, 99, 98, 98, 97, 98, 98, 99, 99, 102, 102, 105,
+ 106, 109, 111, 114, 115, 116, 118, 119, 120, 118, 83, 85, 85, 85, 87,
+ 90, 93, 95, 97, 97, 101, 100, 99, 99, 98, 99, 100, 101, 101, 104, 104,
+ 107, 107, 111, 112, 115, 116, 117, 119, 121, 123, 127, 98, 95, 95, 93,
+ 93, 95, 95, 96, 100, 101, 106, 106, 106, 107, 107, 108, 108, 109, 109,
+ 111, 111, 113, 114, 117, 119, 121, 122, 123, 125, 126, 126, 124, 98, 95,
+ 95, 93, 93, 94, 95, 95, 99, 100, 106, 106, 107, 107, 108, 108, 108, 109,
+ 109, 111, 112, 114, 115, 118, 119, 122, 123, 124, 126, 127, 128, 133,
+ 97, 94, 94, 91, 92, 93, 93, 93, 98, 99, 106, 107, 109, 109, 111, 112,
+ 113, 114, 115, 117, 117, 120, 121, 123, 125, 127, 129, 129, 131, 133,
+ 133, 129, 97, 94, 93, 91, 91, 92, 92, 92, 98, 99, 107, 107, 109, 110,
+ 113, 114, 115, 116, 117, 119, 120, 122, 123, 126, 127, 130, 131, 131,
+ 133, 133, 134, 140, 98, 94, 93, 90, 90, 91, 91, 91, 97, 98, 107, 108,
+ 111, 113, 117, 118, 120, 122, 123, 125, 125, 127, 128, 131, 132, 135,
+ 136, 136, 138, 141, 140, 135, 100, 95, 95, 91, 92, 92, 92, 92, 98, 99,
+ 108, 108, 112, 114, 118, 120, 121, 124, 125, 127, 128, 131, 131, 134,
+ 136, 138, 139, 140, 141, 140, 141, 148, 101, 97, 96, 93, 93, 93, 93, 92,
+ 98, 100, 108, 108, 113, 115, 120, 121, 123, 126, 127, 130, 130, 134,
+ 135, 137, 139, 142, 143, 143, 145, 148, 148, 142, 104, 99, 98, 95, 95,
+ 95, 94, 93, 99, 101, 109, 109, 114, 116, 122, 124, 126, 130, 131, 135,
+ 135, 139, 140, 143, 144, 147, 148, 149, 151, 149, 148, 156, 104, 100,
+ 99, 95, 95, 95, 94, 94, 99, 101, 109, 109, 115, 117, 123, 125, 127, 131,
+ 133, 137, 137, 141, 142, 145, 147, 150, 151, 151, 153, 156, 157, 149,
+ 109, 104, 103, 99, 99, 98, 97, 96, 102, 104, 111, 111, 117, 119, 125,
+ 127, 130, 135, 137, 141, 141, 146, 147, 150, 152, 156, 157, 157, 159,
+ 158, 156, 165, 109, 104, 103, 99, 99, 99, 97, 97, 102, 104, 111, 112,
+ 117, 120, 125, 128, 130, 135, 137, 141, 142, 147, 148, 151, 153, 156,
+ 157, 158, 160, 162, 165, 157, 114, 109, 108, 104, 103, 102, 101, 100,
+ 105, 107, 113, 114, 120, 122, 127, 131, 134, 139, 141, 146, 147, 153,
+ 154, 158, 160, 164, 165, 166, 168, 167, 163, 172, 115, 110, 109, 105,
+ 104, 103, 102, 101, 106, 107, 114, 115, 121, 123, 128, 131, 135, 140,
+ 142, 147, 148, 154, 155, 159, 161, 165, 166, 167, 169, 170, 175, 164,
+ 120, 114, 113, 109, 108, 107, 105, 104, 109, 111, 117, 118, 123, 126,
+ 131, 134, 137, 143, 145, 150, 151, 158, 159, 164, 166, 170, 172, 172,
+ 175, 176, 171, 183, 123, 117, 115, 111, 110, 109, 107, 106, 111, 112,
+ 119, 119, 125, 127, 132, 136, 139, 144, 147, 152, 153, 160, 161, 166,
+ 169, 173, 175, 176, 178, 177, 183, 173, 127, 121, 119, 115, 114, 113,
+ 110, 109, 114, 115, 121, 122, 127, 130, 135, 138, 142, 147, 150, 156,
+ 156, 164, 165, 170, 173, 178, 179, 180, 183, 186, 179, 190, 129, 122,
+ 121, 116, 115, 114, 112, 110, 115, 116, 122, 123, 129, 131, 136, 139,
+ 143, 148, 151, 157, 157, 165, 166, 172, 175, 179, 181, 182, 185, 186,
+ 194, 181, 130, 123, 122, 117, 116, 115, 113, 111, 116, 117, 123, 124,
+ 129, 131, 136, 140, 143, 149, 151, 157, 158, 166, 167, 172, 176, 180,
+ 182, 183, 186, 189, 188, 202, 133, 126, 125, 120, 119, 117, 115, 113,
+ 118, 119, 125, 126, 131, 133, 138, 141, 145, 151, 153, 159, 160, 168,
+ 169, 175, 178, 183, 185, 186, 189, 188, 193, 190, 135, 128, 127, 122,
+ 121, 119, 117, 115, 119, 121, 126, 127, 133, 133, 141, 140, 148, 149,
+ 156, 158, 162, 167, 170, 176, 177, 186, 186, 189, 188, 194, 191, 197,
+ 138, 130, 129, 124, 123, 121, 119, 117, 120, 123, 126, 128, 133, 134,
+ 140, 141, 148, 148, 157, 156, 165, 163, 175, 171, 183, 179, 194, 188,
+ 193, 191, 199, 193, 140, 132, 132, 125, 126, 122, 123, 117, 118, 127,
+ 124, 133, 129, 140, 135, 148, 142, 156, 149, 165, 157, 172, 164, 183,
+ 173, 190, 181, 202, 190, 197, 193, 203,
+ /* Size 4x8 */
+ 63, 94, 100, 122, 72, 94, 95, 114, 86, 100, 101, 117, 91, 106, 117, 131,
+ 95, 108, 132, 148, 104, 113, 141, 165, 115, 121, 150, 180, 123, 127,
+ 155, 185,
+ /* Size 8x4 */
+ 63, 72, 86, 91, 95, 104, 115, 123, 94, 94, 100, 106, 108, 113, 121, 127,
+ 100, 95, 101, 117, 132, 141, 150, 155, 122, 114, 117, 131, 148, 165,
+ 180, 185,
+ /* Size 8x16 */
+ 64, 64, 81, 98, 103, 115, 127, 135, 62, 66, 83, 94, 98, 108, 119, 127,
+ 63, 70, 86, 92, 95, 103, 114, 121, 71, 79, 92, 93, 94, 101, 110, 117,
+ 82, 86, 96, 98, 99, 105, 114, 119, 98, 94, 100, 107, 109, 114, 121, 126,
+ 97, 92, 98, 109, 114, 120, 128, 133, 98, 91, 97, 113, 122, 128, 135,
+ 141, 101, 93, 99, 115, 126, 134, 142, 148, 104, 96, 100, 117, 131, 142,
+ 150, 156, 109, 100, 103, 119, 134, 147, 156, 162, 115, 105, 106, 122,
+ 139, 154, 165, 171, 122, 111, 112, 127, 144, 160, 173, 177, 128, 116,
+ 116, 130, 147, 165, 179, 185, 132, 119, 119, 133, 150, 168, 183, 188,
+ 137, 124, 121, 133, 149, 166, 183, 194,
+ /* Size 16x8 */
+ 64, 62, 63, 71, 82, 98, 97, 98, 101, 104, 109, 115, 122, 128, 132, 137,
+ 64, 66, 70, 79, 86, 94, 92, 91, 93, 96, 100, 105, 111, 116, 119, 124,
+ 81, 83, 86, 92, 96, 100, 98, 97, 99, 100, 103, 106, 112, 116, 119, 121,
+ 98, 94, 92, 93, 98, 107, 109, 113, 115, 117, 119, 122, 127, 130, 133,
+ 133, 103, 98, 95, 94, 99, 109, 114, 122, 126, 131, 134, 139, 144, 147,
+ 150, 149, 115, 108, 103, 101, 105, 114, 120, 128, 134, 142, 147, 154,
+ 160, 165, 168, 166, 127, 119, 114, 110, 114, 121, 128, 135, 142, 150,
+ 156, 165, 173, 179, 183, 183, 135, 127, 121, 117, 119, 126, 133, 141,
+ 148, 156, 162, 171, 177, 185, 188, 194,
+ /* Size 16x32 */
+ 64, 62, 64, 74, 81, 96, 98, 98, 103, 105, 115, 116, 127, 129, 135, 139,
+ 63, 63, 66, 77, 83, 94, 94, 94, 99, 100, 109, 110, 120, 122, 128, 131,
+ 62, 63, 66, 77, 83, 94, 94, 94, 98, 99, 108, 109, 119, 121, 127, 131,
+ 61, 64, 67, 80, 84, 92, 91, 91, 95, 96, 104, 105, 115, 116, 122, 124,
+ 63, 67, 70, 82, 86, 93, 92, 91, 95, 96, 103, 104, 114, 115, 121, 125,
+ 67, 72, 74, 86, 89, 94, 93, 92, 95, 95, 103, 104, 112, 114, 119, 121,
+ 71, 77, 79, 91, 92, 95, 93, 91, 94, 95, 101, 102, 110, 112, 117, 122,
+ 74, 80, 83, 94, 95, 95, 93, 91, 93, 94, 100, 101, 109, 110, 115, 116,
+ 82, 85, 86, 95, 96, 99, 98, 97, 99, 100, 105, 106, 114, 115, 119, 118,
+ 84, 86, 87, 95, 97, 100, 99, 99, 101, 101, 107, 108, 115, 117, 121, 127,
+ 98, 93, 94, 96, 100, 106, 107, 107, 109, 109, 114, 114, 121, 122, 126,
+ 123, 98, 93, 94, 96, 100, 106, 107, 108, 109, 110, 114, 115, 122, 123,
+ 126, 132, 97, 92, 92, 94, 98, 106, 109, 112, 114, 115, 120, 121, 128,
+ 129, 133, 129, 97, 91, 92, 93, 98, 106, 110, 113, 116, 117, 122, 123,
+ 130, 131, 132, 139, 98, 91, 91, 92, 97, 107, 113, 117, 122, 123, 128,
+ 128, 135, 136, 141, 135, 99, 92, 92, 92, 98, 107, 114, 118, 124, 125,
+ 131, 132, 138, 139, 140, 147, 101, 93, 93, 93, 99, 108, 115, 119, 126,
+ 128, 134, 135, 142, 143, 148, 141, 103, 95, 95, 94, 99, 108, 116, 122,
+ 129, 132, 139, 140, 147, 148, 149, 155, 104, 96, 96, 95, 100, 109, 117,
+ 122, 131, 133, 142, 142, 150, 151, 156, 149, 108, 100, 99, 97, 102, 111,
+ 119, 125, 134, 137, 146, 147, 155, 157, 158, 165, 109, 100, 100, 98,
+ 103, 111, 119, 125, 134, 137, 147, 148, 156, 157, 162, 157, 114, 104,
+ 104, 101, 105, 113, 121, 128, 138, 141, 153, 154, 164, 165, 167, 172,
+ 115, 105, 105, 102, 106, 114, 122, 128, 139, 142, 154, 155, 165, 167,
+ 171, 164, 120, 109, 109, 105, 110, 117, 125, 131, 142, 145, 158, 159,
+ 170, 172, 176, 182, 122, 112, 111, 107, 112, 119, 127, 133, 144, 147,
+ 160, 162, 173, 175, 177, 172, 127, 115, 114, 110, 114, 121, 129, 135,
+ 146, 150, 164, 165, 178, 180, 186, 189, 128, 117, 116, 111, 116, 122,
+ 130, 136, 147, 151, 165, 167, 179, 181, 185, 180, 129, 118, 117, 112,
+ 116, 123, 131, 136, 148, 151, 166, 167, 180, 182, 189, 201, 132, 121,
+ 119, 114, 119, 125, 133, 138, 150, 153, 168, 170, 183, 185, 188, 189,
+ 135, 123, 122, 116, 120, 127, 133, 140, 149, 155, 167, 170, 185, 185,
+ 194, 196, 137, 125, 124, 118, 121, 128, 133, 141, 149, 156, 166, 172,
+ 183, 187, 194, 192, 139, 126, 127, 119, 120, 133, 130, 148, 142, 165,
+ 157, 183, 173, 200, 189, 202,
+ /* Size 32x16 */
+ 64, 63, 62, 61, 63, 67, 71, 74, 82, 84, 98, 98, 97, 97, 98, 99, 101,
+ 103, 104, 108, 109, 114, 115, 120, 122, 127, 128, 129, 132, 135, 137,
+ 139, 62, 63, 63, 64, 67, 72, 77, 80, 85, 86, 93, 93, 92, 91, 91, 92, 93,
+ 95, 96, 100, 100, 104, 105, 109, 112, 115, 117, 118, 121, 123, 125, 126,
+ 64, 66, 66, 67, 70, 74, 79, 83, 86, 87, 94, 94, 92, 92, 91, 92, 93, 95,
+ 96, 99, 100, 104, 105, 109, 111, 114, 116, 117, 119, 122, 124, 127, 74,
+ 77, 77, 80, 82, 86, 91, 94, 95, 95, 96, 96, 94, 93, 92, 92, 93, 94, 95,
+ 97, 98, 101, 102, 105, 107, 110, 111, 112, 114, 116, 118, 119, 81, 83,
+ 83, 84, 86, 89, 92, 95, 96, 97, 100, 100, 98, 98, 97, 98, 99, 99, 100,
+ 102, 103, 105, 106, 110, 112, 114, 116, 116, 119, 120, 121, 120, 96, 94,
+ 94, 92, 93, 94, 95, 95, 99, 100, 106, 106, 106, 106, 107, 107, 108, 108,
+ 109, 111, 111, 113, 114, 117, 119, 121, 122, 123, 125, 127, 128, 133,
+ 98, 94, 94, 91, 92, 93, 93, 93, 98, 99, 107, 107, 109, 110, 113, 114,
+ 115, 116, 117, 119, 119, 121, 122, 125, 127, 129, 130, 131, 133, 133,
+ 133, 130, 98, 94, 94, 91, 91, 92, 91, 91, 97, 99, 107, 108, 112, 113,
+ 117, 118, 119, 122, 122, 125, 125, 128, 128, 131, 133, 135, 136, 136,
+ 138, 140, 141, 148, 103, 99, 98, 95, 95, 95, 94, 93, 99, 101, 109, 109,
+ 114, 116, 122, 124, 126, 129, 131, 134, 134, 138, 139, 142, 144, 146,
+ 147, 148, 150, 149, 149, 142, 105, 100, 99, 96, 96, 95, 95, 94, 100,
+ 101, 109, 110, 115, 117, 123, 125, 128, 132, 133, 137, 137, 141, 142,
+ 145, 147, 150, 151, 151, 153, 155, 156, 165, 115, 109, 108, 104, 103,
+ 103, 101, 100, 105, 107, 114, 114, 120, 122, 128, 131, 134, 139, 142,
+ 146, 147, 153, 154, 158, 160, 164, 165, 166, 168, 167, 166, 157, 116,
+ 110, 109, 105, 104, 104, 102, 101, 106, 108, 114, 115, 121, 123, 128,
+ 132, 135, 140, 142, 147, 148, 154, 155, 159, 162, 165, 167, 167, 170,
+ 170, 172, 183, 127, 120, 119, 115, 114, 112, 110, 109, 114, 115, 121,
+ 122, 128, 130, 135, 138, 142, 147, 150, 155, 156, 164, 165, 170, 173,
+ 178, 179, 180, 183, 185, 183, 173, 129, 122, 121, 116, 115, 114, 112,
+ 110, 115, 117, 122, 123, 129, 131, 136, 139, 143, 148, 151, 157, 157,
+ 165, 167, 172, 175, 180, 181, 182, 185, 185, 187, 200, 135, 128, 127,
+ 122, 121, 119, 117, 115, 119, 121, 126, 126, 133, 132, 141, 140, 148,
+ 149, 156, 158, 162, 167, 171, 176, 177, 186, 185, 189, 188, 194, 194,
+ 189, 139, 131, 131, 124, 125, 121, 122, 116, 118, 127, 123, 132, 129,
+ 139, 135, 147, 141, 155, 149, 165, 157, 172, 164, 182, 172, 189, 180,
+ 201, 189, 196, 192, 202,
+ /* Size 4x16 */
+ 62, 96, 105, 129, 63, 94, 99, 121, 67, 93, 96, 115, 77, 95, 95, 112, 85,
+ 99, 100, 115, 93, 106, 109, 122, 92, 106, 115, 129, 91, 107, 123, 136,
+ 93, 108, 128, 143, 96, 109, 133, 151, 100, 111, 137, 157, 105, 114, 142,
+ 167, 112, 119, 147, 175, 117, 122, 151, 181, 121, 125, 153, 185, 125,
+ 128, 156, 187,
+ /* Size 16x4 */
+ 62, 63, 67, 77, 85, 93, 92, 91, 93, 96, 100, 105, 112, 117, 121, 125,
+ 96, 94, 93, 95, 99, 106, 106, 107, 108, 109, 111, 114, 119, 122, 125,
+ 128, 105, 99, 96, 95, 100, 109, 115, 123, 128, 133, 137, 142, 147, 151,
+ 153, 156, 129, 121, 115, 112, 115, 122, 129, 136, 143, 151, 157, 167,
+ 175, 181, 185, 187,
+ /* Size 8x32 */
+ 64, 64, 81, 98, 103, 115, 127, 135, 63, 66, 83, 94, 99, 109, 120, 128,
+ 62, 66, 83, 94, 98, 108, 119, 127, 61, 67, 84, 91, 95, 104, 115, 122,
+ 63, 70, 86, 92, 95, 103, 114, 121, 67, 74, 89, 93, 95, 103, 112, 119,
+ 71, 79, 92, 93, 94, 101, 110, 117, 74, 83, 95, 93, 93, 100, 109, 115,
+ 82, 86, 96, 98, 99, 105, 114, 119, 84, 87, 97, 99, 101, 107, 115, 121,
+ 98, 94, 100, 107, 109, 114, 121, 126, 98, 94, 100, 107, 109, 114, 122,
+ 126, 97, 92, 98, 109, 114, 120, 128, 133, 97, 92, 98, 110, 116, 122,
+ 130, 132, 98, 91, 97, 113, 122, 128, 135, 141, 99, 92, 98, 114, 124,
+ 131, 138, 140, 101, 93, 99, 115, 126, 134, 142, 148, 103, 95, 99, 116,
+ 129, 139, 147, 149, 104, 96, 100, 117, 131, 142, 150, 156, 108, 99, 102,
+ 119, 134, 146, 155, 158, 109, 100, 103, 119, 134, 147, 156, 162, 114,
+ 104, 105, 121, 138, 153, 164, 167, 115, 105, 106, 122, 139, 154, 165,
+ 171, 120, 109, 110, 125, 142, 158, 170, 176, 122, 111, 112, 127, 144,
+ 160, 173, 177, 127, 114, 114, 129, 146, 164, 178, 186, 128, 116, 116,
+ 130, 147, 165, 179, 185, 129, 117, 116, 131, 148, 166, 180, 189, 132,
+ 119, 119, 133, 150, 168, 183, 188, 135, 122, 120, 133, 149, 167, 185,
+ 194, 137, 124, 121, 133, 149, 166, 183, 194, 139, 127, 120, 130, 142,
+ 157, 173, 189,
+ /* Size 32x8 */
+ 64, 63, 62, 61, 63, 67, 71, 74, 82, 84, 98, 98, 97, 97, 98, 99, 101,
+ 103, 104, 108, 109, 114, 115, 120, 122, 127, 128, 129, 132, 135, 137,
+ 139, 64, 66, 66, 67, 70, 74, 79, 83, 86, 87, 94, 94, 92, 92, 91, 92, 93,
+ 95, 96, 99, 100, 104, 105, 109, 111, 114, 116, 117, 119, 122, 124, 127,
+ 81, 83, 83, 84, 86, 89, 92, 95, 96, 97, 100, 100, 98, 98, 97, 98, 99,
+ 99, 100, 102, 103, 105, 106, 110, 112, 114, 116, 116, 119, 120, 121,
+ 120, 98, 94, 94, 91, 92, 93, 93, 93, 98, 99, 107, 107, 109, 110, 113,
+ 114, 115, 116, 117, 119, 119, 121, 122, 125, 127, 129, 130, 131, 133,
+ 133, 133, 130, 103, 99, 98, 95, 95, 95, 94, 93, 99, 101, 109, 109, 114,
+ 116, 122, 124, 126, 129, 131, 134, 134, 138, 139, 142, 144, 146, 147,
+ 148, 150, 149, 149, 142, 115, 109, 108, 104, 103, 103, 101, 100, 105,
+ 107, 114, 114, 120, 122, 128, 131, 134, 139, 142, 146, 147, 153, 154,
+ 158, 160, 164, 165, 166, 168, 167, 166, 157, 127, 120, 119, 115, 114,
+ 112, 110, 109, 114, 115, 121, 122, 128, 130, 135, 138, 142, 147, 150,
+ 155, 156, 164, 165, 170, 173, 178, 179, 180, 183, 185, 183, 173, 135,
+ 128, 127, 122, 121, 119, 117, 115, 119, 121, 126, 126, 133, 132, 141,
+ 140, 148, 149, 156, 158, 162, 167, 171, 176, 177, 186, 185, 189, 188,
+ 194, 194, 189 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 71, 116, 116, 210,
+#endif
+ /* Size 4x4 */
+ 65, 69, 99, 145, 69, 97, 120, 158, 99, 120, 165, 208, 145, 158, 208,
+ 268,
+ /* Size 8x8 */
+ 64, 64, 68, 77, 93, 113, 136, 157, 64, 67, 71, 78, 91, 108, 129, 148,
+ 68, 71, 79, 90, 102, 117, 136, 153, 77, 78, 90, 108, 122, 138, 156, 173,
+ 93, 91, 102, 122, 142, 161, 181, 198, 113, 108, 117, 138, 161, 184, 207,
+ 226, 136, 129, 136, 156, 181, 207, 235, 256, 157, 148, 153, 173, 198,
+ 226, 256, 280,
+ /* Size 16x16 */
+ 64, 63, 63, 63, 64, 68, 72, 79, 88, 97, 108, 118, 131, 143, 160, 166,
+ 63, 64, 64, 64, 65, 68, 70, 77, 85, 93, 103, 113, 125, 136, 152, 157,
+ 63, 64, 65, 65, 65, 67, 69, 75, 82, 89, 99, 108, 119, 130, 145, 150, 63,
+ 64, 65, 67, 68, 71, 73, 78, 84, 91, 100, 108, 118, 129, 143, 148, 64,
+ 65, 65, 68, 71, 74, 77, 81, 85, 92, 99, 107, 116, 126, 139, 144, 68, 68,
+ 67, 71, 74, 79, 85, 90, 95, 102, 109, 117, 126, 136, 148, 153, 72, 70,
+ 69, 73, 77, 85, 97, 101, 108, 114, 120, 128, 136, 146, 158, 162, 79, 77,
+ 75, 78, 81, 90, 101, 108, 116, 122, 130, 138, 147, 156, 168, 173, 88,
+ 85, 82, 84, 85, 95, 108, 116, 127, 134, 143, 151, 159, 169, 181, 185,
+ 97, 93, 89, 91, 92, 102, 114, 122, 134, 142, 153, 161, 171, 181, 193,
+ 198, 108, 103, 99, 100, 99, 109, 120, 130, 143, 153, 165, 174, 185, 195,
+ 208, 213, 118, 113, 108, 108, 107, 117, 128, 138, 151, 161, 174, 184,
+ 196, 207, 221, 226, 131, 125, 119, 118, 116, 126, 136, 147, 159, 171,
+ 185, 196, 210, 222, 237, 242, 143, 136, 130, 129, 126, 136, 146, 156,
+ 169, 181, 195, 207, 222, 235, 251, 256, 160, 152, 145, 143, 139, 148,
+ 158, 168, 181, 193, 208, 221, 237, 251, 268, 274, 166, 157, 150, 148,
+ 144, 153, 162, 173, 185, 198, 213, 226, 242, 256, 274, 280,
+ /* Size 32x32 */
+ 64, 63, 63, 63, 63, 63, 63, 64, 64, 68, 68, 72, 72, 79, 79, 88, 88, 97,
+ 97, 108, 108, 118, 118, 131, 131, 143, 143, 160, 160, 166, 166, 175, 63,
+ 64, 64, 64, 64, 64, 64, 65, 65, 68, 68, 70, 70, 77, 77, 85, 85, 93, 93,
+ 103, 103, 113, 113, 125, 125, 136, 136, 152, 152, 157, 157, 166, 63, 64,
+ 64, 64, 64, 64, 64, 65, 65, 68, 68, 70, 70, 77, 77, 85, 85, 93, 93, 103,
+ 103, 113, 113, 125, 125, 136, 136, 152, 152, 157, 157, 166, 63, 64, 64,
+ 65, 65, 65, 65, 65, 65, 67, 67, 69, 69, 75, 75, 82, 82, 89, 89, 99, 99,
+ 108, 108, 119, 119, 130, 130, 145, 145, 150, 150, 158, 63, 64, 64, 65,
+ 65, 65, 65, 65, 65, 67, 67, 69, 69, 75, 75, 82, 82, 89, 89, 99, 99, 108,
+ 108, 119, 119, 130, 130, 145, 145, 150, 150, 158, 63, 64, 64, 65, 65,
+ 67, 67, 68, 68, 71, 71, 73, 73, 78, 78, 84, 84, 91, 91, 100, 100, 108,
+ 108, 118, 118, 129, 129, 143, 143, 148, 148, 155, 63, 64, 64, 65, 65,
+ 67, 67, 68, 68, 71, 71, 73, 73, 78, 78, 84, 84, 91, 91, 100, 100, 108,
+ 108, 118, 118, 129, 129, 143, 143, 148, 148, 155, 64, 65, 65, 65, 65,
+ 68, 68, 71, 71, 74, 74, 77, 77, 81, 81, 85, 85, 92, 92, 99, 99, 107,
+ 107, 116, 116, 126, 126, 139, 139, 144, 144, 151, 64, 65, 65, 65, 65,
+ 68, 68, 71, 71, 74, 74, 77, 77, 81, 81, 85, 85, 92, 92, 99, 99, 107,
+ 107, 116, 116, 126, 126, 139, 139, 144, 144, 151, 68, 68, 68, 67, 67,
+ 71, 71, 74, 74, 79, 79, 85, 85, 90, 90, 95, 95, 102, 102, 109, 109, 117,
+ 117, 126, 126, 136, 136, 148, 148, 153, 153, 160, 68, 68, 68, 67, 67,
+ 71, 71, 74, 74, 79, 79, 85, 85, 90, 90, 95, 95, 102, 102, 109, 109, 117,
+ 117, 126, 126, 136, 136, 148, 148, 153, 153, 160, 72, 70, 70, 69, 69,
+ 73, 73, 77, 77, 85, 85, 97, 97, 101, 101, 108, 108, 114, 114, 120, 120,
+ 128, 128, 136, 136, 146, 146, 158, 158, 162, 162, 169, 72, 70, 70, 69,
+ 69, 73, 73, 77, 77, 85, 85, 97, 97, 101, 101, 108, 108, 114, 114, 120,
+ 120, 128, 128, 136, 136, 146, 146, 158, 158, 162, 162, 169, 79, 77, 77,
+ 75, 75, 78, 78, 81, 81, 90, 90, 101, 101, 108, 108, 116, 116, 122, 122,
+ 130, 130, 138, 138, 147, 147, 156, 156, 168, 168, 173, 173, 180, 79, 77,
+ 77, 75, 75, 78, 78, 81, 81, 90, 90, 101, 101, 108, 108, 116, 116, 122,
+ 122, 130, 130, 138, 138, 147, 147, 156, 156, 168, 168, 173, 173, 180,
+ 88, 85, 85, 82, 82, 84, 84, 85, 85, 95, 95, 108, 108, 116, 116, 127,
+ 127, 134, 134, 143, 143, 151, 151, 159, 159, 169, 169, 181, 181, 185,
+ 185, 192, 88, 85, 85, 82, 82, 84, 84, 85, 85, 95, 95, 108, 108, 116,
+ 116, 127, 127, 134, 134, 143, 143, 151, 151, 159, 159, 169, 169, 181,
+ 181, 185, 185, 192, 97, 93, 93, 89, 89, 91, 91, 92, 92, 102, 102, 114,
+ 114, 122, 122, 134, 134, 142, 142, 153, 153, 161, 161, 171, 171, 181,
+ 181, 193, 193, 198, 198, 204, 97, 93, 93, 89, 89, 91, 91, 92, 92, 102,
+ 102, 114, 114, 122, 122, 134, 134, 142, 142, 153, 153, 161, 161, 171,
+ 171, 181, 181, 193, 193, 198, 198, 204, 108, 103, 103, 99, 99, 100, 100,
+ 99, 99, 109, 109, 120, 120, 130, 130, 143, 143, 153, 153, 165, 165, 174,
+ 174, 185, 185, 195, 195, 208, 208, 213, 213, 219, 108, 103, 103, 99, 99,
+ 100, 100, 99, 99, 109, 109, 120, 120, 130, 130, 143, 143, 153, 153, 165,
+ 165, 174, 174, 185, 185, 195, 195, 208, 208, 213, 213, 219, 118, 113,
+ 113, 108, 108, 108, 108, 107, 107, 117, 117, 128, 128, 138, 138, 151,
+ 151, 161, 161, 174, 174, 184, 184, 196, 196, 207, 207, 221, 221, 226,
+ 226, 233, 118, 113, 113, 108, 108, 108, 108, 107, 107, 117, 117, 128,
+ 128, 138, 138, 151, 151, 161, 161, 174, 174, 184, 184, 196, 196, 207,
+ 207, 221, 221, 226, 226, 233, 131, 125, 125, 119, 119, 118, 118, 116,
+ 116, 126, 126, 136, 136, 147, 147, 159, 159, 171, 171, 185, 185, 196,
+ 196, 210, 210, 222, 222, 237, 237, 242, 242, 249, 131, 125, 125, 119,
+ 119, 118, 118, 116, 116, 126, 126, 136, 136, 147, 147, 159, 159, 171,
+ 171, 185, 185, 196, 196, 210, 210, 222, 222, 237, 237, 242, 242, 249,
+ 143, 136, 136, 130, 130, 129, 129, 126, 126, 136, 136, 146, 146, 156,
+ 156, 169, 169, 181, 181, 195, 195, 207, 207, 222, 222, 235, 235, 251,
+ 251, 256, 256, 264, 143, 136, 136, 130, 130, 129, 129, 126, 126, 136,
+ 136, 146, 146, 156, 156, 169, 169, 181, 181, 195, 195, 207, 207, 222,
+ 222, 235, 235, 251, 251, 256, 256, 264, 160, 152, 152, 145, 145, 143,
+ 143, 139, 139, 148, 148, 158, 158, 168, 168, 181, 181, 193, 193, 208,
+ 208, 221, 221, 237, 237, 251, 251, 268, 268, 274, 274, 283, 160, 152,
+ 152, 145, 145, 143, 143, 139, 139, 148, 148, 158, 158, 168, 168, 181,
+ 181, 193, 193, 208, 208, 221, 221, 237, 237, 251, 251, 268, 268, 274,
+ 274, 283, 166, 157, 157, 150, 150, 148, 148, 144, 144, 153, 153, 162,
+ 162, 173, 173, 185, 185, 198, 198, 213, 213, 226, 226, 242, 242, 256,
+ 256, 274, 274, 280, 280, 289, 166, 157, 157, 150, 150, 148, 148, 144,
+ 144, 153, 153, 162, 162, 173, 173, 185, 185, 198, 198, 213, 213, 226,
+ 226, 242, 242, 256, 256, 274, 274, 280, 280, 289, 175, 166, 166, 158,
+ 158, 155, 155, 151, 151, 160, 160, 169, 169, 180, 180, 192, 192, 204,
+ 204, 219, 219, 233, 233, 249, 249, 264, 264, 283, 283, 289, 289, 299,
+ /* Size 4x8 */
+ 64, 71, 103, 151, 65, 73, 100, 142, 68, 85, 109, 147, 75, 101, 130, 168,
+ 90, 113, 152, 192, 108, 127, 174, 220, 131, 146, 195, 250, 151, 162,
+ 212, 273,
+ /* Size 8x4 */
+ 64, 65, 68, 75, 90, 108, 131, 151, 71, 73, 85, 101, 113, 127, 146, 162,
+ 103, 100, 109, 130, 152, 174, 195, 212, 151, 142, 147, 168, 192, 220,
+ 250, 273,
+ /* Size 8x16 */
+ 64, 63, 64, 72, 88, 107, 131, 158, 63, 64, 65, 71, 85, 103, 124, 151,
+ 63, 65, 66, 69, 82, 99, 119, 144, 64, 65, 68, 73, 84, 100, 118, 142, 64,
+ 66, 71, 77, 85, 99, 116, 138, 68, 68, 74, 85, 96, 109, 126, 147, 72, 69,
+ 77, 96, 108, 120, 136, 157, 79, 75, 81, 101, 116, 130, 147, 168, 88, 82,
+ 86, 107, 126, 143, 159, 180, 96, 90, 93, 113, 134, 152, 171, 192, 107,
+ 99, 100, 120, 142, 164, 185, 207, 117, 108, 108, 127, 150, 174, 196,
+ 220, 130, 120, 117, 136, 159, 185, 210, 236, 142, 131, 127, 146, 169,
+ 195, 222, 250, 159, 145, 140, 158, 181, 208, 236, 267, 165, 151, 145,
+ 162, 185, 212, 242, 273,
+ /* Size 16x8 */
+ 64, 63, 63, 64, 64, 68, 72, 79, 88, 96, 107, 117, 130, 142, 159, 165,
+ 63, 64, 65, 65, 66, 68, 69, 75, 82, 90, 99, 108, 120, 131, 145, 151, 64,
+ 65, 66, 68, 71, 74, 77, 81, 86, 93, 100, 108, 117, 127, 140, 145, 72,
+ 71, 69, 73, 77, 85, 96, 101, 107, 113, 120, 127, 136, 146, 158, 162, 88,
+ 85, 82, 84, 85, 96, 108, 116, 126, 134, 142, 150, 159, 169, 181, 185,
+ 107, 103, 99, 100, 99, 109, 120, 130, 143, 152, 164, 174, 185, 195, 208,
+ 212, 131, 124, 119, 118, 116, 126, 136, 147, 159, 171, 185, 196, 210,
+ 222, 236, 242, 158, 151, 144, 142, 138, 147, 157, 168, 180, 192, 207,
+ 220, 236, 250, 267, 273,
+ /* Size 16x32 */
+ 64, 63, 63, 64, 64, 72, 72, 88, 88, 107, 107, 131, 131, 158, 158, 174,
+ 63, 64, 64, 65, 65, 71, 71, 85, 85, 103, 103, 124, 124, 151, 151, 165,
+ 63, 64, 64, 65, 65, 71, 71, 85, 85, 103, 103, 124, 124, 151, 151, 165,
+ 63, 65, 65, 66, 66, 69, 69, 82, 82, 99, 99, 119, 119, 144, 144, 157, 63,
+ 65, 65, 66, 66, 69, 69, 82, 82, 99, 99, 119, 119, 144, 144, 157, 64, 65,
+ 65, 68, 68, 73, 73, 84, 84, 100, 100, 118, 118, 142, 142, 154, 64, 65,
+ 65, 68, 68, 73, 73, 84, 84, 100, 100, 118, 118, 142, 142, 154, 64, 66,
+ 66, 71, 71, 77, 77, 85, 85, 99, 99, 116, 116, 138, 138, 150, 64, 66, 66,
+ 71, 71, 77, 77, 85, 85, 99, 99, 116, 116, 138, 138, 150, 68, 68, 68, 74,
+ 74, 85, 85, 96, 96, 109, 109, 126, 126, 147, 147, 159, 68, 68, 68, 74,
+ 74, 85, 85, 96, 96, 109, 109, 126, 126, 147, 147, 159, 72, 69, 69, 77,
+ 77, 96, 96, 108, 108, 120, 120, 136, 136, 157, 157, 168, 72, 69, 69, 77,
+ 77, 96, 96, 108, 108, 120, 120, 136, 136, 157, 157, 168, 79, 75, 75, 81,
+ 81, 101, 101, 116, 116, 130, 130, 147, 147, 168, 168, 179, 79, 75, 75,
+ 81, 81, 101, 101, 116, 116, 130, 130, 147, 147, 168, 168, 179, 88, 82,
+ 82, 86, 86, 107, 107, 126, 126, 143, 143, 159, 159, 180, 180, 191, 88,
+ 82, 82, 86, 86, 107, 107, 126, 126, 143, 143, 159, 159, 180, 180, 191,
+ 96, 90, 90, 93, 93, 113, 113, 134, 134, 152, 152, 171, 171, 192, 192,
+ 204, 96, 90, 90, 93, 93, 113, 113, 134, 134, 152, 152, 171, 171, 192,
+ 192, 204, 107, 99, 99, 100, 100, 120, 120, 142, 142, 164, 164, 185, 185,
+ 207, 207, 219, 107, 99, 99, 100, 100, 120, 120, 142, 142, 164, 164, 185,
+ 185, 207, 207, 219, 117, 108, 108, 108, 108, 127, 127, 150, 150, 174,
+ 174, 196, 196, 220, 220, 232, 117, 108, 108, 108, 108, 127, 127, 150,
+ 150, 174, 174, 196, 196, 220, 220, 232, 130, 120, 120, 117, 117, 136,
+ 136, 159, 159, 185, 185, 210, 210, 236, 236, 249, 130, 120, 120, 117,
+ 117, 136, 136, 159, 159, 185, 185, 210, 210, 236, 236, 249, 142, 131,
+ 131, 127, 127, 146, 146, 169, 169, 195, 195, 222, 222, 250, 250, 264,
+ 142, 131, 131, 127, 127, 146, 146, 169, 169, 195, 195, 222, 222, 250,
+ 250, 264, 159, 145, 145, 140, 140, 158, 158, 181, 181, 208, 208, 236,
+ 236, 267, 267, 282, 159, 145, 145, 140, 140, 158, 158, 181, 181, 208,
+ 208, 236, 236, 267, 267, 282, 165, 151, 151, 145, 145, 162, 162, 185,
+ 185, 212, 212, 242, 242, 273, 273, 289, 165, 151, 151, 145, 145, 162,
+ 162, 185, 185, 212, 212, 242, 242, 273, 273, 289, 174, 159, 159, 152,
+ 152, 169, 169, 192, 192, 219, 219, 249, 249, 282, 282, 298,
+ /* Size 32x16 */
+ 64, 63, 63, 63, 63, 64, 64, 64, 64, 68, 68, 72, 72, 79, 79, 88, 88, 96,
+ 96, 107, 107, 117, 117, 130, 130, 142, 142, 159, 159, 165, 165, 174, 63,
+ 64, 64, 65, 65, 65, 65, 66, 66, 68, 68, 69, 69, 75, 75, 82, 82, 90, 90,
+ 99, 99, 108, 108, 120, 120, 131, 131, 145, 145, 151, 151, 159, 63, 64,
+ 64, 65, 65, 65, 65, 66, 66, 68, 68, 69, 69, 75, 75, 82, 82, 90, 90, 99,
+ 99, 108, 108, 120, 120, 131, 131, 145, 145, 151, 151, 159, 64, 65, 65,
+ 66, 66, 68, 68, 71, 71, 74, 74, 77, 77, 81, 81, 86, 86, 93, 93, 100,
+ 100, 108, 108, 117, 117, 127, 127, 140, 140, 145, 145, 152, 64, 65, 65,
+ 66, 66, 68, 68, 71, 71, 74, 74, 77, 77, 81, 81, 86, 86, 93, 93, 100,
+ 100, 108, 108, 117, 117, 127, 127, 140, 140, 145, 145, 152, 72, 71, 71,
+ 69, 69, 73, 73, 77, 77, 85, 85, 96, 96, 101, 101, 107, 107, 113, 113,
+ 120, 120, 127, 127, 136, 136, 146, 146, 158, 158, 162, 162, 169, 72, 71,
+ 71, 69, 69, 73, 73, 77, 77, 85, 85, 96, 96, 101, 101, 107, 107, 113,
+ 113, 120, 120, 127, 127, 136, 136, 146, 146, 158, 158, 162, 162, 169,
+ 88, 85, 85, 82, 82, 84, 84, 85, 85, 96, 96, 108, 108, 116, 116, 126,
+ 126, 134, 134, 142, 142, 150, 150, 159, 159, 169, 169, 181, 181, 185,
+ 185, 192, 88, 85, 85, 82, 82, 84, 84, 85, 85, 96, 96, 108, 108, 116,
+ 116, 126, 126, 134, 134, 142, 142, 150, 150, 159, 159, 169, 169, 181,
+ 181, 185, 185, 192, 107, 103, 103, 99, 99, 100, 100, 99, 99, 109, 109,
+ 120, 120, 130, 130, 143, 143, 152, 152, 164, 164, 174, 174, 185, 185,
+ 195, 195, 208, 208, 212, 212, 219, 107, 103, 103, 99, 99, 100, 100, 99,
+ 99, 109, 109, 120, 120, 130, 130, 143, 143, 152, 152, 164, 164, 174,
+ 174, 185, 185, 195, 195, 208, 208, 212, 212, 219, 131, 124, 124, 119,
+ 119, 118, 118, 116, 116, 126, 126, 136, 136, 147, 147, 159, 159, 171,
+ 171, 185, 185, 196, 196, 210, 210, 222, 222, 236, 236, 242, 242, 249,
+ 131, 124, 124, 119, 119, 118, 118, 116, 116, 126, 126, 136, 136, 147,
+ 147, 159, 159, 171, 171, 185, 185, 196, 196, 210, 210, 222, 222, 236,
+ 236, 242, 242, 249, 158, 151, 151, 144, 144, 142, 142, 138, 138, 147,
+ 147, 157, 157, 168, 168, 180, 180, 192, 192, 207, 207, 220, 220, 236,
+ 236, 250, 250, 267, 267, 273, 273, 282, 158, 151, 151, 144, 144, 142,
+ 142, 138, 138, 147, 147, 157, 157, 168, 168, 180, 180, 192, 192, 207,
+ 207, 220, 220, 236, 236, 250, 250, 267, 267, 273, 273, 282, 174, 165,
+ 165, 157, 157, 154, 154, 150, 150, 159, 159, 168, 168, 179, 179, 191,
+ 191, 204, 204, 219, 219, 232, 232, 249, 249, 264, 264, 282, 282, 289,
+ 289, 298,
+ /* Size 4x16 */
+ 63, 72, 107, 158, 64, 71, 103, 151, 65, 69, 99, 144, 65, 73, 100, 142,
+ 66, 77, 99, 138, 68, 85, 109, 147, 69, 96, 120, 157, 75, 101, 130, 168,
+ 82, 107, 143, 180, 90, 113, 152, 192, 99, 120, 164, 207, 108, 127, 174,
+ 220, 120, 136, 185, 236, 131, 146, 195, 250, 145, 158, 208, 267, 151,
+ 162, 212, 273,
+ /* Size 16x4 */
+ 63, 64, 65, 65, 66, 68, 69, 75, 82, 90, 99, 108, 120, 131, 145, 151, 72,
+ 71, 69, 73, 77, 85, 96, 101, 107, 113, 120, 127, 136, 146, 158, 162,
+ 107, 103, 99, 100, 99, 109, 120, 130, 143, 152, 164, 174, 185, 195, 208,
+ 212, 158, 151, 144, 142, 138, 147, 157, 168, 180, 192, 207, 220, 236,
+ 250, 267, 273,
+ /* Size 8x32 */
+ 64, 63, 64, 72, 88, 107, 131, 158, 63, 64, 65, 71, 85, 103, 124, 151,
+ 63, 64, 65, 71, 85, 103, 124, 151, 63, 65, 66, 69, 82, 99, 119, 144, 63,
+ 65, 66, 69, 82, 99, 119, 144, 64, 65, 68, 73, 84, 100, 118, 142, 64, 65,
+ 68, 73, 84, 100, 118, 142, 64, 66, 71, 77, 85, 99, 116, 138, 64, 66, 71,
+ 77, 85, 99, 116, 138, 68, 68, 74, 85, 96, 109, 126, 147, 68, 68, 74, 85,
+ 96, 109, 126, 147, 72, 69, 77, 96, 108, 120, 136, 157, 72, 69, 77, 96,
+ 108, 120, 136, 157, 79, 75, 81, 101, 116, 130, 147, 168, 79, 75, 81,
+ 101, 116, 130, 147, 168, 88, 82, 86, 107, 126, 143, 159, 180, 88, 82,
+ 86, 107, 126, 143, 159, 180, 96, 90, 93, 113, 134, 152, 171, 192, 96,
+ 90, 93, 113, 134, 152, 171, 192, 107, 99, 100, 120, 142, 164, 185, 207,
+ 107, 99, 100, 120, 142, 164, 185, 207, 117, 108, 108, 127, 150, 174,
+ 196, 220, 117, 108, 108, 127, 150, 174, 196, 220, 130, 120, 117, 136,
+ 159, 185, 210, 236, 130, 120, 117, 136, 159, 185, 210, 236, 142, 131,
+ 127, 146, 169, 195, 222, 250, 142, 131, 127, 146, 169, 195, 222, 250,
+ 159, 145, 140, 158, 181, 208, 236, 267, 159, 145, 140, 158, 181, 208,
+ 236, 267, 165, 151, 145, 162, 185, 212, 242, 273, 165, 151, 145, 162,
+ 185, 212, 242, 273, 174, 159, 152, 169, 192, 219, 249, 282,
+ /* Size 32x8 */
+ 64, 63, 63, 63, 63, 64, 64, 64, 64, 68, 68, 72, 72, 79, 79, 88, 88, 96,
+ 96, 107, 107, 117, 117, 130, 130, 142, 142, 159, 159, 165, 165, 174, 63,
+ 64, 64, 65, 65, 65, 65, 66, 66, 68, 68, 69, 69, 75, 75, 82, 82, 90, 90,
+ 99, 99, 108, 108, 120, 120, 131, 131, 145, 145, 151, 151, 159, 64, 65,
+ 65, 66, 66, 68, 68, 71, 71, 74, 74, 77, 77, 81, 81, 86, 86, 93, 93, 100,
+ 100, 108, 108, 117, 117, 127, 127, 140, 140, 145, 145, 152, 72, 71, 71,
+ 69, 69, 73, 73, 77, 77, 85, 85, 96, 96, 101, 101, 107, 107, 113, 113,
+ 120, 120, 127, 127, 136, 136, 146, 146, 158, 158, 162, 162, 169, 88, 85,
+ 85, 82, 82, 84, 84, 85, 85, 96, 96, 108, 108, 116, 116, 126, 126, 134,
+ 134, 142, 142, 150, 150, 159, 159, 169, 169, 181, 181, 185, 185, 192,
+ 107, 103, 103, 99, 99, 100, 100, 99, 99, 109, 109, 120, 120, 130, 130,
+ 143, 143, 152, 152, 164, 164, 174, 174, 185, 185, 195, 195, 208, 208,
+ 212, 212, 219, 131, 124, 124, 119, 119, 118, 118, 116, 116, 126, 126,
+ 136, 136, 147, 147, 159, 159, 171, 171, 185, 185, 196, 196, 210, 210,
+ 222, 222, 236, 236, 242, 242, 249, 158, 151, 151, 144, 144, 142, 142,
+ 138, 138, 147, 147, 157, 157, 168, 168, 180, 180, 192, 192, 207, 207,
+ 220, 220, 236, 236, 250, 250, 267, 267, 273, 273, 282 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 95, 100, 100, 153,
+#endif
+ /* Size 4x4 */
+ 64, 93, 95, 115, 93, 106, 109, 121, 95, 109, 133, 150, 115, 121, 150,
+ 178,
+ /* Size 8x8 */
+ 63, 69, 85, 94, 97, 104, 114, 123, 69, 78, 90, 93, 93, 99, 107, 115, 85,
+ 90, 97, 99, 100, 104, 111, 117, 94, 93, 99, 109, 113, 117, 123, 129, 97,
+ 93, 100, 113, 123, 130, 137, 143, 104, 99, 104, 117, 130, 142, 151, 158,
+ 114, 107, 111, 123, 137, 151, 164, 172, 123, 115, 117, 129, 143, 158,
+ 172, 183,
+ /* Size 16x16 */
+ 64, 62, 61, 67, 73, 83, 98, 97, 98, 101, 104, 109, 114, 120, 127, 130,
+ 62, 63, 62, 69, 77, 85, 95, 94, 94, 97, 100, 104, 109, 114, 121, 123,
+ 61, 62, 64, 71, 80, 85, 93, 91, 90, 93, 95, 99, 104, 109, 115, 117, 67,
+ 69, 71, 78, 87, 90, 95, 93, 91, 93, 95, 99, 102, 107, 113, 115, 73, 77,
+ 80, 87, 95, 95, 96, 93, 91, 92, 94, 97, 100, 104, 109, 111, 83, 85, 85,
+ 90, 95, 97, 101, 99, 98, 100, 101, 104, 107, 111, 115, 117, 98, 95, 93,
+ 95, 96, 101, 106, 106, 107, 108, 109, 111, 113, 117, 121, 123, 97, 94,
+ 91, 93, 93, 99, 106, 109, 111, 113, 115, 117, 120, 123, 127, 129, 98,
+ 94, 90, 91, 91, 98, 107, 111, 117, 120, 123, 125, 127, 131, 135, 136,
+ 101, 97, 93, 93, 92, 100, 108, 113, 120, 123, 127, 130, 134, 137, 142,
+ 143, 104, 100, 95, 95, 94, 101, 109, 115, 123, 127, 133, 137, 141, 145,
+ 150, 151, 109, 104, 99, 99, 97, 104, 111, 117, 125, 130, 137, 142, 147,
+ 151, 156, 158, 114, 109, 104, 102, 100, 107, 113, 120, 127, 134, 141,
+ 147, 153, 158, 164, 166, 120, 114, 109, 107, 104, 111, 117, 123, 131,
+ 137, 145, 151, 158, 164, 170, 172, 127, 121, 115, 113, 109, 115, 121,
+ 127, 135, 142, 150, 156, 164, 170, 178, 180, 130, 123, 117, 115, 111,
+ 117, 123, 129, 136, 143, 151, 158, 166, 172, 180, 183,
+ /* Size 32x32 */
+ 64, 62, 62, 61, 61, 67, 67, 73, 73, 83, 83, 98, 98, 97, 97, 98, 98, 101,
+ 101, 104, 104, 109, 109, 114, 114, 120, 120, 127, 127, 130, 130, 134,
+ 62, 63, 63, 62, 62, 69, 69, 77, 77, 85, 85, 95, 95, 94, 94, 94, 94, 97,
+ 97, 100, 100, 104, 104, 109, 109, 114, 114, 121, 121, 123, 123, 127, 62,
+ 63, 63, 62, 62, 69, 69, 77, 77, 85, 85, 95, 95, 94, 94, 94, 94, 97, 97,
+ 100, 100, 104, 104, 109, 109, 114, 114, 121, 121, 123, 123, 127, 61, 62,
+ 62, 64, 64, 71, 71, 80, 80, 85, 85, 93, 93, 91, 91, 90, 90, 93, 93, 95,
+ 95, 99, 99, 104, 104, 109, 109, 115, 115, 117, 117, 121, 61, 62, 62, 64,
+ 64, 71, 71, 80, 80, 85, 85, 93, 93, 91, 91, 90, 90, 93, 93, 95, 95, 99,
+ 99, 104, 104, 109, 109, 115, 115, 117, 117, 121, 67, 69, 69, 71, 71, 78,
+ 78, 87, 87, 90, 90, 95, 95, 93, 93, 91, 91, 93, 93, 95, 95, 99, 99, 102,
+ 102, 107, 107, 113, 113, 115, 115, 118, 67, 69, 69, 71, 71, 78, 78, 87,
+ 87, 90, 90, 95, 95, 93, 93, 91, 91, 93, 93, 95, 95, 99, 99, 102, 102,
+ 107, 107, 113, 113, 115, 115, 118, 73, 77, 77, 80, 80, 87, 87, 95, 95,
+ 95, 95, 96, 96, 93, 93, 91, 91, 92, 92, 94, 94, 97, 97, 100, 100, 104,
+ 104, 109, 109, 111, 111, 114, 73, 77, 77, 80, 80, 87, 87, 95, 95, 95,
+ 95, 96, 96, 93, 93, 91, 91, 92, 92, 94, 94, 97, 97, 100, 100, 104, 104,
+ 109, 109, 111, 111, 114, 83, 85, 85, 85, 85, 90, 90, 95, 95, 97, 97,
+ 101, 101, 99, 99, 98, 98, 100, 100, 101, 101, 104, 104, 107, 107, 111,
+ 111, 115, 115, 117, 117, 120, 83, 85, 85, 85, 85, 90, 90, 95, 95, 97,
+ 97, 101, 101, 99, 99, 98, 98, 100, 100, 101, 101, 104, 104, 107, 107,
+ 111, 111, 115, 115, 117, 117, 120, 98, 95, 95, 93, 93, 95, 95, 96, 96,
+ 101, 101, 106, 106, 106, 106, 107, 107, 108, 108, 109, 109, 111, 111,
+ 113, 113, 117, 117, 121, 121, 123, 123, 125, 98, 95, 95, 93, 93, 95, 95,
+ 96, 96, 101, 101, 106, 106, 106, 106, 107, 107, 108, 108, 109, 109, 111,
+ 111, 113, 113, 117, 117, 121, 121, 123, 123, 125, 97, 94, 94, 91, 91,
+ 93, 93, 93, 93, 99, 99, 106, 106, 109, 109, 111, 111, 113, 113, 115,
+ 115, 117, 117, 120, 120, 123, 123, 127, 127, 129, 129, 132, 97, 94, 94,
+ 91, 91, 93, 93, 93, 93, 99, 99, 106, 106, 109, 109, 111, 111, 113, 113,
+ 115, 115, 117, 117, 120, 120, 123, 123, 127, 127, 129, 129, 132, 98, 94,
+ 94, 90, 90, 91, 91, 91, 91, 98, 98, 107, 107, 111, 111, 117, 117, 120,
+ 120, 123, 123, 125, 125, 127, 127, 131, 131, 135, 135, 136, 136, 138,
+ 98, 94, 94, 90, 90, 91, 91, 91, 91, 98, 98, 107, 107, 111, 111, 117,
+ 117, 120, 120, 123, 123, 125, 125, 127, 127, 131, 131, 135, 135, 136,
+ 136, 138, 101, 97, 97, 93, 93, 93, 93, 92, 92, 100, 100, 108, 108, 113,
+ 113, 120, 120, 123, 123, 127, 127, 130, 130, 134, 134, 137, 137, 142,
+ 142, 143, 143, 145, 101, 97, 97, 93, 93, 93, 93, 92, 92, 100, 100, 108,
+ 108, 113, 113, 120, 120, 123, 123, 127, 127, 130, 130, 134, 134, 137,
+ 137, 142, 142, 143, 143, 145, 104, 100, 100, 95, 95, 95, 95, 94, 94,
+ 101, 101, 109, 109, 115, 115, 123, 123, 127, 127, 133, 133, 137, 137,
+ 141, 141, 145, 145, 150, 150, 151, 151, 153, 104, 100, 100, 95, 95, 95,
+ 95, 94, 94, 101, 101, 109, 109, 115, 115, 123, 123, 127, 127, 133, 133,
+ 137, 137, 141, 141, 145, 145, 150, 150, 151, 151, 153, 109, 104, 104,
+ 99, 99, 99, 99, 97, 97, 104, 104, 111, 111, 117, 117, 125, 125, 130,
+ 130, 137, 137, 142, 142, 147, 147, 151, 151, 156, 156, 158, 158, 161,
+ 109, 104, 104, 99, 99, 99, 99, 97, 97, 104, 104, 111, 111, 117, 117,
+ 125, 125, 130, 130, 137, 137, 142, 142, 147, 147, 151, 151, 156, 156,
+ 158, 158, 161, 114, 109, 109, 104, 104, 102, 102, 100, 100, 107, 107,
+ 113, 113, 120, 120, 127, 127, 134, 134, 141, 141, 147, 147, 153, 153,
+ 158, 158, 164, 164, 166, 166, 169, 114, 109, 109, 104, 104, 102, 102,
+ 100, 100, 107, 107, 113, 113, 120, 120, 127, 127, 134, 134, 141, 141,
+ 147, 147, 153, 153, 158, 158, 164, 164, 166, 166, 169, 120, 114, 114,
+ 109, 109, 107, 107, 104, 104, 111, 111, 117, 117, 123, 123, 131, 131,
+ 137, 137, 145, 145, 151, 151, 158, 158, 164, 164, 170, 170, 172, 172,
+ 176, 120, 114, 114, 109, 109, 107, 107, 104, 104, 111, 111, 117, 117,
+ 123, 123, 131, 131, 137, 137, 145, 145, 151, 151, 158, 158, 164, 164,
+ 170, 170, 172, 172, 176, 127, 121, 121, 115, 115, 113, 113, 109, 109,
+ 115, 115, 121, 121, 127, 127, 135, 135, 142, 142, 150, 150, 156, 156,
+ 164, 164, 170, 170, 178, 178, 180, 180, 184, 127, 121, 121, 115, 115,
+ 113, 113, 109, 109, 115, 115, 121, 121, 127, 127, 135, 135, 142, 142,
+ 150, 150, 156, 156, 164, 164, 170, 170, 178, 178, 180, 180, 184, 130,
+ 123, 123, 117, 117, 115, 115, 111, 111, 117, 117, 123, 123, 129, 129,
+ 136, 136, 143, 143, 151, 151, 158, 158, 166, 166, 172, 172, 180, 180,
+ 183, 183, 187, 130, 123, 123, 117, 117, 115, 115, 111, 111, 117, 117,
+ 123, 123, 129, 129, 136, 136, 143, 143, 151, 151, 158, 158, 166, 166,
+ 172, 172, 180, 180, 183, 183, 187, 134, 127, 127, 121, 121, 118, 118,
+ 114, 114, 120, 120, 125, 125, 132, 132, 138, 138, 145, 145, 153, 153,
+ 161, 161, 169, 169, 176, 176, 184, 184, 187, 187, 191,
+ /* Size 4x8 */
+ 63, 94, 100, 120, 72, 94, 95, 112, 86, 100, 101, 115, 92, 106, 115, 128,
+ 93, 108, 128, 142, 100, 111, 137, 156, 109, 117, 145, 170, 118, 123,
+ 151, 180,
+ /* Size 8x4 */
+ 63, 72, 86, 92, 93, 100, 109, 118, 94, 94, 100, 106, 108, 111, 117, 123,
+ 100, 95, 101, 115, 128, 137, 145, 151, 120, 112, 115, 128, 142, 156,
+ 170, 180,
+ /* Size 8x16 */
+ 64, 62, 74, 96, 98, 105, 115, 127, 63, 63, 77, 94, 94, 100, 109, 120,
+ 61, 64, 80, 92, 91, 96, 104, 115, 67, 72, 86, 94, 92, 95, 103, 112, 74,
+ 80, 94, 95, 91, 94, 100, 109, 84, 86, 95, 100, 99, 101, 107, 115, 98,
+ 93, 96, 106, 107, 109, 114, 121, 97, 92, 94, 106, 112, 115, 120, 128,
+ 98, 91, 92, 107, 117, 123, 128, 135, 101, 93, 93, 108, 119, 128, 134,
+ 142, 104, 96, 95, 109, 122, 133, 142, 150, 109, 100, 98, 111, 125, 137,
+ 147, 156, 114, 104, 101, 113, 128, 141, 153, 164, 120, 109, 105, 117,
+ 131, 145, 158, 170, 127, 115, 110, 121, 135, 150, 164, 178, 129, 118,
+ 112, 123, 136, 151, 166, 180,
+ /* Size 16x8 */
+ 64, 63, 61, 67, 74, 84, 98, 97, 98, 101, 104, 109, 114, 120, 127, 129,
+ 62, 63, 64, 72, 80, 86, 93, 92, 91, 93, 96, 100, 104, 109, 115, 118, 74,
+ 77, 80, 86, 94, 95, 96, 94, 92, 93, 95, 98, 101, 105, 110, 112, 96, 94,
+ 92, 94, 95, 100, 106, 106, 107, 108, 109, 111, 113, 117, 121, 123, 98,
+ 94, 91, 92, 91, 99, 107, 112, 117, 119, 122, 125, 128, 131, 135, 136,
+ 105, 100, 96, 95, 94, 101, 109, 115, 123, 128, 133, 137, 141, 145, 150,
+ 151, 115, 109, 104, 103, 100, 107, 114, 120, 128, 134, 142, 147, 153,
+ 158, 164, 166, 127, 120, 115, 112, 109, 115, 121, 128, 135, 142, 150,
+ 156, 164, 170, 178, 180,
+ /* Size 16x32 */
+ 64, 62, 62, 74, 74, 96, 96, 98, 98, 105, 105, 115, 115, 127, 127, 133,
+ 63, 63, 63, 77, 77, 94, 94, 94, 94, 100, 100, 109, 109, 120, 120, 126,
+ 63, 63, 63, 77, 77, 94, 94, 94, 94, 100, 100, 109, 109, 120, 120, 126,
+ 61, 64, 64, 80, 80, 92, 92, 91, 91, 96, 96, 104, 104, 115, 115, 121, 61,
+ 64, 64, 80, 80, 92, 92, 91, 91, 96, 96, 104, 104, 115, 115, 121, 67, 72,
+ 72, 86, 86, 94, 94, 92, 92, 95, 95, 103, 103, 112, 112, 118, 67, 72, 72,
+ 86, 86, 94, 94, 92, 92, 95, 95, 103, 103, 112, 112, 118, 74, 80, 80, 94,
+ 94, 95, 95, 91, 91, 94, 94, 100, 100, 109, 109, 114, 74, 80, 80, 94, 94,
+ 95, 95, 91, 91, 94, 94, 100, 100, 109, 109, 114, 84, 86, 86, 95, 95,
+ 100, 100, 99, 99, 101, 101, 107, 107, 115, 115, 120, 84, 86, 86, 95, 95,
+ 100, 100, 99, 99, 101, 101, 107, 107, 115, 115, 120, 98, 93, 93, 96, 96,
+ 106, 106, 107, 107, 109, 109, 114, 114, 121, 121, 125, 98, 93, 93, 96,
+ 96, 106, 106, 107, 107, 109, 109, 114, 114, 121, 121, 125, 97, 92, 92,
+ 94, 94, 106, 106, 112, 112, 115, 115, 120, 120, 128, 128, 132, 97, 92,
+ 92, 94, 94, 106, 106, 112, 112, 115, 115, 120, 120, 128, 128, 132, 98,
+ 91, 91, 92, 92, 107, 107, 117, 117, 123, 123, 128, 128, 135, 135, 139,
+ 98, 91, 91, 92, 92, 107, 107, 117, 117, 123, 123, 128, 128, 135, 135,
+ 139, 101, 93, 93, 93, 93, 108, 108, 119, 119, 128, 128, 134, 134, 142,
+ 142, 146, 101, 93, 93, 93, 93, 108, 108, 119, 119, 128, 128, 134, 134,
+ 142, 142, 146, 104, 96, 96, 95, 95, 109, 109, 122, 122, 133, 133, 142,
+ 142, 150, 150, 154, 104, 96, 96, 95, 95, 109, 109, 122, 122, 133, 133,
+ 142, 142, 150, 150, 154, 109, 100, 100, 98, 98, 111, 111, 125, 125, 137,
+ 137, 147, 147, 156, 156, 161, 109, 100, 100, 98, 98, 111, 111, 125, 125,
+ 137, 137, 147, 147, 156, 156, 161, 114, 104, 104, 101, 101, 113, 113,
+ 128, 128, 141, 141, 153, 153, 164, 164, 169, 114, 104, 104, 101, 101,
+ 113, 113, 128, 128, 141, 141, 153, 153, 164, 164, 169, 120, 109, 109,
+ 105, 105, 117, 117, 131, 131, 145, 145, 158, 158, 170, 170, 176, 120,
+ 109, 109, 105, 105, 117, 117, 131, 131, 145, 145, 158, 158, 170, 170,
+ 176, 127, 115, 115, 110, 110, 121, 121, 135, 135, 150, 150, 164, 164,
+ 178, 178, 184, 127, 115, 115, 110, 110, 121, 121, 135, 135, 150, 150,
+ 164, 164, 178, 178, 184, 129, 118, 118, 112, 112, 123, 123, 136, 136,
+ 151, 151, 166, 166, 180, 180, 187, 129, 118, 118, 112, 112, 123, 123,
+ 136, 136, 151, 151, 166, 166, 180, 180, 187, 133, 121, 121, 115, 115,
+ 126, 126, 139, 139, 154, 154, 169, 169, 184, 184, 191,
+ /* Size 32x16 */
+ 64, 63, 63, 61, 61, 67, 67, 74, 74, 84, 84, 98, 98, 97, 97, 98, 98, 101,
+ 101, 104, 104, 109, 109, 114, 114, 120, 120, 127, 127, 129, 129, 133,
+ 62, 63, 63, 64, 64, 72, 72, 80, 80, 86, 86, 93, 93, 92, 92, 91, 91, 93,
+ 93, 96, 96, 100, 100, 104, 104, 109, 109, 115, 115, 118, 118, 121, 62,
+ 63, 63, 64, 64, 72, 72, 80, 80, 86, 86, 93, 93, 92, 92, 91, 91, 93, 93,
+ 96, 96, 100, 100, 104, 104, 109, 109, 115, 115, 118, 118, 121, 74, 77,
+ 77, 80, 80, 86, 86, 94, 94, 95, 95, 96, 96, 94, 94, 92, 92, 93, 93, 95,
+ 95, 98, 98, 101, 101, 105, 105, 110, 110, 112, 112, 115, 74, 77, 77, 80,
+ 80, 86, 86, 94, 94, 95, 95, 96, 96, 94, 94, 92, 92, 93, 93, 95, 95, 98,
+ 98, 101, 101, 105, 105, 110, 110, 112, 112, 115, 96, 94, 94, 92, 92, 94,
+ 94, 95, 95, 100, 100, 106, 106, 106, 106, 107, 107, 108, 108, 109, 109,
+ 111, 111, 113, 113, 117, 117, 121, 121, 123, 123, 126, 96, 94, 94, 92,
+ 92, 94, 94, 95, 95, 100, 100, 106, 106, 106, 106, 107, 107, 108, 108,
+ 109, 109, 111, 111, 113, 113, 117, 117, 121, 121, 123, 123, 126, 98, 94,
+ 94, 91, 91, 92, 92, 91, 91, 99, 99, 107, 107, 112, 112, 117, 117, 119,
+ 119, 122, 122, 125, 125, 128, 128, 131, 131, 135, 135, 136, 136, 139,
+ 98, 94, 94, 91, 91, 92, 92, 91, 91, 99, 99, 107, 107, 112, 112, 117,
+ 117, 119, 119, 122, 122, 125, 125, 128, 128, 131, 131, 135, 135, 136,
+ 136, 139, 105, 100, 100, 96, 96, 95, 95, 94, 94, 101, 101, 109, 109,
+ 115, 115, 123, 123, 128, 128, 133, 133, 137, 137, 141, 141, 145, 145,
+ 150, 150, 151, 151, 154, 105, 100, 100, 96, 96, 95, 95, 94, 94, 101,
+ 101, 109, 109, 115, 115, 123, 123, 128, 128, 133, 133, 137, 137, 141,
+ 141, 145, 145, 150, 150, 151, 151, 154, 115, 109, 109, 104, 104, 103,
+ 103, 100, 100, 107, 107, 114, 114, 120, 120, 128, 128, 134, 134, 142,
+ 142, 147, 147, 153, 153, 158, 158, 164, 164, 166, 166, 169, 115, 109,
+ 109, 104, 104, 103, 103, 100, 100, 107, 107, 114, 114, 120, 120, 128,
+ 128, 134, 134, 142, 142, 147, 147, 153, 153, 158, 158, 164, 164, 166,
+ 166, 169, 127, 120, 120, 115, 115, 112, 112, 109, 109, 115, 115, 121,
+ 121, 128, 128, 135, 135, 142, 142, 150, 150, 156, 156, 164, 164, 170,
+ 170, 178, 178, 180, 180, 184, 127, 120, 120, 115, 115, 112, 112, 109,
+ 109, 115, 115, 121, 121, 128, 128, 135, 135, 142, 142, 150, 150, 156,
+ 156, 164, 164, 170, 170, 178, 178, 180, 180, 184, 133, 126, 126, 121,
+ 121, 118, 118, 114, 114, 120, 120, 125, 125, 132, 132, 139, 139, 146,
+ 146, 154, 154, 161, 161, 169, 169, 176, 176, 184, 184, 187, 187, 191,
+ /* Size 4x16 */
+ 62, 96, 105, 127, 63, 94, 100, 120, 64, 92, 96, 115, 72, 94, 95, 112,
+ 80, 95, 94, 109, 86, 100, 101, 115, 93, 106, 109, 121, 92, 106, 115,
+ 128, 91, 107, 123, 135, 93, 108, 128, 142, 96, 109, 133, 150, 100, 111,
+ 137, 156, 104, 113, 141, 164, 109, 117, 145, 170, 115, 121, 150, 178,
+ 118, 123, 151, 180,
+ /* Size 16x4 */
+ 62, 63, 64, 72, 80, 86, 93, 92, 91, 93, 96, 100, 104, 109, 115, 118, 96,
+ 94, 92, 94, 95, 100, 106, 106, 107, 108, 109, 111, 113, 117, 121, 123,
+ 105, 100, 96, 95, 94, 101, 109, 115, 123, 128, 133, 137, 141, 145, 150,
+ 151, 127, 120, 115, 112, 109, 115, 121, 128, 135, 142, 150, 156, 164,
+ 170, 178, 180,
+ /* Size 8x32 */
+ 64, 62, 74, 96, 98, 105, 115, 127, 63, 63, 77, 94, 94, 100, 109, 120,
+ 63, 63, 77, 94, 94, 100, 109, 120, 61, 64, 80, 92, 91, 96, 104, 115, 61,
+ 64, 80, 92, 91, 96, 104, 115, 67, 72, 86, 94, 92, 95, 103, 112, 67, 72,
+ 86, 94, 92, 95, 103, 112, 74, 80, 94, 95, 91, 94, 100, 109, 74, 80, 94,
+ 95, 91, 94, 100, 109, 84, 86, 95, 100, 99, 101, 107, 115, 84, 86, 95,
+ 100, 99, 101, 107, 115, 98, 93, 96, 106, 107, 109, 114, 121, 98, 93, 96,
+ 106, 107, 109, 114, 121, 97, 92, 94, 106, 112, 115, 120, 128, 97, 92,
+ 94, 106, 112, 115, 120, 128, 98, 91, 92, 107, 117, 123, 128, 135, 98,
+ 91, 92, 107, 117, 123, 128, 135, 101, 93, 93, 108, 119, 128, 134, 142,
+ 101, 93, 93, 108, 119, 128, 134, 142, 104, 96, 95, 109, 122, 133, 142,
+ 150, 104, 96, 95, 109, 122, 133, 142, 150, 109, 100, 98, 111, 125, 137,
+ 147, 156, 109, 100, 98, 111, 125, 137, 147, 156, 114, 104, 101, 113,
+ 128, 141, 153, 164, 114, 104, 101, 113, 128, 141, 153, 164, 120, 109,
+ 105, 117, 131, 145, 158, 170, 120, 109, 105, 117, 131, 145, 158, 170,
+ 127, 115, 110, 121, 135, 150, 164, 178, 127, 115, 110, 121, 135, 150,
+ 164, 178, 129, 118, 112, 123, 136, 151, 166, 180, 129, 118, 112, 123,
+ 136, 151, 166, 180, 133, 121, 115, 126, 139, 154, 169, 184,
+ /* Size 32x8 */
+ 64, 63, 63, 61, 61, 67, 67, 74, 74, 84, 84, 98, 98, 97, 97, 98, 98, 101,
+ 101, 104, 104, 109, 109, 114, 114, 120, 120, 127, 127, 129, 129, 133,
+ 62, 63, 63, 64, 64, 72, 72, 80, 80, 86, 86, 93, 93, 92, 92, 91, 91, 93,
+ 93, 96, 96, 100, 100, 104, 104, 109, 109, 115, 115, 118, 118, 121, 74,
+ 77, 77, 80, 80, 86, 86, 94, 94, 95, 95, 96, 96, 94, 94, 92, 92, 93, 93,
+ 95, 95, 98, 98, 101, 101, 105, 105, 110, 110, 112, 112, 115, 96, 94, 94,
+ 92, 92, 94, 94, 95, 95, 100, 100, 106, 106, 106, 106, 107, 107, 108,
+ 108, 109, 109, 111, 111, 113, 113, 117, 117, 121, 121, 123, 123, 126,
+ 98, 94, 94, 91, 91, 92, 92, 91, 91, 99, 99, 107, 107, 112, 112, 117,
+ 117, 119, 119, 122, 122, 125, 125, 128, 128, 131, 131, 135, 135, 136,
+ 136, 139, 105, 100, 100, 96, 96, 95, 95, 94, 94, 101, 101, 109, 109,
+ 115, 115, 123, 123, 128, 128, 133, 133, 137, 137, 141, 141, 145, 145,
+ 150, 150, 151, 151, 154, 115, 109, 109, 104, 104, 103, 103, 100, 100,
+ 107, 107, 114, 114, 120, 120, 128, 128, 134, 134, 142, 142, 147, 147,
+ 153, 153, 158, 158, 164, 164, 166, 166, 169, 127, 120, 120, 115, 115,
+ 112, 112, 109, 109, 115, 115, 121, 121, 128, 128, 135, 135, 142, 142,
+ 150, 150, 156, 156, 164, 164, 170, 170, 178, 178, 180, 180, 184 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 68, 105, 105, 178,
+#endif
+ /* Size 4x4 */
+ 64, 67, 90, 124, 67, 79, 102, 129, 90, 102, 142, 174, 124, 129, 174,
+ 217,
+ /* Size 8x8 */
+ 63, 64, 65, 71, 85, 102, 119, 138, 64, 65, 67, 71, 83, 98, 113, 131, 65,
+ 67, 71, 77, 86, 99, 112, 128, 71, 71, 77, 97, 108, 119, 132, 147, 85,
+ 83, 86, 108, 127, 142, 155, 170, 102, 98, 99, 119, 142, 162, 178, 195,
+ 119, 113, 112, 132, 155, 178, 196, 216, 138, 131, 128, 147, 170, 195,
+ 216, 238,
+ /* Size 16x16 */
+ 64, 63, 63, 63, 64, 68, 71, 76, 82, 90, 97, 108, 118, 131, 143, 160, 63,
+ 64, 64, 64, 65, 68, 70, 74, 80, 86, 93, 103, 113, 125, 136, 152, 63, 64,
+ 65, 65, 65, 67, 68, 72, 77, 83, 89, 99, 108, 119, 130, 145, 63, 64, 65,
+ 67, 68, 71, 72, 76, 81, 85, 91, 100, 108, 118, 129, 143, 64, 65, 65, 68,
+ 71, 74, 76, 79, 83, 87, 92, 99, 107, 116, 126, 139, 68, 68, 67, 71, 74,
+ 79, 84, 88, 92, 97, 102, 109, 117, 126, 136, 148, 71, 70, 68, 72, 76,
+ 84, 92, 97, 101, 106, 111, 118, 125, 134, 144, 156, 76, 74, 72, 76, 79,
+ 88, 97, 103, 108, 114, 119, 126, 134, 142, 152, 164, 82, 80, 77, 81, 83,
+ 92, 101, 108, 114, 121, 127, 135, 143, 151, 161, 173, 90, 86, 83, 85,
+ 87, 97, 106, 114, 121, 130, 136, 145, 153, 162, 171, 183, 97, 93, 89,
+ 91, 92, 102, 111, 119, 127, 136, 142, 153, 161, 171, 181, 193, 108, 103,
+ 99, 100, 99, 109, 118, 126, 135, 145, 153, 165, 174, 185, 195, 208, 118,
+ 113, 108, 108, 107, 117, 125, 134, 143, 153, 161, 174, 184, 196, 207,
+ 221, 131, 125, 119, 118, 116, 126, 134, 142, 151, 162, 171, 185, 196,
+ 210, 222, 237, 143, 136, 130, 129, 126, 136, 144, 152, 161, 171, 181,
+ 195, 207, 222, 235, 251, 160, 152, 145, 143, 139, 148, 156, 164, 173,
+ 183, 193, 208, 221, 237, 251, 268,
+ /* Size 32x32 */
+ 64, 63, 63, 63, 63, 63, 63, 64, 64, 64, 68, 68, 71, 72, 76, 79, 82, 88,
+ 90, 97, 97, 107, 108, 115, 118, 124, 131, 134, 143, 145, 160, 160, 63,
+ 63, 64, 64, 64, 64, 64, 64, 65, 65, 68, 68, 70, 71, 74, 77, 80, 85, 87,
+ 93, 93, 102, 104, 110, 113, 119, 125, 128, 137, 138, 152, 152, 63, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 68, 68, 70, 70, 74, 77, 80, 85, 86, 93,
+ 93, 102, 103, 110, 113, 118, 125, 128, 136, 138, 152, 152, 63, 64, 64,
+ 64, 64, 65, 65, 65, 65, 65, 67, 67, 69, 69, 73, 76, 78, 83, 84, 90, 90,
+ 99, 100, 106, 109, 115, 121, 124, 132, 133, 147, 147, 63, 64, 64, 64,
+ 65, 65, 65, 65, 65, 66, 67, 67, 68, 69, 72, 75, 77, 82, 83, 89, 89, 98,
+ 99, 105, 108, 113, 119, 122, 130, 131, 145, 145, 63, 64, 64, 65, 65, 65,
+ 66, 66, 67, 67, 69, 69, 70, 71, 74, 77, 79, 83, 84, 90, 90, 98, 99, 105,
+ 108, 113, 119, 122, 129, 131, 144, 144, 63, 64, 64, 65, 65, 66, 67, 67,
+ 68, 68, 71, 71, 72, 73, 76, 78, 81, 84, 85, 91, 91, 99, 100, 105, 108,
+ 113, 118, 121, 129, 130, 143, 143, 64, 64, 64, 65, 65, 66, 67, 68, 69,
+ 69, 71, 71, 73, 74, 77, 79, 81, 84, 86, 91, 91, 99, 99, 105, 108, 113,
+ 118, 121, 128, 129, 141, 141, 64, 65, 65, 65, 65, 67, 68, 69, 71, 71,
+ 74, 74, 76, 77, 79, 81, 83, 85, 87, 92, 92, 98, 99, 104, 107, 111, 116,
+ 119, 126, 127, 139, 139, 64, 65, 65, 65, 66, 67, 68, 69, 71, 71, 74, 74,
+ 77, 77, 80, 82, 83, 86, 87, 93, 93, 99, 100, 105, 108, 112, 117, 120,
+ 127, 128, 140, 140, 68, 68, 68, 67, 67, 69, 71, 71, 74, 74, 79, 79, 84,
+ 85, 88, 90, 92, 95, 97, 102, 102, 108, 109, 114, 117, 121, 126, 129,
+ 136, 137, 148, 148, 68, 68, 68, 67, 67, 69, 71, 71, 74, 74, 79, 79, 84,
+ 85, 88, 90, 92, 95, 97, 102, 102, 108, 109, 114, 117, 121, 126, 129,
+ 136, 137, 148, 148, 71, 70, 70, 69, 68, 70, 72, 73, 76, 77, 84, 84, 92,
+ 94, 97, 99, 101, 105, 106, 111, 111, 117, 118, 123, 125, 129, 134, 137,
+ 144, 145, 156, 156, 72, 71, 70, 69, 69, 71, 73, 74, 77, 77, 85, 85, 94,
+ 97, 100, 101, 104, 108, 109, 114, 114, 119, 120, 125, 128, 132, 136,
+ 139, 146, 147, 158, 158, 76, 74, 74, 73, 72, 74, 76, 77, 79, 80, 88, 88,
+ 97, 100, 103, 105, 108, 112, 114, 119, 119, 125, 126, 131, 134, 138,
+ 142, 145, 152, 153, 164, 164, 79, 77, 77, 76, 75, 77, 78, 79, 81, 82,
+ 90, 90, 99, 101, 105, 108, 111, 116, 117, 122, 122, 129, 130, 135, 138,
+ 142, 147, 149, 156, 157, 168, 168, 82, 80, 80, 78, 77, 79, 81, 81, 83,
+ 83, 92, 92, 101, 104, 108, 111, 114, 120, 121, 127, 127, 134, 135, 140,
+ 143, 147, 151, 154, 161, 162, 173, 173, 88, 85, 85, 83, 82, 83, 84, 84,
+ 85, 86, 95, 95, 105, 108, 112, 116, 120, 127, 128, 134, 134, 142, 143,
+ 148, 151, 155, 159, 162, 169, 170, 181, 181, 90, 87, 86, 84, 83, 84, 85,
+ 86, 87, 87, 97, 97, 106, 109, 114, 117, 121, 128, 130, 136, 136, 144,
+ 145, 150, 153, 157, 162, 164, 171, 172, 183, 183, 97, 93, 93, 90, 89,
+ 90, 91, 91, 92, 93, 102, 102, 111, 114, 119, 122, 127, 134, 136, 142,
+ 142, 151, 153, 158, 161, 166, 171, 174, 181, 182, 193, 193, 97, 93, 93,
+ 90, 89, 90, 91, 91, 92, 93, 102, 102, 111, 114, 119, 122, 127, 134, 136,
+ 142, 142, 151, 153, 158, 161, 166, 171, 174, 181, 182, 193, 193, 107,
+ 102, 102, 99, 98, 98, 99, 99, 98, 99, 108, 108, 117, 119, 125, 129, 134,
+ 142, 144, 151, 151, 162, 163, 170, 173, 178, 183, 186, 194, 195, 206,
+ 206, 108, 104, 103, 100, 99, 99, 100, 99, 99, 100, 109, 109, 118, 120,
+ 126, 130, 135, 143, 145, 153, 153, 163, 165, 171, 174, 179, 185, 188,
+ 195, 196, 208, 208, 115, 110, 110, 106, 105, 105, 105, 105, 104, 105,
+ 114, 114, 123, 125, 131, 135, 140, 148, 150, 158, 158, 170, 171, 178,
+ 181, 187, 193, 196, 204, 205, 217, 217, 118, 113, 113, 109, 108, 108,
+ 108, 108, 107, 108, 117, 117, 125, 128, 134, 138, 143, 151, 153, 161,
+ 161, 173, 174, 181, 184, 190, 196, 199, 207, 209, 221, 221, 124, 119,
+ 118, 115, 113, 113, 113, 113, 111, 112, 121, 121, 129, 132, 138, 142,
+ 147, 155, 157, 166, 166, 178, 179, 187, 190, 196, 203, 206, 214, 216,
+ 229, 229, 131, 125, 125, 121, 119, 119, 118, 118, 116, 117, 126, 126,
+ 134, 136, 142, 147, 151, 159, 162, 171, 171, 183, 185, 193, 196, 203,
+ 210, 213, 222, 223, 237, 237, 134, 128, 128, 124, 122, 122, 121, 121,
+ 119, 120, 129, 129, 137, 139, 145, 149, 154, 162, 164, 174, 174, 186,
+ 188, 196, 199, 206, 213, 217, 226, 227, 241, 241, 143, 137, 136, 132,
+ 130, 129, 129, 128, 126, 127, 136, 136, 144, 146, 152, 156, 161, 169,
+ 171, 181, 181, 194, 195, 204, 207, 214, 222, 226, 235, 236, 251, 251,
+ 145, 138, 138, 133, 131, 131, 130, 129, 127, 128, 137, 137, 145, 147,
+ 153, 157, 162, 170, 172, 182, 182, 195, 196, 205, 209, 216, 223, 227,
+ 236, 238, 252, 252, 160, 152, 152, 147, 145, 144, 143, 141, 139, 140,
+ 148, 148, 156, 158, 164, 168, 173, 181, 183, 193, 193, 206, 208, 217,
+ 221, 229, 237, 241, 251, 252, 268, 268, 160, 152, 152, 147, 145, 144,
+ 143, 141, 139, 140, 148, 148, 156, 158, 164, 168, 173, 181, 183, 193,
+ 193, 206, 208, 217, 221, 229, 237, 241, 251, 252, 268, 268,
+ /* Size 4x8 */
+ 64, 68, 87, 125, 65, 69, 84, 119, 66, 74, 88, 117, 70, 86, 109, 136, 83,
+ 96, 128, 159, 99, 108, 143, 183, 115, 121, 157, 203, 133, 137, 172, 223,
+ /* Size 8x4 */
+ 64, 65, 66, 70, 83, 99, 115, 133, 68, 69, 74, 86, 96, 108, 121, 137, 87,
+ 84, 88, 109, 128, 143, 157, 172, 125, 119, 117, 136, 159, 183, 203, 223,
+ /* Size 8x16 */
+ 64, 63, 64, 72, 88, 107, 125, 146, 63, 64, 65, 71, 85, 103, 119, 139,
+ 63, 65, 66, 69, 82, 99, 114, 133, 64, 65, 68, 73, 84, 100, 114, 131, 64,
+ 66, 71, 77, 85, 99, 112, 128, 68, 68, 74, 85, 96, 109, 122, 138, 71, 69,
+ 76, 94, 105, 118, 130, 146, 76, 73, 80, 99, 112, 126, 139, 154, 82, 78,
+ 83, 103, 120, 135, 148, 163, 89, 84, 87, 108, 128, 145, 158, 173, 96,
+ 90, 93, 113, 134, 152, 167, 183, 107, 99, 100, 120, 142, 164, 180, 198,
+ 117, 108, 108, 127, 150, 174, 191, 210, 130, 120, 117, 136, 159, 185,
+ 204, 225, 142, 131, 127, 146, 169, 195, 216, 238, 159, 145, 140, 158,
+ 181, 208, 230, 254,
+ /* Size 16x8 */
+ 64, 63, 63, 64, 64, 68, 71, 76, 82, 89, 96, 107, 117, 130, 142, 159, 63,
+ 64, 65, 65, 66, 68, 69, 73, 78, 84, 90, 99, 108, 120, 131, 145, 64, 65,
+ 66, 68, 71, 74, 76, 80, 83, 87, 93, 100, 108, 117, 127, 140, 72, 71, 69,
+ 73, 77, 85, 94, 99, 103, 108, 113, 120, 127, 136, 146, 158, 88, 85, 82,
+ 84, 85, 96, 105, 112, 120, 128, 134, 142, 150, 159, 169, 181, 107, 103,
+ 99, 100, 99, 109, 118, 126, 135, 145, 152, 164, 174, 185, 195, 208, 125,
+ 119, 114, 114, 112, 122, 130, 139, 148, 158, 167, 180, 191, 204, 216,
+ 230, 146, 139, 133, 131, 128, 138, 146, 154, 163, 173, 183, 198, 210,
+ 225, 238, 254,
+ /* Size 16x32 */
+ 64, 63, 63, 64, 64, 68, 72, 76, 88, 89, 107, 107, 125, 131, 146, 158,
+ 63, 64, 64, 65, 65, 68, 71, 75, 85, 87, 103, 103, 120, 125, 140, 151,
+ 63, 64, 64, 65, 65, 68, 71, 74, 85, 86, 103, 103, 119, 124, 139, 151,
+ 63, 64, 64, 65, 65, 67, 70, 73, 83, 84, 100, 100, 116, 121, 134, 146,
+ 63, 65, 65, 65, 66, 67, 69, 73, 82, 83, 99, 99, 114, 119, 133, 144, 63,
+ 65, 65, 66, 67, 69, 71, 74, 83, 84, 99, 99, 114, 119, 132, 143, 64, 65,
+ 65, 67, 68, 71, 73, 76, 84, 86, 100, 100, 114, 118, 131, 142, 64, 65,
+ 65, 68, 69, 71, 74, 77, 85, 86, 99, 99, 113, 118, 130, 140, 64, 65, 66,
+ 69, 71, 74, 77, 79, 85, 87, 99, 99, 112, 116, 128, 138, 64, 66, 66, 69,
+ 71, 74, 78, 80, 86, 88, 100, 100, 113, 117, 129, 139, 68, 68, 68, 72,
+ 74, 79, 85, 88, 96, 97, 109, 109, 122, 126, 138, 147, 68, 68, 68, 72,
+ 74, 79, 85, 88, 96, 97, 109, 109, 122, 126, 138, 147, 71, 69, 69, 74,
+ 76, 84, 94, 97, 105, 106, 118, 118, 130, 134, 146, 155, 72, 70, 69, 75,
+ 77, 86, 96, 99, 108, 109, 120, 120, 133, 136, 148, 157, 76, 73, 73, 77,
+ 80, 88, 99, 103, 112, 114, 126, 126, 139, 142, 154, 163, 79, 76, 75, 80,
+ 81, 90, 101, 105, 116, 117, 130, 130, 143, 147, 159, 168, 82, 78, 78,
+ 82, 83, 92, 103, 108, 120, 121, 135, 135, 148, 152, 163, 172, 88, 83,
+ 82, 85, 86, 96, 107, 112, 126, 128, 143, 143, 156, 159, 171, 180, 89,
+ 84, 84, 86, 87, 97, 108, 113, 128, 129, 145, 145, 158, 162, 173, 182,
+ 96, 90, 90, 92, 93, 102, 113, 119, 134, 135, 152, 152, 167, 171, 183,
+ 192, 96, 90, 90, 92, 93, 102, 113, 119, 134, 135, 152, 152, 167, 171,
+ 183, 192, 106, 99, 98, 99, 99, 108, 119, 125, 142, 143, 163, 163, 179,
+ 183, 196, 206, 107, 100, 99, 100, 100, 109, 120, 126, 142, 144, 164,
+ 164, 180, 185, 198, 207, 114, 106, 105, 105, 105, 114, 125, 131, 148,
+ 150, 171, 171, 188, 193, 206, 216, 117, 109, 108, 108, 108, 117, 127,
+ 134, 150, 152, 174, 174, 191, 196, 210, 220, 123, 115, 114, 113, 112,
+ 121, 132, 138, 155, 157, 179, 179, 197, 203, 217, 228, 130, 121, 120,
+ 118, 117, 126, 136, 142, 159, 161, 185, 185, 204, 210, 225, 236, 134,
+ 124, 123, 121, 120, 129, 139, 145, 162, 164, 188, 188, 207, 213, 228,
+ 240, 142, 132, 131, 128, 127, 136, 146, 152, 169, 171, 195, 195, 216,
+ 222, 238, 250, 144, 133, 132, 129, 128, 137, 147, 153, 170, 172, 196,
+ 196, 217, 223, 239, 251, 159, 147, 145, 142, 140, 148, 158, 164, 181,
+ 183, 208, 208, 230, 236, 254, 267, 159, 147, 145, 142, 140, 148, 158,
+ 164, 181, 183, 208, 208, 230, 236, 254, 267,
+ /* Size 32x16 */
+ 64, 63, 63, 63, 63, 63, 64, 64, 64, 64, 68, 68, 71, 72, 76, 79, 82, 88,
+ 89, 96, 96, 106, 107, 114, 117, 123, 130, 134, 142, 144, 159, 159, 63,
+ 64, 64, 64, 65, 65, 65, 65, 65, 66, 68, 68, 69, 70, 73, 76, 78, 83, 84,
+ 90, 90, 99, 100, 106, 109, 115, 121, 124, 132, 133, 147, 147, 63, 64,
+ 64, 64, 65, 65, 65, 65, 66, 66, 68, 68, 69, 69, 73, 75, 78, 82, 84, 90,
+ 90, 98, 99, 105, 108, 114, 120, 123, 131, 132, 145, 145, 64, 65, 65, 65,
+ 65, 66, 67, 68, 69, 69, 72, 72, 74, 75, 77, 80, 82, 85, 86, 92, 92, 99,
+ 100, 105, 108, 113, 118, 121, 128, 129, 142, 142, 64, 65, 65, 65, 66,
+ 67, 68, 69, 71, 71, 74, 74, 76, 77, 80, 81, 83, 86, 87, 93, 93, 99, 100,
+ 105, 108, 112, 117, 120, 127, 128, 140, 140, 68, 68, 68, 67, 67, 69, 71,
+ 71, 74, 74, 79, 79, 84, 86, 88, 90, 92, 96, 97, 102, 102, 108, 109, 114,
+ 117, 121, 126, 129, 136, 137, 148, 148, 72, 71, 71, 70, 69, 71, 73, 74,
+ 77, 78, 85, 85, 94, 96, 99, 101, 103, 107, 108, 113, 113, 119, 120, 125,
+ 127, 132, 136, 139, 146, 147, 158, 158, 76, 75, 74, 73, 73, 74, 76, 77,
+ 79, 80, 88, 88, 97, 99, 103, 105, 108, 112, 113, 119, 119, 125, 126,
+ 131, 134, 138, 142, 145, 152, 153, 164, 164, 88, 85, 85, 83, 82, 83, 84,
+ 85, 85, 86, 96, 96, 105, 108, 112, 116, 120, 126, 128, 134, 134, 142,
+ 142, 148, 150, 155, 159, 162, 169, 170, 181, 181, 89, 87, 86, 84, 83,
+ 84, 86, 86, 87, 88, 97, 97, 106, 109, 114, 117, 121, 128, 129, 135, 135,
+ 143, 144, 150, 152, 157, 161, 164, 171, 172, 183, 183, 107, 103, 103,
+ 100, 99, 99, 100, 99, 99, 100, 109, 109, 118, 120, 126, 130, 135, 143,
+ 145, 152, 152, 163, 164, 171, 174, 179, 185, 188, 195, 196, 208, 208,
+ 107, 103, 103, 100, 99, 99, 100, 99, 99, 100, 109, 109, 118, 120, 126,
+ 130, 135, 143, 145, 152, 152, 163, 164, 171, 174, 179, 185, 188, 195,
+ 196, 208, 208, 125, 120, 119, 116, 114, 114, 114, 113, 112, 113, 122,
+ 122, 130, 133, 139, 143, 148, 156, 158, 167, 167, 179, 180, 188, 191,
+ 197, 204, 207, 216, 217, 230, 230, 131, 125, 124, 121, 119, 119, 118,
+ 118, 116, 117, 126, 126, 134, 136, 142, 147, 152, 159, 162, 171, 171,
+ 183, 185, 193, 196, 203, 210, 213, 222, 223, 236, 236, 146, 140, 139,
+ 134, 133, 132, 131, 130, 128, 129, 138, 138, 146, 148, 154, 159, 163,
+ 171, 173, 183, 183, 196, 198, 206, 210, 217, 225, 228, 238, 239, 254,
+ 254, 158, 151, 151, 146, 144, 143, 142, 140, 138, 139, 147, 147, 155,
+ 157, 163, 168, 172, 180, 182, 192, 192, 206, 207, 216, 220, 228, 236,
+ 240, 250, 251, 267, 267,
+ /* Size 4x16 */
+ 63, 68, 89, 131, 64, 68, 86, 124, 65, 67, 83, 119, 65, 71, 86, 118, 65,
+ 74, 87, 116, 68, 79, 97, 126, 69, 84, 106, 134, 73, 88, 114, 142, 78,
+ 92, 121, 152, 84, 97, 129, 162, 90, 102, 135, 171, 100, 109, 144, 185,
+ 109, 117, 152, 196, 121, 126, 161, 210, 132, 136, 171, 222, 147, 148,
+ 183, 236,
+ /* Size 16x4 */
+ 63, 64, 65, 65, 65, 68, 69, 73, 78, 84, 90, 100, 109, 121, 132, 147, 68,
+ 68, 67, 71, 74, 79, 84, 88, 92, 97, 102, 109, 117, 126, 136, 148, 89,
+ 86, 83, 86, 87, 97, 106, 114, 121, 129, 135, 144, 152, 161, 171, 183,
+ 131, 124, 119, 118, 116, 126, 134, 142, 152, 162, 171, 185, 196, 210,
+ 222, 236,
+ /* Size 8x32 */
+ 64, 63, 64, 72, 88, 107, 125, 146, 63, 64, 65, 71, 85, 103, 120, 140,
+ 63, 64, 65, 71, 85, 103, 119, 139, 63, 64, 65, 70, 83, 100, 116, 134,
+ 63, 65, 66, 69, 82, 99, 114, 133, 63, 65, 67, 71, 83, 99, 114, 132, 64,
+ 65, 68, 73, 84, 100, 114, 131, 64, 65, 69, 74, 85, 99, 113, 130, 64, 66,
+ 71, 77, 85, 99, 112, 128, 64, 66, 71, 78, 86, 100, 113, 129, 68, 68, 74,
+ 85, 96, 109, 122, 138, 68, 68, 74, 85, 96, 109, 122, 138, 71, 69, 76,
+ 94, 105, 118, 130, 146, 72, 69, 77, 96, 108, 120, 133, 148, 76, 73, 80,
+ 99, 112, 126, 139, 154, 79, 75, 81, 101, 116, 130, 143, 159, 82, 78, 83,
+ 103, 120, 135, 148, 163, 88, 82, 86, 107, 126, 143, 156, 171, 89, 84,
+ 87, 108, 128, 145, 158, 173, 96, 90, 93, 113, 134, 152, 167, 183, 96,
+ 90, 93, 113, 134, 152, 167, 183, 106, 98, 99, 119, 142, 163, 179, 196,
+ 107, 99, 100, 120, 142, 164, 180, 198, 114, 105, 105, 125, 148, 171,
+ 188, 206, 117, 108, 108, 127, 150, 174, 191, 210, 123, 114, 112, 132,
+ 155, 179, 197, 217, 130, 120, 117, 136, 159, 185, 204, 225, 134, 123,
+ 120, 139, 162, 188, 207, 228, 142, 131, 127, 146, 169, 195, 216, 238,
+ 144, 132, 128, 147, 170, 196, 217, 239, 159, 145, 140, 158, 181, 208,
+ 230, 254, 159, 145, 140, 158, 181, 208, 230, 254,
+ /* Size 32x8 */
+ 64, 63, 63, 63, 63, 63, 64, 64, 64, 64, 68, 68, 71, 72, 76, 79, 82, 88,
+ 89, 96, 96, 106, 107, 114, 117, 123, 130, 134, 142, 144, 159, 159, 63,
+ 64, 64, 64, 65, 65, 65, 65, 66, 66, 68, 68, 69, 69, 73, 75, 78, 82, 84,
+ 90, 90, 98, 99, 105, 108, 114, 120, 123, 131, 132, 145, 145, 64, 65, 65,
+ 65, 66, 67, 68, 69, 71, 71, 74, 74, 76, 77, 80, 81, 83, 86, 87, 93, 93,
+ 99, 100, 105, 108, 112, 117, 120, 127, 128, 140, 140, 72, 71, 71, 70,
+ 69, 71, 73, 74, 77, 78, 85, 85, 94, 96, 99, 101, 103, 107, 108, 113,
+ 113, 119, 120, 125, 127, 132, 136, 139, 146, 147, 158, 158, 88, 85, 85,
+ 83, 82, 83, 84, 85, 85, 86, 96, 96, 105, 108, 112, 116, 120, 126, 128,
+ 134, 134, 142, 142, 148, 150, 155, 159, 162, 169, 170, 181, 181, 107,
+ 103, 103, 100, 99, 99, 100, 99, 99, 100, 109, 109, 118, 120, 126, 130,
+ 135, 143, 145, 152, 152, 163, 164, 171, 174, 179, 185, 188, 195, 196,
+ 208, 208, 125, 120, 119, 116, 114, 114, 114, 113, 112, 113, 122, 122,
+ 130, 133, 139, 143, 148, 156, 158, 167, 167, 179, 180, 188, 191, 197,
+ 204, 207, 216, 217, 230, 230, 146, 140, 139, 134, 133, 132, 131, 130,
+ 128, 129, 138, 138, 146, 148, 154, 159, 163, 171, 173, 183, 183, 196,
+ 198, 206, 210, 217, 225, 228, 238, 239, 254, 254 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 83, 97, 97, 139,
+#endif
+ /* Size 4x4 */
+ 63, 85, 94, 107, 85, 97, 100, 108, 94, 100, 123, 135, 107, 108, 135,
+ 156,
+ /* Size 8x8 */
+ 63, 65, 77, 96, 94, 100, 107, 115, 65, 71, 84, 94, 90, 95, 101, 109, 77,
+ 84, 95, 96, 91, 94, 99, 105, 96, 94, 96, 106, 107, 109, 112, 117, 94,
+ 90, 91, 107, 117, 122, 126, 131, 100, 95, 94, 109, 122, 132, 138, 145,
+ 107, 101, 99, 112, 126, 138, 147, 155, 115, 109, 105, 117, 131, 145,
+ 155, 165,
+ /* Size 16x16 */
+ 64, 62, 61, 67, 73, 83, 95, 98, 98, 99, 101, 104, 109, 114, 120, 127,
+ 62, 63, 62, 69, 77, 85, 93, 95, 94, 94, 97, 100, 104, 109, 114, 121, 61,
+ 62, 64, 71, 80, 85, 91, 92, 91, 91, 93, 95, 99, 104, 109, 115, 67, 69,
+ 71, 78, 87, 90, 94, 93, 92, 91, 93, 95, 99, 102, 107, 113, 73, 77, 80,
+ 87, 95, 95, 95, 94, 92, 91, 92, 94, 97, 100, 104, 109, 83, 85, 85, 90,
+ 95, 97, 100, 100, 99, 99, 100, 101, 104, 107, 111, 115, 95, 93, 91, 94,
+ 95, 100, 104, 105, 105, 105, 106, 107, 110, 112, 116, 120, 98, 95, 92,
+ 93, 94, 100, 105, 107, 108, 110, 111, 112, 115, 117, 121, 125, 98, 94,
+ 91, 92, 92, 99, 105, 108, 111, 114, 116, 118, 120, 123, 126, 130, 99,
+ 94, 91, 91, 91, 99, 105, 110, 114, 118, 120, 123, 126, 129, 132, 136,
+ 101, 97, 93, 93, 92, 100, 106, 111, 116, 120, 123, 127, 130, 134, 137,
+ 142, 104, 100, 95, 95, 94, 101, 107, 112, 118, 123, 127, 133, 137, 141,
+ 145, 150, 109, 104, 99, 99, 97, 104, 110, 115, 120, 126, 130, 137, 142,
+ 147, 151, 156, 114, 109, 104, 102, 100, 107, 112, 117, 123, 129, 134,
+ 141, 147, 153, 158, 164, 120, 114, 109, 107, 104, 111, 116, 121, 126,
+ 132, 137, 145, 151, 158, 164, 170, 127, 121, 115, 113, 109, 115, 120,
+ 125, 130, 136, 142, 150, 156, 164, 170, 178,
+ /* Size 32x32 */
+ 64, 62, 62, 61, 61, 64, 67, 69, 73, 74, 83, 83, 95, 98, 98, 97, 98, 98,
+ 99, 101, 101, 104, 104, 108, 109, 112, 114, 116, 120, 121, 127, 127, 62,
+ 63, 63, 62, 62, 65, 69, 71, 77, 77, 84, 84, 93, 96, 95, 94, 94, 94, 95,
+ 97, 97, 100, 100, 103, 105, 107, 109, 111, 115, 115, 121, 121, 62, 63,
+ 63, 63, 62, 66, 69, 71, 77, 78, 85, 85, 93, 95, 95, 94, 94, 94, 94, 97,
+ 97, 99, 100, 103, 104, 106, 109, 110, 114, 115, 121, 121, 61, 62, 63,
+ 63, 63, 67, 70, 73, 79, 80, 85, 85, 92, 94, 93, 92, 92, 91, 92, 94, 94,
+ 96, 97, 100, 101, 103, 105, 107, 110, 111, 117, 117, 61, 62, 62, 63, 64,
+ 67, 71, 73, 80, 80, 85, 85, 91, 93, 92, 91, 91, 90, 91, 93, 93, 95, 95,
+ 98, 99, 102, 104, 105, 109, 109, 115, 115, 64, 65, 66, 67, 67, 71, 74,
+ 77, 83, 84, 87, 87, 92, 94, 93, 92, 91, 90, 91, 93, 93, 95, 95, 98, 99,
+ 101, 103, 104, 108, 109, 114, 114, 67, 69, 69, 70, 71, 74, 78, 80, 87,
+ 87, 90, 90, 94, 95, 93, 93, 92, 91, 91, 93, 93, 95, 95, 98, 99, 100,
+ 102, 104, 107, 108, 113, 113, 69, 71, 71, 73, 73, 77, 80, 83, 89, 89,
+ 91, 91, 94, 95, 94, 93, 92, 91, 91, 93, 93, 94, 95, 97, 98, 100, 102,
+ 103, 106, 107, 111, 111, 73, 77, 77, 79, 80, 83, 87, 89, 95, 95, 95, 95,
+ 95, 96, 94, 93, 92, 91, 91, 92, 92, 93, 94, 96, 97, 98, 100, 101, 104,
+ 105, 109, 109, 74, 77, 78, 80, 80, 84, 87, 89, 95, 95, 95, 95, 96, 96,
+ 95, 94, 93, 91, 92, 93, 93, 94, 94, 96, 97, 99, 100, 102, 105, 105, 110,
+ 110, 83, 84, 85, 85, 85, 87, 90, 91, 95, 95, 97, 97, 100, 101, 100, 99,
+ 99, 98, 99, 100, 100, 101, 101, 103, 104, 105, 107, 108, 111, 111, 115,
+ 115, 83, 84, 85, 85, 85, 87, 90, 91, 95, 95, 97, 97, 100, 101, 100, 99,
+ 99, 98, 99, 100, 100, 101, 101, 103, 104, 105, 107, 108, 111, 111, 115,
+ 115, 95, 93, 93, 92, 91, 92, 94, 94, 95, 96, 100, 100, 104, 105, 105,
+ 105, 105, 105, 105, 106, 106, 107, 107, 109, 110, 111, 112, 113, 116,
+ 116, 120, 120, 98, 96, 95, 94, 93, 94, 95, 95, 96, 96, 101, 101, 105,
+ 106, 106, 106, 107, 107, 107, 108, 108, 109, 109, 110, 111, 112, 113,
+ 114, 117, 117, 121, 121, 98, 95, 95, 93, 92, 93, 93, 94, 94, 95, 100,
+ 100, 105, 106, 107, 108, 108, 110, 110, 111, 111, 112, 112, 114, 115,
+ 116, 117, 118, 121, 121, 125, 125, 97, 94, 94, 92, 91, 92, 93, 93, 93,
+ 94, 99, 99, 105, 106, 108, 109, 110, 111, 112, 113, 113, 115, 115, 117,
+ 117, 119, 120, 121, 123, 124, 127, 127, 98, 94, 94, 92, 91, 91, 92, 92,
+ 92, 93, 99, 99, 105, 107, 108, 110, 111, 114, 114, 116, 116, 118, 118,
+ 120, 120, 122, 123, 124, 126, 127, 130, 130, 98, 94, 94, 91, 90, 90, 91,
+ 91, 91, 91, 98, 98, 105, 107, 110, 111, 114, 117, 118, 120, 120, 122,
+ 123, 124, 125, 126, 127, 128, 131, 131, 135, 135, 99, 95, 94, 92, 91,
+ 91, 91, 91, 91, 92, 99, 99, 105, 107, 110, 112, 114, 118, 118, 120, 120,
+ 123, 123, 125, 126, 127, 129, 130, 132, 133, 136, 136, 101, 97, 97, 94,
+ 93, 93, 93, 93, 92, 93, 100, 100, 106, 108, 111, 113, 116, 120, 120,
+ 123, 123, 127, 127, 130, 130, 132, 134, 135, 137, 138, 142, 142, 101,
+ 97, 97, 94, 93, 93, 93, 93, 92, 93, 100, 100, 106, 108, 111, 113, 116,
+ 120, 120, 123, 123, 127, 127, 130, 130, 132, 134, 135, 137, 138, 142,
+ 142, 104, 100, 99, 96, 95, 95, 95, 94, 93, 94, 101, 101, 107, 109, 112,
+ 115, 118, 122, 123, 127, 127, 132, 133, 135, 136, 138, 141, 142, 144,
+ 145, 149, 149, 104, 100, 100, 97, 95, 95, 95, 95, 94, 94, 101, 101, 107,
+ 109, 112, 115, 118, 123, 123, 127, 127, 133, 133, 136, 137, 139, 141,
+ 142, 145, 146, 150, 150, 108, 103, 103, 100, 98, 98, 98, 97, 96, 96,
+ 103, 103, 109, 110, 114, 117, 120, 124, 125, 130, 130, 135, 136, 139,
+ 140, 143, 145, 146, 149, 150, 154, 154, 109, 105, 104, 101, 99, 99, 99,
+ 98, 97, 97, 104, 104, 110, 111, 115, 117, 120, 125, 126, 130, 130, 136,
+ 137, 140, 142, 144, 147, 148, 151, 152, 156, 156, 112, 107, 106, 103,
+ 102, 101, 100, 100, 98, 99, 105, 105, 111, 112, 116, 119, 122, 126, 127,
+ 132, 132, 138, 139, 143, 144, 147, 150, 151, 154, 155, 160, 160, 114,
+ 109, 109, 105, 104, 103, 102, 102, 100, 100, 107, 107, 112, 113, 117,
+ 120, 123, 127, 129, 134, 134, 141, 141, 145, 147, 150, 153, 155, 158,
+ 159, 164, 164, 116, 111, 110, 107, 105, 104, 104, 103, 101, 102, 108,
+ 108, 113, 114, 118, 121, 124, 128, 130, 135, 135, 142, 142, 146, 148,
+ 151, 155, 156, 160, 160, 166, 166, 120, 115, 114, 110, 109, 108, 107,
+ 106, 104, 105, 111, 111, 116, 117, 121, 123, 126, 131, 132, 137, 137,
+ 144, 145, 149, 151, 154, 158, 160, 164, 164, 170, 170, 121, 115, 115,
+ 111, 109, 109, 108, 107, 105, 105, 111, 111, 116, 117, 121, 124, 127,
+ 131, 133, 138, 138, 145, 146, 150, 152, 155, 159, 160, 164, 165, 171,
+ 171, 127, 121, 121, 117, 115, 114, 113, 111, 109, 110, 115, 115, 120,
+ 121, 125, 127, 130, 135, 136, 142, 142, 149, 150, 154, 156, 160, 164,
+ 166, 170, 171, 178, 178, 127, 121, 121, 117, 115, 114, 113, 111, 109,
+ 110, 115, 115, 120, 121, 125, 127, 130, 135, 136, 142, 142, 149, 150,
+ 154, 156, 160, 164, 166, 170, 171, 178, 178,
+ /* Size 4x8 */
+ 63, 85, 95, 109, 67, 88, 91, 103, 80, 95, 92, 101, 94, 101, 108, 114,
+ 91, 99, 118, 128, 96, 101, 123, 141, 103, 105, 127, 150, 111, 111, 133,
+ 159,
+ /* Size 8x4 */
+ 63, 67, 80, 94, 91, 96, 103, 111, 85, 88, 95, 101, 99, 101, 105, 111,
+ 95, 91, 92, 108, 118, 123, 127, 133, 109, 103, 101, 114, 128, 141, 150,
+ 159,
+ /* Size 8x16 */
+ 64, 62, 74, 96, 98, 105, 112, 122, 63, 63, 77, 94, 94, 100, 107, 115,
+ 61, 64, 80, 92, 91, 96, 102, 110, 67, 72, 86, 94, 92, 95, 101, 108, 74,
+ 80, 94, 95, 91, 94, 99, 105, 84, 86, 95, 100, 99, 101, 106, 112, 95, 92,
+ 96, 105, 106, 107, 111, 117, 97, 92, 95, 106, 110, 113, 116, 122, 97,
+ 91, 93, 106, 114, 118, 122, 127, 98, 91, 92, 107, 117, 124, 128, 133,
+ 101, 93, 93, 108, 119, 128, 133, 139, 104, 96, 95, 109, 122, 133, 140,
+ 146, 109, 100, 98, 111, 125, 137, 145, 152, 114, 104, 101, 113, 128,
+ 141, 151, 159, 120, 109, 105, 117, 131, 145, 155, 165, 127, 115, 110,
+ 121, 135, 150, 161, 172,
+ /* Size 16x8 */
+ 64, 63, 61, 67, 74, 84, 95, 97, 97, 98, 101, 104, 109, 114, 120, 127,
+ 62, 63, 64, 72, 80, 86, 92, 92, 91, 91, 93, 96, 100, 104, 109, 115, 74,
+ 77, 80, 86, 94, 95, 96, 95, 93, 92, 93, 95, 98, 101, 105, 110, 96, 94,
+ 92, 94, 95, 100, 105, 106, 106, 107, 108, 109, 111, 113, 117, 121, 98,
+ 94, 91, 92, 91, 99, 106, 110, 114, 117, 119, 122, 125, 128, 131, 135,
+ 105, 100, 96, 95, 94, 101, 107, 113, 118, 124, 128, 133, 137, 141, 145,
+ 150, 112, 107, 102, 101, 99, 106, 111, 116, 122, 128, 133, 140, 145,
+ 151, 155, 161, 122, 115, 110, 108, 105, 112, 117, 122, 127, 133, 139,
+ 146, 152, 159, 165, 172,
+ /* Size 16x32 */
+ 64, 62, 62, 70, 74, 84, 96, 97, 98, 99, 105, 105, 112, 115, 122, 127,
+ 63, 63, 63, 72, 77, 85, 94, 95, 95, 95, 100, 100, 108, 109, 116, 121,
+ 63, 63, 63, 72, 77, 85, 94, 94, 94, 95, 100, 100, 107, 109, 115, 120,
+ 61, 64, 64, 74, 79, 85, 93, 92, 92, 92, 97, 97, 104, 105, 112, 116, 61,
+ 64, 64, 74, 80, 85, 92, 92, 91, 91, 96, 96, 102, 104, 110, 115, 64, 67,
+ 68, 78, 83, 88, 93, 92, 91, 91, 96, 96, 102, 103, 109, 114, 67, 71, 72,
+ 81, 86, 90, 94, 93, 92, 92, 95, 95, 101, 103, 108, 112, 69, 74, 74, 84,
+ 89, 91, 94, 94, 91, 92, 95, 95, 100, 102, 107, 111, 74, 80, 80, 90, 94,
+ 95, 95, 94, 91, 92, 94, 94, 99, 100, 105, 109, 75, 80, 81, 90, 94, 95,
+ 96, 95, 92, 92, 95, 95, 99, 101, 106, 110, 84, 86, 86, 92, 95, 97, 100,
+ 100, 99, 99, 101, 101, 106, 107, 112, 115, 84, 86, 86, 92, 95, 97, 100,
+ 100, 99, 99, 101, 101, 106, 107, 112, 115, 95, 92, 92, 95, 96, 100, 105,
+ 105, 106, 106, 107, 107, 111, 112, 117, 120, 98, 94, 93, 95, 96, 101,
+ 106, 106, 107, 108, 109, 109, 113, 114, 118, 121, 97, 93, 92, 94, 95,
+ 100, 106, 107, 110, 110, 113, 113, 116, 117, 122, 125, 97, 92, 92, 93,
+ 94, 100, 106, 108, 112, 112, 115, 115, 119, 120, 124, 128, 97, 92, 91,
+ 92, 93, 99, 106, 108, 114, 114, 118, 118, 122, 123, 127, 130, 98, 91,
+ 91, 91, 92, 99, 107, 110, 117, 118, 123, 123, 127, 128, 132, 135, 98,
+ 92, 91, 92, 92, 99, 107, 110, 117, 118, 124, 124, 128, 129, 133, 136,
+ 101, 94, 93, 93, 93, 100, 108, 111, 119, 120, 128, 128, 133, 134, 139,
+ 142, 101, 94, 93, 93, 93, 100, 108, 111, 119, 120, 128, 128, 133, 134,
+ 139, 142, 104, 96, 96, 95, 94, 101, 109, 112, 122, 123, 133, 133, 139,
+ 141, 145, 149, 104, 97, 96, 95, 95, 101, 109, 112, 122, 123, 133, 133,
+ 140, 142, 146, 150, 107, 100, 99, 97, 97, 103, 110, 114, 124, 125, 136,
+ 136, 143, 145, 150, 154, 109, 101, 100, 98, 98, 104, 111, 115, 125, 126,
+ 137, 137, 145, 147, 152, 156, 111, 103, 102, 100, 99, 105, 112, 116,
+ 126, 127, 139, 139, 148, 150, 156, 160, 114, 105, 104, 102, 101, 107,
+ 113, 117, 128, 129, 141, 141, 151, 153, 159, 164, 116, 107, 106, 103,
+ 102, 108, 114, 118, 129, 130, 142, 142, 152, 155, 161, 166, 120, 110,
+ 109, 106, 105, 111, 117, 121, 131, 132, 145, 145, 155, 158, 165, 170,
+ 120, 111, 110, 107, 106, 111, 118, 121, 131, 133, 146, 146, 156, 159,
+ 166, 171, 127, 117, 115, 112, 110, 116, 121, 125, 135, 136, 150, 150,
+ 161, 164, 172, 178, 127, 117, 115, 112, 110, 116, 121, 125, 135, 136,
+ 150, 150, 161, 164, 172, 178,
+ /* Size 32x16 */
+ 64, 63, 63, 61, 61, 64, 67, 69, 74, 75, 84, 84, 95, 98, 97, 97, 97, 98,
+ 98, 101, 101, 104, 104, 107, 109, 111, 114, 116, 120, 120, 127, 127, 62,
+ 63, 63, 64, 64, 67, 71, 74, 80, 80, 86, 86, 92, 94, 93, 92, 92, 91, 92,
+ 94, 94, 96, 97, 100, 101, 103, 105, 107, 110, 111, 117, 117, 62, 63, 63,
+ 64, 64, 68, 72, 74, 80, 81, 86, 86, 92, 93, 92, 92, 91, 91, 91, 93, 93,
+ 96, 96, 99, 100, 102, 104, 106, 109, 110, 115, 115, 70, 72, 72, 74, 74,
+ 78, 81, 84, 90, 90, 92, 92, 95, 95, 94, 93, 92, 91, 92, 93, 93, 95, 95,
+ 97, 98, 100, 102, 103, 106, 107, 112, 112, 74, 77, 77, 79, 80, 83, 86,
+ 89, 94, 94, 95, 95, 96, 96, 95, 94, 93, 92, 92, 93, 93, 94, 95, 97, 98,
+ 99, 101, 102, 105, 106, 110, 110, 84, 85, 85, 85, 85, 88, 90, 91, 95,
+ 95, 97, 97, 100, 101, 100, 100, 99, 99, 99, 100, 100, 101, 101, 103,
+ 104, 105, 107, 108, 111, 111, 116, 116, 96, 94, 94, 93, 92, 93, 94, 94,
+ 95, 96, 100, 100, 105, 106, 106, 106, 106, 107, 107, 108, 108, 109, 109,
+ 110, 111, 112, 113, 114, 117, 118, 121, 121, 97, 95, 94, 92, 92, 92, 93,
+ 94, 94, 95, 100, 100, 105, 106, 107, 108, 108, 110, 110, 111, 111, 112,
+ 112, 114, 115, 116, 117, 118, 121, 121, 125, 125, 98, 95, 94, 92, 91,
+ 91, 92, 91, 91, 92, 99, 99, 106, 107, 110, 112, 114, 117, 117, 119, 119,
+ 122, 122, 124, 125, 126, 128, 129, 131, 131, 135, 135, 99, 95, 95, 92,
+ 91, 91, 92, 92, 92, 92, 99, 99, 106, 108, 110, 112, 114, 118, 118, 120,
+ 120, 123, 123, 125, 126, 127, 129, 130, 132, 133, 136, 136, 105, 100,
+ 100, 97, 96, 96, 95, 95, 94, 95, 101, 101, 107, 109, 113, 115, 118, 123,
+ 124, 128, 128, 133, 133, 136, 137, 139, 141, 142, 145, 146, 150, 150,
+ 105, 100, 100, 97, 96, 96, 95, 95, 94, 95, 101, 101, 107, 109, 113, 115,
+ 118, 123, 124, 128, 128, 133, 133, 136, 137, 139, 141, 142, 145, 146,
+ 150, 150, 112, 108, 107, 104, 102, 102, 101, 100, 99, 99, 106, 106, 111,
+ 113, 116, 119, 122, 127, 128, 133, 133, 139, 140, 143, 145, 148, 151,
+ 152, 155, 156, 161, 161, 115, 109, 109, 105, 104, 103, 103, 102, 100,
+ 101, 107, 107, 112, 114, 117, 120, 123, 128, 129, 134, 134, 141, 142,
+ 145, 147, 150, 153, 155, 158, 159, 164, 164, 122, 116, 115, 112, 110,
+ 109, 108, 107, 105, 106, 112, 112, 117, 118, 122, 124, 127, 132, 133,
+ 139, 139, 145, 146, 150, 152, 156, 159, 161, 165, 166, 172, 172, 127,
+ 121, 120, 116, 115, 114, 112, 111, 109, 110, 115, 115, 120, 121, 125,
+ 128, 130, 135, 136, 142, 142, 149, 150, 154, 156, 160, 164, 166, 170,
+ 171, 178, 178,
+ /* Size 4x16 */
+ 62, 84, 99, 115, 63, 85, 95, 109, 64, 85, 91, 104, 71, 90, 92, 103, 80,
+ 95, 92, 100, 86, 97, 99, 107, 92, 100, 106, 112, 93, 100, 110, 117, 92,
+ 99, 114, 123, 92, 99, 118, 129, 94, 100, 120, 134, 97, 101, 123, 142,
+ 101, 104, 126, 147, 105, 107, 129, 153, 110, 111, 132, 158, 117, 116,
+ 136, 164,
+ /* Size 16x4 */
+ 62, 63, 64, 71, 80, 86, 92, 93, 92, 92, 94, 97, 101, 105, 110, 117, 84,
+ 85, 85, 90, 95, 97, 100, 100, 99, 99, 100, 101, 104, 107, 111, 116, 99,
+ 95, 91, 92, 92, 99, 106, 110, 114, 118, 120, 123, 126, 129, 132, 136,
+ 115, 109, 104, 103, 100, 107, 112, 117, 123, 129, 134, 142, 147, 153,
+ 158, 164,
+ /* Size 8x32 */
+ 64, 62, 74, 96, 98, 105, 112, 122, 63, 63, 77, 94, 95, 100, 108, 116,
+ 63, 63, 77, 94, 94, 100, 107, 115, 61, 64, 79, 93, 92, 97, 104, 112, 61,
+ 64, 80, 92, 91, 96, 102, 110, 64, 68, 83, 93, 91, 96, 102, 109, 67, 72,
+ 86, 94, 92, 95, 101, 108, 69, 74, 89, 94, 91, 95, 100, 107, 74, 80, 94,
+ 95, 91, 94, 99, 105, 75, 81, 94, 96, 92, 95, 99, 106, 84, 86, 95, 100,
+ 99, 101, 106, 112, 84, 86, 95, 100, 99, 101, 106, 112, 95, 92, 96, 105,
+ 106, 107, 111, 117, 98, 93, 96, 106, 107, 109, 113, 118, 97, 92, 95,
+ 106, 110, 113, 116, 122, 97, 92, 94, 106, 112, 115, 119, 124, 97, 91,
+ 93, 106, 114, 118, 122, 127, 98, 91, 92, 107, 117, 123, 127, 132, 98,
+ 91, 92, 107, 117, 124, 128, 133, 101, 93, 93, 108, 119, 128, 133, 139,
+ 101, 93, 93, 108, 119, 128, 133, 139, 104, 96, 94, 109, 122, 133, 139,
+ 145, 104, 96, 95, 109, 122, 133, 140, 146, 107, 99, 97, 110, 124, 136,
+ 143, 150, 109, 100, 98, 111, 125, 137, 145, 152, 111, 102, 99, 112, 126,
+ 139, 148, 156, 114, 104, 101, 113, 128, 141, 151, 159, 116, 106, 102,
+ 114, 129, 142, 152, 161, 120, 109, 105, 117, 131, 145, 155, 165, 120,
+ 110, 106, 118, 131, 146, 156, 166, 127, 115, 110, 121, 135, 150, 161,
+ 172, 127, 115, 110, 121, 135, 150, 161, 172,
+ /* Size 32x8 */
+ 64, 63, 63, 61, 61, 64, 67, 69, 74, 75, 84, 84, 95, 98, 97, 97, 97, 98,
+ 98, 101, 101, 104, 104, 107, 109, 111, 114, 116, 120, 120, 127, 127, 62,
+ 63, 63, 64, 64, 68, 72, 74, 80, 81, 86, 86, 92, 93, 92, 92, 91, 91, 91,
+ 93, 93, 96, 96, 99, 100, 102, 104, 106, 109, 110, 115, 115, 74, 77, 77,
+ 79, 80, 83, 86, 89, 94, 94, 95, 95, 96, 96, 95, 94, 93, 92, 92, 93, 93,
+ 94, 95, 97, 98, 99, 101, 102, 105, 106, 110, 110, 96, 94, 94, 93, 92,
+ 93, 94, 94, 95, 96, 100, 100, 105, 106, 106, 106, 106, 107, 107, 108,
+ 108, 109, 109, 110, 111, 112, 113, 114, 117, 118, 121, 121, 98, 95, 94,
+ 92, 91, 91, 92, 91, 91, 92, 99, 99, 106, 107, 110, 112, 114, 117, 117,
+ 119, 119, 122, 122, 124, 125, 126, 128, 129, 131, 131, 135, 135, 105,
+ 100, 100, 97, 96, 96, 95, 95, 94, 95, 101, 101, 107, 109, 113, 115, 118,
+ 123, 124, 128, 128, 133, 133, 136, 137, 139, 141, 142, 145, 146, 150,
+ 150, 112, 108, 107, 104, 102, 102, 101, 100, 99, 99, 106, 106, 111, 113,
+ 116, 119, 122, 127, 128, 133, 133, 139, 140, 143, 145, 148, 151, 152,
+ 155, 156, 161, 161, 122, 116, 115, 112, 110, 109, 108, 107, 105, 106,
+ 112, 112, 117, 118, 122, 124, 127, 132, 133, 139, 139, 145, 146, 150,
+ 152, 156, 159, 161, 165, 166, 172, 172 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 67, 94, 94, 150,
+#endif
+ /* Size 4x4 */
+ 64, 67, 84, 111, 67, 77, 93, 115, 84, 93, 127, 151, 111, 115, 151, 184,
+ /* Size 8x8 */
+ 63, 64, 64, 69, 77, 92, 104, 126, 64, 65, 65, 68, 75, 88, 99, 119, 64,
+ 65, 71, 75, 81, 90, 99, 116, 69, 68, 75, 85, 94, 105, 113, 130, 77, 75,
+ 81, 94, 108, 121, 130, 147, 92, 88, 90, 105, 121, 139, 151, 168, 104,
+ 99, 99, 113, 130, 151, 165, 185, 126, 119, 116, 130, 147, 168, 185, 210,
+ /* Size 16x16 */
+ 64, 63, 63, 63, 64, 64, 68, 72, 77, 82, 88, 97, 108, 116, 123, 131, 63,
+ 64, 64, 64, 64, 65, 68, 70, 76, 80, 85, 93, 103, 111, 117, 125, 63, 64,
+ 65, 65, 65, 65, 67, 69, 74, 77, 82, 89, 99, 106, 112, 119, 63, 64, 65,
+ 66, 67, 67, 70, 72, 76, 80, 84, 91, 99, 106, 112, 119, 64, 64, 65, 67,
+ 68, 69, 72, 74, 78, 81, 85, 91, 99, 106, 111, 118, 64, 65, 65, 67, 69,
+ 71, 74, 77, 80, 83, 85, 92, 99, 105, 110, 116, 68, 68, 67, 70, 72, 74,
+ 79, 85, 89, 92, 95, 102, 109, 115, 120, 126, 72, 70, 69, 72, 74, 77, 85,
+ 97, 101, 104, 108, 114, 120, 126, 131, 136, 77, 76, 74, 76, 78, 80, 89,
+ 101, 105, 109, 114, 121, 128, 134, 139, 144, 82, 80, 77, 80, 81, 83, 92,
+ 104, 109, 114, 120, 127, 135, 141, 146, 151, 88, 85, 82, 84, 85, 85, 95,
+ 108, 114, 120, 127, 134, 143, 149, 154, 159, 97, 93, 89, 91, 91, 92,
+ 102, 114, 121, 127, 134, 142, 153, 159, 165, 171, 108, 103, 99, 99, 99,
+ 99, 109, 120, 128, 135, 143, 153, 165, 172, 178, 185, 116, 111, 106,
+ 106, 106, 105, 115, 126, 134, 141, 149, 159, 172, 180, 187, 194, 123,
+ 117, 112, 112, 111, 110, 120, 131, 139, 146, 154, 165, 178, 187, 194,
+ 202, 131, 125, 119, 119, 118, 116, 126, 136, 144, 151, 159, 171, 185,
+ 194, 202, 210,
+ /* Size 32x32 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 67, 68, 69, 72, 72, 77, 79,
+ 82, 88, 88, 95, 97, 101, 108, 108, 116, 118, 123, 131, 131, 140, 63, 63,
+ 63, 64, 64, 64, 64, 64, 64, 64, 64, 67, 68, 69, 71, 71, 76, 77, 80, 85,
+ 85, 92, 94, 98, 104, 104, 112, 114, 118, 126, 126, 135, 63, 63, 64, 64,
+ 64, 64, 64, 64, 64, 65, 65, 67, 68, 69, 70, 70, 76, 77, 80, 85, 85, 91,
+ 93, 97, 103, 103, 111, 113, 117, 125, 125, 134, 63, 64, 64, 64, 64, 64,
+ 65, 65, 65, 65, 65, 67, 68, 68, 70, 70, 75, 76, 79, 84, 84, 90, 91, 95,
+ 101, 101, 109, 111, 115, 122, 122, 131, 63, 64, 64, 64, 65, 65, 65, 65,
+ 65, 65, 65, 67, 67, 68, 69, 69, 74, 75, 77, 82, 82, 88, 89, 93, 99, 99,
+ 106, 108, 112, 119, 119, 128, 63, 64, 64, 64, 65, 65, 65, 65, 65, 65,
+ 65, 67, 67, 68, 69, 69, 74, 75, 77, 82, 82, 88, 89, 93, 99, 99, 106,
+ 108, 112, 119, 119, 128, 63, 64, 64, 65, 65, 65, 66, 66, 67, 67, 67, 69,
+ 70, 71, 72, 72, 76, 78, 80, 84, 84, 89, 91, 94, 99, 99, 106, 108, 112,
+ 119, 119, 127, 63, 64, 64, 65, 65, 65, 66, 67, 67, 68, 68, 70, 71, 72,
+ 73, 73, 77, 78, 81, 84, 84, 90, 91, 94, 100, 100, 106, 108, 112, 118,
+ 118, 127, 64, 64, 64, 65, 65, 65, 67, 67, 68, 69, 69, 71, 72, 73, 74,
+ 74, 78, 79, 81, 85, 85, 90, 91, 94, 99, 99, 106, 108, 111, 118, 118,
+ 126, 64, 64, 65, 65, 65, 65, 67, 68, 69, 71, 71, 73, 74, 75, 77, 77, 80,
+ 81, 83, 85, 85, 90, 92, 94, 99, 99, 105, 107, 110, 116, 116, 124, 64,
+ 64, 65, 65, 65, 65, 67, 68, 69, 71, 71, 73, 74, 75, 77, 77, 80, 81, 83,
+ 85, 85, 90, 92, 94, 99, 99, 105, 107, 110, 116, 116, 124, 67, 67, 67,
+ 67, 67, 67, 69, 70, 71, 73, 73, 77, 78, 80, 84, 84, 87, 88, 90, 93, 93,
+ 98, 100, 102, 107, 107, 113, 115, 118, 124, 124, 132, 68, 68, 68, 68,
+ 67, 67, 70, 71, 72, 74, 74, 78, 79, 82, 85, 85, 89, 90, 92, 95, 95, 100,
+ 102, 105, 109, 109, 115, 117, 120, 126, 126, 134, 69, 69, 69, 68, 68,
+ 68, 71, 72, 73, 75, 75, 80, 82, 85, 90, 90, 93, 94, 97, 100, 100, 105,
+ 106, 109, 113, 113, 119, 121, 124, 130, 130, 138, 72, 71, 70, 70, 69,
+ 69, 72, 73, 74, 77, 77, 84, 85, 90, 97, 97, 101, 101, 104, 108, 108,
+ 112, 114, 116, 120, 120, 126, 128, 131, 136, 136, 144, 72, 71, 70, 70,
+ 69, 69, 72, 73, 74, 77, 77, 84, 85, 90, 97, 97, 101, 101, 104, 108, 108,
+ 112, 114, 116, 120, 120, 126, 128, 131, 136, 136, 144, 77, 76, 76, 75,
+ 74, 74, 76, 77, 78, 80, 80, 87, 89, 93, 101, 101, 105, 106, 109, 114,
+ 114, 119, 121, 123, 128, 128, 134, 136, 139, 144, 144, 152, 79, 77, 77,
+ 76, 75, 75, 78, 78, 79, 81, 81, 88, 90, 94, 101, 101, 106, 108, 111,
+ 116, 116, 121, 122, 125, 130, 130, 136, 138, 141, 147, 147, 154, 82, 80,
+ 80, 79, 77, 77, 80, 81, 81, 83, 83, 90, 92, 97, 104, 104, 109, 111, 114,
+ 120, 120, 125, 127, 130, 135, 135, 141, 143, 146, 151, 151, 159, 88, 85,
+ 85, 84, 82, 82, 84, 84, 85, 85, 85, 93, 95, 100, 108, 108, 114, 116,
+ 120, 127, 127, 133, 134, 137, 143, 143, 149, 151, 154, 159, 159, 167,
+ 88, 85, 85, 84, 82, 82, 84, 84, 85, 85, 85, 93, 95, 100, 108, 108, 114,
+ 116, 120, 127, 127, 133, 134, 137, 143, 143, 149, 151, 154, 159, 159,
+ 167, 95, 92, 91, 90, 88, 88, 89, 90, 90, 90, 90, 98, 100, 105, 112, 112,
+ 119, 121, 125, 133, 133, 139, 141, 144, 151, 151, 157, 159, 163, 168,
+ 168, 176, 97, 94, 93, 91, 89, 89, 91, 91, 91, 92, 92, 100, 102, 106,
+ 114, 114, 121, 122, 127, 134, 134, 141, 142, 146, 153, 153, 159, 161,
+ 165, 171, 171, 179, 101, 98, 97, 95, 93, 93, 94, 94, 94, 94, 94, 102,
+ 105, 109, 116, 116, 123, 125, 130, 137, 137, 144, 146, 150, 157, 157,
+ 164, 166, 170, 176, 176, 184, 108, 104, 103, 101, 99, 99, 99, 100, 99,
+ 99, 99, 107, 109, 113, 120, 120, 128, 130, 135, 143, 143, 151, 153, 157,
+ 165, 165, 172, 174, 178, 185, 185, 193, 108, 104, 103, 101, 99, 99, 99,
+ 100, 99, 99, 99, 107, 109, 113, 120, 120, 128, 130, 135, 143, 143, 151,
+ 153, 157, 165, 165, 172, 174, 178, 185, 185, 193, 116, 112, 111, 109,
+ 106, 106, 106, 106, 106, 105, 105, 113, 115, 119, 126, 126, 134, 136,
+ 141, 149, 149, 157, 159, 164, 172, 172, 180, 182, 187, 194, 194, 203,
+ 118, 114, 113, 111, 108, 108, 108, 108, 108, 107, 107, 115, 117, 121,
+ 128, 128, 136, 138, 143, 151, 151, 159, 161, 166, 174, 174, 182, 184,
+ 189, 196, 196, 205, 123, 118, 117, 115, 112, 112, 112, 112, 111, 110,
+ 110, 118, 120, 124, 131, 131, 139, 141, 146, 154, 154, 163, 165, 170,
+ 178, 178, 187, 189, 194, 202, 202, 211, 131, 126, 125, 122, 119, 119,
+ 119, 118, 118, 116, 116, 124, 126, 130, 136, 136, 144, 147, 151, 159,
+ 159, 168, 171, 176, 185, 185, 194, 196, 202, 210, 210, 219, 131, 126,
+ 125, 122, 119, 119, 119, 118, 118, 116, 116, 124, 126, 130, 136, 136,
+ 144, 147, 151, 159, 159, 168, 171, 176, 185, 185, 194, 196, 202, 210,
+ 210, 219, 140, 135, 134, 131, 128, 128, 127, 127, 126, 124, 124, 132,
+ 134, 138, 144, 144, 152, 154, 159, 167, 167, 176, 179, 184, 193, 193,
+ 203, 205, 211, 219, 219, 229,
+ /* Size 4x8 */
+ 64, 65, 85, 112, 64, 66, 82, 106, 65, 71, 85, 105, 69, 75, 100, 119, 76,
+ 81, 116, 136, 89, 91, 132, 157, 101, 100, 142, 172, 122, 117, 159, 194,
+ /* Size 8x4 */
+ 64, 64, 65, 69, 76, 89, 101, 122, 65, 66, 71, 75, 81, 91, 100, 117, 85,
+ 82, 85, 100, 116, 132, 142, 159, 112, 106, 105, 119, 136, 157, 172, 194,
+ /* Size 8x16 */
+ 64, 63, 64, 70, 78, 88, 107, 131, 63, 64, 65, 70, 76, 85, 103, 124, 63,
+ 65, 66, 68, 74, 82, 99, 119, 63, 65, 68, 71, 77, 84, 99, 118, 64, 65,
+ 69, 73, 78, 85, 99, 117, 64, 66, 71, 75, 80, 85, 99, 116, 68, 68, 74,
+ 83, 89, 96, 109, 126, 72, 69, 77, 92, 100, 108, 120, 136, 77, 74, 81,
+ 95, 105, 114, 128, 144, 82, 78, 83, 99, 109, 120, 135, 152, 88, 82, 86,
+ 102, 114, 126, 143, 159, 96, 90, 93, 108, 120, 134, 152, 171, 107, 99,
+ 100, 115, 128, 142, 164, 185, 115, 106, 106, 121, 134, 149, 172, 194,
+ 122, 113, 112, 126, 139, 154, 178, 201, 130, 120, 117, 132, 144, 159,
+ 185, 210,
+ /* Size 16x8 */
+ 64, 63, 63, 63, 64, 64, 68, 72, 77, 82, 88, 96, 107, 115, 122, 130, 63,
+ 64, 65, 65, 65, 66, 68, 69, 74, 78, 82, 90, 99, 106, 113, 120, 64, 65,
+ 66, 68, 69, 71, 74, 77, 81, 83, 86, 93, 100, 106, 112, 117, 70, 70, 68,
+ 71, 73, 75, 83, 92, 95, 99, 102, 108, 115, 121, 126, 132, 78, 76, 74,
+ 77, 78, 80, 89, 100, 105, 109, 114, 120, 128, 134, 139, 144, 88, 85, 82,
+ 84, 85, 85, 96, 108, 114, 120, 126, 134, 142, 149, 154, 159, 107, 103,
+ 99, 99, 99, 99, 109, 120, 128, 135, 143, 152, 164, 172, 178, 185, 131,
+ 124, 119, 118, 117, 116, 126, 136, 144, 152, 159, 171, 185, 194, 201,
+ 210,
+ /* Size 16x32 */
+ 64, 63, 63, 63, 64, 64, 70, 72, 78, 88, 88, 103, 107, 116, 131, 131, 63,
+ 64, 64, 64, 65, 65, 70, 71, 76, 85, 85, 99, 104, 112, 126, 126, 63, 64,
+ 64, 64, 65, 65, 70, 71, 76, 85, 85, 99, 103, 111, 124, 124, 63, 64, 64,
+ 65, 65, 65, 69, 70, 75, 83, 83, 97, 101, 109, 122, 122, 63, 64, 65, 65,
+ 66, 66, 68, 69, 74, 82, 82, 95, 99, 106, 119, 119, 63, 64, 65, 65, 66,
+ 66, 68, 69, 74, 82, 82, 95, 99, 106, 119, 119, 63, 65, 65, 66, 68, 68,
+ 71, 72, 77, 84, 84, 96, 99, 106, 118, 118, 64, 65, 65, 66, 68, 68, 72,
+ 73, 77, 84, 84, 96, 100, 106, 118, 118, 64, 65, 65, 67, 69, 69, 73, 75,
+ 78, 85, 85, 96, 99, 106, 117, 117, 64, 65, 66, 68, 71, 71, 75, 77, 80,
+ 85, 85, 96, 99, 105, 116, 116, 64, 65, 66, 68, 71, 71, 75, 77, 80, 85,
+ 85, 96, 99, 105, 116, 116, 67, 67, 67, 70, 73, 73, 81, 83, 87, 93, 93,
+ 104, 107, 113, 124, 124, 68, 68, 68, 70, 74, 74, 83, 85, 89, 96, 96,
+ 106, 109, 115, 126, 126, 69, 69, 68, 71, 75, 75, 86, 89, 93, 100, 100,
+ 110, 113, 119, 130, 130, 72, 70, 69, 72, 77, 77, 92, 96, 100, 108, 108,
+ 117, 120, 126, 136, 136, 72, 70, 69, 72, 77, 77, 92, 96, 100, 108, 108,
+ 117, 120, 126, 136, 136, 77, 75, 74, 77, 81, 81, 95, 100, 105, 114, 114,
+ 125, 128, 134, 144, 144, 79, 76, 75, 78, 81, 81, 96, 101, 106, 116, 116,
+ 127, 130, 136, 147, 147, 82, 79, 78, 80, 83, 83, 99, 103, 109, 120, 120,
+ 132, 135, 141, 152, 152, 88, 83, 82, 84, 86, 86, 102, 107, 114, 126,
+ 126, 139, 143, 149, 159, 159, 88, 83, 82, 84, 86, 86, 102, 107, 114,
+ 126, 126, 139, 143, 149, 159, 159, 94, 89, 88, 89, 91, 91, 107, 112,
+ 119, 132, 132, 146, 150, 157, 168, 168, 96, 91, 90, 91, 93, 93, 108,
+ 113, 120, 134, 134, 148, 152, 159, 171, 171, 100, 95, 93, 94, 95, 95,
+ 111, 116, 123, 137, 137, 152, 157, 164, 176, 176, 107, 101, 99, 100,
+ 100, 100, 115, 120, 128, 142, 142, 159, 164, 172, 185, 185, 107, 101,
+ 99, 100, 100, 100, 115, 120, 128, 142, 142, 159, 164, 172, 185, 185,
+ 115, 108, 106, 106, 106, 106, 121, 126, 134, 149, 149, 166, 172, 180,
+ 194, 194, 117, 110, 108, 108, 108, 108, 123, 127, 136, 150, 150, 168,
+ 174, 182, 196, 196, 122, 114, 113, 112, 112, 112, 126, 131, 139, 154,
+ 154, 172, 178, 187, 201, 201, 130, 122, 120, 119, 117, 117, 132, 136,
+ 144, 159, 159, 179, 185, 194, 210, 210, 130, 122, 120, 119, 117, 117,
+ 132, 136, 144, 159, 159, 179, 185, 194, 210, 210, 140, 130, 128, 127,
+ 125, 125, 140, 144, 152, 167, 167, 187, 193, 203, 219, 219,
+ /* Size 32x16 */
+ 64, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 67, 68, 69, 72, 72, 77, 79,
+ 82, 88, 88, 94, 96, 100, 107, 107, 115, 117, 122, 130, 130, 140, 63, 64,
+ 64, 64, 64, 64, 65, 65, 65, 65, 65, 67, 68, 69, 70, 70, 75, 76, 79, 83,
+ 83, 89, 91, 95, 101, 101, 108, 110, 114, 122, 122, 130, 63, 64, 64, 64,
+ 65, 65, 65, 65, 65, 66, 66, 67, 68, 68, 69, 69, 74, 75, 78, 82, 82, 88,
+ 90, 93, 99, 99, 106, 108, 113, 120, 120, 128, 63, 64, 64, 65, 65, 65,
+ 66, 66, 67, 68, 68, 70, 70, 71, 72, 72, 77, 78, 80, 84, 84, 89, 91, 94,
+ 100, 100, 106, 108, 112, 119, 119, 127, 64, 65, 65, 65, 66, 66, 68, 68,
+ 69, 71, 71, 73, 74, 75, 77, 77, 81, 81, 83, 86, 86, 91, 93, 95, 100,
+ 100, 106, 108, 112, 117, 117, 125, 64, 65, 65, 65, 66, 66, 68, 68, 69,
+ 71, 71, 73, 74, 75, 77, 77, 81, 81, 83, 86, 86, 91, 93, 95, 100, 100,
+ 106, 108, 112, 117, 117, 125, 70, 70, 70, 69, 68, 68, 71, 72, 73, 75,
+ 75, 81, 83, 86, 92, 92, 95, 96, 99, 102, 102, 107, 108, 111, 115, 115,
+ 121, 123, 126, 132, 132, 140, 72, 71, 71, 70, 69, 69, 72, 73, 75, 77,
+ 77, 83, 85, 89, 96, 96, 100, 101, 103, 107, 107, 112, 113, 116, 120,
+ 120, 126, 127, 131, 136, 136, 144, 78, 76, 76, 75, 74, 74, 77, 77, 78,
+ 80, 80, 87, 89, 93, 100, 100, 105, 106, 109, 114, 114, 119, 120, 123,
+ 128, 128, 134, 136, 139, 144, 144, 152, 88, 85, 85, 83, 82, 82, 84, 84,
+ 85, 85, 85, 93, 96, 100, 108, 108, 114, 116, 120, 126, 126, 132, 134,
+ 137, 142, 142, 149, 150, 154, 159, 159, 167, 88, 85, 85, 83, 82, 82, 84,
+ 84, 85, 85, 85, 93, 96, 100, 108, 108, 114, 116, 120, 126, 126, 132,
+ 134, 137, 142, 142, 149, 150, 154, 159, 159, 167, 103, 99, 99, 97, 95,
+ 95, 96, 96, 96, 96, 96, 104, 106, 110, 117, 117, 125, 127, 132, 139,
+ 139, 146, 148, 152, 159, 159, 166, 168, 172, 179, 179, 187, 107, 104,
+ 103, 101, 99, 99, 99, 100, 99, 99, 99, 107, 109, 113, 120, 120, 128,
+ 130, 135, 143, 143, 150, 152, 157, 164, 164, 172, 174, 178, 185, 185,
+ 193, 116, 112, 111, 109, 106, 106, 106, 106, 106, 105, 105, 113, 115,
+ 119, 126, 126, 134, 136, 141, 149, 149, 157, 159, 164, 172, 172, 180,
+ 182, 187, 194, 194, 203, 131, 126, 124, 122, 119, 119, 118, 118, 117,
+ 116, 116, 124, 126, 130, 136, 136, 144, 147, 152, 159, 159, 168, 171,
+ 176, 185, 185, 194, 196, 201, 210, 210, 219, 131, 126, 124, 122, 119,
+ 119, 118, 118, 117, 116, 116, 124, 126, 130, 136, 136, 144, 147, 152,
+ 159, 159, 168, 171, 176, 185, 185, 194, 196, 201, 210, 210, 219,
+ /* Size 4x16 */
+ 63, 64, 88, 116, 64, 65, 85, 111, 64, 66, 82, 106, 65, 68, 84, 106, 65,
+ 69, 85, 106, 65, 71, 85, 105, 68, 74, 96, 115, 70, 77, 108, 126, 75, 81,
+ 114, 134, 79, 83, 120, 141, 83, 86, 126, 149, 91, 93, 134, 159, 101,
+ 100, 142, 172, 108, 106, 149, 180, 114, 112, 154, 187, 122, 117, 159,
+ 194,
+ /* Size 16x4 */
+ 63, 64, 64, 65, 65, 65, 68, 70, 75, 79, 83, 91, 101, 108, 114, 122, 64,
+ 65, 66, 68, 69, 71, 74, 77, 81, 83, 86, 93, 100, 106, 112, 117, 88, 85,
+ 82, 84, 85, 85, 96, 108, 114, 120, 126, 134, 142, 149, 154, 159, 116,
+ 111, 106, 106, 106, 105, 115, 126, 134, 141, 149, 159, 172, 180, 187,
+ 194,
+ /* Size 8x32 */
+ 64, 63, 64, 70, 78, 88, 107, 131, 63, 64, 65, 70, 76, 85, 104, 126, 63,
+ 64, 65, 70, 76, 85, 103, 124, 63, 64, 65, 69, 75, 83, 101, 122, 63, 65,
+ 66, 68, 74, 82, 99, 119, 63, 65, 66, 68, 74, 82, 99, 119, 63, 65, 68,
+ 71, 77, 84, 99, 118, 64, 65, 68, 72, 77, 84, 100, 118, 64, 65, 69, 73,
+ 78, 85, 99, 117, 64, 66, 71, 75, 80, 85, 99, 116, 64, 66, 71, 75, 80,
+ 85, 99, 116, 67, 67, 73, 81, 87, 93, 107, 124, 68, 68, 74, 83, 89, 96,
+ 109, 126, 69, 68, 75, 86, 93, 100, 113, 130, 72, 69, 77, 92, 100, 108,
+ 120, 136, 72, 69, 77, 92, 100, 108, 120, 136, 77, 74, 81, 95, 105, 114,
+ 128, 144, 79, 75, 81, 96, 106, 116, 130, 147, 82, 78, 83, 99, 109, 120,
+ 135, 152, 88, 82, 86, 102, 114, 126, 143, 159, 88, 82, 86, 102, 114,
+ 126, 143, 159, 94, 88, 91, 107, 119, 132, 150, 168, 96, 90, 93, 108,
+ 120, 134, 152, 171, 100, 93, 95, 111, 123, 137, 157, 176, 107, 99, 100,
+ 115, 128, 142, 164, 185, 107, 99, 100, 115, 128, 142, 164, 185, 115,
+ 106, 106, 121, 134, 149, 172, 194, 117, 108, 108, 123, 136, 150, 174,
+ 196, 122, 113, 112, 126, 139, 154, 178, 201, 130, 120, 117, 132, 144,
+ 159, 185, 210, 130, 120, 117, 132, 144, 159, 185, 210, 140, 128, 125,
+ 140, 152, 167, 193, 219,
+ /* Size 32x8 */
+ 64, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 67, 68, 69, 72, 72, 77, 79,
+ 82, 88, 88, 94, 96, 100, 107, 107, 115, 117, 122, 130, 130, 140, 63, 64,
+ 64, 64, 65, 65, 65, 65, 65, 66, 66, 67, 68, 68, 69, 69, 74, 75, 78, 82,
+ 82, 88, 90, 93, 99, 99, 106, 108, 113, 120, 120, 128, 64, 65, 65, 65,
+ 66, 66, 68, 68, 69, 71, 71, 73, 74, 75, 77, 77, 81, 81, 83, 86, 86, 91,
+ 93, 95, 100, 100, 106, 108, 112, 117, 117, 125, 70, 70, 70, 69, 68, 68,
+ 71, 72, 73, 75, 75, 81, 83, 86, 92, 92, 95, 96, 99, 102, 102, 107, 108,
+ 111, 115, 115, 121, 123, 126, 132, 132, 140, 78, 76, 76, 75, 74, 74, 77,
+ 77, 78, 80, 80, 87, 89, 93, 100, 100, 105, 106, 109, 114, 114, 119, 120,
+ 123, 128, 128, 134, 136, 139, 144, 144, 152, 88, 85, 85, 83, 82, 82, 84,
+ 84, 85, 85, 85, 93, 96, 100, 108, 108, 114, 116, 120, 126, 126, 132,
+ 134, 137, 142, 142, 149, 150, 154, 159, 159, 167, 107, 104, 103, 101,
+ 99, 99, 99, 100, 99, 99, 99, 107, 109, 113, 120, 120, 128, 130, 135,
+ 143, 143, 150, 152, 157, 164, 164, 172, 174, 178, 185, 185, 193, 131,
+ 126, 124, 122, 119, 119, 118, 118, 117, 116, 116, 124, 126, 130, 136,
+ 136, 144, 147, 152, 159, 159, 168, 171, 176, 185, 185, 194, 196, 201,
+ 210, 210, 219 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 78, 94, 94, 127,
+#endif
+ /* Size 4x4 */
+ 63, 83, 92, 102, 83, 96, 97, 102, 92, 97, 117, 125, 102, 102, 125, 142,
+ /* Size 8x8 */
+ 63, 62, 76, 89, 95, 97, 101, 110, 62, 64, 80, 88, 91, 92, 95, 104, 76,
+ 80, 95, 95, 93, 92, 94, 100, 89, 88, 95, 100, 102, 103, 104, 109, 95,
+ 91, 93, 102, 109, 113, 115, 120, 97, 92, 92, 103, 113, 122, 126, 133,
+ 101, 95, 94, 104, 115, 126, 133, 141, 110, 104, 100, 109, 120, 133, 141,
+ 153,
+ /* Size 16x16 */
+ 64, 62, 61, 66, 69, 73, 83, 98, 97, 98, 98, 101, 104, 108, 111, 114, 62,
+ 63, 62, 68, 72, 77, 85, 95, 94, 94, 94, 97, 100, 103, 106, 109, 61, 62,
+ 64, 69, 74, 80, 85, 93, 91, 91, 90, 93, 95, 99, 101, 104, 66, 68, 69,
+ 75, 80, 85, 89, 94, 93, 92, 91, 93, 95, 98, 100, 103, 69, 72, 74, 80,
+ 85, 90, 92, 95, 93, 92, 91, 93, 94, 97, 99, 101, 73, 77, 80, 85, 90, 95,
+ 95, 96, 94, 92, 91, 92, 94, 96, 98, 100, 83, 85, 85, 89, 92, 95, 97,
+ 101, 100, 99, 98, 100, 101, 103, 105, 107, 98, 95, 93, 94, 95, 96, 101,
+ 106, 106, 107, 107, 108, 109, 111, 112, 113, 97, 94, 91, 93, 93, 94,
+ 100, 106, 108, 109, 111, 112, 114, 116, 117, 118, 98, 94, 91, 92, 92,
+ 92, 99, 107, 109, 111, 114, 116, 118, 120, 121, 123, 98, 94, 90, 91, 91,
+ 91, 98, 107, 111, 114, 117, 120, 123, 124, 126, 127, 101, 97, 93, 93,
+ 93, 92, 100, 108, 112, 116, 120, 123, 127, 130, 132, 134, 104, 100, 95,
+ 95, 94, 94, 101, 109, 114, 118, 123, 127, 133, 136, 139, 141, 108, 103,
+ 99, 98, 97, 96, 103, 111, 116, 120, 124, 130, 136, 140, 143, 146, 111,
+ 106, 101, 100, 99, 98, 105, 112, 117, 121, 126, 132, 139, 143, 146, 149,
+ 114, 109, 104, 103, 101, 100, 107, 113, 118, 123, 127, 134, 141, 146,
+ 149, 153,
+ /* Size 32x32 */
+ 64, 63, 62, 62, 61, 61, 66, 67, 69, 73, 73, 81, 83, 89, 98, 98, 97, 97,
+ 98, 98, 98, 101, 101, 103, 104, 104, 108, 109, 111, 114, 114, 119, 63,
+ 63, 63, 62, 62, 62, 67, 69, 72, 76, 76, 83, 84, 89, 96, 96, 95, 95, 95,
+ 95, 95, 97, 98, 99, 101, 101, 104, 105, 107, 110, 110, 114, 62, 63, 63,
+ 63, 62, 62, 68, 69, 72, 77, 77, 83, 85, 89, 95, 95, 94, 94, 94, 94, 94,
+ 96, 97, 98, 100, 100, 103, 104, 106, 109, 109, 113, 62, 62, 63, 63, 63,
+ 63, 68, 70, 73, 78, 78, 83, 85, 88, 94, 94, 93, 93, 93, 92, 92, 95, 95,
+ 96, 98, 98, 101, 102, 104, 107, 107, 111, 61, 62, 62, 63, 64, 64, 69,
+ 71, 74, 80, 80, 84, 85, 88, 93, 93, 91, 91, 91, 90, 90, 92, 93, 94, 95,
+ 95, 99, 99, 101, 104, 104, 108, 61, 62, 62, 63, 64, 64, 69, 71, 74, 80,
+ 80, 84, 85, 88, 93, 93, 91, 91, 91, 90, 90, 92, 93, 94, 95, 95, 99, 99,
+ 101, 104, 104, 108, 66, 67, 68, 68, 69, 69, 75, 77, 80, 85, 85, 88, 89,
+ 91, 94, 94, 93, 92, 92, 91, 91, 93, 93, 94, 95, 95, 98, 99, 100, 103,
+ 103, 106, 67, 69, 69, 70, 71, 71, 77, 78, 81, 87, 87, 89, 90, 92, 95,
+ 95, 93, 93, 92, 91, 91, 93, 93, 94, 95, 95, 98, 99, 100, 102, 102, 106,
+ 69, 72, 72, 73, 74, 74, 80, 81, 85, 90, 90, 91, 92, 93, 95, 95, 93, 93,
+ 92, 91, 91, 92, 93, 94, 94, 94, 97, 98, 99, 101, 101, 105, 73, 76, 77,
+ 78, 80, 80, 85, 87, 90, 95, 95, 95, 95, 95, 96, 96, 94, 93, 92, 91, 91,
+ 92, 92, 93, 94, 94, 96, 97, 98, 100, 100, 103, 73, 76, 77, 78, 80, 80,
+ 85, 87, 90, 95, 95, 95, 95, 95, 96, 96, 94, 93, 92, 91, 91, 92, 92, 93,
+ 94, 94, 96, 97, 98, 100, 100, 103, 81, 83, 83, 83, 84, 84, 88, 89, 91,
+ 95, 95, 96, 97, 98, 100, 100, 98, 98, 98, 97, 97, 98, 98, 99, 99, 99,
+ 102, 102, 103, 105, 105, 108, 83, 84, 85, 85, 85, 85, 89, 90, 92, 95,
+ 95, 97, 97, 99, 101, 101, 100, 99, 99, 98, 98, 100, 100, 100, 101, 101,
+ 103, 104, 105, 107, 107, 110, 89, 89, 89, 88, 88, 88, 91, 92, 93, 95,
+ 95, 98, 99, 100, 103, 103, 102, 102, 102, 102, 102, 103, 103, 103, 104,
+ 104, 106, 107, 108, 109, 109, 112, 98, 96, 95, 94, 93, 93, 94, 95, 95,
+ 96, 96, 100, 101, 103, 106, 106, 106, 106, 107, 107, 107, 108, 108, 108,
+ 109, 109, 111, 111, 112, 113, 113, 116, 98, 96, 95, 94, 93, 93, 94, 95,
+ 95, 96, 96, 100, 101, 103, 106, 106, 106, 106, 107, 107, 107, 108, 108,
+ 108, 109, 109, 111, 111, 112, 113, 113, 116, 97, 95, 94, 93, 91, 91, 93,
+ 93, 93, 94, 94, 98, 100, 102, 106, 106, 108, 108, 109, 111, 111, 112,
+ 112, 113, 114, 114, 116, 116, 117, 118, 118, 121, 97, 95, 94, 93, 91,
+ 91, 92, 93, 93, 93, 93, 98, 99, 102, 106, 106, 108, 109, 110, 111, 111,
+ 113, 113, 114, 115, 115, 117, 117, 118, 120, 120, 123, 98, 95, 94, 93,
+ 91, 91, 92, 92, 92, 92, 92, 98, 99, 102, 107, 107, 109, 110, 111, 114,
+ 114, 115, 116, 116, 118, 118, 120, 120, 121, 123, 123, 126, 98, 95, 94,
+ 92, 90, 90, 91, 91, 91, 91, 91, 97, 98, 102, 107, 107, 111, 111, 114,
+ 117, 117, 119, 120, 121, 123, 123, 124, 125, 126, 127, 127, 130, 98, 95,
+ 94, 92, 90, 90, 91, 91, 91, 91, 91, 97, 98, 102, 107, 107, 111, 111,
+ 114, 117, 117, 119, 120, 121, 123, 123, 124, 125, 126, 127, 127, 130,
+ 101, 97, 96, 95, 92, 92, 93, 93, 92, 92, 92, 98, 100, 103, 108, 108,
+ 112, 113, 115, 119, 119, 122, 122, 124, 126, 126, 129, 129, 131, 133,
+ 133, 135, 101, 98, 97, 95, 93, 93, 93, 93, 93, 92, 92, 98, 100, 103,
+ 108, 108, 112, 113, 116, 120, 120, 122, 123, 125, 127, 127, 130, 130,
+ 132, 134, 134, 137, 103, 99, 98, 96, 94, 94, 94, 94, 94, 93, 93, 99,
+ 100, 103, 108, 108, 113, 114, 116, 121, 121, 124, 125, 127, 130, 130,
+ 132, 133, 134, 137, 137, 140, 104, 101, 100, 98, 95, 95, 95, 95, 94, 94,
+ 94, 99, 101, 104, 109, 109, 114, 115, 118, 123, 123, 126, 127, 130, 133,
+ 133, 136, 137, 139, 141, 141, 144, 104, 101, 100, 98, 95, 95, 95, 95,
+ 94, 94, 94, 99, 101, 104, 109, 109, 114, 115, 118, 123, 123, 126, 127,
+ 130, 133, 133, 136, 137, 139, 141, 141, 144, 108, 104, 103, 101, 99, 99,
+ 98, 98, 97, 96, 96, 102, 103, 106, 111, 111, 116, 117, 120, 124, 124,
+ 129, 130, 132, 136, 136, 140, 141, 143, 146, 146, 149, 109, 105, 104,
+ 102, 99, 99, 99, 99, 98, 97, 97, 102, 104, 107, 111, 111, 116, 117, 120,
+ 125, 125, 129, 130, 133, 137, 137, 141, 142, 144, 147, 147, 150, 111,
+ 107, 106, 104, 101, 101, 100, 100, 99, 98, 98, 103, 105, 108, 112, 112,
+ 117, 118, 121, 126, 126, 131, 132, 134, 139, 139, 143, 144, 146, 149,
+ 149, 153, 114, 110, 109, 107, 104, 104, 103, 102, 101, 100, 100, 105,
+ 107, 109, 113, 113, 118, 120, 123, 127, 127, 133, 134, 137, 141, 141,
+ 146, 147, 149, 153, 153, 157, 114, 110, 109, 107, 104, 104, 103, 102,
+ 101, 100, 100, 105, 107, 109, 113, 113, 118, 120, 123, 127, 127, 133,
+ 134, 137, 141, 141, 146, 147, 149, 153, 153, 157, 119, 114, 113, 111,
+ 108, 108, 106, 106, 105, 103, 103, 108, 110, 112, 116, 116, 121, 123,
+ 126, 130, 130, 135, 137, 140, 144, 144, 149, 150, 153, 157, 157, 161,
+ /* Size 4x8 */
+ 63, 76, 95, 104, 64, 80, 91, 99, 79, 94, 91, 96, 89, 95, 102, 106, 93,
+ 94, 112, 117, 94, 93, 119, 129, 97, 95, 122, 137, 106, 101, 128, 146,
+ /* Size 8x4 */
+ 63, 64, 79, 89, 93, 94, 97, 106, 76, 80, 94, 95, 94, 93, 95, 101, 95,
+ 91, 91, 102, 112, 119, 122, 128, 104, 99, 96, 106, 117, 129, 137, 146,
+ /* Size 8x16 */
+ 64, 62, 74, 91, 97, 98, 105, 115, 63, 63, 77, 90, 94, 94, 100, 109, 61,
+ 64, 80, 89, 91, 91, 96, 104, 66, 70, 85, 92, 93, 91, 95, 103, 70, 75,
+ 89, 93, 93, 91, 95, 102, 74, 80, 94, 95, 94, 91, 94, 100, 84, 86, 95,
+ 99, 100, 99, 101, 107, 98, 93, 96, 104, 106, 107, 109, 114, 97, 92, 94,
+ 103, 108, 111, 114, 119, 97, 91, 93, 103, 109, 114, 118, 123, 98, 91,
+ 92, 103, 111, 117, 123, 128, 101, 93, 93, 105, 112, 119, 128, 134, 104,
+ 96, 95, 106, 114, 122, 133, 142, 108, 99, 97, 108, 116, 124, 136, 146,
+ 111, 102, 99, 109, 117, 126, 139, 149, 114, 104, 101, 111, 119, 128,
+ 141, 153,
+ /* Size 16x8 */
+ 64, 63, 61, 66, 70, 74, 84, 98, 97, 97, 98, 101, 104, 108, 111, 114, 62,
+ 63, 64, 70, 75, 80, 86, 93, 92, 91, 91, 93, 96, 99, 102, 104, 74, 77,
+ 80, 85, 89, 94, 95, 96, 94, 93, 92, 93, 95, 97, 99, 101, 91, 90, 89, 92,
+ 93, 95, 99, 104, 103, 103, 103, 105, 106, 108, 109, 111, 97, 94, 91, 93,
+ 93, 94, 100, 106, 108, 109, 111, 112, 114, 116, 117, 119, 98, 94, 91,
+ 91, 91, 91, 99, 107, 111, 114, 117, 119, 122, 124, 126, 128, 105, 100,
+ 96, 95, 95, 94, 101, 109, 114, 118, 123, 128, 133, 136, 139, 141, 115,
+ 109, 104, 103, 102, 100, 107, 114, 119, 123, 128, 134, 142, 146, 149,
+ 153,
+ /* Size 16x32 */
+ 64, 62, 62, 66, 74, 74, 91, 96, 97, 98, 98, 103, 105, 109, 115, 115, 63,
+ 63, 63, 68, 76, 76, 90, 95, 95, 95, 95, 100, 101, 104, 110, 110, 63, 63,
+ 63, 68, 77, 77, 90, 94, 94, 94, 94, 99, 100, 103, 109, 109, 62, 63, 64,
+ 69, 78, 78, 90, 93, 93, 93, 93, 97, 98, 102, 107, 107, 61, 64, 64, 70,
+ 80, 80, 89, 92, 91, 91, 91, 95, 96, 99, 104, 104, 61, 64, 64, 70, 80,
+ 80, 89, 92, 91, 91, 91, 95, 96, 99, 104, 104, 66, 69, 70, 75, 85, 85,
+ 92, 94, 93, 91, 91, 95, 95, 98, 103, 103, 67, 71, 72, 77, 86, 86, 92,
+ 94, 93, 92, 92, 95, 95, 98, 103, 103, 70, 74, 75, 80, 89, 89, 93, 95,
+ 93, 91, 91, 94, 95, 97, 102, 102, 74, 79, 80, 86, 94, 94, 95, 95, 94,
+ 91, 91, 93, 94, 96, 100, 100, 74, 79, 80, 86, 94, 94, 95, 95, 94, 91,
+ 91, 93, 94, 96, 100, 100, 82, 84, 85, 88, 95, 95, 98, 99, 98, 97, 97,
+ 99, 100, 102, 105, 105, 84, 85, 86, 89, 95, 95, 99, 100, 100, 99, 99,
+ 101, 101, 103, 107, 107, 89, 89, 89, 91, 95, 95, 101, 102, 102, 102,
+ 102, 104, 104, 106, 109, 109, 98, 94, 93, 94, 96, 96, 104, 106, 106,
+ 107, 107, 109, 109, 111, 114, 114, 98, 94, 93, 94, 96, 96, 104, 106,
+ 106, 107, 107, 109, 109, 111, 114, 114, 97, 93, 92, 93, 94, 94, 103,
+ 106, 108, 111, 111, 113, 114, 116, 119, 119, 97, 93, 92, 93, 94, 94,
+ 103, 106, 108, 112, 112, 114, 115, 117, 120, 120, 97, 92, 91, 92, 93,
+ 93, 103, 106, 109, 114, 114, 117, 118, 120, 123, 123, 98, 92, 91, 91,
+ 92, 92, 103, 107, 111, 117, 117, 122, 123, 125, 128, 128, 98, 92, 91,
+ 91, 92, 92, 103, 107, 111, 117, 117, 122, 123, 125, 128, 128, 100, 94,
+ 93, 93, 93, 93, 104, 108, 112, 119, 119, 125, 127, 129, 133, 133, 101,
+ 95, 93, 93, 93, 93, 105, 108, 112, 119, 119, 126, 128, 130, 134, 134,
+ 102, 96, 94, 94, 94, 94, 105, 108, 113, 121, 121, 128, 130, 133, 137,
+ 137, 104, 97, 96, 95, 95, 95, 106, 109, 114, 122, 122, 131, 133, 137,
+ 142, 142, 104, 97, 96, 95, 95, 95, 106, 109, 114, 122, 122, 131, 133,
+ 137, 142, 142, 108, 101, 99, 98, 97, 97, 108, 111, 116, 124, 124, 134,
+ 136, 140, 146, 146, 109, 102, 100, 99, 98, 98, 108, 111, 116, 125, 125,
+ 134, 137, 141, 147, 147, 111, 103, 102, 101, 99, 99, 109, 112, 117, 126,
+ 126, 136, 139, 143, 149, 149, 114, 106, 104, 103, 101, 101, 111, 113,
+ 119, 128, 128, 138, 141, 146, 153, 153, 114, 106, 104, 103, 101, 101,
+ 111, 113, 119, 128, 128, 138, 141, 146, 153, 153, 118, 110, 108, 107,
+ 104, 104, 114, 116, 122, 130, 130, 141, 144, 149, 157, 157,
+ /* Size 32x16 */
+ 64, 63, 63, 62, 61, 61, 66, 67, 70, 74, 74, 82, 84, 89, 98, 98, 97, 97,
+ 97, 98, 98, 100, 101, 102, 104, 104, 108, 109, 111, 114, 114, 118, 62,
+ 63, 63, 63, 64, 64, 69, 71, 74, 79, 79, 84, 85, 89, 94, 94, 93, 93, 92,
+ 92, 92, 94, 95, 96, 97, 97, 101, 102, 103, 106, 106, 110, 62, 63, 63,
+ 64, 64, 64, 70, 72, 75, 80, 80, 85, 86, 89, 93, 93, 92, 92, 91, 91, 91,
+ 93, 93, 94, 96, 96, 99, 100, 102, 104, 104, 108, 66, 68, 68, 69, 70, 70,
+ 75, 77, 80, 86, 86, 88, 89, 91, 94, 94, 93, 93, 92, 91, 91, 93, 93, 94,
+ 95, 95, 98, 99, 101, 103, 103, 107, 74, 76, 77, 78, 80, 80, 85, 86, 89,
+ 94, 94, 95, 95, 95, 96, 96, 94, 94, 93, 92, 92, 93, 93, 94, 95, 95, 97,
+ 98, 99, 101, 101, 104, 74, 76, 77, 78, 80, 80, 85, 86, 89, 94, 94, 95,
+ 95, 95, 96, 96, 94, 94, 93, 92, 92, 93, 93, 94, 95, 95, 97, 98, 99, 101,
+ 101, 104, 91, 90, 90, 90, 89, 89, 92, 92, 93, 95, 95, 98, 99, 101, 104,
+ 104, 103, 103, 103, 103, 103, 104, 105, 105, 106, 106, 108, 108, 109,
+ 111, 111, 114, 96, 95, 94, 93, 92, 92, 94, 94, 95, 95, 95, 99, 100, 102,
+ 106, 106, 106, 106, 106, 107, 107, 108, 108, 108, 109, 109, 111, 111,
+ 112, 113, 113, 116, 97, 95, 94, 93, 91, 91, 93, 93, 93, 94, 94, 98, 100,
+ 102, 106, 106, 108, 108, 109, 111, 111, 112, 112, 113, 114, 114, 116,
+ 116, 117, 119, 119, 122, 98, 95, 94, 93, 91, 91, 91, 92, 91, 91, 91, 97,
+ 99, 102, 107, 107, 111, 112, 114, 117, 117, 119, 119, 121, 122, 122,
+ 124, 125, 126, 128, 128, 130, 98, 95, 94, 93, 91, 91, 91, 92, 91, 91,
+ 91, 97, 99, 102, 107, 107, 111, 112, 114, 117, 117, 119, 119, 121, 122,
+ 122, 124, 125, 126, 128, 128, 130, 103, 100, 99, 97, 95, 95, 95, 95, 94,
+ 93, 93, 99, 101, 104, 109, 109, 113, 114, 117, 122, 122, 125, 126, 128,
+ 131, 131, 134, 134, 136, 138, 138, 141, 105, 101, 100, 98, 96, 96, 95,
+ 95, 95, 94, 94, 100, 101, 104, 109, 109, 114, 115, 118, 123, 123, 127,
+ 128, 130, 133, 133, 136, 137, 139, 141, 141, 144, 109, 104, 103, 102,
+ 99, 99, 98, 98, 97, 96, 96, 102, 103, 106, 111, 111, 116, 117, 120, 125,
+ 125, 129, 130, 133, 137, 137, 140, 141, 143, 146, 146, 149, 115, 110,
+ 109, 107, 104, 104, 103, 103, 102, 100, 100, 105, 107, 109, 114, 114,
+ 119, 120, 123, 128, 128, 133, 134, 137, 142, 142, 146, 147, 149, 153,
+ 153, 157, 115, 110, 109, 107, 104, 104, 103, 103, 102, 100, 100, 105,
+ 107, 109, 114, 114, 119, 120, 123, 128, 128, 133, 134, 137, 142, 142,
+ 146, 147, 149, 153, 153, 157,
+ /* Size 4x16 */
+ 62, 74, 98, 109, 63, 77, 94, 103, 64, 80, 91, 99, 69, 85, 91, 98, 74,
+ 89, 91, 97, 79, 94, 91, 96, 85, 95, 99, 103, 94, 96, 107, 111, 93, 94,
+ 111, 116, 92, 93, 114, 120, 92, 92, 117, 125, 95, 93, 119, 130, 97, 95,
+ 122, 137, 101, 97, 124, 140, 103, 99, 126, 143, 106, 101, 128, 146,
+ /* Size 16x4 */
+ 62, 63, 64, 69, 74, 79, 85, 94, 93, 92, 92, 95, 97, 101, 103, 106, 74,
+ 77, 80, 85, 89, 94, 95, 96, 94, 93, 92, 93, 95, 97, 99, 101, 98, 94, 91,
+ 91, 91, 91, 99, 107, 111, 114, 117, 119, 122, 124, 126, 128, 109, 103,
+ 99, 98, 97, 96, 103, 111, 116, 120, 125, 130, 137, 140, 143, 146,
+ /* Size 8x32 */
+ 64, 62, 74, 91, 97, 98, 105, 115, 63, 63, 76, 90, 95, 95, 101, 110, 63,
+ 63, 77, 90, 94, 94, 100, 109, 62, 64, 78, 90, 93, 93, 98, 107, 61, 64,
+ 80, 89, 91, 91, 96, 104, 61, 64, 80, 89, 91, 91, 96, 104, 66, 70, 85,
+ 92, 93, 91, 95, 103, 67, 72, 86, 92, 93, 92, 95, 103, 70, 75, 89, 93,
+ 93, 91, 95, 102, 74, 80, 94, 95, 94, 91, 94, 100, 74, 80, 94, 95, 94,
+ 91, 94, 100, 82, 85, 95, 98, 98, 97, 100, 105, 84, 86, 95, 99, 100, 99,
+ 101, 107, 89, 89, 95, 101, 102, 102, 104, 109, 98, 93, 96, 104, 106,
+ 107, 109, 114, 98, 93, 96, 104, 106, 107, 109, 114, 97, 92, 94, 103,
+ 108, 111, 114, 119, 97, 92, 94, 103, 108, 112, 115, 120, 97, 91, 93,
+ 103, 109, 114, 118, 123, 98, 91, 92, 103, 111, 117, 123, 128, 98, 91,
+ 92, 103, 111, 117, 123, 128, 100, 93, 93, 104, 112, 119, 127, 133, 101,
+ 93, 93, 105, 112, 119, 128, 134, 102, 94, 94, 105, 113, 121, 130, 137,
+ 104, 96, 95, 106, 114, 122, 133, 142, 104, 96, 95, 106, 114, 122, 133,
+ 142, 108, 99, 97, 108, 116, 124, 136, 146, 109, 100, 98, 108, 116, 125,
+ 137, 147, 111, 102, 99, 109, 117, 126, 139, 149, 114, 104, 101, 111,
+ 119, 128, 141, 153, 114, 104, 101, 111, 119, 128, 141, 153, 118, 108,
+ 104, 114, 122, 130, 144, 157,
+ /* Size 32x8 */
+ 64, 63, 63, 62, 61, 61, 66, 67, 70, 74, 74, 82, 84, 89, 98, 98, 97, 97,
+ 97, 98, 98, 100, 101, 102, 104, 104, 108, 109, 111, 114, 114, 118, 62,
+ 63, 63, 64, 64, 64, 70, 72, 75, 80, 80, 85, 86, 89, 93, 93, 92, 92, 91,
+ 91, 91, 93, 93, 94, 96, 96, 99, 100, 102, 104, 104, 108, 74, 76, 77, 78,
+ 80, 80, 85, 86, 89, 94, 94, 95, 95, 95, 96, 96, 94, 94, 93, 92, 92, 93,
+ 93, 94, 95, 95, 97, 98, 99, 101, 101, 104, 91, 90, 90, 90, 89, 89, 92,
+ 92, 93, 95, 95, 98, 99, 101, 104, 104, 103, 103, 103, 103, 103, 104,
+ 105, 105, 106, 106, 108, 108, 109, 111, 111, 114, 97, 95, 94, 93, 91,
+ 91, 93, 93, 93, 94, 94, 98, 100, 102, 106, 106, 108, 108, 109, 111, 111,
+ 112, 112, 113, 114, 114, 116, 116, 117, 119, 119, 122, 98, 95, 94, 93,
+ 91, 91, 91, 92, 91, 91, 91, 97, 99, 102, 107, 107, 111, 112, 114, 117,
+ 117, 119, 119, 121, 122, 122, 124, 125, 126, 128, 128, 130, 105, 101,
+ 100, 98, 96, 96, 95, 95, 95, 94, 94, 100, 101, 104, 109, 109, 114, 115,
+ 118, 123, 123, 127, 128, 130, 133, 133, 136, 137, 139, 141, 141, 144,
+ 115, 110, 109, 107, 104, 104, 103, 103, 102, 100, 100, 105, 107, 109,
+ 114, 114, 119, 120, 123, 128, 128, 133, 134, 137, 142, 142, 146, 147,
+ 149, 153, 153, 157 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 66, 85, 85, 128,
+#endif
+ /* Size 4x4 */
+ 64, 65, 77, 102, 65, 71, 81, 98, 77, 81, 108, 129, 102, 98, 129, 162,
+ /* Size 8x8 */
+ 63, 64, 64, 68, 71, 83, 94, 107, 64, 65, 65, 67, 69, 80, 89, 101, 64,
+ 65, 68, 71, 74, 83, 91, 102, 68, 67, 71, 79, 85, 94, 102, 111, 71, 69,
+ 74, 85, 97, 106, 114, 122, 83, 80, 83, 94, 106, 120, 130, 141, 94, 89,
+ 91, 102, 114, 130, 142, 155, 107, 101, 102, 111, 122, 141, 155, 170,
+ /* Size 16x16 */
+ 64, 63, 63, 63, 63, 64, 65, 68, 72, 76, 79, 88, 95, 99, 108, 118, 63,
+ 64, 64, 64, 64, 65, 66, 68, 70, 74, 77, 85, 91, 95, 103, 113, 63, 64,
+ 64, 65, 65, 65, 66, 67, 69, 73, 75, 82, 88, 92, 100, 109, 63, 64, 65,
+ 65, 65, 66, 67, 68, 70, 73, 76, 82, 88, 91, 99, 108, 63, 64, 65, 65, 67,
+ 68, 69, 71, 73, 76, 78, 84, 90, 93, 100, 108, 64, 65, 65, 66, 68, 71,
+ 72, 74, 77, 79, 81, 85, 90, 93, 99, 107, 65, 66, 66, 67, 69, 72, 73, 76,
+ 80, 82, 84, 89, 94, 97, 103, 111, 68, 68, 67, 68, 71, 74, 76, 79, 85,
+ 88, 90, 95, 100, 103, 109, 117, 72, 70, 69, 70, 73, 77, 80, 85, 97, 100,
+ 101, 108, 112, 115, 120, 128, 76, 74, 73, 73, 76, 79, 82, 88, 100, 103,
+ 105, 112, 117, 120, 126, 134, 79, 77, 75, 76, 78, 81, 84, 90, 101, 105,
+ 108, 116, 121, 124, 130, 138, 88, 85, 82, 82, 84, 85, 89, 95, 108, 112,
+ 116, 127, 133, 136, 143, 151, 95, 91, 88, 88, 90, 90, 94, 100, 112, 117,
+ 121, 133, 139, 142, 151, 159, 99, 95, 92, 91, 93, 93, 97, 103, 115, 120,
+ 124, 136, 142, 146, 155, 163, 108, 103, 100, 99, 100, 99, 103, 109, 120,
+ 126, 130, 143, 151, 155, 165, 174, 118, 113, 109, 108, 108, 107, 111,
+ 117, 128, 134, 138, 151, 159, 163, 174, 184,
+ /* Size 32x32 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 65, 68, 68, 70, 72, 72,
+ 76, 79, 79, 85, 88, 89, 95, 97, 99, 107, 108, 111, 118, 118, 63, 63, 63,
+ 63, 64, 64, 64, 64, 64, 64, 64, 64, 66, 68, 68, 69, 71, 71, 75, 78, 78,
+ 83, 86, 87, 92, 94, 96, 103, 104, 107, 114, 114, 63, 63, 64, 64, 64, 64,
+ 64, 64, 64, 64, 65, 65, 66, 68, 68, 69, 70, 70, 74, 77, 77, 82, 85, 86,
+ 91, 93, 95, 102, 103, 106, 113, 113, 63, 63, 64, 64, 64, 64, 64, 64, 64,
+ 65, 65, 65, 66, 68, 68, 69, 70, 70, 74, 77, 77, 82, 84, 85, 91, 93, 94,
+ 102, 103, 105, 112, 112, 63, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65,
+ 66, 67, 67, 68, 69, 69, 73, 75, 75, 80, 82, 83, 88, 90, 92, 99, 100,
+ 102, 109, 109, 63, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 66, 67,
+ 67, 68, 69, 69, 72, 75, 75, 80, 82, 82, 88, 89, 91, 98, 99, 101, 108,
+ 108, 63, 64, 64, 64, 65, 65, 65, 65, 65, 66, 66, 66, 67, 68, 68, 69, 70,
+ 70, 73, 76, 76, 80, 82, 83, 88, 90, 91, 98, 99, 101, 108, 108, 63, 64,
+ 64, 64, 65, 65, 65, 66, 66, 67, 68, 68, 69, 70, 70, 71, 73, 73, 76, 78,
+ 78, 82, 84, 85, 89, 91, 93, 99, 100, 102, 108, 108, 63, 64, 64, 64, 65,
+ 65, 65, 66, 67, 67, 68, 68, 69, 71, 71, 72, 73, 73, 76, 78, 78, 82, 84,
+ 85, 90, 91, 93, 99, 100, 102, 108, 108, 64, 64, 64, 65, 65, 65, 66, 67,
+ 67, 68, 69, 69, 70, 71, 71, 73, 74, 74, 77, 79, 79, 83, 84, 85, 90, 91,
+ 93, 99, 99, 102, 108, 108, 64, 64, 65, 65, 65, 65, 66, 68, 68, 69, 71,
+ 71, 72, 74, 74, 75, 77, 77, 79, 81, 81, 84, 85, 86, 90, 92, 93, 98, 99,
+ 101, 107, 107, 64, 64, 65, 65, 65, 65, 66, 68, 68, 69, 71, 71, 72, 74,
+ 74, 75, 77, 77, 79, 81, 81, 84, 85, 86, 90, 92, 93, 98, 99, 101, 107,
+ 107, 65, 66, 66, 66, 66, 66, 67, 69, 69, 70, 72, 72, 73, 76, 76, 78, 80,
+ 80, 82, 84, 84, 88, 89, 90, 94, 95, 97, 102, 103, 105, 111, 111, 68, 68,
+ 68, 68, 67, 67, 68, 70, 71, 71, 74, 74, 76, 79, 79, 82, 85, 85, 88, 90,
+ 90, 94, 95, 96, 100, 102, 103, 108, 109, 111, 117, 117, 68, 68, 68, 68,
+ 67, 67, 68, 70, 71, 71, 74, 74, 76, 79, 79, 82, 85, 85, 88, 90, 90, 94,
+ 95, 96, 100, 102, 103, 108, 109, 111, 117, 117, 70, 69, 69, 69, 68, 68,
+ 69, 71, 72, 73, 75, 75, 78, 82, 82, 86, 91, 91, 94, 95, 95, 99, 101,
+ 102, 106, 107, 109, 114, 114, 116, 122, 122, 72, 71, 70, 70, 69, 69, 70,
+ 73, 73, 74, 77, 77, 80, 85, 85, 91, 97, 97, 100, 101, 101, 106, 108,
+ 108, 112, 114, 115, 119, 120, 122, 128, 128, 72, 71, 70, 70, 69, 69, 70,
+ 73, 73, 74, 77, 77, 80, 85, 85, 91, 97, 97, 100, 101, 101, 106, 108,
+ 108, 112, 114, 115, 119, 120, 122, 128, 128, 76, 75, 74, 74, 73, 72, 73,
+ 76, 76, 77, 79, 79, 82, 88, 88, 94, 100, 100, 103, 105, 105, 110, 112,
+ 113, 117, 119, 120, 125, 126, 128, 134, 134, 79, 78, 77, 77, 75, 75, 76,
+ 78, 78, 79, 81, 81, 84, 90, 90, 95, 101, 101, 105, 108, 108, 113, 116,
+ 117, 121, 122, 124, 129, 130, 132, 138, 138, 79, 78, 77, 77, 75, 75, 76,
+ 78, 78, 79, 81, 81, 84, 90, 90, 95, 101, 101, 105, 108, 108, 113, 116,
+ 117, 121, 122, 124, 129, 130, 132, 138, 138, 85, 83, 82, 82, 80, 80, 80,
+ 82, 82, 83, 84, 84, 88, 94, 94, 99, 106, 106, 110, 113, 113, 120, 123,
+ 124, 129, 130, 132, 138, 139, 141, 147, 147, 88, 86, 85, 84, 82, 82, 82,
+ 84, 84, 84, 85, 85, 89, 95, 95, 101, 108, 108, 112, 116, 116, 123, 127,
+ 128, 133, 134, 136, 142, 143, 145, 151, 151, 89, 87, 86, 85, 83, 82, 83,
+ 85, 85, 85, 86, 86, 90, 96, 96, 102, 108, 108, 113, 117, 117, 124, 128,
+ 128, 133, 135, 137, 143, 144, 146, 152, 152, 95, 92, 91, 91, 88, 88, 88,
+ 89, 90, 90, 90, 90, 94, 100, 100, 106, 112, 112, 117, 121, 121, 129,
+ 133, 133, 139, 141, 142, 149, 151, 153, 159, 159, 97, 94, 93, 93, 90,
+ 89, 90, 91, 91, 91, 92, 92, 95, 102, 102, 107, 114, 114, 119, 122, 122,
+ 130, 134, 135, 141, 142, 144, 151, 153, 155, 161, 161, 99, 96, 95, 94,
+ 92, 91, 91, 93, 93, 93, 93, 93, 97, 103, 103, 109, 115, 115, 120, 124,
+ 124, 132, 136, 137, 142, 144, 146, 154, 155, 157, 163, 163, 107, 103,
+ 102, 102, 99, 98, 98, 99, 99, 99, 98, 98, 102, 108, 108, 114, 119, 119,
+ 125, 129, 129, 138, 142, 143, 149, 151, 154, 162, 163, 166, 173, 173,
+ 108, 104, 103, 103, 100, 99, 99, 100, 100, 99, 99, 99, 103, 109, 109,
+ 114, 120, 120, 126, 130, 130, 139, 143, 144, 151, 153, 155, 163, 165,
+ 167, 174, 174, 111, 107, 106, 105, 102, 101, 101, 102, 102, 102, 101,
+ 101, 105, 111, 111, 116, 122, 122, 128, 132, 132, 141, 145, 146, 153,
+ 155, 157, 166, 167, 170, 177, 177, 118, 114, 113, 112, 109, 108, 108,
+ 108, 108, 108, 107, 107, 111, 117, 117, 122, 128, 128, 134, 138, 138,
+ 147, 151, 152, 159, 161, 163, 173, 174, 177, 184, 184, 118, 114, 113,
+ 112, 109, 108, 108, 108, 108, 108, 107, 107, 111, 117, 117, 122, 128,
+ 128, 134, 138, 138, 147, 151, 152, 159, 161, 163, 173, 174, 177, 184,
+ 184,
+ /* Size 4x8 */
+ 64, 65, 75, 104, 64, 66, 73, 99, 65, 69, 77, 99, 68, 74, 88, 109, 70,
+ 77, 99, 120, 81, 85, 110, 139, 92, 93, 119, 152, 104, 102, 128, 167,
+ /* Size 8x4 */
+ 64, 64, 65, 68, 70, 81, 92, 104, 65, 66, 69, 74, 77, 85, 93, 102, 75,
+ 73, 77, 88, 99, 110, 119, 128, 104, 99, 99, 109, 120, 139, 152, 167,
+ /* Size 8x16 */
+ 64, 63, 64, 65, 72, 88, 95, 107, 63, 64, 65, 66, 71, 85, 91, 103, 63,
+ 65, 65, 66, 70, 82, 88, 99, 63, 65, 66, 67, 70, 82, 88, 99, 64, 65, 68,
+ 69, 73, 84, 90, 100, 64, 66, 70, 72, 77, 85, 90, 99, 65, 66, 71, 73, 80,
+ 89, 94, 103, 68, 68, 72, 76, 85, 96, 101, 109, 72, 69, 75, 80, 96, 108,
+ 112, 120, 76, 73, 78, 83, 99, 112, 117, 126, 79, 75, 80, 85, 101, 116,
+ 121, 130, 88, 82, 85, 90, 107, 126, 132, 143, 94, 88, 91, 95, 112, 132,
+ 139, 150, 98, 92, 94, 97, 114, 135, 142, 155, 107, 99, 100, 103, 120,
+ 142, 150, 164, 117, 108, 108, 111, 127, 150, 159, 174,
+ /* Size 16x8 */
+ 64, 63, 63, 63, 64, 64, 65, 68, 72, 76, 79, 88, 94, 98, 107, 117, 63,
+ 64, 65, 65, 65, 66, 66, 68, 69, 73, 75, 82, 88, 92, 99, 108, 64, 65, 65,
+ 66, 68, 70, 71, 72, 75, 78, 80, 85, 91, 94, 100, 108, 65, 66, 66, 67,
+ 69, 72, 73, 76, 80, 83, 85, 90, 95, 97, 103, 111, 72, 71, 70, 70, 73,
+ 77, 80, 85, 96, 99, 101, 107, 112, 114, 120, 127, 88, 85, 82, 82, 84,
+ 85, 89, 96, 108, 112, 116, 126, 132, 135, 142, 150, 95, 91, 88, 88, 90,
+ 90, 94, 101, 112, 117, 121, 132, 139, 142, 150, 159, 107, 103, 99, 99,
+ 100, 99, 103, 109, 120, 126, 130, 143, 150, 155, 164, 174,
+ /* Size 16x32 */
+ 64, 63, 63, 63, 64, 64, 65, 71, 72, 76, 88, 88, 95, 107, 107, 118, 63,
+ 64, 64, 64, 64, 65, 66, 70, 71, 75, 86, 86, 92, 104, 104, 114, 63, 64,
+ 64, 64, 65, 65, 66, 70, 71, 74, 85, 85, 91, 103, 103, 113, 63, 64, 64,
+ 64, 65, 65, 66, 70, 71, 74, 84, 84, 91, 102, 102, 112, 63, 64, 65, 65,
+ 65, 65, 66, 69, 70, 73, 82, 82, 88, 99, 99, 109, 63, 64, 65, 65, 65, 66,
+ 66, 69, 69, 73, 82, 82, 88, 99, 99, 108, 63, 64, 65, 65, 66, 66, 67, 70,
+ 70, 73, 82, 82, 88, 99, 99, 108, 64, 65, 65, 65, 67, 68, 69, 72, 73, 76,
+ 84, 84, 90, 99, 99, 108, 64, 65, 65, 66, 68, 68, 69, 73, 73, 76, 84, 84,
+ 90, 100, 100, 108, 64, 65, 65, 66, 68, 69, 70, 74, 74, 77, 85, 85, 90,
+ 99, 99, 108, 64, 65, 66, 66, 70, 71, 72, 76, 77, 79, 85, 85, 90, 99, 99,
+ 107, 64, 65, 66, 66, 70, 71, 72, 76, 77, 79, 85, 85, 90, 99, 99, 107,
+ 65, 66, 66, 67, 71, 72, 73, 79, 80, 83, 89, 89, 94, 103, 103, 111, 68,
+ 68, 68, 68, 72, 74, 76, 84, 85, 88, 96, 96, 101, 109, 109, 117, 68, 68,
+ 68, 68, 72, 74, 76, 84, 85, 88, 96, 96, 101, 109, 109, 117, 70, 69, 69,
+ 69, 74, 75, 78, 89, 90, 93, 101, 101, 106, 114, 114, 122, 72, 70, 69,
+ 70, 75, 77, 80, 94, 96, 99, 108, 108, 112, 120, 120, 128, 72, 70, 69,
+ 70, 75, 77, 80, 94, 96, 99, 108, 108, 112, 120, 120, 128, 76, 74, 73,
+ 74, 78, 80, 83, 97, 99, 103, 112, 112, 117, 126, 126, 134, 79, 76, 75,
+ 76, 80, 81, 85, 98, 101, 105, 116, 116, 121, 130, 130, 138, 79, 76, 75,
+ 76, 80, 81, 85, 98, 101, 105, 116, 116, 121, 130, 130, 138, 85, 81, 80,
+ 81, 84, 85, 88, 103, 105, 110, 123, 123, 129, 139, 139, 147, 88, 84, 82,
+ 83, 85, 86, 90, 105, 107, 112, 126, 126, 132, 143, 143, 151, 88, 85, 83,
+ 83, 86, 87, 90, 105, 108, 113, 127, 127, 133, 144, 144, 152, 94, 90, 88,
+ 89, 91, 91, 95, 109, 112, 117, 132, 132, 139, 150, 150, 159, 96, 92, 90,
+ 90, 92, 93, 96, 111, 113, 119, 134, 134, 140, 152, 152, 161, 98, 94, 92,
+ 92, 94, 94, 97, 112, 114, 120, 135, 135, 142, 155, 155, 163, 106, 100,
+ 98, 98, 99, 99, 103, 117, 119, 125, 142, 142, 149, 163, 163, 173, 107,
+ 102, 99, 99, 100, 100, 103, 118, 120, 126, 142, 142, 150, 164, 164, 174,
+ 110, 104, 102, 102, 102, 102, 106, 120, 122, 128, 145, 145, 153, 167,
+ 167, 177, 117, 111, 108, 108, 108, 108, 111, 125, 127, 134, 150, 150,
+ 159, 174, 174, 184, 117, 111, 108, 108, 108, 108, 111, 125, 127, 134,
+ 150, 150, 159, 174, 174, 184,
+ /* Size 32x16 */
+ 64, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 65, 68, 68, 70, 72, 72,
+ 76, 79, 79, 85, 88, 88, 94, 96, 98, 106, 107, 110, 117, 117, 63, 64, 64,
+ 64, 64, 64, 64, 65, 65, 65, 65, 65, 66, 68, 68, 69, 70, 70, 74, 76, 76,
+ 81, 84, 85, 90, 92, 94, 100, 102, 104, 111, 111, 63, 64, 64, 64, 65, 65,
+ 65, 65, 65, 65, 66, 66, 66, 68, 68, 69, 69, 69, 73, 75, 75, 80, 82, 83,
+ 88, 90, 92, 98, 99, 102, 108, 108, 63, 64, 64, 64, 65, 65, 65, 65, 66,
+ 66, 66, 66, 67, 68, 68, 69, 70, 70, 74, 76, 76, 81, 83, 83, 89, 90, 92,
+ 98, 99, 102, 108, 108, 64, 64, 65, 65, 65, 65, 66, 67, 68, 68, 70, 70,
+ 71, 72, 72, 74, 75, 75, 78, 80, 80, 84, 85, 86, 91, 92, 94, 99, 100,
+ 102, 108, 108, 64, 65, 65, 65, 65, 66, 66, 68, 68, 69, 71, 71, 72, 74,
+ 74, 75, 77, 77, 80, 81, 81, 85, 86, 87, 91, 93, 94, 99, 100, 102, 108,
+ 108, 65, 66, 66, 66, 66, 66, 67, 69, 69, 70, 72, 72, 73, 76, 76, 78, 80,
+ 80, 83, 85, 85, 88, 90, 90, 95, 96, 97, 103, 103, 106, 111, 111, 71, 70,
+ 70, 70, 69, 69, 70, 72, 73, 74, 76, 76, 79, 84, 84, 89, 94, 94, 97, 98,
+ 98, 103, 105, 105, 109, 111, 112, 117, 118, 120, 125, 125, 72, 71, 71,
+ 71, 70, 69, 70, 73, 73, 74, 77, 77, 80, 85, 85, 90, 96, 96, 99, 101,
+ 101, 105, 107, 108, 112, 113, 114, 119, 120, 122, 127, 127, 76, 75, 74,
+ 74, 73, 73, 73, 76, 76, 77, 79, 79, 83, 88, 88, 93, 99, 99, 103, 105,
+ 105, 110, 112, 113, 117, 119, 120, 125, 126, 128, 134, 134, 88, 86, 85,
+ 84, 82, 82, 82, 84, 84, 85, 85, 85, 89, 96, 96, 101, 108, 108, 112, 116,
+ 116, 123, 126, 127, 132, 134, 135, 142, 142, 145, 150, 150, 88, 86, 85,
+ 84, 82, 82, 82, 84, 84, 85, 85, 85, 89, 96, 96, 101, 108, 108, 112, 116,
+ 116, 123, 126, 127, 132, 134, 135, 142, 142, 145, 150, 150, 95, 92, 91,
+ 91, 88, 88, 88, 90, 90, 90, 90, 90, 94, 101, 101, 106, 112, 112, 117,
+ 121, 121, 129, 132, 133, 139, 140, 142, 149, 150, 153, 159, 159, 107,
+ 104, 103, 102, 99, 99, 99, 99, 100, 99, 99, 99, 103, 109, 109, 114, 120,
+ 120, 126, 130, 130, 139, 143, 144, 150, 152, 155, 163, 164, 167, 174,
+ 174, 107, 104, 103, 102, 99, 99, 99, 99, 100, 99, 99, 99, 103, 109, 109,
+ 114, 120, 120, 126, 130, 130, 139, 143, 144, 150, 152, 155, 163, 164,
+ 167, 174, 174, 118, 114, 113, 112, 109, 108, 108, 108, 108, 108, 107,
+ 107, 111, 117, 117, 122, 128, 128, 134, 138, 138, 147, 151, 152, 159,
+ 161, 163, 173, 174, 177, 184, 184,
+ /* Size 4x16 */
+ 63, 64, 76, 107, 64, 65, 74, 103, 64, 65, 73, 99, 64, 66, 73, 99, 65,
+ 68, 76, 100, 65, 71, 79, 99, 66, 72, 83, 103, 68, 74, 88, 109, 70, 77,
+ 99, 120, 74, 80, 103, 126, 76, 81, 105, 130, 84, 86, 112, 143, 90, 91,
+ 117, 150, 94, 94, 120, 155, 102, 100, 126, 164, 111, 108, 134, 174,
+ /* Size 16x4 */
+ 63, 64, 64, 64, 65, 65, 66, 68, 70, 74, 76, 84, 90, 94, 102, 111, 64,
+ 65, 65, 66, 68, 71, 72, 74, 77, 80, 81, 86, 91, 94, 100, 108, 76, 74,
+ 73, 73, 76, 79, 83, 88, 99, 103, 105, 112, 117, 120, 126, 134, 107, 103,
+ 99, 99, 100, 99, 103, 109, 120, 126, 130, 143, 150, 155, 164, 174,
+ /* Size 8x32 */
+ 64, 63, 64, 65, 72, 88, 95, 107, 63, 64, 64, 66, 71, 86, 92, 104, 63,
+ 64, 65, 66, 71, 85, 91, 103, 63, 64, 65, 66, 71, 84, 91, 102, 63, 65,
+ 65, 66, 70, 82, 88, 99, 63, 65, 65, 66, 69, 82, 88, 99, 63, 65, 66, 67,
+ 70, 82, 88, 99, 64, 65, 67, 69, 73, 84, 90, 99, 64, 65, 68, 69, 73, 84,
+ 90, 100, 64, 65, 68, 70, 74, 85, 90, 99, 64, 66, 70, 72, 77, 85, 90, 99,
+ 64, 66, 70, 72, 77, 85, 90, 99, 65, 66, 71, 73, 80, 89, 94, 103, 68, 68,
+ 72, 76, 85, 96, 101, 109, 68, 68, 72, 76, 85, 96, 101, 109, 70, 69, 74,
+ 78, 90, 101, 106, 114, 72, 69, 75, 80, 96, 108, 112, 120, 72, 69, 75,
+ 80, 96, 108, 112, 120, 76, 73, 78, 83, 99, 112, 117, 126, 79, 75, 80,
+ 85, 101, 116, 121, 130, 79, 75, 80, 85, 101, 116, 121, 130, 85, 80, 84,
+ 88, 105, 123, 129, 139, 88, 82, 85, 90, 107, 126, 132, 143, 88, 83, 86,
+ 90, 108, 127, 133, 144, 94, 88, 91, 95, 112, 132, 139, 150, 96, 90, 92,
+ 96, 113, 134, 140, 152, 98, 92, 94, 97, 114, 135, 142, 155, 106, 98, 99,
+ 103, 119, 142, 149, 163, 107, 99, 100, 103, 120, 142, 150, 164, 110,
+ 102, 102, 106, 122, 145, 153, 167, 117, 108, 108, 111, 127, 150, 159,
+ 174, 117, 108, 108, 111, 127, 150, 159, 174,
+ /* Size 32x8 */
+ 64, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 65, 68, 68, 70, 72, 72,
+ 76, 79, 79, 85, 88, 88, 94, 96, 98, 106, 107, 110, 117, 117, 63, 64, 64,
+ 64, 65, 65, 65, 65, 65, 65, 66, 66, 66, 68, 68, 69, 69, 69, 73, 75, 75,
+ 80, 82, 83, 88, 90, 92, 98, 99, 102, 108, 108, 64, 64, 65, 65, 65, 65,
+ 66, 67, 68, 68, 70, 70, 71, 72, 72, 74, 75, 75, 78, 80, 80, 84, 85, 86,
+ 91, 92, 94, 99, 100, 102, 108, 108, 65, 66, 66, 66, 66, 66, 67, 69, 69,
+ 70, 72, 72, 73, 76, 76, 78, 80, 80, 83, 85, 85, 88, 90, 90, 95, 96, 97,
+ 103, 103, 106, 111, 111, 72, 71, 71, 71, 70, 69, 70, 73, 73, 74, 77, 77,
+ 80, 85, 85, 90, 96, 96, 99, 101, 101, 105, 107, 108, 112, 113, 114, 119,
+ 120, 122, 127, 127, 88, 86, 85, 84, 82, 82, 82, 84, 84, 85, 85, 85, 89,
+ 96, 96, 101, 108, 108, 112, 116, 116, 123, 126, 127, 132, 134, 135, 142,
+ 142, 145, 150, 150, 95, 92, 91, 91, 88, 88, 88, 90, 90, 90, 90, 90, 94,
+ 101, 101, 106, 112, 112, 117, 121, 121, 129, 132, 133, 139, 140, 142,
+ 149, 150, 153, 159, 159, 107, 104, 103, 102, 99, 99, 99, 99, 100, 99,
+ 99, 99, 103, 109, 109, 114, 120, 120, 126, 130, 130, 139, 143, 144, 150,
+ 152, 155, 163, 164, 167, 174, 174 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 77, 91, 91, 118,
+#endif
+ /* Size 4x4 */
+ 63, 77, 94, 99, 77, 95, 93, 93, 94, 93, 109, 115, 99, 93, 115, 132,
+ /* Size 8x8 */
+ 63, 62, 71, 84, 96, 95, 98, 102, 62, 64, 73, 85, 93, 90, 93, 97, 71, 73,
+ 83, 91, 95, 91, 93, 96, 84, 85, 91, 97, 101, 99, 100, 102, 96, 93, 95,
+ 101, 106, 107, 108, 109, 95, 90, 91, 99, 107, 114, 118, 121, 98, 93, 93,
+ 100, 108, 118, 123, 128, 102, 97, 96, 102, 109, 121, 128, 136,
+ /* Size 16x16 */
+ 64, 62, 61, 62, 67, 73, 77, 83, 98, 98, 97, 98, 101, 102, 104, 109, 62,
+ 63, 63, 64, 69, 77, 80, 85, 95, 95, 94, 94, 96, 97, 100, 104, 61, 63,
+ 63, 65, 71, 79, 82, 85, 93, 92, 92, 91, 93, 94, 96, 100, 62, 64, 65, 66,
+ 72, 81, 83, 86, 93, 92, 91, 90, 92, 93, 95, 99, 67, 69, 71, 72, 78, 87,
+ 88, 90, 95, 93, 93, 91, 93, 94, 95, 99, 73, 77, 79, 81, 87, 95, 95, 95,
+ 96, 94, 93, 91, 92, 93, 94, 97, 77, 80, 82, 83, 88, 95, 95, 96, 98, 96,
+ 96, 94, 95, 95, 96, 99, 83, 85, 85, 86, 90, 95, 96, 97, 101, 100, 99,
+ 98, 100, 100, 101, 104, 98, 95, 93, 93, 95, 96, 98, 101, 106, 106, 106,
+ 107, 108, 108, 109, 111, 98, 95, 92, 92, 93, 94, 96, 100, 106, 107, 108,
+ 110, 111, 111, 112, 115, 97, 94, 92, 91, 93, 93, 96, 99, 106, 108, 109,
+ 111, 113, 113, 115, 117, 98, 94, 91, 90, 91, 91, 94, 98, 107, 110, 111,
+ 117, 119, 120, 123, 125, 101, 96, 93, 92, 93, 92, 95, 100, 108, 111,
+ 113, 119, 122, 123, 126, 129, 102, 97, 94, 93, 94, 93, 95, 100, 108,
+ 111, 113, 120, 123, 125, 129, 132, 104, 100, 96, 95, 95, 94, 96, 101,
+ 109, 112, 115, 123, 126, 129, 133, 137, 109, 104, 100, 99, 99, 97, 99,
+ 104, 111, 115, 117, 125, 129, 132, 137, 142,
+ /* Size 32x32 */
+ 64, 63, 62, 62, 61, 61, 62, 66, 67, 69, 73, 73, 77, 83, 83, 90, 98, 98,
+ 98, 97, 97, 98, 98, 98, 101, 101, 102, 104, 104, 106, 109, 109, 63, 63,
+ 63, 63, 62, 62, 63, 68, 69, 71, 76, 76, 79, 84, 84, 90, 96, 96, 95, 95,
+ 95, 95, 95, 95, 98, 98, 99, 101, 101, 102, 106, 106, 62, 63, 63, 63, 63,
+ 62, 64, 69, 69, 71, 77, 77, 80, 85, 85, 90, 95, 95, 95, 94, 94, 94, 94,
+ 94, 96, 97, 97, 99, 100, 101, 104, 104, 62, 63, 63, 63, 63, 63, 64, 69,
+ 69, 72, 77, 77, 80, 85, 85, 90, 95, 95, 94, 94, 94, 94, 93, 94, 96, 96,
+ 97, 99, 99, 101, 104, 104, 61, 62, 63, 63, 63, 63, 65, 70, 71, 73, 79,
+ 79, 82, 85, 85, 89, 93, 93, 92, 92, 92, 91, 91, 91, 93, 94, 94, 96, 96,
+ 97, 100, 100, 61, 62, 62, 63, 63, 64, 65, 70, 71, 73, 80, 80, 82, 85,
+ 85, 89, 93, 93, 92, 91, 91, 90, 90, 90, 92, 93, 93, 95, 95, 97, 99, 99,
+ 62, 63, 64, 64, 65, 65, 66, 71, 72, 75, 81, 81, 83, 86, 86, 89, 93, 93,
+ 92, 91, 91, 91, 90, 90, 92, 93, 93, 95, 95, 96, 99, 99, 66, 68, 69, 69,
+ 70, 70, 71, 77, 77, 80, 86, 86, 87, 89, 89, 92, 94, 94, 93, 92, 92, 91,
+ 91, 91, 93, 93, 94, 95, 95, 96, 99, 99, 67, 69, 69, 69, 71, 71, 72, 77,
+ 78, 80, 87, 87, 88, 90, 90, 92, 95, 95, 93, 93, 93, 91, 91, 91, 93, 93,
+ 94, 95, 95, 96, 99, 99, 69, 71, 71, 72, 73, 73, 75, 80, 80, 83, 89, 89,
+ 90, 91, 91, 93, 95, 95, 94, 93, 93, 91, 91, 91, 93, 93, 93, 94, 95, 96,
+ 98, 98, 73, 76, 77, 77, 79, 80, 81, 86, 87, 89, 95, 95, 95, 95, 95, 95,
+ 96, 96, 94, 93, 93, 91, 91, 91, 92, 92, 93, 93, 94, 94, 97, 97, 73, 76,
+ 77, 77, 79, 80, 81, 86, 87, 89, 95, 95, 95, 95, 95, 95, 96, 96, 94, 93,
+ 93, 91, 91, 91, 92, 92, 93, 93, 94, 94, 97, 97, 77, 79, 80, 80, 82, 82,
+ 83, 87, 88, 90, 95, 95, 95, 96, 96, 97, 98, 98, 96, 96, 96, 94, 94, 94,
+ 95, 95, 95, 96, 96, 97, 99, 99, 83, 84, 85, 85, 85, 85, 86, 89, 90, 91,
+ 95, 95, 96, 97, 97, 99, 101, 101, 100, 99, 99, 99, 98, 99, 100, 100,
+ 100, 101, 101, 102, 104, 104, 83, 84, 85, 85, 85, 85, 86, 89, 90, 91,
+ 95, 95, 96, 97, 97, 99, 101, 101, 100, 99, 99, 99, 98, 99, 100, 100,
+ 100, 101, 101, 102, 104, 104, 90, 90, 90, 90, 89, 89, 89, 92, 92, 93,
+ 95, 95, 97, 99, 99, 101, 103, 103, 103, 103, 103, 103, 103, 103, 104,
+ 104, 104, 105, 105, 105, 107, 107, 98, 96, 95, 95, 93, 93, 93, 94, 95,
+ 95, 96, 96, 98, 101, 101, 103, 106, 106, 106, 106, 106, 107, 107, 107,
+ 108, 108, 108, 109, 109, 109, 111, 111, 98, 96, 95, 95, 93, 93, 93, 94,
+ 95, 95, 96, 96, 98, 101, 101, 103, 106, 106, 106, 106, 106, 107, 107,
+ 107, 108, 108, 108, 109, 109, 109, 111, 111, 98, 95, 95, 94, 92, 92, 92,
+ 93, 93, 94, 94, 94, 96, 100, 100, 103, 106, 106, 107, 108, 108, 109,
+ 110, 110, 111, 111, 111, 112, 112, 113, 115, 115, 97, 95, 94, 94, 92,
+ 91, 91, 92, 93, 93, 93, 93, 96, 99, 99, 103, 106, 106, 108, 109, 109,
+ 111, 111, 112, 113, 113, 113, 115, 115, 116, 117, 117, 97, 95, 94, 94,
+ 92, 91, 91, 92, 93, 93, 93, 93, 96, 99, 99, 103, 106, 106, 108, 109,
+ 109, 111, 111, 112, 113, 113, 113, 115, 115, 116, 117, 117, 98, 95, 94,
+ 94, 91, 90, 91, 91, 91, 91, 91, 91, 94, 99, 99, 103, 107, 107, 109, 111,
+ 111, 114, 115, 116, 117, 118, 118, 120, 120, 121, 123, 123, 98, 95, 94,
+ 93, 91, 90, 90, 91, 91, 91, 91, 91, 94, 98, 98, 103, 107, 107, 110, 111,
+ 111, 115, 117, 117, 119, 120, 120, 122, 123, 123, 125, 125, 98, 95, 94,
+ 94, 91, 90, 90, 91, 91, 91, 91, 91, 94, 99, 99, 103, 107, 107, 110, 112,
+ 112, 116, 117, 118, 119, 120, 121, 123, 123, 124, 126, 126, 101, 98, 96,
+ 96, 93, 92, 92, 93, 93, 93, 92, 92, 95, 100, 100, 104, 108, 108, 111,
+ 113, 113, 117, 119, 119, 122, 122, 123, 126, 126, 127, 129, 129, 101,
+ 98, 97, 96, 94, 93, 93, 93, 93, 93, 92, 92, 95, 100, 100, 104, 108, 108,
+ 111, 113, 113, 118, 120, 120, 122, 123, 124, 127, 127, 128, 130, 130,
+ 102, 99, 97, 97, 94, 93, 93, 94, 94, 93, 93, 93, 95, 100, 100, 104, 108,
+ 108, 111, 113, 113, 118, 120, 121, 123, 124, 125, 128, 129, 129, 132,
+ 132, 104, 101, 99, 99, 96, 95, 95, 95, 95, 94, 93, 93, 96, 101, 101,
+ 105, 109, 109, 112, 115, 115, 120, 122, 123, 126, 127, 128, 132, 133,
+ 134, 136, 136, 104, 101, 100, 99, 96, 95, 95, 95, 95, 95, 94, 94, 96,
+ 101, 101, 105, 109, 109, 112, 115, 115, 120, 123, 123, 126, 127, 129,
+ 133, 133, 134, 137, 137, 106, 102, 101, 101, 97, 97, 96, 96, 96, 96, 94,
+ 94, 97, 102, 102, 105, 109, 109, 113, 116, 116, 121, 123, 124, 127, 128,
+ 129, 134, 134, 136, 138, 138, 109, 106, 104, 104, 100, 99, 99, 99, 99,
+ 98, 97, 97, 99, 104, 104, 107, 111, 111, 115, 117, 117, 123, 125, 126,
+ 129, 130, 132, 136, 137, 138, 142, 142, 109, 106, 104, 104, 100, 99, 99,
+ 99, 99, 98, 97, 97, 99, 104, 104, 107, 111, 111, 115, 117, 117, 123,
+ 125, 126, 129, 130, 132, 136, 137, 138, 142, 142,
+ /* Size 4x8 */
+ 63, 76, 95, 101, 63, 80, 92, 96, 73, 89, 94, 95, 85, 95, 100, 101, 95,
+ 96, 106, 109, 93, 92, 109, 120, 96, 93, 111, 128, 100, 96, 113, 134,
+ /* Size 8x4 */
+ 63, 63, 73, 85, 95, 93, 96, 100, 76, 80, 89, 95, 96, 92, 93, 96, 95, 92,
+ 94, 100, 106, 109, 111, 113, 101, 96, 95, 101, 109, 120, 128, 134,
+ /* Size 8x16 */
+ 64, 62, 71, 77, 96, 98, 101, 105, 63, 63, 74, 80, 94, 94, 97, 100, 61,
+ 64, 76, 81, 92, 91, 93, 97, 62, 66, 77, 83, 92, 91, 93, 96, 67, 72, 83,
+ 88, 94, 92, 93, 95, 74, 80, 91, 95, 95, 91, 92, 94, 78, 82, 92, 95, 97,
+ 94, 95, 97, 84, 86, 93, 96, 100, 99, 100, 101, 98, 93, 96, 98, 106, 107,
+ 108, 109, 97, 92, 94, 97, 106, 110, 111, 113, 97, 92, 93, 96, 106, 112,
+ 113, 115, 98, 91, 91, 94, 107, 117, 119, 123, 100, 93, 93, 96, 108, 119,
+ 122, 127, 102, 94, 94, 96, 108, 120, 123, 129, 104, 96, 95, 97, 109,
+ 122, 127, 133, 109, 100, 98, 100, 111, 125, 130, 137,
+ /* Size 16x8 */
+ 64, 63, 61, 62, 67, 74, 78, 84, 98, 97, 97, 98, 100, 102, 104, 109, 62,
+ 63, 64, 66, 72, 80, 82, 86, 93, 92, 92, 91, 93, 94, 96, 100, 71, 74, 76,
+ 77, 83, 91, 92, 93, 96, 94, 93, 91, 93, 94, 95, 98, 77, 80, 81, 83, 88,
+ 95, 95, 96, 98, 97, 96, 94, 96, 96, 97, 100, 96, 94, 92, 92, 94, 95, 97,
+ 100, 106, 106, 106, 107, 108, 108, 109, 111, 98, 94, 91, 91, 92, 91, 94,
+ 99, 107, 110, 112, 117, 119, 120, 122, 125, 101, 97, 93, 93, 93, 92, 95,
+ 100, 108, 111, 113, 119, 122, 123, 127, 130, 105, 100, 97, 96, 95, 94,
+ 97, 101, 109, 113, 115, 123, 127, 129, 133, 137,
+ /* Size 16x32 */
+ 64, 62, 62, 63, 71, 74, 77, 94, 96, 97, 98, 98, 101, 105, 105, 109, 63,
+ 63, 63, 64, 73, 76, 79, 93, 95, 95, 96, 96, 98, 101, 101, 106, 63, 63,
+ 63, 64, 74, 77, 80, 92, 94, 94, 94, 94, 97, 100, 100, 104, 62, 63, 63,
+ 64, 74, 77, 80, 92, 94, 94, 94, 94, 96, 100, 100, 104, 61, 63, 64, 65,
+ 76, 79, 81, 91, 92, 92, 91, 91, 93, 97, 97, 101, 61, 63, 64, 66, 76, 80,
+ 82, 91, 92, 92, 91, 91, 93, 96, 96, 100, 62, 65, 66, 67, 77, 81, 83, 91,
+ 92, 92, 91, 91, 93, 96, 96, 100, 67, 70, 71, 72, 82, 86, 87, 93, 94, 93,
+ 91, 91, 93, 95, 95, 99, 67, 70, 72, 73, 83, 86, 88, 93, 94, 93, 92, 92,
+ 93, 95, 95, 99, 69, 73, 74, 75, 85, 89, 90, 94, 94, 94, 91, 91, 93, 95,
+ 95, 98, 74, 78, 80, 82, 91, 94, 95, 95, 95, 94, 91, 91, 92, 94, 94, 97,
+ 74, 78, 80, 82, 91, 94, 95, 95, 95, 94, 91, 91, 92, 94, 94, 97, 78, 81,
+ 82, 84, 92, 95, 95, 97, 97, 96, 94, 94, 95, 97, 97, 100, 84, 85, 86, 87,
+ 93, 95, 96, 100, 100, 100, 99, 99, 100, 101, 101, 104, 84, 85, 86, 87,
+ 93, 95, 96, 100, 100, 100, 99, 99, 100, 101, 101, 104, 90, 90, 89, 90,
+ 94, 95, 97, 102, 103, 103, 103, 103, 104, 105, 105, 108, 98, 95, 93, 94,
+ 96, 96, 98, 105, 106, 106, 107, 107, 108, 109, 109, 111, 98, 95, 93, 94,
+ 96, 96, 98, 105, 106, 106, 107, 107, 108, 109, 109, 111, 97, 94, 92, 93,
+ 94, 95, 97, 105, 106, 107, 110, 110, 111, 113, 113, 115, 97, 93, 92, 92,
+ 93, 94, 96, 105, 106, 108, 112, 112, 113, 115, 115, 118, 97, 93, 92, 92,
+ 93, 94, 96, 105, 106, 108, 112, 112, 113, 115, 115, 118, 98, 93, 91, 91,
+ 92, 92, 95, 105, 107, 109, 115, 115, 117, 120, 120, 123, 98, 93, 91, 91,
+ 91, 92, 94, 105, 107, 110, 117, 117, 119, 123, 123, 125, 98, 93, 91, 91,
+ 92, 92, 94, 105, 107, 110, 117, 117, 120, 123, 123, 126, 100, 95, 93,
+ 93, 93, 93, 96, 106, 108, 111, 119, 119, 122, 127, 127, 130, 101, 96,
+ 93, 93, 93, 93, 96, 106, 108, 111, 119, 119, 123, 128, 128, 131, 102,
+ 96, 94, 94, 94, 94, 96, 106, 108, 111, 120, 120, 123, 129, 129, 132,
+ 104, 98, 96, 96, 95, 94, 97, 107, 109, 112, 122, 122, 126, 133, 133,
+ 137, 104, 98, 96, 96, 95, 95, 97, 107, 109, 112, 122, 122, 127, 133,
+ 133, 137, 106, 100, 97, 97, 96, 96, 98, 108, 109, 113, 123, 123, 127,
+ 134, 134, 139, 109, 103, 100, 100, 98, 98, 100, 110, 111, 115, 125, 125,
+ 130, 137, 137, 142, 109, 103, 100, 100, 98, 98, 100, 110, 111, 115, 125,
+ 125, 130, 137, 137, 142,
+ /* Size 32x16 */
+ 64, 63, 63, 62, 61, 61, 62, 67, 67, 69, 74, 74, 78, 84, 84, 90, 98, 98,
+ 97, 97, 97, 98, 98, 98, 100, 101, 102, 104, 104, 106, 109, 109, 62, 63,
+ 63, 63, 63, 63, 65, 70, 70, 73, 78, 78, 81, 85, 85, 90, 95, 95, 94, 93,
+ 93, 93, 93, 93, 95, 96, 96, 98, 98, 100, 103, 103, 62, 63, 63, 63, 64,
+ 64, 66, 71, 72, 74, 80, 80, 82, 86, 86, 89, 93, 93, 92, 92, 92, 91, 91,
+ 91, 93, 93, 94, 96, 96, 97, 100, 100, 63, 64, 64, 64, 65, 66, 67, 72,
+ 73, 75, 82, 82, 84, 87, 87, 90, 94, 94, 93, 92, 92, 91, 91, 91, 93, 93,
+ 94, 96, 96, 97, 100, 100, 71, 73, 74, 74, 76, 76, 77, 82, 83, 85, 91,
+ 91, 92, 93, 93, 94, 96, 96, 94, 93, 93, 92, 91, 92, 93, 93, 94, 95, 95,
+ 96, 98, 98, 74, 76, 77, 77, 79, 80, 81, 86, 86, 89, 94, 94, 95, 95, 95,
+ 95, 96, 96, 95, 94, 94, 92, 92, 92, 93, 93, 94, 94, 95, 96, 98, 98, 77,
+ 79, 80, 80, 81, 82, 83, 87, 88, 90, 95, 95, 95, 96, 96, 97, 98, 98, 97,
+ 96, 96, 95, 94, 94, 96, 96, 96, 97, 97, 98, 100, 100, 94, 93, 92, 92,
+ 91, 91, 91, 93, 93, 94, 95, 95, 97, 100, 100, 102, 105, 105, 105, 105,
+ 105, 105, 105, 105, 106, 106, 106, 107, 107, 108, 110, 110, 96, 95, 94,
+ 94, 92, 92, 92, 94, 94, 94, 95, 95, 97, 100, 100, 103, 106, 106, 106,
+ 106, 106, 107, 107, 107, 108, 108, 108, 109, 109, 109, 111, 111, 97, 95,
+ 94, 94, 92, 92, 92, 93, 93, 94, 94, 94, 96, 100, 100, 103, 106, 106,
+ 107, 108, 108, 109, 110, 110, 111, 111, 111, 112, 112, 113, 115, 115,
+ 98, 96, 94, 94, 91, 91, 91, 91, 92, 91, 91, 91, 94, 99, 99, 103, 107,
+ 107, 110, 112, 112, 115, 117, 117, 119, 119, 120, 122, 122, 123, 125,
+ 125, 98, 96, 94, 94, 91, 91, 91, 91, 92, 91, 91, 91, 94, 99, 99, 103,
+ 107, 107, 110, 112, 112, 115, 117, 117, 119, 119, 120, 122, 122, 123,
+ 125, 125, 101, 98, 97, 96, 93, 93, 93, 93, 93, 93, 92, 92, 95, 100, 100,
+ 104, 108, 108, 111, 113, 113, 117, 119, 120, 122, 123, 123, 126, 127,
+ 127, 130, 130, 105, 101, 100, 100, 97, 96, 96, 95, 95, 95, 94, 94, 97,
+ 101, 101, 105, 109, 109, 113, 115, 115, 120, 123, 123, 127, 128, 129,
+ 133, 133, 134, 137, 137, 105, 101, 100, 100, 97, 96, 96, 95, 95, 95, 94,
+ 94, 97, 101, 101, 105, 109, 109, 113, 115, 115, 120, 123, 123, 127, 128,
+ 129, 133, 133, 134, 137, 137, 109, 106, 104, 104, 101, 100, 100, 99, 99,
+ 98, 97, 97, 100, 104, 104, 108, 111, 111, 115, 118, 118, 123, 125, 126,
+ 130, 131, 132, 137, 137, 139, 142, 142,
+ /* Size 4x16 */
+ 62, 74, 97, 105, 63, 77, 94, 100, 63, 79, 92, 97, 65, 81, 92, 96, 70,
+ 86, 93, 95, 78, 94, 94, 94, 81, 95, 96, 97, 85, 95, 100, 101, 95, 96,
+ 106, 109, 94, 95, 107, 113, 93, 94, 108, 115, 93, 92, 110, 123, 95, 93,
+ 111, 127, 96, 94, 111, 129, 98, 95, 112, 133, 103, 98, 115, 137,
+ /* Size 16x4 */
+ 62, 63, 63, 65, 70, 78, 81, 85, 95, 94, 93, 93, 95, 96, 98, 103, 74, 77,
+ 79, 81, 86, 94, 95, 95, 96, 95, 94, 92, 93, 94, 95, 98, 97, 94, 92, 92,
+ 93, 94, 96, 100, 106, 107, 108, 110, 111, 111, 112, 115, 105, 100, 97,
+ 96, 95, 94, 97, 101, 109, 113, 115, 123, 127, 129, 133, 137,
+ /* Size 8x32 */
+ 64, 62, 71, 77, 96, 98, 101, 105, 63, 63, 73, 79, 95, 96, 98, 101, 63,
+ 63, 74, 80, 94, 94, 97, 100, 62, 63, 74, 80, 94, 94, 96, 100, 61, 64,
+ 76, 81, 92, 91, 93, 97, 61, 64, 76, 82, 92, 91, 93, 96, 62, 66, 77, 83,
+ 92, 91, 93, 96, 67, 71, 82, 87, 94, 91, 93, 95, 67, 72, 83, 88, 94, 92,
+ 93, 95, 69, 74, 85, 90, 94, 91, 93, 95, 74, 80, 91, 95, 95, 91, 92, 94,
+ 74, 80, 91, 95, 95, 91, 92, 94, 78, 82, 92, 95, 97, 94, 95, 97, 84, 86,
+ 93, 96, 100, 99, 100, 101, 84, 86, 93, 96, 100, 99, 100, 101, 90, 89,
+ 94, 97, 103, 103, 104, 105, 98, 93, 96, 98, 106, 107, 108, 109, 98, 93,
+ 96, 98, 106, 107, 108, 109, 97, 92, 94, 97, 106, 110, 111, 113, 97, 92,
+ 93, 96, 106, 112, 113, 115, 97, 92, 93, 96, 106, 112, 113, 115, 98, 91,
+ 92, 95, 107, 115, 117, 120, 98, 91, 91, 94, 107, 117, 119, 123, 98, 91,
+ 92, 94, 107, 117, 120, 123, 100, 93, 93, 96, 108, 119, 122, 127, 101,
+ 93, 93, 96, 108, 119, 123, 128, 102, 94, 94, 96, 108, 120, 123, 129,
+ 104, 96, 95, 97, 109, 122, 126, 133, 104, 96, 95, 97, 109, 122, 127,
+ 133, 106, 97, 96, 98, 109, 123, 127, 134, 109, 100, 98, 100, 111, 125,
+ 130, 137, 109, 100, 98, 100, 111, 125, 130, 137,
+ /* Size 32x8 */
+ 64, 63, 63, 62, 61, 61, 62, 67, 67, 69, 74, 74, 78, 84, 84, 90, 98, 98,
+ 97, 97, 97, 98, 98, 98, 100, 101, 102, 104, 104, 106, 109, 109, 62, 63,
+ 63, 63, 64, 64, 66, 71, 72, 74, 80, 80, 82, 86, 86, 89, 93, 93, 92, 92,
+ 92, 91, 91, 91, 93, 93, 94, 96, 96, 97, 100, 100, 71, 73, 74, 74, 76,
+ 76, 77, 82, 83, 85, 91, 91, 92, 93, 93, 94, 96, 96, 94, 93, 93, 92, 91,
+ 92, 93, 93, 94, 95, 95, 96, 98, 98, 77, 79, 80, 80, 81, 82, 83, 87, 88,
+ 90, 95, 95, 95, 96, 96, 97, 98, 98, 97, 96, 96, 95, 94, 94, 96, 96, 96,
+ 97, 97, 98, 100, 100, 96, 95, 94, 94, 92, 92, 92, 94, 94, 94, 95, 95,
+ 97, 100, 100, 103, 106, 106, 106, 106, 106, 107, 107, 107, 108, 108,
+ 108, 109, 109, 109, 111, 111, 98, 96, 94, 94, 91, 91, 91, 91, 92, 91,
+ 91, 91, 94, 99, 99, 103, 107, 107, 110, 112, 112, 115, 117, 117, 119,
+ 119, 120, 122, 122, 123, 125, 125, 101, 98, 97, 96, 93, 93, 93, 93, 93,
+ 93, 92, 92, 95, 100, 100, 104, 108, 108, 111, 113, 113, 117, 119, 120,
+ 122, 123, 123, 126, 127, 127, 130, 130, 105, 101, 100, 100, 97, 96, 96,
+ 95, 95, 95, 94, 94, 97, 101, 101, 105, 109, 109, 113, 115, 115, 120,
+ 123, 123, 127, 128, 129, 133, 133, 134, 137, 137 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 65, 76, 76, 108,
+#endif
+ /* Size 4x4 */
+ 64, 65, 70, 86, 65, 69, 75, 86, 70, 75, 97, 109, 86, 86, 109, 130,
+ /* Size 8x8 */
+ 63, 63, 64, 64, 68, 75, 86, 94, 63, 65, 65, 65, 68, 72, 82, 89, 64, 65,
+ 67, 68, 71, 76, 84, 91, 64, 65, 68, 71, 74, 79, 85, 92, 68, 68, 71, 74,
+ 82, 90, 98, 104, 75, 72, 76, 79, 90, 103, 112, 119, 86, 82, 84, 85, 98,
+ 112, 127, 134, 94, 89, 91, 92, 104, 119, 134, 142,
+ /* Size 16x16 */
+ 64, 63, 63, 63, 63, 63, 64, 65, 68, 71, 72, 79, 82, 88, 95, 97, 63, 64,
+ 64, 64, 64, 64, 65, 66, 68, 70, 70, 77, 80, 85, 91, 93, 63, 64, 64, 64,
+ 65, 65, 65, 66, 68, 69, 70, 76, 79, 84, 90, 91, 63, 64, 64, 65, 65, 65,
+ 65, 66, 67, 68, 69, 75, 77, 82, 88, 89, 63, 64, 65, 65, 66, 66, 67, 68,
+ 70, 72, 72, 78, 80, 84, 89, 91, 63, 64, 65, 65, 66, 67, 68, 69, 71, 72,
+ 73, 78, 81, 84, 90, 91, 64, 65, 65, 65, 67, 68, 71, 72, 74, 76, 77, 81,
+ 83, 85, 90, 92, 65, 66, 66, 66, 68, 69, 72, 73, 76, 79, 80, 84, 86, 89,
+ 94, 95, 68, 68, 68, 67, 70, 71, 74, 76, 79, 84, 85, 90, 92, 95, 100,
+ 102, 71, 70, 69, 68, 72, 72, 76, 79, 84, 92, 94, 99, 101, 105, 110, 111,
+ 72, 70, 70, 69, 72, 73, 77, 80, 85, 94, 97, 101, 104, 108, 112, 114, 79,
+ 77, 76, 75, 78, 78, 81, 84, 90, 99, 101, 108, 111, 116, 121, 122, 82,
+ 80, 79, 77, 80, 81, 83, 86, 92, 101, 104, 111, 114, 120, 125, 127, 88,
+ 85, 84, 82, 84, 84, 85, 89, 95, 105, 108, 116, 120, 127, 133, 134, 95,
+ 91, 90, 88, 89, 90, 90, 94, 100, 110, 112, 121, 125, 133, 139, 141, 97,
+ 93, 91, 89, 91, 91, 92, 95, 102, 111, 114, 122, 127, 134, 141, 142,
+ /* Size 32x32 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 65, 68, 68, 68,
+ 71, 72, 72, 76, 79, 79, 82, 88, 88, 90, 95, 97, 97, 103, 63, 63, 63, 63,
+ 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 66, 68, 68, 68, 70, 71, 71, 75,
+ 78, 78, 81, 86, 86, 88, 93, 94, 94, 100, 63, 63, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 65, 65, 65, 66, 68, 68, 68, 70, 70, 70, 74, 77, 77, 80, 85,
+ 85, 86, 91, 93, 93, 99, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65,
+ 65, 65, 66, 68, 68, 68, 70, 70, 70, 74, 77, 77, 80, 85, 85, 86, 91, 93,
+ 93, 99, 63, 63, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 66, 68,
+ 68, 68, 69, 70, 70, 73, 76, 76, 79, 84, 84, 85, 90, 91, 91, 97, 63, 63,
+ 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 67, 67, 68, 68, 69,
+ 69, 72, 75, 75, 77, 82, 82, 83, 88, 89, 89, 95, 63, 63, 64, 64, 64, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 66, 67, 67, 68, 68, 69, 69, 72, 75, 75,
+ 77, 82, 82, 83, 88, 89, 89, 95, 63, 64, 64, 64, 64, 65, 65, 65, 65, 65,
+ 65, 66, 66, 66, 67, 68, 68, 68, 69, 70, 70, 73, 76, 76, 78, 82, 82, 84,
+ 88, 90, 90, 95, 63, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 67, 67, 67,
+ 68, 70, 70, 70, 72, 72, 72, 75, 78, 78, 80, 84, 84, 85, 89, 91, 91, 96,
+ 63, 64, 64, 64, 65, 65, 65, 65, 66, 67, 67, 67, 68, 68, 69, 71, 71, 71,
+ 72, 73, 73, 76, 78, 78, 81, 84, 84, 85, 90, 91, 91, 96, 63, 64, 64, 64,
+ 65, 65, 65, 65, 66, 67, 67, 67, 68, 68, 69, 71, 71, 71, 72, 73, 73, 76,
+ 78, 78, 81, 84, 84, 85, 90, 91, 91, 96, 64, 64, 65, 65, 65, 65, 65, 66,
+ 67, 67, 67, 69, 70, 70, 71, 72, 72, 73, 75, 75, 75, 78, 80, 80, 82, 85,
+ 85, 86, 90, 91, 91, 96, 64, 64, 65, 65, 65, 65, 65, 66, 67, 68, 68, 70,
+ 71, 71, 72, 74, 74, 74, 76, 77, 77, 79, 81, 81, 83, 85, 85, 87, 90, 92,
+ 92, 96, 64, 64, 65, 65, 65, 65, 65, 66, 67, 68, 68, 70, 71, 71, 72, 74,
+ 74, 74, 76, 77, 77, 79, 81, 81, 83, 85, 85, 87, 90, 92, 92, 96, 65, 66,
+ 66, 66, 66, 66, 66, 67, 68, 69, 69, 71, 72, 72, 73, 76, 76, 76, 79, 80,
+ 80, 82, 84, 84, 86, 89, 89, 90, 94, 95, 95, 100, 68, 68, 68, 68, 68, 67,
+ 67, 68, 70, 71, 71, 72, 74, 74, 76, 79, 79, 80, 84, 85, 85, 88, 90, 90,
+ 92, 95, 95, 97, 100, 102, 102, 106, 68, 68, 68, 68, 68, 67, 67, 68, 70,
+ 71, 71, 72, 74, 74, 76, 79, 79, 80, 84, 85, 85, 88, 90, 90, 92, 95, 95,
+ 97, 100, 102, 102, 106, 68, 68, 68, 68, 68, 68, 68, 68, 70, 71, 71, 73,
+ 74, 74, 76, 80, 80, 82, 86, 88, 88, 90, 92, 92, 94, 98, 98, 99, 103,
+ 104, 104, 108, 71, 70, 70, 70, 69, 68, 68, 69, 72, 72, 72, 75, 76, 76,
+ 79, 84, 84, 86, 92, 94, 94, 97, 99, 99, 101, 105, 105, 106, 110, 111,
+ 111, 115, 72, 71, 70, 70, 70, 69, 69, 70, 72, 73, 73, 75, 77, 77, 80,
+ 85, 85, 88, 94, 97, 97, 100, 101, 101, 104, 108, 108, 109, 112, 114,
+ 114, 117, 72, 71, 70, 70, 70, 69, 69, 70, 72, 73, 73, 75, 77, 77, 80,
+ 85, 85, 88, 94, 97, 97, 100, 101, 101, 104, 108, 108, 109, 112, 114,
+ 114, 117, 76, 75, 74, 74, 73, 72, 72, 73, 75, 76, 76, 78, 79, 79, 82,
+ 88, 88, 90, 97, 100, 100, 103, 105, 105, 108, 112, 112, 114, 117, 119,
+ 119, 123, 79, 78, 77, 77, 76, 75, 75, 76, 78, 78, 78, 80, 81, 81, 84,
+ 90, 90, 92, 99, 101, 101, 105, 108, 108, 111, 116, 116, 117, 121, 122,
+ 122, 127, 79, 78, 77, 77, 76, 75, 75, 76, 78, 78, 78, 80, 81, 81, 84,
+ 90, 90, 92, 99, 101, 101, 105, 108, 108, 111, 116, 116, 117, 121, 122,
+ 122, 127, 82, 81, 80, 80, 79, 77, 77, 78, 80, 81, 81, 82, 83, 83, 86,
+ 92, 92, 94, 101, 104, 104, 108, 111, 111, 114, 120, 120, 121, 125, 127,
+ 127, 132, 88, 86, 85, 85, 84, 82, 82, 82, 84, 84, 84, 85, 85, 85, 89,
+ 95, 95, 98, 105, 108, 108, 112, 116, 116, 120, 127, 127, 128, 133, 134,
+ 134, 139, 88, 86, 85, 85, 84, 82, 82, 82, 84, 84, 84, 85, 85, 85, 89,
+ 95, 95, 98, 105, 108, 108, 112, 116, 116, 120, 127, 127, 128, 133, 134,
+ 134, 139, 90, 88, 86, 86, 85, 83, 83, 84, 85, 85, 85, 86, 87, 87, 90,
+ 97, 97, 99, 106, 109, 109, 114, 117, 117, 121, 128, 128, 130, 134, 136,
+ 136, 141, 95, 93, 91, 91, 90, 88, 88, 88, 89, 90, 90, 90, 90, 90, 94,
+ 100, 100, 103, 110, 112, 112, 117, 121, 121, 125, 133, 133, 134, 139,
+ 141, 141, 146, 97, 94, 93, 93, 91, 89, 89, 90, 91, 91, 91, 91, 92, 92,
+ 95, 102, 102, 104, 111, 114, 114, 119, 122, 122, 127, 134, 134, 136,
+ 141, 142, 142, 148, 97, 94, 93, 93, 91, 89, 89, 90, 91, 91, 91, 91, 92,
+ 92, 95, 102, 102, 104, 111, 114, 114, 119, 122, 122, 127, 134, 134, 136,
+ 141, 142, 142, 148, 103, 100, 99, 99, 97, 95, 95, 95, 96, 96, 96, 96,
+ 96, 96, 100, 106, 106, 108, 115, 117, 117, 123, 127, 127, 132, 139, 139,
+ 141, 146, 148, 148, 155,
+ /* Size 4x8 */
+ 63, 65, 71, 86, 64, 66, 69, 82, 65, 68, 73, 84, 65, 71, 77, 85, 68, 74,
+ 87, 98, 74, 80, 99, 112, 84, 86, 107, 126, 92, 93, 113, 134,
+ /* Size 8x4 */
+ 63, 64, 65, 65, 68, 74, 84, 92, 65, 66, 68, 71, 74, 80, 86, 93, 71, 69,
+ 73, 77, 87, 99, 107, 113, 86, 82, 84, 85, 98, 112, 126, 134,
+ /* Size 8x16 */
+ 64, 63, 63, 64, 70, 72, 88, 95, 63, 64, 64, 65, 70, 71, 85, 91, 63, 64,
+ 65, 65, 69, 70, 83, 90, 63, 65, 65, 66, 68, 69, 82, 88, 63, 65, 66, 68,
+ 71, 72, 84, 89, 64, 65, 66, 68, 72, 73, 84, 90, 64, 66, 68, 71, 75, 77,
+ 85, 90, 65, 66, 69, 72, 78, 80, 89, 94, 68, 68, 70, 74, 83, 85, 96, 101,
+ 71, 69, 72, 76, 90, 94, 105, 110, 72, 69, 72, 77, 92, 96, 108, 112, 79,
+ 75, 78, 81, 96, 101, 116, 121, 82, 78, 80, 83, 99, 103, 120, 125, 88,
+ 82, 84, 86, 102, 107, 126, 132, 94, 88, 89, 91, 107, 112, 132, 139, 96,
+ 90, 91, 93, 108, 113, 134, 140,
+ /* Size 16x8 */
+ 64, 63, 63, 63, 63, 64, 64, 65, 68, 71, 72, 79, 82, 88, 94, 96, 63, 64,
+ 64, 65, 65, 65, 66, 66, 68, 69, 69, 75, 78, 82, 88, 90, 63, 64, 65, 65,
+ 66, 66, 68, 69, 70, 72, 72, 78, 80, 84, 89, 91, 64, 65, 65, 66, 68, 68,
+ 71, 72, 74, 76, 77, 81, 83, 86, 91, 93, 70, 70, 69, 68, 71, 72, 75, 78,
+ 83, 90, 92, 96, 99, 102, 107, 108, 72, 71, 70, 69, 72, 73, 77, 80, 85,
+ 94, 96, 101, 103, 107, 112, 113, 88, 85, 83, 82, 84, 84, 85, 89, 96,
+ 105, 108, 116, 120, 126, 132, 134, 95, 91, 90, 88, 89, 90, 90, 94, 101,
+ 110, 112, 121, 125, 132, 139, 140,
+ /* Size 16x32 */
+ 64, 63, 63, 63, 63, 64, 64, 65, 70, 72, 72, 81, 88, 88, 95, 107, 63, 63,
+ 64, 64, 64, 65, 65, 66, 70, 71, 71, 79, 86, 86, 93, 105, 63, 64, 64, 64,
+ 64, 65, 65, 66, 70, 71, 71, 79, 85, 85, 91, 103, 63, 64, 64, 64, 64, 65,
+ 65, 66, 70, 71, 71, 79, 85, 85, 91, 103, 63, 64, 64, 64, 65, 65, 65, 66,
+ 69, 70, 70, 78, 83, 83, 90, 101, 63, 64, 65, 65, 65, 66, 66, 66, 68, 69,
+ 69, 76, 82, 82, 88, 99, 63, 64, 65, 65, 65, 66, 66, 66, 68, 69, 69, 76,
+ 82, 82, 88, 99, 63, 64, 65, 65, 65, 66, 66, 67, 69, 70, 70, 77, 82, 82,
+ 88, 99, 63, 64, 65, 65, 66, 68, 68, 69, 71, 72, 72, 79, 84, 84, 89, 99,
+ 64, 65, 65, 65, 66, 68, 68, 69, 72, 73, 73, 79, 84, 84, 90, 100, 64, 65,
+ 65, 65, 66, 68, 68, 69, 72, 73, 73, 79, 84, 84, 90, 100, 64, 65, 65, 65,
+ 67, 70, 70, 71, 74, 75, 75, 81, 85, 85, 90, 99, 64, 65, 66, 66, 68, 71,
+ 71, 72, 75, 77, 77, 82, 85, 85, 90, 99, 64, 65, 66, 66, 68, 71, 71, 72,
+ 75, 77, 77, 82, 85, 85, 90, 99, 65, 66, 66, 66, 69, 72, 72, 73, 78, 80,
+ 80, 85, 89, 89, 94, 103, 68, 68, 68, 68, 70, 74, 74, 76, 83, 85, 85, 91,
+ 96, 96, 101, 109, 68, 68, 68, 68, 70, 74, 74, 76, 83, 85, 85, 91, 96,
+ 96, 101, 109, 68, 68, 68, 68, 70, 74, 74, 77, 84, 87, 87, 93, 98, 98,
+ 103, 111, 71, 70, 69, 69, 72, 76, 76, 79, 90, 94, 94, 100, 105, 105,
+ 110, 118, 72, 70, 69, 69, 72, 77, 77, 80, 92, 96, 96, 103, 108, 108,
+ 112, 120, 72, 70, 69, 69, 72, 77, 77, 80, 92, 96, 96, 103, 108, 108,
+ 112, 120, 76, 74, 73, 73, 75, 80, 80, 83, 94, 99, 99, 107, 112, 112,
+ 117, 126, 79, 77, 75, 75, 78, 81, 81, 85, 96, 101, 101, 109, 116, 116,
+ 121, 130, 79, 77, 75, 75, 78, 81, 81, 85, 96, 101, 101, 109, 116, 116,
+ 121, 130, 82, 80, 78, 78, 80, 83, 83, 87, 99, 103, 103, 113, 120, 120,
+ 125, 135, 88, 84, 82, 82, 84, 86, 86, 90, 102, 107, 107, 118, 126, 126,
+ 132, 143, 88, 84, 82, 82, 84, 86, 86, 90, 102, 107, 107, 118, 126, 126,
+ 132, 143, 89, 86, 84, 84, 85, 87, 87, 91, 103, 108, 108, 119, 128, 128,
+ 134, 145, 94, 91, 88, 88, 89, 91, 91, 95, 107, 112, 112, 123, 132, 132,
+ 139, 150, 96, 92, 90, 90, 91, 93, 93, 96, 108, 113, 113, 125, 134, 134,
+ 140, 152, 96, 92, 90, 90, 91, 93, 93, 96, 108, 113, 113, 125, 134, 134,
+ 140, 152, 103, 98, 95, 95, 96, 97, 97, 100, 112, 117, 117, 129, 139,
+ 139, 146, 159,
+ /* Size 32x16 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 65, 68, 68, 68,
+ 71, 72, 72, 76, 79, 79, 82, 88, 88, 89, 94, 96, 96, 103, 63, 63, 64, 64,
+ 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 66, 68, 68, 68, 70, 70, 70, 74,
+ 77, 77, 80, 84, 84, 86, 91, 92, 92, 98, 63, 64, 64, 64, 64, 65, 65, 65,
+ 65, 65, 65, 65, 66, 66, 66, 68, 68, 68, 69, 69, 69, 73, 75, 75, 78, 82,
+ 82, 84, 88, 90, 90, 95, 63, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65,
+ 66, 66, 66, 68, 68, 68, 69, 69, 69, 73, 75, 75, 78, 82, 82, 84, 88, 90,
+ 90, 95, 63, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 67, 68, 68, 69, 70,
+ 70, 70, 72, 72, 72, 75, 78, 78, 80, 84, 84, 85, 89, 91, 91, 96, 64, 65,
+ 65, 65, 65, 66, 66, 66, 68, 68, 68, 70, 71, 71, 72, 74, 74, 74, 76, 77,
+ 77, 80, 81, 81, 83, 86, 86, 87, 91, 93, 93, 97, 64, 65, 65, 65, 65, 66,
+ 66, 66, 68, 68, 68, 70, 71, 71, 72, 74, 74, 74, 76, 77, 77, 80, 81, 81,
+ 83, 86, 86, 87, 91, 93, 93, 97, 65, 66, 66, 66, 66, 66, 66, 67, 69, 69,
+ 69, 71, 72, 72, 73, 76, 76, 77, 79, 80, 80, 83, 85, 85, 87, 90, 90, 91,
+ 95, 96, 96, 100, 70, 70, 70, 70, 69, 68, 68, 69, 71, 72, 72, 74, 75, 75,
+ 78, 83, 83, 84, 90, 92, 92, 94, 96, 96, 99, 102, 102, 103, 107, 108,
+ 108, 112, 72, 71, 71, 71, 70, 69, 69, 70, 72, 73, 73, 75, 77, 77, 80,
+ 85, 85, 87, 94, 96, 96, 99, 101, 101, 103, 107, 107, 108, 112, 113, 113,
+ 117, 72, 71, 71, 71, 70, 69, 69, 70, 72, 73, 73, 75, 77, 77, 80, 85, 85,
+ 87, 94, 96, 96, 99, 101, 101, 103, 107, 107, 108, 112, 113, 113, 117,
+ 81, 79, 79, 79, 78, 76, 76, 77, 79, 79, 79, 81, 82, 82, 85, 91, 91, 93,
+ 100, 103, 103, 107, 109, 109, 113, 118, 118, 119, 123, 125, 125, 129,
+ 88, 86, 85, 85, 83, 82, 82, 82, 84, 84, 84, 85, 85, 85, 89, 96, 96, 98,
+ 105, 108, 108, 112, 116, 116, 120, 126, 126, 128, 132, 134, 134, 139,
+ 88, 86, 85, 85, 83, 82, 82, 82, 84, 84, 84, 85, 85, 85, 89, 96, 96, 98,
+ 105, 108, 108, 112, 116, 116, 120, 126, 126, 128, 132, 134, 134, 139,
+ 95, 93, 91, 91, 90, 88, 88, 88, 89, 90, 90, 90, 90, 90, 94, 101, 101,
+ 103, 110, 112, 112, 117, 121, 121, 125, 132, 132, 134, 139, 140, 140,
+ 146, 107, 105, 103, 103, 101, 99, 99, 99, 99, 100, 100, 99, 99, 99, 103,
+ 109, 109, 111, 118, 120, 120, 126, 130, 130, 135, 143, 143, 145, 150,
+ 152, 152, 159,
+ /* Size 4x16 */
+ 63, 64, 72, 88, 64, 65, 71, 85, 64, 65, 70, 83, 64, 66, 69, 82, 64, 68,
+ 72, 84, 65, 68, 73, 84, 65, 71, 77, 85, 66, 72, 80, 89, 68, 74, 85, 96,
+ 70, 76, 94, 105, 70, 77, 96, 108, 77, 81, 101, 116, 80, 83, 103, 120,
+ 84, 86, 107, 126, 91, 91, 112, 132, 92, 93, 113, 134,
+ /* Size 16x4 */
+ 63, 64, 64, 64, 64, 65, 65, 66, 68, 70, 70, 77, 80, 84, 91, 92, 64, 65,
+ 65, 66, 68, 68, 71, 72, 74, 76, 77, 81, 83, 86, 91, 93, 72, 71, 70, 69,
+ 72, 73, 77, 80, 85, 94, 96, 101, 103, 107, 112, 113, 88, 85, 83, 82, 84,
+ 84, 85, 89, 96, 105, 108, 116, 120, 126, 132, 134,
+ /* Size 8x32 */
+ 64, 63, 63, 64, 70, 72, 88, 95, 63, 64, 64, 65, 70, 71, 86, 93, 63, 64,
+ 64, 65, 70, 71, 85, 91, 63, 64, 64, 65, 70, 71, 85, 91, 63, 64, 65, 65,
+ 69, 70, 83, 90, 63, 65, 65, 66, 68, 69, 82, 88, 63, 65, 65, 66, 68, 69,
+ 82, 88, 63, 65, 65, 66, 69, 70, 82, 88, 63, 65, 66, 68, 71, 72, 84, 89,
+ 64, 65, 66, 68, 72, 73, 84, 90, 64, 65, 66, 68, 72, 73, 84, 90, 64, 65,
+ 67, 70, 74, 75, 85, 90, 64, 66, 68, 71, 75, 77, 85, 90, 64, 66, 68, 71,
+ 75, 77, 85, 90, 65, 66, 69, 72, 78, 80, 89, 94, 68, 68, 70, 74, 83, 85,
+ 96, 101, 68, 68, 70, 74, 83, 85, 96, 101, 68, 68, 70, 74, 84, 87, 98,
+ 103, 71, 69, 72, 76, 90, 94, 105, 110, 72, 69, 72, 77, 92, 96, 108, 112,
+ 72, 69, 72, 77, 92, 96, 108, 112, 76, 73, 75, 80, 94, 99, 112, 117, 79,
+ 75, 78, 81, 96, 101, 116, 121, 79, 75, 78, 81, 96, 101, 116, 121, 82,
+ 78, 80, 83, 99, 103, 120, 125, 88, 82, 84, 86, 102, 107, 126, 132, 88,
+ 82, 84, 86, 102, 107, 126, 132, 89, 84, 85, 87, 103, 108, 128, 134, 94,
+ 88, 89, 91, 107, 112, 132, 139, 96, 90, 91, 93, 108, 113, 134, 140, 96,
+ 90, 91, 93, 108, 113, 134, 140, 103, 95, 96, 97, 112, 117, 139, 146,
+ /* Size 32x8 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 65, 68, 68, 68,
+ 71, 72, 72, 76, 79, 79, 82, 88, 88, 89, 94, 96, 96, 103, 63, 64, 64, 64,
+ 64, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 68, 68, 68, 69, 69, 69, 73,
+ 75, 75, 78, 82, 82, 84, 88, 90, 90, 95, 63, 64, 64, 64, 65, 65, 65, 65,
+ 66, 66, 66, 67, 68, 68, 69, 70, 70, 70, 72, 72, 72, 75, 78, 78, 80, 84,
+ 84, 85, 89, 91, 91, 96, 64, 65, 65, 65, 65, 66, 66, 66, 68, 68, 68, 70,
+ 71, 71, 72, 74, 74, 74, 76, 77, 77, 80, 81, 81, 83, 86, 86, 87, 91, 93,
+ 93, 97, 70, 70, 70, 70, 69, 68, 68, 69, 71, 72, 72, 74, 75, 75, 78, 83,
+ 83, 84, 90, 92, 92, 94, 96, 96, 99, 102, 102, 103, 107, 108, 108, 112,
+ 72, 71, 71, 71, 70, 69, 69, 70, 72, 73, 73, 75, 77, 77, 80, 85, 85, 87,
+ 94, 96, 96, 99, 101, 101, 103, 107, 107, 108, 112, 113, 113, 117, 88,
+ 86, 85, 85, 83, 82, 82, 82, 84, 84, 84, 85, 85, 85, 89, 96, 96, 98, 105,
+ 108, 108, 112, 116, 116, 120, 126, 126, 128, 132, 134, 134, 139, 95, 93,
+ 91, 91, 90, 88, 88, 88, 89, 90, 90, 90, 90, 90, 94, 101, 101, 103, 110,
+ 112, 112, 117, 121, 121, 125, 132, 132, 134, 139, 140, 140, 146 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 66, 91, 91, 109,
+#endif
+ /* Size 4x4 */
+ 63, 74, 95, 94, 74, 88, 95, 91, 95, 95, 106, 107, 94, 91, 107, 118,
+ /* Size 8x8 */
+ 63, 62, 68, 75, 86, 96, 95, 99, 62, 64, 71, 80, 87, 92, 90, 93, 68, 71,
+ 78, 87, 91, 93, 91, 93, 75, 80, 87, 95, 95, 94, 91, 92, 86, 87, 91, 95,
+ 99, 101, 100, 101, 96, 92, 93, 94, 101, 107, 110, 111, 95, 90, 91, 91,
+ 100, 110, 117, 120, 99, 93, 93, 92, 101, 111, 120, 123,
+ /* Size 16x16 */
+ 64, 62, 62, 61, 66, 67, 73, 77, 83, 95, 98, 97, 98, 98, 101, 101, 62,
+ 63, 63, 62, 68, 69, 77, 80, 85, 93, 95, 94, 94, 94, 96, 97, 62, 63, 63,
+ 63, 68, 70, 78, 81, 85, 92, 94, 93, 93, 92, 95, 95, 61, 62, 63, 64, 69,
+ 71, 80, 82, 85, 91, 93, 91, 91, 90, 92, 93, 66, 68, 68, 69, 75, 77, 85,
+ 87, 89, 93, 94, 92, 92, 91, 93, 93, 67, 69, 70, 71, 77, 78, 87, 88, 90,
+ 94, 95, 93, 92, 91, 93, 93, 73, 77, 78, 80, 85, 87, 95, 95, 95, 95, 96,
+ 93, 92, 91, 92, 92, 77, 80, 81, 82, 87, 88, 95, 95, 96, 97, 98, 96, 95,
+ 94, 95, 95, 83, 85, 85, 85, 89, 90, 95, 96, 97, 100, 101, 99, 99, 98,
+ 100, 100, 95, 93, 92, 91, 93, 94, 95, 97, 100, 104, 105, 105, 105, 105,
+ 106, 106, 98, 95, 94, 93, 94, 95, 96, 98, 101, 105, 106, 106, 107, 107,
+ 108, 108, 97, 94, 93, 91, 92, 93, 93, 96, 99, 105, 106, 109, 110, 111,
+ 113, 113, 98, 94, 93, 91, 92, 92, 92, 95, 99, 105, 107, 110, 111, 114,
+ 115, 116, 98, 94, 92, 90, 91, 91, 91, 94, 98, 105, 107, 111, 114, 117,
+ 119, 120, 101, 96, 95, 92, 93, 93, 92, 95, 100, 106, 108, 113, 115, 119,
+ 122, 122, 101, 97, 95, 93, 93, 93, 92, 95, 100, 106, 108, 113, 116, 120,
+ 122, 123,
+ /* Size 32x32 */
+ 64, 63, 62, 62, 62, 61, 61, 62, 66, 67, 67, 71, 73, 73, 77, 83, 83, 86,
+ 95, 98, 98, 98, 97, 97, 98, 98, 98, 99, 101, 101, 101, 103, 63, 63, 63,
+ 63, 62, 62, 62, 63, 67, 68, 68, 72, 75, 75, 79, 84, 84, 86, 94, 96, 96,
+ 96, 95, 95, 95, 95, 95, 96, 98, 99, 99, 100, 62, 63, 63, 63, 63, 62, 62,
+ 64, 68, 69, 69, 74, 77, 77, 80, 85, 85, 87, 93, 95, 95, 95, 94, 94, 94,
+ 94, 94, 94, 96, 97, 97, 99, 62, 63, 63, 63, 63, 62, 62, 64, 68, 69, 69,
+ 74, 77, 77, 80, 85, 85, 87, 93, 95, 95, 95, 94, 94, 94, 94, 94, 94, 96,
+ 97, 97, 99, 62, 62, 63, 63, 63, 63, 63, 64, 68, 70, 70, 75, 78, 78, 81,
+ 85, 85, 87, 92, 94, 94, 93, 93, 93, 93, 92, 92, 93, 95, 95, 95, 97, 61,
+ 62, 62, 62, 63, 64, 64, 65, 69, 71, 71, 76, 80, 80, 82, 85, 85, 87, 91,
+ 93, 93, 92, 91, 91, 91, 90, 90, 91, 92, 93, 93, 94, 61, 62, 62, 62, 63,
+ 64, 64, 65, 69, 71, 71, 76, 80, 80, 82, 85, 85, 87, 91, 93, 93, 92, 91,
+ 91, 91, 90, 90, 91, 92, 93, 93, 94, 62, 63, 64, 64, 64, 65, 65, 66, 71,
+ 72, 72, 77, 81, 81, 83, 86, 86, 87, 92, 93, 93, 92, 91, 91, 91, 90, 90,
+ 91, 92, 93, 93, 94, 66, 67, 68, 68, 68, 69, 69, 71, 75, 77, 77, 82, 85,
+ 85, 87, 89, 89, 90, 93, 94, 94, 93, 92, 92, 92, 91, 91, 91, 93, 93, 93,
+ 94, 67, 68, 69, 69, 70, 71, 71, 72, 77, 78, 78, 83, 87, 87, 88, 90, 90,
+ 91, 94, 95, 95, 93, 93, 93, 92, 91, 91, 91, 93, 93, 93, 94, 67, 68, 69,
+ 69, 70, 71, 71, 72, 77, 78, 78, 83, 87, 87, 88, 90, 90, 91, 94, 95, 95,
+ 93, 93, 93, 92, 91, 91, 91, 93, 93, 93, 94, 71, 72, 74, 74, 75, 76, 76,
+ 77, 82, 83, 83, 88, 92, 92, 92, 93, 93, 93, 95, 95, 95, 94, 93, 93, 92,
+ 91, 91, 91, 92, 93, 93, 94, 73, 75, 77, 77, 78, 80, 80, 81, 85, 87, 87,
+ 92, 95, 95, 95, 95, 95, 95, 95, 96, 96, 94, 93, 93, 92, 91, 91, 91, 92,
+ 92, 92, 93, 73, 75, 77, 77, 78, 80, 80, 81, 85, 87, 87, 92, 95, 95, 95,
+ 95, 95, 95, 95, 96, 96, 94, 93, 93, 92, 91, 91, 91, 92, 92, 92, 93, 77,
+ 79, 80, 80, 81, 82, 82, 83, 87, 88, 88, 92, 95, 95, 95, 96, 96, 96, 97,
+ 98, 98, 96, 96, 96, 95, 94, 94, 94, 95, 95, 95, 96, 83, 84, 85, 85, 85,
+ 85, 85, 86, 89, 90, 90, 93, 95, 95, 96, 97, 97, 98, 100, 101, 101, 100,
+ 99, 99, 99, 98, 98, 99, 100, 100, 100, 101, 83, 84, 85, 85, 85, 85, 85,
+ 86, 89, 90, 90, 93, 95, 95, 96, 97, 97, 98, 100, 101, 101, 100, 99, 99,
+ 99, 98, 98, 99, 100, 100, 100, 101, 86, 86, 87, 87, 87, 87, 87, 87, 90,
+ 91, 91, 93, 95, 95, 96, 98, 98, 99, 101, 102, 102, 101, 101, 101, 100,
+ 100, 100, 100, 101, 101, 101, 102, 95, 94, 93, 93, 92, 91, 91, 92, 93,
+ 94, 94, 95, 95, 95, 97, 100, 100, 101, 104, 105, 105, 105, 105, 105,
+ 105, 105, 105, 105, 106, 106, 106, 107, 98, 96, 95, 95, 94, 93, 93, 93,
+ 94, 95, 95, 95, 96, 96, 98, 101, 101, 102, 105, 106, 106, 106, 106, 106,
+ 107, 107, 107, 107, 108, 108, 108, 108, 98, 96, 95, 95, 94, 93, 93, 93,
+ 94, 95, 95, 95, 96, 96, 98, 101, 101, 102, 105, 106, 106, 106, 106, 106,
+ 107, 107, 107, 107, 108, 108, 108, 108, 98, 96, 95, 95, 93, 92, 92, 92,
+ 93, 93, 93, 94, 94, 94, 96, 100, 100, 101, 105, 106, 106, 107, 108, 108,
+ 108, 110, 110, 110, 111, 111, 111, 112, 97, 95, 94, 94, 93, 91, 91, 91,
+ 92, 93, 93, 93, 93, 93, 96, 99, 99, 101, 105, 106, 106, 108, 109, 109,
+ 110, 111, 111, 112, 113, 113, 113, 114, 97, 95, 94, 94, 93, 91, 91, 91,
+ 92, 93, 93, 93, 93, 93, 96, 99, 99, 101, 105, 106, 106, 108, 109, 109,
+ 110, 111, 111, 112, 113, 113, 113, 114, 98, 95, 94, 94, 93, 91, 91, 91,
+ 92, 92, 92, 92, 92, 92, 95, 99, 99, 100, 105, 107, 107, 108, 110, 110,
+ 111, 114, 114, 114, 115, 116, 116, 117, 98, 95, 94, 94, 92, 90, 90, 90,
+ 91, 91, 91, 91, 91, 91, 94, 98, 98, 100, 105, 107, 107, 110, 111, 111,
+ 114, 117, 117, 118, 119, 120, 120, 121, 98, 95, 94, 94, 92, 90, 90, 90,
+ 91, 91, 91, 91, 91, 91, 94, 98, 98, 100, 105, 107, 107, 110, 111, 111,
+ 114, 117, 117, 118, 119, 120, 120, 121, 99, 96, 94, 94, 93, 91, 91, 91,
+ 91, 91, 91, 91, 91, 91, 94, 99, 99, 100, 105, 107, 107, 110, 112, 112,
+ 114, 118, 118, 118, 120, 120, 120, 122, 101, 98, 96, 96, 95, 92, 92, 92,
+ 93, 93, 93, 92, 92, 92, 95, 100, 100, 101, 106, 108, 108, 111, 113, 113,
+ 115, 119, 119, 120, 122, 122, 122, 125, 101, 99, 97, 97, 95, 93, 93, 93,
+ 93, 93, 93, 93, 92, 92, 95, 100, 100, 101, 106, 108, 108, 111, 113, 113,
+ 116, 120, 120, 120, 122, 123, 123, 126, 101, 99, 97, 97, 95, 93, 93, 93,
+ 93, 93, 93, 93, 92, 92, 95, 100, 100, 101, 106, 108, 108, 111, 113, 113,
+ 116, 120, 120, 120, 122, 123, 123, 126, 103, 100, 99, 99, 97, 94, 94,
+ 94, 94, 94, 94, 94, 93, 93, 96, 101, 101, 102, 107, 108, 108, 112, 114,
+ 114, 117, 121, 121, 122, 125, 126, 126, 129,
+ /* Size 4x8 */
+ 63, 76, 95, 96, 63, 80, 92, 91, 70, 86, 94, 92, 78, 94, 95, 91, 87, 95,
+ 101, 100, 94, 95, 106, 110, 93, 92, 107, 117, 96, 93, 108, 119,
+ /* Size 8x4 */
+ 63, 63, 70, 78, 87, 94, 93, 96, 76, 80, 86, 94, 95, 95, 92, 93, 95, 92,
+ 94, 95, 101, 106, 107, 108, 96, 91, 92, 91, 100, 110, 117, 119,
+ /* Size 8x16 */
+ 64, 62, 66, 74, 91, 96, 98, 101, 63, 63, 68, 77, 90, 94, 94, 97, 62, 64,
+ 69, 78, 90, 93, 93, 95, 61, 64, 70, 80, 89, 92, 91, 93, 66, 70, 75, 85,
+ 92, 94, 91, 93, 67, 72, 77, 86, 92, 94, 92, 93, 74, 80, 86, 94, 95, 95,
+ 91, 92, 78, 82, 87, 95, 97, 97, 94, 95, 84, 86, 89, 95, 99, 100, 99,
+ 100, 95, 92, 93, 96, 103, 105, 106, 106, 98, 93, 94, 96, 104, 106, 107,
+ 108, 97, 92, 93, 94, 103, 106, 112, 113, 97, 91, 92, 93, 103, 106, 114,
+ 115, 98, 91, 91, 92, 103, 107, 117, 119, 100, 93, 93, 93, 104, 108, 119,
+ 122, 101, 93, 93, 93, 105, 108, 119, 123,
+ /* Size 16x8 */
+ 64, 63, 62, 61, 66, 67, 74, 78, 84, 95, 98, 97, 97, 98, 100, 101, 62,
+ 63, 64, 64, 70, 72, 80, 82, 86, 92, 93, 92, 91, 91, 93, 93, 66, 68, 69,
+ 70, 75, 77, 86, 87, 89, 93, 94, 93, 92, 91, 93, 93, 74, 77, 78, 80, 85,
+ 86, 94, 95, 95, 96, 96, 94, 93, 92, 93, 93, 91, 90, 90, 89, 92, 92, 95,
+ 97, 99, 103, 104, 103, 103, 103, 104, 105, 96, 94, 93, 92, 94, 94, 95,
+ 97, 100, 105, 106, 106, 106, 107, 108, 108, 98, 94, 93, 91, 91, 92, 91,
+ 94, 99, 106, 107, 112, 114, 117, 119, 119, 101, 97, 95, 93, 93, 93, 92,
+ 95, 100, 106, 108, 113, 115, 119, 122, 123,
+ /* Size 16x32 */
+ 64, 62, 62, 62, 66, 74, 74, 77, 91, 96, 96, 98, 98, 98, 101, 105, 63,
+ 63, 63, 63, 67, 76, 76, 79, 90, 95, 95, 96, 96, 96, 98, 102, 63, 63, 63,
+ 63, 68, 77, 77, 80, 90, 94, 94, 94, 94, 94, 97, 100, 63, 63, 63, 63, 68,
+ 77, 77, 80, 90, 94, 94, 94, 94, 94, 97, 100, 62, 63, 64, 64, 69, 78, 78,
+ 81, 90, 93, 93, 93, 93, 93, 95, 98, 61, 63, 64, 64, 70, 80, 80, 82, 89,
+ 92, 92, 91, 91, 91, 93, 96, 61, 63, 64, 64, 70, 80, 80, 82, 89, 92, 92,
+ 91, 91, 91, 93, 96, 62, 64, 66, 66, 71, 81, 81, 83, 90, 92, 92, 91, 91,
+ 91, 93, 96, 66, 68, 70, 70, 75, 85, 85, 86, 92, 94, 94, 92, 91, 91, 93,
+ 95, 67, 70, 72, 72, 77, 86, 86, 88, 92, 94, 94, 93, 92, 92, 93, 95, 67,
+ 70, 72, 72, 77, 86, 86, 88, 92, 94, 94, 93, 92, 92, 93, 95, 71, 74, 77,
+ 77, 82, 91, 91, 92, 94, 95, 95, 93, 91, 91, 93, 95, 74, 78, 80, 80, 86,
+ 94, 94, 95, 95, 95, 95, 93, 91, 91, 92, 94, 74, 78, 80, 80, 86, 94, 94,
+ 95, 95, 95, 95, 93, 91, 91, 92, 94, 78, 80, 82, 82, 87, 95, 95, 95, 97,
+ 97, 97, 95, 94, 94, 95, 97, 84, 85, 86, 86, 89, 95, 95, 96, 99, 100,
+ 100, 99, 99, 99, 100, 101, 84, 85, 86, 86, 89, 95, 95, 96, 99, 100, 100,
+ 99, 99, 99, 100, 101, 86, 87, 87, 87, 90, 95, 95, 96, 100, 101, 101,
+ 101, 100, 100, 101, 103, 95, 93, 92, 92, 93, 96, 96, 97, 103, 105, 105,
+ 105, 106, 106, 106, 107, 98, 95, 93, 93, 94, 96, 96, 98, 104, 106, 106,
+ 107, 107, 107, 108, 109, 98, 95, 93, 93, 94, 96, 96, 98, 104, 106, 106,
+ 107, 107, 107, 108, 109, 97, 94, 92, 92, 93, 95, 95, 97, 104, 106, 106,
+ 108, 110, 110, 111, 113, 97, 94, 92, 92, 93, 94, 94, 96, 103, 106, 106,
+ 109, 112, 112, 113, 115, 97, 94, 92, 92, 93, 94, 94, 96, 103, 106, 106,
+ 109, 112, 112, 113, 115, 97, 94, 91, 91, 92, 93, 93, 95, 103, 106, 106,
+ 111, 114, 114, 115, 118, 98, 93, 91, 91, 91, 92, 92, 94, 103, 107, 107,
+ 113, 117, 117, 119, 123, 98, 93, 91, 91, 91, 92, 92, 94, 103, 107, 107,
+ 113, 117, 117, 119, 123, 98, 94, 91, 91, 91, 92, 92, 95, 104, 107, 107,
+ 113, 117, 117, 120, 124, 100, 96, 93, 93, 93, 93, 93, 96, 104, 108, 108,
+ 114, 119, 119, 122, 127, 101, 96, 93, 93, 93, 93, 93, 96, 105, 108, 108,
+ 115, 119, 119, 123, 128, 101, 96, 93, 93, 93, 93, 93, 96, 105, 108, 108,
+ 115, 119, 119, 123, 128, 103, 98, 95, 95, 95, 94, 94, 97, 105, 108, 108,
+ 116, 121, 121, 125, 131,
+ /* Size 32x16 */
+ 64, 63, 63, 63, 62, 61, 61, 62, 66, 67, 67, 71, 74, 74, 78, 84, 84, 86,
+ 95, 98, 98, 97, 97, 97, 97, 98, 98, 98, 100, 101, 101, 103, 62, 63, 63,
+ 63, 63, 63, 63, 64, 68, 70, 70, 74, 78, 78, 80, 85, 85, 87, 93, 95, 95,
+ 94, 94, 94, 94, 93, 93, 94, 96, 96, 96, 98, 62, 63, 63, 63, 64, 64, 64,
+ 66, 70, 72, 72, 77, 80, 80, 82, 86, 86, 87, 92, 93, 93, 92, 92, 92, 91,
+ 91, 91, 91, 93, 93, 93, 95, 62, 63, 63, 63, 64, 64, 64, 66, 70, 72, 72,
+ 77, 80, 80, 82, 86, 86, 87, 92, 93, 93, 92, 92, 92, 91, 91, 91, 91, 93,
+ 93, 93, 95, 66, 67, 68, 68, 69, 70, 70, 71, 75, 77, 77, 82, 86, 86, 87,
+ 89, 89, 90, 93, 94, 94, 93, 93, 93, 92, 91, 91, 91, 93, 93, 93, 95, 74,
+ 76, 77, 77, 78, 80, 80, 81, 85, 86, 86, 91, 94, 94, 95, 95, 95, 95, 96,
+ 96, 96, 95, 94, 94, 93, 92, 92, 92, 93, 93, 93, 94, 74, 76, 77, 77, 78,
+ 80, 80, 81, 85, 86, 86, 91, 94, 94, 95, 95, 95, 95, 96, 96, 96, 95, 94,
+ 94, 93, 92, 92, 92, 93, 93, 93, 94, 77, 79, 80, 80, 81, 82, 82, 83, 86,
+ 88, 88, 92, 95, 95, 95, 96, 96, 96, 97, 98, 98, 97, 96, 96, 95, 94, 94,
+ 95, 96, 96, 96, 97, 91, 90, 90, 90, 90, 89, 89, 90, 92, 92, 92, 94, 95,
+ 95, 97, 99, 99, 100, 103, 104, 104, 104, 103, 103, 103, 103, 103, 104,
+ 104, 105, 105, 105, 96, 95, 94, 94, 93, 92, 92, 92, 94, 94, 94, 95, 95,
+ 95, 97, 100, 100, 101, 105, 106, 106, 106, 106, 106, 106, 107, 107, 107,
+ 108, 108, 108, 108, 96, 95, 94, 94, 93, 92, 92, 92, 94, 94, 94, 95, 95,
+ 95, 97, 100, 100, 101, 105, 106, 106, 106, 106, 106, 106, 107, 107, 107,
+ 108, 108, 108, 108, 98, 96, 94, 94, 93, 91, 91, 91, 92, 93, 93, 93, 93,
+ 93, 95, 99, 99, 101, 105, 107, 107, 108, 109, 109, 111, 113, 113, 113,
+ 114, 115, 115, 116, 98, 96, 94, 94, 93, 91, 91, 91, 91, 92, 92, 91, 91,
+ 91, 94, 99, 99, 100, 106, 107, 107, 110, 112, 112, 114, 117, 117, 117,
+ 119, 119, 119, 121, 98, 96, 94, 94, 93, 91, 91, 91, 91, 92, 92, 91, 91,
+ 91, 94, 99, 99, 100, 106, 107, 107, 110, 112, 112, 114, 117, 117, 117,
+ 119, 119, 119, 121, 101, 98, 97, 97, 95, 93, 93, 93, 93, 93, 93, 93, 92,
+ 92, 95, 100, 100, 101, 106, 108, 108, 111, 113, 113, 115, 119, 119, 120,
+ 122, 123, 123, 125, 105, 102, 100, 100, 98, 96, 96, 96, 95, 95, 95, 95,
+ 94, 94, 97, 101, 101, 103, 107, 109, 109, 113, 115, 115, 118, 123, 123,
+ 124, 127, 128, 128, 131,
+ /* Size 4x16 */
+ 62, 74, 96, 98, 63, 77, 94, 94, 63, 78, 93, 93, 63, 80, 92, 91, 68, 85,
+ 94, 91, 70, 86, 94, 92, 78, 94, 95, 91, 80, 95, 97, 94, 85, 95, 100, 99,
+ 93, 96, 105, 106, 95, 96, 106, 107, 94, 94, 106, 112, 94, 93, 106, 114,
+ 93, 92, 107, 117, 96, 93, 108, 119, 96, 93, 108, 119,
+ /* Size 16x4 */
+ 62, 63, 63, 63, 68, 70, 78, 80, 85, 93, 95, 94, 94, 93, 96, 96, 74, 77,
+ 78, 80, 85, 86, 94, 95, 95, 96, 96, 94, 93, 92, 93, 93, 96, 94, 93, 92,
+ 94, 94, 95, 97, 100, 105, 106, 106, 106, 107, 108, 108, 98, 94, 93, 91,
+ 91, 92, 91, 94, 99, 106, 107, 112, 114, 117, 119, 119,
+ /* Size 8x32 */
+ 64, 62, 66, 74, 91, 96, 98, 101, 63, 63, 67, 76, 90, 95, 96, 98, 63, 63,
+ 68, 77, 90, 94, 94, 97, 63, 63, 68, 77, 90, 94, 94, 97, 62, 64, 69, 78,
+ 90, 93, 93, 95, 61, 64, 70, 80, 89, 92, 91, 93, 61, 64, 70, 80, 89, 92,
+ 91, 93, 62, 66, 71, 81, 90, 92, 91, 93, 66, 70, 75, 85, 92, 94, 91, 93,
+ 67, 72, 77, 86, 92, 94, 92, 93, 67, 72, 77, 86, 92, 94, 92, 93, 71, 77,
+ 82, 91, 94, 95, 91, 93, 74, 80, 86, 94, 95, 95, 91, 92, 74, 80, 86, 94,
+ 95, 95, 91, 92, 78, 82, 87, 95, 97, 97, 94, 95, 84, 86, 89, 95, 99, 100,
+ 99, 100, 84, 86, 89, 95, 99, 100, 99, 100, 86, 87, 90, 95, 100, 101,
+ 100, 101, 95, 92, 93, 96, 103, 105, 106, 106, 98, 93, 94, 96, 104, 106,
+ 107, 108, 98, 93, 94, 96, 104, 106, 107, 108, 97, 92, 93, 95, 104, 106,
+ 110, 111, 97, 92, 93, 94, 103, 106, 112, 113, 97, 92, 93, 94, 103, 106,
+ 112, 113, 97, 91, 92, 93, 103, 106, 114, 115, 98, 91, 91, 92, 103, 107,
+ 117, 119, 98, 91, 91, 92, 103, 107, 117, 119, 98, 91, 91, 92, 104, 107,
+ 117, 120, 100, 93, 93, 93, 104, 108, 119, 122, 101, 93, 93, 93, 105,
+ 108, 119, 123, 101, 93, 93, 93, 105, 108, 119, 123, 103, 95, 95, 94,
+ 105, 108, 121, 125,
+ /* Size 32x8 */
+ 64, 63, 63, 63, 62, 61, 61, 62, 66, 67, 67, 71, 74, 74, 78, 84, 84, 86,
+ 95, 98, 98, 97, 97, 97, 97, 98, 98, 98, 100, 101, 101, 103, 62, 63, 63,
+ 63, 64, 64, 64, 66, 70, 72, 72, 77, 80, 80, 82, 86, 86, 87, 92, 93, 93,
+ 92, 92, 92, 91, 91, 91, 91, 93, 93, 93, 95, 66, 67, 68, 68, 69, 70, 70,
+ 71, 75, 77, 77, 82, 86, 86, 87, 89, 89, 90, 93, 94, 94, 93, 93, 93, 92,
+ 91, 91, 91, 93, 93, 93, 95, 74, 76, 77, 77, 78, 80, 80, 81, 85, 86, 86,
+ 91, 94, 94, 95, 95, 95, 95, 96, 96, 96, 95, 94, 94, 93, 92, 92, 92, 93,
+ 93, 93, 94, 91, 90, 90, 90, 90, 89, 89, 90, 92, 92, 92, 94, 95, 95, 97,
+ 99, 99, 100, 103, 104, 104, 104, 103, 103, 103, 103, 103, 104, 104, 105,
+ 105, 105, 96, 95, 94, 94, 93, 92, 92, 92, 94, 94, 94, 95, 95, 95, 97,
+ 100, 100, 101, 105, 106, 106, 106, 106, 106, 106, 107, 107, 107, 108,
+ 108, 108, 108, 98, 96, 94, 94, 93, 91, 91, 91, 91, 92, 92, 91, 91, 91,
+ 94, 99, 99, 100, 106, 107, 107, 110, 112, 112, 114, 117, 117, 117, 119,
+ 119, 119, 121, 101, 98, 97, 97, 95, 93, 93, 93, 93, 93, 93, 93, 92, 92,
+ 95, 100, 100, 101, 106, 108, 108, 111, 113, 113, 115, 119, 119, 120,
+ 122, 123, 123, 125 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 65, 69, 69, 97,
+#endif
+ /* Size 4x4 */
+ 64, 64, 68, 77, 64, 67, 71, 78, 68, 71, 79, 90, 77, 78, 90, 108,
+ /* Size 8x8 */
+ 63, 63, 64, 64, 66, 69, 74, 82, 63, 64, 65, 65, 66, 69, 73, 79, 64, 65,
+ 65, 66, 68, 70, 74, 80, 64, 65, 66, 68, 71, 73, 77, 82, 66, 66, 68, 71,
+ 74, 78, 83, 88, 69, 69, 70, 73, 78, 86, 93, 98, 74, 73, 74, 77, 83, 93,
+ 102, 108, 82, 79, 80, 82, 88, 98, 108, 116,
+ /* Size 16x16 */
+ 64, 63, 63, 63, 63, 63, 63, 64, 64, 68, 68, 72, 72, 79, 79, 88, 63, 64,
+ 64, 64, 64, 64, 64, 65, 65, 68, 68, 70, 70, 77, 77, 85, 63, 64, 64, 64,
+ 64, 64, 64, 65, 65, 68, 68, 70, 70, 77, 77, 85, 63, 64, 64, 65, 65, 65,
+ 65, 65, 65, 67, 67, 69, 69, 75, 75, 82, 63, 64, 64, 65, 65, 65, 65, 65,
+ 65, 67, 67, 69, 69, 75, 75, 82, 63, 64, 64, 65, 65, 67, 67, 68, 68, 71,
+ 71, 73, 73, 78, 78, 84, 63, 64, 64, 65, 65, 67, 67, 68, 68, 71, 71, 73,
+ 73, 78, 78, 84, 64, 65, 65, 65, 65, 68, 68, 71, 71, 74, 74, 77, 77, 81,
+ 81, 85, 64, 65, 65, 65, 65, 68, 68, 71, 71, 74, 74, 77, 77, 81, 81, 85,
+ 68, 68, 68, 67, 67, 71, 71, 74, 74, 79, 79, 85, 85, 90, 90, 95, 68, 68,
+ 68, 67, 67, 71, 71, 74, 74, 79, 79, 85, 85, 90, 90, 95, 72, 70, 70, 69,
+ 69, 73, 73, 77, 77, 85, 85, 97, 97, 101, 101, 108, 72, 70, 70, 69, 69,
+ 73, 73, 77, 77, 85, 85, 97, 97, 101, 101, 108, 79, 77, 77, 75, 75, 78,
+ 78, 81, 81, 90, 90, 101, 101, 108, 108, 116, 79, 77, 77, 75, 75, 78, 78,
+ 81, 81, 90, 90, 101, 101, 108, 108, 116, 88, 85, 85, 82, 82, 84, 84, 85,
+ 85, 95, 95, 108, 108, 116, 116, 127,
+ /* Size 32x32 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 66,
+ 68, 68, 68, 70, 72, 72, 72, 75, 79, 79, 79, 83, 88, 88, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 66, 68, 68, 68, 69,
+ 71, 71, 71, 74, 78, 78, 78, 82, 86, 86, 63, 63, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 65, 65, 65, 65, 66, 68, 68, 68, 69, 70, 70, 70, 74,
+ 77, 77, 77, 81, 85, 85, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 65, 65, 65, 65, 66, 68, 68, 68, 69, 70, 70, 70, 74, 77, 77, 77, 81,
+ 85, 85, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65,
+ 65, 66, 68, 68, 68, 69, 70, 70, 70, 74, 77, 77, 77, 81, 85, 85, 63, 63,
+ 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 66, 68, 68,
+ 68, 69, 70, 70, 70, 73, 76, 76, 76, 79, 83, 83, 63, 63, 64, 64, 64, 64,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 67, 67, 67, 68, 69, 69,
+ 69, 72, 75, 75, 75, 78, 82, 82, 63, 63, 64, 64, 64, 64, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 66, 67, 67, 67, 68, 69, 69, 69, 72, 75, 75,
+ 75, 78, 82, 82, 63, 63, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 66, 67, 67, 67, 68, 69, 69, 69, 72, 75, 75, 75, 78, 82, 82,
+ 63, 64, 64, 64, 64, 65, 65, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 68,
+ 69, 69, 69, 70, 71, 71, 71, 74, 77, 77, 77, 80, 83, 83, 63, 64, 64, 64,
+ 64, 65, 65, 65, 65, 66, 67, 67, 67, 67, 68, 68, 68, 69, 71, 71, 71, 72,
+ 73, 73, 73, 76, 78, 78, 78, 81, 84, 84, 63, 64, 64, 64, 64, 65, 65, 65,
+ 65, 66, 67, 67, 67, 67, 68, 68, 68, 69, 71, 71, 71, 72, 73, 73, 73, 76,
+ 78, 78, 78, 81, 84, 84, 63, 64, 64, 64, 64, 65, 65, 65, 65, 66, 67, 67,
+ 67, 67, 68, 68, 68, 69, 71, 71, 71, 72, 73, 73, 73, 76, 78, 78, 78, 81,
+ 84, 84, 64, 64, 65, 65, 65, 65, 65, 65, 65, 66, 67, 67, 67, 68, 69, 69,
+ 69, 71, 72, 72, 72, 73, 75, 75, 75, 77, 80, 80, 80, 82, 85, 85, 64, 64,
+ 65, 65, 65, 65, 65, 65, 65, 67, 68, 68, 68, 69, 71, 71, 71, 72, 74, 74,
+ 74, 75, 77, 77, 77, 79, 81, 81, 81, 83, 85, 85, 64, 64, 65, 65, 65, 65,
+ 65, 65, 65, 67, 68, 68, 68, 69, 71, 71, 71, 72, 74, 74, 74, 75, 77, 77,
+ 77, 79, 81, 81, 81, 83, 85, 85, 64, 64, 65, 65, 65, 65, 65, 65, 65, 67,
+ 68, 68, 68, 69, 71, 71, 71, 72, 74, 74, 74, 75, 77, 77, 77, 79, 81, 81,
+ 81, 83, 85, 85, 66, 66, 66, 66, 66, 66, 66, 66, 66, 68, 69, 69, 69, 71,
+ 72, 72, 72, 74, 76, 76, 76, 78, 81, 81, 81, 83, 85, 85, 85, 88, 90, 90,
+ 68, 68, 68, 68, 68, 68, 67, 67, 67, 69, 71, 71, 71, 72, 74, 74, 74, 76,
+ 79, 79, 79, 82, 85, 85, 85, 88, 90, 90, 90, 93, 95, 95, 68, 68, 68, 68,
+ 68, 68, 67, 67, 67, 69, 71, 71, 71, 72, 74, 74, 74, 76, 79, 79, 79, 82,
+ 85, 85, 85, 88, 90, 90, 90, 93, 95, 95, 68, 68, 68, 68, 68, 68, 67, 67,
+ 67, 69, 71, 71, 71, 72, 74, 74, 74, 76, 79, 79, 79, 82, 85, 85, 85, 88,
+ 90, 90, 90, 93, 95, 95, 70, 69, 69, 69, 69, 69, 68, 68, 68, 70, 72, 72,
+ 72, 73, 75, 75, 75, 78, 82, 82, 82, 86, 91, 91, 91, 93, 95, 95, 95, 98,
+ 101, 101, 72, 71, 70, 70, 70, 70, 69, 69, 69, 71, 73, 73, 73, 75, 77,
+ 77, 77, 81, 85, 85, 85, 91, 97, 97, 97, 99, 101, 101, 101, 104, 108,
+ 108, 72, 71, 70, 70, 70, 70, 69, 69, 69, 71, 73, 73, 73, 75, 77, 77, 77,
+ 81, 85, 85, 85, 91, 97, 97, 97, 99, 101, 101, 101, 104, 108, 108, 72,
+ 71, 70, 70, 70, 70, 69, 69, 69, 71, 73, 73, 73, 75, 77, 77, 77, 81, 85,
+ 85, 85, 91, 97, 97, 97, 99, 101, 101, 101, 104, 108, 108, 75, 74, 74,
+ 74, 74, 73, 72, 72, 72, 74, 76, 76, 76, 77, 79, 79, 79, 83, 88, 88, 88,
+ 93, 99, 99, 99, 102, 104, 104, 104, 108, 112, 112, 79, 78, 77, 77, 77,
+ 76, 75, 75, 75, 77, 78, 78, 78, 80, 81, 81, 81, 85, 90, 90, 90, 95, 101,
+ 101, 101, 104, 108, 108, 108, 112, 116, 116, 79, 78, 77, 77, 77, 76, 75,
+ 75, 75, 77, 78, 78, 78, 80, 81, 81, 81, 85, 90, 90, 90, 95, 101, 101,
+ 101, 104, 108, 108, 108, 112, 116, 116, 79, 78, 77, 77, 77, 76, 75, 75,
+ 75, 77, 78, 78, 78, 80, 81, 81, 81, 85, 90, 90, 90, 95, 101, 101, 101,
+ 104, 108, 108, 108, 112, 116, 116, 83, 82, 81, 81, 81, 79, 78, 78, 78,
+ 80, 81, 81, 81, 82, 83, 83, 83, 88, 93, 93, 93, 98, 104, 104, 104, 108,
+ 112, 112, 112, 116, 121, 121, 88, 86, 85, 85, 85, 83, 82, 82, 82, 83,
+ 84, 84, 84, 85, 85, 85, 85, 90, 95, 95, 95, 101, 108, 108, 108, 112,
+ 116, 116, 116, 121, 127, 127, 88, 86, 85, 85, 85, 83, 82, 82, 82, 83,
+ 84, 84, 84, 85, 85, 85, 85, 90, 95, 95, 95, 101, 108, 108, 108, 112,
+ 116, 116, 116, 121, 127, 127,
+ /* Size 4x8 */
+ 63, 64, 68, 78, 64, 65, 68, 76, 64, 66, 69, 77, 65, 67, 72, 80, 66, 69,
+ 76, 85, 69, 72, 82, 95, 74, 76, 88, 105, 81, 81, 93, 112,
+ /* Size 8x4 */
+ 63, 64, 64, 65, 66, 69, 74, 81, 64, 65, 66, 67, 69, 72, 76, 81, 68, 68,
+ 69, 72, 76, 82, 88, 93, 78, 76, 77, 80, 85, 95, 105, 112,
+ /* Size 8x16 */
+ 64, 63, 63, 64, 64, 72, 72, 88, 63, 64, 64, 65, 65, 71, 71, 85, 63, 64,
+ 64, 65, 65, 71, 71, 85, 63, 65, 65, 66, 66, 69, 69, 82, 63, 65, 65, 66,
+ 66, 69, 69, 82, 64, 65, 65, 68, 68, 73, 73, 84, 64, 65, 65, 68, 68, 73,
+ 73, 84, 64, 66, 66, 71, 71, 77, 77, 85, 64, 66, 66, 71, 71, 77, 77, 85,
+ 68, 68, 68, 74, 74, 85, 85, 96, 68, 68, 68, 74, 74, 85, 85, 96, 72, 69,
+ 69, 77, 77, 96, 96, 108, 72, 69, 69, 77, 77, 96, 96, 108, 79, 75, 75,
+ 81, 81, 101, 101, 116, 79, 75, 75, 81, 81, 101, 101, 116, 88, 82, 82,
+ 86, 86, 107, 107, 126,
+ /* Size 16x8 */
+ 64, 63, 63, 63, 63, 64, 64, 64, 64, 68, 68, 72, 72, 79, 79, 88, 63, 64,
+ 64, 65, 65, 65, 65, 66, 66, 68, 68, 69, 69, 75, 75, 82, 63, 64, 64, 65,
+ 65, 65, 65, 66, 66, 68, 68, 69, 69, 75, 75, 82, 64, 65, 65, 66, 66, 68,
+ 68, 71, 71, 74, 74, 77, 77, 81, 81, 86, 64, 65, 65, 66, 66, 68, 68, 71,
+ 71, 74, 74, 77, 77, 81, 81, 86, 72, 71, 71, 69, 69, 73, 73, 77, 77, 85,
+ 85, 96, 96, 101, 101, 107, 72, 71, 71, 69, 69, 73, 73, 77, 77, 85, 85,
+ 96, 96, 101, 101, 107, 88, 85, 85, 82, 82, 84, 84, 85, 85, 96, 96, 108,
+ 108, 116, 116, 126,
+ /* Size 16x32 */
+ 64, 63, 63, 63, 63, 64, 64, 64, 64, 68, 72, 72, 72, 79, 88, 88, 63, 63,
+ 63, 63, 63, 64, 64, 64, 64, 68, 71, 71, 71, 78, 86, 86, 63, 64, 64, 64,
+ 64, 64, 65, 65, 65, 68, 71, 71, 71, 77, 85, 85, 63, 64, 64, 64, 64, 64,
+ 65, 65, 65, 68, 71, 71, 71, 77, 85, 85, 63, 64, 64, 64, 64, 64, 65, 65,
+ 65, 68, 71, 71, 71, 77, 85, 85, 63, 64, 64, 64, 64, 65, 65, 65, 65, 68,
+ 70, 70, 70, 76, 83, 83, 63, 64, 65, 65, 65, 65, 66, 66, 66, 67, 69, 69,
+ 69, 75, 82, 82, 63, 64, 65, 65, 65, 65, 66, 66, 66, 67, 69, 69, 69, 75,
+ 82, 82, 63, 64, 65, 65, 65, 65, 66, 66, 66, 67, 69, 69, 69, 75, 82, 82,
+ 63, 64, 65, 65, 65, 66, 67, 67, 67, 69, 71, 71, 71, 77, 83, 83, 64, 64,
+ 65, 65, 65, 67, 68, 68, 68, 71, 73, 73, 73, 78, 84, 84, 64, 64, 65, 65,
+ 65, 67, 68, 68, 68, 71, 73, 73, 73, 78, 84, 84, 64, 64, 65, 65, 65, 67,
+ 68, 68, 68, 71, 73, 73, 73, 78, 84, 84, 64, 65, 65, 65, 65, 67, 69, 69,
+ 69, 72, 75, 75, 75, 80, 85, 85, 64, 65, 66, 66, 66, 68, 71, 71, 71, 74,
+ 77, 77, 77, 81, 85, 85, 64, 65, 66, 66, 66, 68, 71, 71, 71, 74, 77, 77,
+ 77, 81, 85, 85, 64, 65, 66, 66, 66, 68, 71, 71, 71, 74, 77, 77, 77, 81,
+ 85, 85, 66, 66, 67, 67, 67, 69, 72, 72, 72, 76, 81, 81, 81, 85, 90, 90,
+ 68, 68, 68, 68, 68, 71, 74, 74, 74, 79, 85, 85, 85, 90, 96, 96, 68, 68,
+ 68, 68, 68, 71, 74, 74, 74, 79, 85, 85, 85, 90, 96, 96, 68, 68, 68, 68,
+ 68, 71, 74, 74, 74, 79, 85, 85, 85, 90, 96, 96, 70, 69, 69, 69, 69, 72,
+ 75, 75, 75, 82, 90, 90, 90, 95, 101, 101, 72, 70, 69, 69, 69, 73, 77,
+ 77, 77, 86, 96, 96, 96, 102, 108, 108, 72, 70, 69, 69, 69, 73, 77, 77,
+ 77, 86, 96, 96, 96, 102, 108, 108, 72, 70, 69, 69, 69, 73, 77, 77, 77,
+ 86, 96, 96, 96, 102, 108, 108, 75, 74, 72, 72, 72, 76, 79, 79, 79, 88,
+ 98, 98, 98, 105, 112, 112, 79, 77, 75, 75, 75, 78, 81, 81, 81, 90, 101,
+ 101, 101, 108, 116, 116, 79, 77, 75, 75, 75, 78, 81, 81, 81, 90, 101,
+ 101, 101, 108, 116, 116, 79, 77, 75, 75, 75, 78, 81, 81, 81, 90, 101,
+ 101, 101, 108, 116, 116, 83, 81, 79, 79, 79, 81, 84, 84, 84, 93, 104,
+ 104, 104, 112, 121, 121, 88, 85, 82, 82, 82, 84, 86, 86, 86, 96, 107,
+ 107, 107, 116, 126, 126, 88, 85, 82, 82, 82, 84, 86, 86, 86, 96, 107,
+ 107, 107, 116, 126, 126,
+ /* Size 32x16 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 66,
+ 68, 68, 68, 70, 72, 72, 72, 75, 79, 79, 79, 83, 88, 88, 63, 63, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 66, 68, 68, 68, 69,
+ 70, 70, 70, 74, 77, 77, 77, 81, 85, 85, 63, 63, 64, 64, 64, 64, 65, 65,
+ 65, 65, 65, 65, 65, 65, 66, 66, 66, 67, 68, 68, 68, 69, 69, 69, 69, 72,
+ 75, 75, 75, 79, 82, 82, 63, 63, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
+ 65, 65, 66, 66, 66, 67, 68, 68, 68, 69, 69, 69, 69, 72, 75, 75, 75, 79,
+ 82, 82, 63, 63, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66,
+ 66, 67, 68, 68, 68, 69, 69, 69, 69, 72, 75, 75, 75, 79, 82, 82, 64, 64,
+ 64, 64, 64, 65, 65, 65, 65, 66, 67, 67, 67, 67, 68, 68, 68, 69, 71, 71,
+ 71, 72, 73, 73, 73, 76, 78, 78, 78, 81, 84, 84, 64, 64, 65, 65, 65, 65,
+ 66, 66, 66, 67, 68, 68, 68, 69, 71, 71, 71, 72, 74, 74, 74, 75, 77, 77,
+ 77, 79, 81, 81, 81, 84, 86, 86, 64, 64, 65, 65, 65, 65, 66, 66, 66, 67,
+ 68, 68, 68, 69, 71, 71, 71, 72, 74, 74, 74, 75, 77, 77, 77, 79, 81, 81,
+ 81, 84, 86, 86, 64, 64, 65, 65, 65, 65, 66, 66, 66, 67, 68, 68, 68, 69,
+ 71, 71, 71, 72, 74, 74, 74, 75, 77, 77, 77, 79, 81, 81, 81, 84, 86, 86,
+ 68, 68, 68, 68, 68, 68, 67, 67, 67, 69, 71, 71, 71, 72, 74, 74, 74, 76,
+ 79, 79, 79, 82, 86, 86, 86, 88, 90, 90, 90, 93, 96, 96, 72, 71, 71, 71,
+ 71, 70, 69, 69, 69, 71, 73, 73, 73, 75, 77, 77, 77, 81, 85, 85, 85, 90,
+ 96, 96, 96, 98, 101, 101, 101, 104, 107, 107, 72, 71, 71, 71, 71, 70,
+ 69, 69, 69, 71, 73, 73, 73, 75, 77, 77, 77, 81, 85, 85, 85, 90, 96, 96,
+ 96, 98, 101, 101, 101, 104, 107, 107, 72, 71, 71, 71, 71, 70, 69, 69,
+ 69, 71, 73, 73, 73, 75, 77, 77, 77, 81, 85, 85, 85, 90, 96, 96, 96, 98,
+ 101, 101, 101, 104, 107, 107, 79, 78, 77, 77, 77, 76, 75, 75, 75, 77,
+ 78, 78, 78, 80, 81, 81, 81, 85, 90, 90, 90, 95, 102, 102, 102, 105, 108,
+ 108, 108, 112, 116, 116, 88, 86, 85, 85, 85, 83, 82, 82, 82, 83, 84, 84,
+ 84, 85, 85, 85, 85, 90, 96, 96, 96, 101, 108, 108, 108, 112, 116, 116,
+ 116, 121, 126, 126, 88, 86, 85, 85, 85, 83, 82, 82, 82, 83, 84, 84, 84,
+ 85, 85, 85, 85, 90, 96, 96, 96, 101, 108, 108, 108, 112, 116, 116, 116,
+ 121, 126, 126,
+ /* Size 4x16 */
+ 63, 64, 68, 79, 64, 64, 68, 77, 64, 64, 68, 77, 64, 65, 67, 75, 64, 65,
+ 67, 75, 64, 67, 71, 78, 64, 67, 71, 78, 65, 68, 74, 81, 65, 68, 74, 81,
+ 68, 71, 79, 90, 68, 71, 79, 90, 70, 73, 86, 102, 70, 73, 86, 102, 77,
+ 78, 90, 108, 77, 78, 90, 108, 85, 84, 96, 116,
+ /* Size 16x4 */
+ 63, 64, 64, 64, 64, 64, 64, 65, 65, 68, 68, 70, 70, 77, 77, 85, 64, 64,
+ 64, 65, 65, 67, 67, 68, 68, 71, 71, 73, 73, 78, 78, 84, 68, 68, 68, 67,
+ 67, 71, 71, 74, 74, 79, 79, 86, 86, 90, 90, 96, 79, 77, 77, 75, 75, 78,
+ 78, 81, 81, 90, 90, 102, 102, 108, 108, 116,
+ /* Size 8x32 */
+ 64, 63, 63, 64, 64, 72, 72, 88, 63, 63, 63, 64, 64, 71, 71, 86, 63, 64,
+ 64, 65, 65, 71, 71, 85, 63, 64, 64, 65, 65, 71, 71, 85, 63, 64, 64, 65,
+ 65, 71, 71, 85, 63, 64, 64, 65, 65, 70, 70, 83, 63, 65, 65, 66, 66, 69,
+ 69, 82, 63, 65, 65, 66, 66, 69, 69, 82, 63, 65, 65, 66, 66, 69, 69, 82,
+ 63, 65, 65, 67, 67, 71, 71, 83, 64, 65, 65, 68, 68, 73, 73, 84, 64, 65,
+ 65, 68, 68, 73, 73, 84, 64, 65, 65, 68, 68, 73, 73, 84, 64, 65, 65, 69,
+ 69, 75, 75, 85, 64, 66, 66, 71, 71, 77, 77, 85, 64, 66, 66, 71, 71, 77,
+ 77, 85, 64, 66, 66, 71, 71, 77, 77, 85, 66, 67, 67, 72, 72, 81, 81, 90,
+ 68, 68, 68, 74, 74, 85, 85, 96, 68, 68, 68, 74, 74, 85, 85, 96, 68, 68,
+ 68, 74, 74, 85, 85, 96, 70, 69, 69, 75, 75, 90, 90, 101, 72, 69, 69, 77,
+ 77, 96, 96, 108, 72, 69, 69, 77, 77, 96, 96, 108, 72, 69, 69, 77, 77,
+ 96, 96, 108, 75, 72, 72, 79, 79, 98, 98, 112, 79, 75, 75, 81, 81, 101,
+ 101, 116, 79, 75, 75, 81, 81, 101, 101, 116, 79, 75, 75, 81, 81, 101,
+ 101, 116, 83, 79, 79, 84, 84, 104, 104, 121, 88, 82, 82, 86, 86, 107,
+ 107, 126, 88, 82, 82, 86, 86, 107, 107, 126,
+ /* Size 32x8 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 66,
+ 68, 68, 68, 70, 72, 72, 72, 75, 79, 79, 79, 83, 88, 88, 63, 63, 64, 64,
+ 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 67, 68, 68, 68, 69,
+ 69, 69, 69, 72, 75, 75, 75, 79, 82, 82, 63, 63, 64, 64, 64, 64, 65, 65,
+ 65, 65, 65, 65, 65, 65, 66, 66, 66, 67, 68, 68, 68, 69, 69, 69, 69, 72,
+ 75, 75, 75, 79, 82, 82, 64, 64, 65, 65, 65, 65, 66, 66, 66, 67, 68, 68,
+ 68, 69, 71, 71, 71, 72, 74, 74, 74, 75, 77, 77, 77, 79, 81, 81, 81, 84,
+ 86, 86, 64, 64, 65, 65, 65, 65, 66, 66, 66, 67, 68, 68, 68, 69, 71, 71,
+ 71, 72, 74, 74, 74, 75, 77, 77, 77, 79, 81, 81, 81, 84, 86, 86, 72, 71,
+ 71, 71, 71, 70, 69, 69, 69, 71, 73, 73, 73, 75, 77, 77, 77, 81, 85, 85,
+ 85, 90, 96, 96, 96, 98, 101, 101, 101, 104, 107, 107, 72, 71, 71, 71,
+ 71, 70, 69, 69, 69, 71, 73, 73, 73, 75, 77, 77, 77, 81, 85, 85, 85, 90,
+ 96, 96, 96, 98, 101, 101, 101, 104, 107, 107, 88, 86, 85, 85, 85, 83,
+ 82, 82, 82, 83, 84, 84, 84, 85, 85, 85, 85, 90, 96, 96, 96, 101, 108,
+ 108, 108, 112, 116, 116, 116, 121, 126, 126 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 64, 93, 93, 106,
+#endif
+ /* Size 4x4 */
+ 63, 69, 85, 94, 69, 78, 90, 93, 85, 90, 97, 99, 94, 93, 99, 109,
+ /* Size 8x8 */
+ 63, 62, 65, 71, 79, 90, 96, 96, 62, 63, 66, 74, 82, 89, 93, 92, 65, 66,
+ 71, 79, 85, 90, 93, 91, 71, 74, 79, 86, 91, 94, 94, 92, 79, 82, 85, 91,
+ 95, 97, 97, 95, 90, 89, 90, 94, 97, 101, 103, 103, 96, 93, 93, 94, 97,
+ 103, 107, 108, 96, 92, 91, 92, 95, 103, 108, 112,
+ /* Size 16x16 */
+ 64, 62, 62, 61, 61, 67, 67, 73, 73, 83, 83, 98, 98, 97, 97, 98, 62, 63,
+ 63, 62, 62, 69, 69, 77, 77, 85, 85, 95, 95, 94, 94, 94, 62, 63, 63, 62,
+ 62, 69, 69, 77, 77, 85, 85, 95, 95, 94, 94, 94, 61, 62, 62, 64, 64, 71,
+ 71, 80, 80, 85, 85, 93, 93, 91, 91, 90, 61, 62, 62, 64, 64, 71, 71, 80,
+ 80, 85, 85, 93, 93, 91, 91, 90, 67, 69, 69, 71, 71, 78, 78, 87, 87, 90,
+ 90, 95, 95, 93, 93, 91, 67, 69, 69, 71, 71, 78, 78, 87, 87, 90, 90, 95,
+ 95, 93, 93, 91, 73, 77, 77, 80, 80, 87, 87, 95, 95, 95, 95, 96, 96, 93,
+ 93, 91, 73, 77, 77, 80, 80, 87, 87, 95, 95, 95, 95, 96, 96, 93, 93, 91,
+ 83, 85, 85, 85, 85, 90, 90, 95, 95, 97, 97, 101, 101, 99, 99, 98, 83,
+ 85, 85, 85, 85, 90, 90, 95, 95, 97, 97, 101, 101, 99, 99, 98, 98, 95,
+ 95, 93, 93, 95, 95, 96, 96, 101, 101, 106, 106, 106, 106, 107, 98, 95,
+ 95, 93, 93, 95, 95, 96, 96, 101, 101, 106, 106, 106, 106, 107, 97, 94,
+ 94, 91, 91, 93, 93, 93, 93, 99, 99, 106, 106, 109, 109, 111, 97, 94, 94,
+ 91, 91, 93, 93, 93, 93, 99, 99, 106, 106, 109, 109, 111, 98, 94, 94, 90,
+ 90, 91, 91, 91, 91, 98, 98, 107, 107, 111, 111, 117,
+ /* Size 32x32 */
+ 64, 63, 62, 62, 62, 62, 61, 61, 61, 64, 67, 67, 67, 70, 73, 73, 73, 78,
+ 83, 83, 83, 90, 98, 98, 98, 98, 97, 97, 97, 98, 98, 98, 63, 63, 63, 63,
+ 63, 62, 62, 62, 62, 65, 68, 68, 68, 71, 75, 75, 75, 79, 84, 84, 84, 90,
+ 97, 97, 97, 96, 96, 96, 96, 96, 96, 96, 62, 63, 63, 63, 63, 63, 62, 62,
+ 62, 66, 69, 69, 69, 73, 77, 77, 77, 81, 85, 85, 85, 90, 95, 95, 95, 95,
+ 94, 94, 94, 94, 94, 94, 62, 63, 63, 63, 63, 63, 62, 62, 62, 66, 69, 69,
+ 69, 73, 77, 77, 77, 81, 85, 85, 85, 90, 95, 95, 95, 95, 94, 94, 94, 94,
+ 94, 94, 62, 63, 63, 63, 63, 63, 62, 62, 62, 66, 69, 69, 69, 73, 77, 77,
+ 77, 81, 85, 85, 85, 90, 95, 95, 95, 95, 94, 94, 94, 94, 94, 94, 62, 62,
+ 63, 63, 63, 63, 63, 63, 63, 66, 70, 70, 70, 74, 78, 78, 78, 82, 85, 85,
+ 85, 89, 94, 94, 94, 93, 93, 93, 93, 92, 92, 92, 61, 62, 62, 62, 62, 63,
+ 64, 64, 64, 67, 71, 71, 71, 75, 80, 80, 80, 83, 85, 85, 85, 89, 93, 93,
+ 93, 92, 91, 91, 91, 91, 90, 90, 61, 62, 62, 62, 62, 63, 64, 64, 64, 67,
+ 71, 71, 71, 75, 80, 80, 80, 83, 85, 85, 85, 89, 93, 93, 93, 92, 91, 91,
+ 91, 91, 90, 90, 61, 62, 62, 62, 62, 63, 64, 64, 64, 67, 71, 71, 71, 75,
+ 80, 80, 80, 83, 85, 85, 85, 89, 93, 93, 93, 92, 91, 91, 91, 91, 90, 90,
+ 64, 65, 66, 66, 66, 66, 67, 67, 67, 71, 74, 74, 74, 79, 83, 83, 83, 85,
+ 87, 87, 87, 90, 94, 94, 94, 93, 92, 92, 92, 91, 90, 90, 67, 68, 69, 69,
+ 69, 70, 71, 71, 71, 74, 78, 78, 78, 82, 87, 87, 87, 88, 90, 90, 90, 92,
+ 95, 95, 95, 94, 93, 93, 93, 92, 91, 91, 67, 68, 69, 69, 69, 70, 71, 71,
+ 71, 74, 78, 78, 78, 82, 87, 87, 87, 88, 90, 90, 90, 92, 95, 95, 95, 94,
+ 93, 93, 93, 92, 91, 91, 67, 68, 69, 69, 69, 70, 71, 71, 71, 74, 78, 78,
+ 78, 82, 87, 87, 87, 88, 90, 90, 90, 92, 95, 95, 95, 94, 93, 93, 93, 92,
+ 91, 91, 70, 71, 73, 73, 73, 74, 75, 75, 75, 79, 82, 82, 82, 86, 91, 91,
+ 91, 91, 92, 92, 92, 94, 95, 95, 95, 94, 93, 93, 93, 92, 91, 91, 73, 75,
+ 77, 77, 77, 78, 80, 80, 80, 83, 87, 87, 87, 91, 95, 95, 95, 95, 95, 95,
+ 95, 95, 96, 96, 96, 94, 93, 93, 93, 92, 91, 91, 73, 75, 77, 77, 77, 78,
+ 80, 80, 80, 83, 87, 87, 87, 91, 95, 95, 95, 95, 95, 95, 95, 95, 96, 96,
+ 96, 94, 93, 93, 93, 92, 91, 91, 73, 75, 77, 77, 77, 78, 80, 80, 80, 83,
+ 87, 87, 87, 91, 95, 95, 95, 95, 95, 95, 95, 95, 96, 96, 96, 94, 93, 93,
+ 93, 92, 91, 91, 78, 79, 81, 81, 81, 82, 83, 83, 83, 85, 88, 88, 88, 91,
+ 95, 95, 95, 95, 96, 96, 96, 97, 98, 98, 98, 97, 96, 96, 96, 95, 94, 94,
+ 83, 84, 85, 85, 85, 85, 85, 85, 85, 87, 90, 90, 90, 92, 95, 95, 95, 96,
+ 97, 97, 97, 99, 101, 101, 101, 100, 99, 99, 99, 99, 98, 98, 83, 84, 85,
+ 85, 85, 85, 85, 85, 85, 87, 90, 90, 90, 92, 95, 95, 95, 96, 97, 97, 97,
+ 99, 101, 101, 101, 100, 99, 99, 99, 99, 98, 98, 83, 84, 85, 85, 85, 85,
+ 85, 85, 85, 87, 90, 90, 90, 92, 95, 95, 95, 96, 97, 97, 97, 99, 101,
+ 101, 101, 100, 99, 99, 99, 99, 98, 98, 90, 90, 90, 90, 90, 89, 89, 89,
+ 89, 90, 92, 92, 92, 94, 95, 95, 95, 97, 99, 99, 99, 101, 103, 103, 103,
+ 103, 103, 103, 103, 103, 103, 103, 98, 97, 95, 95, 95, 94, 93, 93, 93,
+ 94, 95, 95, 95, 95, 96, 96, 96, 98, 101, 101, 101, 103, 106, 106, 106,
+ 106, 106, 106, 106, 107, 107, 107, 98, 97, 95, 95, 95, 94, 93, 93, 93,
+ 94, 95, 95, 95, 95, 96, 96, 96, 98, 101, 101, 101, 103, 106, 106, 106,
+ 106, 106, 106, 106, 107, 107, 107, 98, 97, 95, 95, 95, 94, 93, 93, 93,
+ 94, 95, 95, 95, 95, 96, 96, 96, 98, 101, 101, 101, 103, 106, 106, 106,
+ 106, 106, 106, 106, 107, 107, 107, 98, 96, 95, 95, 95, 93, 92, 92, 92,
+ 93, 94, 94, 94, 94, 94, 94, 94, 97, 100, 100, 100, 103, 106, 106, 106,
+ 107, 107, 107, 107, 108, 109, 109, 97, 96, 94, 94, 94, 93, 91, 91, 91,
+ 92, 93, 93, 93, 93, 93, 93, 93, 96, 99, 99, 99, 103, 106, 106, 106, 107,
+ 109, 109, 109, 110, 111, 111, 97, 96, 94, 94, 94, 93, 91, 91, 91, 92,
+ 93, 93, 93, 93, 93, 93, 93, 96, 99, 99, 99, 103, 106, 106, 106, 107,
+ 109, 109, 109, 110, 111, 111, 97, 96, 94, 94, 94, 93, 91, 91, 91, 92,
+ 93, 93, 93, 93, 93, 93, 93, 96, 99, 99, 99, 103, 106, 106, 106, 107,
+ 109, 109, 109, 110, 111, 111, 98, 96, 94, 94, 94, 92, 91, 91, 91, 91,
+ 92, 92, 92, 92, 92, 92, 92, 95, 99, 99, 99, 103, 107, 107, 107, 108,
+ 110, 110, 110, 112, 114, 114, 98, 96, 94, 94, 94, 92, 90, 90, 90, 90,
+ 91, 91, 91, 91, 91, 91, 91, 94, 98, 98, 98, 103, 107, 107, 107, 109,
+ 111, 111, 111, 114, 117, 117, 98, 96, 94, 94, 94, 92, 90, 90, 90, 90,
+ 91, 91, 91, 91, 91, 91, 91, 94, 98, 98, 98, 103, 107, 107, 107, 109,
+ 111, 111, 111, 114, 117, 117,
+ /* Size 4x8 */
+ 63, 68, 84, 96, 63, 70, 85, 93, 66, 75, 88, 92, 73, 82, 92, 93, 81, 88,
+ 96, 96, 90, 92, 99, 103, 95, 94, 100, 108, 94, 92, 99, 110,
+ /* Size 8x4 */
+ 63, 63, 66, 73, 81, 90, 95, 94, 68, 70, 75, 82, 88, 92, 94, 92, 84, 85,
+ 88, 92, 96, 99, 100, 99, 96, 93, 92, 93, 96, 103, 108, 110,
+ /* Size 8x16 */
+ 64, 62, 62, 74, 74, 96, 96, 98, 63, 63, 63, 77, 77, 94, 94, 94, 63, 63,
+ 63, 77, 77, 94, 94, 94, 61, 64, 64, 80, 80, 92, 92, 91, 61, 64, 64, 80,
+ 80, 92, 92, 91, 67, 72, 72, 86, 86, 94, 94, 92, 67, 72, 72, 86, 86, 94,
+ 94, 92, 74, 80, 80, 94, 94, 95, 95, 91, 74, 80, 80, 94, 94, 95, 95, 91,
+ 84, 86, 86, 95, 95, 100, 100, 99, 84, 86, 86, 95, 95, 100, 100, 99, 98,
+ 93, 93, 96, 96, 106, 106, 107, 98, 93, 93, 96, 96, 106, 106, 107, 97,
+ 92, 92, 94, 94, 106, 106, 112, 97, 92, 92, 94, 94, 106, 106, 112, 98,
+ 91, 91, 92, 92, 107, 107, 117,
+ /* Size 16x8 */
+ 64, 63, 63, 61, 61, 67, 67, 74, 74, 84, 84, 98, 98, 97, 97, 98, 62, 63,
+ 63, 64, 64, 72, 72, 80, 80, 86, 86, 93, 93, 92, 92, 91, 62, 63, 63, 64,
+ 64, 72, 72, 80, 80, 86, 86, 93, 93, 92, 92, 91, 74, 77, 77, 80, 80, 86,
+ 86, 94, 94, 95, 95, 96, 96, 94, 94, 92, 74, 77, 77, 80, 80, 86, 86, 94,
+ 94, 95, 95, 96, 96, 94, 94, 92, 96, 94, 94, 92, 92, 94, 94, 95, 95, 100,
+ 100, 106, 106, 106, 106, 107, 96, 94, 94, 92, 92, 94, 94, 95, 95, 100,
+ 100, 106, 106, 106, 106, 107, 98, 94, 94, 91, 91, 92, 92, 91, 91, 99,
+ 99, 107, 107, 112, 112, 117,
+ /* Size 16x32 */
+ 64, 63, 62, 62, 62, 67, 74, 74, 74, 84, 96, 96, 96, 97, 98, 98, 63, 63,
+ 62, 62, 62, 68, 75, 75, 75, 84, 95, 95, 95, 96, 96, 96, 63, 63, 63, 63,
+ 63, 69, 77, 77, 77, 85, 94, 94, 94, 94, 94, 94, 63, 63, 63, 63, 63, 69,
+ 77, 77, 77, 85, 94, 94, 94, 94, 94, 94, 63, 63, 63, 63, 63, 69, 77, 77,
+ 77, 85, 94, 94, 94, 94, 94, 94, 62, 63, 64, 64, 64, 70, 78, 78, 78, 85,
+ 93, 93, 93, 93, 92, 92, 61, 63, 64, 64, 64, 71, 80, 80, 80, 85, 92, 92,
+ 92, 91, 91, 91, 61, 63, 64, 64, 64, 71, 80, 80, 80, 85, 92, 92, 92, 91,
+ 91, 91, 61, 63, 64, 64, 64, 71, 80, 80, 80, 85, 92, 92, 92, 91, 91, 91,
+ 64, 66, 68, 68, 68, 75, 83, 83, 83, 88, 93, 93, 93, 92, 91, 91, 67, 69,
+ 72, 72, 72, 78, 86, 86, 86, 90, 94, 94, 94, 93, 92, 92, 67, 69, 72, 72,
+ 72, 78, 86, 86, 86, 90, 94, 94, 94, 93, 92, 92, 67, 69, 72, 72, 72, 78,
+ 86, 86, 86, 90, 94, 94, 94, 93, 92, 92, 71, 73, 76, 76, 76, 82, 90, 90,
+ 90, 92, 95, 95, 95, 93, 91, 91, 74, 77, 80, 80, 80, 87, 94, 94, 94, 95,
+ 95, 95, 95, 93, 91, 91, 74, 77, 80, 80, 80, 87, 94, 94, 94, 95, 95, 95,
+ 95, 93, 91, 91, 74, 77, 80, 80, 80, 87, 94, 94, 94, 95, 95, 95, 95, 93,
+ 91, 91, 79, 81, 83, 83, 83, 88, 95, 95, 95, 96, 98, 98, 98, 96, 95, 95,
+ 84, 85, 86, 86, 86, 90, 95, 95, 95, 97, 100, 100, 100, 100, 99, 99, 84,
+ 85, 86, 86, 86, 90, 95, 95, 95, 97, 100, 100, 100, 100, 99, 99, 84, 85,
+ 86, 86, 86, 90, 95, 95, 95, 97, 100, 100, 100, 100, 99, 99, 90, 90, 89,
+ 89, 89, 92, 95, 95, 95, 99, 103, 103, 103, 103, 103, 103, 98, 96, 93,
+ 93, 93, 95, 96, 96, 96, 101, 106, 106, 106, 107, 107, 107, 98, 96, 93,
+ 93, 93, 95, 96, 96, 96, 101, 106, 106, 106, 107, 107, 107, 98, 96, 93,
+ 93, 93, 95, 96, 96, 96, 101, 106, 106, 106, 107, 107, 107, 97, 95, 93,
+ 93, 93, 94, 95, 95, 95, 100, 106, 106, 106, 108, 109, 109, 97, 94, 92,
+ 92, 92, 93, 94, 94, 94, 100, 106, 106, 106, 109, 112, 112, 97, 94, 92,
+ 92, 92, 93, 94, 94, 94, 100, 106, 106, 106, 109, 112, 112, 97, 94, 92,
+ 92, 92, 93, 94, 94, 94, 100, 106, 106, 106, 109, 112, 112, 97, 94, 91,
+ 91, 91, 92, 93, 93, 93, 99, 106, 106, 106, 110, 114, 114, 98, 94, 91,
+ 91, 91, 91, 92, 92, 92, 99, 107, 107, 107, 112, 117, 117, 98, 94, 91,
+ 91, 91, 91, 92, 92, 92, 99, 107, 107, 107, 112, 117, 117,
+ /* Size 32x16 */
+ 64, 63, 63, 63, 63, 62, 61, 61, 61, 64, 67, 67, 67, 71, 74, 74, 74, 79,
+ 84, 84, 84, 90, 98, 98, 98, 97, 97, 97, 97, 97, 98, 98, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 66, 69, 69, 69, 73, 77, 77, 77, 81, 85, 85, 85, 90,
+ 96, 96, 96, 95, 94, 94, 94, 94, 94, 94, 62, 62, 63, 63, 63, 64, 64, 64,
+ 64, 68, 72, 72, 72, 76, 80, 80, 80, 83, 86, 86, 86, 89, 93, 93, 93, 93,
+ 92, 92, 92, 91, 91, 91, 62, 62, 63, 63, 63, 64, 64, 64, 64, 68, 72, 72,
+ 72, 76, 80, 80, 80, 83, 86, 86, 86, 89, 93, 93, 93, 93, 92, 92, 92, 91,
+ 91, 91, 62, 62, 63, 63, 63, 64, 64, 64, 64, 68, 72, 72, 72, 76, 80, 80,
+ 80, 83, 86, 86, 86, 89, 93, 93, 93, 93, 92, 92, 92, 91, 91, 91, 67, 68,
+ 69, 69, 69, 70, 71, 71, 71, 75, 78, 78, 78, 82, 87, 87, 87, 88, 90, 90,
+ 90, 92, 95, 95, 95, 94, 93, 93, 93, 92, 91, 91, 74, 75, 77, 77, 77, 78,
+ 80, 80, 80, 83, 86, 86, 86, 90, 94, 94, 94, 95, 95, 95, 95, 95, 96, 96,
+ 96, 95, 94, 94, 94, 93, 92, 92, 74, 75, 77, 77, 77, 78, 80, 80, 80, 83,
+ 86, 86, 86, 90, 94, 94, 94, 95, 95, 95, 95, 95, 96, 96, 96, 95, 94, 94,
+ 94, 93, 92, 92, 74, 75, 77, 77, 77, 78, 80, 80, 80, 83, 86, 86, 86, 90,
+ 94, 94, 94, 95, 95, 95, 95, 95, 96, 96, 96, 95, 94, 94, 94, 93, 92, 92,
+ 84, 84, 85, 85, 85, 85, 85, 85, 85, 88, 90, 90, 90, 92, 95, 95, 95, 96,
+ 97, 97, 97, 99, 101, 101, 101, 100, 100, 100, 100, 99, 99, 99, 96, 95,
+ 94, 94, 94, 93, 92, 92, 92, 93, 94, 94, 94, 95, 95, 95, 95, 98, 100,
+ 100, 100, 103, 106, 106, 106, 106, 106, 106, 106, 106, 107, 107, 96, 95,
+ 94, 94, 94, 93, 92, 92, 92, 93, 94, 94, 94, 95, 95, 95, 95, 98, 100,
+ 100, 100, 103, 106, 106, 106, 106, 106, 106, 106, 106, 107, 107, 96, 95,
+ 94, 94, 94, 93, 92, 92, 92, 93, 94, 94, 94, 95, 95, 95, 95, 98, 100,
+ 100, 100, 103, 106, 106, 106, 106, 106, 106, 106, 106, 107, 107, 97, 96,
+ 94, 94, 94, 93, 91, 91, 91, 92, 93, 93, 93, 93, 93, 93, 93, 96, 100,
+ 100, 100, 103, 107, 107, 107, 108, 109, 109, 109, 110, 112, 112, 98, 96,
+ 94, 94, 94, 92, 91, 91, 91, 91, 92, 92, 92, 91, 91, 91, 91, 95, 99, 99,
+ 99, 103, 107, 107, 107, 109, 112, 112, 112, 114, 117, 117, 98, 96, 94,
+ 94, 94, 92, 91, 91, 91, 91, 92, 92, 92, 91, 91, 91, 91, 95, 99, 99, 99,
+ 103, 107, 107, 107, 109, 112, 112, 112, 114, 117, 117,
+ /* Size 4x16 */
+ 63, 67, 84, 97, 63, 69, 85, 94, 63, 69, 85, 94, 63, 71, 85, 91, 63, 71,
+ 85, 91, 69, 78, 90, 93, 69, 78, 90, 93, 77, 87, 95, 93, 77, 87, 95, 93,
+ 85, 90, 97, 100, 85, 90, 97, 100, 96, 95, 101, 107, 96, 95, 101, 107,
+ 94, 93, 100, 109, 94, 93, 100, 109, 94, 91, 99, 112,
+ /* Size 16x4 */
+ 63, 63, 63, 63, 63, 69, 69, 77, 77, 85, 85, 96, 96, 94, 94, 94, 67, 69,
+ 69, 71, 71, 78, 78, 87, 87, 90, 90, 95, 95, 93, 93, 91, 84, 85, 85, 85,
+ 85, 90, 90, 95, 95, 97, 97, 101, 101, 100, 100, 99, 97, 94, 94, 91, 91,
+ 93, 93, 93, 93, 100, 100, 107, 107, 109, 109, 112,
+ /* Size 8x32 */
+ 64, 62, 62, 74, 74, 96, 96, 98, 63, 62, 62, 75, 75, 95, 95, 96, 63, 63,
+ 63, 77, 77, 94, 94, 94, 63, 63, 63, 77, 77, 94, 94, 94, 63, 63, 63, 77,
+ 77, 94, 94, 94, 62, 64, 64, 78, 78, 93, 93, 92, 61, 64, 64, 80, 80, 92,
+ 92, 91, 61, 64, 64, 80, 80, 92, 92, 91, 61, 64, 64, 80, 80, 92, 92, 91,
+ 64, 68, 68, 83, 83, 93, 93, 91, 67, 72, 72, 86, 86, 94, 94, 92, 67, 72,
+ 72, 86, 86, 94, 94, 92, 67, 72, 72, 86, 86, 94, 94, 92, 71, 76, 76, 90,
+ 90, 95, 95, 91, 74, 80, 80, 94, 94, 95, 95, 91, 74, 80, 80, 94, 94, 95,
+ 95, 91, 74, 80, 80, 94, 94, 95, 95, 91, 79, 83, 83, 95, 95, 98, 98, 95,
+ 84, 86, 86, 95, 95, 100, 100, 99, 84, 86, 86, 95, 95, 100, 100, 99, 84,
+ 86, 86, 95, 95, 100, 100, 99, 90, 89, 89, 95, 95, 103, 103, 103, 98, 93,
+ 93, 96, 96, 106, 106, 107, 98, 93, 93, 96, 96, 106, 106, 107, 98, 93,
+ 93, 96, 96, 106, 106, 107, 97, 93, 93, 95, 95, 106, 106, 109, 97, 92,
+ 92, 94, 94, 106, 106, 112, 97, 92, 92, 94, 94, 106, 106, 112, 97, 92,
+ 92, 94, 94, 106, 106, 112, 97, 91, 91, 93, 93, 106, 106, 114, 98, 91,
+ 91, 92, 92, 107, 107, 117, 98, 91, 91, 92, 92, 107, 107, 117,
+ /* Size 32x8 */
+ 64, 63, 63, 63, 63, 62, 61, 61, 61, 64, 67, 67, 67, 71, 74, 74, 74, 79,
+ 84, 84, 84, 90, 98, 98, 98, 97, 97, 97, 97, 97, 98, 98, 62, 62, 63, 63,
+ 63, 64, 64, 64, 64, 68, 72, 72, 72, 76, 80, 80, 80, 83, 86, 86, 86, 89,
+ 93, 93, 93, 93, 92, 92, 92, 91, 91, 91, 62, 62, 63, 63, 63, 64, 64, 64,
+ 64, 68, 72, 72, 72, 76, 80, 80, 80, 83, 86, 86, 86, 89, 93, 93, 93, 93,
+ 92, 92, 92, 91, 91, 91, 74, 75, 77, 77, 77, 78, 80, 80, 80, 83, 86, 86,
+ 86, 90, 94, 94, 94, 95, 95, 95, 95, 95, 96, 96, 96, 95, 94, 94, 94, 93,
+ 92, 92, 74, 75, 77, 77, 77, 78, 80, 80, 80, 83, 86, 86, 86, 90, 94, 94,
+ 94, 95, 95, 95, 95, 95, 96, 96, 96, 95, 94, 94, 94, 93, 92, 92, 96, 95,
+ 94, 94, 94, 93, 92, 92, 92, 93, 94, 94, 94, 95, 95, 95, 95, 98, 100,
+ 100, 100, 103, 106, 106, 106, 106, 106, 106, 106, 106, 107, 107, 96, 95,
+ 94, 94, 94, 93, 92, 92, 92, 93, 94, 94, 94, 95, 95, 95, 95, 98, 100,
+ 100, 100, 103, 106, 106, 106, 106, 106, 106, 106, 106, 107, 107, 98, 96,
+ 94, 94, 94, 92, 91, 91, 91, 91, 92, 92, 92, 91, 91, 91, 91, 95, 99, 99,
+ 99, 103, 107, 107, 107, 109, 112, 112, 112, 114, 117, 117 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 64, 67, 67, 79,
+#endif
+ /* Size 4x4 */
+ 64, 64, 65, 70, 64, 65, 66, 70, 65, 66, 71, 76, 70, 70, 76, 92,
+ /* Size 8x8 */
+ 63, 63, 63, 64, 64, 65, 68, 71, 63, 64, 64, 64, 65, 66, 68, 70, 63, 64,
+ 65, 65, 65, 66, 67, 69, 64, 64, 65, 67, 68, 69, 71, 73, 64, 65, 65, 68,
+ 70, 71, 73, 76, 65, 66, 66, 69, 71, 73, 76, 80, 68, 68, 67, 71, 73, 76,
+ 79, 85, 71, 70, 69, 73, 76, 80, 85, 97,
+ /* Size 16x16 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 67, 68, 69, 72, 72, 63, 63,
+ 63, 64, 64, 64, 64, 64, 64, 64, 64, 67, 68, 69, 71, 71, 63, 63, 64, 64,
+ 64, 64, 64, 64, 64, 65, 65, 67, 68, 69, 70, 70, 63, 64, 64, 64, 64, 64,
+ 65, 65, 65, 65, 65, 67, 68, 68, 70, 70, 63, 64, 64, 64, 65, 65, 65, 65,
+ 65, 65, 65, 67, 67, 68, 69, 69, 63, 64, 64, 64, 65, 65, 65, 65, 65, 65,
+ 65, 67, 67, 68, 69, 69, 63, 64, 64, 65, 65, 65, 66, 66, 67, 67, 67, 69,
+ 70, 71, 72, 72, 63, 64, 64, 65, 65, 65, 66, 67, 67, 68, 68, 70, 71, 72,
+ 73, 73, 64, 64, 64, 65, 65, 65, 67, 67, 68, 69, 69, 71, 72, 73, 74, 74,
+ 64, 64, 65, 65, 65, 65, 67, 68, 69, 71, 71, 73, 74, 75, 77, 77, 64, 64,
+ 65, 65, 65, 65, 67, 68, 69, 71, 71, 73, 74, 75, 77, 77, 67, 67, 67, 67,
+ 67, 67, 69, 70, 71, 73, 73, 77, 78, 80, 84, 84, 68, 68, 68, 68, 67, 67,
+ 70, 71, 72, 74, 74, 78, 79, 82, 85, 85, 69, 69, 69, 68, 68, 68, 71, 72,
+ 73, 75, 75, 80, 82, 85, 90, 90, 72, 71, 70, 70, 69, 69, 72, 73, 74, 77,
+ 77, 84, 85, 90, 97, 97, 72, 71, 70, 70, 69, 69, 72, 73, 74, 77, 77, 84,
+ 85, 90, 97, 97,
+ /* Size 32x32 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64,
+ 64, 64, 64, 65, 67, 68, 68, 68, 69, 71, 72, 72, 72, 74, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65,
+ 67, 68, 68, 68, 69, 70, 71, 71, 71, 74, 63, 63, 63, 63, 63, 63, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 66, 67, 68, 68, 68,
+ 69, 70, 71, 71, 71, 73, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 65, 65, 65, 65, 66, 67, 68, 68, 68, 69, 70, 70, 70,
+ 70, 73, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 65, 65, 65, 65, 66, 67, 68, 68, 68, 69, 70, 70, 70, 70, 73, 63, 63,
+ 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65,
+ 65, 66, 67, 68, 68, 68, 69, 70, 70, 70, 70, 73, 63, 63, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 67, 68,
+ 68, 68, 68, 69, 70, 70, 70, 72, 63, 63, 64, 64, 64, 64, 64, 64, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 67, 67, 67, 67, 68, 69,
+ 69, 69, 69, 71, 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 66, 67, 67, 67, 67, 68, 68, 69, 69, 69, 71,
+ 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 66, 67, 67, 67, 67, 68, 68, 69, 69, 69, 71, 63, 63, 64, 64,
+ 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66,
+ 67, 67, 67, 67, 68, 68, 69, 69, 69, 71, 63, 63, 64, 64, 64, 64, 64, 65,
+ 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 67, 68, 69, 69, 69,
+ 69, 70, 70, 70, 70, 73, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 66,
+ 66, 66, 66, 66, 67, 67, 67, 67, 67, 68, 69, 70, 70, 70, 71, 72, 72, 72,
+ 72, 74, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 66, 66, 67, 67, 67,
+ 67, 68, 68, 68, 68, 69, 70, 71, 71, 71, 72, 72, 73, 73, 73, 75, 63, 64,
+ 64, 64, 64, 64, 65, 65, 65, 65, 65, 66, 66, 67, 67, 67, 67, 68, 68, 68,
+ 68, 69, 70, 71, 71, 71, 72, 72, 73, 73, 73, 75, 63, 64, 64, 64, 64, 64,
+ 65, 65, 65, 65, 65, 66, 66, 67, 67, 67, 67, 68, 68, 68, 68, 69, 70, 71,
+ 71, 71, 72, 72, 73, 73, 73, 75, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65,
+ 65, 66, 67, 67, 67, 67, 68, 69, 69, 69, 69, 70, 71, 72, 72, 72, 73, 74,
+ 74, 74, 74, 76, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 66, 67, 68,
+ 68, 68, 69, 70, 70, 70, 70, 71, 72, 73, 73, 73, 74, 75, 76, 76, 76, 78,
+ 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 66, 67, 68, 68, 68, 69, 70,
+ 71, 71, 71, 72, 73, 74, 74, 74, 75, 76, 77, 77, 77, 78, 64, 64, 64, 65,
+ 65, 65, 65, 65, 65, 65, 65, 66, 67, 68, 68, 68, 69, 70, 71, 71, 71, 72,
+ 73, 74, 74, 74, 75, 76, 77, 77, 77, 78, 64, 64, 64, 65, 65, 65, 65, 65,
+ 65, 65, 65, 66, 67, 68, 68, 68, 69, 70, 71, 71, 71, 72, 73, 74, 74, 74,
+ 75, 76, 77, 77, 77, 78, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 67,
+ 68, 69, 69, 69, 70, 71, 72, 72, 72, 73, 75, 76, 76, 76, 77, 79, 80, 80,
+ 80, 82, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 68, 69, 70, 70, 70,
+ 71, 72, 73, 73, 73, 75, 77, 78, 78, 78, 80, 82, 84, 84, 84, 85, 68, 68,
+ 68, 68, 68, 68, 68, 67, 67, 67, 67, 69, 70, 71, 71, 71, 72, 73, 74, 74,
+ 74, 76, 78, 79, 79, 79, 82, 84, 85, 85, 85, 87, 68, 68, 68, 68, 68, 68,
+ 68, 67, 67, 67, 67, 69, 70, 71, 71, 71, 72, 73, 74, 74, 74, 76, 78, 79,
+ 79, 79, 82, 84, 85, 85, 85, 87, 68, 68, 68, 68, 68, 68, 68, 67, 67, 67,
+ 67, 69, 70, 71, 71, 71, 72, 73, 74, 74, 74, 76, 78, 79, 79, 79, 82, 84,
+ 85, 85, 85, 87, 69, 69, 69, 69, 69, 69, 68, 68, 68, 68, 68, 69, 71, 72,
+ 72, 72, 73, 74, 75, 75, 75, 77, 80, 82, 82, 82, 85, 88, 90, 90, 90, 91,
+ 71, 70, 70, 70, 70, 70, 69, 69, 68, 68, 68, 70, 72, 72, 72, 72, 74, 75,
+ 76, 76, 76, 79, 82, 84, 84, 84, 88, 92, 94, 94, 94, 96, 72, 71, 71, 70,
+ 70, 70, 70, 69, 69, 69, 69, 70, 72, 73, 73, 73, 74, 76, 77, 77, 77, 80,
+ 84, 85, 85, 85, 90, 94, 97, 97, 97, 99, 72, 71, 71, 70, 70, 70, 70, 69,
+ 69, 69, 69, 70, 72, 73, 73, 73, 74, 76, 77, 77, 77, 80, 84, 85, 85, 85,
+ 90, 94, 97, 97, 97, 99, 72, 71, 71, 70, 70, 70, 70, 69, 69, 69, 69, 70,
+ 72, 73, 73, 73, 74, 76, 77, 77, 77, 80, 84, 85, 85, 85, 90, 94, 97, 97,
+ 97, 99, 74, 74, 73, 73, 73, 73, 72, 71, 71, 71, 71, 73, 74, 75, 75, 75,
+ 76, 78, 78, 78, 78, 82, 85, 87, 87, 87, 91, 96, 99, 99, 99, 101,
+ /* Size 4x8 */
+ 63, 63, 64, 71, 64, 64, 65, 71, 64, 65, 66, 69, 64, 65, 68, 73, 64, 66,
+ 70, 76, 66, 66, 72, 80, 68, 68, 74, 85, 71, 69, 77, 96,
+ /* Size 8x4 */
+ 63, 64, 64, 64, 64, 66, 68, 71, 63, 64, 65, 65, 66, 66, 68, 69, 64, 65,
+ 66, 68, 70, 72, 74, 77, 71, 71, 69, 73, 76, 80, 85, 96,
+ /* Size 8x16 */
+ 64, 63, 63, 63, 64, 64, 70, 72, 63, 64, 64, 64, 65, 65, 70, 71, 63, 64,
+ 64, 64, 65, 65, 70, 71, 63, 64, 64, 65, 65, 65, 69, 70, 63, 64, 65, 65,
+ 66, 66, 68, 69, 63, 64, 65, 65, 66, 66, 68, 69, 63, 65, 65, 66, 68, 68,
+ 71, 72, 64, 65, 65, 66, 68, 68, 72, 73, 64, 65, 65, 67, 69, 69, 73, 75,
+ 64, 65, 66, 68, 71, 71, 75, 77, 64, 65, 66, 68, 71, 71, 75, 77, 67, 67,
+ 67, 70, 73, 73, 81, 83, 68, 68, 68, 70, 74, 74, 83, 85, 69, 69, 68, 71,
+ 75, 75, 86, 89, 72, 70, 69, 72, 77, 77, 92, 96, 72, 70, 69, 72, 77, 77,
+ 92, 96,
+ /* Size 16x8 */
+ 64, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 67, 68, 69, 72, 72, 63, 64,
+ 64, 64, 64, 64, 65, 65, 65, 65, 65, 67, 68, 69, 70, 70, 63, 64, 64, 64,
+ 65, 65, 65, 65, 65, 66, 66, 67, 68, 68, 69, 69, 63, 64, 64, 65, 65, 65,
+ 66, 66, 67, 68, 68, 70, 70, 71, 72, 72, 64, 65, 65, 65, 66, 66, 68, 68,
+ 69, 71, 71, 73, 74, 75, 77, 77, 64, 65, 65, 65, 66, 66, 68, 68, 69, 71,
+ 71, 73, 74, 75, 77, 77, 70, 70, 70, 69, 68, 68, 71, 72, 73, 75, 75, 81,
+ 83, 86, 92, 92, 72, 71, 71, 70, 69, 69, 72, 73, 75, 77, 77, 83, 85, 89,
+ 96, 96,
+ /* Size 16x32 */
+ 64, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 67, 70, 72, 72, 72, 63, 63,
+ 63, 63, 63, 63, 64, 64, 64, 64, 64, 67, 70, 71, 71, 71, 63, 63, 64, 64,
+ 64, 64, 64, 65, 65, 65, 65, 67, 70, 71, 71, 71, 63, 64, 64, 64, 64, 64,
+ 64, 65, 65, 65, 65, 67, 70, 71, 71, 71, 63, 64, 64, 64, 64, 64, 64, 65,
+ 65, 65, 65, 67, 70, 71, 71, 71, 63, 64, 64, 64, 64, 64, 64, 65, 65, 65,
+ 65, 67, 70, 71, 71, 71, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 67,
+ 69, 70, 70, 70, 63, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 67, 69, 70,
+ 70, 70, 63, 64, 64, 65, 65, 65, 65, 65, 66, 66, 66, 67, 68, 69, 69, 69,
+ 63, 64, 64, 65, 65, 65, 65, 65, 66, 66, 66, 67, 68, 69, 69, 69, 63, 64,
+ 64, 65, 65, 65, 65, 65, 66, 66, 66, 67, 68, 69, 69, 69, 63, 64, 65, 65,
+ 65, 65, 66, 66, 67, 67, 67, 68, 70, 71, 71, 71, 63, 64, 65, 65, 65, 65,
+ 66, 67, 68, 68, 68, 69, 71, 72, 72, 72, 64, 64, 65, 65, 65, 65, 66, 68,
+ 68, 68, 68, 70, 72, 73, 73, 73, 64, 64, 65, 65, 65, 65, 66, 68, 68, 68,
+ 68, 70, 72, 73, 73, 73, 64, 64, 65, 65, 65, 65, 66, 68, 68, 68, 68, 70,
+ 72, 73, 73, 73, 64, 64, 65, 65, 65, 65, 67, 68, 69, 69, 69, 71, 73, 75,
+ 75, 75, 64, 64, 65, 66, 66, 66, 67, 69, 70, 70, 70, 72, 75, 76, 76, 76,
+ 64, 64, 65, 66, 66, 66, 68, 70, 71, 71, 71, 73, 75, 77, 77, 77, 64, 64,
+ 65, 66, 66, 66, 68, 70, 71, 71, 71, 73, 75, 77, 77, 77, 64, 64, 65, 66,
+ 66, 66, 68, 70, 71, 71, 71, 73, 75, 77, 77, 77, 65, 66, 66, 66, 66, 66,
+ 69, 71, 72, 72, 72, 75, 78, 80, 80, 80, 67, 67, 67, 67, 67, 67, 70, 72,
+ 73, 73, 73, 77, 81, 83, 83, 83, 68, 68, 68, 68, 68, 68, 70, 72, 74, 74,
+ 74, 78, 83, 85, 85, 85, 68, 68, 68, 68, 68, 68, 70, 72, 74, 74, 74, 78,
+ 83, 85, 85, 85, 68, 68, 68, 68, 68, 68, 70, 72, 74, 74, 74, 78, 83, 85,
+ 85, 85, 69, 69, 69, 68, 68, 68, 71, 74, 75, 75, 75, 80, 86, 89, 89, 89,
+ 71, 70, 69, 69, 69, 69, 72, 75, 76, 76, 76, 82, 90, 94, 94, 94, 72, 71,
+ 70, 69, 69, 69, 72, 75, 77, 77, 77, 84, 92, 96, 96, 96, 72, 71, 70, 69,
+ 69, 69, 72, 75, 77, 77, 77, 84, 92, 96, 96, 96, 72, 71, 70, 69, 69, 69,
+ 72, 75, 77, 77, 77, 84, 92, 96, 96, 96, 74, 73, 72, 72, 72, 72, 74, 77,
+ 79, 79, 79, 85, 93, 98, 98, 98,
+ /* Size 32x16 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64,
+ 64, 64, 64, 65, 67, 68, 68, 68, 69, 71, 72, 72, 72, 74, 63, 63, 63, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 66,
+ 67, 68, 68, 68, 69, 70, 71, 71, 71, 73, 63, 63, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 67, 68, 68, 68,
+ 69, 69, 70, 70, 70, 72, 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 67, 68, 68, 68, 68, 69, 69, 69,
+ 69, 72, 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 66, 66, 66, 66, 66, 67, 68, 68, 68, 68, 69, 69, 69, 69, 72, 63, 63,
+ 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66,
+ 66, 66, 67, 68, 68, 68, 68, 69, 69, 69, 69, 72, 63, 64, 64, 64, 64, 64,
+ 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 67, 67, 68, 68, 68, 69, 70, 70,
+ 70, 70, 71, 72, 72, 72, 72, 74, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 66, 67, 68, 68, 68, 68, 69, 70, 70, 70, 71, 72, 72, 72, 72, 74, 75,
+ 75, 75, 75, 77, 64, 64, 65, 65, 65, 65, 65, 65, 66, 66, 66, 67, 68, 68,
+ 68, 68, 69, 70, 71, 71, 71, 72, 73, 74, 74, 74, 75, 76, 77, 77, 77, 79,
+ 64, 64, 65, 65, 65, 65, 65, 65, 66, 66, 66, 67, 68, 68, 68, 68, 69, 70,
+ 71, 71, 71, 72, 73, 74, 74, 74, 75, 76, 77, 77, 77, 79, 64, 64, 65, 65,
+ 65, 65, 65, 65, 66, 66, 66, 67, 68, 68, 68, 68, 69, 70, 71, 71, 71, 72,
+ 73, 74, 74, 74, 75, 76, 77, 77, 77, 79, 67, 67, 67, 67, 67, 67, 67, 67,
+ 67, 67, 67, 68, 69, 70, 70, 70, 71, 72, 73, 73, 73, 75, 77, 78, 78, 78,
+ 80, 82, 84, 84, 84, 85, 70, 70, 70, 70, 70, 70, 69, 69, 68, 68, 68, 70,
+ 71, 72, 72, 72, 73, 75, 75, 75, 75, 78, 81, 83, 83, 83, 86, 90, 92, 92,
+ 92, 93, 72, 71, 71, 71, 71, 71, 70, 70, 69, 69, 69, 71, 72, 73, 73, 73,
+ 75, 76, 77, 77, 77, 80, 83, 85, 85, 85, 89, 94, 96, 96, 96, 98, 72, 71,
+ 71, 71, 71, 71, 70, 70, 69, 69, 69, 71, 72, 73, 73, 73, 75, 76, 77, 77,
+ 77, 80, 83, 85, 85, 85, 89, 94, 96, 96, 96, 98, 72, 71, 71, 71, 71, 71,
+ 70, 70, 69, 69, 69, 71, 72, 73, 73, 73, 75, 76, 77, 77, 77, 80, 83, 85,
+ 85, 85, 89, 94, 96, 96, 96, 98,
+ /* Size 4x16 */
+ 63, 63, 64, 72, 63, 64, 65, 71, 64, 64, 65, 71, 64, 64, 65, 70, 64, 65,
+ 66, 69, 64, 65, 66, 69, 64, 65, 68, 72, 64, 65, 68, 73, 64, 65, 69, 75,
+ 64, 66, 71, 77, 64, 66, 71, 77, 67, 67, 73, 83, 68, 68, 74, 85, 69, 68,
+ 75, 89, 71, 69, 77, 96, 71, 69, 77, 96,
+ /* Size 16x4 */
+ 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 67, 68, 69, 71, 71, 63, 64,
+ 64, 64, 65, 65, 65, 65, 65, 66, 66, 67, 68, 68, 69, 69, 64, 65, 65, 65,
+ 66, 66, 68, 68, 69, 71, 71, 73, 74, 75, 77, 77, 72, 71, 71, 70, 69, 69,
+ 72, 73, 75, 77, 77, 83, 85, 89, 96, 96,
+ /* Size 8x32 */
+ 64, 63, 63, 63, 64, 64, 70, 72, 63, 63, 63, 64, 64, 64, 70, 71, 63, 64,
+ 64, 64, 65, 65, 70, 71, 63, 64, 64, 64, 65, 65, 70, 71, 63, 64, 64, 64,
+ 65, 65, 70, 71, 63, 64, 64, 64, 65, 65, 70, 71, 63, 64, 64, 65, 65, 65,
+ 69, 70, 63, 64, 65, 65, 65, 65, 69, 70, 63, 64, 65, 65, 66, 66, 68, 69,
+ 63, 64, 65, 65, 66, 66, 68, 69, 63, 64, 65, 65, 66, 66, 68, 69, 63, 65,
+ 65, 66, 67, 67, 70, 71, 63, 65, 65, 66, 68, 68, 71, 72, 64, 65, 65, 66,
+ 68, 68, 72, 73, 64, 65, 65, 66, 68, 68, 72, 73, 64, 65, 65, 66, 68, 68,
+ 72, 73, 64, 65, 65, 67, 69, 69, 73, 75, 64, 65, 66, 67, 70, 70, 75, 76,
+ 64, 65, 66, 68, 71, 71, 75, 77, 64, 65, 66, 68, 71, 71, 75, 77, 64, 65,
+ 66, 68, 71, 71, 75, 77, 65, 66, 66, 69, 72, 72, 78, 80, 67, 67, 67, 70,
+ 73, 73, 81, 83, 68, 68, 68, 70, 74, 74, 83, 85, 68, 68, 68, 70, 74, 74,
+ 83, 85, 68, 68, 68, 70, 74, 74, 83, 85, 69, 69, 68, 71, 75, 75, 86, 89,
+ 71, 69, 69, 72, 76, 76, 90, 94, 72, 70, 69, 72, 77, 77, 92, 96, 72, 70,
+ 69, 72, 77, 77, 92, 96, 72, 70, 69, 72, 77, 77, 92, 96, 74, 72, 72, 74,
+ 79, 79, 93, 98,
+ /* Size 32x8 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64,
+ 64, 64, 64, 65, 67, 68, 68, 68, 69, 71, 72, 72, 72, 74, 63, 63, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66,
+ 67, 68, 68, 68, 69, 69, 70, 70, 70, 72, 63, 63, 64, 64, 64, 64, 64, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 67, 68, 68, 68,
+ 68, 69, 69, 69, 69, 72, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 66,
+ 66, 66, 66, 66, 67, 67, 68, 68, 68, 69, 70, 70, 70, 70, 71, 72, 72, 72,
+ 72, 74, 64, 64, 65, 65, 65, 65, 65, 65, 66, 66, 66, 67, 68, 68, 68, 68,
+ 69, 70, 71, 71, 71, 72, 73, 74, 74, 74, 75, 76, 77, 77, 77, 79, 64, 64,
+ 65, 65, 65, 65, 65, 65, 66, 66, 66, 67, 68, 68, 68, 68, 69, 70, 71, 71,
+ 71, 72, 73, 74, 74, 74, 75, 76, 77, 77, 77, 79, 70, 70, 70, 70, 70, 70,
+ 69, 69, 68, 68, 68, 70, 71, 72, 72, 72, 73, 75, 75, 75, 75, 78, 81, 83,
+ 83, 83, 86, 90, 92, 92, 92, 93, 72, 71, 71, 71, 71, 71, 70, 70, 69, 69,
+ 69, 71, 72, 73, 73, 73, 75, 76, 77, 77, 77, 80, 83, 85, 85, 85, 89, 94,
+ 96, 96, 96, 98 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 63, 85, 85, 97,
+#endif
+ /* Size 4x4 */
+ 63, 65, 77, 93, 65, 69, 83, 92, 77, 83, 95, 95, 93, 92, 95, 104,
+ /* Size 8x8 */
+ 63, 63, 61, 68, 73, 78, 84, 97, 63, 63, 62, 69, 75, 80, 85, 95, 61, 62,
+ 64, 71, 78, 82, 85, 93, 68, 69, 71, 78, 85, 88, 90, 95, 73, 75, 78, 85,
+ 92, 94, 94, 95, 78, 80, 82, 88, 94, 95, 96, 98, 84, 85, 85, 90, 94, 96,
+ 97, 101, 97, 95, 93, 95, 95, 98, 101, 106,
+ /* Size 16x16 */
+ 64, 63, 62, 62, 61, 61, 66, 67, 69, 73, 73, 81, 83, 89, 98, 98, 63, 63,
+ 63, 62, 62, 62, 67, 69, 72, 76, 76, 83, 84, 89, 96, 96, 62, 63, 63, 63,
+ 62, 62, 68, 69, 72, 77, 77, 83, 85, 89, 95, 95, 62, 62, 63, 63, 63, 63,
+ 68, 70, 73, 78, 78, 83, 85, 88, 94, 94, 61, 62, 62, 63, 64, 64, 69, 71,
+ 74, 80, 80, 84, 85, 88, 93, 93, 61, 62, 62, 63, 64, 64, 69, 71, 74, 80,
+ 80, 84, 85, 88, 93, 93, 66, 67, 68, 68, 69, 69, 75, 77, 80, 85, 85, 88,
+ 89, 91, 94, 94, 67, 69, 69, 70, 71, 71, 77, 78, 81, 87, 87, 89, 90, 92,
+ 95, 95, 69, 72, 72, 73, 74, 74, 80, 81, 85, 90, 90, 91, 92, 93, 95, 95,
+ 73, 76, 77, 78, 80, 80, 85, 87, 90, 95, 95, 95, 95, 95, 96, 96, 73, 76,
+ 77, 78, 80, 80, 85, 87, 90, 95, 95, 95, 95, 95, 96, 96, 81, 83, 83, 83,
+ 84, 84, 88, 89, 91, 95, 95, 96, 97, 98, 100, 100, 83, 84, 85, 85, 85,
+ 85, 89, 90, 92, 95, 95, 97, 97, 99, 101, 101, 89, 89, 89, 88, 88, 88,
+ 91, 92, 93, 95, 95, 98, 99, 100, 103, 103, 98, 96, 95, 94, 93, 93, 94,
+ 95, 95, 96, 96, 100, 101, 103, 106, 106, 98, 96, 95, 94, 93, 93, 94, 95,
+ 95, 96, 96, 100, 101, 103, 106, 106,
+ /* Size 32x32 */
+ 64, 63, 63, 62, 62, 62, 62, 61, 61, 61, 61, 63, 66, 67, 67, 67, 69, 72,
+ 73, 73, 73, 77, 81, 83, 83, 83, 89, 95, 98, 98, 98, 98, 63, 63, 63, 63,
+ 63, 63, 62, 62, 61, 61, 61, 64, 66, 68, 68, 68, 70, 73, 75, 75, 75, 78,
+ 82, 84, 84, 84, 89, 94, 97, 97, 97, 97, 63, 63, 63, 63, 63, 63, 62, 62,
+ 62, 62, 62, 65, 67, 69, 69, 69, 72, 75, 76, 76, 76, 79, 83, 84, 84, 84,
+ 89, 93, 96, 96, 96, 95, 62, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 65,
+ 68, 69, 69, 69, 72, 75, 77, 77, 77, 80, 83, 85, 85, 85, 89, 93, 95, 95,
+ 95, 95, 62, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 65, 68, 69, 69, 69,
+ 72, 75, 77, 77, 77, 80, 83, 85, 85, 85, 89, 93, 95, 95, 95, 95, 62, 63,
+ 63, 63, 63, 63, 63, 63, 62, 62, 62, 65, 68, 69, 69, 69, 72, 75, 77, 77,
+ 77, 80, 83, 85, 85, 85, 89, 93, 95, 95, 95, 95, 62, 62, 62, 63, 63, 63,
+ 63, 63, 63, 63, 63, 66, 68, 70, 70, 70, 73, 76, 78, 78, 78, 81, 83, 85,
+ 85, 85, 88, 92, 94, 94, 94, 94, 61, 62, 62, 63, 63, 63, 63, 63, 63, 63,
+ 63, 66, 69, 71, 71, 71, 74, 77, 79, 79, 79, 82, 84, 85, 85, 85, 88, 92,
+ 93, 93, 93, 93, 61, 61, 62, 62, 62, 62, 63, 63, 64, 64, 64, 66, 69, 71,
+ 71, 71, 74, 78, 80, 80, 80, 82, 84, 85, 85, 85, 88, 91, 93, 93, 93, 92,
+ 61, 61, 62, 62, 62, 62, 63, 63, 64, 64, 64, 66, 69, 71, 71, 71, 74, 78,
+ 80, 80, 80, 82, 84, 85, 85, 85, 88, 91, 93, 93, 93, 92, 61, 61, 62, 62,
+ 62, 62, 63, 63, 64, 64, 64, 66, 69, 71, 71, 71, 74, 78, 80, 80, 80, 82,
+ 84, 85, 85, 85, 88, 91, 93, 93, 93, 92, 63, 64, 65, 65, 65, 65, 66, 66,
+ 66, 66, 66, 69, 72, 74, 74, 74, 77, 81, 83, 83, 83, 84, 86, 87, 87, 87,
+ 89, 92, 93, 93, 93, 93, 66, 66, 67, 68, 68, 68, 68, 69, 69, 69, 69, 72,
+ 75, 77, 77, 77, 80, 83, 85, 85, 85, 87, 88, 89, 89, 89, 91, 93, 94, 94,
+ 94, 93, 67, 68, 69, 69, 69, 69, 70, 71, 71, 71, 71, 74, 77, 78, 78, 78,
+ 81, 85, 87, 87, 87, 88, 89, 90, 90, 90, 92, 94, 95, 95, 95, 94, 67, 68,
+ 69, 69, 69, 69, 70, 71, 71, 71, 71, 74, 77, 78, 78, 78, 81, 85, 87, 87,
+ 87, 88, 89, 90, 90, 90, 92, 94, 95, 95, 95, 94, 67, 68, 69, 69, 69, 69,
+ 70, 71, 71, 71, 71, 74, 77, 78, 78, 78, 81, 85, 87, 87, 87, 88, 89, 90,
+ 90, 90, 92, 94, 95, 95, 95, 94, 69, 70, 72, 72, 72, 72, 73, 74, 74, 74,
+ 74, 77, 80, 81, 81, 81, 85, 88, 90, 90, 90, 91, 91, 92, 92, 92, 93, 94,
+ 95, 95, 95, 94, 72, 73, 75, 75, 75, 75, 76, 77, 78, 78, 78, 81, 83, 85,
+ 85, 85, 88, 92, 93, 93, 93, 94, 94, 94, 94, 94, 94, 95, 95, 95, 95, 94,
+ 73, 75, 76, 77, 77, 77, 78, 79, 80, 80, 80, 83, 85, 87, 87, 87, 90, 93,
+ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 96, 96, 96, 95, 73, 75, 76, 77,
+ 77, 77, 78, 79, 80, 80, 80, 83, 85, 87, 87, 87, 90, 93, 95, 95, 95, 95,
+ 95, 95, 95, 95, 95, 95, 96, 96, 96, 95, 73, 75, 76, 77, 77, 77, 78, 79,
+ 80, 80, 80, 83, 85, 87, 87, 87, 90, 93, 95, 95, 95, 95, 95, 95, 95, 95,
+ 95, 95, 96, 96, 96, 95, 77, 78, 79, 80, 80, 80, 81, 82, 82, 82, 82, 84,
+ 87, 88, 88, 88, 91, 94, 95, 95, 95, 95, 96, 96, 96, 96, 96, 97, 98, 98,
+ 98, 97, 81, 82, 83, 83, 83, 83, 83, 84, 84, 84, 84, 86, 88, 89, 89, 89,
+ 91, 94, 95, 95, 95, 96, 96, 97, 97, 97, 98, 99, 100, 100, 100, 99, 83,
+ 84, 84, 85, 85, 85, 85, 85, 85, 85, 85, 87, 89, 90, 90, 90, 92, 94, 95,
+ 95, 95, 96, 97, 97, 97, 97, 99, 100, 101, 101, 101, 100, 83, 84, 84, 85,
+ 85, 85, 85, 85, 85, 85, 85, 87, 89, 90, 90, 90, 92, 94, 95, 95, 95, 96,
+ 97, 97, 97, 97, 99, 100, 101, 101, 101, 100, 83, 84, 84, 85, 85, 85, 85,
+ 85, 85, 85, 85, 87, 89, 90, 90, 90, 92, 94, 95, 95, 95, 96, 97, 97, 97,
+ 97, 99, 100, 101, 101, 101, 100, 89, 89, 89, 89, 89, 89, 88, 88, 88, 88,
+ 88, 89, 91, 92, 92, 92, 93, 94, 95, 95, 95, 96, 98, 99, 99, 99, 100,
+ 102, 103, 103, 103, 102, 95, 94, 93, 93, 93, 93, 92, 92, 91, 91, 91, 92,
+ 93, 94, 94, 94, 94, 95, 95, 95, 95, 97, 99, 100, 100, 100, 102, 104,
+ 105, 105, 105, 105, 98, 97, 96, 95, 95, 95, 94, 93, 93, 93, 93, 93, 94,
+ 95, 95, 95, 95, 95, 96, 96, 96, 98, 100, 101, 101, 101, 103, 105, 106,
+ 106, 106, 106, 98, 97, 96, 95, 95, 95, 94, 93, 93, 93, 93, 93, 94, 95,
+ 95, 95, 95, 95, 96, 96, 96, 98, 100, 101, 101, 101, 103, 105, 106, 106,
+ 106, 106, 98, 97, 96, 95, 95, 95, 94, 93, 93, 93, 93, 93, 94, 95, 95,
+ 95, 95, 95, 96, 96, 96, 98, 100, 101, 101, 101, 103, 105, 106, 106, 106,
+ 106, 98, 97, 95, 95, 95, 95, 94, 93, 92, 92, 92, 93, 93, 94, 94, 94, 94,
+ 94, 95, 95, 95, 97, 99, 100, 100, 100, 102, 105, 106, 106, 106, 107,
+ /* Size 4x8 */
+ 63, 62, 75, 96, 63, 63, 77, 94, 62, 64, 80, 92, 69, 72, 86, 94, 75, 79,
+ 93, 95, 79, 82, 95, 97, 85, 86, 95, 100, 96, 93, 96, 106,
+ /* Size 8x4 */
+ 63, 63, 62, 69, 75, 79, 85, 96, 62, 63, 64, 72, 79, 82, 86, 93, 75, 77,
+ 80, 86, 93, 95, 95, 96, 96, 94, 92, 94, 95, 97, 100, 106,
+ /* Size 8x16 */
+ 64, 62, 62, 66, 74, 74, 91, 96, 63, 63, 63, 68, 76, 76, 90, 95, 63, 63,
+ 63, 68, 77, 77, 90, 94, 62, 63, 64, 69, 78, 78, 90, 93, 61, 64, 64, 70,
+ 80, 80, 89, 92, 61, 64, 64, 70, 80, 80, 89, 92, 66, 69, 70, 75, 85, 85,
+ 92, 94, 67, 71, 72, 77, 86, 86, 92, 94, 70, 74, 75, 80, 89, 89, 93, 95,
+ 74, 79, 80, 86, 94, 94, 95, 95, 74, 79, 80, 86, 94, 94, 95, 95, 82, 84,
+ 85, 88, 95, 95, 98, 99, 84, 85, 86, 89, 95, 95, 99, 100, 89, 89, 89, 91,
+ 95, 95, 101, 102, 98, 94, 93, 94, 96, 96, 104, 106, 98, 94, 93, 94, 96,
+ 96, 104, 106,
+ /* Size 16x8 */
+ 64, 63, 63, 62, 61, 61, 66, 67, 70, 74, 74, 82, 84, 89, 98, 98, 62, 63,
+ 63, 63, 64, 64, 69, 71, 74, 79, 79, 84, 85, 89, 94, 94, 62, 63, 63, 64,
+ 64, 64, 70, 72, 75, 80, 80, 85, 86, 89, 93, 93, 66, 68, 68, 69, 70, 70,
+ 75, 77, 80, 86, 86, 88, 89, 91, 94, 94, 74, 76, 77, 78, 80, 80, 85, 86,
+ 89, 94, 94, 95, 95, 95, 96, 96, 74, 76, 77, 78, 80, 80, 85, 86, 89, 94,
+ 94, 95, 95, 95, 96, 96, 91, 90, 90, 90, 89, 89, 92, 92, 93, 95, 95, 98,
+ 99, 101, 104, 104, 96, 95, 94, 93, 92, 92, 94, 94, 95, 95, 95, 99, 100,
+ 102, 106, 106,
+ /* Size 16x32 */
+ 64, 63, 62, 62, 62, 62, 66, 71, 74, 74, 74, 81, 91, 96, 96, 96, 63, 63,
+ 62, 62, 62, 62, 67, 72, 75, 75, 75, 82, 91, 96, 96, 96, 63, 63, 63, 63,
+ 63, 63, 68, 73, 76, 76, 76, 83, 90, 95, 95, 95, 63, 63, 63, 63, 63, 63,
+ 68, 74, 77, 77, 77, 83, 90, 94, 94, 94, 63, 63, 63, 63, 63, 63, 68, 74,
+ 77, 77, 77, 83, 90, 94, 94, 94, 63, 63, 63, 63, 63, 63, 68, 74, 77, 77,
+ 77, 83, 90, 94, 94, 94, 62, 63, 63, 64, 64, 64, 69, 75, 78, 78, 78, 83,
+ 90, 93, 93, 93, 61, 62, 63, 64, 64, 64, 69, 76, 79, 79, 79, 84, 89, 92,
+ 92, 92, 61, 62, 64, 64, 64, 64, 70, 76, 80, 80, 80, 84, 89, 92, 92, 92,
+ 61, 62, 64, 64, 64, 64, 70, 76, 80, 80, 80, 84, 89, 92, 92, 92, 61, 62,
+ 64, 64, 64, 64, 70, 76, 80, 80, 80, 84, 89, 92, 92, 92, 63, 65, 66, 67,
+ 67, 67, 72, 79, 82, 82, 82, 86, 90, 93, 93, 93, 66, 68, 69, 70, 70, 70,
+ 75, 81, 85, 85, 85, 88, 92, 94, 94, 94, 67, 69, 71, 72, 72, 72, 77, 83,
+ 86, 86, 86, 89, 92, 94, 94, 94, 67, 69, 71, 72, 72, 72, 77, 83, 86, 86,
+ 86, 89, 92, 94, 94, 94, 67, 69, 71, 72, 72, 72, 77, 83, 86, 86, 86, 89,
+ 92, 94, 94, 94, 70, 72, 74, 75, 75, 75, 80, 86, 89, 89, 89, 91, 93, 95,
+ 95, 95, 73, 75, 77, 79, 79, 79, 84, 89, 93, 93, 93, 94, 95, 95, 95, 95,
+ 74, 76, 79, 80, 80, 80, 86, 91, 94, 94, 94, 95, 95, 95, 95, 95, 74, 76,
+ 79, 80, 80, 80, 86, 91, 94, 94, 94, 95, 95, 95, 95, 95, 74, 76, 79, 80,
+ 80, 80, 86, 91, 94, 94, 94, 95, 95, 95, 95, 95, 78, 79, 81, 82, 82, 82,
+ 87, 92, 95, 95, 95, 96, 97, 97, 97, 97, 82, 83, 84, 85, 85, 85, 88, 92,
+ 95, 95, 95, 96, 98, 99, 99, 99, 84, 85, 85, 86, 86, 86, 89, 93, 95, 95,
+ 95, 97, 99, 100, 100, 100, 84, 85, 85, 86, 86, 86, 89, 93, 95, 95, 95,
+ 97, 99, 100, 100, 100, 84, 85, 85, 86, 86, 86, 89, 93, 95, 95, 95, 97,
+ 99, 100, 100, 100, 89, 89, 89, 89, 89, 89, 91, 94, 95, 95, 95, 98, 101,
+ 102, 102, 102, 95, 93, 92, 92, 92, 92, 93, 95, 96, 96, 96, 99, 103, 105,
+ 105, 105, 98, 96, 94, 93, 93, 93, 94, 96, 96, 96, 96, 100, 104, 106,
+ 106, 106, 98, 96, 94, 93, 93, 93, 94, 96, 96, 96, 96, 100, 104, 106,
+ 106, 106, 98, 96, 94, 93, 93, 93, 94, 96, 96, 96, 96, 100, 104, 106,
+ 106, 106, 98, 96, 94, 93, 93, 93, 94, 95, 95, 95, 95, 99, 104, 106, 106,
+ 106,
+ /* Size 32x16 */
+ 64, 63, 63, 63, 63, 63, 62, 61, 61, 61, 61, 63, 66, 67, 67, 67, 70, 73,
+ 74, 74, 74, 78, 82, 84, 84, 84, 89, 95, 98, 98, 98, 98, 63, 63, 63, 63,
+ 63, 63, 63, 62, 62, 62, 62, 65, 68, 69, 69, 69, 72, 75, 76, 76, 76, 79,
+ 83, 85, 85, 85, 89, 93, 96, 96, 96, 96, 62, 62, 63, 63, 63, 63, 63, 63,
+ 64, 64, 64, 66, 69, 71, 71, 71, 74, 77, 79, 79, 79, 81, 84, 85, 85, 85,
+ 89, 92, 94, 94, 94, 94, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 64, 67,
+ 70, 72, 72, 72, 75, 79, 80, 80, 80, 82, 85, 86, 86, 86, 89, 92, 93, 93,
+ 93, 93, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 64, 67, 70, 72, 72, 72,
+ 75, 79, 80, 80, 80, 82, 85, 86, 86, 86, 89, 92, 93, 93, 93, 93, 62, 62,
+ 63, 63, 63, 63, 64, 64, 64, 64, 64, 67, 70, 72, 72, 72, 75, 79, 80, 80,
+ 80, 82, 85, 86, 86, 86, 89, 92, 93, 93, 93, 93, 66, 67, 68, 68, 68, 68,
+ 69, 69, 70, 70, 70, 72, 75, 77, 77, 77, 80, 84, 86, 86, 86, 87, 88, 89,
+ 89, 89, 91, 93, 94, 94, 94, 94, 71, 72, 73, 74, 74, 74, 75, 76, 76, 76,
+ 76, 79, 81, 83, 83, 83, 86, 89, 91, 91, 91, 92, 92, 93, 93, 93, 94, 95,
+ 96, 96, 96, 95, 74, 75, 76, 77, 77, 77, 78, 79, 80, 80, 80, 82, 85, 86,
+ 86, 86, 89, 93, 94, 94, 94, 95, 95, 95, 95, 95, 95, 96, 96, 96, 96, 95,
+ 74, 75, 76, 77, 77, 77, 78, 79, 80, 80, 80, 82, 85, 86, 86, 86, 89, 93,
+ 94, 94, 94, 95, 95, 95, 95, 95, 95, 96, 96, 96, 96, 95, 74, 75, 76, 77,
+ 77, 77, 78, 79, 80, 80, 80, 82, 85, 86, 86, 86, 89, 93, 94, 94, 94, 95,
+ 95, 95, 95, 95, 95, 96, 96, 96, 96, 95, 81, 82, 83, 83, 83, 83, 83, 84,
+ 84, 84, 84, 86, 88, 89, 89, 89, 91, 94, 95, 95, 95, 96, 96, 97, 97, 97,
+ 98, 99, 100, 100, 100, 99, 91, 91, 90, 90, 90, 90, 90, 89, 89, 89, 89,
+ 90, 92, 92, 92, 92, 93, 95, 95, 95, 95, 97, 98, 99, 99, 99, 101, 103,
+ 104, 104, 104, 104, 96, 96, 95, 94, 94, 94, 93, 92, 92, 92, 92, 93, 94,
+ 94, 94, 94, 95, 95, 95, 95, 95, 97, 99, 100, 100, 100, 102, 105, 106,
+ 106, 106, 106, 96, 96, 95, 94, 94, 94, 93, 92, 92, 92, 92, 93, 94, 94,
+ 94, 94, 95, 95, 95, 95, 95, 97, 99, 100, 100, 100, 102, 105, 106, 106,
+ 106, 106, 96, 96, 95, 94, 94, 94, 93, 92, 92, 92, 92, 93, 94, 94, 94,
+ 94, 95, 95, 95, 95, 95, 97, 99, 100, 100, 100, 102, 105, 106, 106, 106,
+ 106,
+ /* Size 4x16 */
+ 63, 62, 74, 96, 63, 63, 76, 95, 63, 63, 77, 94, 63, 64, 78, 93, 62, 64,
+ 80, 92, 62, 64, 80, 92, 68, 70, 85, 94, 69, 72, 86, 94, 72, 75, 89, 95,
+ 76, 80, 94, 95, 76, 80, 94, 95, 83, 85, 95, 99, 85, 86, 95, 100, 89, 89,
+ 95, 102, 96, 93, 96, 106, 96, 93, 96, 106,
+ /* Size 16x4 */
+ 63, 63, 63, 63, 62, 62, 68, 69, 72, 76, 76, 83, 85, 89, 96, 96, 62, 63,
+ 63, 64, 64, 64, 70, 72, 75, 80, 80, 85, 86, 89, 93, 93, 74, 76, 77, 78,
+ 80, 80, 85, 86, 89, 94, 94, 95, 95, 95, 96, 96, 96, 95, 94, 93, 92, 92,
+ 94, 94, 95, 95, 95, 99, 100, 102, 106, 106,
+ /* Size 8x32 */
+ 64, 62, 62, 66, 74, 74, 91, 96, 63, 62, 62, 67, 75, 75, 91, 96, 63, 63,
+ 63, 68, 76, 76, 90, 95, 63, 63, 63, 68, 77, 77, 90, 94, 63, 63, 63, 68,
+ 77, 77, 90, 94, 63, 63, 63, 68, 77, 77, 90, 94, 62, 63, 64, 69, 78, 78,
+ 90, 93, 61, 63, 64, 69, 79, 79, 89, 92, 61, 64, 64, 70, 80, 80, 89, 92,
+ 61, 64, 64, 70, 80, 80, 89, 92, 61, 64, 64, 70, 80, 80, 89, 92, 63, 66,
+ 67, 72, 82, 82, 90, 93, 66, 69, 70, 75, 85, 85, 92, 94, 67, 71, 72, 77,
+ 86, 86, 92, 94, 67, 71, 72, 77, 86, 86, 92, 94, 67, 71, 72, 77, 86, 86,
+ 92, 94, 70, 74, 75, 80, 89, 89, 93, 95, 73, 77, 79, 84, 93, 93, 95, 95,
+ 74, 79, 80, 86, 94, 94, 95, 95, 74, 79, 80, 86, 94, 94, 95, 95, 74, 79,
+ 80, 86, 94, 94, 95, 95, 78, 81, 82, 87, 95, 95, 97, 97, 82, 84, 85, 88,
+ 95, 95, 98, 99, 84, 85, 86, 89, 95, 95, 99, 100, 84, 85, 86, 89, 95, 95,
+ 99, 100, 84, 85, 86, 89, 95, 95, 99, 100, 89, 89, 89, 91, 95, 95, 101,
+ 102, 95, 92, 92, 93, 96, 96, 103, 105, 98, 94, 93, 94, 96, 96, 104, 106,
+ 98, 94, 93, 94, 96, 96, 104, 106, 98, 94, 93, 94, 96, 96, 104, 106, 98,
+ 94, 93, 94, 95, 95, 104, 106,
+ /* Size 32x8 */
+ 64, 63, 63, 63, 63, 63, 62, 61, 61, 61, 61, 63, 66, 67, 67, 67, 70, 73,
+ 74, 74, 74, 78, 82, 84, 84, 84, 89, 95, 98, 98, 98, 98, 62, 62, 63, 63,
+ 63, 63, 63, 63, 64, 64, 64, 66, 69, 71, 71, 71, 74, 77, 79, 79, 79, 81,
+ 84, 85, 85, 85, 89, 92, 94, 94, 94, 94, 62, 62, 63, 63, 63, 63, 64, 64,
+ 64, 64, 64, 67, 70, 72, 72, 72, 75, 79, 80, 80, 80, 82, 85, 86, 86, 86,
+ 89, 92, 93, 93, 93, 93, 66, 67, 68, 68, 68, 68, 69, 69, 70, 70, 70, 72,
+ 75, 77, 77, 77, 80, 84, 86, 86, 86, 87, 88, 89, 89, 89, 91, 93, 94, 94,
+ 94, 94, 74, 75, 76, 77, 77, 77, 78, 79, 80, 80, 80, 82, 85, 86, 86, 86,
+ 89, 93, 94, 94, 94, 95, 95, 95, 95, 95, 95, 96, 96, 96, 96, 95, 74, 75,
+ 76, 77, 77, 77, 78, 79, 80, 80, 80, 82, 85, 86, 86, 86, 89, 93, 94, 94,
+ 94, 95, 95, 95, 95, 95, 95, 96, 96, 96, 96, 95, 91, 91, 90, 90, 90, 90,
+ 90, 89, 89, 89, 89, 90, 92, 92, 92, 92, 93, 95, 95, 95, 95, 97, 98, 99,
+ 99, 99, 101, 103, 104, 104, 104, 104, 96, 96, 95, 94, 94, 94, 93, 92,
+ 92, 92, 92, 93, 94, 94, 94, 94, 95, 95, 95, 95, 95, 97, 99, 100, 100,
+ 100, 102, 105, 106, 106, 106, 106 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 64, 65, 65, 70,
+#endif
+ /* Size 4x4 */
+ 63, 64, 64, 65, 64, 65, 65, 66, 64, 65, 67, 68, 65, 66, 68, 71,
+ /* Size 8x8 */
+ 63, 63, 63, 63, 64, 64, 64, 67, 63, 64, 64, 64, 64, 64, 65, 67, 63, 64,
+ 64, 64, 65, 65, 65, 67, 63, 64, 64, 65, 65, 65, 65, 67, 64, 64, 65, 65,
+ 67, 67, 68, 70, 64, 64, 65, 65, 67, 68, 69, 71, 64, 65, 65, 65, 68, 69,
+ 71, 73, 67, 67, 67, 67, 70, 71, 73, 76,
+ /* Size 16x16 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 65, 68, 63, 63,
+ 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 66, 68, 63, 63, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 66, 68, 63, 63, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 65, 65, 65, 66, 68, 63, 63, 64, 64, 64, 64, 64, 64,
+ 65, 65, 65, 65, 65, 65, 66, 68, 63, 63, 64, 64, 64, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 66, 67, 63, 63, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 66, 67, 63, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 66, 66, 66,
+ 67, 68, 63, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 67, 67, 67, 68, 70,
+ 63, 64, 64, 64, 65, 65, 65, 65, 66, 67, 67, 67, 68, 68, 69, 71, 63, 64,
+ 64, 64, 65, 65, 65, 65, 66, 67, 67, 67, 68, 68, 69, 71, 64, 64, 65, 65,
+ 65, 65, 65, 66, 67, 67, 67, 69, 70, 70, 71, 72, 64, 64, 65, 65, 65, 65,
+ 65, 66, 67, 68, 68, 70, 71, 71, 72, 74, 64, 64, 65, 65, 65, 65, 65, 66,
+ 67, 68, 68, 70, 71, 71, 72, 74, 65, 66, 66, 66, 66, 66, 66, 67, 68, 69,
+ 69, 71, 72, 72, 73, 76, 68, 68, 68, 68, 68, 67, 67, 68, 70, 71, 71, 72,
+ 74, 74, 76, 79,
+ /* Size 32x32 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 65, 66, 68, 68, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 65, 67, 68, 68, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 65, 66, 67, 68, 68, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 66, 67,
+ 68, 68, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 66, 67, 68, 68, 63, 63,
+ 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 65, 65, 65, 65, 65, 65, 66, 67, 68, 68, 63, 63, 63, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
+ 65, 65, 65, 65, 66, 67, 68, 68, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65,
+ 66, 67, 68, 68, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 67, 68, 68,
+ 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 67, 67, 67, 63, 63, 63, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 66, 66, 67, 67, 67, 63, 63, 63, 64, 64, 64, 64, 64,
+ 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 66, 66, 67, 67, 67, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 67,
+ 67, 67, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 67, 67, 67, 63, 63,
64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 61, 61, 61, 61, 61, 61, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64,
- 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 62, 62,
- 62, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 62, 62, 62, 62, 62, 62,
- 62, 63, 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 66, 66, 66, 66, 66, 66, 63, 63, 62, 62, 62, 62, 63, 63, 63, 63,
- 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66,
- 66, 66, 66, 66, 63, 63, 63, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 65,
- 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66,
- 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65,
- 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 64, 63, 63, 63,
- 63, 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66,
- 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 64, 64, 64, 63, 63, 63, 64, 64,
- 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 64, 64, 64, 64, 63, 64, 64, 64, 64, 64, 64, 65,
+ 65, 66, 66, 66, 66, 66, 66, 66, 67, 67, 68, 68, 63, 63, 64, 64, 64, 64,
+ 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 67,
+ 67, 67, 67, 67, 68, 68, 69, 69, 63, 64, 64, 64, 64, 64, 64, 64, 65, 65,
+ 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 68,
+ 68, 69, 70, 70, 63, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
+ 65, 66, 66, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 69, 70, 71, 71,
+ 63, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 66, 66, 67,
+ 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 69, 70, 71, 71, 63, 64, 64, 64,
+ 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 66, 66, 67, 67, 67, 67, 67,
+ 67, 68, 68, 68, 68, 68, 69, 70, 71, 71, 63, 64, 64, 64, 64, 64, 64, 64,
+ 65, 65, 65, 65, 65, 65, 65, 66, 66, 67, 67, 67, 67, 67, 67, 68, 68, 68,
+ 68, 68, 69, 70, 71, 71, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65,
+ 65, 65, 66, 66, 67, 67, 67, 67, 67, 68, 68, 69, 69, 69, 69, 69, 70, 71,
+ 71, 71, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66,
+ 67, 67, 67, 67, 67, 68, 69, 69, 70, 70, 70, 70, 71, 71, 72, 72, 64, 64,
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 67, 67, 68, 68, 68,
+ 68, 69, 69, 70, 70, 70, 70, 71, 71, 72, 73, 73, 64, 64, 64, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 66, 67, 67, 68, 68, 68, 68, 69, 70, 70,
+ 71, 71, 71, 71, 72, 73, 74, 74, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 66, 67, 67, 68, 68, 68, 68, 69, 70, 70, 71, 71, 71, 71,
+ 72, 73, 74, 74, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 66, 67, 67, 68, 68, 68, 68, 69, 70, 70, 71, 71, 71, 71, 72, 73, 74, 74,
+ 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 67, 68, 68,
+ 68, 68, 68, 69, 70, 71, 71, 71, 71, 71, 72, 73, 74, 74, 65, 65, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 67, 68, 68, 69, 69, 69, 69, 70,
+ 71, 71, 72, 72, 72, 72, 73, 74, 76, 76, 66, 67, 67, 67, 67, 67, 67, 67,
+ 67, 67, 67, 67, 67, 67, 67, 68, 69, 70, 70, 70, 70, 71, 71, 72, 73, 73,
+ 73, 73, 74, 76, 77, 77, 68, 68, 68, 68, 68, 68, 68, 68, 68, 67, 67, 67,
+ 67, 67, 68, 69, 70, 71, 71, 71, 71, 71, 72, 73, 74, 74, 74, 74, 76, 77,
+ 79, 79, 68, 68, 68, 68, 68, 68, 68, 68, 68, 67, 67, 67, 67, 67, 68, 69,
+ 70, 71, 71, 71, 71, 71, 72, 73, 74, 74, 74, 74, 76, 77, 79, 79,
+ /* Size 4x8 */
+ 63, 63, 64, 64, 63, 64, 65, 65, 64, 64, 65, 65, 64, 65, 65, 66, 64, 65,
+ 67, 68, 64, 65, 68, 69, 64, 66, 69, 71, 67, 67, 71, 73,
+ /* Size 8x4 */
+ 63, 63, 64, 64, 64, 64, 64, 67, 63, 64, 64, 65, 65, 65, 66, 67, 64, 65,
+ 65, 65, 67, 68, 69, 71, 64, 65, 65, 66, 68, 69, 71, 73,
+ /* Size 8x16 */
+ 64, 63, 63, 63, 63, 64, 64, 65, 63, 63, 64, 64, 64, 65, 65, 66, 63, 64,
+ 64, 64, 64, 65, 65, 66, 63, 64, 64, 64, 64, 65, 65, 66, 63, 64, 64, 64,
+ 65, 65, 65, 66, 63, 64, 65, 65, 65, 66, 66, 66, 63, 64, 65, 65, 65, 66,
+ 66, 66, 63, 64, 65, 65, 65, 66, 66, 67, 63, 64, 65, 65, 66, 68, 68, 69,
+ 64, 65, 65, 65, 66, 68, 68, 69, 64, 65, 65, 65, 66, 68, 68, 69, 64, 65,
+ 65, 65, 67, 70, 70, 71, 64, 65, 66, 66, 68, 71, 71, 72, 64, 65, 66, 66,
+ 68, 71, 71, 72, 65, 66, 66, 66, 69, 72, 72, 73, 68, 68, 68, 68, 70, 74,
+ 74, 76,
+ /* Size 16x8 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 65, 68, 63, 63,
+ 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 66, 68, 63, 64, 64, 64,
+ 64, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 68, 63, 64, 64, 64, 64, 65,
+ 65, 65, 65, 65, 65, 65, 66, 66, 66, 68, 63, 64, 64, 64, 65, 65, 65, 65,
+ 66, 66, 66, 67, 68, 68, 69, 70, 64, 65, 65, 65, 65, 66, 66, 66, 68, 68,
+ 68, 70, 71, 71, 72, 74, 64, 65, 65, 65, 65, 66, 66, 66, 68, 68, 68, 70,
+ 71, 71, 72, 74, 65, 66, 66, 66, 66, 66, 66, 67, 69, 69, 69, 71, 72, 72,
+ 73, 76,
+ /* Size 16x32 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 65, 68, 63, 63,
+ 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 66, 68, 63, 63, 63, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 66, 68, 63, 63, 64, 64, 64, 64,
+ 64, 64, 64, 65, 65, 65, 65, 65, 66, 68, 63, 63, 64, 64, 64, 64, 64, 64,
+ 64, 65, 65, 65, 65, 65, 66, 68, 63, 63, 64, 64, 64, 64, 64, 64, 64, 65,
+ 65, 65, 65, 65, 66, 68, 63, 63, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65,
+ 65, 65, 66, 68, 63, 63, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65,
+ 66, 68, 63, 63, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 66, 68,
+ 63, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 66, 67, 63, 64,
+ 64, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 67, 63, 64, 64, 65,
+ 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 67, 63, 64, 64, 65, 65, 65,
+ 65, 65, 65, 65, 66, 66, 66, 66, 66, 67, 63, 64, 64, 65, 65, 65, 65, 65,
+ 65, 65, 66, 66, 66, 66, 66, 67, 63, 64, 64, 65, 65, 65, 65, 65, 65, 66,
+ 66, 66, 66, 66, 67, 68, 63, 64, 64, 65, 65, 65, 65, 65, 66, 66, 67, 67,
+ 67, 67, 68, 69, 63, 64, 64, 65, 65, 65, 65, 65, 66, 67, 68, 68, 68, 68,
+ 69, 70, 64, 64, 65, 65, 65, 65, 65, 66, 66, 67, 68, 68, 68, 68, 69, 71,
+ 64, 64, 65, 65, 65, 65, 65, 66, 66, 67, 68, 68, 68, 68, 69, 71, 64, 64,
+ 65, 65, 65, 65, 65, 66, 66, 67, 68, 68, 68, 68, 69, 71, 64, 64, 65, 65,
+ 65, 65, 65, 66, 66, 67, 68, 68, 68, 68, 69, 71, 64, 64, 65, 65, 65, 65,
+ 65, 66, 67, 68, 69, 69, 69, 69, 70, 71, 64, 64, 65, 65, 65, 65, 65, 66,
+ 67, 68, 70, 70, 70, 70, 71, 72, 64, 64, 65, 65, 66, 66, 66, 66, 67, 69,
+ 70, 70, 70, 70, 72, 73, 64, 64, 65, 65, 66, 66, 66, 66, 68, 69, 71, 71,
+ 71, 71, 72, 74, 64, 64, 65, 65, 66, 66, 66, 66, 68, 69, 71, 71, 71, 71,
+ 72, 74, 64, 64, 65, 65, 66, 66, 66, 66, 68, 69, 71, 71, 71, 71, 72, 74,
+ 64, 65, 65, 66, 66, 66, 66, 66, 68, 69, 71, 71, 71, 71, 72, 74, 65, 66,
+ 66, 66, 66, 66, 66, 67, 69, 70, 72, 72, 72, 72, 73, 76, 67, 67, 67, 67,
+ 67, 67, 67, 68, 69, 71, 73, 73, 73, 73, 75, 77, 68, 68, 68, 68, 68, 68,
+ 68, 68, 70, 72, 74, 74, 74, 74, 76, 79, 68, 68, 68, 68, 68, 68, 68, 68,
+ 70, 72, 74, 74, 74, 74, 76, 79,
+ /* Size 32x16 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 67, 68, 68, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 65, 66, 67, 68, 68, 63, 63, 63, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 66, 67, 68, 68, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 67,
+ 68, 68, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 67, 68, 68, 63, 63,
+ 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 66, 66, 66, 66, 66, 66, 67, 68, 68, 63, 63, 64, 64, 64, 64,
+ 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66,
+ 66, 66, 66, 66, 66, 67, 68, 68, 63, 63, 64, 64, 64, 64, 64, 64, 64, 65,
65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
- 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 64,
- 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 64, 64, 64,
- 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 64, 64, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
- 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 67, 68, 69, 67, 68, 69, 69, 68, 69, 70, 70, 69, 69, 70, 71,
- /* Size 8 */
- 64, 62, 67, 67, 67, 68, 68, 69, 62, 65, 67, 66, 66, 67, 68, 68, 67, 67,
- 68, 67, 67, 68, 68, 69, 67, 66, 67, 68, 68, 68, 69, 69, 67, 66, 67, 68,
- 69, 69, 69, 69, 68, 67, 68, 68, 69, 69, 70, 70, 68, 68, 68, 69, 69, 70,
- 70, 70, 69, 68, 69, 69, 69, 70, 70, 70,
- /* Size 16 */
- 64, 63, 62, 64, 67, 67, 67, 67, 67, 68, 68, 68, 68, 69, 69, 69, 63, 63,
- 64, 65, 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 69, 69, 62, 64, 65, 66,
- 67, 66, 66, 66, 66, 67, 67, 67, 68, 68, 68, 68, 64, 65, 66, 67, 67, 67,
- 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 67, 67, 67, 67, 68, 67, 67, 67,
- 67, 68, 68, 68, 68, 68, 69, 69, 67, 67, 66, 67, 67, 68, 68, 68, 68, 68,
- 68, 68, 68, 69, 69, 69, 67, 67, 66, 67, 67, 68, 68, 68, 68, 68, 68, 69,
- 69, 69, 69, 69, 67, 67, 66, 67, 67, 68, 68, 68, 68, 69, 69, 69, 69, 69,
- 69, 69, 67, 67, 66, 67, 67, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69,
- 68, 67, 67, 67, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 70, 70, 68, 67,
- 67, 67, 68, 68, 68, 69, 69, 69, 69, 69, 70, 70, 70, 70, 68, 68, 67, 68,
- 68, 68, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 68, 68, 68, 68, 68, 68,
- 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 69, 68, 68, 68, 68, 69, 69, 69,
- 69, 69, 70, 70, 70, 70, 70, 70, 69, 69, 68, 68, 69, 69, 69, 69, 69, 70,
- 70, 70, 70, 70, 70, 70, 69, 69, 68, 68, 69, 69, 69, 69, 69, 70, 70, 70,
- 70, 70, 70, 70,
- /* Size 32 */
- 64, 64, 63, 63, 62, 63, 64, 65, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
- 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 64, 63, 63, 63,
- 63, 64, 65, 66, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 68, 68,
- 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 63, 63, 63, 63, 64, 64, 65, 66,
- 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68,
- 68, 68, 69, 69, 69, 69, 63, 63, 63, 64, 64, 65, 66, 66, 67, 67, 67, 66,
- 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68,
- 68, 68, 62, 63, 64, 64, 65, 66, 66, 66, 67, 67, 66, 66, 66, 66, 66, 66,
- 66, 66, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 63, 64,
- 64, 65, 66, 66, 66, 67, 67, 67, 67, 67, 66, 66, 67, 67, 67, 67, 67, 67,
- 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 64, 65, 65, 66, 66, 66,
- 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 68, 68,
- 68, 68, 68, 68, 68, 68, 68, 68, 65, 66, 66, 66, 66, 67, 67, 67, 67, 67,
- 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68,
- 68, 68, 68, 68, 67, 67, 67, 67, 67, 67, 67, 67, 68, 68, 67, 67, 67, 67,
- 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69,
- 67, 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
- 68, 68, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 67, 67, 67, 67,
- 66, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
- 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 67, 67, 67, 66, 66, 67, 67, 67,
- 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 69, 69,
- 69, 69, 69, 69, 69, 69, 67, 67, 67, 66, 66, 66, 67, 67, 67, 68, 68, 68,
- 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 67, 67, 67, 66, 66, 66, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68,
- 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 67, 67,
- 67, 66, 66, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 67, 67, 67, 67, 66, 67,
- 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 69, 69, 67, 67, 67, 67, 66, 67, 67, 67, 67, 68,
- 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 69, 67, 67, 67, 67, 66, 67, 67, 67, 67, 68, 68, 68, 68, 68,
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
- 68, 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 68, 67, 67, 67,
- 67, 67, 67, 67, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 68, 68, 67, 67, 67, 67, 67, 67,
- 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70,
- 70, 70, 70, 70, 70, 70, 68, 68, 68, 67, 67, 67, 67, 68, 68, 68, 68, 68,
- 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 70,
- 70, 70, 68, 68, 68, 67, 67, 67, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 68, 68,
- 68, 68, 67, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69,
- 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 68, 68, 68, 68, 68, 68,
- 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 70,
- 70, 70, 70, 70, 70, 70, 70, 70, 69, 68, 68, 68, 68, 68, 68, 68, 68, 68,
- 68, 69, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 70, 70,
- 70, 70, 70, 70, 69, 68, 68, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
- 69, 69, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69,
- 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 69, 69, 69, 68,
- 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 70,
- 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 69, 69, 69, 68, 68, 68, 68, 68,
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 70,
- 70, 70, 70, 70, 70, 70, 69, 69, 69, 68, 68, 68, 68, 68, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
- 70, 70, 69, 69, 69, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70 },
- { /* Intra matrices */
- /* Size 4 */
- 59, 63, 63, 64, 63, 64, 64, 65, 63, 64, 65, 66, 64, 65, 66, 66,
- /* Size 8 */
- 60, 58, 63, 63, 63, 64, 65, 65, 58, 61, 63, 62, 62, 63, 64, 64, 63, 63,
- 64, 64, 64, 64, 64, 65, 63, 62, 64, 64, 64, 65, 65, 65, 63, 62, 64, 64,
- 65, 65, 65, 66, 64, 63, 64, 65, 65, 65, 66, 66, 65, 64, 64, 65, 65, 66,
- 66, 66, 65, 64, 65, 65, 66, 66, 66, 66,
- /* Size 16 */
- 60, 59, 58, 60, 63, 63, 63, 63, 63, 64, 64, 64, 64, 65, 65, 65, 59, 59,
- 60, 61, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 58, 60, 61, 62,
- 63, 62, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 60, 61, 62, 62, 63, 63,
- 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 63, 63, 63, 63, 64, 63, 63, 63,
- 63, 63, 64, 64, 64, 64, 64, 64, 63, 63, 62, 63, 63, 64, 64, 64, 64, 64,
- 64, 64, 64, 65, 65, 65, 63, 63, 62, 63, 63, 64, 64, 64, 64, 64, 64, 65,
- 65, 65, 65, 65, 63, 63, 62, 63, 63, 64, 64, 64, 64, 65, 65, 65, 65, 65,
- 65, 65, 63, 63, 62, 63, 63, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65,
- 64, 63, 63, 63, 63, 64, 64, 65, 65, 65, 65, 65, 65, 65, 66, 66, 64, 63,
- 63, 63, 64, 64, 64, 65, 65, 65, 65, 65, 66, 66, 66, 66, 64, 64, 63, 63,
- 64, 64, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 64, 64, 63, 64, 64, 64,
- 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 65, 64, 64, 64, 64, 65, 65, 65,
- 65, 65, 66, 66, 66, 66, 66, 66, 65, 64, 64, 64, 64, 65, 65, 65, 65, 66,
- 66, 66, 66, 66, 66, 66, 65, 64, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66,
- 66, 66, 66, 66,
- /* Size 32 */
- 60, 59, 59, 59, 58, 59, 60, 61, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
- 63, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 59, 59, 59, 59,
- 59, 60, 61, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64,
- 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 59, 59, 59, 59, 60, 60, 61, 62,
- 63, 63, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 59, 59, 59, 60, 60, 61, 61, 62, 63, 62, 62, 62,
- 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64,
- 64, 64, 58, 59, 60, 60, 61, 61, 62, 62, 63, 62, 62, 62, 62, 62, 62, 62,
- 62, 62, 62, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 59, 60,
- 60, 61, 61, 62, 62, 62, 63, 63, 63, 62, 62, 62, 62, 62, 62, 63, 63, 63,
- 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 60, 61, 61, 61, 62, 62,
- 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 61, 62, 62, 62, 62, 62, 63, 63, 63, 63,
- 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64,
+ 67, 68, 68, 68, 63, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
+ 65, 66, 66, 66, 66, 66, 66, 67, 67, 67, 68, 68, 68, 68, 69, 69, 70, 70,
+ 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 67, 67,
+ 67, 67, 67, 68, 68, 69, 69, 69, 69, 69, 70, 71, 72, 72, 64, 64, 65, 65,
+ 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 67, 68, 68, 68, 68, 68, 69,
+ 70, 70, 71, 71, 71, 71, 72, 73, 74, 74, 64, 64, 65, 65, 65, 65, 65, 65,
+ 65, 65, 66, 66, 66, 66, 66, 67, 68, 68, 68, 68, 68, 69, 70, 70, 71, 71,
+ 71, 71, 72, 73, 74, 74, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66,
+ 66, 66, 66, 67, 68, 68, 68, 68, 68, 69, 70, 70, 71, 71, 71, 71, 72, 73,
+ 74, 74, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 67,
+ 68, 68, 68, 68, 68, 69, 70, 70, 71, 71, 71, 71, 72, 73, 74, 74, 65, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 67, 68, 69, 69, 69, 69,
+ 69, 70, 71, 72, 72, 72, 72, 72, 73, 75, 76, 76, 68, 68, 68, 68, 68, 68,
+ 68, 68, 68, 67, 67, 67, 67, 67, 68, 69, 70, 71, 71, 71, 71, 71, 72, 73,
+ 74, 74, 74, 74, 76, 77, 79, 79,
+ /* Size 4x16 */
+ 63, 63, 64, 64, 63, 64, 64, 65, 63, 64, 65, 65, 63, 64, 65, 65, 63, 64,
+ 65, 65, 64, 65, 65, 66, 64, 65, 65, 66, 64, 65, 66, 66, 64, 65, 67, 68,
+ 64, 65, 67, 68, 64, 65, 67, 68, 64, 65, 68, 70, 64, 66, 69, 71, 64, 66,
+ 69, 71, 66, 66, 70, 72, 68, 68, 72, 74,
+ /* Size 16x4 */
+ 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 66, 68, 63, 64,
+ 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 68, 64, 64, 65, 65,
+ 65, 65, 65, 66, 67, 67, 67, 68, 69, 69, 70, 72, 64, 65, 65, 65, 65, 66,
+ 66, 66, 68, 68, 68, 70, 71, 71, 72, 74,
+ /* Size 8x32 */
+ 64, 63, 63, 63, 63, 64, 64, 65, 63, 63, 63, 63, 64, 64, 64, 66, 63, 63,
+ 64, 64, 64, 65, 65, 66, 63, 64, 64, 64, 64, 65, 65, 66, 63, 64, 64, 64,
+ 64, 65, 65, 66, 63, 64, 64, 64, 64, 65, 65, 66, 63, 64, 64, 64, 64, 65,
+ 65, 66, 63, 64, 64, 64, 64, 65, 65, 66, 63, 64, 64, 64, 65, 65, 65, 66,
+ 63, 64, 64, 64, 65, 65, 65, 66, 63, 64, 65, 65, 65, 66, 66, 66, 63, 64,
+ 65, 65, 65, 66, 66, 66, 63, 64, 65, 65, 65, 66, 66, 66, 63, 64, 65, 65,
+ 65, 66, 66, 66, 63, 64, 65, 65, 65, 66, 66, 67, 63, 64, 65, 65, 66, 67,
+ 67, 68, 63, 64, 65, 65, 66, 68, 68, 69, 64, 65, 65, 65, 66, 68, 68, 69,
+ 64, 65, 65, 65, 66, 68, 68, 69, 64, 65, 65, 65, 66, 68, 68, 69, 64, 65,
+ 65, 65, 66, 68, 68, 69, 64, 65, 65, 65, 67, 69, 69, 70, 64, 65, 65, 65,
+ 67, 70, 70, 71, 64, 65, 66, 66, 67, 70, 70, 72, 64, 65, 66, 66, 68, 71,
+ 71, 72, 64, 65, 66, 66, 68, 71, 71, 72, 64, 65, 66, 66, 68, 71, 71, 72,
+ 64, 65, 66, 66, 68, 71, 71, 72, 65, 66, 66, 66, 69, 72, 72, 73, 67, 67,
+ 67, 67, 69, 73, 73, 75, 68, 68, 68, 68, 70, 74, 74, 76, 68, 68, 68, 68,
+ 70, 74, 74, 76,
+ /* Size 32x8 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 67, 68, 68, 63, 63, 63, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 66, 67, 68, 68, 63, 63, 64, 64, 64, 64, 64, 64,
+ 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66,
+ 66, 66, 66, 67, 68, 68, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 67,
+ 68, 68, 63, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 66,
+ 66, 66, 66, 66, 66, 67, 67, 67, 68, 68, 68, 68, 69, 69, 70, 70, 64, 64,
+ 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 67, 68, 68, 68, 68,
+ 68, 69, 70, 70, 71, 71, 71, 71, 72, 73, 74, 74, 64, 64, 65, 65, 65, 65,
+ 65, 65, 65, 65, 66, 66, 66, 66, 66, 67, 68, 68, 68, 68, 68, 69, 70, 70,
+ 71, 71, 71, 71, 72, 73, 74, 74, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 67, 68, 69, 69, 69, 69, 69, 70, 71, 72, 72, 72, 72, 72,
+ 73, 75, 76, 76 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 63, 76, 76, 93,
+#endif
+ /* Size 4x4 */
+ 63, 62, 69, 77, 62, 64, 71, 80, 69, 71, 78, 87, 77, 80, 87, 95,
+ /* Size 8x8 */
+ 63, 62, 62, 61, 68, 70, 74, 81, 62, 63, 63, 62, 69, 71, 77, 82, 62, 63,
+ 63, 63, 70, 73, 79, 83, 61, 62, 63, 64, 71, 73, 80, 84, 68, 69, 70, 71,
+ 78, 80, 87, 89, 70, 71, 73, 73, 80, 83, 89, 91, 74, 77, 79, 80, 87, 89,
+ 95, 95, 81, 82, 83, 84, 89, 91, 95, 96,
+ /* Size 16x16 */
+ 64, 63, 62, 62, 62, 61, 61, 62, 66, 67, 67, 71, 73, 73, 77, 83, 63, 63,
+ 63, 63, 62, 62, 62, 63, 67, 68, 68, 72, 75, 75, 79, 84, 62, 63, 63, 63,
+ 63, 62, 62, 64, 68, 69, 69, 74, 77, 77, 80, 85, 62, 63, 63, 63, 63, 62,
+ 62, 64, 68, 69, 69, 74, 77, 77, 80, 85, 62, 62, 63, 63, 63, 63, 63, 64,
+ 68, 70, 70, 75, 78, 78, 81, 85, 61, 62, 62, 62, 63, 64, 64, 65, 69, 71,
+ 71, 76, 80, 80, 82, 85, 61, 62, 62, 62, 63, 64, 64, 65, 69, 71, 71, 76,
+ 80, 80, 82, 85, 62, 63, 64, 64, 64, 65, 65, 66, 71, 72, 72, 77, 81, 81,
+ 83, 86, 66, 67, 68, 68, 68, 69, 69, 71, 75, 77, 77, 82, 85, 85, 87, 89,
+ 67, 68, 69, 69, 70, 71, 71, 72, 77, 78, 78, 83, 87, 87, 88, 90, 67, 68,
+ 69, 69, 70, 71, 71, 72, 77, 78, 78, 83, 87, 87, 88, 90, 71, 72, 74, 74,
+ 75, 76, 76, 77, 82, 83, 83, 88, 92, 92, 92, 93, 73, 75, 77, 77, 78, 80,
+ 80, 81, 85, 87, 87, 92, 95, 95, 95, 95, 73, 75, 77, 77, 78, 80, 80, 81,
+ 85, 87, 87, 92, 95, 95, 95, 95, 77, 79, 80, 80, 81, 82, 82, 83, 87, 88,
+ 88, 92, 95, 95, 95, 96, 83, 84, 85, 85, 85, 85, 85, 86, 89, 90, 90, 93,
+ 95, 95, 96, 97,
+ /* Size 32x32 */
+ 64, 63, 63, 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 62, 64, 66, 67,
+ 67, 67, 67, 69, 71, 73, 73, 73, 73, 74, 77, 80, 83, 83, 63, 63, 63, 63,
+ 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 62, 64, 66, 68, 68, 68, 68, 70,
+ 72, 74, 74, 74, 74, 75, 78, 81, 84, 84, 63, 63, 63, 63, 63, 63, 63, 63,
+ 62, 62, 62, 62, 62, 62, 63, 65, 67, 68, 68, 68, 68, 70, 72, 75, 75, 75,
+ 75, 76, 79, 81, 84, 84, 62, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62,
+ 62, 62, 64, 65, 68, 69, 69, 69, 69, 71, 73, 76, 77, 77, 77, 77, 80, 82,
+ 84, 84, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 64, 66,
+ 68, 69, 69, 69, 69, 71, 74, 76, 77, 77, 77, 78, 80, 82, 85, 85, 62, 62,
+ 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 64, 66, 68, 69, 69, 69,
+ 69, 71, 74, 76, 77, 77, 77, 78, 80, 82, 85, 85, 62, 62, 63, 63, 63, 63,
+ 63, 63, 63, 63, 62, 62, 62, 62, 64, 66, 68, 69, 69, 69, 69, 71, 74, 76,
+ 77, 77, 77, 78, 80, 82, 85, 85, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 64, 66, 68, 69, 69, 69, 69, 72, 74, 76, 77, 77, 77, 78,
+ 80, 82, 85, 85, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 64, 66, 68, 70, 70, 70, 70, 72, 75, 77, 78, 78, 78, 79, 81, 83, 85, 85,
+ 61, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 65, 67, 69, 70,
+ 70, 70, 70, 73, 75, 78, 79, 79, 79, 80, 81, 83, 85, 85, 61, 61, 62, 62,
+ 62, 62, 62, 63, 63, 63, 64, 64, 64, 64, 65, 67, 69, 71, 71, 71, 71, 73,
+ 76, 79, 80, 80, 80, 80, 82, 84, 85, 85, 61, 61, 62, 62, 62, 62, 62, 63,
+ 63, 63, 64, 64, 64, 64, 65, 67, 69, 71, 71, 71, 71, 73, 76, 79, 80, 80,
+ 80, 80, 82, 84, 85, 85, 61, 61, 62, 62, 62, 62, 62, 63, 63, 63, 64, 64,
+ 64, 64, 65, 67, 69, 71, 71, 71, 71, 73, 76, 79, 80, 80, 80, 80, 82, 84,
+ 85, 85, 61, 61, 62, 62, 62, 62, 62, 63, 63, 63, 64, 64, 64, 64, 65, 67,
+ 69, 71, 71, 71, 71, 73, 76, 79, 80, 80, 80, 80, 82, 84, 85, 85, 62, 62,
+ 63, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 66, 68, 71, 72, 72, 72,
+ 72, 75, 77, 80, 81, 81, 81, 82, 83, 85, 86, 86, 64, 64, 65, 65, 66, 66,
+ 66, 66, 66, 67, 67, 67, 67, 67, 68, 71, 73, 74, 74, 74, 74, 77, 79, 82,
+ 83, 83, 83, 84, 85, 86, 87, 87, 66, 66, 67, 68, 68, 68, 68, 68, 68, 69,
+ 69, 69, 69, 69, 71, 73, 75, 77, 77, 77, 77, 79, 82, 84, 85, 85, 85, 86,
+ 87, 88, 89, 89, 67, 68, 68, 69, 69, 69, 69, 69, 70, 70, 71, 71, 71, 71,
+ 72, 74, 77, 78, 78, 78, 78, 80, 83, 86, 87, 87, 87, 87, 88, 89, 90, 90,
+ 67, 68, 68, 69, 69, 69, 69, 69, 70, 70, 71, 71, 71, 71, 72, 74, 77, 78,
+ 78, 78, 78, 80, 83, 86, 87, 87, 87, 87, 88, 89, 90, 90, 67, 68, 68, 69,
+ 69, 69, 69, 69, 70, 70, 71, 71, 71, 71, 72, 74, 77, 78, 78, 78, 78, 80,
+ 83, 86, 87, 87, 87, 87, 88, 89, 90, 90, 67, 68, 68, 69, 69, 69, 69, 69,
+ 70, 70, 71, 71, 71, 71, 72, 74, 77, 78, 78, 78, 78, 80, 83, 86, 87, 87,
+ 87, 87, 88, 89, 90, 90, 69, 70, 70, 71, 71, 71, 71, 72, 72, 73, 73, 73,
+ 73, 73, 75, 77, 79, 80, 80, 80, 80, 83, 85, 88, 89, 89, 89, 89, 90, 91,
+ 91, 91, 71, 72, 72, 73, 74, 74, 74, 74, 75, 75, 76, 76, 76, 76, 77, 79,
+ 82, 83, 83, 83, 83, 85, 88, 91, 92, 92, 92, 92, 92, 92, 93, 93, 73, 74,
+ 75, 76, 76, 76, 76, 76, 77, 78, 79, 79, 79, 79, 80, 82, 84, 86, 86, 86,
+ 86, 88, 91, 93, 94, 94, 94, 94, 94, 94, 94, 94, 73, 74, 75, 77, 77, 77,
+ 77, 77, 78, 79, 80, 80, 80, 80, 81, 83, 85, 87, 87, 87, 87, 89, 92, 94,
+ 95, 95, 95, 95, 95, 95, 95, 95, 73, 74, 75, 77, 77, 77, 77, 77, 78, 79,
+ 80, 80, 80, 80, 81, 83, 85, 87, 87, 87, 87, 89, 92, 94, 95, 95, 95, 95,
+ 95, 95, 95, 95, 73, 74, 75, 77, 77, 77, 77, 77, 78, 79, 80, 80, 80, 80,
+ 81, 83, 85, 87, 87, 87, 87, 89, 92, 94, 95, 95, 95, 95, 95, 95, 95, 95,
+ 74, 75, 76, 77, 78, 78, 78, 78, 79, 80, 80, 80, 80, 80, 82, 84, 86, 87,
+ 87, 87, 87, 89, 92, 94, 95, 95, 95, 95, 95, 95, 95, 95, 77, 78, 79, 80,
+ 80, 80, 80, 80, 81, 81, 82, 82, 82, 82, 83, 85, 87, 88, 88, 88, 88, 90,
+ 92, 94, 95, 95, 95, 95, 95, 96, 96, 96, 80, 81, 81, 82, 82, 82, 82, 82,
+ 83, 83, 84, 84, 84, 84, 85, 86, 88, 89, 89, 89, 89, 91, 92, 94, 95, 95,
+ 95, 95, 96, 96, 96, 96, 83, 84, 84, 84, 85, 85, 85, 85, 85, 85, 85, 85,
+ 85, 85, 86, 87, 89, 90, 90, 90, 90, 91, 93, 94, 95, 95, 95, 95, 96, 96,
+ 97, 97, 83, 84, 84, 84, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 86, 87,
+ 89, 90, 90, 90, 90, 91, 93, 94, 95, 95, 95, 95, 96, 96, 97, 97,
+ /* Size 4x8 */
+ 63, 62, 70, 75, 63, 63, 72, 77, 62, 64, 74, 79, 62, 64, 74, 80, 69, 72,
+ 81, 86, 71, 74, 84, 89, 76, 80, 90, 94, 82, 84, 91, 95,
+ /* Size 8x4 */
+ 63, 63, 62, 62, 69, 71, 76, 82, 62, 63, 64, 64, 72, 74, 80, 84, 70, 72,
+ 74, 74, 81, 84, 90, 91, 75, 77, 79, 80, 86, 89, 94, 95,
+ /* Size 8x16 */
+ 64, 62, 62, 62, 66, 74, 74, 77, 63, 63, 63, 63, 67, 76, 76, 79, 63, 63,
+ 63, 63, 68, 77, 77, 80, 63, 63, 63, 63, 68, 77, 77, 80, 62, 63, 64, 64,
+ 69, 78, 78, 81, 61, 63, 64, 64, 70, 80, 80, 82, 61, 63, 64, 64, 70, 80,
+ 80, 82, 62, 64, 66, 66, 71, 81, 81, 83, 66, 68, 70, 70, 75, 85, 85, 86,
+ 67, 70, 72, 72, 77, 86, 86, 88, 67, 70, 72, 72, 77, 86, 86, 88, 71, 74,
+ 77, 77, 82, 91, 91, 92, 74, 78, 80, 80, 86, 94, 94, 95, 74, 78, 80, 80,
+ 86, 94, 94, 95, 78, 80, 82, 82, 87, 95, 95, 95, 84, 85, 86, 86, 89, 95,
+ 95, 96,
+ /* Size 16x8 */
+ 64, 63, 63, 63, 62, 61, 61, 62, 66, 67, 67, 71, 74, 74, 78, 84, 62, 63,
+ 63, 63, 63, 63, 63, 64, 68, 70, 70, 74, 78, 78, 80, 85, 62, 63, 63, 63,
+ 64, 64, 64, 66, 70, 72, 72, 77, 80, 80, 82, 86, 62, 63, 63, 63, 64, 64,
+ 64, 66, 70, 72, 72, 77, 80, 80, 82, 86, 66, 67, 68, 68, 69, 70, 70, 71,
+ 75, 77, 77, 82, 86, 86, 87, 89, 74, 76, 77, 77, 78, 80, 80, 81, 85, 86,
+ 86, 91, 94, 94, 95, 95, 74, 76, 77, 77, 78, 80, 80, 81, 85, 86, 86, 91,
+ 94, 94, 95, 95, 77, 79, 80, 80, 81, 82, 82, 83, 86, 88, 88, 92, 95, 95,
+ 95, 96,
+ /* Size 16x32 */
+ 64, 63, 62, 62, 62, 62, 62, 63, 66, 70, 74, 74, 74, 74, 77, 84, 63, 63,
+ 63, 62, 62, 62, 62, 63, 67, 70, 75, 75, 75, 75, 78, 84, 63, 63, 63, 63,
+ 63, 63, 63, 64, 67, 71, 76, 76, 76, 76, 79, 84, 63, 63, 63, 63, 63, 63,
+ 63, 64, 68, 72, 77, 77, 77, 77, 80, 85, 63, 63, 63, 63, 63, 63, 63, 64,
+ 68, 72, 77, 77, 77, 77, 80, 85, 63, 63, 63, 63, 63, 63, 63, 64, 68, 72,
+ 77, 77, 77, 77, 80, 85, 63, 63, 63, 63, 63, 63, 63, 64, 68, 72, 77, 77,
+ 77, 77, 80, 85, 62, 63, 63, 63, 63, 63, 63, 64, 68, 72, 77, 77, 77, 77,
+ 80, 85, 62, 62, 63, 63, 64, 64, 64, 65, 69, 73, 78, 78, 78, 78, 81, 85,
+ 61, 62, 63, 64, 64, 64, 64, 65, 69, 74, 79, 79, 79, 79, 81, 85, 61, 62,
+ 63, 64, 64, 64, 64, 66, 70, 74, 80, 80, 80, 80, 82, 85, 61, 62, 63, 64,
+ 64, 64, 64, 66, 70, 74, 80, 80, 80, 80, 82, 85, 61, 62, 63, 64, 64, 64,
+ 64, 66, 70, 74, 80, 80, 80, 80, 82, 85, 61, 62, 63, 64, 64, 64, 64, 66,
+ 70, 74, 80, 80, 80, 80, 82, 85, 62, 63, 64, 65, 66, 66, 66, 67, 71, 76,
+ 81, 81, 81, 81, 83, 86, 64, 65, 66, 67, 68, 68, 68, 69, 73, 78, 83, 83,
+ 83, 83, 85, 88, 66, 67, 68, 70, 70, 70, 70, 71, 75, 80, 85, 85, 85, 85,
+ 86, 89, 67, 69, 70, 71, 72, 72, 72, 73, 77, 81, 86, 86, 86, 86, 88, 90,
+ 67, 69, 70, 71, 72, 72, 72, 73, 77, 81, 86, 86, 86, 86, 88, 90, 67, 69,
+ 70, 71, 72, 72, 72, 73, 77, 81, 86, 86, 86, 86, 88, 90, 67, 69, 70, 71,
+ 72, 72, 72, 73, 77, 81, 86, 86, 86, 86, 88, 90, 69, 71, 72, 74, 74, 74,
+ 74, 75, 79, 84, 89, 89, 89, 89, 90, 91, 71, 73, 74, 76, 77, 77, 77, 78,
+ 82, 86, 91, 91, 91, 91, 92, 93, 73, 75, 77, 79, 79, 79, 79, 81, 85, 89,
+ 94, 94, 94, 94, 94, 94, 74, 76, 78, 80, 80, 80, 80, 82, 86, 90, 94, 94,
+ 94, 94, 95, 95, 74, 76, 78, 80, 80, 80, 80, 82, 86, 90, 94, 94, 94, 94,
+ 95, 95, 74, 76, 78, 80, 80, 80, 80, 82, 86, 90, 94, 94, 94, 94, 95, 95,
+ 75, 77, 78, 80, 81, 81, 81, 82, 86, 90, 94, 94, 94, 94, 95, 95, 78, 79,
+ 80, 82, 82, 82, 82, 84, 87, 91, 95, 95, 95, 95, 95, 96, 81, 82, 83, 84,
+ 84, 84, 84, 85, 88, 91, 95, 95, 95, 95, 95, 97, 84, 84, 85, 86, 86, 86,
+ 86, 87, 89, 92, 95, 95, 95, 95, 96, 97, 84, 84, 85, 86, 86, 86, 86, 87,
+ 89, 92, 95, 95, 95, 95, 96, 97,
+ /* Size 32x16 */
+ 64, 63, 63, 63, 63, 63, 63, 62, 62, 61, 61, 61, 61, 61, 62, 64, 66, 67,
+ 67, 67, 67, 69, 71, 73, 74, 74, 74, 75, 78, 81, 84, 84, 63, 63, 63, 63,
+ 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 63, 65, 67, 69, 69, 69, 69, 71,
+ 73, 75, 76, 76, 76, 77, 79, 82, 84, 84, 62, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 64, 66, 68, 70, 70, 70, 70, 72, 74, 77, 78, 78,
+ 78, 78, 80, 83, 85, 85, 62, 62, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64,
+ 64, 64, 65, 67, 70, 71, 71, 71, 71, 74, 76, 79, 80, 80, 80, 80, 82, 84,
+ 86, 86, 62, 62, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 66, 68,
+ 70, 72, 72, 72, 72, 74, 77, 79, 80, 80, 80, 81, 82, 84, 86, 86, 62, 62,
+ 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 66, 68, 70, 72, 72, 72,
+ 72, 74, 77, 79, 80, 80, 80, 81, 82, 84, 86, 86, 62, 62, 63, 63, 63, 63,
+ 63, 63, 64, 64, 64, 64, 64, 64, 66, 68, 70, 72, 72, 72, 72, 74, 77, 79,
+ 80, 80, 80, 81, 82, 84, 86, 86, 63, 63, 64, 64, 64, 64, 64, 64, 65, 65,
+ 66, 66, 66, 66, 67, 69, 71, 73, 73, 73, 73, 75, 78, 81, 82, 82, 82, 82,
+ 84, 85, 87, 87, 66, 67, 67, 68, 68, 68, 68, 68, 69, 69, 70, 70, 70, 70,
+ 71, 73, 75, 77, 77, 77, 77, 79, 82, 85, 86, 86, 86, 86, 87, 88, 89, 89,
+ 70, 70, 71, 72, 72, 72, 72, 72, 73, 74, 74, 74, 74, 74, 76, 78, 80, 81,
+ 81, 81, 81, 84, 86, 89, 90, 90, 90, 90, 91, 91, 92, 92, 74, 75, 76, 77,
+ 77, 77, 77, 77, 78, 79, 80, 80, 80, 80, 81, 83, 85, 86, 86, 86, 86, 89,
+ 91, 94, 94, 94, 94, 94, 95, 95, 95, 95, 74, 75, 76, 77, 77, 77, 77, 77,
+ 78, 79, 80, 80, 80, 80, 81, 83, 85, 86, 86, 86, 86, 89, 91, 94, 94, 94,
+ 94, 94, 95, 95, 95, 95, 74, 75, 76, 77, 77, 77, 77, 77, 78, 79, 80, 80,
+ 80, 80, 81, 83, 85, 86, 86, 86, 86, 89, 91, 94, 94, 94, 94, 94, 95, 95,
+ 95, 95, 74, 75, 76, 77, 77, 77, 77, 77, 78, 79, 80, 80, 80, 80, 81, 83,
+ 85, 86, 86, 86, 86, 89, 91, 94, 94, 94, 94, 94, 95, 95, 95, 95, 77, 78,
+ 79, 80, 80, 80, 80, 80, 81, 81, 82, 82, 82, 82, 83, 85, 86, 88, 88, 88,
+ 88, 90, 92, 94, 95, 95, 95, 95, 95, 95, 96, 96, 84, 84, 84, 85, 85, 85,
+ 85, 85, 85, 85, 85, 85, 85, 85, 86, 88, 89, 90, 90, 90, 90, 91, 93, 94,
+ 95, 95, 95, 95, 96, 97, 97, 97,
+ /* Size 4x16 */
+ 63, 62, 70, 74, 63, 63, 71, 76, 63, 63, 72, 77, 63, 63, 72, 77, 62, 64,
+ 73, 78, 62, 64, 74, 80, 62, 64, 74, 80, 63, 66, 76, 81, 67, 70, 80, 85,
+ 69, 72, 81, 86, 69, 72, 81, 86, 73, 77, 86, 91, 76, 80, 90, 94, 76, 80,
+ 90, 94, 79, 82, 91, 95, 84, 86, 92, 95,
+ /* Size 16x4 */
+ 63, 63, 63, 63, 62, 62, 62, 63, 67, 69, 69, 73, 76, 76, 79, 84, 62, 63,
+ 63, 63, 64, 64, 64, 66, 70, 72, 72, 77, 80, 80, 82, 86, 70, 71, 72, 72,
+ 73, 74, 74, 76, 80, 81, 81, 86, 90, 90, 91, 92, 74, 76, 77, 77, 78, 80,
+ 80, 81, 85, 86, 86, 91, 94, 94, 95, 95,
+ /* Size 8x32 */
+ 64, 62, 62, 62, 66, 74, 74, 77, 63, 63, 62, 62, 67, 75, 75, 78, 63, 63,
+ 63, 63, 67, 76, 76, 79, 63, 63, 63, 63, 68, 77, 77, 80, 63, 63, 63, 63,
+ 68, 77, 77, 80, 63, 63, 63, 63, 68, 77, 77, 80, 63, 63, 63, 63, 68, 77,
+ 77, 80, 62, 63, 63, 63, 68, 77, 77, 80, 62, 63, 64, 64, 69, 78, 78, 81,
+ 61, 63, 64, 64, 69, 79, 79, 81, 61, 63, 64, 64, 70, 80, 80, 82, 61, 63,
+ 64, 64, 70, 80, 80, 82, 61, 63, 64, 64, 70, 80, 80, 82, 61, 63, 64, 64,
+ 70, 80, 80, 82, 62, 64, 66, 66, 71, 81, 81, 83, 64, 66, 68, 68, 73, 83,
+ 83, 85, 66, 68, 70, 70, 75, 85, 85, 86, 67, 70, 72, 72, 77, 86, 86, 88,
+ 67, 70, 72, 72, 77, 86, 86, 88, 67, 70, 72, 72, 77, 86, 86, 88, 67, 70,
+ 72, 72, 77, 86, 86, 88, 69, 72, 74, 74, 79, 89, 89, 90, 71, 74, 77, 77,
+ 82, 91, 91, 92, 73, 77, 79, 79, 85, 94, 94, 94, 74, 78, 80, 80, 86, 94,
+ 94, 95, 74, 78, 80, 80, 86, 94, 94, 95, 74, 78, 80, 80, 86, 94, 94, 95,
+ 75, 78, 81, 81, 86, 94, 94, 95, 78, 80, 82, 82, 87, 95, 95, 95, 81, 83,
+ 84, 84, 88, 95, 95, 95, 84, 85, 86, 86, 89, 95, 95, 96, 84, 85, 86, 86,
+ 89, 95, 95, 96,
+ /* Size 32x8 */
+ 64, 63, 63, 63, 63, 63, 63, 62, 62, 61, 61, 61, 61, 61, 62, 64, 66, 67,
+ 67, 67, 67, 69, 71, 73, 74, 74, 74, 75, 78, 81, 84, 84, 62, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 66, 68, 70, 70, 70, 70, 72,
+ 74, 77, 78, 78, 78, 78, 80, 83, 85, 85, 62, 62, 63, 63, 63, 63, 63, 63,
+ 64, 64, 64, 64, 64, 64, 66, 68, 70, 72, 72, 72, 72, 74, 77, 79, 80, 80,
+ 80, 81, 82, 84, 86, 86, 62, 62, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64,
+ 64, 64, 66, 68, 70, 72, 72, 72, 72, 74, 77, 79, 80, 80, 80, 81, 82, 84,
+ 86, 86, 66, 67, 67, 68, 68, 68, 68, 68, 69, 69, 70, 70, 70, 70, 71, 73,
+ 75, 77, 77, 77, 77, 79, 82, 85, 86, 86, 86, 86, 87, 88, 89, 89, 74, 75,
+ 76, 77, 77, 77, 77, 77, 78, 79, 80, 80, 80, 80, 81, 83, 85, 86, 86, 86,
+ 86, 89, 91, 94, 94, 94, 94, 94, 95, 95, 95, 95, 74, 75, 76, 77, 77, 77,
+ 77, 77, 78, 79, 80, 80, 80, 80, 81, 83, 85, 86, 86, 86, 86, 89, 91, 94,
+ 94, 94, 94, 94, 95, 95, 95, 95, 77, 78, 79, 80, 80, 80, 80, 80, 81, 81,
+ 82, 82, 82, 82, 83, 85, 86, 88, 88, 88, 88, 90, 92, 94, 95, 95, 95, 95,
+ 95, 95, 96, 96 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 64, 64, 64, 66,
+#endif
+ /* Size 4x4 */
+ 63, 63, 63, 64, 63, 64, 64, 65, 63, 64, 65, 65, 64, 65, 65, 67,
+ /* Size 8x8 */
+ 63, 63, 63, 63, 63, 63, 64, 64, 63, 64, 64, 64, 64, 64, 64, 64, 63, 64,
+ 64, 64, 64, 64, 64, 64, 63, 64, 64, 64, 64, 64, 65, 65, 63, 64, 64, 64,
+ 65, 65, 65, 65, 63, 64, 64, 64, 65, 65, 65, 65, 64, 64, 64, 65, 65, 65,
+ 67, 67, 64, 64, 64, 65, 65, 65, 67, 67,
+ /* Size 16x16 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 63, 63, 63, 63,
+ 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 65, 65, 65, 65, 63, 63, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
+ 65, 65, 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 63, 63,
+ 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 63, 63, 64, 64,
+ 64, 64, 64, 65, 65, 65, 65, 65, 66, 66, 66, 66, 63, 64, 64, 64, 64, 64,
+ 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 63, 64, 64, 64, 64, 64, 65, 65,
+ 65, 65, 65, 66, 66, 67, 67, 67, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65,
+ 65, 66, 66, 67, 67, 67, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 66,
+ 66, 67, 67, 67,
+ /* Size 32x32 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63,
+ 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63,
+ 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65,
+ 65, 65, 65, 65, 65, 65, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
+ 65, 65, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 63, 63,
+ 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 63, 63, 63, 63, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 63, 63, 63, 63,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 63, 63, 63, 63, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 66, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 63, 63,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 63, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 67, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 67, 67, 67,
+ 67, 67, 67, 67, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67,
+ 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 63, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 63, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 67,
+ 67, 67, 67, 67, 67, 67, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 67, 67, 67, 67, 67,
+ 67, 67, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 67,
+ /* Size 4x8 */
+ 63, 63, 63, 64, 63, 64, 64, 65, 63, 64, 64, 65, 63, 64, 64, 65, 63, 65,
+ 65, 65, 63, 65, 65, 66, 64, 65, 65, 67, 64, 65, 65, 67,
+ /* Size 8x4 */
+ 63, 63, 63, 63, 63, 63, 64, 64, 63, 64, 64, 64, 65, 65, 65, 65, 63, 64,
+ 64, 64, 65, 65, 65, 65, 64, 65, 65, 65, 65, 66, 67, 67,
+ /* Size 8x16 */
+ 64, 63, 63, 63, 63, 63, 63, 64, 63, 63, 63, 63, 63, 63, 64, 64, 63, 63,
+ 64, 64, 64, 64, 64, 65, 63, 64, 64, 64, 64, 64, 64, 65, 63, 64, 64, 64,
+ 64, 64, 64, 65, 63, 64, 64, 64, 64, 64, 64, 65, 63, 64, 64, 64, 64, 64,
+ 65, 65, 63, 64, 64, 65, 65, 65, 65, 65, 63, 64, 64, 65, 65, 65, 65, 65,
+ 63, 64, 64, 65, 65, 65, 65, 65, 63, 64, 64, 65, 65, 65, 65, 65, 63, 64,
+ 65, 65, 65, 65, 66, 66, 63, 64, 65, 65, 65, 65, 66, 67, 64, 64, 65, 65,
+ 65, 65, 66, 68, 64, 64, 65, 65, 65, 65, 66, 68, 64, 64, 65, 65, 65, 65,
+ 66, 68,
+ /* Size 16x8 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 63, 63,
+ 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 63, 63, 64, 64, 64, 64,
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 63, 63, 64, 64, 64, 64, 64, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 63, 63, 64, 64, 64, 64, 64, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 66,
+ 66, 66, 66, 66, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 67, 68,
+ 68, 68,
+ /* Size 16x32 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 63, 63, 63, 63, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 63, 63, 63, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 65, 65, 65, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 65, 65, 65, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65,
+ 65, 65, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65,
+ 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 63, 63,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 63, 63, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 63, 63, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 63, 63, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 65, 65, 65, 65, 65, 63, 63, 64, 64, 64, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 63, 63, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 66, 63, 63, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 66, 63, 63, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66,
+ 63, 63, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 63, 63,
+ 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 63, 63, 64, 64,
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 63, 63, 64, 64, 64, 65,
+ 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 63, 64, 64, 64, 65, 65, 65, 65,
+ 65, 65, 65, 65, 66, 66, 66, 67, 63, 64, 64, 64, 65, 65, 65, 65, 65, 65,
+ 65, 65, 66, 66, 67, 67, 63, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 66,
+ 66, 67, 67, 68, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 67,
+ 68, 68, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 67, 68, 68,
+ 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 67, 68, 68, 64, 64,
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 67, 68, 68, 64, 64, 64, 65,
+ 65, 65, 65, 65, 65, 65, 65, 66, 66, 67, 68, 68, 64, 64, 64, 65, 65, 65,
+ 65, 65, 65, 65, 65, 66, 66, 67, 68, 68, 64, 64, 64, 65, 65, 65, 65, 65,
+ 65, 65, 65, 66, 67, 67, 68, 69,
+ /* Size 32x16 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65,
+ 65, 65, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 63, 63,
+ 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 63, 63, 63, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 63, 63, 63, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 63, 63, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66,
+ 66, 66, 66, 66, 66, 66, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 67, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 67, 64, 64,
+ 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 66, 66, 67, 67, 68, 68, 68, 68, 68, 68, 68, 64, 64, 64, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 67, 67,
+ 68, 68, 68, 68, 68, 68, 68, 69,
+ /* Size 4x16 */
+ 63, 63, 63, 64, 63, 63, 63, 64, 63, 64, 64, 64, 63, 64, 64, 65, 63, 64,
+ 64, 65, 63, 64, 64, 65, 63, 64, 64, 65, 63, 65, 65, 65, 63, 65, 65, 65,
+ 63, 65, 65, 65, 63, 65, 65, 65, 64, 65, 65, 66, 64, 65, 65, 67, 64, 65,
+ 65, 67, 64, 65, 65, 67, 64, 65, 65, 67,
+ /* Size 16x4 */
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 63, 63,
+ 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 63, 63, 64, 64,
+ 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 65, 65, 65,
+ 65, 65, 65, 65, 65, 66, 67, 67, 67, 67,
+ /* Size 8x32 */
+ 64, 63, 63, 63, 63, 63, 63, 64, 63, 63, 63, 63, 63, 63, 64, 64, 63, 63,
+ 63, 63, 63, 63, 64, 64, 63, 63, 64, 64, 64, 64, 64, 64, 63, 63, 64, 64,
+ 64, 64, 64, 65, 63, 64, 64, 64, 64, 64, 64, 65, 63, 64, 64, 64, 64, 64,
+ 64, 65, 63, 64, 64, 64, 64, 64, 64, 65, 63, 64, 64, 64, 64, 64, 64, 65,
+ 63, 64, 64, 64, 64, 64, 64, 65, 63, 64, 64, 64, 64, 64, 64, 65, 63, 64,
+ 64, 64, 64, 64, 64, 65, 63, 64, 64, 64, 64, 64, 65, 65, 63, 64, 64, 64,
+ 64, 64, 65, 65, 63, 64, 64, 65, 65, 65, 65, 65, 63, 64, 64, 65, 65, 65,
+ 65, 65, 63, 64, 64, 65, 65, 65, 65, 65, 63, 64, 64, 65, 65, 65, 65, 65,
+ 63, 64, 64, 65, 65, 65, 65, 65, 63, 64, 64, 65, 65, 65, 65, 65, 63, 64,
+ 64, 65, 65, 65, 65, 65, 63, 64, 64, 65, 65, 65, 65, 66, 63, 64, 65, 65,
+ 65, 65, 66, 66, 63, 64, 65, 65, 65, 65, 66, 67, 63, 64, 65, 65, 65, 65,
+ 66, 67, 64, 64, 65, 65, 65, 65, 66, 68, 64, 64, 65, 65, 65, 65, 66, 68,
+ 64, 64, 65, 65, 65, 65, 66, 68, 64, 64, 65, 65, 65, 65, 66, 68, 64, 64,
+ 65, 65, 65, 65, 66, 68, 64, 64, 65, 65, 65, 65, 66, 68, 64, 64, 65, 65,
+ 65, 65, 67, 68,
+ /* Size 32x8 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63,
+ 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 63, 63,
+ 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 63, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 67, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 67, 67, 68, 68, 68,
+ 68, 68, 68, 68 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 63, 66, 66, 72,
+#endif
+ /* Size 4x4 */
+ 63, 62, 62, 68, 62, 63, 63, 70, 62, 63, 64, 71, 68, 70, 71, 78,
+ /* Size 8x8 */
+ 63, 62, 62, 62, 61, 62, 67, 67, 62, 63, 63, 63, 62, 64, 69, 69, 62, 63,
+ 63, 63, 62, 64, 69, 69, 62, 63, 63, 63, 63, 64, 70, 70, 61, 62, 62, 63,
+ 64, 65, 71, 71, 62, 64, 64, 64, 65, 66, 72, 72, 67, 69, 69, 70, 71, 72,
+ 78, 78, 67, 69, 69, 70, 71, 72, 78, 78,
+ /* Size 16x16 */
+ 64, 63, 63, 62, 62, 62, 62, 61, 61, 61, 61, 63, 66, 67, 67, 67, 63, 63,
+ 63, 63, 63, 63, 62, 62, 61, 61, 61, 64, 66, 68, 68, 68, 63, 63, 63, 63,
+ 63, 63, 62, 62, 62, 62, 62, 65, 67, 69, 69, 69, 62, 63, 63, 63, 63, 63,
+ 63, 63, 62, 62, 62, 65, 68, 69, 69, 69, 62, 63, 63, 63, 63, 63, 63, 63,
+ 62, 62, 62, 65, 68, 69, 69, 69, 62, 63, 63, 63, 63, 63, 63, 63, 62, 62,
+ 62, 65, 68, 69, 69, 69, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 66,
+ 68, 70, 70, 70, 61, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 66, 69, 71,
+ 71, 71, 61, 61, 62, 62, 62, 62, 63, 63, 64, 64, 64, 66, 69, 71, 71, 71,
+ 61, 61, 62, 62, 62, 62, 63, 63, 64, 64, 64, 66, 69, 71, 71, 71, 61, 61,
+ 62, 62, 62, 62, 63, 63, 64, 64, 64, 66, 69, 71, 71, 71, 63, 64, 65, 65,
+ 65, 65, 66, 66, 66, 66, 66, 69, 72, 74, 74, 74, 66, 66, 67, 68, 68, 68,
+ 68, 69, 69, 69, 69, 72, 75, 77, 77, 77, 67, 68, 69, 69, 69, 69, 70, 71,
+ 71, 71, 71, 74, 77, 78, 78, 78, 67, 68, 69, 69, 69, 69, 70, 71, 71, 71,
+ 71, 74, 77, 78, 78, 78, 67, 68, 69, 69, 69, 69, 70, 71, 71, 71, 71, 74,
+ 77, 78, 78, 78,
+ /* Size 32x32 */
+ 64, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61,
+ 61, 61, 61, 62, 63, 64, 66, 67, 67, 67, 67, 67, 67, 68, 63, 63, 63, 63,
+ 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 62,
+ 63, 65, 66, 67, 67, 67, 67, 67, 67, 69, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 63, 64, 65, 66, 68,
+ 68, 68, 68, 68, 68, 69, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62,
+ 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 64, 66, 67, 68, 68, 68, 68, 68,
+ 68, 70, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62,
+ 62, 62, 62, 62, 62, 63, 65, 66, 67, 69, 69, 69, 69, 69, 69, 70, 62, 62,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62,
+ 62, 64, 65, 66, 68, 69, 69, 69, 69, 69, 69, 71, 62, 62, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 64, 65, 66,
+ 68, 69, 69, 69, 69, 69, 69, 71, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 64, 65, 66, 68, 69, 69, 69,
+ 69, 69, 69, 71, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 62, 62, 62, 62, 62, 62, 64, 65, 66, 68, 69, 69, 69, 69, 69, 69, 71,
+ 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62,
+ 62, 62, 62, 64, 65, 66, 68, 69, 69, 69, 69, 69, 69, 71, 62, 62, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 64,
+ 65, 66, 68, 69, 69, 69, 69, 69, 69, 71, 62, 62, 62, 62, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 65, 67, 68, 70,
+ 70, 70, 70, 70, 70, 71, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 66, 67, 68, 70, 70, 70, 70, 70,
+ 70, 71, 61, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 64, 66, 67, 69, 70, 70, 70, 70, 70, 70, 72, 61, 61,
+ 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 65, 66, 68, 69, 71, 71, 71, 71, 71, 71, 72, 61, 61, 61, 62, 62, 62,
+ 62, 62, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 65, 66, 68,
+ 69, 71, 71, 71, 71, 71, 71, 73, 61, 61, 61, 62, 62, 62, 62, 62, 62, 62,
+ 62, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 65, 66, 68, 69, 71, 71, 71,
+ 71, 71, 71, 73, 61, 61, 61, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63,
+ 63, 64, 64, 64, 64, 64, 64, 65, 66, 68, 69, 71, 71, 71, 71, 71, 71, 73,
+ 61, 61, 61, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64,
+ 64, 64, 64, 65, 66, 68, 69, 71, 71, 71, 71, 71, 71, 73, 61, 61, 61, 62,
+ 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 65,
+ 66, 68, 69, 71, 71, 71, 71, 71, 71, 73, 61, 61, 61, 62, 62, 62, 62, 62,
+ 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 65, 66, 68, 69, 71,
+ 71, 71, 71, 71, 71, 73, 62, 62, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 65, 65, 65, 65, 65, 65, 65, 66, 68, 69, 71, 72, 72, 72, 72, 72,
+ 72, 74, 63, 63, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 68, 69, 71, 72, 74, 74, 74, 74, 74, 74, 75, 64, 65,
+ 65, 66, 66, 66, 66, 66, 66, 66, 66, 67, 67, 67, 68, 68, 68, 68, 68, 68,
+ 68, 69, 71, 72, 74, 75, 75, 75, 75, 75, 75, 77, 66, 66, 66, 67, 67, 68,
+ 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 71, 72, 74,
+ 75, 77, 77, 77, 77, 77, 77, 78, 67, 67, 68, 68, 69, 69, 69, 69, 69, 69,
+ 69, 70, 70, 70, 71, 71, 71, 71, 71, 71, 71, 72, 74, 75, 77, 78, 78, 78,
+ 78, 78, 78, 80, 67, 67, 68, 68, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70,
+ 71, 71, 71, 71, 71, 71, 71, 72, 74, 75, 77, 78, 78, 78, 78, 78, 78, 80,
+ 67, 67, 68, 68, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 71, 71, 71, 71,
+ 71, 71, 71, 72, 74, 75, 77, 78, 78, 78, 78, 78, 78, 80, 67, 67, 68, 68,
+ 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 71, 71, 71, 71, 71, 71, 71, 72,
+ 74, 75, 77, 78, 78, 78, 78, 78, 78, 80, 67, 67, 68, 68, 69, 69, 69, 69,
+ 69, 69, 69, 70, 70, 70, 71, 71, 71, 71, 71, 71, 71, 72, 74, 75, 77, 78,
+ 78, 78, 78, 78, 78, 80, 67, 67, 68, 68, 69, 69, 69, 69, 69, 69, 69, 70,
+ 70, 70, 71, 71, 71, 71, 71, 71, 71, 72, 74, 75, 77, 78, 78, 78, 78, 78,
+ 78, 80, 68, 69, 69, 70, 70, 71, 71, 71, 71, 71, 71, 71, 71, 72, 72, 73,
+ 73, 73, 73, 73, 73, 74, 75, 77, 78, 80, 80, 80, 80, 80, 80, 81,
+ /* Size 4x8 */
+ 63, 62, 62, 69, 63, 63, 63, 71, 63, 63, 63, 71, 62, 64, 64, 72, 62, 64,
+ 64, 73, 63, 66, 66, 74, 68, 72, 72, 80, 68, 72, 72, 80,
+ /* Size 8x4 */
+ 63, 63, 63, 62, 62, 63, 68, 68, 62, 63, 63, 64, 64, 66, 72, 72, 62, 63,
+ 63, 64, 64, 66, 72, 72, 69, 71, 71, 72, 73, 74, 80, 80,
+ /* Size 8x16 */
+ 64, 63, 62, 62, 62, 62, 66, 71, 63, 63, 62, 62, 62, 62, 67, 72, 63, 63,
+ 63, 63, 63, 63, 68, 73, 63, 63, 63, 63, 63, 63, 68, 74, 63, 63, 63, 63,
+ 63, 63, 68, 74, 63, 63, 63, 63, 63, 63, 68, 74, 62, 63, 63, 64, 64, 64,
+ 69, 75, 61, 62, 63, 64, 64, 64, 69, 76, 61, 62, 64, 64, 64, 64, 70, 76,
+ 61, 62, 64, 64, 64, 64, 70, 76, 61, 62, 64, 64, 64, 64, 70, 76, 63, 65,
+ 66, 67, 67, 67, 72, 79, 66, 68, 69, 70, 70, 70, 75, 81, 67, 69, 71, 72,
+ 72, 72, 77, 83, 67, 69, 71, 72, 72, 72, 77, 83, 67, 69, 71, 72, 72, 72,
+ 77, 83,
+ /* Size 16x8 */
+ 64, 63, 63, 63, 63, 63, 62, 61, 61, 61, 61, 63, 66, 67, 67, 67, 63, 63,
+ 63, 63, 63, 63, 63, 62, 62, 62, 62, 65, 68, 69, 69, 69, 62, 62, 63, 63,
+ 63, 63, 63, 63, 64, 64, 64, 66, 69, 71, 71, 71, 62, 62, 63, 63, 63, 63,
+ 64, 64, 64, 64, 64, 67, 70, 72, 72, 72, 62, 62, 63, 63, 63, 63, 64, 64,
+ 64, 64, 64, 67, 70, 72, 72, 72, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64,
+ 64, 67, 70, 72, 72, 72, 66, 67, 68, 68, 68, 68, 69, 69, 70, 70, 70, 72,
+ 75, 77, 77, 77, 71, 72, 73, 74, 74, 74, 75, 76, 76, 76, 76, 79, 81, 83,
+ 83, 83,
+ /* Size 16x32 */
+ 64, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 64, 66, 68, 71, 74, 63, 63,
+ 63, 62, 62, 62, 62, 62, 62, 62, 62, 64, 66, 69, 71, 74, 63, 63, 63, 63,
+ 62, 62, 62, 62, 62, 62, 62, 64, 67, 69, 72, 75, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 65, 67, 70, 73, 76, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 65, 68, 70, 73, 76, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 66, 68, 71, 74, 77, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 66,
+ 68, 71, 74, 77, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 66, 68, 71,
+ 74, 77, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 66, 68, 71, 74, 77,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 66, 68, 71, 74, 77, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 66, 68, 71, 74, 77, 62, 62, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 66, 68, 71, 74, 77, 62, 62, 63, 63, 63, 64,
+ 64, 64, 64, 64, 64, 66, 69, 72, 75, 78, 62, 62, 62, 63, 63, 64, 64, 64,
+ 64, 64, 64, 66, 69, 72, 75, 79, 61, 62, 62, 63, 63, 64, 64, 64, 64, 64,
+ 64, 67, 69, 72, 76, 79, 61, 62, 62, 63, 64, 64, 64, 64, 64, 64, 64, 67,
+ 70, 73, 76, 80, 61, 62, 62, 63, 64, 64, 64, 64, 64, 64, 64, 67, 70, 73,
+ 76, 80, 61, 62, 62, 63, 64, 64, 64, 64, 64, 64, 64, 67, 70, 73, 76, 80,
+ 61, 62, 62, 63, 64, 64, 64, 64, 64, 64, 64, 67, 70, 73, 76, 80, 61, 62,
+ 62, 63, 64, 64, 64, 64, 64, 64, 64, 67, 70, 73, 76, 80, 61, 62, 62, 63,
+ 64, 64, 64, 64, 64, 64, 64, 67, 70, 73, 76, 80, 62, 63, 63, 64, 65, 66,
+ 66, 66, 66, 66, 66, 68, 71, 74, 77, 81, 63, 64, 65, 66, 66, 67, 67, 67,
+ 67, 67, 67, 70, 72, 75, 79, 82, 65, 65, 66, 67, 68, 68, 68, 68, 68, 68,
+ 68, 71, 74, 77, 80, 83, 66, 67, 68, 68, 69, 70, 70, 70, 70, 70, 70, 73,
+ 75, 78, 81, 85, 67, 68, 69, 70, 71, 72, 72, 72, 72, 72, 72, 74, 77, 80,
+ 83, 86, 67, 68, 69, 70, 71, 72, 72, 72, 72, 72, 72, 74, 77, 80, 83, 86,
+ 67, 68, 69, 70, 71, 72, 72, 72, 72, 72, 72, 74, 77, 80, 83, 86, 67, 68,
+ 69, 70, 71, 72, 72, 72, 72, 72, 72, 74, 77, 80, 83, 86, 67, 68, 69, 70,
+ 71, 72, 72, 72, 72, 72, 72, 74, 77, 80, 83, 86, 67, 68, 69, 70, 71, 72,
+ 72, 72, 72, 72, 72, 74, 77, 80, 83, 86, 69, 69, 70, 71, 72, 73, 73, 73,
+ 73, 73, 73, 76, 78, 81, 84, 88,
+ /* Size 32x16 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 61, 61, 61, 61,
+ 61, 61, 61, 62, 63, 65, 66, 67, 67, 67, 67, 67, 67, 69, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63,
+ 64, 65, 67, 68, 68, 68, 68, 68, 68, 69, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 63, 65, 66, 68, 69,
+ 69, 69, 69, 69, 69, 70, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 66, 67, 68, 70, 70, 70, 70, 70,
+ 70, 71, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64,
+ 64, 64, 64, 64, 64, 65, 66, 68, 69, 71, 71, 71, 71, 71, 71, 72, 62, 62,
+ 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 66, 67, 68, 70, 72, 72, 72, 72, 72, 72, 73, 62, 62, 62, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 66, 67, 68,
+ 70, 72, 72, 72, 72, 72, 72, 73, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 66, 67, 68, 70, 72, 72, 72,
+ 72, 72, 72, 73, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 66, 67, 68, 70, 72, 72, 72, 72, 72, 72, 73,
+ 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 66, 67, 68, 70, 72, 72, 72, 72, 72, 72, 73, 62, 62, 62, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 66,
+ 67, 68, 70, 72, 72, 72, 72, 72, 72, 73, 64, 64, 64, 65, 65, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 68, 70, 71, 73, 74,
+ 74, 74, 74, 74, 74, 76, 66, 66, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68,
+ 69, 69, 69, 70, 70, 70, 70, 70, 70, 71, 72, 74, 75, 77, 77, 77, 77, 77,
+ 77, 78, 68, 69, 69, 70, 70, 71, 71, 71, 71, 71, 71, 71, 72, 72, 72, 73,
+ 73, 73, 73, 73, 73, 74, 75, 77, 78, 80, 80, 80, 80, 80, 80, 81, 71, 71,
+ 72, 73, 73, 74, 74, 74, 74, 74, 74, 74, 75, 75, 76, 76, 76, 76, 76, 76,
+ 76, 77, 79, 80, 81, 83, 83, 83, 83, 83, 83, 84, 74, 74, 75, 76, 76, 77,
+ 77, 77, 77, 77, 77, 77, 78, 79, 79, 80, 80, 80, 80, 80, 80, 81, 82, 83,
+ 85, 86, 86, 86, 86, 86, 86, 88,
+ /* Size 4x16 */
+ 63, 62, 62, 68, 63, 62, 62, 69, 63, 63, 63, 70, 63, 63, 63, 71, 63, 63,
+ 63, 71, 63, 63, 63, 71, 62, 64, 64, 72, 62, 64, 64, 72, 62, 64, 64, 73,
+ 62, 64, 64, 73, 62, 64, 64, 73, 64, 67, 67, 75, 67, 70, 70, 78, 68, 72,
+ 72, 80, 68, 72, 72, 80, 68, 72, 72, 80,
+ /* Size 16x4 */
+ 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 64, 67, 68, 68, 68, 62, 62,
+ 63, 63, 63, 63, 64, 64, 64, 64, 64, 67, 70, 72, 72, 72, 62, 62, 63, 63,
+ 63, 63, 64, 64, 64, 64, 64, 67, 70, 72, 72, 72, 68, 69, 70, 71, 71, 71,
+ 72, 72, 73, 73, 73, 75, 78, 80, 80, 80,
+ /* Size 8x32 */
+ 64, 63, 62, 62, 62, 62, 66, 71, 63, 63, 62, 62, 62, 62, 66, 71, 63, 63,
+ 62, 62, 62, 62, 67, 72, 63, 63, 63, 63, 63, 63, 67, 73, 63, 63, 63, 63,
+ 63, 63, 68, 73, 63, 63, 63, 63, 63, 63, 68, 74, 63, 63, 63, 63, 63, 63,
+ 68, 74, 63, 63, 63, 63, 63, 63, 68, 74, 63, 63, 63, 63, 63, 63, 68, 74,
+ 63, 63, 63, 63, 63, 63, 68, 74, 63, 63, 63, 63, 63, 63, 68, 74, 62, 63,
+ 63, 63, 63, 63, 68, 74, 62, 63, 63, 64, 64, 64, 69, 75, 62, 62, 63, 64,
+ 64, 64, 69, 75, 61, 62, 63, 64, 64, 64, 69, 76, 61, 62, 64, 64, 64, 64,
+ 70, 76, 61, 62, 64, 64, 64, 64, 70, 76, 61, 62, 64, 64, 64, 64, 70, 76,
+ 61, 62, 64, 64, 64, 64, 70, 76, 61, 62, 64, 64, 64, 64, 70, 76, 61, 62,
+ 64, 64, 64, 64, 70, 76, 62, 63, 65, 66, 66, 66, 71, 77, 63, 65, 66, 67,
+ 67, 67, 72, 79, 65, 66, 68, 68, 68, 68, 74, 80, 66, 68, 69, 70, 70, 70,
+ 75, 81, 67, 69, 71, 72, 72, 72, 77, 83, 67, 69, 71, 72, 72, 72, 77, 83,
+ 67, 69, 71, 72, 72, 72, 77, 83, 67, 69, 71, 72, 72, 72, 77, 83, 67, 69,
+ 71, 72, 72, 72, 77, 83, 67, 69, 71, 72, 72, 72, 77, 83, 69, 70, 72, 73,
+ 73, 73, 78, 84,
+ /* Size 32x8 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 61, 61, 61, 61,
+ 61, 61, 61, 62, 63, 65, 66, 67, 67, 67, 67, 67, 67, 69, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 63,
+ 65, 66, 68, 69, 69, 69, 69, 69, 69, 70, 62, 62, 62, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 65, 66, 68, 69, 71,
+ 71, 71, 71, 71, 71, 72, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 66, 67, 68, 70, 72, 72, 72, 72, 72,
+ 72, 73, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 66, 67, 68, 70, 72, 72, 72, 72, 72, 72, 73, 62, 62,
+ 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 66, 67, 68, 70, 72, 72, 72, 72, 72, 72, 73, 66, 66, 67, 67, 68, 68,
+ 68, 68, 68, 68, 68, 68, 69, 69, 69, 70, 70, 70, 70, 70, 70, 71, 72, 74,
+ 75, 77, 77, 77, 77, 77, 77, 78, 71, 71, 72, 73, 73, 74, 74, 74, 74, 74,
+ 74, 74, 75, 75, 76, 76, 76, 76, 76, 76, 76, 77, 79, 80, 81, 83, 83, 83,
+ 83, 83, 83, 84 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 63, 63, 63, 64,
+#endif
+ /* Size 4x4 */
+ 63, 63, 63, 63, 63, 64, 64, 64, 63, 64, 64, 64, 63, 64, 64, 64,
+ /* Size 8x8 */
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 64, 64, 64, 64, 64, 63, 63, 64, 64, 64, 64, 64, 64, 63, 63, 64, 64,
+ 64, 64, 64, 64, 63, 63, 64, 64, 64, 64, 64, 64, 63, 63, 64, 64, 64, 64,
+ 64, 64, 63, 63, 64, 64, 64, 64, 64, 65,
+ /* Size 16x16 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63,
+ 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 65, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 65, 65,
+ /* Size 32x32 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64,
64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63,
63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 63, 63, 63, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 62, 62,
- 62, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 63, 63, 62, 62, 62, 62, 63, 63,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63,
63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 65, 65, 65, 65, 65, 65, 63, 63, 62, 62, 62, 62, 63, 63, 63, 63, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
- 65, 65, 63, 63, 62, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 63, 63,
- 63, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65,
- 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 63, 63, 63, 62, 62, 62,
- 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 65, 65, 63, 63, 63, 62, 62, 62, 63, 63, 63, 63,
- 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 65, 63, 63, 63, 63, 62, 63, 63, 63, 63, 64, 64, 64, 64, 64,
- 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
- 63, 63, 63, 63, 62, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 63, 63, 63,
- 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 64, 64, 63, 63, 63, 63, 63, 63,
- 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
- 66, 66, 66, 66, 66, 66, 64, 64, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64,
- 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66,
- 66, 66, 64, 64, 64, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 64, 64,
- 64, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 64, 64, 64, 64, 63, 64,
- 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
- 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 64, 64,
- 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 64, 64, 64, 64, 64, 64,
- 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
- 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63,
+ 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 63, 63, 63, 63, 63, 63, 63, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 65, 65, 65, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
+ 65, 65, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65,
+ /* Size 4x8 */
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 63, 64, 64, 64, 63, 64,
+ 64, 64, 63, 64, 64, 64, 63, 64, 64, 64, 63, 64, 64, 65,
+ /* Size 8x4 */
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 63, 63,
+ 64, 64, 64, 64, 64, 64, 63, 63, 64, 64, 64, 64, 64, 65,
+ /* Size 8x16 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 63, 63, 63, 64,
+ 64, 64, 64, 64, 63, 63, 64, 64, 64, 64, 64, 64, 63, 63, 64, 64, 64, 64,
+ 64, 64, 63, 63, 64, 64, 64, 64, 64, 64, 63, 63, 64, 64, 64, 64, 64, 64,
+ 63, 63, 64, 64, 64, 64, 64, 64, 63, 63, 64, 64, 64, 64, 64, 64, 63, 63,
+ 64, 64, 64, 64, 64, 64, 63, 63, 64, 64, 64, 64, 64, 64, 63, 63, 64, 64,
+ 64, 64, 64, 64, 63, 63, 64, 64, 64, 65, 65, 65, 63, 63, 64, 64, 64, 65,
+ 65, 65,
+ /* Size 16x8 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 65, 65, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 65, 65, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 65, 65,
+ /* Size 16x32 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64,
+ 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63,
+ 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63,
+ 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63,
+ 63, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 63, 63, 63, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 63, 63, 63, 64, 64, 64,
+ 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 63, 63, 63, 64, 64, 64, 64, 64,
+ 64, 65, 65, 65, 65, 65, 65, 65,
+ /* Size 32x16 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64,
+ 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63,
+ 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63,
+ 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 63, 63, 63, 63,
+ 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 63, 63, 63, 63, 63, 63, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 65, 65, 65, 65, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
+ 65, 65, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 63, 63,
+ 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 63, 63, 63, 63, 63, 63,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 65, 65, 65, 65,
+ /* Size 4x16 */
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 63, 64,
+ 64, 64, 63, 64, 64, 64, 63, 64, 64, 64, 63, 64, 64, 64, 63, 64, 64, 64,
+ 63, 64, 64, 64, 63, 64, 64, 64, 63, 64, 64, 64, 63, 64, 64, 64, 63, 64,
+ 64, 64, 63, 64, 64, 65, 63, 64, 65, 65,
+ /* Size 16x4 */
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 63, 63, 63, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
+ /* Size 8x32 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64,
+ 64, 64, 63, 63, 63, 64, 64, 64, 64, 64, 63, 63, 63, 64, 64, 64, 64, 64,
+ 63, 63, 64, 64, 64, 64, 64, 64, 63, 63, 64, 64, 64, 64, 64, 64, 63, 63,
+ 64, 64, 64, 64, 64, 64, 63, 63, 64, 64, 64, 64, 64, 64, 63, 63, 64, 64,
+ 64, 64, 64, 64, 63, 63, 64, 64, 64, 64, 64, 64, 63, 63, 64, 64, 64, 64,
+ 64, 64, 63, 63, 64, 64, 64, 64, 64, 64, 63, 63, 64, 64, 64, 64, 64, 64,
+ 63, 63, 64, 64, 64, 64, 64, 64, 63, 63, 64, 64, 64, 64, 64, 64, 63, 63,
+ 64, 64, 64, 64, 64, 64, 63, 63, 64, 64, 64, 64, 64, 64, 63, 63, 64, 64,
+ 64, 64, 64, 64, 63, 63, 64, 64, 64, 64, 64, 64, 63, 63, 64, 64, 64, 64,
+ 64, 64, 63, 63, 64, 64, 64, 64, 64, 64, 63, 63, 64, 64, 64, 64, 64, 64,
+ 63, 63, 64, 64, 64, 64, 64, 64, 63, 63, 64, 64, 64, 65, 65, 65, 63, 63,
+ 64, 64, 64, 65, 65, 65, 63, 63, 64, 64, 64, 65, 65, 65, 63, 63, 64, 64,
+ 64, 65, 65, 65,
+ /* Size 32x8 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63,
+ 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 63, 63, 63, 63, 63, 63,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 65, 65, 65, 65, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 65, 65, 65, 65 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 63, 62, 62, 63,
+#endif
+ /* Size 4x4 */
+ 63, 62, 62, 62, 62, 63, 63, 63, 62, 63, 63, 63, 62, 63, 63, 63,
+ /* Size 8x8 */
+ 63, 63, 63, 62, 62, 62, 62, 61, 63, 63, 63, 63, 63, 62, 62, 62, 63, 63,
+ 63, 63, 63, 63, 62, 62, 62, 63, 63, 63, 63, 63, 63, 62, 62, 63, 63, 63,
+ 63, 63, 63, 62, 62, 62, 63, 63, 63, 63, 63, 63, 62, 62, 62, 63, 63, 63,
+ 63, 63, 61, 62, 62, 62, 62, 63, 63, 63,
+ /* Size 16x16 */
+ 64, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 61, 61, 61, 63, 63,
+ 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 61, 61, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 61, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62,
+ 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 61, 62, 62, 62, 62, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 61, 61, 62, 62, 62, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 61, 61, 61, 62, 62, 62, 62, 62, 62, 62, 62, 63,
+ 63, 63, 63, 64,
+ /* Size 32x32 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62,
+ 62, 62, 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
+ 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
+ 62, 61, 61, 61, 61, 61, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62,
+ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 61, 61,
+ 61, 61, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 61, 61, 61, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62,
+ 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62,
+ 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62,
+ 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62,
+ 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62,
+ 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62,
+ 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62,
+ 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62,
+ 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 61, 61, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 61, 61, 61, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 61, 61, 61, 61,
+ 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 61, 61, 61, 61, 61, 62, 62, 62,
+ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 61, 61, 61, 61, 61, 62, 62, 62, 62, 62, 62, 62,
+ 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 64, 64, 61, 61, 61, 61, 61, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
+ 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64,
+ /* Size 4x8 */
+ 63, 63, 62, 62, 63, 63, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 62, 63, 63, 63, 62, 63, 64, 64, 61, 63, 64, 64,
+ /* Size 8x4 */
+ 63, 63, 63, 63, 63, 62, 62, 61, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62,
+ 63, 63, 63, 63, 64, 64, 62, 62, 63, 63, 63, 63, 64, 64,
+ /* Size 8x16 */
+ 64, 63, 63, 62, 62, 62, 62, 62, 63, 63, 63, 62, 62, 62, 62, 62, 63, 63,
+ 63, 63, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62,
+ 63, 63, 63, 63, 63, 63, 62, 62, 63, 63, 63, 64, 64, 64, 62, 62, 62, 63,
+ 63, 64, 64, 64, 61, 62, 62, 63, 63, 64, 64, 64, 61, 62, 62, 63, 64, 64,
+ 64, 64,
+ /* Size 16x8 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 61, 61, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 64, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 64, 64, 64, 64, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 64, 64, 64, 64, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64,
+ 64, 64,
+ /* Size 16x32 */
+ 64, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63,
+ 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63,
+ 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63,
+ 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 62,
+ 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62,
+ 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63,
+ 64, 64, 64, 64, 64, 64, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 64, 64,
+ 64, 64, 64, 64, 62, 62, 62, 62, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64,
+ 64, 64, 62, 62, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64,
+ 61, 62, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 61, 62,
+ 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 61, 61, 62, 62,
+ 62, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 61, 61, 62, 62, 62, 63,
+ 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 61, 61, 62, 62, 62, 63, 63, 63,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 32x16 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62,
+ 62, 62, 62, 62, 62, 62, 62, 61, 61, 61, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62,
+ 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62,
+ 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64,
+ 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 62, 62, 62, 62,
+ 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 62, 62, 62, 62, 62, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 62,
+ 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 62, 62, 62, 62, 62,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 4x16 */
+ 63, 63, 62, 62, 63, 63, 62, 62, 63, 63, 62, 62, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 62, 63, 63, 63, 62, 63, 63, 64, 62, 63,
+ 64, 64, 62, 63, 64, 64, 61, 63, 64, 64,
+ /* Size 16x4 */
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 61, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 62, 62, 62, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 64, 64, 64, 64,
+ /* Size 8x32 */
+ 64, 63, 63, 62, 62, 62, 62, 62, 63, 63, 63, 62, 62, 62, 62, 62, 63, 63,
+ 63, 62, 62, 62, 62, 62, 63, 63, 63, 63, 62, 62, 62, 62, 63, 63, 63, 63,
+ 62, 62, 62, 62, 63, 63, 63, 63, 63, 62, 62, 62, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 62, 63, 63, 63, 63, 63, 63, 63, 62, 62, 63, 63,
+ 63, 63, 63, 63, 62, 62, 63, 63, 63, 64, 64, 64, 62, 62, 63, 63, 63, 64,
+ 64, 64, 62, 62, 63, 63, 63, 64, 64, 64, 62, 62, 62, 63, 63, 64, 64, 64,
+ 61, 62, 62, 63, 63, 64, 64, 64, 61, 62, 62, 63, 63, 64, 64, 64, 61, 62,
+ 62, 63, 64, 64, 64, 64, 61, 62, 62, 63, 64, 64, 64, 64, 61, 62, 62, 63,
+ 64, 64, 64, 64,
+ /* Size 32x8 */
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 62, 62,
+ 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 62, 62, 62, 62, 62,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 64, 64, 64, 64,
+#endif
+ /* Size 4x4 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- /* Size 8 */
+ /* Size 8x8 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- /* Size 16 */
+ /* Size 16x16 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -5656,7 +7495,7 @@ static uint16_t iwt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64,
- /* Size 32 */
+ /* Size 32x32 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -5713,22 +7552,23 @@ static uint16_t iwt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 },
- { /* Intra matrices */
- /* Size 4 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- /* Size 8 */
+ /* Size 4x8 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 8x4 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 8x16 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- /* Size 16 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64,
+ /* Size 16x8 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -5736,9 +7576,40 @@ static uint16_t iwt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64,
+ /* Size 16x32 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 32x16 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64,
- /* Size 32 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -5765,11 +7636,19 @@ static uint16_t iwt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 4x16 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 16x4 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 8x32 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -5783,6 +7662,10 @@ static uint16_t iwt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64,
+ /* Size 32x8 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -5795,17 +7678,20 @@ static uint16_t iwt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
+ 64, 64, 64, 64 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 64, 64, 64, 64,
+#endif
+ /* Size 4x4 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- /* Size 8 */
+ /* Size 8x8 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- /* Size 16 */
+ /* Size 16x16 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -5821,7 +7707,7 @@ static uint16_t iwt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64,
- /* Size 32 */
+ /* Size 32x32 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -5878,22 +7764,23 @@ static uint16_t iwt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 },
- { /* Intra matrices */
- /* Size 4 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- /* Size 8 */
+ /* Size 4x8 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 8x4 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 8x16 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- /* Size 16 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64,
+ /* Size 16x8 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -5901,9 +7788,12 @@ static uint16_t iwt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64,
+ /* Size 16x32 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64,
- /* Size 32 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -5928,6 +7818,8 @@ static uint16_t iwt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 32x16 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -5956,5035 +7848,6457 @@ static uint16_t iwt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 4x16 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 16x4 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 8x32 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 } } }
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64,
+ /* Size 32x8 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64 },
+ },
};
-static uint16_t wt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
- 32 * 32] = {
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 58, 33, 19, 58, 37, 25, 17, 33, 25, 16, 12, 19, 17, 12, 10,
- /* Size 8 */
- 64, 87, 80, 59, 42, 31, 24, 19, 87, 75, 79, 66, 50, 38, 29, 23, 80, 79,
- 54, 46, 38, 31, 25, 20, 59, 66, 46, 34, 29, 24, 21, 18, 42, 50, 38, 29,
- 23, 20, 17, 15, 31, 38, 31, 24, 20, 17, 15, 13, 24, 29, 25, 21, 17, 15,
- 13, 12, 19, 23, 20, 18, 15, 13, 12, 11,
- /* Size 16 */
- 64, 76, 87, 84, 80, 70, 59, 51, 42, 37, 31, 27, 24, 21, 19, 19, 76, 79,
- 81, 81, 80, 71, 63, 55, 46, 40, 34, 30, 26, 23, 21, 21, 87, 81, 75, 77,
- 79, 73, 66, 58, 50, 44, 38, 33, 29, 26, 23, 23, 84, 81, 77, 72, 67, 61,
- 56, 50, 44, 39, 34, 31, 27, 24, 21, 21, 80, 80, 79, 67, 54, 50, 46, 42,
- 38, 34, 31, 28, 25, 23, 20, 20, 70, 71, 73, 61, 50, 45, 40, 37, 33, 30,
- 28, 25, 23, 21, 19, 19, 59, 63, 66, 56, 46, 40, 34, 31, 29, 26, 24, 22,
- 21, 19, 18, 18, 51, 55, 58, 50, 42, 37, 31, 29, 26, 24, 22, 20, 19, 18,
- 16, 16, 42, 46, 50, 44, 38, 33, 29, 26, 23, 21, 20, 18, 17, 16, 15, 15,
- 37, 40, 44, 39, 34, 30, 26, 24, 21, 20, 18, 17, 16, 15, 14, 14, 31, 34,
- 38, 34, 31, 28, 24, 22, 20, 18, 17, 16, 15, 14, 13, 13, 27, 30, 33, 31,
- 28, 25, 22, 20, 18, 17, 16, 15, 14, 13, 13, 13, 24, 26, 29, 27, 25, 23,
- 21, 19, 17, 16, 15, 14, 13, 13, 12, 12, 21, 23, 26, 24, 23, 21, 19, 18,
- 16, 15, 14, 13, 13, 12, 12, 12, 19, 21, 23, 21, 20, 19, 18, 16, 15, 14,
- 13, 13, 12, 12, 11, 11, 19, 21, 23, 21, 20, 19, 18, 16, 15, 14, 13, 13,
- 12, 12, 11, 11,
- /* Size 32 */
- 64, 70, 76, 82, 87, 86, 84, 82, 80, 75, 70, 65, 59, 55, 51, 47, 42, 40,
- 37, 34, 31, 29, 27, 26, 24, 22, 21, 20, 19, 19, 19, 19, 70, 74, 77, 81,
- 84, 83, 82, 81, 80, 75, 71, 66, 61, 57, 53, 49, 44, 41, 39, 36, 33, 31,
- 29, 27, 25, 24, 22, 21, 20, 20, 20, 20, 76, 77, 79, 80, 81, 81, 81, 80,
- 80, 75, 71, 67, 63, 59, 55, 51, 46, 43, 40, 37, 34, 32, 30, 28, 26, 25,
- 23, 22, 21, 21, 21, 21, 82, 81, 80, 79, 78, 79, 79, 79, 79, 76, 72, 68,
- 65, 61, 56, 52, 48, 45, 42, 39, 36, 34, 32, 30, 27, 26, 25, 23, 22, 22,
- 22, 22, 87, 84, 81, 78, 75, 76, 77, 78, 79, 76, 73, 70, 66, 62, 58, 54,
- 50, 47, 44, 41, 38, 36, 33, 31, 29, 27, 26, 24, 23, 23, 23, 23, 86, 83,
- 81, 79, 76, 75, 75, 74, 73, 70, 67, 64, 61, 58, 54, 51, 47, 44, 42, 39,
- 36, 34, 32, 30, 28, 26, 25, 23, 22, 22, 22, 22, 84, 82, 81, 79, 77, 75,
- 72, 69, 67, 64, 61, 59, 56, 53, 50, 47, 44, 42, 39, 37, 34, 32, 31, 29,
- 27, 25, 24, 23, 21, 21, 21, 21, 82, 81, 80, 79, 78, 74, 69, 65, 61, 58,
- 56, 53, 51, 48, 46, 44, 41, 39, 37, 35, 33, 31, 29, 28, 26, 25, 23, 22,
- 21, 21, 21, 21, 80, 80, 80, 79, 79, 73, 67, 61, 54, 52, 50, 48, 46, 44,
- 42, 40, 38, 36, 34, 33, 31, 29, 28, 26, 25, 24, 23, 22, 20, 20, 20, 20,
- 75, 75, 75, 76, 76, 70, 64, 58, 52, 50, 47, 45, 43, 41, 39, 37, 36, 34,
- 32, 31, 29, 28, 27, 25, 24, 23, 22, 21, 20, 20, 20, 20, 70, 71, 71, 72,
- 73, 67, 61, 56, 50, 47, 45, 42, 40, 38, 37, 35, 33, 32, 30, 29, 28, 26,
- 25, 24, 23, 22, 21, 20, 19, 19, 19, 19, 65, 66, 67, 68, 70, 64, 59, 53,
- 48, 45, 42, 40, 37, 36, 34, 32, 31, 30, 28, 27, 26, 25, 24, 23, 22, 21,
- 20, 19, 18, 18, 18, 18, 59, 61, 63, 65, 66, 61, 56, 51, 46, 43, 40, 37,
- 34, 33, 31, 30, 29, 27, 26, 25, 24, 23, 22, 22, 21, 20, 19, 18, 18, 18,
- 18, 18, 55, 57, 59, 61, 62, 58, 53, 48, 44, 41, 38, 36, 33, 31, 30, 29,
- 27, 26, 25, 24, 23, 22, 21, 21, 20, 19, 18, 18, 17, 17, 17, 17, 51, 53,
- 55, 56, 58, 54, 50, 46, 42, 39, 37, 34, 31, 30, 29, 27, 26, 25, 24, 23,
- 22, 21, 20, 20, 19, 18, 18, 17, 16, 16, 16, 16, 47, 49, 51, 52, 54, 51,
- 47, 44, 40, 37, 35, 32, 30, 29, 27, 26, 24, 24, 23, 22, 21, 20, 19, 19,
- 18, 18, 17, 16, 16, 16, 16, 16, 42, 44, 46, 48, 50, 47, 44, 41, 38, 36,
- 33, 31, 29, 27, 26, 24, 23, 22, 21, 21, 20, 19, 18, 18, 17, 17, 16, 16,
- 15, 15, 15, 15, 40, 41, 43, 45, 47, 44, 42, 39, 36, 34, 32, 30, 27, 26,
- 25, 24, 22, 21, 21, 20, 19, 18, 18, 17, 17, 16, 16, 15, 15, 15, 15, 15,
- 37, 39, 40, 42, 44, 42, 39, 37, 34, 32, 30, 28, 26, 25, 24, 23, 21, 21,
- 20, 19, 18, 18, 17, 17, 16, 16, 15, 15, 14, 14, 14, 14, 34, 36, 37, 39,
- 41, 39, 37, 35, 33, 31, 29, 27, 25, 24, 23, 22, 21, 20, 19, 18, 18, 17,
- 16, 16, 15, 15, 15, 14, 14, 14, 14, 14, 31, 33, 34, 36, 38, 36, 34, 33,
- 31, 29, 28, 26, 24, 23, 22, 21, 20, 19, 18, 18, 17, 16, 16, 15, 15, 15,
- 14, 14, 13, 13, 13, 13, 29, 31, 32, 34, 36, 34, 32, 31, 29, 28, 26, 25,
- 23, 22, 21, 20, 19, 18, 18, 17, 16, 16, 15, 15, 14, 14, 14, 13, 13, 13,
- 13, 13, 27, 29, 30, 32, 33, 32, 31, 29, 28, 27, 25, 24, 22, 21, 20, 19,
- 18, 18, 17, 16, 16, 15, 15, 14, 14, 14, 13, 13, 13, 13, 13, 13, 26, 27,
- 28, 30, 31, 30, 29, 28, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 17, 16,
- 15, 15, 14, 14, 14, 13, 13, 13, 12, 12, 12, 12, 24, 25, 26, 27, 29, 28,
- 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 17, 16, 15, 15, 14, 14, 14,
- 13, 13, 13, 12, 12, 12, 12, 12, 22, 24, 25, 26, 27, 26, 25, 25, 24, 23,
- 22, 21, 20, 19, 18, 18, 17, 16, 16, 15, 15, 14, 14, 13, 13, 13, 12, 12,
- 12, 12, 12, 12, 21, 22, 23, 25, 26, 25, 24, 23, 23, 22, 21, 20, 19, 18,
- 18, 17, 16, 16, 15, 15, 14, 14, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12,
- 20, 21, 22, 23, 24, 23, 23, 22, 22, 21, 20, 19, 18, 18, 17, 16, 16, 15,
- 15, 14, 14, 13, 13, 13, 12, 12, 12, 12, 11, 11, 11, 11, 19, 20, 21, 22,
- 23, 22, 21, 21, 20, 20, 19, 18, 18, 17, 16, 16, 15, 15, 14, 14, 13, 13,
- 13, 12, 12, 12, 12, 11, 11, 11, 11, 11, 19, 20, 21, 22, 23, 22, 21, 21,
- 20, 20, 19, 18, 18, 17, 16, 16, 15, 15, 14, 14, 13, 13, 13, 12, 12, 12,
- 12, 11, 11, 11, 11, 11, 19, 20, 21, 22, 23, 22, 21, 21, 20, 20, 19, 18,
- 18, 17, 16, 16, 15, 15, 14, 14, 13, 13, 13, 12, 12, 12, 12, 11, 11, 11,
- 11, 11, 19, 20, 21, 22, 23, 22, 21, 21, 20, 20, 19, 18, 18, 17, 16, 16,
- 15, 15, 14, 14, 13, 13, 13, 12, 12, 12, 12, 11, 11, 11, 11, 11 },
- { /* Intra matrices */
- /* Size 4 */
- 249, 225, 124, 69, 225, 139, 91, 60, 124, 91, 57, 42, 69, 60, 42, 32,
- /* Size 8 */
- 206, 285, 261, 191, 134, 96, 71, 55, 285, 245, 257, 214, 161, 118, 88,
- 68, 261, 257, 174, 145, 119, 95, 75, 60, 191, 214, 145, 107, 87, 73, 61,
- 51, 134, 161, 119, 87, 69, 58, 50, 43, 96, 118, 95, 73, 58, 48, 42, 37,
- 71, 88, 75, 61, 50, 42, 36, 32, 55, 68, 60, 51, 43, 37, 32, 29,
- /* Size 16 */
- 217, 259, 300, 287, 275, 237, 200, 171, 141, 121, 101, 88, 75, 66, 57,
- 57, 259, 269, 279, 275, 272, 243, 213, 184, 155, 134, 113, 98, 84, 74,
- 64, 64, 300, 279, 257, 264, 270, 248, 226, 197, 169, 147, 124, 109, 93,
- 82, 71, 71, 287, 275, 264, 245, 227, 208, 189, 168, 147, 130, 112, 99,
- 86, 77, 67, 67, 275, 272, 270, 227, 183, 168, 152, 139, 125, 113, 100,
- 90, 79, 71, 63, 63, 237, 243, 248, 208, 168, 150, 132, 120, 109, 98, 88,
- 80, 72, 65, 58, 58, 200, 213, 226, 189, 152, 132, 113, 102, 92, 84, 77,
- 70, 64, 59, 54, 54, 171, 184, 197, 168, 139, 120, 102, 92, 82, 75, 69,
- 63, 58, 54, 49, 49, 141, 155, 169, 147, 125, 109, 92, 82, 73, 67, 61,
- 56, 52, 49, 45, 45, 121, 134, 147, 130, 113, 98, 84, 75, 67, 61, 56, 52,
- 48, 45, 42, 42, 101, 113, 124, 112, 100, 88, 77, 69, 61, 56, 50, 47, 44,
- 41, 39, 39, 88, 98, 109, 99, 90, 80, 70, 63, 56, 52, 47, 44, 41, 39, 36,
- 36, 75, 84, 93, 86, 79, 72, 64, 58, 52, 48, 44, 41, 38, 36, 34, 34, 66,
- 74, 82, 77, 71, 65, 59, 54, 49, 45, 41, 39, 36, 34, 32, 32, 57, 64, 71,
- 67, 63, 58, 54, 49, 45, 42, 39, 36, 34, 32, 31, 31, 57, 64, 71, 67, 63,
- 58, 54, 49, 45, 42, 39, 36, 34, 32, 31, 31,
- /* Size 32 */
- 223, 244, 265, 287, 308, 301, 295, 288, 282, 263, 244, 225, 206, 190,
- 175, 160, 145, 134, 124, 114, 104, 97, 90, 83, 77, 72, 68, 63, 59, 59,
- 59, 59, 244, 257, 271, 284, 297, 293, 289, 285, 281, 264, 246, 229, 212,
- 197, 182, 167, 152, 141, 131, 120, 110, 103, 95, 88, 81, 77, 72, 67, 62,
- 62, 62, 62, 265, 271, 276, 281, 286, 284, 283, 281, 280, 264, 249, 234,
- 219, 204, 189, 174, 159, 148, 137, 127, 116, 108, 101, 93, 86, 81, 76,
- 71, 66, 66, 66, 66, 287, 284, 281, 278, 275, 276, 277, 278, 278, 265,
- 252, 238, 225, 210, 196, 181, 166, 155, 144, 133, 122, 114, 106, 98, 91,
- 85, 80, 75, 69, 69, 69, 69, 308, 297, 286, 275, 264, 267, 271, 274, 277,
- 266, 254, 243, 231, 217, 203, 188, 174, 162, 151, 139, 128, 120, 111,
- 103, 95, 90, 84, 78, 73, 73, 73, 73, 301, 293, 284, 276, 267, 264, 261,
- 258, 255, 244, 234, 223, 213, 200, 187, 175, 162, 152, 142, 132, 121,
- 114, 107, 99, 92, 87, 81, 76, 71, 71, 71, 71, 295, 289, 283, 277, 271,
- 261, 252, 242, 233, 223, 213, 203, 194, 183, 172, 162, 151, 142, 133,
- 124, 115, 108, 102, 95, 88, 83, 79, 74, 69, 69, 69, 69, 288, 285, 281,
- 278, 274, 258, 242, 226, 210, 201, 193, 184, 175, 166, 157, 149, 140,
- 132, 124, 117, 109, 103, 97, 91, 85, 80, 76, 71, 67, 67, 67, 67, 282,
- 281, 280, 278, 277, 255, 233, 210, 188, 180, 172, 164, 156, 149, 142,
- 135, 129, 122, 116, 109, 103, 97, 92, 87, 81, 77, 73, 69, 65, 65, 65,
- 65, 263, 264, 264, 265, 266, 244, 223, 201, 180, 171, 163, 154, 146,
- 139, 133, 126, 120, 114, 108, 103, 97, 92, 87, 82, 77, 74, 70, 66, 62,
- 62, 62, 62, 244, 246, 249, 252, 254, 234, 213, 193, 172, 163, 154, 145,
- 136, 130, 124, 118, 111, 106, 101, 96, 91, 86, 82, 78, 73, 70, 67, 63,
- 60, 60, 60, 60, 225, 229, 234, 238, 243, 223, 203, 184, 164, 154, 145,
- 135, 126, 120, 114, 109, 103, 98, 94, 89, 85, 81, 77, 73, 70, 67, 64,
- 61, 57, 57, 57, 57, 206, 212, 219, 225, 231, 213, 194, 175, 156, 146,
- 136, 126, 116, 110, 105, 100, 94, 90, 87, 83, 79, 76, 72, 69, 66, 63,
- 60, 58, 55, 55, 55, 55, 190, 197, 204, 210, 217, 200, 183, 166, 149,
- 139, 130, 120, 110, 105, 100, 95, 89, 86, 82, 78, 75, 72, 69, 66, 63,
- 60, 58, 55, 53, 53, 53, 53, 175, 182, 189, 196, 203, 187, 172, 157, 142,
- 133, 124, 114, 105, 100, 95, 90, 84, 81, 77, 74, 71, 68, 65, 62, 60, 57,
- 55, 53, 51, 51, 51, 51, 160, 167, 174, 181, 188, 175, 162, 149, 135,
- 126, 118, 109, 100, 95, 90, 84, 79, 76, 73, 70, 66, 64, 61, 59, 57, 55,
- 53, 51, 49, 49, 49, 49, 145, 152, 159, 166, 174, 162, 151, 140, 129,
- 120, 111, 103, 94, 89, 84, 79, 74, 71, 68, 65, 62, 60, 58, 56, 53, 52,
- 50, 48, 46, 46, 46, 46, 134, 141, 148, 155, 162, 152, 142, 132, 122,
- 114, 106, 98, 90, 86, 81, 76, 71, 68, 66, 63, 60, 58, 55, 53, 51, 50,
- 48, 46, 45, 45, 45, 45, 124, 131, 137, 144, 151, 142, 133, 124, 116,
- 108, 101, 94, 87, 82, 77, 73, 68, 66, 63, 60, 57, 55, 53, 51, 49, 48,
- 46, 45, 43, 43, 43, 43, 114, 120, 127, 133, 139, 132, 124, 117, 109,
- 103, 96, 89, 83, 78, 74, 70, 65, 63, 60, 57, 54, 53, 51, 49, 47, 46, 44,
- 43, 41, 41, 41, 41, 104, 110, 116, 122, 128, 121, 115, 109, 103, 97, 91,
- 85, 79, 75, 71, 66, 62, 60, 57, 54, 52, 50, 48, 47, 45, 44, 42, 41, 40,
- 40, 40, 40, 97, 103, 108, 114, 120, 114, 108, 103, 97, 92, 86, 81, 76,
- 72, 68, 64, 60, 58, 55, 53, 50, 48, 47, 45, 43, 42, 41, 40, 38, 38, 38,
- 38, 90, 95, 101, 106, 111, 107, 102, 97, 92, 87, 82, 77, 72, 69, 65, 61,
- 58, 55, 53, 51, 48, 47, 45, 44, 42, 41, 40, 38, 37, 37, 37, 37, 83, 88,
- 93, 98, 103, 99, 95, 91, 87, 82, 78, 73, 69, 66, 62, 59, 56, 53, 51, 49,
- 47, 45, 44, 42, 40, 39, 38, 37, 36, 36, 36, 36, 77, 81, 86, 91, 95, 92,
- 88, 85, 81, 77, 73, 70, 66, 63, 60, 57, 53, 51, 49, 47, 45, 43, 42, 40,
- 39, 38, 37, 36, 35, 35, 35, 35, 72, 77, 81, 85, 90, 87, 83, 80, 77, 74,
- 70, 67, 63, 60, 57, 55, 52, 50, 48, 46, 44, 42, 41, 39, 38, 37, 36, 35,
- 34, 34, 34, 34, 68, 72, 76, 80, 84, 81, 79, 76, 73, 70, 67, 64, 60, 58,
- 55, 53, 50, 48, 46, 44, 42, 41, 40, 38, 37, 36, 35, 34, 33, 33, 33, 33,
- 63, 67, 71, 75, 78, 76, 74, 71, 69, 66, 63, 61, 58, 55, 53, 51, 48, 46,
- 45, 43, 41, 40, 38, 37, 36, 35, 34, 33, 32, 32, 32, 32, 59, 62, 66, 69,
- 73, 71, 69, 67, 65, 62, 60, 57, 55, 53, 51, 49, 46, 45, 43, 41, 40, 38,
- 37, 36, 35, 34, 33, 32, 31, 31, 31, 31, 59, 62, 66, 69, 73, 71, 69, 67,
- 65, 62, 60, 57, 55, 53, 51, 49, 46, 45, 43, 41, 40, 38, 37, 36, 35, 34,
- 33, 32, 31, 31, 31, 31, 59, 62, 66, 69, 73, 71, 69, 67, 65, 62, 60, 57,
- 55, 53, 51, 49, 46, 45, 43, 41, 40, 38, 37, 36, 35, 34, 33, 32, 31, 31,
- 31, 31, 59, 62, 66, 69, 73, 71, 69, 67, 65, 62, 60, 57, 55, 53, 51, 49,
- 46, 45, 43, 41, 40, 38, 37, 36, 35, 34, 33, 32, 31, 31, 31, 31 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 39, 35, 27, 39, 31, 29, 25, 35, 29, 21, 18, 27, 25, 18, 15,
- /* Size 8 */
- 64, 81, 42, 39, 36, 32, 28, 24, 81, 54, 41, 46, 44, 40, 35, 30, 42, 41,
- 34, 36, 36, 34, 31, 27, 39, 46, 36, 31, 29, 28, 26, 24, 36, 44, 36, 29,
- 26, 24, 22, 20, 32, 40, 34, 28, 24, 21, 19, 18, 28, 35, 31, 26, 22, 19,
- 17, 16, 24, 30, 27, 24, 20, 18, 16, 15,
- /* Size 16 */
- 64, 72, 81, 61, 42, 41, 39, 38, 36, 34, 32, 30, 28, 26, 24, 24, 72, 70,
- 67, 54, 42, 42, 43, 42, 40, 38, 36, 34, 31, 29, 27, 27, 81, 67, 54, 48,
- 41, 44, 46, 45, 44, 42, 40, 37, 35, 32, 30, 30, 61, 54, 48, 43, 38, 39,
- 41, 40, 40, 39, 37, 35, 33, 31, 29, 29, 42, 42, 41, 38, 34, 35, 36, 36,
- 36, 35, 34, 32, 31, 29, 27, 27, 41, 42, 44, 39, 35, 34, 33, 33, 33, 32,
- 31, 30, 28, 27, 25, 25, 39, 43, 46, 41, 36, 33, 31, 30, 29, 29, 28, 27,
- 26, 25, 24, 24, 38, 42, 45, 40, 36, 33, 30, 29, 27, 27, 26, 25, 24, 23,
- 22, 22, 36, 40, 44, 40, 36, 33, 29, 27, 26, 25, 24, 23, 22, 21, 20, 20,
- 34, 38, 42, 39, 35, 32, 29, 27, 25, 23, 22, 21, 21, 20, 19, 19, 32, 36,
- 40, 37, 34, 31, 28, 26, 24, 22, 21, 20, 19, 19, 18, 18, 30, 34, 37, 35,
- 32, 30, 27, 25, 23, 21, 20, 19, 18, 18, 17, 17, 28, 31, 35, 33, 31, 28,
- 26, 24, 22, 21, 19, 18, 17, 17, 16, 16, 26, 29, 32, 31, 29, 27, 25, 23,
- 21, 20, 19, 18, 17, 16, 15, 15, 24, 27, 30, 29, 27, 25, 24, 22, 20, 19,
- 18, 17, 16, 15, 15, 15, 24, 27, 30, 29, 27, 25, 24, 22, 20, 19, 18, 17,
- 16, 15, 15, 15,
- /* Size 32 */
- 64, 68, 72, 76, 81, 71, 61, 52, 42, 41, 41, 40, 39, 39, 38, 37, 36, 35,
- 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 24, 24, 24, 68, 70, 71, 73,
- 74, 66, 58, 50, 42, 42, 41, 41, 41, 40, 40, 39, 38, 37, 36, 35, 34, 33,
- 32, 31, 29, 28, 27, 26, 25, 25, 25, 25, 72, 71, 70, 69, 67, 61, 54, 48,
- 42, 42, 42, 42, 43, 42, 42, 41, 40, 39, 38, 37, 36, 35, 34, 32, 31, 30,
- 29, 28, 27, 27, 27, 27, 76, 73, 69, 65, 61, 56, 51, 46, 41, 42, 43, 44,
- 44, 44, 43, 43, 42, 41, 40, 39, 38, 37, 36, 34, 33, 32, 31, 30, 29, 29,
- 29, 29, 81, 74, 67, 61, 54, 51, 48, 44, 41, 42, 44, 45, 46, 46, 45, 45,
- 44, 43, 42, 41, 40, 39, 37, 36, 35, 34, 32, 31, 30, 30, 30, 30, 71, 66,
- 61, 56, 51, 48, 45, 42, 39, 40, 41, 42, 43, 43, 43, 43, 42, 41, 40, 39,
- 38, 37, 36, 35, 34, 33, 32, 30, 29, 29, 29, 29, 61, 58, 54, 51, 48, 45,
- 43, 40, 38, 38, 39, 40, 41, 41, 40, 40, 40, 39, 39, 38, 37, 36, 35, 34,
- 33, 32, 31, 30, 29, 29, 29, 29, 52, 50, 48, 46, 44, 42, 40, 38, 36, 37,
- 37, 38, 38, 38, 38, 38, 38, 37, 37, 36, 35, 34, 33, 33, 32, 31, 30, 29,
- 28, 28, 28, 28, 42, 42, 42, 41, 41, 39, 38, 36, 34, 35, 35, 35, 36, 36,
- 36, 36, 36, 35, 35, 34, 34, 33, 32, 31, 31, 30, 29, 28, 27, 27, 27, 27,
- 41, 42, 42, 42, 42, 40, 38, 37, 35, 35, 35, 35, 35, 34, 34, 34, 34, 34,
- 33, 33, 32, 32, 31, 30, 29, 29, 28, 27, 26, 26, 26, 26, 41, 41, 42, 43,
- 44, 41, 39, 37, 35, 35, 34, 34, 33, 33, 33, 33, 33, 32, 32, 31, 31, 30,
- 30, 29, 28, 28, 27, 26, 25, 25, 25, 25, 40, 41, 42, 44, 45, 42, 40, 38,
- 35, 35, 34, 33, 32, 32, 32, 31, 31, 30, 30, 30, 29, 29, 28, 28, 27, 26,
- 26, 25, 25, 25, 25, 25, 39, 41, 43, 44, 46, 43, 41, 38, 36, 35, 33, 32,
- 31, 31, 30, 30, 29, 29, 29, 28, 28, 27, 27, 26, 26, 25, 25, 24, 24, 24,
- 24, 24, 39, 40, 42, 44, 46, 43, 41, 38, 36, 34, 33, 32, 31, 30, 29, 29,
- 28, 28, 28, 27, 27, 26, 26, 25, 25, 24, 24, 23, 23, 23, 23, 23, 38, 40,
- 42, 43, 45, 43, 40, 38, 36, 34, 33, 32, 30, 29, 29, 28, 27, 27, 27, 26,
- 26, 25, 25, 24, 24, 23, 23, 23, 22, 22, 22, 22, 37, 39, 41, 43, 45, 43,
- 40, 38, 36, 34, 33, 31, 30, 29, 28, 27, 27, 26, 26, 25, 25, 24, 24, 23,
- 23, 23, 22, 22, 21, 21, 21, 21, 36, 38, 40, 42, 44, 42, 40, 38, 36, 34,
- 33, 31, 29, 28, 27, 27, 26, 25, 25, 24, 24, 23, 23, 22, 22, 22, 21, 21,
- 20, 20, 20, 20, 35, 37, 39, 41, 43, 41, 39, 37, 35, 34, 32, 30, 29, 28,
- 27, 26, 25, 25, 24, 23, 23, 23, 22, 22, 21, 21, 21, 20, 20, 20, 20, 20,
- 34, 36, 38, 40, 42, 40, 39, 37, 35, 33, 32, 30, 29, 28, 27, 26, 25, 24,
- 23, 23, 22, 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, 19, 33, 35, 37, 39,
- 41, 39, 38, 36, 34, 33, 31, 30, 28, 27, 26, 25, 24, 23, 23, 22, 22, 21,
- 21, 20, 20, 20, 19, 19, 19, 19, 19, 19, 32, 34, 36, 38, 40, 38, 37, 35,
- 34, 32, 31, 29, 28, 27, 26, 25, 24, 23, 22, 22, 21, 21, 20, 20, 19, 19,
- 19, 18, 18, 18, 18, 18, 31, 33, 35, 37, 39, 37, 36, 34, 33, 32, 30, 29,
- 27, 26, 25, 24, 23, 23, 22, 21, 21, 20, 20, 19, 19, 18, 18, 18, 17, 17,
- 17, 17, 30, 32, 34, 36, 37, 36, 35, 33, 32, 31, 30, 28, 27, 26, 25, 24,
- 23, 22, 21, 21, 20, 20, 19, 19, 18, 18, 18, 17, 17, 17, 17, 17, 29, 31,
- 32, 34, 36, 35, 34, 33, 31, 30, 29, 28, 26, 25, 24, 23, 22, 22, 21, 20,
- 20, 19, 19, 18, 18, 17, 17, 17, 16, 16, 16, 16, 28, 29, 31, 33, 35, 34,
- 33, 32, 31, 29, 28, 27, 26, 25, 24, 23, 22, 21, 21, 20, 19, 19, 18, 18,
- 17, 17, 17, 16, 16, 16, 16, 16, 27, 28, 30, 32, 34, 33, 32, 31, 30, 29,
- 28, 26, 25, 24, 23, 23, 22, 21, 20, 20, 19, 18, 18, 17, 17, 17, 16, 16,
- 16, 16, 16, 16, 26, 27, 29, 31, 32, 32, 31, 30, 29, 28, 27, 26, 25, 24,
- 23, 22, 21, 21, 20, 19, 19, 18, 18, 17, 17, 16, 16, 16, 15, 15, 15, 15,
- 25, 26, 28, 30, 31, 30, 30, 29, 28, 27, 26, 25, 24, 23, 23, 22, 21, 20,
- 20, 19, 18, 18, 17, 17, 16, 16, 16, 15, 15, 15, 15, 15, 24, 25, 27, 29,
- 30, 29, 29, 28, 27, 26, 25, 25, 24, 23, 22, 21, 20, 20, 19, 19, 18, 17,
- 17, 16, 16, 16, 15, 15, 15, 15, 15, 15, 24, 25, 27, 29, 30, 29, 29, 28,
- 27, 26, 25, 25, 24, 23, 22, 21, 20, 20, 19, 19, 18, 17, 17, 16, 16, 16,
- 15, 15, 15, 15, 15, 15, 24, 25, 27, 29, 30, 29, 29, 28, 27, 26, 25, 25,
- 24, 23, 22, 21, 20, 20, 19, 19, 18, 17, 17, 16, 16, 16, 15, 15, 15, 15,
- 15, 15, 24, 25, 27, 29, 30, 29, 29, 28, 27, 26, 25, 25, 24, 23, 22, 21,
- 20, 20, 19, 19, 18, 17, 17, 16, 16, 16, 15, 15, 15, 15, 15, 15 },
- { /* Intra matrices */
- /* Size 4 */
- 175, 103, 93, 70, 103, 83, 76, 64, 93, 76, 55, 46, 70, 64, 46, 36,
- /* Size 8 */
- 162, 205, 104, 97, 90, 78, 67, 57, 205, 136, 102, 115, 111, 99, 86, 73,
- 104, 102, 84, 88, 88, 83, 75, 66, 97, 115, 88, 75, 71, 67, 62, 56, 90,
- 111, 88, 71, 62, 56, 52, 48, 78, 99, 83, 67, 56, 49, 45, 41, 67, 86, 75,
- 62, 52, 45, 40, 36, 57, 73, 66, 56, 48, 41, 36, 33,
- /* Size 16 */
- 168, 190, 213, 160, 108, 104, 101, 97, 93, 87, 81, 75, 69, 64, 59, 59,
- 190, 184, 177, 142, 107, 108, 110, 107, 104, 98, 92, 85, 79, 73, 67, 67,
- 213, 177, 141, 123, 106, 112, 119, 117, 115, 109, 103, 96, 89, 82, 76,
- 76, 160, 142, 123, 110, 96, 101, 105, 104, 103, 99, 94, 89, 83, 77, 72,
- 72, 108, 107, 106, 96, 87, 89, 91, 91, 91, 89, 86, 82, 77, 73, 68, 68,
- 104, 108, 112, 101, 89, 87, 85, 84, 82, 80, 78, 74, 71, 67, 63, 63, 101,
- 110, 119, 105, 91, 85, 78, 76, 74, 72, 70, 67, 64, 61, 58, 58, 97, 107,
- 117, 104, 91, 84, 76, 72, 69, 66, 64, 62, 59, 57, 54, 54, 93, 104, 115,
- 103, 91, 82, 74, 69, 64, 61, 58, 56, 54, 52, 50, 50, 87, 98, 109, 99,
- 89, 80, 72, 66, 61, 58, 55, 52, 50, 48, 46, 46, 81, 92, 103, 94, 86, 78,
- 70, 64, 58, 55, 51, 49, 46, 45, 43, 43, 75, 85, 96, 89, 82, 74, 67, 62,
- 56, 52, 49, 46, 44, 42, 40, 40, 69, 79, 89, 83, 77, 71, 64, 59, 54, 50,
- 46, 44, 41, 40, 38, 38, 64, 73, 82, 77, 73, 67, 61, 57, 52, 48, 45, 42,
- 40, 38, 36, 36, 59, 67, 76, 72, 68, 63, 58, 54, 50, 46, 43, 40, 38, 36,
- 34, 34, 59, 67, 76, 72, 68, 63, 58, 54, 50, 46, 43, 40, 38, 36, 34, 34,
- /* Size 32 */
- 171, 182, 194, 205, 217, 190, 163, 137, 110, 108, 106, 104, 103, 101,
- 99, 97, 95, 92, 89, 86, 83, 80, 77, 74, 71, 68, 65, 63, 60, 60, 60, 60,
- 182, 186, 190, 194, 198, 176, 154, 132, 109, 109, 108, 108, 107, 105,
- 104, 102, 100, 97, 94, 91, 88, 85, 82, 79, 76, 73, 70, 67, 64, 64, 64,
- 64, 194, 190, 187, 184, 180, 162, 144, 127, 109, 110, 110, 111, 112,
- 110, 109, 107, 106, 103, 100, 97, 94, 90, 87, 84, 80, 78, 75, 72, 69,
- 69, 69, 69, 205, 194, 184, 173, 162, 148, 135, 122, 108, 110, 112, 114,
- 116, 115, 114, 113, 111, 108, 105, 102, 99, 96, 92, 89, 85, 82, 79, 76,
- 73, 73, 73, 73, 217, 198, 180, 162, 144, 135, 126, 117, 108, 111, 114,
- 118, 121, 120, 119, 118, 117, 114, 111, 108, 104, 101, 97, 94, 90, 87,
- 84, 80, 77, 77, 77, 77, 190, 176, 162, 148, 135, 127, 119, 111, 103,
- 106, 108, 111, 114, 113, 112, 112, 111, 108, 106, 103, 100, 97, 94, 91,
- 87, 84, 81, 78, 75, 75, 75, 75, 163, 154, 144, 135, 126, 119, 112, 105,
- 98, 100, 103, 105, 107, 106, 106, 105, 105, 103, 101, 98, 96, 93, 90,
- 87, 85, 82, 79, 76, 73, 73, 73, 73, 137, 132, 127, 122, 117, 111, 105,
- 99, 94, 95, 97, 98, 100, 100, 99, 99, 99, 97, 95, 94, 92, 89, 87, 84,
- 82, 79, 76, 74, 71, 71, 71, 71, 110, 109, 109, 108, 108, 103, 98, 94,
- 89, 90, 91, 92, 93, 93, 93, 93, 93, 92, 90, 89, 87, 85, 83, 81, 79, 76,
- 74, 72, 69, 69, 69, 69, 108, 109, 110, 110, 111, 106, 100, 95, 90, 90,
- 90, 90, 89, 89, 89, 89, 89, 87, 86, 85, 83, 81, 79, 77, 75, 73, 71, 69,
- 67, 67, 67, 67, 106, 108, 110, 112, 114, 108, 103, 97, 91, 90, 89, 87,
- 86, 86, 85, 85, 84, 83, 82, 80, 79, 77, 76, 74, 72, 70, 68, 66, 64, 64,
- 64, 64, 104, 108, 111, 114, 118, 111, 105, 98, 92, 90, 87, 85, 83, 82,
- 81, 80, 79, 78, 77, 76, 75, 74, 72, 70, 69, 67, 65, 64, 62, 62, 62, 62,
- 103, 107, 112, 116, 121, 114, 107, 100, 93, 89, 86, 83, 80, 78, 77, 76,
- 75, 74, 73, 72, 71, 70, 68, 67, 66, 64, 63, 61, 60, 60, 60, 60, 101,
- 105, 110, 115, 120, 113, 106, 100, 93, 89, 86, 82, 78, 77, 75, 74, 72,
- 71, 70, 69, 68, 67, 65, 64, 63, 62, 60, 59, 57, 57, 57, 57, 99, 104,
- 109, 114, 119, 112, 106, 99, 93, 89, 85, 81, 77, 75, 74, 72, 70, 69, 68,
- 66, 65, 64, 63, 61, 60, 59, 58, 56, 55, 55, 55, 55, 97, 102, 107, 113,
- 118, 112, 105, 99, 93, 89, 85, 80, 76, 74, 72, 70, 67, 66, 65, 64, 62,
- 61, 60, 59, 58, 56, 55, 54, 53, 53, 53, 53, 95, 100, 106, 111, 117, 111,
- 105, 99, 93, 89, 84, 79, 75, 72, 70, 67, 65, 64, 62, 61, 59, 58, 57, 56,
- 55, 54, 53, 52, 51, 51, 51, 51, 92, 97, 103, 108, 114, 108, 103, 97, 92,
- 87, 83, 78, 74, 71, 69, 66, 64, 62, 61, 59, 57, 56, 55, 54, 53, 52, 51,
- 50, 49, 49, 49, 49, 89, 94, 100, 105, 111, 106, 101, 95, 90, 86, 82, 77,
- 73, 70, 68, 65, 62, 61, 59, 57, 56, 55, 53, 52, 51, 50, 49, 48, 47, 47,
- 47, 47, 86, 91, 97, 102, 108, 103, 98, 94, 89, 85, 80, 76, 72, 69, 66,
- 64, 61, 59, 57, 56, 54, 53, 52, 50, 49, 48, 47, 46, 45, 45, 45, 45, 83,
- 88, 94, 99, 104, 100, 96, 92, 87, 83, 79, 75, 71, 68, 65, 62, 59, 57,
- 56, 54, 52, 51, 50, 48, 47, 46, 45, 44, 44, 44, 44, 44, 80, 85, 90, 96,
- 101, 97, 93, 89, 85, 81, 77, 74, 70, 67, 64, 61, 58, 56, 55, 53, 51, 50,
- 48, 47, 46, 45, 44, 43, 42, 42, 42, 42, 77, 82, 87, 92, 97, 94, 90, 87,
- 83, 79, 76, 72, 68, 65, 63, 60, 57, 55, 53, 52, 50, 48, 47, 46, 45, 44,
- 43, 42, 41, 41, 41, 41, 74, 79, 84, 89, 94, 91, 87, 84, 81, 77, 74, 70,
- 67, 64, 61, 59, 56, 54, 52, 50, 48, 47, 46, 45, 43, 42, 42, 41, 40, 40,
- 40, 40, 71, 76, 80, 85, 90, 87, 85, 82, 79, 75, 72, 69, 66, 63, 60, 58,
- 55, 53, 51, 49, 47, 46, 45, 43, 42, 41, 40, 39, 38, 38, 38, 38, 68, 73,
- 78, 82, 87, 84, 82, 79, 76, 73, 70, 67, 64, 62, 59, 56, 54, 52, 50, 48,
- 46, 45, 44, 42, 41, 40, 39, 38, 37, 37, 37, 37, 65, 70, 75, 79, 84, 81,
- 79, 76, 74, 71, 68, 65, 63, 60, 58, 55, 53, 51, 49, 47, 45, 44, 43, 42,
- 40, 39, 38, 37, 37, 37, 37, 37, 63, 67, 72, 76, 80, 78, 76, 74, 72, 69,
- 66, 64, 61, 59, 56, 54, 52, 50, 48, 46, 44, 43, 42, 41, 39, 38, 37, 37,
- 36, 36, 36, 36, 60, 64, 69, 73, 77, 75, 73, 71, 69, 67, 64, 62, 60, 57,
- 55, 53, 51, 49, 47, 45, 44, 42, 41, 40, 38, 37, 37, 36, 35, 35, 35, 35,
- 60, 64, 69, 73, 77, 75, 73, 71, 69, 67, 64, 62, 60, 57, 55, 53, 51, 49,
- 47, 45, 44, 42, 41, 40, 38, 37, 37, 36, 35, 35, 35, 35, 60, 64, 69, 73,
- 77, 75, 73, 71, 69, 67, 64, 62, 60, 57, 55, 53, 51, 49, 47, 45, 44, 42,
- 41, 40, 38, 37, 37, 36, 35, 35, 35, 35, 60, 64, 69, 73, 77, 75, 73, 71,
- 69, 67, 64, 62, 60, 57, 55, 53, 51, 49, 47, 45, 44, 42, 41, 40, 38, 37,
- 37, 36, 35, 35, 35, 35 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 58, 34, 21, 58, 38, 26, 19, 34, 26, 18, 14, 21, 19, 14, 12,
- /* Size 8 */
- 64, 86, 80, 59, 43, 33, 25, 21, 86, 75, 78, 66, 51, 39, 30, 24, 80, 78,
- 55, 46, 39, 32, 27, 22, 59, 66, 46, 36, 30, 26, 23, 20, 43, 51, 39, 30,
- 25, 22, 19, 17, 33, 39, 32, 26, 22, 19, 17, 16, 25, 30, 27, 23, 19, 17,
- 16, 14, 21, 24, 22, 20, 17, 16, 14, 14,
- /* Size 16 */
- 64, 75, 86, 83, 80, 70, 59, 51, 43, 38, 33, 29, 25, 23, 21, 21, 75, 78,
- 81, 80, 79, 71, 63, 55, 47, 41, 36, 32, 28, 25, 23, 23, 86, 81, 75, 77,
- 78, 72, 66, 59, 51, 45, 39, 35, 30, 27, 24, 24, 83, 80, 77, 72, 67, 61,
- 56, 51, 45, 40, 36, 32, 29, 26, 23, 23, 80, 79, 78, 67, 55, 51, 46, 43,
- 39, 36, 32, 29, 27, 24, 22, 22, 70, 71, 72, 61, 51, 46, 41, 38, 35, 32,
- 29, 27, 25, 23, 21, 21, 59, 63, 66, 56, 46, 41, 36, 33, 30, 28, 26, 24,
- 23, 21, 20, 20, 51, 55, 59, 51, 43, 38, 33, 30, 28, 26, 24, 22, 21, 20,
- 19, 19, 43, 47, 51, 45, 39, 35, 30, 28, 25, 23, 22, 21, 19, 18, 17, 17,
- 38, 41, 45, 40, 36, 32, 28, 26, 23, 22, 20, 19, 18, 17, 17, 17, 33, 36,
- 39, 36, 32, 29, 26, 24, 22, 20, 19, 18, 17, 16, 16, 16, 29, 32, 35, 32,
- 29, 27, 24, 22, 21, 19, 18, 17, 16, 16, 15, 15, 25, 28, 30, 29, 27, 25,
- 23, 21, 19, 18, 17, 16, 16, 15, 14, 14, 23, 25, 27, 26, 24, 23, 21, 20,
- 18, 17, 16, 16, 15, 14, 14, 14, 21, 23, 24, 23, 22, 21, 20, 19, 17, 17,
- 16, 15, 14, 14, 14, 14, 21, 23, 24, 23, 22, 21, 20, 19, 17, 17, 16, 15,
- 14, 14, 14, 14,
- /* Size 32 */
- 64, 70, 75, 81, 86, 85, 83, 81, 80, 75, 70, 64, 59, 55, 51, 47, 43, 41,
- 38, 35, 33, 31, 29, 27, 25, 24, 23, 22, 21, 21, 21, 21, 70, 73, 77, 80,
- 84, 82, 81, 80, 79, 75, 70, 66, 61, 57, 53, 49, 45, 43, 40, 37, 34, 32,
- 30, 29, 27, 25, 24, 23, 22, 22, 22, 22, 75, 77, 78, 79, 81, 80, 80, 79,
- 79, 75, 71, 67, 63, 59, 55, 51, 47, 44, 41, 39, 36, 34, 32, 30, 28, 27,
- 25, 24, 23, 23, 23, 23, 81, 80, 79, 78, 78, 78, 78, 78, 79, 75, 72, 68,
- 65, 61, 57, 53, 49, 46, 43, 40, 37, 35, 33, 31, 29, 28, 26, 25, 24, 24,
- 24, 24, 86, 84, 81, 78, 75, 76, 77, 77, 78, 75, 72, 69, 66, 62, 59, 55,
- 51, 48, 45, 42, 39, 37, 35, 33, 30, 29, 27, 26, 24, 24, 24, 24, 85, 82,
- 80, 78, 76, 75, 74, 73, 72, 70, 67, 64, 61, 58, 55, 51, 48, 45, 43, 40,
- 37, 35, 33, 31, 29, 28, 27, 25, 24, 24, 24, 24, 83, 81, 80, 78, 77, 74,
- 72, 69, 67, 64, 61, 59, 56, 54, 51, 48, 45, 43, 40, 38, 36, 34, 32, 30,
- 29, 27, 26, 25, 23, 23, 23, 23, 81, 80, 79, 78, 77, 73, 69, 65, 61, 58,
- 56, 54, 51, 49, 47, 44, 42, 40, 38, 36, 34, 32, 31, 29, 28, 26, 25, 24,
- 23, 23, 23, 23, 80, 79, 79, 79, 78, 72, 67, 61, 55, 53, 51, 48, 46, 45,
- 43, 41, 39, 37, 36, 34, 32, 31, 29, 28, 27, 26, 24, 23, 22, 22, 22, 22,
- 75, 75, 75, 75, 75, 70, 64, 58, 53, 50, 48, 46, 44, 42, 40, 39, 37, 35,
- 34, 32, 31, 29, 28, 27, 26, 25, 24, 23, 22, 22, 22, 22, 70, 70, 71, 72,
- 72, 67, 61, 56, 51, 48, 46, 43, 41, 39, 38, 36, 35, 33, 32, 31, 29, 28,
- 27, 26, 25, 24, 23, 22, 21, 21, 21, 21, 64, 66, 67, 68, 69, 64, 59, 54,
- 48, 46, 43, 41, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23,
- 22, 21, 20, 20, 20, 20, 59, 61, 63, 65, 66, 61, 56, 51, 46, 44, 41, 38,
- 36, 34, 33, 32, 30, 29, 28, 27, 26, 25, 24, 23, 23, 22, 21, 20, 20, 20,
- 20, 20, 55, 57, 59, 61, 62, 58, 54, 49, 45, 42, 39, 37, 34, 33, 32, 30,
- 29, 28, 27, 26, 25, 24, 23, 23, 22, 21, 20, 20, 19, 19, 19, 19, 51, 53,
- 55, 57, 59, 55, 51, 47, 43, 40, 38, 35, 33, 32, 30, 29, 28, 27, 26, 25,
- 24, 23, 22, 22, 21, 20, 20, 19, 19, 19, 19, 19, 47, 49, 51, 53, 55, 51,
- 48, 44, 41, 39, 36, 34, 32, 30, 29, 28, 26, 25, 24, 24, 23, 22, 21, 21,
- 20, 20, 19, 19, 18, 18, 18, 18, 43, 45, 47, 49, 51, 48, 45, 42, 39, 37,
- 35, 32, 30, 29, 28, 26, 25, 24, 23, 22, 22, 21, 21, 20, 19, 19, 18, 18,
- 17, 17, 17, 17, 41, 43, 44, 46, 48, 45, 43, 40, 37, 35, 33, 31, 29, 28,
- 27, 25, 24, 23, 23, 22, 21, 20, 20, 19, 19, 18, 18, 17, 17, 17, 17, 17,
- 38, 40, 41, 43, 45, 43, 40, 38, 36, 34, 32, 30, 28, 27, 26, 24, 23, 23,
- 22, 21, 20, 20, 19, 19, 18, 18, 17, 17, 17, 17, 17, 17, 35, 37, 39, 40,
- 42, 40, 38, 36, 34, 32, 31, 29, 27, 26, 25, 24, 22, 22, 21, 20, 20, 19,
- 19, 18, 18, 17, 17, 17, 16, 16, 16, 16, 33, 34, 36, 37, 39, 37, 36, 34,
- 32, 31, 29, 28, 26, 25, 24, 23, 22, 21, 20, 20, 19, 18, 18, 18, 17, 17,
- 16, 16, 16, 16, 16, 16, 31, 32, 34, 35, 37, 35, 34, 32, 31, 29, 28, 27,
- 25, 24, 23, 22, 21, 20, 20, 19, 18, 18, 18, 17, 17, 16, 16, 16, 15, 15,
- 15, 15, 29, 30, 32, 33, 35, 33, 32, 31, 29, 28, 27, 26, 24, 23, 22, 21,
- 21, 20, 19, 19, 18, 18, 17, 17, 16, 16, 16, 15, 15, 15, 15, 15, 27, 29,
- 30, 31, 33, 31, 30, 29, 28, 27, 26, 25, 23, 23, 22, 21, 20, 19, 19, 18,
- 18, 17, 17, 16, 16, 16, 15, 15, 15, 15, 15, 15, 25, 27, 28, 29, 30, 29,
- 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 19, 18, 18, 17, 17, 16, 16,
- 16, 15, 15, 15, 14, 14, 14, 14, 24, 25, 27, 28, 29, 28, 27, 26, 26, 25,
- 24, 23, 22, 21, 20, 20, 19, 18, 18, 17, 17, 16, 16, 16, 15, 15, 15, 14,
- 14, 14, 14, 14, 23, 24, 25, 26, 27, 27, 26, 25, 24, 24, 23, 22, 21, 20,
- 20, 19, 18, 18, 17, 17, 16, 16, 16, 15, 15, 15, 14, 14, 14, 14, 14, 14,
- 22, 23, 24, 25, 26, 25, 25, 24, 23, 23, 22, 21, 20, 20, 19, 19, 18, 17,
- 17, 17, 16, 16, 15, 15, 15, 14, 14, 14, 14, 14, 14, 14, 21, 22, 23, 24,
- 24, 24, 23, 23, 22, 22, 21, 20, 20, 19, 19, 18, 17, 17, 17, 16, 16, 15,
- 15, 15, 14, 14, 14, 14, 14, 14, 14, 14, 21, 22, 23, 24, 24, 24, 23, 23,
- 22, 22, 21, 20, 20, 19, 19, 18, 17, 17, 17, 16, 16, 15, 15, 15, 14, 14,
- 14, 14, 14, 14, 14, 14, 21, 22, 23, 24, 24, 24, 23, 23, 22, 22, 21, 20,
- 20, 19, 19, 18, 17, 17, 17, 16, 16, 15, 15, 15, 14, 14, 14, 14, 14, 14,
- 14, 14, 21, 22, 23, 24, 24, 24, 23, 23, 22, 22, 21, 20, 20, 19, 19, 18,
- 17, 17, 17, 16, 16, 15, 15, 15, 14, 14, 14, 14, 14, 14, 14, 14 },
- { /* Intra matrices */
- /* Size 4 */
- 217, 196, 112, 65, 196, 124, 84, 58, 112, 84, 55, 43, 65, 58, 43, 34,
- /* Size 8 */
- 180, 246, 226, 167, 120, 88, 67, 53, 246, 212, 222, 187, 142, 107, 81,
- 64, 226, 222, 153, 128, 107, 87, 71, 58, 167, 187, 128, 97, 81, 69, 59,
- 50, 120, 142, 107, 81, 65, 56, 49, 44, 88, 107, 87, 69, 56, 48, 43, 39,
- 67, 81, 71, 59, 49, 43, 38, 35, 53, 64, 58, 50, 44, 39, 35, 32,
- /* Size 16 */
- 188, 223, 257, 246, 236, 205, 174, 150, 125, 108, 92, 81, 70, 63, 56,
- 56, 223, 231, 239, 237, 234, 209, 185, 161, 137, 119, 102, 90, 78, 70,
- 62, 62, 257, 239, 221, 227, 232, 214, 195, 172, 148, 130, 111, 98, 85,
- 76, 67, 67, 246, 237, 227, 211, 196, 180, 165, 148, 130, 116, 101, 90,
- 80, 72, 64, 64, 236, 234, 232, 196, 160, 147, 134, 123, 112, 102, 91,
- 83, 74, 67, 61, 61, 205, 209, 214, 180, 147, 133, 118, 108, 98, 90, 82,
- 75, 68, 62, 57, 57, 174, 185, 195, 165, 134, 118, 102, 93, 84, 78, 72,
- 67, 61, 57, 53, 53, 150, 161, 172, 148, 123, 108, 93, 85, 76, 71, 65,
- 61, 56, 53, 49, 49, 125, 137, 148, 130, 112, 98, 84, 76, 68, 64, 59, 55,
- 51, 49, 46, 46, 108, 119, 130, 116, 102, 90, 78, 71, 64, 59, 54, 51, 48,
- 46, 43, 43, 92, 102, 111, 101, 91, 82, 72, 65, 59, 54, 50, 47, 45, 42,
- 40, 40, 81, 90, 98, 90, 83, 75, 67, 61, 55, 51, 47, 45, 42, 40, 38, 38,
- 70, 78, 85, 80, 74, 68, 61, 56, 51, 48, 45, 42, 40, 38, 36, 36, 63, 70,
- 76, 72, 67, 62, 57, 53, 49, 46, 42, 40, 38, 37, 35, 35, 56, 62, 67, 64,
- 61, 57, 53, 49, 46, 43, 40, 38, 36, 35, 34, 34, 56, 62, 67, 64, 61, 57,
- 53, 49, 46, 43, 40, 38, 36, 35, 34, 34,
- /* Size 32 */
- 193, 210, 228, 245, 263, 258, 252, 247, 241, 226, 210, 194, 178, 166,
- 153, 141, 128, 120, 111, 103, 94, 89, 83, 77, 72, 68, 65, 61, 57, 57,
- 57, 57, 210, 221, 232, 243, 254, 250, 247, 244, 240, 226, 212, 198, 184,
- 171, 159, 146, 134, 125, 117, 108, 99, 93, 87, 82, 76, 72, 68, 64, 60,
- 60, 60, 60, 228, 232, 236, 240, 245, 243, 242, 241, 239, 227, 214, 202,
- 189, 177, 165, 152, 140, 131, 122, 113, 104, 98, 92, 86, 80, 75, 71, 67,
- 63, 63, 63, 63, 245, 243, 240, 238, 236, 236, 237, 238, 238, 227, 216,
- 205, 194, 182, 170, 158, 146, 137, 127, 118, 109, 103, 96, 90, 83, 79,
- 75, 70, 66, 66, 66, 66, 263, 254, 245, 236, 227, 229, 232, 235, 238,
- 228, 219, 209, 200, 188, 176, 164, 152, 142, 133, 123, 114, 107, 101,
- 94, 87, 83, 78, 73, 69, 69, 69, 69, 258, 250, 243, 236, 229, 227, 224,
- 222, 219, 210, 202, 193, 184, 174, 163, 153, 143, 134, 126, 117, 109,
- 103, 97, 90, 84, 80, 76, 71, 67, 67, 67, 67, 252, 247, 242, 237, 232,
- 224, 216, 208, 201, 193, 185, 177, 169, 160, 151, 142, 133, 126, 118,
- 111, 104, 98, 93, 87, 81, 77, 73, 69, 65, 65, 65, 65, 247, 244, 241,
- 238, 235, 222, 208, 195, 182, 175, 168, 160, 153, 146, 139, 131, 124,
- 118, 111, 105, 98, 93, 88, 83, 78, 75, 71, 67, 64, 64, 64, 64, 241, 240,
- 239, 238, 238, 219, 201, 182, 164, 157, 151, 144, 137, 132, 126, 120,
- 115, 109, 104, 99, 93, 89, 84, 80, 76, 72, 69, 65, 62, 62, 62, 62, 226,
- 226, 227, 227, 228, 210, 193, 175, 157, 150, 143, 136, 129, 124, 118,
- 113, 108, 103, 98, 93, 88, 84, 80, 76, 72, 69, 66, 63, 60, 60, 60, 60,
- 210, 212, 214, 216, 219, 202, 185, 168, 151, 143, 136, 128, 121, 116,
- 111, 106, 101, 96, 92, 88, 83, 80, 76, 73, 69, 66, 64, 61, 58, 58, 58,
- 58, 194, 198, 202, 205, 209, 193, 177, 160, 144, 136, 128, 120, 112,
- 108, 103, 98, 94, 90, 86, 82, 79, 75, 72, 69, 66, 64, 61, 59, 56, 56,
- 56, 56, 178, 184, 189, 194, 200, 184, 169, 153, 137, 129, 121, 112, 104,
- 100, 95, 91, 86, 83, 80, 77, 74, 71, 68, 66, 63, 61, 58, 56, 54, 54, 54,
- 54, 166, 171, 177, 182, 188, 174, 160, 146, 132, 124, 116, 108, 100, 95,
- 91, 87, 82, 79, 76, 73, 70, 68, 65, 63, 60, 58, 56, 54, 52, 52, 52, 52,
- 153, 159, 165, 170, 176, 163, 151, 139, 126, 118, 111, 103, 95, 91, 87,
- 82, 78, 75, 73, 70, 67, 65, 62, 60, 58, 56, 54, 52, 50, 50, 50, 50, 141,
- 146, 152, 158, 164, 153, 142, 131, 120, 113, 106, 98, 91, 87, 82, 78,
- 74, 71, 69, 66, 63, 61, 59, 57, 55, 54, 52, 50, 49, 49, 49, 49, 128,
- 134, 140, 146, 152, 143, 133, 124, 115, 108, 101, 94, 86, 82, 78, 74,
- 70, 68, 65, 63, 60, 58, 56, 54, 53, 51, 50, 48, 47, 47, 47, 47, 120,
- 125, 131, 137, 142, 134, 126, 118, 109, 103, 96, 90, 83, 79, 75, 71, 68,
- 65, 63, 60, 58, 56, 54, 53, 51, 50, 48, 47, 45, 45, 45, 45, 111, 117,
- 122, 127, 133, 126, 118, 111, 104, 98, 92, 86, 80, 76, 73, 69, 65, 63,
- 60, 58, 56, 54, 52, 51, 49, 48, 47, 45, 44, 44, 44, 44, 103, 108, 113,
- 118, 123, 117, 111, 105, 99, 93, 88, 82, 77, 73, 70, 66, 63, 60, 58, 56,
- 53, 52, 50, 49, 47, 46, 45, 44, 43, 43, 43, 43, 94, 99, 104, 109, 114,
- 109, 104, 98, 93, 88, 83, 79, 74, 70, 67, 63, 60, 58, 56, 53, 51, 50,
- 48, 47, 46, 44, 43, 42, 41, 41, 41, 41, 89, 93, 98, 103, 107, 103, 98,
- 93, 89, 84, 80, 75, 71, 68, 65, 61, 58, 56, 54, 52, 50, 49, 47, 46, 44,
- 43, 42, 41, 40, 40, 40, 40, 83, 87, 92, 96, 101, 97, 93, 88, 84, 80, 76,
- 72, 68, 65, 62, 59, 56, 54, 52, 50, 48, 47, 46, 44, 43, 42, 41, 40, 39,
- 39, 39, 39, 77, 82, 86, 90, 94, 90, 87, 83, 80, 76, 73, 69, 66, 63, 60,
- 57, 54, 53, 51, 49, 47, 46, 44, 43, 42, 41, 40, 39, 38, 38, 38, 38, 72,
- 76, 80, 83, 87, 84, 81, 78, 76, 72, 69, 66, 63, 60, 58, 55, 53, 51, 49,
- 47, 46, 44, 43, 42, 41, 40, 39, 38, 37, 37, 37, 37, 68, 72, 75, 79, 83,
- 80, 77, 75, 72, 69, 66, 64, 61, 58, 56, 54, 51, 50, 48, 46, 44, 43, 42,
- 41, 40, 39, 38, 37, 37, 37, 37, 37, 65, 68, 71, 75, 78, 76, 73, 71, 69,
- 66, 64, 61, 58, 56, 54, 52, 50, 48, 47, 45, 43, 42, 41, 40, 39, 38, 37,
- 37, 36, 36, 36, 36, 61, 64, 67, 70, 73, 71, 69, 67, 65, 63, 61, 59, 56,
- 54, 52, 50, 48, 47, 45, 44, 42, 41, 40, 39, 38, 37, 37, 36, 35, 35, 35,
- 35, 57, 60, 63, 66, 69, 67, 65, 64, 62, 60, 58, 56, 54, 52, 50, 49, 47,
- 45, 44, 43, 41, 40, 39, 38, 37, 37, 36, 35, 34, 34, 34, 34, 57, 60, 63,
- 66, 69, 67, 65, 64, 62, 60, 58, 56, 54, 52, 50, 49, 47, 45, 44, 43, 41,
- 40, 39, 38, 37, 37, 36, 35, 34, 34, 34, 34, 57, 60, 63, 66, 69, 67, 65,
- 64, 62, 60, 58, 56, 54, 52, 50, 49, 47, 45, 44, 43, 41, 40, 39, 38, 37,
- 37, 36, 35, 34, 34, 34, 34, 57, 60, 63, 66, 69, 67, 65, 64, 62, 60, 58,
- 56, 54, 52, 50, 49, 47, 45, 44, 43, 41, 40, 39, 38, 37, 37, 36, 35, 34,
- 34, 34, 34 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 39, 36, 28, 39, 32, 30, 26, 36, 30, 23, 20, 28, 26, 20, 16,
- /* Size 8 */
- 64, 80, 43, 40, 37, 33, 29, 25, 80, 55, 42, 47, 45, 41, 36, 31, 43, 42,
- 35, 37, 37, 35, 32, 29, 40, 47, 37, 32, 31, 29, 27, 25, 37, 45, 37, 31,
- 27, 25, 24, 22, 33, 41, 35, 29, 25, 23, 21, 20, 29, 36, 32, 27, 24, 21,
- 19, 18, 25, 31, 29, 25, 22, 20, 18, 17,
- /* Size 16 */
- 64, 72, 80, 61, 43, 41, 40, 39, 37, 35, 33, 31, 29, 27, 25, 25, 72, 70,
- 67, 55, 42, 43, 43, 42, 41, 39, 37, 35, 32, 30, 28, 28, 80, 67, 55, 48,
- 42, 44, 47, 46, 45, 43, 41, 38, 36, 34, 31, 31, 61, 55, 48, 43, 39, 40,
- 42, 41, 41, 39, 38, 36, 34, 32, 30, 30, 43, 42, 42, 39, 35, 36, 37, 37,
- 37, 36, 35, 33, 32, 30, 29, 29, 41, 43, 44, 40, 36, 35, 34, 34, 34, 33,
- 32, 31, 30, 28, 27, 27, 40, 43, 47, 42, 37, 34, 32, 31, 31, 30, 29, 28,
- 27, 26, 25, 25, 39, 42, 46, 41, 37, 34, 31, 30, 29, 28, 27, 26, 25, 25,
- 24, 24, 37, 41, 45, 41, 37, 34, 31, 29, 27, 26, 25, 24, 24, 23, 22, 22,
- 35, 39, 43, 39, 36, 33, 30, 28, 26, 25, 24, 23, 22, 22, 21, 21, 33, 37,
- 41, 38, 35, 32, 29, 27, 25, 24, 23, 22, 21, 20, 20, 20, 31, 35, 38, 36,
- 33, 31, 28, 26, 24, 23, 22, 21, 20, 19, 19, 19, 29, 32, 36, 34, 32, 30,
- 27, 25, 24, 22, 21, 20, 19, 18, 18, 18, 27, 30, 34, 32, 30, 28, 26, 25,
- 23, 22, 20, 19, 18, 18, 17, 17, 25, 28, 31, 30, 29, 27, 25, 24, 22, 21,
- 20, 19, 18, 17, 17, 17, 25, 28, 31, 30, 29, 27, 25, 24, 22, 21, 20, 19,
- 18, 17, 17, 17,
- /* Size 32 */
- 64, 68, 72, 76, 80, 71, 61, 52, 43, 42, 41, 41, 40, 39, 39, 38, 37, 36,
- 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 25, 25, 25, 68, 69, 71, 72,
- 74, 66, 58, 50, 43, 42, 42, 42, 42, 41, 41, 40, 39, 38, 37, 36, 35, 34,
- 33, 32, 31, 30, 29, 28, 27, 27, 27, 27, 72, 71, 70, 68, 67, 61, 55, 49,
- 42, 43, 43, 43, 43, 43, 42, 42, 41, 40, 39, 38, 37, 36, 35, 34, 32, 31,
- 30, 29, 28, 28, 28, 28, 76, 72, 68, 65, 61, 56, 52, 47, 42, 43, 44, 44,
- 45, 45, 44, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 33, 32, 31, 30, 30,
- 30, 30, 80, 74, 67, 61, 55, 51, 48, 45, 42, 43, 44, 45, 47, 46, 46, 46,
- 45, 44, 43, 42, 41, 40, 38, 37, 36, 35, 34, 33, 31, 31, 31, 31, 71, 66,
- 61, 56, 51, 49, 46, 43, 40, 41, 42, 43, 44, 44, 44, 43, 43, 42, 41, 40,
- 39, 38, 37, 36, 35, 34, 33, 32, 31, 31, 31, 31, 61, 58, 55, 52, 48, 46,
- 43, 41, 39, 39, 40, 41, 42, 42, 41, 41, 41, 40, 39, 39, 38, 37, 36, 35,
- 34, 33, 32, 31, 30, 30, 30, 30, 52, 50, 49, 47, 45, 43, 41, 39, 37, 38,
- 38, 39, 39, 39, 39, 39, 39, 38, 38, 37, 36, 36, 35, 34, 33, 32, 31, 30,
- 29, 29, 29, 29, 43, 43, 42, 42, 42, 40, 39, 37, 35, 36, 36, 36, 37, 37,
- 37, 37, 37, 36, 36, 35, 35, 34, 33, 33, 32, 31, 30, 29, 29, 29, 29, 29,
- 42, 42, 43, 43, 43, 41, 39, 38, 36, 36, 36, 36, 36, 36, 35, 35, 35, 35,
- 34, 34, 33, 33, 32, 31, 31, 30, 29, 28, 28, 28, 28, 28, 41, 42, 43, 44,
- 44, 42, 40, 38, 36, 36, 35, 35, 34, 34, 34, 34, 34, 33, 33, 32, 32, 31,
- 31, 30, 30, 29, 28, 28, 27, 27, 27, 27, 41, 42, 43, 44, 45, 43, 41, 39,
- 36, 36, 35, 34, 33, 33, 33, 32, 32, 32, 31, 31, 31, 30, 30, 29, 28, 28,
- 27, 27, 26, 26, 26, 26, 40, 42, 43, 45, 47, 44, 42, 39, 37, 36, 34, 33,
- 32, 32, 31, 31, 31, 30, 30, 30, 29, 29, 28, 28, 27, 27, 26, 26, 25, 25,
- 25, 25, 39, 41, 43, 45, 46, 44, 42, 39, 37, 36, 34, 33, 32, 31, 31, 30,
- 30, 29, 29, 29, 28, 28, 27, 27, 26, 26, 25, 25, 24, 24, 24, 24, 39, 41,
- 42, 44, 46, 44, 41, 39, 37, 35, 34, 33, 31, 31, 30, 29, 29, 28, 28, 28,
- 27, 27, 26, 26, 25, 25, 25, 24, 24, 24, 24, 24, 38, 40, 42, 44, 46, 43,
- 41, 39, 37, 35, 34, 32, 31, 30, 29, 29, 28, 27, 27, 27, 26, 26, 25, 25,
- 25, 24, 24, 23, 23, 23, 23, 23, 37, 39, 41, 43, 45, 43, 41, 39, 37, 35,
- 34, 32, 31, 30, 29, 28, 27, 27, 26, 26, 25, 25, 24, 24, 24, 23, 23, 22,
- 22, 22, 22, 22, 36, 38, 40, 42, 44, 42, 40, 38, 36, 35, 33, 32, 30, 29,
- 28, 27, 27, 26, 26, 25, 24, 24, 24, 23, 23, 23, 22, 22, 21, 21, 21, 21,
- 35, 37, 39, 41, 43, 41, 39, 38, 36, 34, 33, 31, 30, 29, 28, 27, 26, 26,
- 25, 24, 24, 23, 23, 23, 22, 22, 22, 21, 21, 21, 21, 21, 34, 36, 38, 40,
- 42, 40, 39, 37, 35, 34, 32, 31, 30, 29, 28, 27, 26, 25, 24, 24, 23, 23,
- 22, 22, 22, 21, 21, 21, 20, 20, 20, 20, 33, 35, 37, 39, 41, 39, 38, 36,
- 35, 33, 32, 31, 29, 28, 27, 26, 25, 24, 24, 23, 23, 22, 22, 21, 21, 21,
- 20, 20, 20, 20, 20, 20, 32, 34, 36, 38, 40, 38, 37, 36, 34, 33, 31, 30,
- 29, 28, 27, 26, 25, 24, 23, 23, 22, 22, 21, 21, 20, 20, 20, 19, 19, 19,
- 19, 19, 31, 33, 35, 37, 38, 37, 36, 35, 33, 32, 31, 30, 28, 27, 26, 25,
- 24, 24, 23, 22, 22, 21, 21, 20, 20, 20, 19, 19, 19, 19, 19, 19, 30, 32,
- 34, 35, 37, 36, 35, 34, 33, 31, 30, 29, 28, 27, 26, 25, 24, 23, 23, 22,
- 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 18, 29, 31, 32, 34, 36, 35,
- 34, 33, 32, 31, 30, 28, 27, 26, 25, 25, 24, 23, 22, 22, 21, 20, 20, 20,
- 19, 19, 18, 18, 18, 18, 18, 18, 28, 30, 31, 33, 35, 34, 33, 32, 31, 30,
- 29, 28, 27, 26, 25, 24, 23, 23, 22, 21, 21, 20, 20, 19, 19, 18, 18, 18,
- 18, 18, 18, 18, 27, 29, 30, 32, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25,
- 25, 24, 23, 22, 22, 21, 20, 20, 19, 19, 18, 18, 18, 18, 17, 17, 17, 17,
- 26, 28, 29, 31, 33, 32, 31, 30, 29, 28, 28, 27, 26, 25, 24, 23, 22, 22,
- 21, 21, 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, 17, 17, 25, 27, 28, 30,
- 31, 31, 30, 29, 29, 28, 27, 26, 25, 24, 24, 23, 22, 21, 21, 20, 20, 19,
- 19, 18, 18, 18, 17, 17, 17, 17, 17, 17, 25, 27, 28, 30, 31, 31, 30, 29,
- 29, 28, 27, 26, 25, 24, 24, 23, 22, 21, 21, 20, 20, 19, 19, 18, 18, 18,
- 17, 17, 17, 17, 17, 17, 25, 27, 28, 30, 31, 31, 30, 29, 29, 28, 27, 26,
- 25, 24, 24, 23, 22, 21, 21, 20, 20, 19, 19, 18, 18, 18, 17, 17, 17, 17,
- 17, 17, 25, 27, 28, 30, 31, 31, 30, 29, 29, 28, 27, 26, 25, 24, 24, 23,
- 22, 21, 21, 20, 20, 19, 19, 18, 18, 18, 17, 17, 17, 17, 17, 17 },
- { /* Intra matrices */
- /* Size 4 */
- 162, 98, 89, 68, 98, 80, 74, 63, 89, 74, 55, 47, 68, 63, 47, 38,
- /* Size 8 */
- 151, 190, 99, 93, 86, 76, 66, 57, 190, 128, 97, 108, 105, 94, 82, 71,
- 99, 97, 81, 84, 85, 80, 72, 64, 93, 108, 84, 73, 69, 66, 61, 56, 86,
- 105, 85, 69, 61, 56, 52, 49, 76, 94, 80, 66, 56, 50, 46, 43, 66, 82, 72,
- 61, 52, 46, 41, 38, 57, 71, 64, 56, 49, 43, 38, 35,
- /* Size 16 */
- 156, 176, 196, 149, 102, 99, 96, 92, 89, 83, 78, 73, 68, 63, 58, 58,
- 176, 170, 164, 133, 101, 103, 104, 101, 99, 93, 88, 82, 76, 71, 66, 66,
- 196, 164, 132, 116, 100, 106, 112, 110, 108, 103, 97, 91, 85, 79, 73,
- 73, 149, 133, 116, 104, 92, 96, 99, 99, 98, 94, 90, 85, 80, 75, 70, 70,
- 102, 101, 100, 92, 84, 85, 87, 87, 87, 85, 82, 79, 75, 71, 67, 67, 99,
- 103, 106, 96, 85, 83, 81, 80, 79, 77, 75, 72, 69, 66, 62, 62, 96, 104,
- 112, 99, 87, 81, 76, 74, 71, 70, 68, 66, 63, 61, 58, 58, 92, 101, 110,
- 99, 87, 80, 74, 70, 67, 65, 63, 61, 59, 56, 54, 54, 89, 99, 108, 98, 87,
- 79, 71, 67, 63, 60, 58, 56, 54, 52, 50, 50, 83, 93, 103, 94, 85, 77, 70,
- 65, 60, 57, 55, 53, 51, 49, 47, 47, 78, 88, 97, 90, 82, 75, 68, 63, 58,
- 55, 51, 49, 47, 46, 44, 44, 73, 82, 91, 85, 79, 72, 66, 61, 56, 53, 49,
- 47, 45, 43, 42, 42, 68, 76, 85, 80, 75, 69, 63, 59, 54, 51, 47, 45, 43,
- 41, 39, 39, 63, 71, 79, 75, 71, 66, 61, 56, 52, 49, 46, 43, 41, 39, 38,
- 38, 58, 66, 73, 70, 67, 62, 58, 54, 50, 47, 44, 42, 39, 38, 36, 36, 58,
- 66, 73, 70, 67, 62, 58, 54, 50, 47, 44, 42, 39, 38, 36, 36,
- /* Size 32 */
- 158, 169, 179, 189, 199, 175, 152, 128, 104, 102, 101, 99, 97, 96, 94,
- 92, 90, 88, 85, 82, 79, 77, 74, 71, 69, 66, 64, 62, 59, 59, 59, 59, 169,
- 172, 176, 179, 183, 163, 143, 123, 103, 103, 102, 102, 101, 100, 98, 97,
- 95, 93, 90, 87, 84, 82, 79, 76, 73, 71, 68, 66, 63, 63, 63, 63, 179,
- 176, 173, 170, 167, 151, 135, 119, 103, 104, 104, 105, 106, 104, 103,
- 102, 100, 97, 95, 92, 89, 86, 83, 81, 78, 75, 72, 70, 67, 67, 67, 67,
- 189, 179, 170, 160, 150, 138, 126, 114, 102, 104, 106, 108, 110, 109,
- 107, 106, 105, 102, 100, 97, 94, 91, 88, 85, 82, 79, 76, 74, 71, 71, 71,
- 71, 199, 183, 167, 150, 134, 126, 118, 110, 102, 105, 108, 111, 114,
- 113, 112, 111, 110, 107, 105, 102, 99, 96, 93, 90, 86, 84, 81, 78, 75,
- 75, 75, 75, 175, 163, 151, 138, 126, 119, 112, 105, 98, 100, 103, 105,
- 107, 107, 106, 106, 105, 102, 100, 98, 95, 92, 90, 87, 84, 81, 78, 76,
- 73, 73, 73, 73, 152, 143, 135, 126, 118, 112, 106, 100, 94, 95, 97, 99,
- 101, 101, 100, 100, 100, 98, 96, 94, 91, 89, 86, 84, 81, 79, 76, 74, 71,
- 71, 71, 71, 128, 123, 119, 114, 110, 105, 100, 95, 89, 91, 92, 94, 95,
- 95, 95, 94, 94, 93, 91, 89, 88, 85, 83, 81, 79, 76, 74, 72, 69, 69, 69,
- 69, 104, 103, 103, 102, 102, 98, 94, 89, 85, 86, 87, 88, 89, 89, 89, 89,
- 89, 88, 86, 85, 84, 82, 80, 78, 76, 74, 72, 70, 68, 68, 68, 68, 102,
- 103, 104, 104, 105, 100, 95, 91, 86, 86, 86, 86, 86, 85, 85, 85, 85, 84,
- 83, 81, 80, 78, 77, 75, 73, 71, 69, 67, 66, 66, 66, 66, 101, 102, 104,
- 106, 108, 103, 97, 92, 87, 86, 85, 84, 83, 82, 82, 81, 81, 80, 79, 78,
- 77, 75, 73, 72, 70, 69, 67, 65, 63, 63, 63, 63, 99, 102, 105, 108, 111,
- 105, 99, 94, 88, 86, 84, 82, 80, 79, 78, 78, 77, 76, 75, 74, 73, 71, 70,
- 69, 67, 66, 64, 63, 61, 61, 61, 61, 97, 101, 106, 110, 114, 107, 101,
- 95, 89, 86, 83, 80, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 64,
- 63, 62, 60, 59, 59, 59, 59, 96, 100, 104, 109, 113, 107, 101, 95, 89,
- 85, 82, 79, 76, 74, 73, 72, 70, 69, 68, 68, 67, 65, 64, 63, 62, 61, 60,
- 58, 57, 57, 57, 57, 94, 98, 103, 107, 112, 106, 100, 95, 89, 85, 82, 78,
- 75, 73, 72, 70, 68, 67, 66, 65, 64, 63, 62, 61, 60, 58, 57, 56, 55, 55,
- 55, 55, 92, 97, 102, 106, 111, 106, 100, 94, 89, 85, 81, 78, 74, 72, 70,
- 68, 66, 65, 64, 63, 61, 60, 59, 58, 57, 56, 55, 54, 53, 53, 53, 53, 90,
- 95, 100, 105, 110, 105, 100, 94, 89, 85, 81, 77, 73, 70, 68, 66, 64, 63,
- 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 51, 51, 51, 88, 93, 97, 102,
- 107, 102, 98, 93, 88, 84, 80, 76, 72, 69, 67, 65, 63, 61, 60, 59, 57,
- 56, 55, 54, 53, 52, 51, 50, 49, 49, 49, 49, 85, 90, 95, 100, 105, 100,
- 96, 91, 86, 83, 79, 75, 71, 68, 66, 64, 61, 60, 58, 57, 56, 55, 53, 52,
- 51, 51, 50, 49, 48, 48, 48, 48, 82, 87, 92, 97, 102, 98, 94, 89, 85, 81,
- 78, 74, 70, 68, 65, 63, 60, 59, 57, 55, 54, 53, 52, 51, 50, 49, 48, 47,
- 46, 46, 46, 46, 79, 84, 89, 94, 99, 95, 91, 88, 84, 80, 77, 73, 69, 67,
- 64, 61, 59, 57, 56, 54, 52, 51, 50, 49, 48, 47, 46, 46, 45, 45, 45, 45,
- 77, 82, 86, 91, 96, 92, 89, 85, 82, 78, 75, 71, 68, 65, 63, 60, 58, 56,
- 55, 53, 51, 50, 49, 48, 47, 46, 45, 44, 44, 44, 44, 44, 74, 79, 83, 88,
- 93, 90, 86, 83, 80, 77, 73, 70, 67, 64, 62, 59, 57, 55, 53, 52, 50, 49,
- 48, 47, 46, 45, 44, 43, 42, 42, 42, 42, 71, 76, 81, 85, 90, 87, 84, 81,
- 78, 75, 72, 69, 66, 63, 61, 58, 56, 54, 52, 51, 49, 48, 47, 46, 45, 44,
- 43, 42, 41, 41, 41, 41, 69, 73, 78, 82, 86, 84, 81, 79, 76, 73, 70, 67,
- 64, 62, 60, 57, 55, 53, 51, 50, 48, 47, 46, 45, 43, 43, 42, 41, 40, 40,
- 40, 40, 66, 71, 75, 79, 84, 81, 79, 76, 74, 71, 69, 66, 63, 61, 58, 56,
- 54, 52, 51, 49, 47, 46, 45, 44, 43, 42, 41, 40, 39, 39, 39, 39, 64, 68,
- 72, 76, 81, 78, 76, 74, 72, 69, 67, 64, 62, 60, 57, 55, 53, 51, 50, 48,
- 46, 45, 44, 43, 42, 41, 40, 39, 38, 38, 38, 38, 62, 66, 70, 74, 78, 76,
- 74, 72, 70, 67, 65, 63, 60, 58, 56, 54, 52, 50, 49, 47, 46, 44, 43, 42,
- 41, 40, 39, 38, 38, 38, 38, 38, 59, 63, 67, 71, 75, 73, 71, 69, 68, 66,
- 63, 61, 59, 57, 55, 53, 51, 49, 48, 46, 45, 44, 42, 41, 40, 39, 38, 38,
- 37, 37, 37, 37, 59, 63, 67, 71, 75, 73, 71, 69, 68, 66, 63, 61, 59, 57,
- 55, 53, 51, 49, 48, 46, 45, 44, 42, 41, 40, 39, 38, 38, 37, 37, 37, 37,
- 59, 63, 67, 71, 75, 73, 71, 69, 68, 66, 63, 61, 59, 57, 55, 53, 51, 49,
- 48, 46, 45, 44, 42, 41, 40, 39, 38, 38, 37, 37, 37, 37, 59, 63, 67, 71,
- 75, 73, 71, 69, 68, 66, 63, 61, 59, 57, 55, 53, 51, 49, 48, 46, 45, 44,
- 42, 41, 40, 39, 38, 38, 37, 37, 37, 37 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 58, 35, 23, 58, 39, 28, 21, 35, 28, 20, 16, 23, 21, 16, 14,
- /* Size 8 */
- 64, 85, 79, 60, 44, 34, 27, 23, 85, 74, 78, 66, 52, 40, 32, 26, 79, 78,
- 55, 47, 40, 34, 29, 24, 60, 66, 47, 37, 32, 28, 25, 22, 44, 52, 40, 32,
- 27, 24, 22, 20, 34, 40, 34, 28, 24, 21, 19, 18, 27, 32, 29, 25, 22, 19,
- 18, 17, 23, 26, 24, 22, 20, 18, 17, 16,
- /* Size 16 */
- 64, 75, 85, 82, 79, 69, 60, 52, 44, 39, 34, 31, 27, 25, 23, 23, 75, 77,
- 80, 79, 78, 71, 63, 55, 48, 43, 37, 33, 30, 27, 25, 25, 85, 80, 74, 76,
- 78, 72, 66, 59, 52, 46, 40, 36, 32, 29, 26, 26, 82, 79, 76, 71, 66, 62,
- 57, 51, 46, 42, 37, 34, 30, 28, 25, 25, 79, 78, 78, 66, 55, 51, 47, 44,
- 40, 37, 34, 31, 29, 26, 24, 24, 69, 71, 72, 62, 51, 47, 42, 39, 36, 33,
- 31, 29, 27, 25, 23, 23, 60, 63, 66, 57, 47, 42, 37, 34, 32, 30, 28, 26,
- 25, 23, 22, 22, 52, 55, 59, 51, 44, 39, 34, 32, 29, 28, 26, 24, 23, 22,
- 21, 21, 44, 48, 52, 46, 40, 36, 32, 29, 27, 25, 24, 23, 22, 21, 20, 20,
- 39, 43, 46, 42, 37, 33, 30, 28, 25, 24, 22, 21, 20, 20, 19, 19, 34, 37,
- 40, 37, 34, 31, 28, 26, 24, 22, 21, 20, 19, 19, 18, 18, 31, 33, 36, 34,
- 31, 29, 26, 24, 23, 21, 20, 19, 19, 18, 17, 17, 27, 30, 32, 30, 29, 27,
- 25, 23, 22, 20, 19, 19, 18, 17, 17, 17, 25, 27, 29, 28, 26, 25, 23, 22,
- 21, 20, 19, 18, 17, 17, 16, 16, 23, 25, 26, 25, 24, 23, 22, 21, 20, 19,
- 18, 17, 17, 16, 16, 16, 23, 25, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17,
- 17, 16, 16, 16,
- /* Size 32 */
- 64, 69, 75, 80, 85, 84, 82, 80, 79, 74, 69, 64, 60, 56, 52, 48, 44, 42,
- 39, 37, 34, 32, 31, 29, 27, 26, 25, 24, 23, 23, 23, 23, 69, 73, 76, 79,
- 83, 82, 81, 80, 78, 74, 70, 66, 61, 58, 54, 50, 46, 44, 41, 38, 36, 34,
- 32, 30, 29, 27, 26, 25, 24, 24, 24, 24, 75, 76, 77, 79, 80, 79, 79, 79,
- 78, 74, 71, 67, 63, 59, 55, 52, 48, 45, 43, 40, 37, 35, 33, 32, 30, 28,
- 27, 26, 25, 25, 25, 25, 80, 79, 79, 78, 77, 77, 77, 78, 78, 75, 71, 68,
- 65, 61, 57, 54, 50, 47, 44, 41, 39, 37, 35, 33, 31, 30, 28, 27, 26, 26,
- 26, 26, 85, 83, 80, 77, 74, 75, 76, 77, 78, 75, 72, 69, 66, 63, 59, 55,
- 52, 49, 46, 43, 40, 38, 36, 34, 32, 31, 29, 28, 26, 26, 26, 26, 84, 82,
- 79, 77, 75, 74, 74, 73, 72, 69, 67, 64, 61, 58, 55, 52, 49, 46, 44, 41,
- 39, 37, 35, 33, 31, 30, 29, 27, 26, 26, 26, 26, 82, 81, 79, 77, 76, 74,
- 71, 69, 66, 64, 62, 59, 57, 54, 51, 49, 46, 44, 42, 39, 37, 35, 34, 32,
- 30, 29, 28, 27, 25, 25, 25, 25, 80, 80, 79, 78, 77, 73, 69, 65, 61, 59,
- 56, 54, 52, 50, 48, 45, 43, 41, 39, 37, 35, 34, 32, 31, 29, 28, 27, 26,
- 25, 25, 25, 25, 79, 78, 78, 78, 78, 72, 66, 61, 55, 53, 51, 49, 47, 46,
- 44, 42, 40, 39, 37, 36, 34, 33, 31, 30, 29, 27, 26, 25, 24, 24, 24, 24,
- 74, 74, 74, 75, 75, 69, 64, 59, 53, 51, 49, 47, 45, 43, 41, 40, 38, 37,
- 35, 34, 32, 31, 30, 29, 28, 27, 26, 25, 24, 24, 24, 24, 69, 70, 71, 71,
- 72, 67, 62, 56, 51, 49, 47, 44, 42, 41, 39, 38, 36, 35, 33, 32, 31, 30,
- 29, 28, 27, 26, 25, 24, 23, 23, 23, 23, 64, 66, 67, 68, 69, 64, 59, 54,
- 49, 47, 44, 42, 40, 38, 37, 35, 34, 33, 32, 31, 29, 28, 28, 27, 26, 25,
- 24, 23, 23, 23, 23, 23, 60, 61, 63, 65, 66, 61, 57, 52, 47, 45, 42, 40,
- 37, 36, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 25, 24, 23, 23, 22, 22,
- 22, 22, 56, 58, 59, 61, 63, 58, 54, 50, 46, 43, 41, 38, 36, 34, 33, 32,
- 31, 30, 29, 28, 27, 26, 25, 25, 24, 23, 23, 22, 21, 21, 21, 21, 52, 54,
- 55, 57, 59, 55, 51, 48, 44, 41, 39, 37, 34, 33, 32, 31, 29, 28, 28, 27,
- 26, 25, 24, 24, 23, 23, 22, 21, 21, 21, 21, 21, 48, 50, 52, 54, 55, 52,
- 49, 45, 42, 40, 38, 35, 33, 32, 31, 29, 28, 27, 26, 26, 25, 24, 24, 23,
- 22, 22, 21, 21, 20, 20, 20, 20, 44, 46, 48, 50, 52, 49, 46, 43, 40, 38,
- 36, 34, 32, 31, 29, 28, 27, 26, 25, 25, 24, 23, 23, 22, 22, 21, 21, 20,
- 20, 20, 20, 20, 42, 44, 45, 47, 49, 46, 44, 41, 39, 37, 35, 33, 31, 30,
- 28, 27, 26, 25, 25, 24, 23, 23, 22, 22, 21, 21, 20, 20, 19, 19, 19, 19,
- 39, 41, 43, 44, 46, 44, 42, 39, 37, 35, 33, 32, 30, 29, 28, 26, 25, 25,
- 24, 23, 22, 22, 21, 21, 20, 20, 20, 19, 19, 19, 19, 19, 37, 38, 40, 41,
- 43, 41, 39, 37, 36, 34, 32, 31, 29, 28, 27, 26, 25, 24, 23, 22, 22, 21,
- 21, 20, 20, 20, 19, 19, 19, 19, 19, 19, 34, 36, 37, 39, 40, 39, 37, 35,
- 34, 32, 31, 29, 28, 27, 26, 25, 24, 23, 22, 22, 21, 21, 20, 20, 19, 19,
- 19, 18, 18, 18, 18, 18, 32, 34, 35, 37, 38, 37, 35, 34, 33, 31, 30, 28,
- 27, 26, 25, 24, 23, 23, 22, 21, 21, 20, 20, 19, 19, 19, 18, 18, 18, 18,
- 18, 18, 31, 32, 33, 35, 36, 35, 34, 32, 31, 30, 29, 28, 26, 25, 24, 24,
- 23, 22, 21, 21, 20, 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, 17, 29, 30,
- 32, 33, 34, 33, 32, 31, 30, 29, 28, 27, 25, 25, 24, 23, 22, 22, 21, 20,
- 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, 17, 17, 27, 29, 30, 31, 32, 31,
- 30, 29, 29, 28, 27, 26, 25, 24, 23, 22, 22, 21, 20, 20, 19, 19, 19, 18,
- 18, 18, 17, 17, 17, 17, 17, 17, 26, 27, 28, 30, 31, 30, 29, 28, 27, 27,
- 26, 25, 24, 23, 23, 22, 21, 21, 20, 20, 19, 19, 18, 18, 18, 17, 17, 17,
- 17, 17, 17, 17, 25, 26, 27, 28, 29, 29, 28, 27, 26, 26, 25, 24, 23, 23,
- 22, 21, 21, 20, 20, 19, 19, 18, 18, 18, 17, 17, 17, 17, 16, 16, 16, 16,
- 24, 25, 26, 27, 28, 27, 27, 26, 25, 25, 24, 23, 23, 22, 21, 21, 20, 20,
- 19, 19, 18, 18, 18, 17, 17, 17, 17, 16, 16, 16, 16, 16, 23, 24, 25, 26,
- 26, 26, 25, 25, 24, 24, 23, 23, 22, 21, 21, 20, 20, 19, 19, 19, 18, 18,
- 17, 17, 17, 17, 16, 16, 16, 16, 16, 16, 23, 24, 25, 26, 26, 26, 25, 25,
- 24, 24, 23, 23, 22, 21, 21, 20, 20, 19, 19, 19, 18, 18, 17, 17, 17, 17,
- 16, 16, 16, 16, 16, 16, 23, 24, 25, 26, 26, 26, 25, 25, 24, 24, 23, 23,
- 22, 21, 21, 20, 20, 19, 19, 19, 18, 18, 17, 17, 17, 17, 16, 16, 16, 16,
- 16, 16, 23, 24, 25, 26, 26, 26, 25, 25, 24, 24, 23, 23, 22, 21, 21, 20,
- 20, 19, 19, 19, 18, 18, 17, 17, 17, 17, 16, 16, 16, 16, 16, 16 },
- { /* Intra matrices */
- /* Size 4 */
- 192, 174, 103, 63, 174, 113, 79, 57, 103, 79, 55, 44, 63, 57, 44, 37,
- /* Size 8 */
- 160, 216, 199, 149, 109, 82, 65, 53, 216, 187, 195, 166, 128, 98, 77,
- 62, 199, 195, 137, 116, 98, 81, 67, 57, 149, 166, 116, 90, 76, 66, 57,
- 50, 109, 128, 98, 76, 63, 55, 49, 45, 82, 98, 81, 66, 55, 48, 44, 40,
- 65, 77, 67, 57, 49, 44, 40, 37, 53, 62, 57, 50, 45, 40, 37, 35,
- /* Size 16 */
- 167, 195, 224, 216, 207, 181, 155, 134, 113, 99, 85, 76, 67, 61, 55, 55,
- 195, 202, 209, 207, 205, 184, 164, 143, 123, 108, 94, 84, 74, 67, 60,
- 60, 224, 209, 194, 199, 203, 188, 172, 153, 133, 117, 102, 91, 80, 72,
- 65, 65, 216, 207, 199, 186, 173, 160, 147, 132, 118, 106, 93, 84, 75,
- 68, 62, 62, 207, 205, 203, 173, 143, 132, 121, 112, 102, 94, 85, 78, 70,
- 65, 59, 59, 181, 184, 188, 160, 132, 120, 107, 99, 91, 84, 77, 71, 65,
- 60, 56, 56, 155, 164, 172, 147, 121, 107, 94, 86, 79, 74, 69, 64, 60,
- 56, 53, 53, 134, 143, 153, 132, 112, 99, 86, 79, 72, 68, 63, 59, 56, 53,
- 50, 50, 113, 123, 133, 118, 102, 91, 79, 72, 66, 62, 57, 54, 51, 49, 47,
- 47, 99, 108, 117, 106, 94, 84, 74, 68, 62, 58, 54, 51, 48, 46, 44, 44,
- 85, 94, 102, 93, 85, 77, 69, 63, 57, 54, 50, 48, 46, 44, 42, 42, 76, 84,
- 91, 84, 78, 71, 64, 59, 54, 51, 48, 46, 44, 42, 40, 40, 67, 74, 80, 75,
- 70, 65, 60, 56, 51, 48, 46, 44, 42, 40, 39, 39, 61, 67, 72, 68, 65, 60,
- 56, 53, 49, 46, 44, 42, 40, 39, 38, 38, 55, 60, 65, 62, 59, 56, 53, 50,
- 47, 44, 42, 40, 39, 38, 36, 36, 55, 60, 65, 62, 59, 56, 53, 50, 47, 44,
- 42, 40, 39, 38, 36, 36,
- /* Size 32 */
- 170, 185, 200, 214, 229, 225, 220, 215, 211, 198, 185, 171, 158, 147,
- 137, 126, 116, 109, 101, 94, 87, 83, 78, 73, 69, 66, 62, 59, 56, 56, 56,
- 56, 185, 194, 203, 212, 221, 219, 216, 213, 210, 198, 186, 174, 163,
- 152, 142, 131, 121, 113, 106, 99, 91, 87, 82, 77, 72, 69, 65, 62, 59,
- 59, 59, 59, 200, 203, 207, 210, 214, 213, 212, 210, 209, 199, 188, 178,
- 167, 157, 146, 136, 126, 118, 111, 103, 96, 90, 85, 80, 75, 72, 68, 65,
- 61, 61, 61, 61, 214, 212, 210, 208, 206, 207, 207, 208, 209, 199, 190,
- 181, 172, 161, 151, 141, 131, 123, 115, 108, 100, 94, 89, 84, 78, 75,
- 71, 67, 64, 64, 64, 64, 229, 221, 214, 206, 199, 201, 203, 205, 208,
- 200, 192, 184, 176, 166, 156, 146, 136, 128, 120, 112, 104, 98, 93, 87,
- 81, 78, 74, 70, 66, 66, 66, 66, 225, 219, 213, 207, 201, 199, 197, 194,
- 192, 185, 178, 170, 163, 154, 145, 137, 128, 121, 114, 107, 100, 95, 89,
- 84, 79, 75, 72, 68, 65, 65, 65, 65, 220, 216, 212, 207, 203, 197, 190,
- 183, 177, 170, 163, 157, 150, 142, 135, 128, 120, 114, 108, 102, 95, 91,
- 86, 81, 77, 73, 70, 67, 63, 63, 63, 63, 215, 213, 210, 208, 205, 194,
- 183, 172, 161, 155, 149, 143, 137, 131, 125, 118, 112, 107, 102, 96, 91,
- 87, 83, 78, 74, 71, 68, 65, 62, 62, 62, 62, 211, 210, 209, 209, 208,
- 192, 177, 161, 146, 140, 135, 129, 124, 119, 114, 109, 105, 100, 96, 91,
- 87, 83, 79, 75, 72, 69, 66, 63, 60, 60, 60, 60, 198, 198, 199, 199, 200,
- 185, 170, 155, 140, 134, 128, 123, 117, 112, 108, 103, 99, 95, 91, 87,
- 82, 79, 76, 72, 69, 66, 64, 61, 59, 59, 59, 59, 185, 186, 188, 190, 192,
- 178, 163, 149, 135, 128, 122, 116, 110, 105, 101, 97, 93, 89, 86, 82,
- 78, 75, 72, 69, 66, 64, 62, 59, 57, 57, 57, 57, 171, 174, 178, 181, 184,
- 170, 157, 143, 129, 123, 116, 109, 103, 99, 95, 91, 87, 84, 81, 77, 74,
- 72, 69, 66, 64, 62, 60, 57, 55, 55, 55, 55, 158, 163, 167, 172, 176,
- 163, 150, 137, 124, 117, 110, 103, 96, 92, 88, 85, 81, 78, 75, 73, 70,
- 68, 66, 63, 61, 59, 57, 55, 54, 54, 54, 54, 147, 152, 157, 161, 166,
- 154, 142, 131, 119, 112, 105, 99, 92, 88, 85, 81, 77, 75, 72, 70, 67,
- 65, 63, 61, 59, 57, 55, 54, 52, 52, 52, 52, 137, 142, 146, 151, 156,
- 145, 135, 125, 114, 108, 101, 95, 88, 85, 81, 78, 74, 72, 69, 67, 64,
- 62, 61, 59, 57, 55, 54, 52, 51, 51, 51, 51, 126, 131, 136, 141, 146,
- 137, 128, 118, 109, 103, 97, 91, 85, 81, 78, 74, 71, 68, 66, 64, 61, 60,
- 58, 56, 55, 53, 52, 50, 49, 49, 49, 49, 116, 121, 126, 131, 136, 128,
- 120, 112, 105, 99, 93, 87, 81, 77, 74, 71, 67, 65, 63, 61, 59, 57, 56,
- 54, 52, 51, 50, 49, 48, 48, 48, 48, 109, 113, 118, 123, 128, 121, 114,
- 107, 100, 95, 89, 84, 78, 75, 72, 68, 65, 63, 61, 59, 57, 55, 54, 52,
- 51, 50, 49, 48, 46, 46, 46, 46, 101, 106, 111, 115, 120, 114, 108, 102,
- 96, 91, 86, 81, 75, 72, 69, 66, 63, 61, 59, 57, 55, 54, 52, 51, 49, 48,
- 47, 46, 45, 45, 45, 45, 94, 99, 103, 108, 112, 107, 102, 96, 91, 87, 82,
- 77, 73, 70, 67, 64, 61, 59, 57, 55, 53, 52, 51, 49, 48, 47, 46, 45, 44,
- 44, 44, 44, 87, 91, 96, 100, 104, 100, 95, 91, 87, 82, 78, 74, 70, 67,
- 64, 61, 59, 57, 55, 53, 51, 50, 49, 48, 47, 46, 45, 44, 43, 43, 43, 43,
- 83, 87, 90, 94, 98, 95, 91, 87, 83, 79, 75, 72, 68, 65, 62, 60, 57, 55,
- 54, 52, 50, 49, 48, 47, 45, 45, 44, 43, 42, 42, 42, 42, 78, 82, 85, 89,
- 93, 89, 86, 83, 79, 76, 72, 69, 66, 63, 61, 58, 56, 54, 52, 51, 49, 48,
- 47, 46, 44, 44, 43, 42, 41, 41, 41, 41, 73, 77, 80, 84, 87, 84, 81, 78,
- 75, 72, 69, 66, 63, 61, 59, 56, 54, 52, 51, 49, 48, 47, 46, 45, 43, 43,
- 42, 41, 40, 40, 40, 40, 69, 72, 75, 78, 81, 79, 77, 74, 72, 69, 66, 64,
- 61, 59, 57, 55, 52, 51, 49, 48, 47, 45, 44, 43, 42, 42, 41, 40, 40, 40,
- 40, 40, 66, 69, 72, 75, 78, 75, 73, 71, 69, 66, 64, 62, 59, 57, 55, 53,
- 51, 50, 48, 47, 46, 45, 44, 43, 42, 41, 40, 40, 39, 39, 39, 39, 62, 65,
- 68, 71, 74, 72, 70, 68, 66, 64, 62, 60, 57, 55, 54, 52, 50, 49, 47, 46,
- 45, 44, 43, 42, 41, 40, 40, 39, 38, 38, 38, 38, 59, 62, 65, 67, 70, 68,
- 67, 65, 63, 61, 59, 57, 55, 54, 52, 50, 49, 48, 46, 45, 44, 43, 42, 41,
- 40, 40, 39, 38, 38, 38, 38, 38, 56, 59, 61, 64, 66, 65, 63, 62, 60, 59,
- 57, 55, 54, 52, 51, 49, 48, 46, 45, 44, 43, 42, 41, 40, 40, 39, 38, 38,
- 37, 37, 37, 37, 56, 59, 61, 64, 66, 65, 63, 62, 60, 59, 57, 55, 54, 52,
- 51, 49, 48, 46, 45, 44, 43, 42, 41, 40, 40, 39, 38, 38, 37, 37, 37, 37,
- 56, 59, 61, 64, 66, 65, 63, 62, 60, 59, 57, 55, 54, 52, 51, 49, 48, 46,
- 45, 44, 43, 42, 41, 40, 40, 39, 38, 38, 37, 37, 37, 37, 56, 59, 61, 64,
- 66, 65, 63, 62, 60, 59, 57, 55, 54, 52, 51, 49, 48, 46, 45, 44, 43, 42,
- 41, 40, 40, 39, 38, 38, 37, 37, 37, 37 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 40, 37, 29, 40, 34, 32, 27, 37, 32, 25, 22, 29, 27, 22, 18,
- /* Size 8 */
- 64, 79, 44, 41, 39, 35, 31, 27, 79, 55, 43, 47, 46, 42, 37, 33, 44, 43,
- 37, 38, 38, 36, 33, 30, 41, 47, 38, 34, 32, 31, 29, 27, 39, 46, 38, 32,
- 29, 27, 25, 24, 35, 42, 36, 31, 27, 24, 23, 21, 31, 37, 33, 29, 25, 23,
- 21, 20, 27, 33, 30, 27, 24, 21, 20, 19,
- /* Size 16 */
- 64, 72, 79, 62, 44, 42, 41, 40, 39, 37, 35, 33, 31, 29, 27, 27, 72, 69,
- 67, 55, 43, 44, 44, 43, 42, 40, 38, 36, 34, 32, 30, 30, 79, 67, 55, 49,
- 43, 45, 47, 47, 46, 44, 42, 39, 37, 35, 33, 33, 62, 55, 49, 44, 40, 41,
- 43, 42, 42, 41, 39, 37, 35, 33, 31, 31, 44, 43, 43, 40, 37, 37, 38, 38,
- 38, 37, 36, 35, 33, 32, 30, 30, 42, 44, 45, 41, 37, 37, 36, 35, 35, 34,
- 33, 32, 31, 30, 28, 28, 41, 44, 47, 43, 38, 36, 34, 33, 32, 31, 31, 30,
- 29, 28, 27, 27, 40, 43, 47, 42, 38, 35, 33, 32, 30, 29, 29, 28, 27, 26,
- 25, 25, 39, 42, 46, 42, 38, 35, 32, 30, 29, 28, 27, 26, 25, 25, 24, 24,
- 37, 40, 44, 41, 37, 34, 31, 29, 28, 27, 26, 25, 24, 23, 23, 23, 35, 38,
- 42, 39, 36, 33, 31, 29, 27, 26, 24, 24, 23, 22, 21, 21, 33, 36, 39, 37,
- 35, 32, 30, 28, 26, 25, 24, 23, 22, 21, 21, 21, 31, 34, 37, 35, 33, 31,
- 29, 27, 25, 24, 23, 22, 21, 20, 20, 20, 29, 32, 35, 33, 32, 30, 28, 26,
- 25, 23, 22, 21, 20, 20, 19, 19, 27, 30, 33, 31, 30, 28, 27, 25, 24, 23,
- 21, 21, 20, 19, 19, 19, 27, 30, 33, 31, 30, 28, 27, 25, 24, 23, 21, 21,
- 20, 19, 19, 19,
- /* Size 32 */
- 64, 68, 72, 75, 79, 70, 62, 53, 44, 43, 42, 42, 41, 41, 40, 39, 39, 38,
- 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 27, 27, 27, 68, 69, 71, 72,
- 73, 66, 58, 51, 43, 43, 43, 43, 43, 42, 42, 41, 40, 39, 38, 37, 36, 35,
- 34, 33, 32, 31, 30, 29, 28, 28, 28, 28, 72, 71, 69, 68, 67, 61, 55, 49,
- 43, 44, 44, 44, 44, 44, 43, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33,
- 32, 31, 30, 30, 30, 30, 75, 72, 68, 65, 61, 57, 52, 48, 43, 44, 44, 45,
- 46, 45, 45, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 33, 32, 31, 31,
- 31, 31, 79, 73, 67, 61, 55, 52, 49, 46, 43, 44, 45, 46, 47, 47, 47, 46,
- 46, 45, 44, 43, 42, 41, 39, 38, 37, 36, 35, 34, 33, 33, 33, 33, 70, 66,
- 61, 57, 52, 49, 47, 44, 41, 42, 43, 44, 45, 45, 44, 44, 44, 43, 42, 41,
- 40, 39, 38, 37, 36, 35, 34, 33, 32, 32, 32, 32, 62, 58, 55, 52, 49, 47,
- 44, 42, 40, 40, 41, 42, 43, 42, 42, 42, 42, 41, 41, 40, 39, 38, 37, 36,
- 35, 34, 33, 32, 31, 31, 31, 31, 53, 51, 49, 48, 46, 44, 42, 40, 38, 39,
- 39, 40, 40, 40, 40, 40, 40, 39, 39, 38, 38, 37, 36, 35, 34, 33, 32, 32,
- 31, 31, 31, 31, 44, 43, 43, 43, 43, 41, 40, 38, 37, 37, 37, 38, 38, 38,
- 38, 38, 38, 38, 37, 37, 36, 35, 35, 34, 33, 32, 32, 31, 30, 30, 30, 30,
- 43, 43, 44, 44, 44, 42, 40, 39, 37, 37, 37, 37, 37, 37, 37, 37, 37, 36,
- 36, 35, 35, 34, 33, 33, 32, 31, 31, 30, 29, 29, 29, 29, 42, 43, 44, 44,
- 45, 43, 41, 39, 37, 37, 37, 36, 36, 36, 35, 35, 35, 35, 34, 34, 33, 33,
- 32, 32, 31, 30, 30, 29, 28, 28, 28, 28, 42, 43, 44, 45, 46, 44, 42, 40,
- 38, 37, 36, 35, 35, 34, 34, 34, 33, 33, 33, 32, 32, 31, 31, 30, 30, 29,
- 29, 28, 28, 28, 28, 28, 41, 43, 44, 46, 47, 45, 43, 40, 38, 37, 36, 35,
- 34, 33, 33, 32, 32, 32, 31, 31, 31, 30, 30, 29, 29, 28, 28, 27, 27, 27,
- 27, 27, 41, 42, 44, 45, 47, 45, 42, 40, 38, 37, 36, 34, 33, 33, 32, 32,
- 31, 31, 30, 30, 30, 29, 29, 28, 28, 27, 27, 27, 26, 26, 26, 26, 40, 42,
- 43, 45, 47, 44, 42, 40, 38, 37, 35, 34, 33, 32, 32, 31, 30, 30, 29, 29,
- 29, 28, 28, 27, 27, 27, 26, 26, 25, 25, 25, 25, 39, 41, 43, 45, 46, 44,
- 42, 40, 38, 37, 35, 34, 32, 32, 31, 30, 29, 29, 29, 28, 28, 27, 27, 27,
- 26, 26, 25, 25, 25, 25, 25, 25, 39, 40, 42, 44, 46, 44, 42, 40, 38, 37,
- 35, 33, 32, 31, 30, 29, 29, 28, 28, 27, 27, 26, 26, 26, 25, 25, 25, 24,
- 24, 24, 24, 24, 38, 39, 41, 43, 45, 43, 41, 39, 38, 36, 35, 33, 32, 31,
- 30, 29, 28, 28, 27, 27, 26, 26, 25, 25, 25, 24, 24, 24, 23, 23, 23, 23,
- 37, 38, 40, 42, 44, 42, 41, 39, 37, 36, 34, 33, 31, 30, 29, 29, 28, 27,
- 27, 26, 26, 25, 25, 24, 24, 24, 23, 23, 23, 23, 23, 23, 36, 37, 39, 41,
- 43, 41, 40, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 27, 26, 26, 25, 25,
- 24, 24, 23, 23, 23, 22, 22, 22, 22, 22, 35, 36, 38, 40, 42, 40, 39, 38,
- 36, 35, 33, 32, 31, 30, 29, 28, 27, 26, 26, 25, 24, 24, 24, 23, 23, 22,
- 22, 22, 21, 21, 21, 21, 34, 35, 37, 39, 41, 39, 38, 37, 35, 34, 33, 31,
- 30, 29, 28, 27, 26, 26, 25, 25, 24, 24, 23, 23, 22, 22, 22, 21, 21, 21,
- 21, 21, 33, 34, 36, 38, 39, 38, 37, 36, 35, 33, 32, 31, 30, 29, 28, 27,
- 26, 25, 25, 24, 24, 23, 23, 22, 22, 22, 21, 21, 21, 21, 21, 21, 32, 33,
- 35, 37, 38, 37, 36, 35, 34, 33, 32, 30, 29, 28, 27, 27, 26, 25, 24, 24,
- 23, 23, 22, 22, 21, 21, 21, 21, 20, 20, 20, 20, 31, 32, 34, 35, 37, 36,
- 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 25, 24, 23, 23, 22, 22, 21,
- 21, 21, 20, 20, 20, 20, 20, 20, 30, 31, 33, 34, 36, 35, 34, 33, 32, 31,
- 30, 29, 28, 27, 27, 26, 25, 24, 24, 23, 22, 22, 22, 21, 21, 20, 20, 20,
- 19, 19, 19, 19, 29, 30, 32, 33, 35, 34, 33, 32, 32, 31, 30, 29, 28, 27,
- 26, 25, 25, 24, 23, 23, 22, 22, 21, 21, 20, 20, 20, 19, 19, 19, 19, 19,
- 28, 29, 31, 32, 34, 33, 32, 32, 31, 30, 29, 28, 27, 27, 26, 25, 24, 24,
- 23, 22, 22, 21, 21, 21, 20, 20, 19, 19, 19, 19, 19, 19, 27, 28, 30, 31,
- 33, 32, 31, 31, 30, 29, 28, 28, 27, 26, 25, 25, 24, 23, 23, 22, 21, 21,
- 21, 20, 20, 19, 19, 19, 19, 19, 19, 19, 27, 28, 30, 31, 33, 32, 31, 31,
- 30, 29, 28, 28, 27, 26, 25, 25, 24, 23, 23, 22, 21, 21, 21, 20, 20, 19,
- 19, 19, 19, 19, 19, 19, 27, 28, 30, 31, 33, 32, 31, 31, 30, 29, 28, 28,
- 27, 26, 25, 25, 24, 23, 23, 22, 21, 21, 21, 20, 20, 19, 19, 19, 19, 19,
- 19, 19, 27, 28, 30, 31, 33, 32, 31, 31, 30, 29, 28, 28, 27, 26, 25, 25,
- 24, 23, 23, 22, 21, 21, 21, 20, 20, 19, 19, 19, 19, 19, 19, 19 },
- { /* Intra matrices */
- /* Size 4 */
- 152, 94, 86, 67, 94, 77, 72, 62, 86, 72, 55, 48, 67, 62, 48, 40,
- /* Size 8 */
- 141, 176, 95, 89, 83, 74, 65, 57, 176, 120, 93, 103, 100, 90, 80, 70,
- 95, 93, 79, 81, 82, 77, 71, 64, 89, 103, 81, 71, 68, 65, 61, 56, 83,
- 100, 82, 68, 60, 56, 53, 49, 74, 90, 77, 65, 56, 50, 47, 44, 65, 80, 71,
- 61, 53, 47, 43, 40, 57, 70, 64, 56, 49, 44, 40, 37,
- /* Size 16 */
- 145, 163, 181, 139, 97, 94, 91, 88, 85, 81, 76, 71, 66, 62, 58, 58, 163,
- 158, 152, 124, 96, 98, 99, 96, 94, 89, 84, 79, 74, 70, 65, 65, 181, 152,
- 124, 110, 95, 101, 106, 104, 103, 98, 93, 87, 82, 77, 72, 72, 139, 124,
- 110, 99, 88, 91, 95, 94, 93, 90, 86, 82, 77, 73, 69, 69, 97, 96, 95, 88,
- 81, 82, 84, 84, 84, 82, 80, 76, 73, 69, 65, 65, 94, 98, 101, 91, 82, 80,
- 79, 78, 77, 75, 73, 70, 68, 65, 62, 62, 91, 99, 106, 95, 84, 79, 74, 72,
- 70, 68, 67, 65, 63, 60, 58, 58, 88, 96, 104, 94, 84, 78, 72, 69, 66, 64,
- 62, 60, 58, 56, 54, 54, 85, 94, 103, 93, 84, 77, 70, 66, 62, 60, 58, 56,
- 54, 52, 51, 51, 81, 89, 98, 90, 82, 75, 68, 64, 60, 57, 55, 53, 51, 50,
- 48, 48, 76, 84, 93, 86, 80, 73, 67, 62, 58, 55, 52, 50, 48, 47, 45, 45,
- 71, 79, 87, 82, 76, 70, 65, 60, 56, 53, 50, 48, 46, 45, 43, 43, 66, 74,
- 82, 77, 73, 68, 63, 58, 54, 51, 48, 46, 44, 43, 41, 41, 62, 70, 77, 73,
- 69, 65, 60, 56, 52, 50, 47, 45, 43, 41, 40, 40, 58, 65, 72, 69, 65, 62,
- 58, 54, 51, 48, 45, 43, 41, 40, 38, 38, 58, 65, 72, 69, 65, 62, 58, 54,
- 51, 48, 45, 43, 41, 40, 38, 38,
- /* Size 32 */
- 147, 156, 165, 175, 184, 163, 141, 120, 99, 97, 96, 94, 93, 91, 90, 88,
- 87, 84, 82, 79, 77, 75, 72, 70, 67, 65, 63, 61, 59, 59, 59, 59, 156,
- 160, 163, 166, 169, 151, 134, 116, 98, 98, 97, 97, 97, 95, 94, 92, 91,
- 89, 86, 84, 81, 79, 76, 74, 71, 69, 67, 65, 62, 62, 62, 62, 165, 163,
- 160, 157, 155, 140, 126, 112, 98, 98, 99, 100, 100, 99, 98, 97, 95, 93,
- 91, 88, 86, 83, 80, 78, 75, 73, 71, 68, 66, 66, 66, 66, 175, 166, 157,
- 149, 140, 129, 119, 108, 97, 99, 101, 102, 104, 103, 102, 101, 100, 97,
- 95, 93, 90, 87, 85, 82, 79, 77, 74, 72, 69, 69, 69, 69, 184, 169, 155,
- 140, 126, 118, 111, 104, 97, 100, 102, 105, 108, 107, 106, 105, 104,
- 102, 99, 97, 94, 92, 89, 86, 83, 81, 78, 75, 73, 73, 73, 73, 163, 151,
- 140, 129, 118, 112, 106, 99, 93, 95, 98, 100, 102, 101, 101, 100, 100,
- 97, 95, 93, 91, 88, 86, 83, 81, 78, 76, 74, 71, 71, 71, 71, 141, 134,
- 126, 119, 111, 106, 100, 95, 89, 91, 93, 95, 96, 96, 96, 95, 95, 93, 91,
- 89, 88, 85, 83, 81, 79, 76, 74, 72, 70, 70, 70, 70, 120, 116, 112, 108,
- 104, 99, 95, 90, 86, 87, 88, 89, 91, 91, 90, 90, 90, 89, 87, 86, 84, 82,
- 80, 78, 76, 74, 72, 70, 68, 68, 68, 68, 99, 98, 98, 97, 97, 93, 89, 86,
- 82, 83, 84, 84, 85, 85, 85, 85, 85, 84, 83, 82, 81, 79, 77, 76, 74, 72,
- 70, 68, 66, 66, 66, 66, 97, 98, 98, 99, 100, 95, 91, 87, 83, 83, 83, 83,
- 82, 82, 82, 82, 82, 81, 80, 79, 78, 76, 74, 73, 71, 70, 68, 66, 64, 64,
- 64, 64, 96, 97, 99, 101, 102, 98, 93, 88, 84, 83, 82, 81, 80, 79, 79,
- 79, 78, 77, 76, 75, 74, 73, 71, 70, 69, 67, 66, 64, 63, 63, 63, 63, 94,
- 97, 100, 102, 105, 100, 95, 89, 84, 83, 81, 79, 77, 77, 76, 75, 75, 74,
- 73, 72, 71, 70, 69, 67, 66, 65, 63, 62, 61, 61, 61, 61, 93, 97, 100,
- 104, 108, 102, 96, 91, 85, 82, 80, 77, 75, 74, 73, 72, 71, 70, 69, 68,
- 68, 67, 66, 65, 64, 62, 61, 60, 59, 59, 59, 59, 91, 95, 99, 103, 107,
- 101, 96, 91, 85, 82, 79, 77, 74, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63,
- 62, 61, 60, 59, 58, 57, 57, 57, 57, 90, 94, 98, 102, 106, 101, 96, 90,
- 85, 82, 79, 76, 73, 71, 70, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58,
- 57, 56, 55, 55, 55, 55, 88, 92, 97, 101, 105, 100, 95, 90, 85, 82, 79,
- 75, 72, 70, 68, 67, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53,
- 53, 53, 53, 87, 91, 95, 100, 104, 100, 95, 90, 85, 82, 78, 75, 71, 69,
- 67, 65, 63, 62, 61, 60, 58, 58, 57, 56, 55, 54, 53, 52, 52, 52, 52, 52,
- 84, 89, 93, 97, 102, 97, 93, 89, 84, 81, 77, 74, 70, 68, 66, 64, 62, 61,
- 59, 58, 57, 56, 55, 54, 53, 53, 52, 51, 50, 50, 50, 50, 82, 86, 91, 95,
- 99, 95, 91, 87, 83, 80, 76, 73, 69, 67, 65, 63, 61, 59, 58, 57, 56, 55,
- 54, 53, 52, 51, 50, 50, 49, 49, 49, 49, 79, 84, 88, 93, 97, 93, 89, 86,
- 82, 79, 75, 72, 68, 66, 64, 62, 60, 58, 57, 56, 54, 53, 52, 51, 50, 50,
- 49, 48, 47, 47, 47, 47, 77, 81, 86, 90, 94, 91, 88, 84, 81, 78, 74, 71,
- 68, 65, 63, 61, 58, 57, 56, 54, 53, 52, 51, 50, 49, 48, 47, 47, 46, 46,
- 46, 46, 75, 79, 83, 87, 92, 88, 85, 82, 79, 76, 73, 70, 67, 64, 62, 60,
- 58, 56, 55, 53, 52, 51, 50, 49, 48, 47, 46, 46, 45, 45, 45, 45, 72, 76,
- 80, 85, 89, 86, 83, 80, 77, 74, 71, 69, 66, 63, 61, 59, 57, 55, 54, 52,
- 51, 50, 49, 48, 47, 46, 45, 45, 44, 44, 44, 44, 70, 74, 78, 82, 86, 83,
- 81, 78, 76, 73, 70, 67, 65, 62, 60, 58, 56, 54, 53, 51, 50, 49, 48, 47,
- 46, 45, 44, 44, 43, 43, 43, 43, 67, 71, 75, 79, 83, 81, 79, 76, 74, 71,
- 69, 66, 64, 61, 59, 57, 55, 53, 52, 50, 49, 48, 47, 46, 45, 44, 43, 43,
- 42, 42, 42, 42, 65, 69, 73, 77, 81, 78, 76, 74, 72, 70, 67, 65, 62, 60,
- 58, 56, 54, 53, 51, 50, 48, 47, 46, 45, 44, 43, 43, 42, 41, 41, 41, 41,
- 63, 67, 71, 74, 78, 76, 74, 72, 70, 68, 66, 63, 61, 59, 57, 55, 53, 52,
- 50, 49, 47, 46, 45, 44, 43, 43, 42, 41, 40, 40, 40, 40, 61, 65, 68, 72,
- 75, 74, 72, 70, 68, 66, 64, 62, 60, 58, 56, 54, 52, 51, 50, 48, 47, 46,
- 45, 44, 43, 42, 41, 40, 40, 40, 40, 40, 59, 62, 66, 69, 73, 71, 70, 68,
- 66, 64, 63, 61, 59, 57, 55, 53, 52, 50, 49, 47, 46, 45, 44, 43, 42, 41,
- 40, 40, 39, 39, 39, 39, 59, 62, 66, 69, 73, 71, 70, 68, 66, 64, 63, 61,
- 59, 57, 55, 53, 52, 50, 49, 47, 46, 45, 44, 43, 42, 41, 40, 40, 39, 39,
- 39, 39, 59, 62, 66, 69, 73, 71, 70, 68, 66, 64, 63, 61, 59, 57, 55, 53,
- 52, 50, 49, 47, 46, 45, 44, 43, 42, 41, 40, 40, 39, 39, 39, 39, 59, 62,
- 66, 69, 73, 71, 70, 68, 66, 64, 63, 61, 59, 57, 55, 53, 52, 50, 49, 47,
- 46, 45, 44, 43, 42, 41, 40, 40, 39, 39, 39, 39 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 59, 37, 24, 59, 40, 29, 23, 37, 29, 22, 19, 24, 23, 19, 16,
- /* Size 8 */
- 64, 84, 78, 60, 45, 36, 29, 25, 84, 74, 77, 66, 52, 41, 34, 28, 78, 77,
- 56, 48, 42, 36, 30, 27, 60, 66, 48, 39, 34, 30, 27, 24, 45, 52, 42, 34,
- 29, 26, 24, 22, 36, 41, 36, 30, 26, 23, 22, 21, 29, 34, 30, 27, 24, 22,
- 20, 19, 25, 28, 27, 24, 22, 21, 19, 19,
- /* Size 16 */
- 64, 74, 84, 81, 78, 69, 60, 53, 45, 41, 36, 33, 29, 27, 25, 25, 74, 77,
- 79, 78, 77, 70, 63, 56, 49, 44, 39, 35, 32, 29, 27, 27, 84, 79, 74, 75,
- 77, 71, 66, 59, 52, 47, 41, 38, 34, 31, 28, 28, 81, 78, 75, 71, 66, 62,
- 57, 52, 47, 43, 38, 35, 32, 30, 28, 28, 78, 77, 77, 66, 56, 52, 48, 45,
- 42, 39, 36, 33, 30, 29, 27, 27, 69, 70, 71, 62, 52, 48, 43, 40, 38, 35,
- 33, 31, 29, 27, 25, 25, 60, 63, 66, 57, 48, 43, 39, 36, 34, 32, 30, 28,
- 27, 26, 24, 24, 53, 56, 59, 52, 45, 40, 36, 34, 31, 30, 28, 27, 25, 24,
- 23, 23, 45, 49, 52, 47, 42, 38, 34, 31, 29, 27, 26, 25, 24, 23, 22, 22,
- 41, 44, 47, 43, 39, 35, 32, 30, 27, 26, 25, 24, 23, 22, 21, 21, 36, 39,
- 41, 38, 36, 33, 30, 28, 26, 25, 23, 23, 22, 21, 21, 21, 33, 35, 38, 35,
- 33, 31, 28, 27, 25, 24, 23, 22, 21, 21, 20, 20, 29, 32, 34, 32, 30, 29,
- 27, 25, 24, 23, 22, 21, 20, 20, 19, 19, 27, 29, 31, 30, 29, 27, 26, 24,
- 23, 22, 21, 21, 20, 20, 19, 19, 25, 27, 28, 28, 27, 25, 24, 23, 22, 21,
- 21, 20, 19, 19, 19, 19, 25, 27, 28, 28, 27, 25, 24, 23, 22, 21, 21, 20,
- 19, 19, 19, 19,
- /* Size 32 */
- 64, 69, 74, 79, 84, 83, 81, 80, 78, 73, 69, 64, 60, 56, 53, 49, 45, 43,
- 41, 38, 36, 34, 33, 31, 29, 28, 27, 26, 25, 25, 25, 25, 69, 72, 75, 78,
- 82, 81, 80, 79, 78, 74, 70, 66, 61, 58, 54, 51, 47, 45, 42, 40, 37, 35,
- 34, 32, 30, 29, 28, 27, 26, 26, 26, 26, 74, 75, 77, 78, 79, 79, 78, 78,
- 77, 74, 70, 67, 63, 59, 56, 52, 49, 46, 44, 41, 39, 37, 35, 33, 32, 30,
- 29, 28, 27, 27, 27, 27, 79, 78, 78, 77, 76, 77, 77, 77, 77, 74, 71, 68,
- 65, 61, 58, 54, 51, 48, 45, 43, 40, 38, 36, 35, 33, 31, 30, 29, 28, 28,
- 28, 28, 84, 82, 79, 76, 74, 75, 75, 76, 77, 74, 71, 69, 66, 63, 59, 56,
- 52, 50, 47, 44, 41, 40, 38, 36, 34, 32, 31, 30, 28, 28, 28, 28, 83, 81,
- 79, 77, 75, 74, 73, 72, 72, 69, 67, 64, 62, 59, 56, 53, 50, 47, 45, 42,
- 40, 38, 36, 35, 33, 32, 30, 29, 28, 28, 28, 28, 81, 80, 78, 77, 75, 73,
- 71, 69, 66, 64, 62, 59, 57, 55, 52, 50, 47, 45, 43, 41, 38, 37, 35, 34,
- 32, 31, 30, 29, 28, 28, 28, 28, 80, 79, 78, 77, 76, 72, 69, 65, 61, 59,
- 57, 55, 53, 51, 48, 46, 44, 43, 41, 39, 37, 36, 34, 33, 31, 30, 29, 28,
- 27, 27, 27, 27, 78, 78, 77, 77, 77, 72, 66, 61, 56, 54, 52, 50, 48, 47,
- 45, 43, 42, 40, 39, 37, 36, 34, 33, 32, 30, 29, 29, 28, 27, 27, 27, 27,
- 73, 74, 74, 74, 74, 69, 64, 59, 54, 52, 50, 48, 46, 44, 43, 41, 40, 38,
- 37, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 26, 26, 26, 69, 70, 70, 71,
- 71, 67, 62, 57, 52, 50, 48, 46, 43, 42, 40, 39, 38, 36, 35, 34, 33, 32,
- 31, 30, 29, 28, 27, 26, 25, 25, 25, 25, 64, 66, 67, 68, 69, 64, 59, 55,
- 50, 48, 46, 43, 41, 40, 38, 37, 36, 35, 33, 32, 31, 30, 30, 29, 28, 27,
- 26, 26, 25, 25, 25, 25, 60, 61, 63, 65, 66, 62, 57, 53, 48, 46, 43, 41,
- 39, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 28, 27, 26, 26, 25, 24, 24,
- 24, 24, 56, 58, 59, 61, 63, 59, 55, 51, 47, 44, 42, 40, 37, 36, 35, 34,
- 32, 32, 31, 30, 29, 28, 27, 27, 26, 25, 25, 24, 24, 24, 24, 24, 53, 54,
- 56, 58, 59, 56, 52, 48, 45, 43, 40, 38, 36, 35, 34, 32, 31, 30, 30, 29,
- 28, 27, 27, 26, 25, 25, 24, 24, 23, 23, 23, 23, 49, 51, 52, 54, 56, 53,
- 50, 46, 43, 41, 39, 37, 35, 34, 32, 31, 30, 29, 28, 28, 27, 26, 26, 25,
- 25, 24, 24, 23, 23, 23, 23, 23, 45, 47, 49, 51, 52, 50, 47, 44, 42, 40,
- 38, 36, 34, 32, 31, 30, 29, 28, 27, 27, 26, 25, 25, 24, 24, 23, 23, 23,
- 22, 22, 22, 22, 43, 45, 46, 48, 50, 47, 45, 43, 40, 38, 36, 35, 33, 32,
- 30, 29, 28, 27, 27, 26, 25, 25, 24, 24, 23, 23, 23, 22, 22, 22, 22, 22,
- 41, 42, 44, 45, 47, 45, 43, 41, 39, 37, 35, 33, 32, 31, 30, 28, 27, 27,
- 26, 25, 25, 24, 24, 23, 23, 22, 22, 22, 21, 21, 21, 21, 38, 40, 41, 43,
- 44, 42, 41, 39, 37, 35, 34, 32, 31, 30, 29, 28, 27, 26, 25, 25, 24, 24,
- 23, 23, 22, 22, 22, 21, 21, 21, 21, 21, 36, 37, 39, 40, 41, 40, 38, 37,
- 36, 34, 33, 31, 30, 29, 28, 27, 26, 25, 25, 24, 23, 23, 23, 22, 22, 22,
- 21, 21, 21, 21, 21, 21, 34, 35, 37, 38, 40, 38, 37, 36, 34, 33, 32, 30,
- 29, 28, 27, 26, 25, 25, 24, 24, 23, 23, 22, 22, 21, 21, 21, 21, 20, 20,
- 20, 20, 33, 34, 35, 36, 38, 36, 35, 34, 33, 32, 31, 30, 28, 27, 27, 26,
- 25, 24, 24, 23, 23, 22, 22, 22, 21, 21, 21, 20, 20, 20, 20, 20, 31, 32,
- 33, 35, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 24, 23, 23,
- 22, 22, 22, 21, 21, 21, 20, 20, 20, 20, 20, 20, 29, 30, 32, 33, 34, 33,
- 32, 31, 30, 30, 29, 28, 27, 26, 25, 25, 24, 23, 23, 22, 22, 21, 21, 21,
- 20, 20, 20, 20, 19, 19, 19, 19, 28, 29, 30, 31, 32, 32, 31, 30, 29, 29,
- 28, 27, 26, 25, 25, 24, 23, 23, 22, 22, 22, 21, 21, 21, 20, 20, 20, 19,
- 19, 19, 19, 19, 27, 28, 29, 30, 31, 30, 30, 29, 29, 28, 27, 26, 26, 25,
- 24, 24, 23, 23, 22, 22, 21, 21, 21, 20, 20, 20, 20, 19, 19, 19, 19, 19,
- 26, 27, 28, 29, 30, 29, 29, 28, 28, 27, 26, 26, 25, 24, 24, 23, 23, 22,
- 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 25, 26, 27, 28,
- 28, 28, 28, 27, 27, 26, 25, 25, 24, 24, 23, 23, 22, 22, 21, 21, 21, 20,
- 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 25, 26, 27, 28, 28, 28, 28, 27,
- 27, 26, 25, 25, 24, 24, 23, 23, 22, 22, 21, 21, 21, 20, 20, 20, 19, 19,
- 19, 19, 19, 19, 19, 19, 25, 26, 27, 28, 28, 28, 28, 27, 27, 26, 25, 25,
- 24, 24, 23, 23, 22, 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, 19, 19, 19,
- 19, 19, 25, 26, 27, 28, 28, 28, 28, 27, 27, 26, 25, 25, 24, 24, 23, 23,
- 22, 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19 },
- { /* Intra matrices */
- /* Size 4 */
- 171, 157, 95, 62, 157, 104, 75, 57, 95, 75, 54, 45, 62, 57, 45, 39,
- /* Size 8 */
- 144, 192, 177, 135, 101, 78, 63, 53, 192, 167, 174, 149, 117, 91, 73,
- 61, 177, 174, 125, 107, 92, 77, 65, 56, 135, 149, 107, 84, 73, 64, 57,
- 51, 101, 117, 92, 73, 62, 55, 50, 46, 78, 91, 77, 64, 55, 49, 45, 42,
- 63, 73, 65, 57, 50, 45, 42, 39, 53, 61, 56, 51, 46, 42, 39, 38,
- /* Size 16 */
- 149, 174, 199, 191, 184, 162, 140, 122, 104, 92, 81, 73, 65, 60, 55, 55,
- 174, 180, 186, 184, 182, 165, 147, 130, 113, 100, 88, 79, 70, 65, 59,
- 59, 199, 186, 173, 177, 181, 168, 154, 138, 121, 108, 95, 85, 76, 69,
- 63, 63, 191, 184, 177, 166, 155, 144, 133, 120, 108, 98, 87, 80, 72, 66,
- 61, 61, 184, 182, 181, 155, 129, 120, 111, 103, 95, 88, 80, 74, 68, 63,
- 58, 58, 162, 165, 168, 144, 120, 110, 99, 92, 85, 79, 73, 68, 63, 59,
- 55, 55, 140, 147, 154, 133, 111, 99, 88, 81, 75, 71, 66, 63, 59, 56, 53,
- 53, 122, 130, 138, 120, 103, 92, 81, 75, 70, 66, 62, 58, 55, 53, 50, 50,
- 104, 113, 121, 108, 95, 85, 75, 70, 64, 60, 57, 54, 52, 50, 48, 48, 92,
- 100, 108, 98, 88, 79, 71, 66, 60, 57, 54, 51, 49, 47, 46, 46, 81, 88,
- 95, 87, 80, 73, 66, 62, 57, 54, 51, 49, 47, 45, 44, 44, 73, 79, 85, 80,
- 74, 68, 63, 58, 54, 51, 49, 47, 45, 44, 42, 42, 65, 70, 76, 72, 68, 63,
- 59, 55, 52, 49, 47, 45, 43, 42, 41, 41, 60, 65, 69, 66, 63, 59, 56, 53,
- 50, 47, 45, 44, 42, 41, 40, 40, 55, 59, 63, 61, 58, 55, 53, 50, 48, 46,
- 44, 42, 41, 40, 39, 39, 55, 59, 63, 61, 58, 55, 53, 50, 48, 46, 44, 42,
- 41, 40, 39, 39,
- /* Size 32 */
- 152, 165, 177, 190, 202, 198, 195, 191, 187, 176, 165, 153, 142, 133,
- 124, 115, 106, 100, 94, 88, 82, 78, 74, 70, 66, 64, 61, 58, 56, 56, 56,
- 56, 165, 173, 180, 188, 196, 193, 191, 189, 186, 176, 166, 156, 146,
- 137, 128, 119, 111, 104, 98, 92, 86, 82, 77, 73, 69, 66, 63, 61, 58, 58,
- 58, 58, 177, 180, 183, 186, 189, 188, 187, 187, 186, 177, 168, 159, 150,
- 141, 132, 124, 115, 108, 102, 96, 89, 85, 80, 76, 72, 69, 66, 63, 60,
- 60, 60, 60, 190, 188, 186, 185, 183, 183, 184, 184, 185, 177, 169, 161,
- 154, 145, 136, 128, 119, 112, 106, 99, 93, 88, 84, 79, 74, 71, 68, 65,
- 62, 62, 62, 62, 202, 196, 189, 183, 176, 178, 180, 182, 184, 177, 171,
- 164, 157, 149, 140, 132, 123, 117, 110, 103, 96, 92, 87, 82, 77, 74, 71,
- 67, 64, 64, 64, 64, 198, 193, 188, 183, 178, 177, 175, 173, 171, 165,
- 159, 152, 146, 139, 131, 124, 117, 111, 105, 99, 93, 88, 84, 80, 75, 72,
- 69, 66, 63, 63, 63, 63, 195, 191, 187, 184, 180, 175, 169, 164, 158,
- 152, 147, 141, 135, 129, 123, 116, 110, 105, 99, 94, 89, 85, 81, 77, 73,
- 70, 67, 65, 62, 62, 62, 62, 191, 189, 187, 184, 182, 173, 164, 154, 145,
- 140, 134, 129, 124, 119, 114, 109, 103, 99, 94, 90, 85, 82, 78, 75, 71,
- 68, 66, 63, 61, 61, 61, 61, 187, 186, 186, 185, 184, 171, 158, 145, 132,
- 127, 122, 118, 113, 109, 105, 101, 97, 93, 89, 85, 82, 78, 75, 72, 69,
- 67, 64, 62, 59, 59, 59, 59, 176, 176, 177, 177, 177, 165, 152, 140, 127,
- 122, 117, 112, 107, 103, 99, 96, 92, 88, 85, 81, 78, 75, 72, 70, 67, 64,
- 62, 60, 58, 58, 58, 58, 165, 166, 168, 169, 171, 159, 147, 134, 122,
- 117, 112, 106, 101, 97, 94, 90, 87, 84, 81, 78, 75, 72, 69, 67, 64, 62,
- 60, 58, 56, 56, 56, 56, 153, 156, 159, 161, 164, 152, 141, 129, 118,
- 112, 106, 101, 95, 92, 88, 85, 82, 79, 76, 74, 71, 69, 67, 64, 62, 60,
- 59, 57, 55, 55, 55, 55, 142, 146, 150, 154, 157, 146, 135, 124, 113,
- 107, 101, 95, 89, 86, 83, 80, 77, 74, 72, 70, 68, 66, 64, 62, 60, 58,
- 57, 55, 54, 54, 54, 54, 133, 137, 141, 145, 149, 139, 129, 119, 109,
- 103, 97, 92, 86, 83, 80, 77, 74, 72, 69, 67, 65, 63, 62, 60, 58, 57, 55,
- 54, 52, 52, 52, 52, 124, 128, 132, 136, 140, 131, 123, 114, 105, 99, 94,
- 88, 83, 80, 77, 74, 71, 69, 67, 65, 63, 61, 59, 58, 56, 55, 54, 52, 51,
- 51, 51, 51, 115, 119, 124, 128, 132, 124, 116, 109, 101, 96, 90, 85, 80,
- 77, 74, 71, 68, 66, 64, 62, 60, 59, 57, 56, 54, 53, 52, 51, 50, 50, 50,
- 50, 106, 111, 115, 119, 123, 117, 110, 103, 97, 92, 87, 82, 77, 74, 71,
- 68, 65, 63, 61, 60, 58, 57, 55, 54, 53, 52, 51, 50, 48, 48, 48, 48, 100,
- 104, 108, 112, 117, 111, 105, 99, 93, 88, 84, 79, 74, 72, 69, 66, 63,
- 61, 60, 58, 56, 55, 54, 53, 51, 50, 49, 48, 47, 47, 47, 47, 94, 98, 102,
- 106, 110, 105, 99, 94, 89, 85, 81, 76, 72, 69, 67, 64, 61, 60, 58, 56,
- 55, 54, 52, 51, 50, 49, 48, 47, 46, 46, 46, 46, 88, 92, 96, 99, 103, 99,
- 94, 90, 85, 81, 78, 74, 70, 67, 65, 62, 60, 58, 56, 55, 53, 52, 51, 50,
- 49, 48, 47, 46, 46, 46, 46, 46, 82, 86, 89, 93, 96, 93, 89, 85, 82, 78,
- 75, 71, 68, 65, 63, 60, 58, 56, 55, 53, 52, 51, 50, 49, 48, 47, 46, 45,
- 45, 45, 45, 45, 78, 82, 85, 88, 92, 88, 85, 82, 78, 75, 72, 69, 66, 63,
- 61, 59, 57, 55, 54, 52, 51, 50, 49, 48, 47, 46, 45, 45, 44, 44, 44, 44,
- 74, 77, 80, 84, 87, 84, 81, 78, 75, 72, 69, 67, 64, 62, 59, 57, 55, 54,
- 52, 51, 50, 49, 48, 47, 46, 45, 44, 44, 43, 43, 43, 43, 70, 73, 76, 79,
- 82, 80, 77, 75, 72, 70, 67, 64, 62, 60, 58, 56, 54, 53, 51, 50, 49, 48,
- 47, 46, 45, 44, 44, 43, 42, 42, 42, 42, 66, 69, 72, 74, 77, 75, 73, 71,
- 69, 67, 64, 62, 60, 58, 56, 54, 53, 51, 50, 49, 48, 47, 46, 45, 44, 44,
- 43, 42, 42, 42, 42, 42, 64, 66, 69, 71, 74, 72, 70, 68, 67, 64, 62, 60,
- 58, 57, 55, 53, 52, 50, 49, 48, 47, 46, 45, 44, 44, 43, 42, 42, 41, 41,
- 41, 41, 61, 63, 66, 68, 71, 69, 67, 66, 64, 62, 60, 59, 57, 55, 54, 52,
- 51, 49, 48, 47, 46, 45, 44, 44, 43, 42, 42, 41, 41, 41, 41, 41, 58, 61,
- 63, 65, 67, 66, 65, 63, 62, 60, 58, 57, 55, 54, 52, 51, 50, 48, 47, 46,
- 45, 45, 44, 43, 42, 42, 41, 41, 40, 40, 40, 40, 56, 58, 60, 62, 64, 63,
- 62, 61, 59, 58, 56, 55, 54, 52, 51, 50, 48, 47, 46, 46, 45, 44, 43, 42,
- 42, 41, 41, 40, 40, 40, 40, 40, 56, 58, 60, 62, 64, 63, 62, 61, 59, 58,
- 56, 55, 54, 52, 51, 50, 48, 47, 46, 46, 45, 44, 43, 42, 42, 41, 41, 40,
- 40, 40, 40, 40, 56, 58, 60, 62, 64, 63, 62, 61, 59, 58, 56, 55, 54, 52,
- 51, 50, 48, 47, 46, 46, 45, 44, 43, 42, 42, 41, 41, 40, 40, 40, 40, 40,
- 56, 58, 60, 62, 64, 63, 62, 61, 59, 58, 56, 55, 54, 52, 51, 50, 48, 47,
- 46, 46, 45, 44, 43, 42, 42, 41, 41, 40, 40, 40, 40, 40 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 41, 38, 31, 41, 35, 33, 29, 38, 33, 26, 23, 31, 29, 23, 20,
- /* Size 8 */
- 64, 79, 45, 42, 40, 36, 32, 29, 79, 55, 44, 48, 47, 43, 38, 34, 45, 44,
- 38, 39, 39, 37, 35, 32, 42, 48, 39, 35, 33, 32, 31, 29, 40, 47, 39, 33,
- 30, 28, 27, 26, 36, 43, 37, 32, 28, 26, 25, 23, 32, 38, 35, 31, 27, 25,
- 23, 22, 29, 34, 32, 29, 26, 23, 22, 21,
- /* Size 16 */
- 64, 71, 79, 62, 45, 43, 42, 41, 40, 38, 36, 34, 32, 30, 29, 29, 71, 69,
- 67, 56, 44, 45, 45, 44, 43, 41, 39, 37, 35, 33, 31, 31, 79, 67, 55, 50,
- 44, 46, 48, 47, 47, 45, 43, 41, 38, 36, 34, 34, 62, 56, 50, 45, 41, 42,
- 44, 43, 43, 42, 40, 38, 37, 35, 33, 33, 45, 44, 44, 41, 38, 39, 39, 39,
- 39, 38, 37, 36, 35, 33, 32, 32, 43, 45, 46, 42, 39, 38, 37, 37, 36, 36,
- 35, 34, 33, 31, 30, 30, 42, 45, 48, 44, 39, 37, 35, 34, 33, 33, 32, 31,
- 31, 30, 29, 29, 41, 44, 47, 43, 39, 37, 34, 33, 32, 31, 30, 30, 29, 28,
- 27, 27, 40, 43, 47, 43, 39, 36, 33, 32, 30, 29, 28, 28, 27, 26, 26, 26,
- 38, 41, 45, 42, 38, 36, 33, 31, 29, 28, 27, 27, 26, 25, 25, 25, 36, 39,
- 43, 40, 37, 35, 32, 30, 28, 27, 26, 25, 25, 24, 23, 23, 34, 37, 41, 38,
- 36, 34, 31, 30, 28, 27, 25, 25, 24, 23, 23, 23, 32, 35, 38, 37, 35, 33,
- 31, 29, 27, 26, 25, 24, 23, 22, 22, 22, 30, 33, 36, 35, 33, 31, 30, 28,
- 26, 25, 24, 23, 22, 22, 21, 21, 29, 31, 34, 33, 32, 30, 29, 27, 26, 25,
- 23, 23, 22, 21, 21, 21, 29, 31, 34, 33, 32, 30, 29, 27, 26, 25, 23, 23,
+static uint16_t wt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE] = {
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 48, 24, 24, 12,
+#endif
+ /* Size 4x4 */
+ 63, 48, 28, 20, 48, 31, 22, 17, 28, 22, 15, 15, 20, 17, 15, 10,
+ /* Size 8x8 */
+ 64, 63, 53, 40, 30, 24, 21, 18, 63, 58, 51, 41, 33, 27, 23, 19, 53, 51,
+ 38, 32, 26, 23, 20, 19, 40, 41, 32, 25, 21, 18, 18, 18, 30, 33, 26, 21,
+ 17, 15, 14, 15, 24, 27, 23, 18, 15, 13, 14, 11, 21, 23, 20, 18, 14, 14,
+ 11, 8, 18, 19, 19, 18, 15, 11, 8, 9,
+ /* Size 16x16 */
+ 64, 65, 65, 60, 57, 47, 42, 35, 31, 26, 25, 22, 21, 19, 18, 16, 65, 63,
+ 63, 61, 59, 50, 46, 38, 34, 28, 27, 25, 23, 21, 19, 18, 65, 63, 61, 58,
+ 56, 49, 45, 38, 35, 29, 28, 25, 23, 22, 20, 18, 60, 61, 58, 52, 48, 43,
+ 40, 35, 33, 28, 27, 25, 24, 23, 21, 20, 57, 59, 56, 48, 42, 38, 36, 32,
+ 30, 26, 25, 23, 22, 21, 18, 17, 47, 50, 49, 43, 38, 32, 31, 27, 26, 23,
+ 22, 22, 20, 21, 18, 16, 42, 46, 45, 40, 36, 31, 29, 25, 24, 21, 21, 19,
+ 20, 18, 18, 15, 35, 38, 38, 35, 32, 27, 25, 22, 21, 19, 18, 18, 18, 16,
+ 18, 14, 31, 34, 35, 33, 30, 26, 24, 21, 20, 17, 17, 16, 15, 14, 17, 13,
+ 26, 28, 29, 28, 26, 23, 21, 19, 17, 15, 15, 15, 14, 15, 16, 11, 25, 27,
+ 28, 27, 25, 22, 21, 18, 17, 15, 15, 14, 14, 15, 14, 11, 22, 25, 25, 25,
+ 23, 22, 19, 18, 16, 15, 14, 13, 13, 12, 12, 10, 21, 23, 23, 24, 22, 20,
+ 20, 18, 15, 14, 14, 13, 12, 12, 10, 9, 19, 21, 22, 23, 21, 21, 18, 16,
+ 14, 15, 15, 12, 12, 11, 11, 8, 18, 19, 20, 21, 18, 18, 18, 18, 17, 16,
+ 14, 12, 10, 11, 10, 10, 16, 18, 18, 20, 17, 16, 15, 14, 13, 11, 11, 10,
+ 9, 8, 10, 9,
+ /* Size 32x32 */
+ 64, 65, 65, 65, 65, 64, 60, 59, 57, 52, 47, 45, 42, 38, 35, 33, 31, 29,
+ 26, 25, 25, 23, 22, 21, 21, 20, 19, 18, 18, 17, 16, 16, 65, 64, 64, 64,
+ 64, 63, 60, 59, 59, 53, 48, 46, 44, 40, 36, 35, 33, 30, 27, 27, 26, 24,
+ 23, 23, 22, 21, 20, 19, 19, 18, 17, 17, 65, 64, 63, 63, 63, 63, 61, 60,
+ 59, 55, 50, 48, 46, 41, 38, 36, 34, 32, 28, 28, 27, 26, 25, 24, 23, 22,
+ 21, 20, 19, 18, 18, 16, 65, 64, 63, 63, 62, 61, 59, 59, 58, 53, 49, 48,
+ 46, 41, 38, 36, 34, 32, 28, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 19,
+ 18, 18, 65, 64, 63, 62, 61, 60, 58, 57, 56, 53, 49, 47, 45, 41, 38, 36,
+ 35, 32, 29, 28, 28, 26, 25, 24, 23, 23, 22, 21, 20, 19, 18, 17, 64, 63,
+ 63, 61, 60, 58, 55, 55, 53, 51, 48, 47, 45, 41, 38, 37, 35, 33, 29, 29,
+ 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 19, 18, 60, 60, 61, 59, 58, 55,
+ 52, 50, 48, 46, 43, 41, 40, 38, 35, 34, 33, 30, 28, 27, 27, 25, 25, 25,
+ 24, 23, 23, 22, 21, 20, 20, 18, 59, 59, 60, 59, 57, 55, 50, 48, 45, 43,
+ 41, 39, 38, 36, 34, 33, 31, 29, 27, 26, 26, 25, 25, 24, 22, 21, 21, 21,
+ 21, 20, 20, 20, 57, 59, 59, 58, 56, 53, 48, 45, 42, 41, 38, 37, 36, 34,
+ 32, 31, 30, 28, 26, 26, 25, 24, 23, 22, 22, 22, 21, 20, 18, 18, 17, 19,
+ 52, 53, 55, 53, 53, 51, 46, 43, 41, 38, 35, 34, 34, 32, 30, 29, 28, 26,
+ 24, 24, 24, 23, 22, 22, 22, 20, 19, 19, 20, 19, 19, 16, 47, 48, 50, 49,
+ 49, 48, 43, 41, 38, 35, 32, 32, 31, 29, 27, 26, 26, 24, 23, 22, 22, 21,
+ 22, 21, 20, 19, 21, 20, 18, 17, 16, 18, 45, 46, 48, 48, 47, 47, 41, 39,
+ 37, 34, 32, 31, 30, 28, 26, 26, 25, 23, 22, 22, 21, 21, 21, 19, 20, 20,
+ 18, 17, 18, 19, 18, 15, 42, 44, 46, 46, 45, 45, 40, 38, 36, 34, 31, 30,
+ 29, 27, 25, 25, 24, 23, 21, 21, 21, 20, 19, 20, 20, 17, 18, 19, 18, 15,
+ 15, 18, 38, 40, 41, 41, 41, 41, 38, 36, 34, 32, 29, 28, 27, 25, 24, 23,
+ 22, 21, 20, 20, 19, 18, 19, 19, 17, 18, 19, 16, 16, 18, 18, 14, 35, 36,
+ 38, 38, 38, 38, 35, 34, 32, 30, 27, 26, 25, 24, 22, 22, 21, 20, 19, 18,
+ 18, 18, 18, 17, 18, 17, 16, 18, 18, 14, 14, 17, 33, 35, 36, 36, 36, 37,
+ 34, 33, 31, 29, 26, 26, 25, 23, 22, 21, 20, 19, 18, 18, 18, 17, 17, 17,
+ 17, 15, 18, 16, 14, 17, 17, 13, 31, 33, 34, 34, 35, 35, 33, 31, 30, 28,
+ 26, 25, 24, 22, 21, 20, 20, 18, 17, 17, 17, 16, 16, 17, 15, 17, 14, 15,
+ 17, 14, 13, 16, 29, 30, 32, 32, 32, 33, 30, 29, 28, 26, 24, 23, 23, 21,
+ 20, 19, 18, 17, 16, 16, 16, 15, 16, 14, 16, 14, 15, 16, 13, 15, 16, 12,
+ 26, 27, 28, 28, 29, 29, 28, 27, 26, 24, 23, 22, 21, 20, 19, 18, 17, 16,
+ 15, 15, 15, 15, 15, 15, 14, 14, 15, 13, 16, 13, 11, 16, 25, 27, 28, 28,
+ 28, 29, 27, 26, 26, 24, 22, 22, 21, 20, 18, 18, 17, 16, 15, 15, 15, 14,
+ 13, 15, 13, 15, 12, 15, 12, 13, 15, 10, 25, 26, 27, 27, 28, 28, 27, 26,
+ 25, 24, 22, 21, 21, 19, 18, 18, 17, 16, 15, 15, 15, 14, 14, 12, 14, 12,
+ 15, 11, 14, 13, 11, 15, 23, 24, 26, 26, 26, 27, 25, 25, 24, 23, 21, 21,
+ 20, 18, 18, 17, 16, 15, 15, 14, 14, 13, 14, 13, 12, 14, 11, 14, 12, 11,
+ 14, 10, 22, 23, 25, 25, 25, 26, 25, 25, 23, 22, 22, 21, 19, 19, 18, 17,
+ 16, 16, 15, 13, 14, 14, 13, 13, 13, 12, 12, 12, 12, 13, 10, 14, 21, 23,
+ 24, 24, 24, 25, 25, 24, 22, 22, 21, 19, 20, 19, 17, 17, 17, 14, 15, 15,
+ 12, 13, 13, 12, 13, 12, 12, 11, 12, 10, 13, 9, 21, 22, 23, 23, 23, 24,
+ 24, 22, 22, 22, 20, 20, 20, 17, 18, 17, 15, 16, 14, 13, 14, 12, 13, 13,
+ 12, 13, 12, 12, 10, 13, 9, 13, 20, 21, 22, 22, 23, 23, 23, 21, 22, 20,
+ 19, 20, 17, 18, 17, 15, 17, 14, 14, 15, 12, 14, 12, 12, 13, 11, 12, 11,
+ 12, 8, 12, 8, 19, 20, 21, 21, 22, 22, 23, 21, 21, 19, 21, 18, 18, 19,
+ 16, 18, 14, 15, 15, 12, 15, 11, 12, 12, 12, 12, 11, 12, 11, 12, 8, 12,
+ 18, 19, 20, 20, 21, 21, 22, 21, 20, 19, 20, 17, 19, 16, 18, 16, 15, 16,
+ 13, 15, 11, 14, 12, 11, 12, 11, 12, 10, 12, 10, 12, 7, 18, 19, 19, 19,
+ 20, 20, 21, 21, 18, 20, 18, 18, 18, 16, 18, 14, 17, 13, 16, 12, 14, 12,
+ 12, 12, 10, 12, 11, 12, 10, 12, 10, 11, 17, 18, 18, 19, 19, 19, 20, 20,
+ 18, 19, 17, 19, 15, 18, 14, 17, 14, 15, 13, 13, 13, 11, 13, 10, 13, 8,
+ 12, 10, 12, 9, 11, 9, 16, 17, 18, 18, 18, 19, 20, 20, 17, 19, 16, 18,
+ 15, 18, 14, 17, 13, 16, 11, 15, 11, 14, 10, 13, 9, 12, 8, 12, 10, 11, 9,
+ 11, 16, 17, 16, 18, 17, 18, 18, 20, 19, 16, 18, 15, 18, 14, 17, 13, 16,
+ 12, 16, 10, 15, 10, 14, 9, 13, 8, 12, 7, 11, 9, 11, 8,
+ /* Size 4x8 */
+ 64, 48, 27, 20, 62, 48, 30, 22, 55, 35, 24, 20, 41, 29, 20, 16, 31, 24,
+ 16, 16, 25, 21, 14, 14, 22, 19, 14, 11, 19, 19, 15, 12,
+ /* Size 8x4 */
+ 64, 62, 55, 41, 31, 25, 22, 19, 48, 48, 35, 29, 24, 21, 19, 19, 27, 30,
+ 24, 20, 16, 14, 14, 15, 20, 22, 20, 16, 16, 14, 11, 12,
+ /* Size 8x16 */
+ 64, 64, 57, 38, 31, 24, 21, 18, 65, 62, 59, 41, 34, 26, 23, 19, 64, 60,
+ 56, 41, 35, 27, 24, 20, 60, 55, 48, 38, 33, 26, 24, 22, 57, 53, 43, 34,
+ 30, 24, 23, 19, 47, 48, 38, 29, 26, 21, 20, 17, 43, 44, 36, 27, 24, 20,
+ 18, 16, 35, 38, 32, 24, 21, 18, 18, 15, 32, 35, 30, 22, 20, 16, 17, 14,
+ 26, 29, 26, 20, 17, 15, 14, 13, 25, 28, 25, 19, 17, 14, 12, 13, 22, 26,
+ 23, 19, 16, 14, 12, 13, 21, 24, 22, 20, 15, 12, 13, 13, 19, 22, 20, 18,
+ 17, 15, 12, 12, 18, 20, 18, 16, 13, 11, 11, 12, 16, 18, 17, 15, 13, 11,
+ 9, 10,
+ /* Size 16x8 */
+ 64, 65, 64, 60, 57, 47, 43, 35, 32, 26, 25, 22, 21, 19, 18, 16, 64, 62,
+ 60, 55, 53, 48, 44, 38, 35, 29, 28, 26, 24, 22, 20, 18, 57, 59, 56, 48,
+ 43, 38, 36, 32, 30, 26, 25, 23, 22, 20, 18, 17, 38, 41, 41, 38, 34, 29,
+ 27, 24, 22, 20, 19, 19, 20, 18, 16, 15, 31, 34, 35, 33, 30, 26, 24, 21,
+ 20, 17, 17, 16, 15, 17, 13, 13, 24, 26, 27, 26, 24, 21, 20, 18, 16, 15,
+ 14, 14, 12, 15, 11, 11, 21, 23, 24, 24, 23, 20, 18, 18, 17, 14, 12, 12,
+ 13, 12, 11, 9, 18, 19, 20, 22, 19, 17, 16, 15, 14, 13, 13, 13, 13, 12,
+ 12, 10,
+ /* Size 16x32 */
+ 64, 65, 64, 60, 57, 47, 38, 35, 31, 26, 24, 22, 21, 19, 18, 17, 65, 64,
+ 63, 60, 58, 48, 40, 36, 33, 27, 25, 23, 22, 20, 19, 18, 65, 63, 62, 61,
+ 59, 50, 41, 38, 34, 28, 26, 24, 23, 21, 19, 18, 65, 63, 61, 59, 58, 49,
+ 41, 38, 34, 29, 26, 24, 23, 21, 20, 19, 64, 63, 60, 58, 56, 49, 41, 38,
+ 35, 29, 27, 25, 24, 22, 20, 19, 64, 62, 58, 55, 53, 48, 41, 38, 35, 30,
+ 27, 26, 24, 22, 20, 20, 60, 60, 55, 52, 48, 43, 38, 35, 33, 28, 26, 25,
+ 24, 23, 22, 19, 59, 59, 55, 50, 46, 41, 36, 34, 31, 27, 25, 24, 22, 22,
+ 21, 21, 57, 59, 53, 48, 43, 38, 34, 32, 30, 26, 24, 22, 23, 20, 19, 20,
+ 52, 55, 51, 46, 41, 35, 32, 30, 28, 24, 23, 22, 21, 20, 20, 17, 47, 50,
+ 48, 43, 38, 33, 29, 27, 26, 23, 21, 22, 20, 20, 17, 19, 45, 48, 46, 41,
+ 37, 32, 28, 26, 25, 22, 21, 19, 21, 18, 20, 16, 43, 46, 44, 40, 36, 31,
+ 27, 25, 24, 21, 20, 20, 18, 20, 16, 19, 38, 41, 41, 38, 34, 29, 25, 24,
+ 22, 20, 19, 19, 19, 16, 19, 14, 35, 38, 38, 35, 32, 27, 24, 22, 21, 19,
+ 18, 17, 18, 18, 15, 18, 33, 36, 37, 34, 31, 26, 23, 22, 20, 18, 17, 17,
+ 15, 16, 18, 13, 32, 34, 35, 33, 30, 26, 22, 21, 20, 17, 16, 17, 17, 15,
+ 14, 17, 29, 31, 32, 30, 28, 24, 21, 20, 18, 16, 16, 15, 15, 16, 16, 12,
+ 26, 28, 29, 28, 26, 23, 20, 19, 17, 15, 15, 15, 14, 13, 13, 16, 25, 28,
+ 29, 27, 26, 22, 20, 18, 17, 15, 14, 15, 15, 16, 14, 11, 25, 27, 28, 27,
+ 25, 22, 19, 18, 17, 15, 14, 13, 12, 12, 13, 15, 23, 25, 27, 25, 24, 21,
+ 19, 18, 16, 14, 14, 13, 13, 14, 12, 10, 22, 25, 26, 25, 23, 20, 19, 18,
+ 16, 14, 14, 14, 12, 12, 13, 14, 21, 24, 25, 25, 23, 20, 20, 18, 15, 15,
+ 14, 13, 12, 11, 11, 9, 21, 23, 24, 24, 22, 20, 20, 16, 15, 15, 12, 13,
+ 13, 12, 13, 13, 20, 22, 23, 23, 20, 19, 19, 16, 17, 14, 12, 13, 11, 11,
+ 9, 9, 19, 21, 22, 22, 20, 21, 18, 16, 17, 13, 15, 11, 12, 12, 12, 13,
+ 18, 20, 21, 21, 19, 20, 16, 18, 15, 13, 14, 10, 13, 10, 11, 7, 18, 19,
+ 20, 21, 18, 19, 16, 18, 13, 16, 11, 12, 11, 11, 12, 12, 17, 19, 19, 20,
+ 18, 19, 15, 17, 13, 15, 11, 14, 9, 12, 10, 10, 16, 18, 18, 19, 17, 18,
+ 15, 17, 13, 15, 11, 13, 9, 12, 10, 12, 16, 18, 17, 19, 19, 15, 18, 13,
+ 16, 11, 15, 9, 13, 8, 11, 9,
+ /* Size 32x16 */
+ 64, 65, 65, 65, 64, 64, 60, 59, 57, 52, 47, 45, 43, 38, 35, 33, 32, 29,
+ 26, 25, 25, 23, 22, 21, 21, 20, 19, 18, 18, 17, 16, 16, 65, 64, 63, 63,
+ 63, 62, 60, 59, 59, 55, 50, 48, 46, 41, 38, 36, 34, 31, 28, 28, 27, 25,
+ 25, 24, 23, 22, 21, 20, 19, 19, 18, 18, 64, 63, 62, 61, 60, 58, 55, 55,
+ 53, 51, 48, 46, 44, 41, 38, 37, 35, 32, 29, 29, 28, 27, 26, 25, 24, 23,
+ 22, 21, 20, 19, 18, 17, 60, 60, 61, 59, 58, 55, 52, 50, 48, 46, 43, 41,
+ 40, 38, 35, 34, 33, 30, 28, 27, 27, 25, 25, 25, 24, 23, 22, 21, 21, 20,
+ 19, 19, 57, 58, 59, 58, 56, 53, 48, 46, 43, 41, 38, 37, 36, 34, 32, 31,
+ 30, 28, 26, 26, 25, 24, 23, 23, 22, 20, 20, 19, 18, 18, 17, 19, 47, 48,
+ 50, 49, 49, 48, 43, 41, 38, 35, 33, 32, 31, 29, 27, 26, 26, 24, 23, 22,
+ 22, 21, 20, 20, 20, 19, 21, 20, 19, 19, 18, 15, 38, 40, 41, 41, 41, 41,
+ 38, 36, 34, 32, 29, 28, 27, 25, 24, 23, 22, 21, 20, 20, 19, 19, 19, 20,
+ 20, 19, 18, 16, 16, 15, 15, 18, 35, 36, 38, 38, 38, 38, 35, 34, 32, 30,
+ 27, 26, 25, 24, 22, 22, 21, 20, 19, 18, 18, 18, 18, 18, 16, 16, 16, 18,
+ 18, 17, 17, 13, 31, 33, 34, 34, 35, 35, 33, 31, 30, 28, 26, 25, 24, 22,
+ 21, 20, 20, 18, 17, 17, 17, 16, 16, 15, 15, 17, 17, 15, 13, 13, 13, 16,
+ 26, 27, 28, 29, 29, 30, 28, 27, 26, 24, 23, 22, 21, 20, 19, 18, 17, 16,
+ 15, 15, 15, 14, 14, 15, 15, 14, 13, 13, 16, 15, 15, 11, 24, 25, 26, 26,
+ 27, 27, 26, 25, 24, 23, 21, 21, 20, 19, 18, 17, 16, 16, 15, 14, 14, 14,
+ 14, 14, 12, 12, 15, 14, 11, 11, 11, 15, 22, 23, 24, 24, 25, 26, 25, 24,
+ 22, 22, 22, 19, 20, 19, 17, 17, 17, 15, 15, 15, 13, 13, 14, 13, 13, 13,
+ 11, 10, 12, 14, 13, 9, 21, 22, 23, 23, 24, 24, 24, 22, 23, 21, 20, 21,
+ 18, 19, 18, 15, 17, 15, 14, 15, 12, 13, 12, 12, 13, 11, 12, 13, 11, 9,
+ 9, 13, 19, 20, 21, 21, 22, 22, 23, 22, 20, 20, 20, 18, 20, 16, 18, 16,
+ 15, 16, 13, 16, 12, 14, 12, 11, 12, 11, 12, 10, 11, 12, 12, 8, 18, 19,
+ 19, 20, 20, 20, 22, 21, 19, 20, 17, 20, 16, 19, 15, 18, 14, 16, 13, 14,
+ 13, 12, 13, 11, 13, 9, 12, 11, 12, 10, 10, 11, 17, 18, 18, 19, 19, 20,
+ 19, 21, 20, 17, 19, 16, 19, 14, 18, 13, 17, 12, 16, 11, 15, 10, 14, 9,
+ 13, 9, 13, 7, 12, 10, 12, 9,
+ /* Size 4x16 */
+ 65, 47, 26, 19, 63, 50, 28, 21, 63, 49, 29, 22, 60, 43, 28, 23, 59, 38,
+ 26, 20, 50, 33, 23, 20, 46, 31, 21, 20, 38, 27, 19, 18, 34, 26, 17, 15,
+ 28, 23, 15, 13, 27, 22, 15, 12, 25, 20, 14, 12, 23, 20, 15, 12, 21, 21,
+ 13, 12, 19, 19, 16, 11, 18, 18, 15, 12,
+ /* Size 16x4 */
+ 65, 63, 63, 60, 59, 50, 46, 38, 34, 28, 27, 25, 23, 21, 19, 18, 47, 50,
+ 49, 43, 38, 33, 31, 27, 26, 23, 22, 20, 20, 21, 19, 18, 26, 28, 29, 28,
+ 26, 23, 21, 19, 17, 15, 15, 14, 15, 13, 16, 15, 19, 21, 22, 23, 20, 20,
+ 20, 18, 15, 13, 12, 12, 12, 12, 11, 12,
+ /* Size 8x32 */
+ 64, 64, 57, 38, 31, 24, 21, 18, 65, 63, 58, 40, 33, 25, 22, 19, 65, 62,
+ 59, 41, 34, 26, 23, 19, 65, 61, 58, 41, 34, 26, 23, 20, 64, 60, 56, 41,
+ 35, 27, 24, 20, 64, 58, 53, 41, 35, 27, 24, 20, 60, 55, 48, 38, 33, 26,
+ 24, 22, 59, 55, 46, 36, 31, 25, 22, 21, 57, 53, 43, 34, 30, 24, 23, 19,
+ 52, 51, 41, 32, 28, 23, 21, 20, 47, 48, 38, 29, 26, 21, 20, 17, 45, 46,
+ 37, 28, 25, 21, 21, 20, 43, 44, 36, 27, 24, 20, 18, 16, 38, 41, 34, 25,
+ 22, 19, 19, 19, 35, 38, 32, 24, 21, 18, 18, 15, 33, 37, 31, 23, 20, 17,
+ 15, 18, 32, 35, 30, 22, 20, 16, 17, 14, 29, 32, 28, 21, 18, 16, 15, 16,
+ 26, 29, 26, 20, 17, 15, 14, 13, 25, 29, 26, 20, 17, 14, 15, 14, 25, 28,
+ 25, 19, 17, 14, 12, 13, 23, 27, 24, 19, 16, 14, 13, 12, 22, 26, 23, 19,
+ 16, 14, 12, 13, 21, 25, 23, 20, 15, 14, 12, 11, 21, 24, 22, 20, 15, 12,
+ 13, 13, 20, 23, 20, 19, 17, 12, 11, 9, 19, 22, 20, 18, 17, 15, 12, 12,
+ 18, 21, 19, 16, 15, 14, 13, 11, 18, 20, 18, 16, 13, 11, 11, 12, 17, 19,
+ 18, 15, 13, 11, 9, 10, 16, 18, 17, 15, 13, 11, 9, 10, 16, 17, 19, 18,
+ 16, 15, 13, 11,
+ /* Size 32x8 */
+ 64, 65, 65, 65, 64, 64, 60, 59, 57, 52, 47, 45, 43, 38, 35, 33, 32, 29,
+ 26, 25, 25, 23, 22, 21, 21, 20, 19, 18, 18, 17, 16, 16, 64, 63, 62, 61,
+ 60, 58, 55, 55, 53, 51, 48, 46, 44, 41, 38, 37, 35, 32, 29, 29, 28, 27,
+ 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 57, 58, 59, 58, 56, 53, 48, 46,
+ 43, 41, 38, 37, 36, 34, 32, 31, 30, 28, 26, 26, 25, 24, 23, 23, 22, 20,
+ 20, 19, 18, 18, 17, 19, 38, 40, 41, 41, 41, 41, 38, 36, 34, 32, 29, 28,
+ 27, 25, 24, 23, 22, 21, 20, 20, 19, 19, 19, 20, 20, 19, 18, 16, 16, 15,
+ 15, 18, 31, 33, 34, 34, 35, 35, 33, 31, 30, 28, 26, 25, 24, 22, 21, 20,
+ 20, 18, 17, 17, 17, 16, 16, 15, 15, 17, 17, 15, 13, 13, 13, 16, 24, 25,
+ 26, 26, 27, 27, 26, 25, 24, 23, 21, 21, 20, 19, 18, 17, 16, 16, 15, 14,
+ 14, 14, 14, 14, 12, 12, 15, 14, 11, 11, 11, 15, 21, 22, 23, 23, 24, 24,
+ 24, 22, 23, 21, 20, 21, 18, 19, 18, 15, 17, 15, 14, 15, 12, 13, 12, 12,
+ 13, 11, 12, 13, 11, 9, 9, 13, 18, 19, 19, 20, 20, 20, 22, 21, 19, 20,
+ 17, 20, 16, 19, 15, 18, 14, 16, 13, 14, 13, 12, 13, 11, 13, 9, 12, 11,
+ 12, 10, 10, 11 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 41, 33, 33, 20,
+#endif
+ /* Size 4x4 */
+ 58, 45, 36, 30, 45, 34, 29, 26, 36, 29, 23, 24, 30, 26, 24, 18,
+ /* Size 8x8 */
+ 65, 53, 44, 41, 36, 32, 29, 27, 53, 43, 44, 44, 39, 36, 33, 29, 44, 44,
+ 38, 36, 33, 31, 30, 30, 41, 44, 36, 31, 28, 26, 27, 28, 36, 39, 33, 28,
+ 25, 23, 22, 24, 32, 36, 31, 26, 23, 21, 22, 19, 29, 33, 30, 27, 22, 22,
+ 19, 16, 27, 29, 30, 28, 24, 19, 16, 17,
+ /* Size 16x16 */
+ 64, 67, 61, 49, 42, 42, 41, 38, 36, 32, 32, 30, 28, 27, 26, 25, 67, 64,
+ 58, 48, 44, 46, 44, 41, 39, 36, 35, 33, 31, 30, 28, 27, 61, 58, 53, 46,
+ 43, 45, 44, 41, 40, 36, 36, 34, 33, 32, 30, 29, 49, 48, 46, 42, 41, 42,
+ 41, 39, 38, 36, 35, 34, 34, 33, 32, 31, 42, 44, 43, 41, 39, 38, 38, 37,
+ 36, 34, 33, 32, 31, 31, 28, 27, 42, 46, 45, 42, 38, 35, 34, 33, 32, 30,
+ 30, 30, 28, 30, 27, 26, 41, 44, 44, 41, 38, 34, 33, 32, 31, 29, 29, 27,
+ 28, 27, 27, 24, 38, 41, 41, 39, 37, 33, 32, 29, 28, 26, 26, 26, 27, 24,
+ 27, 23, 36, 39, 40, 38, 36, 32, 31, 28, 27, 25, 25, 24, 23, 22, 26, 21,
+ 32, 36, 36, 36, 34, 30, 29, 26, 25, 23, 23, 23, 22, 23, 25, 20, 32, 35,
+ 36, 35, 33, 30, 29, 26, 25, 23, 22, 22, 22, 23, 22, 19, 30, 33, 34, 34,
+ 32, 30, 27, 26, 24, 23, 22, 21, 21, 20, 20, 17, 28, 31, 33, 34, 31, 28,
+ 28, 27, 23, 22, 22, 21, 19, 19, 17, 17, 27, 30, 32, 33, 31, 30, 27, 24,
+ 22, 23, 23, 20, 19, 18, 18, 15, 26, 28, 30, 32, 28, 27, 27, 27, 26, 25,
+ 22, 20, 17, 18, 17, 17, 25, 27, 29, 31, 27, 26, 24, 23, 21, 20, 19, 17,
+ 17, 15, 17, 16,
+ /* Size 32x32 */
+ 64, 66, 67, 64, 61, 56, 49, 46, 42, 42, 42, 41, 41, 39, 38, 37, 36, 34,
+ 32, 32, 32, 30, 30, 29, 28, 28, 27, 27, 26, 26, 25, 25, 66, 65, 66, 62,
+ 59, 53, 48, 46, 43, 44, 44, 43, 42, 41, 39, 39, 38, 36, 34, 34, 33, 32,
+ 32, 31, 30, 29, 29, 28, 28, 27, 27, 26, 67, 66, 64, 61, 58, 51, 48, 46,
+ 44, 45, 46, 45, 44, 43, 41, 40, 39, 38, 36, 35, 35, 34, 33, 32, 31, 31,
+ 30, 29, 28, 28, 27, 26, 64, 62, 61, 58, 55, 49, 47, 46, 44, 45, 46, 45,
+ 44, 43, 41, 41, 40, 38, 36, 36, 35, 34, 33, 33, 32, 31, 30, 30, 29, 28,
+ 28, 28, 61, 59, 58, 55, 53, 47, 46, 45, 43, 44, 45, 45, 44, 43, 41, 41,
+ 40, 38, 36, 36, 36, 34, 34, 33, 33, 32, 32, 31, 30, 29, 29, 27, 56, 53,
+ 51, 49, 47, 43, 43, 43, 43, 44, 45, 45, 45, 44, 42, 42, 41, 39, 38, 37,
+ 37, 36, 35, 34, 34, 33, 31, 31, 30, 29, 29, 29, 49, 48, 48, 47, 46, 43,
+ 42, 41, 41, 41, 42, 41, 41, 41, 39, 39, 38, 37, 36, 35, 35, 34, 34, 34,
+ 34, 33, 33, 33, 32, 31, 31, 28, 46, 46, 46, 46, 45, 43, 41, 41, 40, 40,
+ 40, 40, 39, 39, 38, 38, 37, 36, 35, 34, 34, 33, 33, 33, 31, 31, 30, 32,
+ 31, 31, 30, 32, 42, 43, 44, 44, 43, 43, 41, 40, 39, 39, 38, 38, 38, 38,
+ 37, 37, 36, 35, 34, 34, 33, 33, 32, 31, 31, 32, 31, 30, 28, 27, 27, 30,
+ 42, 44, 45, 45, 44, 44, 41, 40, 39, 38, 37, 37, 36, 36, 35, 34, 34, 33,
+ 32, 32, 32, 31, 30, 31, 31, 30, 28, 28, 30, 30, 29, 25, 42, 44, 46, 46,
+ 45, 45, 42, 40, 38, 37, 35, 35, 34, 33, 33, 33, 32, 31, 30, 30, 30, 30,
+ 30, 30, 28, 28, 30, 30, 27, 26, 26, 29, 41, 43, 45, 45, 45, 45, 41, 40,
+ 38, 37, 35, 34, 34, 33, 32, 32, 31, 31, 30, 29, 29, 29, 29, 28, 29, 29,
+ 27, 26, 28, 29, 28, 25, 41, 42, 44, 44, 44, 45, 41, 39, 38, 36, 34, 34,
+ 33, 32, 32, 31, 31, 30, 29, 29, 29, 28, 27, 28, 28, 26, 27, 29, 27, 25,
+ 24, 28, 39, 41, 43, 43, 43, 44, 41, 39, 38, 36, 33, 33, 32, 31, 30, 29,
+ 29, 28, 27, 27, 27, 26, 27, 27, 26, 27, 28, 24, 25, 28, 27, 23, 38, 39,
+ 41, 41, 41, 42, 39, 38, 37, 35, 33, 32, 32, 30, 29, 28, 28, 27, 26, 26,
+ 26, 26, 26, 25, 27, 26, 24, 27, 27, 23, 23, 27, 37, 39, 40, 41, 41, 42,
+ 39, 38, 37, 34, 33, 32, 31, 29, 28, 28, 27, 27, 26, 25, 25, 25, 25, 25,
+ 25, 23, 26, 24, 23, 26, 26, 21, 36, 38, 39, 40, 40, 41, 38, 37, 36, 34,
+ 32, 31, 31, 29, 28, 27, 27, 26, 25, 25, 25, 24, 24, 25, 23, 25, 22, 23,
+ 26, 22, 21, 26, 34, 36, 38, 38, 38, 39, 37, 36, 35, 33, 31, 31, 30, 28,
+ 27, 27, 26, 25, 24, 24, 24, 23, 24, 22, 25, 22, 24, 25, 21, 24, 25, 20,
+ 32, 34, 36, 36, 36, 38, 36, 35, 34, 32, 30, 30, 29, 27, 26, 26, 25, 24,
+ 23, 23, 23, 22, 23, 23, 22, 22, 23, 21, 25, 22, 20, 25, 32, 34, 35, 36,
+ 36, 37, 35, 34, 34, 32, 30, 29, 29, 27, 26, 25, 25, 24, 23, 23, 23, 22,
+ 21, 23, 21, 23, 20, 24, 20, 22, 24, 18, 32, 33, 35, 35, 36, 37, 35, 34,
+ 33, 32, 30, 29, 29, 27, 26, 25, 25, 24, 23, 23, 22, 22, 22, 20, 22, 20,
+ 23, 19, 22, 22, 19, 24, 30, 32, 34, 34, 34, 36, 34, 33, 33, 31, 30, 29,
+ 28, 26, 26, 25, 24, 23, 22, 22, 22, 21, 21, 21, 20, 22, 19, 22, 20, 19,
+ 23, 18, 30, 32, 33, 33, 34, 35, 34, 33, 32, 30, 30, 29, 27, 27, 26, 25,
+ 24, 24, 23, 21, 22, 21, 21, 21, 21, 19, 20, 20, 20, 21, 17, 23, 29, 31,
+ 32, 33, 33, 34, 34, 33, 31, 31, 30, 28, 28, 27, 25, 25, 25, 22, 23, 23,
+ 20, 21, 21, 20, 21, 20, 19, 19, 20, 18, 22, 16, 28, 30, 31, 32, 33, 34,
+ 34, 31, 31, 31, 28, 29, 28, 26, 27, 25, 23, 25, 22, 21, 22, 20, 21, 21,
+ 19, 21, 19, 20, 17, 21, 17, 21, 28, 29, 31, 31, 32, 33, 33, 31, 32, 30,
+ 28, 29, 26, 27, 26, 23, 25, 22, 22, 23, 20, 22, 19, 20, 21, 19, 20, 19,
+ 20, 16, 21, 16, 27, 29, 30, 30, 32, 31, 33, 30, 31, 28, 30, 27, 27, 28,
+ 24, 26, 22, 24, 23, 20, 23, 19, 20, 19, 19, 20, 18, 20, 18, 20, 15, 20,
+ 27, 28, 29, 30, 31, 31, 33, 32, 30, 28, 30, 26, 29, 24, 27, 24, 23, 25,
+ 21, 24, 19, 22, 20, 19, 20, 19, 20, 18, 20, 18, 19, 14, 26, 28, 28, 29,
+ 30, 30, 32, 31, 28, 30, 27, 28, 27, 25, 27, 23, 26, 21, 25, 20, 22, 20,
+ 20, 20, 17, 20, 18, 20, 17, 19, 17, 19, 26, 27, 28, 28, 29, 29, 31, 31,
+ 27, 30, 26, 29, 25, 28, 23, 26, 22, 24, 22, 22, 22, 19, 21, 18, 21, 16,
+ 20, 18, 19, 17, 19, 17, 25, 27, 27, 28, 29, 29, 31, 30, 27, 29, 26, 28,
+ 24, 27, 23, 26, 21, 25, 20, 24, 19, 23, 17, 22, 17, 21, 15, 19, 17, 19,
+ 16, 19, 25, 26, 26, 28, 27, 29, 28, 32, 30, 25, 29, 25, 28, 23, 27, 21,
+ 26, 20, 25, 18, 24, 18, 23, 16, 21, 16, 20, 14, 19, 17, 19, 16,
+ /* Size 4x8 */
+ 65, 44, 34, 29, 51, 45, 38, 31, 45, 37, 32, 29, 43, 34, 27, 25, 38, 31,
+ 24, 24, 34, 29, 22, 22, 31, 28, 22, 19, 28, 29, 24, 20,
+ /* Size 8x4 */
+ 65, 51, 45, 43, 38, 34, 31, 28, 44, 45, 37, 34, 31, 29, 28, 29, 34, 38,
+ 32, 27, 24, 22, 22, 24, 29, 31, 29, 25, 24, 22, 19, 20,
+ /* Size 8x16 */
+ 64, 55, 43, 39, 36, 31, 28, 26, 67, 51, 45, 43, 39, 34, 31, 29, 61, 48,
+ 44, 43, 40, 35, 33, 30, 49, 43, 41, 41, 38, 34, 34, 32, 42, 43, 39, 38,
+ 36, 33, 32, 28, 42, 45, 38, 33, 32, 29, 29, 27, 41, 44, 38, 32, 31, 28,
+ 26, 25, 38, 42, 37, 30, 28, 25, 26, 23, 36, 41, 36, 29, 27, 24, 26, 23,
+ 32, 37, 34, 27, 25, 22, 22, 22, 32, 37, 33, 27, 25, 22, 20, 21, 30, 34,
+ 32, 27, 24, 22, 20, 21, 29, 33, 31, 28, 23, 20, 21, 20, 27, 32, 29, 27,
+ 25, 23, 19, 20, 26, 30, 28, 25, 21, 19, 19, 20, 25, 29, 27, 24, 21, 19,
+ 17, 17,
+ /* Size 16x8 */
+ 64, 67, 61, 49, 42, 42, 41, 38, 36, 32, 32, 30, 29, 27, 26, 25, 55, 51,
+ 48, 43, 43, 45, 44, 42, 41, 37, 37, 34, 33, 32, 30, 29, 43, 45, 44, 41,
+ 39, 38, 38, 37, 36, 34, 33, 32, 31, 29, 28, 27, 39, 43, 43, 41, 38, 33,
+ 32, 30, 29, 27, 27, 27, 28, 27, 25, 24, 36, 39, 40, 38, 36, 32, 31, 28,
+ 27, 25, 25, 24, 23, 25, 21, 21, 31, 34, 35, 34, 33, 29, 28, 25, 24, 22,
+ 22, 22, 20, 23, 19, 19, 28, 31, 33, 34, 32, 29, 26, 26, 26, 22, 20, 20,
+ 21, 19, 19, 17, 26, 29, 30, 32, 28, 27, 25, 23, 23, 22, 21, 21, 20, 20,
+ 20, 17,
+ /* Size 16x32 */
+ 64, 66, 55, 49, 43, 42, 39, 38, 36, 32, 31, 29, 28, 27, 26, 25, 65, 65,
+ 53, 48, 44, 44, 41, 39, 38, 34, 33, 31, 30, 29, 28, 27, 67, 64, 51, 48,
+ 45, 45, 43, 41, 39, 36, 34, 33, 31, 30, 29, 27, 64, 60, 49, 47, 44, 45,
+ 43, 41, 40, 36, 34, 33, 32, 30, 29, 29, 61, 57, 48, 46, 44, 45, 43, 41,
+ 40, 37, 35, 34, 33, 32, 30, 28, 55, 51, 44, 43, 43, 45, 44, 42, 41, 38,
+ 36, 35, 33, 31, 30, 30, 49, 48, 43, 42, 41, 41, 41, 39, 38, 36, 34, 34,
+ 34, 34, 32, 29, 46, 46, 43, 41, 40, 40, 39, 38, 37, 35, 33, 33, 31, 32,
+ 32, 32, 42, 44, 43, 41, 39, 38, 38, 37, 36, 34, 33, 31, 32, 30, 28, 31,
+ 42, 45, 44, 41, 39, 37, 36, 35, 34, 32, 31, 31, 30, 29, 30, 26, 42, 45,
+ 45, 41, 38, 35, 33, 33, 32, 30, 29, 30, 29, 30, 27, 29, 41, 45, 45, 41,
+ 38, 35, 33, 32, 31, 30, 29, 28, 30, 27, 29, 25, 41, 44, 44, 41, 38, 34,
+ 32, 31, 31, 29, 28, 28, 26, 29, 25, 29, 39, 43, 43, 41, 38, 34, 31, 30,
+ 29, 27, 27, 27, 27, 25, 28, 23, 38, 41, 42, 39, 37, 33, 30, 29, 28, 26,
+ 25, 25, 26, 27, 23, 28, 37, 40, 41, 39, 37, 33, 29, 28, 27, 26, 25, 25,
+ 24, 25, 27, 22, 36, 39, 41, 38, 36, 32, 29, 28, 27, 25, 24, 25, 26, 24,
+ 23, 27, 34, 38, 39, 37, 35, 31, 28, 27, 26, 24, 23, 23, 23, 24, 24, 20,
+ 32, 36, 37, 35, 34, 30, 27, 26, 25, 23, 22, 23, 22, 21, 22, 25, 32, 35,
+ 37, 35, 34, 30, 27, 26, 25, 23, 22, 23, 23, 24, 22, 19, 32, 35, 37, 35,
+ 33, 30, 27, 26, 25, 23, 22, 21, 20, 20, 21, 24, 31, 34, 35, 34, 33, 29,
+ 27, 26, 24, 22, 21, 21, 21, 22, 20, 18, 30, 33, 34, 34, 32, 28, 27, 26,
+ 24, 22, 22, 21, 20, 20, 21, 23, 29, 32, 34, 34, 32, 28, 28, 26, 23, 23,
+ 22, 20, 20, 19, 19, 16, 29, 32, 33, 34, 31, 28, 28, 24, 23, 23, 20, 21,
+ 21, 20, 20, 22, 28, 31, 32, 33, 29, 28, 28, 24, 25, 22, 20, 21, 19, 19,
+ 16, 16, 27, 30, 32, 32, 29, 30, 27, 24, 25, 21, 23, 19, 19, 20, 20, 21,
+ 27, 30, 31, 32, 28, 30, 25, 27, 24, 21, 22, 18, 20, 18, 18, 14, 26, 29,
+ 30, 31, 28, 29, 25, 27, 21, 25, 19, 20, 19, 18, 20, 20, 26, 28, 29, 31,
+ 28, 29, 25, 27, 21, 24, 19, 22, 16, 20, 17, 17, 25, 28, 29, 30, 27, 28,
+ 24, 26, 21, 24, 19, 22, 17, 19, 17, 19, 25, 28, 27, 31, 29, 25, 28, 22,
+ 26, 19, 24, 16, 21, 15, 19, 16,
+ /* Size 32x16 */
+ 64, 65, 67, 64, 61, 55, 49, 46, 42, 42, 42, 41, 41, 39, 38, 37, 36, 34,
+ 32, 32, 32, 31, 30, 29, 29, 28, 27, 27, 26, 26, 25, 25, 66, 65, 64, 60,
+ 57, 51, 48, 46, 44, 45, 45, 45, 44, 43, 41, 40, 39, 38, 36, 35, 35, 34,
+ 33, 32, 32, 31, 30, 30, 29, 28, 28, 28, 55, 53, 51, 49, 48, 44, 43, 43,
+ 43, 44, 45, 45, 44, 43, 42, 41, 41, 39, 37, 37, 37, 35, 34, 34, 33, 32,
+ 32, 31, 30, 29, 29, 27, 49, 48, 48, 47, 46, 43, 42, 41, 41, 41, 41, 41,
+ 41, 41, 39, 39, 38, 37, 35, 35, 35, 34, 34, 34, 34, 33, 32, 32, 31, 31,
+ 30, 31, 43, 44, 45, 44, 44, 43, 41, 40, 39, 39, 38, 38, 38, 38, 37, 37,
+ 36, 35, 34, 34, 33, 33, 32, 32, 31, 29, 29, 28, 28, 28, 27, 29, 42, 44,
+ 45, 45, 45, 45, 41, 40, 38, 37, 35, 35, 34, 34, 33, 33, 32, 31, 30, 30,
+ 30, 29, 28, 28, 28, 28, 30, 30, 29, 29, 28, 25, 39, 41, 43, 43, 43, 44,
+ 41, 39, 38, 36, 33, 33, 32, 31, 30, 29, 29, 28, 27, 27, 27, 27, 27, 28,
+ 28, 28, 27, 25, 25, 25, 24, 28, 38, 39, 41, 41, 41, 42, 39, 38, 37, 35,
+ 33, 32, 31, 30, 29, 28, 28, 27, 26, 26, 26, 26, 26, 26, 24, 24, 24, 27,
+ 27, 27, 26, 22, 36, 38, 39, 40, 40, 41, 38, 37, 36, 34, 32, 31, 31, 29,
+ 28, 27, 27, 26, 25, 25, 25, 24, 24, 23, 23, 25, 25, 24, 21, 21, 21, 26,
+ 32, 34, 36, 36, 37, 38, 36, 35, 34, 32, 30, 30, 29, 27, 26, 26, 25, 24,
+ 23, 23, 23, 22, 22, 23, 23, 22, 21, 21, 25, 24, 24, 19, 31, 33, 34, 34,
+ 35, 36, 34, 33, 33, 31, 29, 29, 28, 27, 25, 25, 24, 23, 22, 22, 22, 21,
+ 22, 22, 20, 20, 23, 22, 19, 19, 19, 24, 29, 31, 33, 33, 34, 35, 34, 33,
+ 31, 31, 30, 28, 28, 27, 25, 25, 25, 23, 23, 23, 21, 21, 21, 20, 21, 21,
+ 19, 18, 20, 22, 22, 16, 28, 30, 31, 32, 33, 33, 34, 31, 32, 30, 29, 30,
+ 26, 27, 26, 24, 26, 23, 22, 23, 20, 21, 20, 20, 21, 19, 19, 20, 19, 16,
+ 17, 21, 27, 29, 30, 30, 32, 31, 34, 32, 30, 29, 30, 27, 29, 25, 27, 25,
+ 24, 24, 21, 24, 20, 22, 20, 19, 20, 19, 20, 18, 18, 20, 19, 15, 26, 28,
+ 29, 29, 30, 30, 32, 32, 28, 30, 27, 29, 25, 28, 23, 27, 23, 24, 22, 22,
+ 21, 20, 21, 19, 20, 16, 20, 18, 20, 17, 17, 19, 25, 27, 27, 29, 28, 30,
+ 29, 32, 31, 26, 29, 25, 29, 23, 28, 22, 27, 20, 25, 19, 24, 18, 23, 16,
+ 22, 16, 21, 14, 20, 17, 19, 16,
+ /* Size 4x16 */
+ 66, 42, 32, 27, 64, 45, 36, 30, 57, 45, 37, 32, 48, 41, 36, 34, 44, 38,
+ 34, 30, 45, 35, 30, 30, 44, 34, 29, 29, 41, 33, 26, 27, 39, 32, 25, 24,
+ 36, 30, 23, 21, 35, 30, 23, 20, 33, 28, 22, 20, 32, 28, 23, 20, 30, 30,
+ 21, 20, 29, 29, 25, 18, 28, 28, 24, 19,
+ /* Size 16x4 */
+ 66, 64, 57, 48, 44, 45, 44, 41, 39, 36, 35, 33, 32, 30, 29, 28, 42, 45,
+ 45, 41, 38, 35, 34, 33, 32, 30, 30, 28, 28, 30, 29, 28, 32, 36, 37, 36,
+ 34, 30, 29, 26, 25, 23, 23, 22, 23, 21, 25, 24, 27, 30, 32, 34, 30, 30,
+ 29, 27, 24, 21, 20, 20, 20, 20, 18, 19,
+ /* Size 8x32 */
+ 64, 55, 43, 39, 36, 31, 28, 26, 65, 53, 44, 41, 38, 33, 30, 28, 67, 51,
+ 45, 43, 39, 34, 31, 29, 64, 49, 44, 43, 40, 34, 32, 29, 61, 48, 44, 43,
+ 40, 35, 33, 30, 55, 44, 43, 44, 41, 36, 33, 30, 49, 43, 41, 41, 38, 34,
+ 34, 32, 46, 43, 40, 39, 37, 33, 31, 32, 42, 43, 39, 38, 36, 33, 32, 28,
+ 42, 44, 39, 36, 34, 31, 30, 30, 42, 45, 38, 33, 32, 29, 29, 27, 41, 45,
+ 38, 33, 31, 29, 30, 29, 41, 44, 38, 32, 31, 28, 26, 25, 39, 43, 38, 31,
+ 29, 27, 27, 28, 38, 42, 37, 30, 28, 25, 26, 23, 37, 41, 37, 29, 27, 25,
+ 24, 27, 36, 41, 36, 29, 27, 24, 26, 23, 34, 39, 35, 28, 26, 23, 23, 24,
+ 32, 37, 34, 27, 25, 22, 22, 22, 32, 37, 34, 27, 25, 22, 23, 22, 32, 37,
+ 33, 27, 25, 22, 20, 21, 31, 35, 33, 27, 24, 21, 21, 20, 30, 34, 32, 27,
+ 24, 22, 20, 21, 29, 34, 32, 28, 23, 22, 20, 19, 29, 33, 31, 28, 23, 20,
+ 21, 20, 28, 32, 29, 28, 25, 20, 19, 16, 27, 32, 29, 27, 25, 23, 19, 20,
+ 27, 31, 28, 25, 24, 22, 20, 18, 26, 30, 28, 25, 21, 19, 19, 20, 26, 29,
+ 28, 25, 21, 19, 16, 17, 25, 29, 27, 24, 21, 19, 17, 17, 25, 27, 29, 28,
+ 26, 24, 21, 19,
+ /* Size 32x8 */
+ 64, 65, 67, 64, 61, 55, 49, 46, 42, 42, 42, 41, 41, 39, 38, 37, 36, 34,
+ 32, 32, 32, 31, 30, 29, 29, 28, 27, 27, 26, 26, 25, 25, 55, 53, 51, 49,
+ 48, 44, 43, 43, 43, 44, 45, 45, 44, 43, 42, 41, 41, 39, 37, 37, 37, 35,
+ 34, 34, 33, 32, 32, 31, 30, 29, 29, 27, 43, 44, 45, 44, 44, 43, 41, 40,
+ 39, 39, 38, 38, 38, 38, 37, 37, 36, 35, 34, 34, 33, 33, 32, 32, 31, 29,
+ 29, 28, 28, 28, 27, 29, 39, 41, 43, 43, 43, 44, 41, 39, 38, 36, 33, 33,
+ 32, 31, 30, 29, 29, 28, 27, 27, 27, 27, 27, 28, 28, 28, 27, 25, 25, 25,
+ 24, 28, 36, 38, 39, 40, 40, 41, 38, 37, 36, 34, 32, 31, 31, 29, 28, 27,
+ 27, 26, 25, 25, 25, 24, 24, 23, 23, 25, 25, 24, 21, 21, 21, 26, 31, 33,
+ 34, 34, 35, 36, 34, 33, 33, 31, 29, 29, 28, 27, 25, 25, 24, 23, 22, 22,
+ 22, 21, 22, 22, 20, 20, 23, 22, 19, 19, 19, 24, 28, 30, 31, 32, 33, 33,
+ 34, 31, 32, 30, 29, 30, 26, 27, 26, 24, 26, 23, 22, 23, 20, 21, 20, 20,
+ 21, 19, 19, 20, 19, 16, 17, 21, 26, 28, 29, 29, 30, 30, 32, 32, 28, 30,
+ 27, 29, 25, 28, 23, 27, 23, 24, 22, 22, 21, 20, 21, 19, 20, 16, 20, 18,
+ 20, 17, 17, 19 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 52, 25, 25, 13,
+#endif
+ /* Size 4x4 */
+ 63, 50, 30, 22, 50, 32, 23, 19, 30, 23, 16, 16, 22, 19, 16, 11,
+ /* Size 8x8 */
+ 64, 63, 55, 43, 33, 26, 22, 19, 63, 58, 52, 44, 35, 28, 24, 21, 55, 52,
+ 40, 34, 29, 24, 22, 21, 43, 44, 34, 28, 24, 20, 20, 19, 33, 35, 29, 24,
+ 20, 17, 15, 16, 26, 28, 24, 20, 17, 15, 14, 12, 22, 24, 22, 20, 15, 14,
+ 12, 10, 19, 21, 21, 19, 16, 12, 10, 10,
+ /* Size 16x16 */
+ 64, 65, 65, 63, 57, 52, 43, 38, 33, 29, 26, 24, 22, 20, 19, 18, 65, 64,
+ 63, 62, 59, 55, 47, 41, 36, 31, 28, 26, 24, 22, 20, 19, 65, 63, 61, 59,
+ 56, 53, 46, 41, 37, 32, 29, 27, 25, 23, 21, 20, 63, 62, 59, 56, 51, 49,
+ 44, 40, 36, 32, 29, 27, 26, 24, 23, 21, 57, 59, 56, 51, 42, 41, 37, 34,
+ 31, 28, 26, 24, 23, 23, 20, 19, 52, 55, 53, 49, 41, 38, 34, 32, 29, 26,
+ 24, 23, 21, 22, 19, 18, 43, 47, 46, 44, 37, 34, 29, 27, 25, 23, 22, 20,
+ 20, 19, 19, 17, 38, 41, 41, 40, 34, 32, 27, 25, 23, 21, 20, 19, 19, 17,
+ 19, 15, 33, 36, 37, 36, 31, 29, 25, 23, 21, 19, 18, 17, 16, 16, 18, 14,
+ 29, 31, 32, 32, 28, 26, 23, 21, 19, 17, 16, 16, 15, 16, 16, 13, 26, 28,
+ 29, 29, 26, 24, 22, 20, 18, 16, 15, 15, 15, 15, 15, 12, 24, 26, 27, 27,
+ 24, 23, 20, 19, 17, 16, 15, 14, 14, 13, 13, 11, 22, 24, 25, 26, 23, 21,
+ 20, 19, 16, 15, 15, 14, 13, 12, 11, 10, 20, 22, 23, 24, 23, 22, 19, 17,
+ 16, 16, 15, 13, 12, 12, 11, 9, 19, 20, 21, 23, 20, 19, 19, 19, 18, 16,
+ 15, 13, 11, 11, 11, 11, 18, 19, 20, 21, 19, 18, 17, 15, 14, 13, 12, 11,
+ 10, 9, 11, 10,
+ /* Size 32x32 */
+ 64, 65, 65, 65, 65, 64, 63, 60, 57, 54, 52, 47, 43, 41, 38, 35, 33, 31,
+ 29, 27, 26, 25, 24, 23, 22, 21, 20, 20, 19, 18, 18, 17, 65, 64, 64, 64,
+ 64, 63, 62, 60, 59, 55, 53, 48, 45, 43, 40, 36, 35, 33, 30, 28, 27, 26,
+ 25, 24, 23, 22, 21, 21, 20, 19, 19, 18, 65, 64, 64, 63, 63, 63, 62, 61,
+ 59, 56, 55, 50, 47, 45, 41, 38, 36, 34, 31, 29, 28, 27, 26, 25, 24, 23,
+ 22, 21, 20, 20, 19, 18, 65, 64, 63, 63, 63, 62, 61, 60, 59, 56, 54, 50,
+ 47, 45, 41, 38, 37, 34, 32, 30, 28, 27, 26, 25, 24, 23, 23, 22, 21, 20,
+ 19, 19, 65, 64, 63, 63, 61, 60, 59, 58, 56, 54, 53, 49, 46, 44, 41, 38,
+ 37, 35, 32, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 21, 20, 19, 64, 63,
+ 63, 62, 60, 58, 57, 55, 53, 52, 51, 48, 46, 44, 41, 38, 37, 35, 33, 31,
+ 29, 28, 27, 26, 25, 24, 23, 22, 22, 21, 20, 20, 63, 62, 62, 61, 59, 57,
+ 56, 54, 51, 50, 49, 46, 44, 42, 40, 37, 36, 34, 32, 30, 29, 28, 27, 26,
+ 26, 25, 24, 24, 23, 22, 21, 19, 60, 60, 61, 60, 58, 55, 54, 52, 48, 47,
+ 46, 43, 41, 40, 38, 35, 34, 33, 30, 29, 28, 27, 26, 25, 24, 23, 22, 23,
+ 22, 22, 21, 21, 57, 59, 59, 59, 56, 53, 51, 48, 42, 41, 41, 38, 37, 36,
+ 34, 32, 31, 30, 28, 27, 26, 25, 24, 24, 23, 23, 23, 21, 20, 19, 19, 20,
+ 54, 55, 56, 56, 54, 52, 50, 47, 41, 40, 39, 37, 35, 34, 33, 31, 30, 29,
+ 27, 26, 25, 24, 24, 23, 23, 22, 21, 20, 21, 21, 20, 17, 52, 53, 55, 54,
+ 53, 51, 49, 46, 41, 39, 38, 35, 34, 33, 32, 30, 29, 28, 26, 25, 24, 24,
+ 23, 22, 21, 21, 22, 21, 19, 18, 18, 19, 47, 48, 50, 50, 49, 48, 46, 43,
+ 38, 37, 35, 32, 31, 30, 29, 27, 27, 26, 24, 23, 23, 22, 22, 21, 21, 21,
+ 20, 19, 19, 20, 19, 17, 43, 45, 47, 47, 46, 46, 44, 41, 37, 35, 34, 31,
+ 29, 29, 27, 26, 25, 24, 23, 22, 22, 21, 20, 21, 20, 19, 19, 20, 19, 17,
+ 17, 19, 41, 43, 45, 45, 44, 44, 42, 40, 36, 34, 33, 30, 29, 28, 26, 25,
+ 25, 24, 22, 21, 21, 20, 20, 20, 19, 20, 20, 17, 17, 19, 19, 15, 38, 40,
+ 41, 41, 41, 41, 40, 38, 34, 33, 32, 29, 27, 26, 25, 24, 23, 22, 21, 20,
+ 20, 19, 19, 18, 19, 18, 17, 19, 19, 16, 15, 18, 35, 36, 38, 38, 38, 38,
+ 37, 35, 32, 31, 30, 27, 26, 25, 24, 22, 22, 21, 20, 19, 19, 18, 18, 18,
+ 18, 17, 18, 17, 16, 18, 18, 14, 33, 35, 36, 37, 37, 37, 36, 34, 31, 30,
+ 29, 27, 25, 25, 23, 22, 21, 20, 19, 19, 18, 18, 17, 17, 16, 18, 16, 16,
+ 18, 15, 14, 17, 31, 33, 34, 34, 35, 35, 34, 33, 30, 29, 28, 26, 24, 24,
+ 22, 21, 20, 20, 18, 18, 17, 17, 17, 16, 17, 15, 16, 17, 14, 16, 17, 13,
+ 29, 30, 31, 32, 32, 33, 32, 30, 28, 27, 26, 24, 23, 22, 21, 20, 19, 18,
+ 17, 17, 16, 16, 16, 16, 15, 15, 16, 14, 16, 14, 13, 16, 27, 28, 29, 30,
+ 30, 31, 30, 29, 27, 26, 25, 23, 22, 21, 20, 19, 19, 18, 17, 16, 16, 15,
+ 15, 15, 15, 15, 14, 16, 13, 14, 16, 12, 26, 27, 28, 28, 29, 29, 29, 28,
+ 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 16, 15, 15, 15, 14, 15, 13,
+ 15, 12, 15, 14, 12, 15, 25, 26, 27, 27, 28, 28, 28, 27, 25, 24, 24, 22,
+ 21, 20, 19, 18, 18, 17, 16, 15, 15, 15, 14, 14, 13, 14, 13, 14, 13, 12,
+ 15, 11, 24, 25, 26, 26, 27, 27, 27, 26, 24, 24, 23, 22, 20, 20, 19, 18,
+ 17, 17, 16, 15, 15, 14, 14, 14, 14, 13, 13, 13, 13, 14, 11, 15, 23, 24,
+ 25, 25, 26, 26, 26, 25, 24, 23, 22, 21, 21, 20, 18, 18, 17, 16, 16, 15,
+ 14, 14, 14, 13, 14, 13, 13, 12, 13, 11, 14, 10, 22, 23, 24, 24, 25, 25,
+ 26, 24, 23, 23, 21, 21, 20, 19, 19, 18, 16, 17, 15, 15, 15, 13, 14, 14,
+ 13, 13, 12, 13, 11, 13, 10, 14, 21, 22, 23, 23, 24, 24, 25, 23, 23, 22,
+ 21, 21, 19, 20, 18, 17, 18, 15, 15, 15, 13, 14, 13, 13, 13, 12, 13, 12,
+ 13, 10, 13, 10, 20, 21, 22, 23, 23, 23, 24, 22, 23, 21, 22, 20, 19, 20,
+ 17, 18, 16, 16, 16, 14, 15, 13, 13, 13, 12, 13, 12, 13, 11, 12, 9, 13,
+ 20, 21, 21, 22, 22, 22, 24, 23, 21, 20, 21, 19, 20, 17, 19, 17, 16, 17,
+ 14, 16, 12, 14, 13, 12, 13, 12, 13, 11, 12, 11, 12, 8, 19, 20, 20, 21,
+ 21, 22, 23, 22, 20, 21, 19, 19, 19, 17, 19, 16, 18, 14, 16, 13, 15, 13,
+ 13, 13, 11, 13, 11, 12, 11, 12, 11, 12, 18, 19, 20, 20, 21, 21, 22, 22,
+ 19, 21, 18, 20, 17, 19, 16, 18, 15, 16, 14, 14, 14, 12, 14, 11, 13, 10,
+ 12, 11, 12, 10, 12, 10, 18, 19, 19, 19, 20, 20, 21, 21, 19, 20, 18, 19,
+ 17, 19, 15, 18, 14, 17, 13, 16, 12, 15, 11, 14, 10, 13, 9, 12, 11, 12,
+ 10, 12, 17, 18, 18, 19, 19, 20, 19, 21, 20, 17, 19, 17, 19, 15, 18, 14,
+ 17, 13, 16, 12, 15, 11, 15, 10, 14, 10, 13, 8, 12, 10, 12, 9,
+ /* Size 4x8 */
+ 64, 48, 29, 21, 62, 48, 32, 23, 56, 37, 27, 21, 45, 30, 22, 17, 34, 26,
+ 18, 17, 27, 22, 16, 14, 23, 21, 15, 12, 20, 20, 16, 12,
+ /* Size 8x4 */
+ 64, 62, 56, 45, 34, 27, 23, 20, 48, 48, 37, 30, 26, 22, 21, 20, 29, 32,
+ 27, 22, 18, 16, 15, 16, 21, 23, 21, 17, 17, 14, 12, 12,
+ /* Size 8x16 */
+ 64, 64, 57, 43, 31, 26, 22, 19, 65, 63, 59, 47, 34, 28, 24, 21, 64, 60,
+ 56, 46, 35, 29, 25, 22, 63, 58, 51, 44, 34, 29, 25, 23, 57, 55, 43, 37,
+ 30, 26, 24, 20, 52, 51, 41, 34, 28, 24, 21, 19, 44, 45, 37, 29, 24, 22,
+ 19, 17, 38, 41, 34, 27, 22, 20, 19, 16, 34, 37, 31, 25, 20, 18, 18, 15,
+ 29, 32, 28, 23, 18, 16, 15, 14, 26, 29, 26, 22, 17, 15, 14, 14, 24, 27,
+ 24, 20, 17, 15, 13, 13, 22, 25, 23, 20, 16, 13, 13, 13, 20, 23, 21, 19,
+ 17, 15, 12, 13, 19, 21, 20, 17, 14, 12, 12, 12, 18, 20, 19, 17, 14, 12,
+ 10, 10,
+ /* Size 16x8 */
+ 64, 65, 64, 63, 57, 52, 44, 38, 34, 29, 26, 24, 22, 20, 19, 18, 64, 63,
+ 60, 58, 55, 51, 45, 41, 37, 32, 29, 27, 25, 23, 21, 20, 57, 59, 56, 51,
+ 43, 41, 37, 34, 31, 28, 26, 24, 23, 21, 20, 19, 43, 47, 46, 44, 37, 34,
+ 29, 27, 25, 23, 22, 20, 20, 19, 17, 17, 31, 34, 35, 34, 30, 28, 24, 22,
+ 20, 18, 17, 17, 16, 17, 14, 14, 26, 28, 29, 29, 26, 24, 22, 20, 18, 16,
+ 15, 15, 13, 15, 12, 12, 22, 24, 25, 25, 24, 21, 19, 19, 18, 15, 14, 13,
+ 13, 12, 12, 10, 19, 21, 22, 23, 20, 19, 17, 16, 15, 14, 14, 13, 13, 13,
+ 12, 10,
+ /* Size 16x32 */
+ 64, 65, 64, 63, 57, 47, 43, 38, 31, 28, 26, 23, 22, 20, 19, 18, 65, 64,
+ 63, 62, 58, 48, 45, 40, 33, 29, 27, 24, 23, 21, 20, 19, 65, 63, 63, 62,
+ 59, 50, 47, 41, 34, 31, 28, 25, 24, 22, 21, 19, 65, 63, 62, 61, 59, 50,
+ 47, 41, 34, 31, 29, 26, 24, 23, 21, 20, 64, 63, 60, 59, 56, 49, 46, 41,
+ 35, 31, 29, 26, 25, 23, 22, 20, 64, 62, 59, 57, 53, 48, 46, 41, 35, 32,
+ 30, 27, 25, 23, 22, 21, 63, 62, 58, 56, 51, 46, 44, 40, 34, 31, 29, 27,
+ 25, 24, 23, 20, 60, 60, 57, 54, 48, 43, 41, 38, 33, 30, 28, 25, 24, 24,
+ 23, 22, 57, 59, 55, 51, 43, 38, 37, 34, 30, 28, 26, 24, 24, 22, 20, 21,
+ 54, 56, 53, 49, 41, 37, 35, 33, 29, 27, 25, 24, 22, 21, 21, 18, 52, 55,
+ 51, 48, 41, 35, 34, 32, 28, 26, 24, 23, 21, 22, 19, 20, 47, 50, 48, 46,
+ 38, 33, 31, 29, 26, 24, 23, 21, 22, 19, 21, 17, 44, 47, 45, 43, 37, 31,
+ 29, 27, 24, 23, 22, 21, 19, 21, 17, 20, 42, 45, 44, 42, 36, 30, 29, 26,
+ 24, 22, 21, 20, 20, 17, 20, 16, 38, 41, 41, 40, 34, 29, 27, 25, 22, 21,
+ 20, 18, 19, 19, 16, 19, 35, 38, 38, 37, 32, 27, 26, 24, 21, 20, 19, 18,
+ 17, 17, 18, 15, 34, 36, 37, 36, 31, 27, 25, 23, 20, 19, 18, 17, 18, 16,
+ 15, 18, 32, 34, 35, 34, 30, 26, 24, 22, 20, 18, 17, 16, 16, 17, 16, 13,
+ 29, 31, 32, 31, 28, 24, 23, 21, 18, 17, 16, 16, 15, 14, 14, 17, 27, 29,
+ 30, 30, 27, 23, 22, 20, 18, 17, 16, 15, 16, 16, 15, 12, 26, 28, 29, 29,
+ 26, 23, 22, 20, 17, 16, 15, 14, 14, 13, 14, 16, 25, 27, 28, 28, 25, 22,
+ 21, 19, 17, 16, 15, 14, 14, 14, 13, 12, 24, 26, 27, 27, 24, 22, 20, 19,
+ 17, 15, 15, 14, 13, 13, 13, 15, 23, 25, 26, 26, 24, 21, 21, 18, 16, 16,
+ 14, 13, 13, 12, 12, 10, 22, 24, 25, 25, 23, 21, 20, 17, 16, 16, 13, 14,
+ 13, 13, 13, 14, 21, 23, 24, 25, 22, 21, 20, 17, 18, 15, 13, 14, 12, 12,
+ 10, 10, 20, 23, 23, 24, 21, 22, 19, 17, 17, 14, 15, 12, 12, 13, 13, 13,
+ 20, 22, 22, 23, 21, 21, 17, 19, 16, 14, 15, 12, 13, 11, 11, 9, 19, 21,
+ 21, 22, 20, 20, 17, 19, 14, 16, 12, 13, 12, 11, 12, 12, 18, 20, 21, 21,
+ 20, 20, 17, 18, 14, 16, 12, 14, 10, 12, 10, 11, 18, 19, 20, 21, 19, 19,
+ 17, 18, 14, 16, 12, 14, 10, 12, 10, 12, 17, 19, 19, 20, 20, 17, 19, 14,
+ 17, 12, 15, 10, 14, 9, 12, 10,
+ /* Size 32x16 */
+ 64, 65, 65, 65, 64, 64, 63, 60, 57, 54, 52, 47, 44, 42, 38, 35, 34, 32,
+ 29, 27, 26, 25, 24, 23, 22, 21, 20, 20, 19, 18, 18, 17, 65, 64, 63, 63,
+ 63, 62, 62, 60, 59, 56, 55, 50, 47, 45, 41, 38, 36, 34, 31, 29, 28, 27,
+ 26, 25, 24, 23, 23, 22, 21, 20, 19, 19, 64, 63, 63, 62, 60, 59, 58, 57,
+ 55, 53, 51, 48, 45, 44, 41, 38, 37, 35, 32, 30, 29, 28, 27, 26, 25, 24,
+ 23, 22, 21, 21, 20, 19, 63, 62, 62, 61, 59, 57, 56, 54, 51, 49, 48, 46,
+ 43, 42, 40, 37, 36, 34, 31, 30, 29, 28, 27, 26, 25, 25, 24, 23, 22, 21,
+ 21, 20, 57, 58, 59, 59, 56, 53, 51, 48, 43, 41, 41, 38, 37, 36, 34, 32,
+ 31, 30, 28, 27, 26, 25, 24, 24, 23, 22, 21, 21, 20, 20, 19, 20, 47, 48,
+ 50, 50, 49, 48, 46, 43, 38, 37, 35, 33, 31, 30, 29, 27, 27, 26, 24, 23,
+ 23, 22, 22, 21, 21, 21, 22, 21, 20, 20, 19, 17, 43, 45, 47, 47, 46, 46,
+ 44, 41, 37, 35, 34, 31, 29, 29, 27, 26, 25, 24, 23, 22, 22, 21, 20, 21,
+ 20, 20, 19, 17, 17, 17, 17, 19, 38, 40, 41, 41, 41, 41, 40, 38, 34, 33,
+ 32, 29, 27, 26, 25, 24, 23, 22, 21, 20, 20, 19, 19, 18, 17, 17, 17, 19,
+ 19, 18, 18, 14, 31, 33, 34, 34, 35, 35, 34, 33, 30, 29, 28, 26, 24, 24,
+ 22, 21, 20, 20, 18, 18, 17, 17, 17, 16, 16, 18, 17, 16, 14, 14, 14, 17,
+ 28, 29, 31, 31, 31, 32, 31, 30, 28, 27, 26, 24, 23, 22, 21, 20, 19, 18,
+ 17, 17, 16, 16, 15, 16, 16, 15, 14, 14, 16, 16, 16, 12, 26, 27, 28, 29,
+ 29, 30, 29, 28, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 16, 15, 15,
+ 15, 14, 13, 13, 15, 15, 12, 12, 12, 15, 23, 24, 25, 26, 26, 27, 27, 25,
+ 24, 24, 23, 21, 21, 20, 18, 18, 17, 16, 16, 15, 14, 14, 14, 13, 14, 14,
+ 12, 12, 13, 14, 14, 10, 22, 23, 24, 24, 25, 25, 25, 24, 24, 22, 21, 22,
+ 19, 20, 19, 17, 18, 16, 15, 16, 14, 14, 13, 13, 13, 12, 12, 13, 12, 10,
+ 10, 14, 20, 21, 22, 23, 23, 23, 24, 24, 22, 21, 22, 19, 21, 17, 19, 17,
+ 16, 17, 14, 16, 13, 14, 13, 12, 13, 12, 13, 11, 11, 12, 12, 9, 19, 20,
+ 21, 21, 22, 22, 23, 23, 20, 21, 19, 21, 17, 20, 16, 18, 15, 16, 14, 15,
+ 14, 13, 13, 12, 13, 10, 13, 11, 12, 10, 10, 12, 18, 19, 19, 20, 20, 21,
+ 20, 22, 21, 18, 20, 17, 20, 16, 19, 15, 18, 13, 17, 12, 16, 12, 15, 10,
+ 14, 10, 13, 9, 12, 11, 12, 10,
+ /* Size 4x16 */
+ 65, 47, 28, 20, 63, 50, 31, 22, 63, 49, 31, 23, 62, 46, 31, 24, 59, 38,
+ 28, 22, 55, 35, 26, 22, 47, 31, 23, 21, 41, 29, 21, 19, 36, 27, 19, 16,
+ 31, 24, 17, 14, 28, 23, 16, 13, 26, 22, 15, 13, 24, 21, 16, 13, 23, 22,
+ 14, 13, 21, 20, 16, 11, 19, 19, 16, 12,
+ /* Size 16x4 */
+ 65, 63, 63, 62, 59, 55, 47, 41, 36, 31, 28, 26, 24, 23, 21, 19, 47, 50,
+ 49, 46, 38, 35, 31, 29, 27, 24, 23, 22, 21, 22, 20, 19, 28, 31, 31, 31,
+ 28, 26, 23, 21, 19, 17, 16, 15, 16, 14, 16, 16, 20, 22, 23, 24, 22, 22,
+ 21, 19, 16, 14, 13, 13, 13, 13, 11, 12,
+ /* Size 8x32 */
+ 64, 64, 57, 43, 31, 26, 22, 19, 65, 63, 58, 45, 33, 27, 23, 20, 65, 63,
+ 59, 47, 34, 28, 24, 21, 65, 62, 59, 47, 34, 29, 24, 21, 64, 60, 56, 46,
+ 35, 29, 25, 22, 64, 59, 53, 46, 35, 30, 25, 22, 63, 58, 51, 44, 34, 29,
+ 25, 23, 60, 57, 48, 41, 33, 28, 24, 23, 57, 55, 43, 37, 30, 26, 24, 20,
+ 54, 53, 41, 35, 29, 25, 22, 21, 52, 51, 41, 34, 28, 24, 21, 19, 47, 48,
+ 38, 31, 26, 23, 22, 21, 44, 45, 37, 29, 24, 22, 19, 17, 42, 44, 36, 29,
+ 24, 21, 20, 20, 38, 41, 34, 27, 22, 20, 19, 16, 35, 38, 32, 26, 21, 19,
+ 17, 18, 34, 37, 31, 25, 20, 18, 18, 15, 32, 35, 30, 24, 20, 17, 16, 16,
+ 29, 32, 28, 23, 18, 16, 15, 14, 27, 30, 27, 22, 18, 16, 16, 15, 26, 29,
+ 26, 22, 17, 15, 14, 14, 25, 28, 25, 21, 17, 15, 14, 13, 24, 27, 24, 20,
+ 17, 15, 13, 13, 23, 26, 24, 21, 16, 14, 13, 12, 22, 25, 23, 20, 16, 13,
+ 13, 13, 21, 24, 22, 20, 18, 13, 12, 10, 20, 23, 21, 19, 17, 15, 12, 13,
+ 20, 22, 21, 17, 16, 15, 13, 11, 19, 21, 20, 17, 14, 12, 12, 12, 18, 21,
+ 20, 17, 14, 12, 10, 10, 18, 20, 19, 17, 14, 12, 10, 10, 17, 19, 20, 19,
+ 17, 15, 14, 12,
+ /* Size 32x8 */
+ 64, 65, 65, 65, 64, 64, 63, 60, 57, 54, 52, 47, 44, 42, 38, 35, 34, 32,
+ 29, 27, 26, 25, 24, 23, 22, 21, 20, 20, 19, 18, 18, 17, 64, 63, 63, 62,
+ 60, 59, 58, 57, 55, 53, 51, 48, 45, 44, 41, 38, 37, 35, 32, 30, 29, 28,
+ 27, 26, 25, 24, 23, 22, 21, 21, 20, 19, 57, 58, 59, 59, 56, 53, 51, 48,
+ 43, 41, 41, 38, 37, 36, 34, 32, 31, 30, 28, 27, 26, 25, 24, 24, 23, 22,
+ 21, 21, 20, 20, 19, 20, 43, 45, 47, 47, 46, 46, 44, 41, 37, 35, 34, 31,
+ 29, 29, 27, 26, 25, 24, 23, 22, 22, 21, 20, 21, 20, 20, 19, 17, 17, 17,
+ 17, 19, 31, 33, 34, 34, 35, 35, 34, 33, 30, 29, 28, 26, 24, 24, 22, 21,
+ 20, 20, 18, 18, 17, 17, 17, 16, 16, 18, 17, 16, 14, 14, 14, 17, 26, 27,
+ 28, 29, 29, 30, 29, 28, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 16,
+ 15, 15, 15, 14, 13, 13, 15, 15, 12, 12, 12, 15, 22, 23, 24, 24, 25, 25,
+ 25, 24, 24, 22, 21, 22, 19, 20, 19, 17, 18, 16, 15, 16, 14, 14, 13, 13,
+ 13, 12, 12, 13, 12, 10, 10, 14, 19, 20, 21, 21, 22, 22, 23, 23, 20, 21,
+ 19, 21, 17, 20, 16, 18, 15, 16, 14, 15, 14, 13, 13, 12, 13, 10, 13, 11,
+ 12, 10, 10, 12 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 42, 34, 34, 21,
+#endif
+ /* Size 4x4 */
+ 62, 46, 37, 31, 46, 35, 31, 28, 37, 31, 24, 24, 31, 28, 24, 19,
+ /* Size 8x8 */
+ 65, 53, 43, 42, 38, 33, 31, 28, 53, 43, 44, 44, 41, 37, 34, 31, 43, 44,
+ 38, 37, 35, 32, 31, 31, 42, 44, 37, 33, 30, 28, 28, 28, 38, 41, 35, 30,
+ 27, 25, 23, 25, 33, 37, 32, 28, 25, 22, 22, 20, 31, 34, 31, 28, 23, 22,
+ 20, 17, 28, 31, 31, 28, 25, 20, 17, 18,
+ /* Size 16x16 */
+ 64, 67, 61, 53, 42, 42, 41, 39, 37, 34, 32, 31, 29, 28, 27, 26, 67, 65,
+ 58, 50, 44, 45, 44, 43, 40, 37, 35, 34, 32, 31, 29, 28, 61, 58, 53, 47,
+ 43, 44, 44, 43, 41, 38, 36, 35, 34, 33, 31, 30, 53, 50, 47, 43, 42, 43,
+ 43, 43, 41, 38, 37, 35, 35, 34, 33, 32, 42, 44, 43, 42, 39, 39, 38, 38,
+ 37, 35, 34, 33, 32, 32, 29, 29, 42, 45, 44, 43, 39, 38, 36, 36, 35, 33,
+ 32, 31, 30, 31, 28, 27, 41, 44, 44, 43, 38, 36, 34, 33, 31, 30, 29, 28,
+ 29, 28, 28, 26, 39, 43, 43, 43, 38, 36, 33, 31, 29, 28, 27, 27, 27, 25,
+ 28, 24, 37, 40, 41, 41, 37, 35, 31, 29, 28, 27, 26, 25, 24, 24, 26, 23,
+ 34, 37, 38, 38, 35, 33, 30, 28, 27, 25, 24, 23, 23, 24, 25, 21, 32, 35,
+ 36, 37, 34, 32, 29, 27, 26, 24, 23, 22, 23, 23, 23, 20, 31, 34, 35, 35,
+ 33, 31, 28, 27, 25, 23, 22, 22, 21, 21, 21, 19, 29, 32, 34, 35, 32, 30,
+ 29, 27, 24, 23, 23, 21, 20, 20, 18, 18, 28, 31, 33, 34, 32, 31, 28, 25,
+ 24, 24, 23, 21, 20, 19, 19, 16, 27, 29, 31, 33, 29, 28, 28, 28, 26, 25,
+ 23, 21, 18, 19, 18, 18, 26, 28, 30, 32, 29, 27, 26, 24, 23, 21, 20, 19,
+ 18, 16, 18, 17,
+ /* Size 32x32 */
+ 64, 66, 67, 66, 61, 56, 53, 49, 42, 42, 42, 42, 41, 40, 39, 38, 37, 36,
+ 34, 33, 32, 32, 31, 30, 29, 29, 28, 28, 27, 27, 26, 26, 66, 65, 65, 64,
+ 59, 53, 51, 48, 43, 43, 44, 44, 43, 42, 41, 39, 39, 38, 36, 35, 34, 33,
+ 33, 32, 31, 31, 30, 29, 29, 28, 28, 27, 67, 65, 65, 63, 58, 52, 50, 48,
+ 44, 45, 45, 45, 44, 44, 43, 41, 40, 39, 37, 36, 35, 35, 34, 33, 32, 32,
+ 31, 30, 29, 29, 28, 27, 66, 64, 63, 62, 57, 51, 49, 48, 44, 45, 45, 46,
+ 45, 44, 43, 41, 41, 40, 38, 37, 36, 35, 34, 33, 33, 32, 32, 31, 30, 30,
+ 29, 29, 61, 59, 58, 57, 53, 47, 47, 46, 43, 44, 44, 45, 44, 44, 43, 41,
+ 41, 40, 38, 37, 36, 36, 35, 34, 34, 33, 33, 32, 31, 30, 30, 28, 56, 53,
+ 52, 51, 47, 43, 43, 43, 43, 44, 44, 45, 45, 44, 44, 42, 42, 41, 39, 38,
+ 38, 37, 36, 35, 34, 34, 32, 32, 31, 31, 30, 30, 53, 51, 50, 49, 47, 43,
+ 43, 43, 42, 43, 43, 44, 43, 43, 43, 41, 41, 40, 38, 38, 37, 36, 35, 35,
+ 35, 34, 34, 34, 33, 32, 32, 29, 49, 48, 48, 48, 46, 43, 43, 42, 41, 41,
+ 41, 42, 41, 41, 41, 39, 39, 38, 37, 36, 36, 35, 34, 34, 33, 32, 32, 33,
+ 33, 32, 31, 32, 42, 43, 44, 44, 43, 43, 42, 41, 39, 39, 39, 38, 38, 38,
+ 38, 37, 37, 36, 35, 34, 34, 33, 33, 32, 32, 33, 32, 31, 29, 29, 29, 31,
+ 42, 43, 45, 45, 44, 44, 43, 41, 39, 38, 38, 37, 37, 37, 37, 36, 35, 35,
+ 34, 33, 33, 32, 32, 32, 32, 31, 30, 30, 31, 31, 30, 27, 42, 44, 45, 45,
+ 44, 44, 43, 41, 39, 38, 38, 37, 36, 36, 36, 35, 35, 34, 33, 33, 32, 32,
+ 31, 31, 30, 30, 31, 31, 28, 28, 27, 30, 42, 44, 45, 46, 45, 45, 44, 42,
+ 38, 37, 37, 35, 34, 34, 33, 33, 33, 32, 31, 31, 30, 30, 30, 29, 30, 30,
+ 28, 28, 29, 30, 29, 26, 41, 43, 44, 45, 44, 45, 43, 41, 38, 37, 36, 34,
+ 34, 33, 33, 32, 31, 31, 30, 30, 29, 29, 28, 29, 29, 27, 28, 29, 28, 26,
+ 26, 29, 40, 42, 44, 44, 44, 44, 43, 41, 38, 37, 36, 34, 33, 33, 32, 31,
+ 31, 30, 29, 29, 29, 28, 28, 28, 27, 28, 28, 26, 26, 28, 28, 24, 39, 41,
+ 43, 43, 43, 44, 43, 41, 38, 37, 36, 33, 33, 32, 31, 30, 29, 29, 28, 28,
+ 27, 27, 27, 26, 27, 27, 25, 27, 28, 24, 24, 28, 38, 39, 41, 41, 41, 42,
+ 41, 39, 37, 36, 35, 33, 32, 31, 30, 29, 28, 28, 27, 27, 26, 26, 26, 26,
+ 26, 25, 27, 25, 24, 27, 27, 23, 37, 39, 40, 41, 41, 42, 41, 39, 37, 35,
+ 35, 33, 31, 31, 29, 28, 28, 27, 27, 26, 26, 25, 25, 25, 24, 26, 24, 24,
+ 26, 24, 23, 27, 36, 38, 39, 40, 40, 41, 40, 38, 36, 35, 34, 32, 31, 30,
+ 29, 28, 27, 27, 26, 25, 25, 25, 24, 24, 25, 23, 24, 25, 22, 25, 26, 22,
+ 34, 36, 37, 38, 38, 39, 38, 37, 35, 34, 33, 31, 30, 29, 28, 27, 27, 26,
+ 25, 24, 24, 24, 23, 24, 23, 23, 24, 22, 25, 23, 21, 26, 33, 35, 36, 37,
+ 37, 38, 38, 36, 34, 33, 33, 31, 30, 29, 28, 27, 26, 25, 24, 24, 23, 23,
+ 23, 23, 22, 23, 22, 24, 21, 23, 25, 20, 32, 34, 35, 36, 36, 38, 37, 36,
+ 34, 33, 32, 30, 29, 29, 27, 26, 26, 25, 24, 23, 23, 23, 22, 22, 23, 21,
+ 23, 20, 23, 23, 20, 24, 32, 33, 35, 35, 36, 37, 36, 35, 33, 32, 32, 30,
+ 29, 28, 27, 26, 25, 25, 24, 23, 23, 22, 22, 22, 21, 22, 20, 22, 21, 20,
+ 23, 19, 31, 33, 34, 34, 35, 36, 35, 34, 33, 32, 31, 30, 28, 28, 27, 26,
+ 25, 24, 23, 23, 22, 22, 22, 22, 21, 20, 21, 21, 21, 22, 19, 23, 30, 32,
+ 33, 33, 34, 35, 35, 34, 32, 32, 31, 29, 29, 28, 26, 26, 25, 24, 24, 23,
+ 22, 22, 22, 21, 21, 21, 20, 20, 21, 19, 22, 18, 29, 31, 32, 33, 34, 34,
+ 35, 33, 32, 32, 30, 30, 29, 27, 27, 26, 24, 25, 23, 22, 23, 21, 21, 21,
+ 20, 21, 20, 20, 18, 21, 18, 22, 29, 31, 32, 32, 33, 34, 34, 32, 33, 31,
+ 30, 30, 27, 28, 27, 25, 26, 23, 23, 23, 21, 22, 20, 21, 21, 20, 21, 20,
+ 21, 17, 21, 17, 28, 30, 31, 32, 33, 32, 34, 32, 32, 30, 31, 28, 28, 28,
+ 25, 27, 24, 24, 24, 22, 23, 20, 21, 20, 20, 21, 19, 20, 19, 20, 16, 21,
+ 28, 29, 30, 31, 32, 32, 34, 33, 31, 30, 31, 28, 29, 26, 27, 25, 24, 25,
+ 22, 24, 20, 22, 21, 20, 20, 20, 20, 19, 20, 19, 20, 15, 27, 29, 29, 30,
+ 31, 31, 33, 33, 29, 31, 28, 29, 28, 26, 28, 24, 26, 22, 25, 21, 23, 21,
+ 21, 21, 18, 21, 19, 20, 18, 20, 18, 20, 27, 28, 29, 30, 30, 31, 32, 32,
+ 29, 31, 28, 30, 26, 28, 24, 27, 24, 25, 23, 23, 23, 20, 22, 19, 21, 17,
+ 20, 19, 20, 18, 20, 18, 26, 28, 28, 29, 30, 30, 32, 31, 29, 30, 27, 29,
+ 26, 28, 24, 27, 23, 26, 21, 25, 20, 23, 19, 22, 18, 21, 16, 20, 18, 20,
+ 17, 19, 26, 27, 27, 29, 28, 30, 29, 32, 31, 27, 30, 26, 29, 24, 28, 23,
+ 27, 22, 26, 20, 24, 19, 23, 18, 22, 17, 21, 15, 20, 18, 19, 17,
+ /* Size 4x8 */
+ 65, 44, 36, 30, 51, 45, 39, 32, 45, 37, 34, 31, 44, 34, 29, 26, 39, 32,
+ 26, 25, 35, 30, 24, 22, 32, 30, 23, 20, 29, 30, 25, 20,
+ /* Size 8x4 */
+ 65, 51, 45, 44, 39, 35, 32, 29, 44, 45, 37, 34, 32, 30, 30, 30, 36, 39,
+ 34, 29, 26, 24, 23, 25, 30, 32, 31, 26, 25, 22, 20, 20,
+ /* Size 8x16 */
+ 64, 58, 43, 41, 36, 32, 29, 27, 67, 54, 45, 44, 39, 35, 32, 29, 61, 49,
+ 44, 44, 40, 37, 34, 31, 53, 45, 42, 43, 40, 37, 35, 33, 42, 43, 39, 38,
+ 36, 34, 33, 29, 42, 44, 39, 36, 34, 32, 30, 28, 41, 44, 38, 34, 31, 29,
+ 27, 26, 39, 43, 38, 32, 29, 27, 27, 25, 37, 41, 37, 31, 27, 26, 26, 24,
+ 34, 39, 35, 30, 26, 24, 23, 23, 32, 37, 34, 29, 25, 23, 21, 22, 31, 35,
+ 33, 28, 24, 22, 21, 21, 30, 34, 32, 29, 24, 21, 21, 21, 28, 33, 30, 28,
+ 26, 23, 20, 20, 27, 31, 30, 26, 23, 20, 20, 20, 26, 30, 29, 26, 23, 20,
+ 18, 18,
+ /* Size 16x8 */
+ 64, 67, 61, 53, 42, 42, 41, 39, 37, 34, 32, 31, 30, 28, 27, 26, 58, 54,
+ 49, 45, 43, 44, 44, 43, 41, 39, 37, 35, 34, 33, 31, 30, 43, 45, 44, 42,
+ 39, 39, 38, 38, 37, 35, 34, 33, 32, 30, 30, 29, 41, 44, 44, 43, 38, 36,
+ 34, 32, 31, 30, 29, 28, 29, 28, 26, 26, 36, 39, 40, 40, 36, 34, 31, 29,
+ 27, 26, 25, 24, 24, 26, 23, 23, 32, 35, 37, 37, 34, 32, 29, 27, 26, 24,
+ 23, 22, 21, 23, 20, 20, 29, 32, 34, 35, 33, 30, 27, 27, 26, 23, 21, 21,
+ 21, 20, 20, 18, 27, 29, 31, 33, 29, 28, 26, 25, 24, 23, 22, 21, 21, 20,
+ 20, 18,
+ /* Size 16x32 */
+ 64, 66, 58, 53, 43, 42, 41, 39, 36, 34, 32, 30, 29, 28, 27, 26, 65, 65,
+ 55, 51, 44, 44, 42, 41, 38, 36, 34, 32, 31, 30, 29, 28, 67, 64, 54, 51,
+ 45, 45, 44, 42, 39, 37, 35, 33, 32, 31, 29, 28, 66, 62, 53, 49, 45, 45,
+ 44, 43, 39, 37, 36, 34, 33, 32, 30, 30, 61, 57, 49, 47, 44, 45, 44, 43,
+ 40, 38, 37, 34, 34, 32, 31, 29, 55, 51, 45, 43, 43, 45, 45, 44, 41, 39,
+ 38, 36, 34, 32, 31, 31, 53, 50, 45, 43, 42, 44, 43, 42, 40, 38, 37, 35,
+ 35, 34, 33, 30, 49, 48, 44, 43, 41, 41, 41, 41, 38, 37, 36, 34, 33, 33,
+ 33, 33, 42, 44, 43, 42, 39, 38, 38, 38, 36, 35, 34, 32, 33, 31, 29, 32,
+ 42, 45, 44, 42, 39, 37, 37, 36, 35, 34, 33, 32, 31, 31, 31, 27, 42, 45,
+ 44, 43, 39, 37, 36, 36, 34, 33, 32, 31, 30, 31, 28, 30, 42, 45, 45, 44,
+ 38, 35, 34, 33, 32, 31, 30, 29, 30, 28, 30, 26, 41, 44, 44, 43, 38, 34,
+ 34, 32, 31, 30, 29, 29, 27, 29, 26, 29, 40, 44, 44, 43, 38, 34, 33, 32,
+ 30, 29, 29, 28, 28, 26, 29, 25, 39, 43, 43, 42, 38, 34, 32, 31, 29, 28,
+ 27, 26, 27, 27, 25, 28, 38, 41, 42, 41, 37, 33, 32, 30, 28, 27, 26, 26,
+ 25, 25, 27, 23, 37, 40, 41, 41, 37, 33, 31, 29, 27, 26, 26, 25, 26, 25,
+ 24, 27, 36, 39, 41, 40, 36, 32, 31, 29, 27, 26, 25, 24, 24, 25, 25, 22,
+ 34, 38, 39, 38, 35, 31, 30, 28, 26, 25, 24, 23, 23, 23, 23, 26, 33, 36,
+ 38, 37, 34, 31, 29, 28, 25, 24, 23, 23, 23, 24, 23, 20, 32, 36, 37, 37,
+ 34, 30, 29, 27, 25, 24, 23, 22, 21, 21, 22, 25, 32, 35, 36, 36, 33, 30,
+ 29, 27, 25, 24, 23, 22, 22, 22, 21, 20, 31, 34, 35, 35, 33, 30, 28, 27,
+ 24, 23, 22, 22, 21, 21, 21, 23, 30, 33, 35, 35, 32, 30, 29, 26, 24, 24,
+ 22, 21, 21, 20, 20, 18, 30, 33, 34, 34, 32, 30, 29, 25, 24, 24, 21, 21,
+ 21, 20, 21, 22, 29, 32, 33, 34, 31, 30, 29, 25, 26, 23, 21, 21, 20, 20,
+ 18, 17, 28, 31, 33, 33, 30, 31, 28, 25, 26, 22, 23, 20, 20, 21, 20, 21,
+ 28, 31, 32, 33, 30, 30, 26, 27, 24, 22, 23, 19, 21, 19, 19, 16, 27, 30,
+ 31, 32, 30, 30, 26, 28, 23, 25, 20, 21, 20, 19, 20, 20, 27, 29, 30, 32,
+ 29, 30, 26, 27, 23, 25, 20, 22, 18, 20, 18, 18, 26, 29, 30, 31, 29, 29,
+ 26, 27, 23, 25, 20, 22, 18, 20, 18, 20, 26, 29, 28, 32, 31, 26, 29, 23,
+ 27, 20, 24, 18, 22, 16, 20, 17,
+ /* Size 32x16 */
+ 64, 65, 67, 66, 61, 55, 53, 49, 42, 42, 42, 42, 41, 40, 39, 38, 37, 36,
+ 34, 33, 32, 32, 31, 30, 30, 29, 28, 28, 27, 27, 26, 26, 66, 65, 64, 62,
+ 57, 51, 50, 48, 44, 45, 45, 45, 44, 44, 43, 41, 40, 39, 38, 36, 36, 35,
+ 34, 33, 33, 32, 31, 31, 30, 29, 29, 29, 58, 55, 54, 53, 49, 45, 45, 44,
+ 43, 44, 44, 45, 44, 44, 43, 42, 41, 41, 39, 38, 37, 36, 35, 35, 34, 33,
+ 33, 32, 31, 30, 30, 28, 53, 51, 51, 49, 47, 43, 43, 43, 42, 42, 43, 44,
+ 43, 43, 42, 41, 41, 40, 38, 37, 37, 36, 35, 35, 34, 34, 33, 33, 32, 32,
+ 31, 32, 43, 44, 45, 45, 44, 43, 42, 41, 39, 39, 39, 38, 38, 38, 38, 37,
+ 37, 36, 35, 34, 34, 33, 33, 32, 32, 31, 30, 30, 30, 29, 29, 31, 42, 44,
+ 45, 45, 45, 45, 44, 41, 38, 37, 37, 35, 34, 34, 34, 33, 33, 32, 31, 31,
+ 30, 30, 30, 30, 30, 30, 31, 30, 30, 30, 29, 26, 41, 42, 44, 44, 44, 45,
+ 43, 41, 38, 37, 36, 34, 34, 33, 32, 32, 31, 31, 30, 29, 29, 29, 28, 29,
+ 29, 29, 28, 26, 26, 26, 26, 29, 39, 41, 42, 43, 43, 44, 42, 41, 38, 36,
+ 36, 33, 32, 32, 31, 30, 29, 29, 28, 28, 27, 27, 27, 26, 25, 25, 25, 27,
+ 28, 27, 27, 23, 36, 38, 39, 39, 40, 41, 40, 38, 36, 35, 34, 32, 31, 30,
+ 29, 28, 27, 27, 26, 25, 25, 25, 24, 24, 24, 26, 26, 24, 23, 23, 23, 27,
+ 34, 36, 37, 37, 38, 39, 38, 37, 35, 34, 33, 31, 30, 29, 28, 27, 26, 26,
+ 25, 24, 24, 24, 23, 24, 24, 23, 22, 22, 25, 25, 25, 20, 32, 34, 35, 36,
+ 37, 38, 37, 36, 34, 33, 32, 30, 29, 29, 27, 26, 26, 25, 24, 23, 23, 23,
+ 22, 22, 21, 21, 23, 23, 20, 20, 20, 24, 30, 32, 33, 34, 34, 36, 35, 34,
+ 32, 32, 31, 29, 29, 28, 26, 26, 25, 24, 23, 23, 22, 22, 22, 21, 21, 21,
+ 20, 19, 21, 22, 22, 18, 29, 31, 32, 33, 34, 34, 35, 33, 33, 31, 30, 30,
+ 27, 28, 27, 25, 26, 24, 23, 23, 21, 22, 21, 21, 21, 20, 20, 21, 20, 18,
+ 18, 22, 28, 30, 31, 32, 32, 32, 34, 33, 31, 31, 31, 28, 29, 26, 27, 25,
+ 25, 25, 23, 24, 21, 22, 21, 20, 20, 20, 21, 19, 19, 20, 20, 16, 27, 29,
+ 29, 30, 31, 31, 33, 33, 29, 31, 28, 30, 26, 29, 25, 27, 24, 25, 23, 23,
+ 22, 21, 21, 20, 21, 18, 20, 19, 20, 18, 18, 20, 26, 28, 28, 30, 29, 31,
+ 30, 33, 32, 27, 30, 26, 29, 25, 28, 23, 27, 22, 26, 20, 25, 20, 23, 18,
+ 22, 17, 21, 16, 20, 18, 20, 17,
+ /* Size 4x16 */
+ 66, 42, 34, 28, 64, 45, 37, 31, 57, 45, 38, 32, 50, 44, 38, 34, 44, 38,
+ 35, 31, 45, 37, 33, 31, 44, 34, 30, 29, 43, 34, 28, 27, 40, 33, 26, 25,
+ 38, 31, 25, 23, 36, 30, 24, 21, 34, 30, 23, 21, 33, 30, 24, 20, 31, 31,
+ 22, 21, 30, 30, 25, 19, 29, 29, 25, 20,
+ /* Size 16x4 */
+ 66, 64, 57, 50, 44, 45, 44, 43, 40, 38, 36, 34, 33, 31, 30, 29, 42, 45,
+ 45, 44, 38, 37, 34, 34, 33, 31, 30, 30, 30, 31, 30, 29, 34, 37, 38, 38,
+ 35, 33, 30, 28, 26, 25, 24, 23, 24, 22, 25, 25, 28, 31, 32, 34, 31, 31,
+ 29, 27, 25, 23, 21, 21, 20, 21, 19, 20,
+ /* Size 8x32 */
+ 64, 58, 43, 41, 36, 32, 29, 27, 65, 55, 44, 42, 38, 34, 31, 29, 67, 54,
+ 45, 44, 39, 35, 32, 29, 66, 53, 45, 44, 39, 36, 33, 30, 61, 49, 44, 44,
+ 40, 37, 34, 31, 55, 45, 43, 45, 41, 38, 34, 31, 53, 45, 42, 43, 40, 37,
+ 35, 33, 49, 44, 41, 41, 38, 36, 33, 33, 42, 43, 39, 38, 36, 34, 33, 29,
+ 42, 44, 39, 37, 35, 33, 31, 31, 42, 44, 39, 36, 34, 32, 30, 28, 42, 45,
+ 38, 34, 32, 30, 30, 30, 41, 44, 38, 34, 31, 29, 27, 26, 40, 44, 38, 33,
+ 30, 29, 28, 29, 39, 43, 38, 32, 29, 27, 27, 25, 38, 42, 37, 32, 28, 26,
+ 25, 27, 37, 41, 37, 31, 27, 26, 26, 24, 36, 41, 36, 31, 27, 25, 24, 25,
+ 34, 39, 35, 30, 26, 24, 23, 23, 33, 38, 34, 29, 25, 23, 23, 23, 32, 37,
+ 34, 29, 25, 23, 21, 22, 32, 36, 33, 29, 25, 23, 22, 21, 31, 35, 33, 28,
+ 24, 22, 21, 21, 30, 35, 32, 29, 24, 22, 21, 20, 30, 34, 32, 29, 24, 21,
+ 21, 21, 29, 33, 31, 29, 26, 21, 20, 18, 28, 33, 30, 28, 26, 23, 20, 20,
+ 28, 32, 30, 26, 24, 23, 21, 19, 27, 31, 30, 26, 23, 20, 20, 20, 27, 30,
+ 29, 26, 23, 20, 18, 18, 26, 30, 29, 26, 23, 20, 18, 18, 26, 28, 31, 29,
+ 27, 24, 22, 20,
+ /* Size 32x8 */
+ 64, 65, 67, 66, 61, 55, 53, 49, 42, 42, 42, 42, 41, 40, 39, 38, 37, 36,
+ 34, 33, 32, 32, 31, 30, 30, 29, 28, 28, 27, 27, 26, 26, 58, 55, 54, 53,
+ 49, 45, 45, 44, 43, 44, 44, 45, 44, 44, 43, 42, 41, 41, 39, 38, 37, 36,
+ 35, 35, 34, 33, 33, 32, 31, 30, 30, 28, 43, 44, 45, 45, 44, 43, 42, 41,
+ 39, 39, 39, 38, 38, 38, 38, 37, 37, 36, 35, 34, 34, 33, 33, 32, 32, 31,
+ 30, 30, 30, 29, 29, 31, 41, 42, 44, 44, 44, 45, 43, 41, 38, 37, 36, 34,
+ 34, 33, 32, 32, 31, 31, 30, 29, 29, 29, 28, 29, 29, 29, 28, 26, 26, 26,
+ 26, 29, 36, 38, 39, 39, 40, 41, 40, 38, 36, 35, 34, 32, 31, 30, 29, 28,
+ 27, 27, 26, 25, 25, 25, 24, 24, 24, 26, 26, 24, 23, 23, 23, 27, 32, 34,
+ 35, 36, 37, 38, 37, 36, 34, 33, 32, 30, 29, 29, 27, 26, 26, 25, 24, 23,
+ 23, 23, 22, 22, 21, 21, 23, 23, 20, 20, 20, 24, 29, 31, 32, 33, 34, 34,
+ 35, 33, 33, 31, 30, 30, 27, 28, 27, 25, 26, 24, 23, 23, 21, 22, 21, 21,
+ 21, 20, 20, 21, 20, 18, 18, 22, 27, 29, 29, 30, 31, 31, 33, 33, 29, 31,
+ 28, 30, 26, 29, 25, 27, 24, 25, 23, 23, 22, 21, 21, 20, 21, 18, 20, 19,
+ 20, 18, 18, 20 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 52, 27, 27, 15,
+#endif
+ /* Size 4x4 */
+ 63, 53, 32, 23, 53, 36, 26, 20, 32, 26, 18, 17, 23, 20, 17, 12,
+ /* Size 8x8 */
+ 64, 63, 59, 45, 36, 27, 24, 21, 63, 60, 55, 45, 38, 29, 26, 22, 59, 55,
+ 42, 36, 32, 26, 23, 22, 45, 45, 36, 29, 25, 21, 21, 20, 36, 38, 32, 25,
+ 22, 18, 17, 17, 27, 29, 26, 21, 18, 15, 15, 14, 24, 26, 23, 21, 17, 15,
+ 13, 11, 21, 22, 22, 20, 17, 14, 11, 11,
+ /* Size 16x16 */
+ 64, 65, 65, 64, 59, 52, 47, 41, 35, 31, 29, 25, 23, 22, 20, 19, 65, 64,
+ 63, 63, 60, 54, 49, 44, 38, 34, 31, 27, 25, 24, 22, 20, 65, 63, 61, 60,
+ 57, 53, 49, 44, 39, 35, 32, 28, 26, 25, 23, 21, 64, 63, 60, 58, 55, 51,
+ 48, 44, 39, 35, 33, 29, 27, 25, 24, 22, 59, 60, 57, 55, 48, 44, 41, 38,
+ 34, 32, 29, 26, 25, 24, 22, 21, 52, 54, 53, 51, 44, 38, 35, 33, 30, 28,
+ 26, 24, 23, 23, 21, 20, 47, 49, 49, 48, 41, 35, 32, 30, 27, 26, 24, 22,
+ 21, 21, 20, 18, 41, 44, 44, 44, 38, 33, 30, 28, 25, 24, 22, 21, 20, 19,
+ 20, 17, 35, 38, 39, 39, 34, 30, 27, 25, 23, 21, 20, 19, 18, 17, 18, 16,
+ 31, 34, 35, 35, 32, 28, 26, 24, 21, 20, 18, 17, 16, 17, 17, 14, 29, 31,
+ 32, 33, 29, 26, 24, 22, 20, 18, 17, 16, 15, 16, 16, 14, 25, 27, 28, 29,
+ 26, 24, 22, 21, 19, 17, 16, 15, 14, 14, 14, 12, 23, 25, 26, 27, 25, 23,
+ 21, 20, 18, 16, 15, 14, 14, 13, 12, 12, 22, 24, 25, 25, 24, 23, 21, 19,
+ 17, 17, 16, 14, 13, 13, 12, 10, 20, 22, 23, 24, 22, 21, 20, 20, 18, 17,
+ 16, 14, 12, 12, 12, 11, 19, 20, 21, 22, 21, 20, 18, 17, 16, 14, 14, 12,
+ 12, 10, 11, 11,
+ /* Size 32x32 */
+ 64, 65, 65, 65, 65, 64, 64, 60, 59, 57, 52, 50, 47, 43, 41, 38, 35, 34,
+ 31, 29, 29, 26, 25, 25, 23, 23, 22, 21, 20, 20, 19, 18, 65, 64, 64, 64,
+ 64, 63, 63, 60, 59, 59, 53, 52, 48, 45, 43, 40, 37, 36, 33, 31, 30, 27,
+ 26, 26, 25, 24, 23, 22, 21, 21, 20, 20, 65, 64, 64, 64, 63, 63, 63, 61,
+ 60, 59, 54, 53, 49, 46, 44, 41, 38, 37, 34, 32, 31, 28, 27, 27, 25, 24,
+ 24, 23, 22, 21, 20, 19, 65, 64, 64, 63, 63, 63, 63, 61, 60, 59, 55, 53,
+ 50, 47, 45, 41, 39, 38, 34, 32, 32, 28, 28, 27, 26, 25, 24, 23, 23, 22,
+ 21, 21, 65, 64, 63, 63, 61, 61, 60, 58, 57, 56, 53, 51, 49, 46, 44, 41,
+ 39, 38, 35, 33, 32, 29, 28, 28, 26, 25, 25, 24, 23, 22, 21, 20, 64, 63,
+ 63, 63, 61, 60, 59, 57, 56, 55, 51, 51, 48, 45, 44, 41, 39, 38, 35, 33,
+ 32, 29, 28, 28, 27, 26, 25, 24, 23, 22, 22, 21, 64, 63, 63, 63, 60, 59,
+ 58, 55, 55, 53, 51, 50, 48, 45, 44, 41, 39, 38, 35, 33, 33, 29, 29, 28,
+ 27, 26, 25, 25, 24, 23, 22, 21, 60, 60, 61, 61, 58, 57, 55, 52, 50, 48,
+ 46, 45, 43, 41, 40, 38, 36, 35, 33, 31, 30, 28, 27, 27, 25, 25, 24, 25,
+ 24, 23, 23, 22, 59, 59, 60, 60, 57, 56, 55, 50, 48, 46, 44, 43, 41, 39,
+ 38, 36, 34, 34, 32, 30, 29, 27, 26, 26, 25, 25, 24, 23, 22, 21, 21, 22,
+ 57, 59, 59, 59, 56, 55, 53, 48, 46, 42, 41, 40, 38, 36, 36, 34, 33, 32,
+ 30, 29, 28, 26, 26, 25, 24, 23, 23, 22, 23, 22, 21, 19, 52, 53, 54, 55,
+ 53, 51, 51, 46, 44, 41, 38, 37, 35, 34, 33, 32, 30, 29, 28, 27, 26, 24,
+ 24, 24, 23, 23, 23, 22, 21, 20, 20, 21, 50, 52, 53, 53, 51, 51, 50, 45,
+ 43, 40, 37, 36, 34, 33, 32, 31, 29, 29, 27, 26, 26, 24, 23, 23, 22, 22,
+ 21, 20, 21, 21, 21, 18, 47, 48, 49, 50, 49, 48, 48, 43, 41, 38, 35, 34,
+ 32, 31, 30, 29, 27, 27, 26, 25, 24, 23, 22, 22, 21, 20, 21, 21, 20, 19,
+ 18, 20, 43, 45, 46, 47, 46, 45, 45, 41, 39, 36, 34, 33, 31, 29, 29, 27,
+ 26, 25, 24, 23, 23, 21, 21, 21, 20, 21, 20, 19, 19, 20, 20, 17, 41, 43,
+ 44, 45, 44, 44, 44, 40, 38, 36, 33, 32, 30, 29, 28, 26, 25, 25, 24, 23,
+ 22, 21, 21, 20, 20, 19, 19, 20, 20, 17, 17, 19, 38, 40, 41, 41, 41, 41,
+ 41, 38, 36, 34, 32, 31, 29, 27, 26, 25, 24, 23, 22, 21, 21, 20, 19, 19,
+ 19, 18, 19, 18, 17, 19, 19, 16, 35, 37, 38, 39, 39, 39, 39, 36, 34, 33,
+ 30, 29, 27, 26, 25, 24, 23, 22, 21, 20, 20, 19, 19, 18, 18, 18, 17, 17,
+ 18, 16, 16, 18, 34, 36, 37, 38, 38, 38, 38, 35, 34, 32, 29, 29, 27, 25,
+ 25, 23, 22, 22, 21, 20, 20, 18, 18, 18, 18, 17, 17, 18, 15, 17, 18, 15,
+ 31, 33, 34, 34, 35, 35, 35, 33, 32, 30, 28, 27, 26, 24, 24, 22, 21, 21,
+ 20, 19, 18, 17, 17, 17, 16, 17, 17, 16, 17, 16, 14, 17, 29, 31, 32, 32,
+ 33, 33, 33, 31, 30, 29, 27, 26, 25, 23, 23, 21, 20, 20, 19, 18, 18, 17,
+ 16, 16, 16, 16, 15, 17, 15, 15, 17, 13, 29, 30, 31, 32, 32, 32, 33, 30,
+ 29, 28, 26, 26, 24, 23, 22, 21, 20, 20, 18, 18, 17, 16, 16, 16, 15, 15,
+ 16, 14, 16, 15, 14, 16, 26, 27, 28, 28, 29, 29, 29, 28, 27, 26, 24, 24,
+ 23, 21, 21, 20, 19, 18, 17, 17, 16, 15, 15, 15, 14, 15, 14, 15, 14, 14,
+ 16, 13, 25, 26, 27, 28, 28, 28, 29, 27, 26, 26, 24, 23, 22, 21, 21, 19,
+ 19, 18, 17, 16, 16, 15, 15, 15, 14, 14, 14, 14, 14, 14, 12, 15, 25, 26,
+ 27, 27, 28, 28, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 18, 17, 16,
+ 16, 15, 15, 15, 14, 14, 13, 13, 14, 12, 15, 11, 23, 25, 25, 26, 26, 27,
+ 27, 25, 25, 24, 23, 22, 21, 20, 20, 19, 18, 18, 16, 16, 15, 14, 14, 14,
+ 14, 14, 13, 13, 12, 14, 12, 14, 23, 24, 24, 25, 25, 26, 26, 25, 25, 23,
+ 23, 22, 20, 21, 19, 18, 18, 17, 17, 16, 15, 15, 14, 14, 14, 13, 14, 13,
+ 13, 11, 14, 11, 22, 23, 24, 24, 25, 25, 25, 24, 24, 23, 23, 21, 21, 20,
+ 19, 19, 17, 17, 17, 15, 16, 14, 14, 13, 13, 14, 13, 13, 12, 13, 10, 13,
+ 21, 22, 23, 23, 24, 24, 25, 25, 23, 22, 22, 20, 21, 19, 20, 18, 17, 18,
+ 16, 17, 14, 15, 14, 13, 13, 13, 13, 12, 13, 12, 13, 9, 20, 21, 22, 23,
+ 23, 23, 24, 24, 22, 23, 21, 21, 20, 19, 20, 17, 18, 15, 17, 15, 16, 14,
+ 14, 14, 12, 13, 12, 13, 12, 13, 11, 12, 20, 21, 21, 22, 22, 22, 23, 23,
+ 21, 22, 20, 21, 19, 20, 17, 19, 16, 17, 16, 15, 15, 14, 14, 12, 14, 11,
+ 13, 12, 13, 11, 12, 11, 19, 20, 20, 21, 21, 22, 22, 23, 21, 21, 20, 21,
+ 18, 20, 17, 19, 16, 18, 14, 17, 14, 16, 12, 15, 12, 14, 10, 13, 11, 12,
+ 11, 12, 18, 20, 19, 21, 20, 21, 21, 22, 22, 19, 21, 18, 20, 17, 19, 16,
+ 18, 15, 17, 13, 16, 13, 15, 11, 14, 11, 13, 9, 12, 11, 12, 10,
+ /* Size 4x8 */
+ 64, 53, 33, 23, 63, 51, 35, 24, 59, 40, 30, 23, 46, 34, 24, 19, 38, 29,
+ 21, 17, 28, 24, 17, 15, 25, 23, 16, 13, 22, 21, 17, 13,
+ /* Size 8x4 */
+ 64, 63, 59, 46, 38, 28, 25, 22, 53, 51, 40, 34, 29, 24, 23, 21, 33, 35,
+ 30, 24, 21, 17, 16, 17, 23, 24, 23, 19, 17, 15, 13, 13,
+ /* Size 8x16 */
+ 64, 64, 57, 47, 35, 26, 23, 20, 65, 63, 59, 49, 38, 28, 25, 22, 64, 61,
+ 56, 49, 39, 29, 26, 23, 64, 59, 53, 48, 39, 30, 27, 24, 59, 57, 46, 41,
+ 34, 27, 25, 22, 52, 52, 41, 35, 30, 24, 23, 20, 47, 48, 38, 33, 27, 23,
+ 21, 19, 42, 44, 36, 30, 25, 21, 20, 17, 36, 39, 33, 27, 23, 19, 18, 17,
+ 32, 35, 30, 26, 21, 17, 16, 16, 29, 32, 28, 24, 20, 16, 15, 15, 25, 28,
+ 25, 22, 19, 15, 14, 14, 23, 26, 24, 21, 18, 15, 14, 14, 22, 25, 23, 20,
+ 18, 16, 13, 13, 20, 23, 22, 19, 16, 14, 13, 13, 19, 21, 21, 18, 16, 13,
+ 11, 11,
+ /* Size 16x8 */
+ 64, 65, 64, 64, 59, 52, 47, 42, 36, 32, 29, 25, 23, 22, 20, 19, 64, 63,
+ 61, 59, 57, 52, 48, 44, 39, 35, 32, 28, 26, 25, 23, 21, 57, 59, 56, 53,
+ 46, 41, 38, 36, 33, 30, 28, 25, 24, 23, 22, 21, 47, 49, 49, 48, 41, 35,
+ 33, 30, 27, 26, 24, 22, 21, 20, 19, 18, 35, 38, 39, 39, 34, 30, 27, 25,
+ 23, 21, 20, 19, 18, 18, 16, 16, 26, 28, 29, 30, 27, 24, 23, 21, 19, 17,
+ 16, 15, 15, 16, 14, 13, 23, 25, 26, 27, 25, 23, 21, 20, 18, 16, 15, 14,
+ 14, 13, 13, 11, 20, 22, 23, 24, 22, 20, 19, 17, 17, 16, 15, 14, 14, 13,
+ 13, 11,
+ /* Size 16x32 */
+ 64, 65, 64, 64, 57, 52, 47, 38, 35, 31, 26, 25, 23, 22, 20, 19, 65, 64,
+ 63, 63, 58, 53, 48, 40, 37, 33, 27, 26, 24, 23, 21, 20, 65, 64, 63, 63,
+ 59, 54, 49, 41, 38, 34, 28, 27, 25, 23, 22, 20, 65, 63, 63, 62, 59, 55,
+ 50, 41, 39, 34, 28, 28, 25, 24, 23, 22, 64, 63, 61, 60, 56, 53, 49, 41,
+ 39, 35, 29, 28, 26, 24, 23, 21, 64, 63, 60, 59, 55, 51, 48, 41, 39, 35,
+ 29, 29, 26, 24, 23, 22, 64, 62, 59, 58, 53, 51, 48, 41, 39, 35, 30, 29,
+ 27, 25, 24, 22, 60, 60, 58, 55, 48, 46, 43, 38, 36, 33, 28, 27, 25, 25,
+ 24, 23, 59, 60, 57, 55, 46, 44, 41, 36, 34, 32, 27, 27, 25, 23, 22, 23,
+ 57, 59, 55, 53, 43, 40, 38, 34, 33, 30, 26, 26, 24, 23, 23, 20, 52, 55,
+ 52, 51, 41, 38, 35, 32, 30, 28, 24, 24, 23, 23, 20, 22, 51, 53, 51, 49,
+ 40, 37, 34, 31, 29, 27, 24, 24, 22, 21, 22, 19, 47, 50, 48, 48, 38, 35,
+ 33, 29, 27, 26, 23, 22, 21, 21, 19, 21, 43, 46, 45, 45, 37, 34, 31, 27,
+ 26, 24, 21, 21, 21, 19, 21, 17, 42, 45, 44, 44, 36, 33, 30, 26, 25, 24,
+ 21, 21, 20, 20, 17, 20, 38, 41, 41, 41, 34, 32, 29, 25, 24, 22, 20, 20,
+ 18, 18, 19, 16, 36, 39, 39, 39, 33, 30, 27, 24, 23, 21, 19, 19, 18, 18,
+ 17, 19, 35, 38, 38, 38, 32, 29, 27, 23, 22, 21, 18, 18, 17, 17, 17, 15,
+ 32, 34, 35, 35, 30, 28, 26, 22, 21, 20, 17, 17, 16, 16, 16, 18, 30, 32,
+ 33, 33, 29, 27, 25, 21, 20, 19, 17, 16, 16, 17, 16, 13, 29, 31, 32, 32,
+ 28, 26, 24, 21, 20, 18, 16, 16, 15, 14, 15, 17, 26, 28, 29, 29, 26, 24,
+ 23, 20, 19, 17, 15, 15, 15, 15, 14, 13, 25, 28, 28, 29, 25, 24, 22, 20,
+ 19, 17, 15, 15, 14, 14, 14, 16, 25, 27, 28, 28, 25, 24, 22, 19, 18, 17,
+ 15, 15, 14, 13, 13, 12, 23, 26, 26, 27, 24, 23, 21, 19, 18, 16, 15, 14,
+ 14, 13, 14, 15, 23, 25, 25, 26, 23, 23, 21, 19, 18, 16, 15, 14, 13, 13,
+ 11, 11, 22, 24, 25, 25, 23, 23, 20, 19, 18, 15, 16, 13, 13, 13, 13, 14,
+ 21, 23, 24, 24, 22, 22, 19, 20, 17, 15, 15, 13, 14, 12, 12, 10, 20, 23,
+ 23, 24, 22, 22, 19, 20, 16, 17, 14, 14, 13, 12, 13, 13, 20, 22, 22, 23,
+ 21, 21, 19, 19, 16, 17, 13, 15, 11, 13, 11, 11, 19, 21, 21, 22, 21, 21,
+ 18, 19, 16, 17, 13, 15, 11, 13, 11, 12, 18, 21, 20, 22, 22, 18, 20, 16,
+ 18, 13, 16, 11, 14, 10, 13, 10,
+ /* Size 32x16 */
+ 64, 65, 65, 65, 64, 64, 64, 60, 59, 57, 52, 51, 47, 43, 42, 38, 36, 35,
+ 32, 30, 29, 26, 25, 25, 23, 23, 22, 21, 20, 20, 19, 18, 65, 64, 64, 63,
+ 63, 63, 62, 60, 60, 59, 55, 53, 50, 46, 45, 41, 39, 38, 34, 32, 31, 28,
+ 28, 27, 26, 25, 24, 23, 23, 22, 21, 21, 64, 63, 63, 63, 61, 60, 59, 58,
+ 57, 55, 52, 51, 48, 45, 44, 41, 39, 38, 35, 33, 32, 29, 28, 28, 26, 25,
+ 25, 24, 23, 22, 21, 20, 64, 63, 63, 62, 60, 59, 58, 55, 55, 53, 51, 49,
+ 48, 45, 44, 41, 39, 38, 35, 33, 32, 29, 29, 28, 27, 26, 25, 24, 24, 23,
+ 22, 22, 57, 58, 59, 59, 56, 55, 53, 48, 46, 43, 41, 40, 38, 37, 36, 34,
+ 33, 32, 30, 29, 28, 26, 25, 25, 24, 23, 23, 22, 22, 21, 21, 22, 52, 53,
+ 54, 55, 53, 51, 51, 46, 44, 40, 38, 37, 35, 34, 33, 32, 30, 29, 28, 27,
+ 26, 24, 24, 24, 23, 23, 23, 22, 22, 21, 21, 18, 47, 48, 49, 50, 49, 48,
+ 48, 43, 41, 38, 35, 34, 33, 31, 30, 29, 27, 27, 26, 25, 24, 23, 22, 22,
+ 21, 21, 20, 19, 19, 19, 18, 20, 38, 40, 41, 41, 41, 41, 41, 38, 36, 34,
+ 32, 31, 29, 27, 26, 25, 24, 23, 22, 21, 21, 20, 20, 19, 19, 19, 19, 20,
+ 20, 19, 19, 16, 35, 37, 38, 39, 39, 39, 39, 36, 34, 33, 30, 29, 27, 26,
+ 25, 24, 23, 22, 21, 20, 20, 19, 19, 18, 18, 18, 18, 17, 16, 16, 16, 18,
+ 31, 33, 34, 34, 35, 35, 35, 33, 32, 30, 28, 27, 26, 24, 24, 22, 21, 21,
+ 20, 19, 18, 17, 17, 17, 16, 16, 15, 15, 17, 17, 17, 13, 26, 27, 28, 28,
+ 29, 29, 30, 28, 27, 26, 24, 24, 23, 21, 21, 20, 19, 18, 17, 17, 16, 15,
+ 15, 15, 15, 15, 16, 15, 14, 13, 13, 16, 25, 26, 27, 28, 28, 29, 29, 27,
+ 27, 26, 24, 24, 22, 21, 21, 20, 19, 18, 17, 16, 16, 15, 15, 15, 14, 14,
+ 13, 13, 14, 15, 15, 11, 23, 24, 25, 25, 26, 26, 27, 25, 25, 24, 23, 22,
+ 21, 21, 20, 18, 18, 17, 16, 16, 15, 15, 14, 14, 14, 13, 13, 14, 13, 11,
+ 11, 14, 22, 23, 23, 24, 24, 24, 25, 25, 23, 23, 23, 21, 21, 19, 20, 18,
+ 18, 17, 16, 17, 14, 15, 14, 13, 13, 13, 13, 12, 12, 13, 13, 10, 20, 21,
+ 22, 23, 23, 23, 24, 24, 22, 23, 20, 22, 19, 21, 17, 19, 17, 17, 16, 16,
+ 15, 14, 14, 13, 14, 11, 13, 12, 13, 11, 11, 13, 19, 20, 20, 22, 21, 22,
+ 22, 23, 23, 20, 22, 19, 21, 17, 20, 16, 19, 15, 18, 13, 17, 13, 16, 12,
+ 15, 11, 14, 10, 13, 11, 12, 10,
+ /* Size 4x16 */
+ 65, 52, 31, 22, 64, 54, 34, 23, 63, 53, 35, 24, 62, 51, 35, 25, 60, 44,
+ 32, 23, 55, 38, 28, 23, 50, 35, 26, 21, 45, 33, 24, 20, 39, 30, 21, 18,
+ 34, 28, 20, 16, 31, 26, 18, 14, 28, 24, 17, 14, 26, 23, 16, 13, 24, 23,
+ 15, 13, 23, 22, 17, 12, 21, 21, 17, 13,
+ /* Size 16x4 */
+ 65, 64, 63, 62, 60, 55, 50, 45, 39, 34, 31, 28, 26, 24, 23, 21, 52, 54,
+ 53, 51, 44, 38, 35, 33, 30, 28, 26, 24, 23, 23, 22, 21, 31, 34, 35, 35,
+ 32, 28, 26, 24, 21, 20, 18, 17, 16, 15, 17, 17, 22, 23, 24, 25, 23, 23,
+ 21, 20, 18, 16, 14, 14, 13, 13, 12, 13,
+ /* Size 8x32 */
+ 64, 64, 57, 47, 35, 26, 23, 20, 65, 63, 58, 48, 37, 27, 24, 21, 65, 63,
+ 59, 49, 38, 28, 25, 22, 65, 63, 59, 50, 39, 28, 25, 23, 64, 61, 56, 49,
+ 39, 29, 26, 23, 64, 60, 55, 48, 39, 29, 26, 23, 64, 59, 53, 48, 39, 30,
+ 27, 24, 60, 58, 48, 43, 36, 28, 25, 24, 59, 57, 46, 41, 34, 27, 25, 22,
+ 57, 55, 43, 38, 33, 26, 24, 23, 52, 52, 41, 35, 30, 24, 23, 20, 51, 51,
+ 40, 34, 29, 24, 22, 22, 47, 48, 38, 33, 27, 23, 21, 19, 43, 45, 37, 31,
+ 26, 21, 21, 21, 42, 44, 36, 30, 25, 21, 20, 17, 38, 41, 34, 29, 24, 20,
+ 18, 19, 36, 39, 33, 27, 23, 19, 18, 17, 35, 38, 32, 27, 22, 18, 17, 17,
+ 32, 35, 30, 26, 21, 17, 16, 16, 30, 33, 29, 25, 20, 17, 16, 16, 29, 32,
+ 28, 24, 20, 16, 15, 15, 26, 29, 26, 23, 19, 15, 15, 14, 25, 28, 25, 22,
+ 19, 15, 14, 14, 25, 28, 25, 22, 18, 15, 14, 13, 23, 26, 24, 21, 18, 15,
+ 14, 14, 23, 25, 23, 21, 18, 15, 13, 11, 22, 25, 23, 20, 18, 16, 13, 13,
+ 21, 24, 22, 19, 17, 15, 14, 12, 20, 23, 22, 19, 16, 14, 13, 13, 20, 22,
+ 21, 19, 16, 13, 11, 11, 19, 21, 21, 18, 16, 13, 11, 11, 18, 20, 22, 20,
+ 18, 16, 14, 13,
+ /* Size 32x8 */
+ 64, 65, 65, 65, 64, 64, 64, 60, 59, 57, 52, 51, 47, 43, 42, 38, 36, 35,
+ 32, 30, 29, 26, 25, 25, 23, 23, 22, 21, 20, 20, 19, 18, 64, 63, 63, 63,
+ 61, 60, 59, 58, 57, 55, 52, 51, 48, 45, 44, 41, 39, 38, 35, 33, 32, 29,
+ 28, 28, 26, 25, 25, 24, 23, 22, 21, 20, 57, 58, 59, 59, 56, 55, 53, 48,
+ 46, 43, 41, 40, 38, 37, 36, 34, 33, 32, 30, 29, 28, 26, 25, 25, 24, 23,
+ 23, 22, 22, 21, 21, 22, 47, 48, 49, 50, 49, 48, 48, 43, 41, 38, 35, 34,
+ 33, 31, 30, 29, 27, 27, 26, 25, 24, 23, 22, 22, 21, 21, 20, 19, 19, 19,
+ 18, 20, 35, 37, 38, 39, 39, 39, 39, 36, 34, 33, 30, 29, 27, 26, 25, 24,
+ 23, 22, 21, 20, 20, 19, 19, 18, 18, 18, 18, 17, 16, 16, 16, 18, 26, 27,
+ 28, 28, 29, 29, 30, 28, 27, 26, 24, 24, 23, 21, 21, 20, 19, 18, 17, 17,
+ 16, 15, 15, 15, 15, 15, 16, 15, 14, 13, 13, 16, 23, 24, 25, 25, 26, 26,
+ 27, 25, 25, 24, 23, 22, 21, 21, 20, 18, 18, 17, 16, 16, 15, 15, 14, 14,
+ 14, 13, 13, 14, 13, 11, 11, 14, 20, 21, 22, 23, 23, 23, 24, 24, 22, 23,
+ 20, 22, 19, 21, 17, 19, 17, 17, 16, 16, 15, 14, 14, 13, 14, 11, 13, 12,
+ 13, 11, 11, 13 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 42, 35, 35, 22,
+#endif
+ /* Size 4x4 */
+ 64, 45, 38, 32, 45, 37, 33, 29, 38, 33, 26, 25, 32, 29, 25, 20,
+ /* Size 8x8 */
+ 65, 56, 43, 42, 39, 34, 32, 29, 56, 48, 43, 44, 42, 37, 34, 32, 43, 43,
+ 39, 38, 37, 34, 32, 32, 42, 44, 38, 34, 32, 29, 29, 29, 39, 42, 37, 32,
+ 29, 26, 25, 26, 34, 37, 34, 29, 26, 23, 23, 22, 32, 34, 32, 29, 25, 23,
+ 21, 19, 29, 32, 32, 29, 26, 22, 19, 19,
+ /* Size 16x16 */
+ 64, 67, 61, 56, 46, 42, 42, 40, 38, 36, 34, 32, 31, 29, 28, 27, 67, 65,
+ 59, 52, 47, 45, 45, 43, 41, 39, 37, 34, 33, 32, 31, 29, 61, 59, 53, 47,
+ 45, 44, 45, 44, 42, 40, 38, 36, 35, 34, 32, 31, 56, 52, 47, 43, 43, 44,
+ 45, 44, 43, 41, 39, 37, 36, 35, 34, 33, 46, 47, 45, 43, 41, 40, 40, 40,
+ 39, 38, 36, 34, 34, 33, 31, 30, 42, 45, 44, 44, 40, 38, 37, 36, 35, 34,
+ 33, 32, 31, 32, 30, 29, 42, 45, 45, 45, 40, 37, 35, 34, 33, 32, 31, 30,
+ 29, 29, 29, 27, 40, 43, 44, 44, 40, 36, 34, 33, 31, 30, 29, 28, 28, 27,
+ 28, 26, 38, 41, 42, 43, 39, 35, 33, 31, 29, 28, 27, 26, 26, 25, 27, 24,
+ 36, 39, 40, 41, 38, 34, 32, 30, 28, 27, 26, 25, 24, 25, 26, 23, 34, 37,
+ 38, 39, 36, 33, 31, 29, 27, 26, 25, 24, 23, 24, 24, 22, 32, 34, 36, 37,
+ 34, 32, 30, 28, 26, 25, 24, 23, 22, 22, 22, 20, 31, 33, 35, 36, 34, 31,
+ 29, 28, 26, 24, 23, 22, 21, 21, 20, 19, 29, 32, 34, 35, 33, 32, 29, 27,
+ 25, 25, 24, 22, 21, 20, 20, 18, 28, 31, 32, 34, 31, 30, 29, 28, 27, 26,
+ 24, 22, 20, 20, 19, 19, 27, 29, 31, 33, 30, 29, 27, 26, 24, 23, 22, 20,
+ 19, 18, 19, 18,
+ /* Size 32x32 */
+ 64, 66, 67, 67, 61, 59, 56, 49, 46, 42, 42, 42, 42, 41, 40, 39, 38, 37,
+ 36, 35, 34, 32, 32, 32, 31, 30, 29, 29, 28, 28, 27, 27, 66, 65, 65, 66,
+ 59, 56, 53, 48, 46, 43, 44, 44, 44, 42, 42, 41, 40, 39, 38, 37, 36, 34,
+ 34, 33, 32, 32, 31, 31, 30, 29, 29, 29, 67, 65, 65, 65, 59, 55, 52, 48,
+ 47, 44, 45, 45, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 34, 33, 33,
+ 32, 31, 31, 30, 29, 28, 67, 66, 65, 64, 58, 55, 51, 48, 47, 44, 45, 45,
+ 46, 44, 44, 43, 41, 41, 39, 38, 38, 36, 35, 35, 34, 33, 33, 32, 32, 31,
+ 30, 30, 61, 59, 59, 58, 53, 50, 47, 46, 45, 43, 44, 45, 45, 44, 44, 43,
+ 42, 41, 40, 39, 38, 36, 36, 36, 35, 34, 34, 33, 32, 32, 31, 30, 59, 56,
+ 55, 55, 50, 48, 45, 45, 44, 43, 44, 45, 45, 44, 44, 44, 42, 42, 41, 39,
+ 39, 37, 37, 36, 35, 34, 34, 33, 32, 32, 31, 31, 56, 53, 52, 51, 47, 45,
+ 43, 43, 43, 43, 44, 45, 45, 45, 44, 44, 43, 42, 41, 40, 39, 38, 37, 37,
+ 36, 35, 35, 34, 34, 33, 33, 31, 49, 48, 48, 48, 46, 45, 43, 42, 41, 41,
+ 41, 41, 42, 41, 41, 41, 40, 39, 38, 38, 37, 36, 35, 35, 34, 34, 34, 34,
+ 34, 33, 33, 33, 46, 46, 47, 47, 45, 44, 43, 41, 41, 40, 40, 40, 40, 40,
+ 40, 39, 39, 38, 38, 37, 36, 35, 34, 34, 34, 34, 33, 32, 31, 31, 30, 32,
+ 42, 43, 44, 44, 43, 43, 43, 41, 40, 39, 39, 38, 38, 38, 38, 38, 37, 37,
+ 36, 35, 35, 34, 34, 33, 33, 32, 31, 31, 32, 32, 31, 29, 42, 44, 45, 45,
+ 44, 44, 44, 41, 40, 39, 38, 38, 37, 36, 36, 36, 35, 35, 34, 34, 33, 32,
+ 32, 32, 31, 31, 32, 31, 30, 29, 29, 31, 42, 44, 45, 45, 45, 45, 45, 41,
+ 40, 38, 38, 37, 36, 36, 36, 35, 34, 34, 34, 33, 33, 32, 31, 31, 31, 31,
+ 30, 29, 30, 31, 30, 27, 42, 44, 45, 46, 45, 45, 45, 42, 40, 38, 37, 36,
+ 35, 34, 34, 33, 33, 33, 32, 32, 31, 30, 30, 30, 29, 29, 29, 30, 29, 27,
+ 27, 30, 41, 42, 44, 44, 44, 44, 45, 41, 40, 38, 36, 36, 34, 34, 33, 32,
+ 32, 32, 31, 30, 30, 29, 29, 29, 28, 29, 29, 27, 27, 29, 29, 26, 40, 42,
+ 43, 44, 44, 44, 44, 41, 40, 38, 36, 36, 34, 33, 33, 32, 31, 31, 30, 30,
+ 29, 29, 28, 28, 28, 28, 27, 28, 28, 26, 26, 29, 39, 41, 42, 43, 43, 44,
+ 44, 41, 39, 38, 36, 35, 33, 32, 32, 31, 30, 30, 29, 28, 28, 27, 27, 27,
+ 27, 26, 27, 26, 26, 28, 28, 24, 38, 40, 41, 41, 42, 42, 43, 40, 39, 37,
+ 35, 34, 33, 32, 31, 30, 29, 29, 28, 27, 27, 26, 26, 26, 26, 26, 25, 26,
+ 27, 25, 24, 27, 37, 39, 40, 41, 41, 42, 42, 39, 38, 37, 35, 34, 33, 32,
+ 31, 30, 29, 29, 28, 27, 27, 26, 26, 26, 25, 25, 25, 26, 24, 26, 26, 23,
+ 36, 38, 39, 39, 40, 41, 41, 38, 38, 36, 34, 34, 32, 31, 30, 29, 28, 28,
+ 27, 26, 26, 25, 25, 25, 24, 25, 25, 24, 26, 24, 23, 26, 35, 37, 38, 38,
+ 39, 39, 40, 38, 37, 35, 34, 33, 32, 30, 30, 28, 27, 27, 26, 26, 25, 24,
+ 24, 24, 24, 24, 23, 25, 23, 24, 25, 21, 34, 36, 37, 38, 38, 39, 39, 37,
+ 36, 35, 33, 33, 31, 30, 29, 28, 27, 27, 26, 25, 25, 24, 24, 24, 23, 23,
+ 24, 22, 24, 23, 22, 25, 32, 34, 35, 36, 36, 37, 38, 36, 35, 34, 32, 32,
+ 30, 29, 29, 27, 26, 26, 25, 24, 24, 23, 23, 23, 22, 23, 22, 23, 22, 22,
+ 24, 21, 32, 34, 34, 35, 36, 37, 37, 35, 34, 34, 32, 31, 30, 29, 28, 27,
+ 26, 26, 25, 24, 24, 23, 23, 23, 22, 22, 22, 22, 22, 23, 20, 24, 32, 33,
+ 34, 35, 36, 36, 37, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 26, 25, 24,
+ 24, 23, 23, 22, 22, 22, 21, 21, 22, 20, 23, 19, 31, 32, 33, 34, 35, 35,
+ 36, 34, 34, 33, 31, 31, 29, 28, 28, 27, 26, 25, 24, 24, 23, 22, 22, 22,
+ 21, 22, 21, 21, 20, 22, 19, 23, 30, 32, 33, 33, 34, 34, 35, 34, 34, 32,
+ 31, 31, 29, 29, 28, 26, 26, 25, 25, 24, 23, 23, 22, 22, 22, 21, 21, 21,
+ 21, 19, 22, 18, 29, 31, 32, 33, 34, 34, 35, 34, 33, 31, 32, 30, 29, 29,
+ 27, 27, 25, 25, 25, 23, 24, 22, 22, 21, 21, 21, 20, 21, 20, 21, 18, 21,
+ 29, 31, 31, 32, 33, 33, 34, 34, 32, 31, 31, 29, 30, 27, 28, 26, 26, 26,
+ 24, 25, 22, 23, 22, 21, 21, 21, 21, 20, 21, 20, 21, 17, 28, 30, 31, 32,
+ 32, 32, 34, 34, 31, 32, 30, 30, 29, 27, 28, 26, 27, 24, 26, 23, 24, 22,
+ 22, 22, 20, 21, 20, 21, 19, 20, 19, 20, 28, 29, 30, 31, 32, 32, 33, 33,
+ 31, 32, 29, 31, 27, 29, 26, 28, 25, 26, 24, 24, 23, 22, 23, 20, 22, 19,
+ 21, 20, 20, 19, 20, 19, 27, 29, 29, 30, 31, 31, 33, 33, 30, 31, 29, 30,
+ 27, 29, 26, 28, 24, 26, 23, 25, 22, 24, 20, 23, 19, 22, 18, 21, 19, 20,
+ 18, 20, 27, 29, 28, 30, 30, 31, 31, 33, 32, 29, 31, 27, 30, 26, 29, 24,
+ 27, 23, 26, 21, 25, 21, 24, 19, 23, 18, 21, 17, 20, 19, 20, 18,
+ /* Size 4x8 */
+ 65, 44, 38, 31, 54, 44, 41, 33, 44, 38, 36, 32, 44, 36, 31, 27, 41, 35,
+ 28, 26, 36, 32, 25, 23, 33, 31, 24, 21, 31, 31, 25, 21,
+ /* Size 8x4 */
+ 65, 54, 44, 44, 41, 36, 33, 31, 44, 44, 38, 36, 35, 32, 31, 31, 38, 41,
+ 36, 31, 28, 25, 24, 25, 31, 33, 32, 27, 26, 23, 21, 21,
+ /* Size 8x16 */
+ 64, 60, 43, 42, 38, 32, 30, 28, 66, 57, 44, 45, 41, 35, 33, 31, 61, 51,
+ 44, 45, 42, 37, 34, 32, 55, 47, 43, 45, 43, 38, 36, 34, 46, 45, 40, 40,
+ 39, 35, 34, 31, 42, 44, 39, 37, 35, 32, 31, 29, 42, 45, 38, 35, 33, 30,
+ 29, 28, 40, 44, 38, 34, 31, 29, 28, 26, 38, 42, 37, 33, 29, 26, 26, 25,
+ 36, 40, 36, 32, 28, 25, 24, 24, 34, 38, 35, 31, 27, 24, 23, 23, 32, 36,
+ 34, 30, 26, 23, 22, 22, 31, 35, 33, 29, 26, 22, 22, 22, 29, 33, 32, 29,
+ 26, 24, 21, 21, 28, 32, 31, 27, 24, 22, 21, 21, 27, 31, 31, 27, 24, 22,
+ 19, 19,
+ /* Size 16x8 */
+ 64, 66, 61, 55, 46, 42, 42, 40, 38, 36, 34, 32, 31, 29, 28, 27, 60, 57,
+ 51, 47, 45, 44, 45, 44, 42, 40, 38, 36, 35, 33, 32, 31, 43, 44, 44, 43,
+ 40, 39, 38, 38, 37, 36, 35, 34, 33, 32, 31, 31, 42, 45, 45, 45, 40, 37,
+ 35, 34, 33, 32, 31, 30, 29, 29, 27, 27, 38, 41, 42, 43, 39, 35, 33, 31,
+ 29, 28, 27, 26, 26, 26, 24, 24, 32, 35, 37, 38, 35, 32, 30, 29, 26, 25,
+ 24, 23, 22, 24, 22, 22, 30, 33, 34, 36, 34, 31, 29, 28, 26, 24, 23, 22,
+ 22, 21, 21, 19, 28, 31, 32, 34, 31, 29, 28, 26, 25, 24, 23, 22, 22, 21,
+ 21, 19,
+ /* Size 16x32 */
+ 64, 66, 60, 55, 43, 42, 42, 39, 38, 36, 32, 32, 30, 29, 28, 27, 65, 65,
+ 58, 53, 44, 44, 44, 41, 40, 38, 34, 34, 32, 31, 30, 29, 66, 64, 57, 52,
+ 44, 45, 45, 42, 41, 39, 35, 34, 33, 32, 31, 29, 67, 64, 56, 51, 45, 45,
+ 45, 43, 41, 39, 36, 35, 34, 33, 32, 31, 61, 57, 51, 48, 44, 44, 45, 43,
+ 42, 40, 37, 36, 34, 33, 32, 30, 58, 54, 49, 46, 43, 44, 45, 43, 42, 41,
+ 37, 37, 35, 33, 32, 32, 55, 51, 47, 44, 43, 44, 45, 44, 43, 41, 38, 37,
+ 36, 35, 34, 31, 49, 48, 45, 43, 41, 41, 41, 41, 40, 38, 36, 35, 34, 34,
+ 34, 34, 46, 46, 45, 43, 40, 40, 40, 39, 39, 38, 35, 34, 34, 32, 31, 33,
+ 42, 44, 43, 43, 39, 38, 38, 38, 37, 36, 34, 34, 32, 32, 32, 29, 42, 45,
+ 44, 44, 39, 38, 37, 36, 35, 34, 32, 32, 31, 32, 29, 31, 42, 45, 45, 44,
+ 39, 37, 36, 35, 34, 34, 32, 31, 31, 29, 31, 28, 42, 45, 45, 45, 38, 37,
+ 35, 33, 33, 32, 30, 30, 29, 30, 28, 30, 41, 44, 44, 44, 38, 36, 34, 32,
+ 32, 31, 29, 29, 29, 27, 29, 26, 40, 44, 44, 44, 38, 36, 34, 32, 31, 30,
+ 29, 28, 28, 28, 26, 29, 39, 43, 43, 43, 38, 36, 34, 31, 30, 29, 27, 27,
+ 26, 27, 28, 25, 38, 41, 42, 42, 37, 35, 33, 30, 29, 28, 26, 26, 26, 26,
+ 25, 28, 38, 41, 41, 42, 37, 35, 33, 30, 29, 28, 26, 26, 25, 26, 26, 23,
+ 36, 39, 40, 41, 36, 34, 32, 29, 28, 27, 25, 25, 24, 24, 24, 26, 35, 38,
+ 39, 39, 35, 33, 32, 28, 27, 26, 24, 24, 24, 25, 24, 22, 34, 38, 38, 39,
+ 35, 33, 31, 28, 27, 26, 24, 24, 23, 22, 23, 25, 32, 36, 37, 37, 34, 32,
+ 30, 27, 26, 25, 23, 23, 23, 23, 22, 21, 32, 35, 36, 37, 34, 32, 30, 27,
+ 26, 25, 23, 23, 22, 22, 22, 24, 32, 35, 36, 37, 33, 32, 30, 27, 26, 25,
+ 23, 23, 22, 21, 21, 19, 31, 34, 35, 36, 33, 31, 29, 27, 26, 24, 22, 22,
+ 22, 21, 22, 23, 30, 33, 34, 35, 32, 31, 29, 27, 26, 24, 23, 22, 21, 21,
+ 19, 19, 29, 33, 33, 34, 32, 32, 29, 27, 26, 23, 24, 21, 21, 21, 21, 22,
+ 29, 32, 33, 34, 32, 31, 27, 28, 25, 24, 23, 21, 21, 20, 20, 17, 28, 31,
+ 32, 33, 31, 31, 27, 28, 24, 26, 22, 22, 21, 20, 21, 21, 28, 31, 32, 33,
+ 31, 31, 27, 28, 24, 25, 21, 23, 19, 21, 19, 19, 27, 30, 31, 32, 31, 30,
+ 27, 28, 24, 25, 22, 23, 19, 21, 19, 20, 27, 30, 30, 33, 32, 28, 30, 25,
+ 27, 22, 25, 19, 23, 17, 20, 18,
+ /* Size 32x16 */
+ 64, 65, 66, 67, 61, 58, 55, 49, 46, 42, 42, 42, 42, 41, 40, 39, 38, 38,
+ 36, 35, 34, 32, 32, 32, 31, 30, 29, 29, 28, 28, 27, 27, 66, 65, 64, 64,
+ 57, 54, 51, 48, 46, 44, 45, 45, 45, 44, 44, 43, 41, 41, 39, 38, 38, 36,
+ 35, 35, 34, 33, 33, 32, 31, 31, 30, 30, 60, 58, 57, 56, 51, 49, 47, 45,
+ 45, 43, 44, 45, 45, 44, 44, 43, 42, 41, 40, 39, 38, 37, 36, 36, 35, 34,
+ 33, 33, 32, 32, 31, 30, 55, 53, 52, 51, 48, 46, 44, 43, 43, 43, 44, 44,
+ 45, 44, 44, 43, 42, 42, 41, 39, 39, 37, 37, 37, 36, 35, 34, 34, 33, 33,
+ 32, 33, 43, 44, 44, 45, 44, 43, 43, 41, 40, 39, 39, 39, 38, 38, 38, 38,
+ 37, 37, 36, 35, 35, 34, 34, 33, 33, 32, 32, 32, 31, 31, 31, 32, 42, 44,
+ 45, 45, 44, 44, 44, 41, 40, 38, 38, 37, 37, 36, 36, 36, 35, 35, 34, 33,
+ 33, 32, 32, 32, 31, 31, 32, 31, 31, 31, 30, 28, 42, 44, 45, 45, 45, 45,
+ 45, 41, 40, 38, 37, 36, 35, 34, 34, 34, 33, 33, 32, 32, 31, 30, 30, 30,
+ 29, 29, 29, 27, 27, 27, 27, 30, 39, 41, 42, 43, 43, 43, 44, 41, 39, 38,
+ 36, 35, 33, 32, 32, 31, 30, 30, 29, 28, 28, 27, 27, 27, 27, 27, 27, 28,
+ 28, 28, 28, 25, 38, 40, 41, 41, 42, 42, 43, 40, 39, 37, 35, 34, 33, 32,
+ 31, 30, 29, 29, 28, 27, 27, 26, 26, 26, 26, 26, 26, 25, 24, 24, 24, 27,
+ 36, 38, 39, 39, 40, 41, 41, 38, 38, 36, 34, 34, 32, 31, 30, 29, 28, 28,
+ 27, 26, 26, 25, 25, 25, 24, 24, 23, 24, 26, 25, 25, 22, 32, 34, 35, 36,
+ 37, 37, 38, 36, 35, 34, 32, 32, 30, 29, 29, 27, 26, 26, 25, 24, 24, 23,
+ 23, 23, 22, 23, 24, 23, 22, 21, 22, 25, 32, 34, 34, 35, 36, 37, 37, 35,
+ 34, 34, 32, 31, 30, 29, 28, 27, 26, 26, 25, 24, 24, 23, 23, 23, 22, 22,
+ 21, 21, 22, 23, 23, 19, 30, 32, 33, 34, 34, 35, 36, 34, 34, 32, 31, 31,
+ 29, 29, 28, 26, 26, 25, 24, 24, 23, 23, 22, 22, 22, 21, 21, 21, 21, 19,
+ 19, 23, 29, 31, 32, 33, 33, 33, 35, 34, 32, 32, 32, 29, 30, 27, 28, 27,
+ 26, 26, 24, 25, 22, 23, 22, 21, 21, 21, 21, 20, 20, 21, 21, 17, 28, 30,
+ 31, 32, 32, 32, 34, 34, 31, 32, 29, 31, 28, 29, 26, 28, 25, 26, 24, 24,
+ 23, 22, 22, 21, 22, 19, 21, 20, 21, 19, 19, 20, 27, 29, 29, 31, 30, 32,
+ 31, 34, 33, 29, 31, 28, 30, 26, 29, 25, 28, 23, 26, 22, 25, 21, 24, 19,
+ 23, 19, 22, 17, 21, 19, 20, 18,
+ /* Size 4x16 */
+ 66, 42, 36, 29, 64, 45, 39, 32, 57, 44, 40, 33, 51, 44, 41, 35, 46, 40,
+ 38, 32, 45, 38, 34, 32, 45, 37, 32, 30, 44, 36, 30, 28, 41, 35, 28, 26,
+ 39, 34, 27, 24, 38, 33, 26, 22, 35, 32, 25, 22, 34, 31, 24, 21, 33, 32,
+ 23, 21, 31, 31, 26, 20, 30, 30, 25, 21,
+ /* Size 16x4 */
+ 66, 64, 57, 51, 46, 45, 45, 44, 41, 39, 38, 35, 34, 33, 31, 30, 42, 45,
+ 44, 44, 40, 38, 37, 36, 35, 34, 33, 32, 31, 32, 31, 30, 36, 39, 40, 41,
+ 38, 34, 32, 30, 28, 27, 26, 25, 24, 23, 26, 25, 29, 32, 33, 35, 32, 32,
+ 30, 28, 26, 24, 22, 22, 21, 21, 20, 21,
+ /* Size 8x32 */
+ 64, 60, 43, 42, 38, 32, 30, 28, 65, 58, 44, 44, 40, 34, 32, 30, 66, 57,
+ 44, 45, 41, 35, 33, 31, 67, 56, 45, 45, 41, 36, 34, 32, 61, 51, 44, 45,
+ 42, 37, 34, 32, 58, 49, 43, 45, 42, 37, 35, 32, 55, 47, 43, 45, 43, 38,
+ 36, 34, 49, 45, 41, 41, 40, 36, 34, 34, 46, 45, 40, 40, 39, 35, 34, 31,
+ 42, 43, 39, 38, 37, 34, 32, 32, 42, 44, 39, 37, 35, 32, 31, 29, 42, 45,
+ 39, 36, 34, 32, 31, 31, 42, 45, 38, 35, 33, 30, 29, 28, 41, 44, 38, 34,
+ 32, 29, 29, 29, 40, 44, 38, 34, 31, 29, 28, 26, 39, 43, 38, 34, 30, 27,
+ 26, 28, 38, 42, 37, 33, 29, 26, 26, 25, 38, 41, 37, 33, 29, 26, 25, 26,
+ 36, 40, 36, 32, 28, 25, 24, 24, 35, 39, 35, 32, 27, 24, 24, 24, 34, 38,
+ 35, 31, 27, 24, 23, 23, 32, 37, 34, 30, 26, 23, 23, 22, 32, 36, 34, 30,
+ 26, 23, 22, 22, 32, 36, 33, 30, 26, 23, 22, 21, 31, 35, 33, 29, 26, 22,
+ 22, 22, 30, 34, 32, 29, 26, 23, 21, 19, 29, 33, 32, 29, 26, 24, 21, 21,
+ 29, 33, 32, 27, 25, 23, 21, 20, 28, 32, 31, 27, 24, 22, 21, 21, 28, 32,
+ 31, 27, 24, 21, 19, 19, 27, 31, 31, 27, 24, 22, 19, 19, 27, 30, 32, 30,
+ 27, 25, 23, 20,
+ /* Size 32x8 */
+ 64, 65, 66, 67, 61, 58, 55, 49, 46, 42, 42, 42, 42, 41, 40, 39, 38, 38,
+ 36, 35, 34, 32, 32, 32, 31, 30, 29, 29, 28, 28, 27, 27, 60, 58, 57, 56,
+ 51, 49, 47, 45, 45, 43, 44, 45, 45, 44, 44, 43, 42, 41, 40, 39, 38, 37,
+ 36, 36, 35, 34, 33, 33, 32, 32, 31, 30, 43, 44, 44, 45, 44, 43, 43, 41,
+ 40, 39, 39, 39, 38, 38, 38, 38, 37, 37, 36, 35, 35, 34, 34, 33, 33, 32,
+ 32, 32, 31, 31, 31, 32, 42, 44, 45, 45, 45, 45, 45, 41, 40, 38, 37, 36,
+ 35, 34, 34, 34, 33, 33, 32, 32, 31, 30, 30, 30, 29, 29, 29, 27, 27, 27,
+ 27, 30, 38, 40, 41, 41, 42, 42, 43, 40, 39, 37, 35, 34, 33, 32, 31, 30,
+ 29, 29, 28, 27, 27, 26, 26, 26, 26, 26, 26, 25, 24, 24, 24, 27, 32, 34,
+ 35, 36, 37, 37, 38, 36, 35, 34, 32, 32, 30, 29, 29, 27, 26, 26, 25, 24,
+ 24, 23, 23, 23, 22, 23, 24, 23, 22, 21, 22, 25, 30, 32, 33, 34, 34, 35,
+ 36, 34, 34, 32, 31, 31, 29, 29, 28, 26, 26, 25, 24, 24, 23, 23, 22, 22,
+ 22, 21, 21, 21, 21, 19, 19, 23, 28, 30, 31, 32, 32, 32, 34, 34, 31, 32,
+ 29, 31, 28, 29, 26, 28, 25, 26, 24, 24, 23, 22, 22, 21, 22, 19, 21, 20,
+ 21, 19, 19, 20 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 56, 29, 29, 15,
+#endif
+ /* Size 4x4 */
+ 63, 55, 35, 25, 55, 38, 28, 22, 35, 28, 20, 17, 25, 22, 17, 13,
+ /* Size 8x8 */
+ 64, 64, 59, 48, 38, 30, 26, 22, 64, 61, 57, 49, 40, 32, 28, 24, 59, 57,
+ 45, 39, 34, 28, 26, 24, 48, 49, 39, 32, 28, 24, 22, 21, 38, 40, 34, 28,
+ 24, 20, 19, 18, 30, 32, 28, 24, 20, 17, 16, 15, 26, 28, 26, 22, 19, 16,
+ 15, 12, 22, 24, 24, 21, 18, 15, 12, 12,
+ /* Size 16x16 */
+ 64, 65, 65, 64, 60, 57, 50, 43, 38, 35, 31, 27, 25, 23, 22, 21, 65, 64,
+ 63, 63, 60, 59, 52, 46, 41, 37, 34, 29, 27, 25, 23, 22, 65, 63, 62, 61,
+ 59, 57, 51, 46, 41, 38, 34, 31, 28, 26, 25, 23, 64, 63, 61, 58, 55, 53,
+ 49, 46, 41, 38, 35, 31, 29, 27, 25, 24, 60, 60, 59, 55, 52, 48, 45, 41,
+ 38, 35, 33, 29, 27, 25, 24, 23, 57, 59, 57, 53, 48, 42, 39, 37, 34, 32,
+ 30, 27, 25, 24, 23, 22, 50, 52, 51, 49, 45, 39, 36, 33, 30, 29, 27, 25,
+ 23, 22, 21, 20, 43, 46, 46, 46, 41, 37, 33, 29, 27, 26, 24, 22, 21, 20,
+ 20, 19, 38, 41, 41, 41, 38, 34, 30, 27, 25, 24, 22, 20, 19, 19, 19, 17,
+ 35, 37, 38, 38, 35, 32, 29, 26, 24, 22, 21, 19, 18, 18, 18, 16, 31, 34,
+ 34, 35, 33, 30, 27, 24, 22, 21, 20, 18, 17, 16, 17, 15, 27, 29, 31, 31,
+ 29, 27, 25, 22, 20, 19, 18, 17, 16, 15, 15, 14, 25, 27, 28, 29, 27, 25,
+ 23, 21, 19, 18, 17, 16, 15, 14, 13, 13, 23, 25, 26, 27, 25, 24, 22, 20,
+ 19, 18, 16, 15, 14, 14, 13, 12, 22, 23, 25, 25, 24, 23, 21, 20, 19, 18,
+ 17, 15, 13, 13, 13, 12, 21, 22, 23, 24, 23, 22, 20, 19, 17, 16, 15, 14,
+ 13, 12, 12, 12,
+ /* Size 32x32 */
+ 64, 65, 65, 65, 65, 65, 64, 63, 60, 58, 57, 52, 50, 47, 43, 42, 38, 37,
+ 35, 32, 31, 29, 27, 26, 25, 25, 23, 23, 22, 21, 21, 20, 65, 64, 64, 64,
+ 64, 64, 63, 62, 60, 59, 59, 53, 51, 48, 45, 44, 40, 38, 36, 34, 33, 30,
+ 29, 27, 26, 26, 25, 24, 23, 22, 22, 21, 65, 64, 64, 64, 63, 63, 63, 62,
+ 60, 59, 59, 54, 52, 49, 46, 45, 41, 39, 37, 34, 34, 31, 29, 27, 27, 27,
+ 25, 24, 23, 23, 22, 21, 65, 64, 64, 63, 63, 63, 63, 62, 61, 60, 59, 55,
+ 53, 50, 47, 46, 41, 40, 38, 35, 34, 32, 30, 28, 27, 27, 26, 25, 24, 23,
+ 23, 22, 65, 64, 63, 63, 62, 62, 61, 60, 59, 57, 57, 53, 51, 49, 46, 45,
+ 41, 40, 38, 35, 34, 32, 31, 29, 28, 28, 26, 25, 25, 24, 23, 22, 65, 64,
+ 63, 63, 62, 61, 60, 59, 58, 57, 56, 53, 51, 49, 46, 45, 41, 40, 38, 35,
+ 35, 32, 31, 29, 28, 28, 26, 25, 25, 24, 23, 23, 64, 63, 63, 63, 61, 60,
+ 58, 57, 55, 54, 53, 51, 49, 48, 46, 45, 41, 40, 38, 36, 35, 33, 31, 29,
+ 29, 28, 27, 26, 25, 25, 24, 23, 63, 62, 62, 62, 60, 59, 57, 56, 54, 52,
+ 51, 49, 48, 46, 44, 43, 40, 39, 37, 35, 34, 32, 30, 29, 28, 28, 26, 26,
+ 26, 25, 24, 24, 60, 60, 60, 61, 59, 58, 55, 54, 52, 49, 48, 46, 45, 43,
+ 41, 40, 38, 37, 35, 33, 33, 30, 29, 28, 27, 27, 25, 25, 24, 23, 23, 23,
+ 58, 59, 59, 60, 57, 57, 54, 52, 49, 45, 44, 41, 41, 39, 37, 37, 35, 34,
+ 33, 31, 31, 28, 28, 26, 26, 26, 24, 24, 24, 24, 23, 21, 57, 59, 59, 59,
+ 57, 56, 53, 51, 48, 44, 42, 41, 39, 38, 37, 36, 34, 33, 32, 31, 30, 28,
+ 27, 26, 25, 25, 24, 24, 23, 22, 22, 22, 52, 53, 54, 55, 53, 53, 51, 49,
+ 46, 41, 41, 38, 37, 35, 34, 34, 32, 31, 30, 28, 28, 26, 25, 24, 24, 24,
+ 23, 22, 22, 22, 22, 20, 50, 51, 52, 53, 51, 51, 49, 48, 45, 41, 39, 37,
+ 36, 34, 33, 32, 30, 30, 29, 27, 27, 25, 25, 24, 23, 23, 22, 22, 21, 20,
+ 20, 21, 47, 48, 49, 50, 49, 49, 48, 46, 43, 39, 38, 35, 34, 32, 31, 31,
+ 29, 28, 27, 26, 26, 24, 24, 23, 22, 22, 21, 20, 20, 21, 21, 19, 43, 45,
+ 46, 47, 46, 46, 46, 44, 41, 37, 37, 34, 33, 31, 29, 29, 27, 27, 26, 25,
+ 24, 23, 22, 22, 21, 21, 20, 21, 20, 19, 19, 20, 42, 44, 45, 46, 45, 45,
+ 45, 43, 40, 37, 36, 34, 32, 31, 29, 29, 27, 26, 25, 24, 24, 23, 22, 21,
+ 21, 21, 20, 19, 19, 20, 20, 17, 38, 40, 41, 41, 41, 41, 41, 40, 38, 35,
+ 34, 32, 30, 29, 27, 27, 25, 24, 24, 22, 22, 21, 20, 20, 19, 19, 19, 19,
+ 19, 18, 17, 19, 37, 38, 39, 40, 40, 40, 40, 39, 37, 34, 33, 31, 30, 28,
+ 27, 26, 24, 24, 23, 22, 22, 20, 20, 19, 19, 19, 18, 18, 17, 18, 18, 16,
+ 35, 36, 37, 38, 38, 38, 38, 37, 35, 33, 32, 30, 29, 27, 26, 25, 24, 23,
+ 22, 21, 21, 20, 19, 19, 18, 18, 18, 17, 18, 17, 16, 18, 32, 34, 34, 35,
+ 35, 35, 36, 35, 33, 31, 31, 28, 27, 26, 25, 24, 22, 22, 21, 20, 20, 19,
+ 18, 18, 17, 17, 17, 17, 16, 17, 17, 15, 31, 33, 34, 34, 34, 35, 35, 34,
+ 33, 31, 30, 28, 27, 26, 24, 24, 22, 22, 21, 20, 20, 18, 18, 17, 17, 17,
+ 16, 16, 17, 16, 15, 17, 29, 30, 31, 32, 32, 32, 33, 32, 30, 28, 28, 26,
+ 25, 24, 23, 23, 21, 20, 20, 19, 18, 17, 17, 16, 16, 16, 15, 16, 15, 15,
+ 16, 14, 27, 29, 29, 30, 31, 31, 31, 30, 29, 28, 27, 25, 25, 24, 22, 22,
+ 20, 20, 19, 18, 18, 17, 17, 16, 16, 16, 15, 15, 15, 15, 14, 16, 26, 27,
+ 27, 28, 29, 29, 29, 29, 28, 26, 26, 24, 24, 23, 22, 21, 20, 19, 19, 18,
+ 17, 16, 16, 15, 15, 15, 14, 14, 15, 14, 15, 13, 25, 26, 27, 27, 28, 28,
+ 29, 28, 27, 26, 25, 24, 23, 22, 21, 21, 19, 19, 18, 17, 17, 16, 16, 15,
+ 15, 15, 14, 14, 13, 15, 13, 15, 25, 26, 27, 27, 28, 28, 28, 28, 27, 26,
+ 25, 24, 23, 22, 21, 21, 19, 19, 18, 17, 17, 16, 16, 15, 15, 15, 14, 14,
+ 14, 12, 14, 12, 23, 25, 25, 26, 26, 26, 27, 26, 25, 24, 24, 23, 22, 21,
+ 20, 20, 19, 18, 18, 17, 16, 15, 15, 14, 14, 14, 14, 14, 13, 14, 12, 14,
+ 23, 24, 24, 25, 25, 25, 26, 26, 25, 24, 24, 22, 22, 20, 21, 19, 19, 18,
+ 17, 17, 16, 16, 15, 14, 14, 14, 14, 13, 14, 13, 13, 11, 22, 23, 23, 24,
+ 25, 25, 25, 26, 24, 24, 23, 22, 21, 20, 20, 19, 19, 17, 18, 16, 17, 15,
+ 15, 15, 13, 14, 13, 14, 13, 13, 12, 13, 21, 22, 23, 23, 24, 24, 25, 25,
+ 23, 24, 22, 22, 20, 21, 19, 20, 18, 18, 17, 17, 16, 15, 15, 14, 15, 12,
+ 14, 13, 13, 12, 13, 12, 21, 22, 22, 23, 23, 23, 24, 24, 23, 23, 22, 22,
+ 20, 21, 19, 20, 17, 18, 16, 17, 15, 16, 14, 15, 13, 14, 12, 13, 12, 13,
+ 12, 13, 20, 21, 21, 22, 22, 23, 23, 24, 23, 21, 22, 20, 21, 19, 20, 17,
+ 19, 16, 18, 15, 17, 14, 16, 13, 15, 12, 14, 11, 13, 12, 13, 11,
+ /* Size 4x8 */
+ 64, 58, 34, 24, 63, 56, 36, 26, 59, 44, 32, 24, 50, 38, 26, 21, 40, 33,
+ 22, 18, 31, 28, 19, 16, 27, 25, 17, 14, 23, 22, 18, 14,
+ /* Size 8x4 */
+ 64, 63, 59, 50, 40, 31, 27, 23, 58, 56, 44, 38, 33, 28, 25, 22, 34, 36,
+ 32, 26, 22, 19, 17, 18, 24, 26, 24, 21, 18, 16, 14, 14,
+ /* Size 8x16 */
+ 64, 65, 59, 47, 38, 31, 25, 22, 65, 63, 59, 49, 41, 34, 27, 23, 65, 62,
+ 58, 49, 41, 35, 28, 24, 64, 60, 55, 48, 41, 35, 29, 25, 60, 59, 49, 43,
+ 38, 33, 27, 24, 57, 57, 45, 38, 34, 30, 25, 22, 50, 51, 41, 34, 30, 27,
+ 23, 21, 44, 46, 38, 31, 27, 24, 21, 19, 38, 41, 36, 29, 25, 22, 19, 18,
+ 35, 38, 33, 27, 24, 21, 18, 17, 32, 34, 31, 26, 22, 20, 17, 16, 27, 31,
+ 28, 24, 20, 18, 16, 15, 25, 28, 26, 22, 19, 17, 15, 15, 23, 26, 25, 21,
+ 19, 16, 14, 14, 22, 25, 24, 21, 17, 15, 14, 13, 21, 23, 23, 20, 17, 15,
+ 13, 12,
+ /* Size 16x8 */
+ 64, 65, 65, 64, 60, 57, 50, 44, 38, 35, 32, 27, 25, 23, 22, 21, 65, 63,
+ 62, 60, 59, 57, 51, 46, 41, 38, 34, 31, 28, 26, 25, 23, 59, 59, 58, 55,
+ 49, 45, 41, 38, 36, 33, 31, 28, 26, 25, 24, 23, 47, 49, 49, 48, 43, 38,
+ 34, 31, 29, 27, 26, 24, 22, 21, 21, 20, 38, 41, 41, 41, 38, 34, 30, 27,
+ 25, 24, 22, 20, 19, 19, 17, 17, 31, 34, 35, 35, 33, 30, 27, 24, 22, 21,
+ 20, 18, 17, 16, 15, 15, 25, 27, 28, 29, 27, 25, 23, 21, 19, 18, 17, 16,
+ 15, 14, 14, 13, 22, 23, 24, 25, 24, 22, 21, 19, 18, 17, 16, 15, 15, 14,
+ 13, 12,
+ /* Size 16x32 */
+ 64, 65, 65, 64, 59, 57, 47, 43, 38, 33, 31, 26, 25, 23, 22, 21, 65, 64,
+ 64, 63, 59, 58, 48, 45, 40, 34, 33, 27, 26, 24, 23, 22, 65, 64, 63, 63,
+ 59, 59, 49, 46, 41, 35, 34, 28, 27, 25, 23, 22, 65, 63, 63, 62, 60, 59,
+ 50, 47, 41, 36, 34, 28, 27, 25, 24, 23, 65, 63, 62, 60, 58, 57, 49, 46,
+ 41, 36, 35, 29, 28, 26, 24, 23, 64, 63, 62, 60, 57, 56, 49, 46, 41, 36,
+ 35, 29, 28, 26, 25, 24, 64, 62, 60, 58, 55, 53, 48, 46, 41, 37, 35, 30,
+ 29, 27, 25, 23, 63, 62, 59, 57, 53, 51, 46, 44, 40, 35, 34, 29, 28, 26,
+ 25, 25, 60, 60, 59, 55, 49, 48, 43, 41, 38, 34, 33, 28, 27, 25, 24, 24,
+ 58, 59, 57, 54, 46, 44, 39, 37, 35, 32, 31, 26, 26, 24, 24, 22, 57, 59,
+ 57, 53, 45, 43, 38, 37, 34, 31, 30, 26, 25, 24, 22, 23, 52, 55, 53, 51,
+ 43, 41, 35, 34, 32, 29, 28, 24, 24, 23, 23, 20, 50, 53, 51, 49, 41, 40,
+ 34, 33, 30, 28, 27, 24, 23, 22, 21, 22, 47, 50, 49, 48, 40, 38, 33, 31,
+ 29, 26, 26, 23, 22, 21, 22, 19, 44, 47, 46, 45, 38, 37, 31, 29, 27, 25,
+ 24, 22, 21, 21, 19, 21, 43, 46, 45, 44, 38, 36, 31, 29, 27, 25, 24, 21,
+ 21, 20, 20, 18, 38, 41, 41, 41, 36, 34, 29, 27, 25, 23, 22, 20, 19, 19,
+ 18, 20, 37, 40, 40, 40, 35, 33, 28, 27, 24, 22, 22, 19, 19, 18, 18, 16,
+ 35, 38, 38, 38, 33, 32, 27, 26, 24, 21, 21, 19, 18, 17, 17, 18, 32, 35,
+ 35, 36, 32, 31, 26, 25, 23, 20, 20, 18, 17, 17, 17, 15, 32, 34, 34, 35,
+ 31, 30, 26, 24, 22, 20, 20, 17, 17, 16, 16, 17, 29, 31, 32, 32, 29, 28,
+ 24, 23, 21, 19, 18, 16, 16, 16, 15, 14, 27, 30, 31, 31, 28, 27, 24, 22,
+ 20, 19, 18, 16, 16, 15, 15, 16, 26, 28, 29, 29, 27, 26, 23, 22, 20, 18,
+ 17, 15, 15, 14, 14, 13, 25, 27, 28, 28, 26, 25, 22, 21, 19, 18, 17, 15,
+ 15, 14, 15, 15, 25, 27, 28, 28, 26, 25, 22, 21, 19, 17, 17, 15, 15, 14,
+ 13, 12, 23, 26, 26, 27, 25, 24, 21, 20, 19, 17, 16, 14, 14, 14, 14, 14,
+ 23, 25, 25, 26, 24, 24, 21, 21, 18, 17, 16, 14, 14, 13, 13, 11, 22, 24,
+ 25, 25, 24, 23, 21, 20, 17, 18, 15, 15, 14, 13, 13, 13, 21, 23, 24, 25,
+ 23, 22, 20, 20, 17, 18, 15, 16, 13, 14, 12, 12, 21, 23, 23, 24, 23, 22,
+ 20, 20, 17, 17, 15, 15, 13, 13, 12, 13, 20, 22, 22, 24, 23, 20, 21, 17,
+ 19, 15, 17, 13, 15, 11, 13, 11,
+ /* Size 32x16 */
+ 64, 65, 65, 65, 65, 64, 64, 63, 60, 58, 57, 52, 50, 47, 44, 43, 38, 37,
+ 35, 32, 32, 29, 27, 26, 25, 25, 23, 23, 22, 21, 21, 20, 65, 64, 64, 63,
+ 63, 63, 62, 62, 60, 59, 59, 55, 53, 50, 47, 46, 41, 40, 38, 35, 34, 31,
+ 30, 28, 27, 27, 26, 25, 24, 23, 23, 22, 65, 64, 63, 63, 62, 62, 60, 59,
+ 59, 57, 57, 53, 51, 49, 46, 45, 41, 40, 38, 35, 34, 32, 31, 29, 28, 28,
+ 26, 25, 25, 24, 23, 22, 64, 63, 63, 62, 60, 60, 58, 57, 55, 54, 53, 51,
+ 49, 48, 45, 44, 41, 40, 38, 36, 35, 32, 31, 29, 28, 28, 27, 26, 25, 25,
+ 24, 24, 59, 59, 59, 60, 58, 57, 55, 53, 49, 46, 45, 43, 41, 40, 38, 38,
+ 36, 35, 33, 32, 31, 29, 28, 27, 26, 26, 25, 24, 24, 23, 23, 23, 57, 58,
+ 59, 59, 57, 56, 53, 51, 48, 44, 43, 41, 40, 38, 37, 36, 34, 33, 32, 31,
+ 30, 28, 27, 26, 25, 25, 24, 24, 23, 22, 22, 20, 47, 48, 49, 50, 49, 49,
+ 48, 46, 43, 39, 38, 35, 34, 33, 31, 31, 29, 28, 27, 26, 26, 24, 24, 23,
+ 22, 22, 21, 21, 21, 20, 20, 21, 43, 45, 46, 47, 46, 46, 46, 44, 41, 37,
+ 37, 34, 33, 31, 29, 29, 27, 27, 26, 25, 24, 23, 22, 22, 21, 21, 20, 21,
+ 20, 20, 20, 17, 38, 40, 41, 41, 41, 41, 41, 40, 38, 35, 34, 32, 30, 29,
+ 27, 27, 25, 24, 24, 23, 22, 21, 20, 20, 19, 19, 19, 18, 17, 17, 17, 19,
+ 33, 34, 35, 36, 36, 36, 37, 35, 34, 32, 31, 29, 28, 26, 25, 25, 23, 22,
+ 21, 20, 20, 19, 19, 18, 18, 17, 17, 17, 18, 18, 17, 15, 31, 33, 34, 34,
+ 35, 35, 35, 34, 33, 31, 30, 28, 27, 26, 24, 24, 22, 22, 21, 20, 20, 18,
+ 18, 17, 17, 17, 16, 16, 15, 15, 15, 17, 26, 27, 28, 28, 29, 29, 30, 29,
+ 28, 26, 26, 24, 24, 23, 22, 21, 20, 19, 19, 18, 17, 16, 16, 15, 15, 15,
+ 14, 14, 15, 16, 15, 13, 25, 26, 27, 27, 28, 28, 29, 28, 27, 26, 25, 24,
+ 23, 22, 21, 21, 19, 19, 18, 17, 17, 16, 16, 15, 15, 15, 14, 14, 14, 13,
+ 13, 15, 23, 24, 25, 25, 26, 26, 27, 26, 25, 24, 24, 23, 22, 21, 21, 20,
+ 19, 18, 17, 17, 16, 16, 15, 14, 14, 14, 14, 13, 13, 14, 13, 11, 22, 23,
+ 23, 24, 24, 25, 25, 25, 24, 24, 22, 23, 21, 22, 19, 20, 18, 18, 17, 17,
+ 16, 15, 15, 14, 15, 13, 14, 13, 13, 12, 12, 13, 21, 22, 22, 23, 23, 24,
+ 23, 25, 24, 22, 23, 20, 22, 19, 21, 18, 20, 16, 18, 15, 17, 14, 16, 13,
+ 15, 12, 14, 11, 13, 12, 13, 11,
+ /* Size 4x16 */
+ 65, 57, 33, 23, 64, 59, 35, 25, 63, 57, 36, 26, 62, 53, 37, 27, 60, 48,
+ 34, 25, 59, 43, 31, 24, 53, 40, 28, 22, 47, 37, 25, 21, 41, 34, 23, 19,
+ 38, 32, 21, 17, 34, 30, 20, 16, 30, 27, 19, 15, 27, 25, 18, 14, 26, 24,
+ 17, 14, 24, 23, 18, 13, 23, 22, 17, 13,
+ /* Size 16x4 */
+ 65, 64, 63, 62, 60, 59, 53, 47, 41, 38, 34, 30, 27, 26, 24, 23, 57, 59,
+ 57, 53, 48, 43, 40, 37, 34, 32, 30, 27, 25, 24, 23, 22, 33, 35, 36, 37,
+ 34, 31, 28, 25, 23, 21, 20, 19, 18, 17, 18, 17, 23, 25, 26, 27, 25, 24,
+ 22, 21, 19, 17, 16, 15, 14, 14, 13, 13,
+ /* Size 8x32 */
+ 64, 65, 59, 47, 38, 31, 25, 22, 65, 64, 59, 48, 40, 33, 26, 23, 65, 63,
+ 59, 49, 41, 34, 27, 23, 65, 63, 60, 50, 41, 34, 27, 24, 65, 62, 58, 49,
+ 41, 35, 28, 24, 64, 62, 57, 49, 41, 35, 28, 25, 64, 60, 55, 48, 41, 35,
+ 29, 25, 63, 59, 53, 46, 40, 34, 28, 25, 60, 59, 49, 43, 38, 33, 27, 24,
+ 58, 57, 46, 39, 35, 31, 26, 24, 57, 57, 45, 38, 34, 30, 25, 22, 52, 53,
+ 43, 35, 32, 28, 24, 23, 50, 51, 41, 34, 30, 27, 23, 21, 47, 49, 40, 33,
+ 29, 26, 22, 22, 44, 46, 38, 31, 27, 24, 21, 19, 43, 45, 38, 31, 27, 24,
+ 21, 20, 38, 41, 36, 29, 25, 22, 19, 18, 37, 40, 35, 28, 24, 22, 19, 18,
+ 35, 38, 33, 27, 24, 21, 18, 17, 32, 35, 32, 26, 23, 20, 17, 17, 32, 34,
+ 31, 26, 22, 20, 17, 16, 29, 32, 29, 24, 21, 18, 16, 15, 27, 31, 28, 24,
+ 20, 18, 16, 15, 26, 29, 27, 23, 20, 17, 15, 14, 25, 28, 26, 22, 19, 17,
+ 15, 15, 25, 28, 26, 22, 19, 17, 15, 13, 23, 26, 25, 21, 19, 16, 14, 14,
+ 23, 25, 24, 21, 18, 16, 14, 13, 22, 25, 24, 21, 17, 15, 14, 13, 21, 24,
+ 23, 20, 17, 15, 13, 12, 21, 23, 23, 20, 17, 15, 13, 12, 20, 22, 23, 21,
+ 19, 17, 15, 13,
+ /* Size 32x8 */
+ 64, 65, 65, 65, 65, 64, 64, 63, 60, 58, 57, 52, 50, 47, 44, 43, 38, 37,
+ 35, 32, 32, 29, 27, 26, 25, 25, 23, 23, 22, 21, 21, 20, 65, 64, 63, 63,
+ 62, 62, 60, 59, 59, 57, 57, 53, 51, 49, 46, 45, 41, 40, 38, 35, 34, 32,
+ 31, 29, 28, 28, 26, 25, 25, 24, 23, 22, 59, 59, 59, 60, 58, 57, 55, 53,
+ 49, 46, 45, 43, 41, 40, 38, 38, 36, 35, 33, 32, 31, 29, 28, 27, 26, 26,
+ 25, 24, 24, 23, 23, 23, 47, 48, 49, 50, 49, 49, 48, 46, 43, 39, 38, 35,
+ 34, 33, 31, 31, 29, 28, 27, 26, 26, 24, 24, 23, 22, 22, 21, 21, 21, 20,
+ 20, 21, 38, 40, 41, 41, 41, 41, 41, 40, 38, 35, 34, 32, 30, 29, 27, 27,
+ 25, 24, 24, 23, 22, 21, 20, 20, 19, 19, 19, 18, 17, 17, 17, 19, 31, 33,
+ 34, 34, 35, 35, 35, 34, 33, 31, 30, 28, 27, 26, 24, 24, 22, 22, 21, 20,
+ 20, 18, 18, 17, 17, 17, 16, 16, 15, 15, 15, 17, 25, 26, 27, 27, 28, 28,
+ 29, 28, 27, 26, 25, 24, 23, 22, 21, 21, 19, 19, 18, 17, 17, 16, 16, 15,
+ 15, 15, 14, 14, 14, 13, 13, 15, 22, 23, 23, 24, 24, 25, 25, 25, 24, 24,
+ 22, 23, 21, 22, 19, 20, 18, 18, 17, 17, 16, 15, 15, 14, 15, 13, 14, 13,
+ 13, 12, 12, 13 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 43, 37, 37, 23,
+#endif
+ /* Size 4x4 */
+ 64, 45, 40, 33, 45, 38, 34, 31, 40, 34, 27, 25, 33, 31, 25, 21,
+ /* Size 8x8 */
+ 65, 59, 44, 44, 41, 36, 33, 31, 59, 53, 44, 45, 43, 38, 36, 33, 44, 44,
+ 39, 39, 38, 35, 34, 33, 44, 45, 39, 35, 33, 31, 30, 30, 41, 43, 38, 33,
+ 30, 28, 27, 27, 36, 38, 35, 31, 28, 25, 24, 23, 33, 36, 34, 30, 27, 24,
+ 22, 20, 31, 33, 33, 30, 27, 23, 20, 20,
+ /* Size 16x16 */
+ 64, 66, 62, 56, 49, 42, 42, 41, 39, 38, 36, 33, 32, 31, 29, 28, 66, 65,
+ 60, 53, 48, 44, 44, 43, 42, 40, 38, 36, 34, 33, 32, 31, 62, 60, 55, 48,
+ 46, 44, 45, 44, 43, 41, 40, 37, 36, 34, 33, 32, 56, 53, 48, 43, 43, 43,
+ 45, 45, 44, 42, 41, 39, 37, 36, 35, 33, 49, 48, 46, 43, 42, 41, 41, 41,
+ 41, 39, 38, 37, 35, 34, 33, 32, 42, 44, 44, 43, 41, 39, 38, 38, 38, 37,
+ 36, 34, 33, 33, 31, 31, 42, 44, 45, 45, 41, 38, 37, 36, 35, 34, 33, 32,
+ 31, 31, 30, 29, 41, 43, 44, 45, 41, 38, 36, 34, 33, 32, 31, 30, 29, 28,
+ 29, 27, 39, 42, 43, 44, 41, 38, 35, 33, 31, 30, 29, 28, 27, 27, 28, 26,
+ 38, 40, 41, 42, 39, 37, 34, 32, 30, 29, 28, 27, 26, 25, 26, 24, 36, 38,
+ 40, 41, 38, 36, 33, 31, 29, 28, 27, 26, 25, 24, 25, 23, 33, 36, 37, 39,
+ 37, 34, 32, 30, 28, 27, 26, 24, 23, 23, 23, 22, 32, 34, 36, 37, 35, 33,
+ 31, 29, 27, 26, 25, 23, 23, 22, 21, 21, 31, 33, 34, 36, 34, 33, 31, 28,
+ 27, 25, 24, 23, 22, 21, 21, 19, 29, 32, 33, 35, 33, 31, 30, 29, 28, 26,
+ 25, 23, 21, 21, 20, 20, 28, 31, 32, 33, 32, 31, 29, 27, 26, 24, 23, 22,
+ 21, 19, 20, 19,
+ /* Size 32x32 */
+ 64, 66, 66, 67, 62, 61, 56, 53, 49, 43, 42, 42, 42, 42, 41, 41, 39, 39,
+ 38, 36, 36, 34, 33, 32, 32, 32, 31, 30, 29, 29, 28, 28, 66, 65, 65, 66,
+ 60, 59, 53, 51, 48, 44, 43, 44, 44, 44, 43, 42, 41, 41, 39, 38, 38, 36,
+ 35, 34, 33, 33, 32, 32, 31, 31, 30, 30, 66, 65, 65, 65, 60, 59, 53, 51,
+ 48, 45, 44, 44, 44, 45, 43, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 34,
+ 33, 32, 32, 31, 31, 30, 67, 66, 65, 64, 59, 58, 51, 50, 48, 45, 44, 45,
+ 45, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 35, 34, 33, 33, 32,
+ 32, 32, 62, 60, 60, 59, 55, 53, 48, 47, 46, 44, 44, 45, 45, 45, 44, 44,
+ 43, 42, 41, 40, 40, 38, 37, 36, 36, 36, 34, 34, 33, 33, 32, 31, 61, 59,
+ 59, 58, 53, 53, 47, 47, 46, 44, 43, 44, 45, 45, 44, 44, 43, 43, 41, 40,
+ 40, 38, 38, 36, 36, 36, 35, 34, 34, 33, 33, 33, 56, 53, 53, 51, 48, 47,
+ 43, 43, 43, 43, 43, 44, 45, 45, 45, 45, 44, 43, 42, 41, 41, 39, 39, 38,
+ 37, 37, 36, 35, 35, 34, 33, 32, 53, 51, 51, 50, 47, 47, 43, 43, 43, 42,
+ 42, 43, 43, 44, 43, 43, 43, 42, 41, 40, 40, 38, 38, 37, 36, 36, 35, 35,
+ 35, 34, 34, 34, 49, 48, 48, 48, 46, 46, 43, 43, 42, 41, 41, 41, 41, 42,
+ 41, 41, 41, 40, 39, 39, 38, 37, 37, 36, 35, 35, 34, 34, 33, 33, 32, 33,
+ 43, 44, 45, 45, 44, 44, 43, 42, 41, 39, 39, 39, 39, 39, 39, 39, 38, 38,
+ 37, 37, 37, 35, 35, 34, 34, 34, 33, 33, 33, 33, 32, 30, 42, 43, 44, 44,
+ 44, 43, 43, 42, 41, 39, 39, 39, 38, 38, 38, 38, 38, 37, 37, 36, 36, 35,
+ 34, 34, 33, 33, 33, 32, 31, 31, 31, 32, 42, 44, 44, 45, 45, 44, 44, 43,
+ 41, 39, 39, 38, 37, 37, 36, 36, 36, 35, 35, 34, 34, 33, 33, 32, 32, 32,
+ 31, 31, 31, 32, 31, 29, 42, 44, 44, 45, 45, 45, 45, 43, 41, 39, 38, 37,
+ 37, 36, 36, 35, 35, 34, 34, 34, 33, 33, 32, 32, 31, 31, 31, 31, 30, 29,
+ 29, 31, 42, 44, 45, 46, 45, 45, 45, 44, 42, 39, 38, 37, 36, 35, 34, 34,
+ 33, 33, 33, 32, 32, 31, 31, 30, 30, 30, 29, 29, 29, 30, 30, 27, 41, 43,
+ 43, 45, 44, 44, 45, 43, 41, 39, 38, 36, 36, 34, 34, 34, 33, 32, 32, 31,
+ 31, 30, 30, 29, 29, 29, 28, 29, 29, 27, 27, 29, 41, 42, 43, 44, 44, 44,
+ 45, 43, 41, 39, 38, 36, 35, 34, 34, 33, 32, 32, 32, 31, 31, 30, 29, 29,
+ 29, 29, 28, 27, 27, 29, 28, 26, 39, 41, 42, 43, 43, 43, 44, 43, 41, 38,
+ 38, 36, 35, 33, 33, 32, 31, 30, 30, 29, 29, 28, 28, 27, 27, 27, 27, 27,
+ 28, 26, 26, 28, 39, 41, 41, 42, 42, 43, 43, 42, 40, 38, 37, 35, 34, 33,
+ 32, 32, 30, 30, 29, 29, 29, 28, 27, 27, 27, 27, 26, 26, 25, 27, 27, 25,
+ 38, 39, 40, 41, 41, 41, 42, 41, 39, 37, 37, 35, 34, 33, 32, 32, 30, 29,
+ 29, 28, 28, 27, 27, 26, 26, 26, 25, 25, 26, 25, 24, 27, 36, 38, 39, 40,
+ 40, 40, 41, 40, 39, 37, 36, 34, 34, 32, 31, 31, 29, 29, 28, 27, 27, 26,
+ 26, 25, 25, 25, 25, 25, 24, 25, 26, 23, 36, 38, 38, 39, 40, 40, 41, 40,
+ 38, 37, 36, 34, 33, 32, 31, 31, 29, 29, 28, 27, 27, 26, 26, 25, 25, 25,
+ 24, 23, 25, 24, 23, 25, 34, 36, 37, 38, 38, 38, 39, 38, 37, 35, 35, 33,
+ 33, 31, 30, 30, 28, 28, 27, 26, 26, 25, 25, 24, 24, 24, 23, 24, 23, 23,
+ 25, 22, 33, 35, 36, 37, 37, 38, 39, 38, 37, 35, 34, 33, 32, 31, 30, 29,
+ 28, 27, 27, 26, 26, 25, 24, 24, 23, 23, 23, 23, 23, 23, 22, 24, 32, 34,
+ 35, 36, 36, 36, 38, 37, 36, 34, 34, 32, 32, 30, 29, 29, 27, 27, 26, 25,
+ 25, 24, 24, 23, 23, 23, 22, 22, 23, 22, 23, 21, 32, 33, 34, 35, 36, 36,
+ 37, 36, 35, 34, 33, 32, 31, 30, 29, 29, 27, 27, 26, 25, 25, 24, 23, 23,
+ 23, 22, 22, 22, 21, 23, 21, 23, 32, 33, 34, 35, 36, 36, 37, 36, 35, 34,
+ 33, 32, 31, 30, 29, 29, 27, 27, 26, 25, 25, 24, 23, 23, 22, 22, 22, 22,
+ 22, 20, 22, 20, 31, 32, 33, 34, 34, 35, 36, 35, 34, 33, 33, 31, 31, 29,
+ 28, 28, 27, 26, 25, 25, 24, 23, 23, 22, 22, 22, 21, 22, 21, 21, 19, 22,
+ 30, 32, 32, 33, 34, 34, 35, 35, 34, 33, 32, 31, 31, 29, 29, 27, 27, 26,
+ 25, 25, 23, 24, 23, 22, 22, 22, 22, 21, 21, 21, 21, 19, 29, 31, 32, 33,
+ 33, 34, 35, 35, 33, 33, 31, 31, 30, 29, 29, 27, 28, 25, 26, 24, 25, 23,
+ 23, 23, 21, 22, 21, 21, 20, 21, 20, 21, 29, 31, 31, 32, 33, 33, 34, 34,
+ 33, 33, 31, 32, 29, 30, 27, 29, 26, 27, 25, 25, 24, 23, 23, 22, 23, 20,
+ 21, 21, 21, 20, 21, 20, 28, 30, 31, 32, 32, 33, 33, 34, 32, 32, 31, 31,
+ 29, 30, 27, 28, 26, 27, 24, 26, 23, 25, 22, 23, 21, 22, 19, 21, 20, 21,
+ 19, 21, 28, 30, 30, 32, 31, 33, 32, 34, 33, 30, 32, 29, 31, 27, 29, 26,
+ 28, 25, 27, 23, 25, 22, 24, 21, 23, 20, 22, 19, 21, 20, 21, 19,
+ /* Size 4x8 */
+ 65, 44, 38, 32, 57, 44, 41, 34, 45, 39, 37, 33, 45, 38, 32, 29, 42, 37,
+ 29, 26, 38, 35, 26, 24, 35, 33, 25, 22, 32, 31, 26, 21,
+ /* Size 8x4 */
+ 65, 57, 45, 45, 42, 38, 35, 32, 44, 44, 39, 38, 37, 35, 33, 31, 38, 41,
+ 37, 32, 29, 26, 25, 26, 32, 34, 33, 29, 26, 24, 22, 21,
+ /* Size 8x16 */
+ 64, 62, 45, 42, 39, 36, 32, 29, 66, 59, 46, 44, 42, 38, 34, 31, 62, 55,
+ 45, 45, 43, 40, 36, 33, 55, 48, 43, 45, 44, 41, 37, 34, 49, 46, 41, 41,
+ 41, 38, 35, 33, 42, 44, 39, 38, 38, 36, 33, 31, 42, 45, 40, 36, 35, 33,
+ 31, 29, 41, 44, 39, 34, 32, 31, 29, 27, 39, 43, 39, 34, 31, 29, 27, 26,
+ 38, 41, 38, 33, 30, 28, 26, 25, 36, 40, 37, 32, 29, 27, 25, 24, 34, 37,
+ 35, 31, 28, 26, 23, 23, 32, 36, 34, 30, 27, 25, 23, 22, 31, 34, 33, 29,
+ 27, 24, 22, 22, 30, 33, 33, 29, 26, 23, 21, 21, 29, 32, 32, 29, 26, 23,
+ 21, 20,
+ /* Size 16x8 */
+ 64, 66, 62, 55, 49, 42, 42, 41, 39, 38, 36, 34, 32, 31, 30, 29, 62, 59,
+ 55, 48, 46, 44, 45, 44, 43, 41, 40, 37, 36, 34, 33, 32, 45, 46, 45, 43,
+ 41, 39, 40, 39, 39, 38, 37, 35, 34, 33, 33, 32, 42, 44, 45, 45, 41, 38,
+ 36, 34, 34, 33, 32, 31, 30, 29, 29, 29, 39, 42, 43, 44, 41, 38, 35, 32,
+ 31, 30, 29, 28, 27, 27, 26, 26, 36, 38, 40, 41, 38, 36, 33, 31, 29, 28,
+ 27, 26, 25, 24, 23, 23, 32, 34, 36, 37, 35, 33, 31, 29, 27, 26, 25, 23,
+ 23, 22, 21, 21, 29, 31, 33, 34, 33, 31, 29, 27, 26, 25, 24, 23, 22, 22,
+ 21, 20,
+ /* Size 16x32 */
+ 64, 66, 62, 55, 45, 43, 42, 41, 39, 37, 36, 32, 32, 30, 29, 28, 65, 65,
+ 60, 53, 46, 44, 44, 42, 41, 38, 38, 34, 33, 32, 31, 30, 66, 64, 59, 53,
+ 46, 44, 44, 43, 42, 39, 38, 35, 34, 33, 31, 30, 67, 64, 59, 51, 46, 45,
+ 45, 44, 43, 40, 39, 36, 35, 34, 33, 32, 62, 59, 55, 48, 45, 44, 45, 44,
+ 43, 41, 40, 36, 36, 34, 33, 32, 61, 57, 53, 48, 45, 44, 45, 44, 43, 41,
+ 40, 37, 36, 34, 33, 33, 55, 51, 48, 44, 43, 43, 45, 45, 44, 41, 41, 38,
+ 37, 36, 34, 33, 53, 50, 47, 43, 42, 42, 44, 43, 42, 41, 40, 37, 36, 35,
+ 35, 34, 49, 48, 46, 43, 41, 41, 41, 41, 41, 39, 38, 36, 35, 34, 33, 34,
+ 43, 45, 44, 43, 40, 39, 39, 39, 38, 37, 37, 34, 34, 33, 33, 31, 42, 44,
+ 44, 43, 39, 39, 38, 38, 38, 36, 36, 34, 33, 32, 31, 32, 42, 45, 44, 44,
+ 40, 39, 37, 36, 36, 34, 34, 32, 32, 31, 32, 29, 42, 45, 45, 44, 40, 39,
+ 36, 36, 35, 34, 33, 32, 31, 31, 29, 31, 42, 45, 45, 45, 40, 38, 35, 34,
+ 33, 32, 32, 30, 30, 29, 30, 28, 41, 44, 44, 44, 39, 38, 34, 34, 32, 31,
+ 31, 29, 29, 29, 27, 30, 41, 44, 44, 44, 39, 38, 34, 33, 32, 31, 31, 29,
+ 29, 28, 29, 26, 39, 43, 43, 43, 39, 38, 34, 32, 31, 29, 29, 27, 27, 27,
+ 26, 28, 39, 42, 42, 43, 38, 37, 33, 32, 30, 29, 28, 27, 27, 26, 27, 25,
+ 38, 41, 41, 42, 38, 37, 33, 32, 30, 28, 28, 26, 26, 25, 25, 27, 36, 40,
+ 40, 41, 37, 36, 32, 31, 29, 27, 27, 25, 25, 25, 25, 23, 36, 39, 40, 41,
+ 37, 36, 32, 31, 29, 27, 27, 25, 25, 24, 24, 26, 34, 38, 38, 39, 36, 35,
+ 31, 30, 28, 26, 26, 24, 24, 24, 23, 22, 34, 37, 37, 38, 35, 34, 31, 30,
+ 28, 26, 26, 24, 23, 23, 23, 25, 32, 36, 36, 37, 34, 34, 30, 29, 27, 25,
+ 25, 23, 23, 22, 22, 21, 32, 35, 36, 37, 34, 33, 30, 29, 27, 25, 25, 23,
+ 23, 22, 22, 23, 32, 35, 35, 37, 34, 33, 30, 29, 27, 25, 25, 23, 22, 22,
+ 20, 20, 31, 34, 34, 36, 33, 33, 29, 28, 27, 25, 24, 22, 22, 22, 22, 22,
+ 30, 33, 34, 35, 33, 32, 29, 29, 26, 25, 24, 22, 22, 21, 21, 19, 30, 33,
+ 33, 34, 33, 32, 29, 29, 26, 26, 23, 23, 21, 21, 21, 21, 29, 32, 33, 34,
+ 33, 31, 29, 29, 26, 26, 23, 24, 20, 21, 20, 20, 29, 32, 32, 34, 32, 31,
+ 29, 28, 26, 26, 23, 23, 21, 21, 20, 21, 28, 31, 31, 34, 33, 29, 31, 26,
+ 28, 23, 25, 21, 23, 19, 21, 19,
+ /* Size 32x16 */
+ 64, 65, 66, 67, 62, 61, 55, 53, 49, 43, 42, 42, 42, 42, 41, 41, 39, 39,
+ 38, 36, 36, 34, 34, 32, 32, 32, 31, 30, 30, 29, 29, 28, 66, 65, 64, 64,
+ 59, 57, 51, 50, 48, 45, 44, 45, 45, 45, 44, 44, 43, 42, 41, 40, 39, 38,
+ 37, 36, 35, 35, 34, 33, 33, 32, 32, 31, 62, 60, 59, 59, 55, 53, 48, 47,
+ 46, 44, 44, 44, 45, 45, 44, 44, 43, 42, 41, 40, 40, 38, 37, 36, 36, 35,
+ 34, 34, 33, 33, 32, 31, 55, 53, 53, 51, 48, 48, 44, 43, 43, 43, 43, 44,
+ 44, 45, 44, 44, 43, 43, 42, 41, 41, 39, 38, 37, 37, 37, 36, 35, 34, 34,
+ 34, 34, 45, 46, 46, 46, 45, 45, 43, 42, 41, 40, 39, 40, 40, 40, 39, 39,
+ 39, 38, 38, 37, 37, 36, 35, 34, 34, 34, 33, 33, 33, 33, 32, 33, 43, 44,
+ 44, 45, 44, 44, 43, 42, 41, 39, 39, 39, 39, 38, 38, 38, 38, 37, 37, 36,
+ 36, 35, 34, 34, 33, 33, 33, 32, 32, 31, 31, 29, 42, 44, 44, 45, 45, 45,
+ 45, 44, 41, 39, 38, 37, 36, 35, 34, 34, 34, 33, 33, 32, 32, 31, 31, 30,
+ 30, 30, 29, 29, 29, 29, 29, 31, 41, 42, 43, 44, 44, 44, 45, 43, 41, 39,
+ 38, 36, 36, 34, 34, 33, 32, 32, 32, 31, 31, 30, 30, 29, 29, 29, 28, 29,
+ 29, 29, 28, 26, 39, 41, 42, 43, 43, 43, 44, 42, 41, 38, 38, 36, 35, 33,
+ 32, 32, 31, 30, 30, 29, 29, 28, 28, 27, 27, 27, 27, 26, 26, 26, 26, 28,
+ 37, 38, 39, 40, 41, 41, 41, 41, 39, 37, 36, 34, 34, 32, 31, 31, 29, 29,
+ 28, 27, 27, 26, 26, 25, 25, 25, 25, 25, 26, 26, 26, 23, 36, 38, 38, 39,
+ 40, 40, 41, 40, 38, 37, 36, 34, 33, 32, 31, 31, 29, 28, 28, 27, 27, 26,
+ 26, 25, 25, 25, 24, 24, 23, 23, 23, 25, 32, 34, 35, 36, 36, 37, 38, 37,
+ 36, 34, 34, 32, 32, 30, 29, 29, 27, 27, 26, 25, 25, 24, 24, 23, 23, 23,
+ 22, 22, 23, 24, 23, 21, 32, 33, 34, 35, 36, 36, 37, 36, 35, 34, 33, 32,
+ 31, 30, 29, 29, 27, 27, 26, 25, 25, 24, 23, 23, 23, 22, 22, 22, 21, 20,
+ 21, 23, 30, 32, 33, 34, 34, 34, 36, 35, 34, 33, 32, 31, 31, 29, 29, 28,
+ 27, 26, 25, 25, 24, 24, 23, 22, 22, 22, 22, 21, 21, 21, 21, 19, 29, 31,
+ 31, 33, 33, 33, 34, 35, 33, 33, 31, 32, 29, 30, 27, 29, 26, 27, 25, 25,
+ 24, 23, 23, 22, 22, 20, 22, 21, 21, 20, 20, 21, 28, 30, 30, 32, 32, 33,
+ 33, 34, 34, 31, 32, 29, 31, 28, 30, 26, 28, 25, 27, 23, 26, 22, 25, 21,
+ 23, 20, 22, 19, 21, 20, 21, 19,
+ /* Size 4x16 */
+ 66, 43, 37, 30, 64, 44, 39, 33, 59, 44, 41, 34, 51, 43, 41, 36, 48, 41,
+ 39, 34, 44, 39, 36, 32, 45, 39, 34, 31, 44, 38, 31, 29, 43, 38, 29, 27,
+ 41, 37, 28, 25, 39, 36, 27, 24, 37, 34, 26, 23, 35, 33, 25, 22, 34, 33,
+ 25, 22, 33, 32, 26, 21, 32, 31, 26, 21,
+ /* Size 16x4 */
+ 66, 64, 59, 51, 48, 44, 45, 44, 43, 41, 39, 37, 35, 34, 33, 32, 43, 44,
+ 44, 43, 41, 39, 39, 38, 38, 37, 36, 34, 33, 33, 32, 31, 37, 39, 41, 41,
+ 39, 36, 34, 31, 29, 28, 27, 26, 25, 25, 26, 26, 30, 33, 34, 36, 34, 32,
+ 31, 29, 27, 25, 24, 23, 22, 22, 21, 21,
+ /* Size 8x32 */
+ 64, 62, 45, 42, 39, 36, 32, 29, 65, 60, 46, 44, 41, 38, 33, 31, 66, 59,
+ 46, 44, 42, 38, 34, 31, 67, 59, 46, 45, 43, 39, 35, 33, 62, 55, 45, 45,
+ 43, 40, 36, 33, 61, 53, 45, 45, 43, 40, 36, 33, 55, 48, 43, 45, 44, 41,
+ 37, 34, 53, 47, 42, 44, 42, 40, 36, 35, 49, 46, 41, 41, 41, 38, 35, 33,
+ 43, 44, 40, 39, 38, 37, 34, 33, 42, 44, 39, 38, 38, 36, 33, 31, 42, 44,
+ 40, 37, 36, 34, 32, 32, 42, 45, 40, 36, 35, 33, 31, 29, 42, 45, 40, 35,
+ 33, 32, 30, 30, 41, 44, 39, 34, 32, 31, 29, 27, 41, 44, 39, 34, 32, 31,
+ 29, 29, 39, 43, 39, 34, 31, 29, 27, 26, 39, 42, 38, 33, 30, 28, 27, 27,
+ 38, 41, 38, 33, 30, 28, 26, 25, 36, 40, 37, 32, 29, 27, 25, 25, 36, 40,
+ 37, 32, 29, 27, 25, 24, 34, 38, 36, 31, 28, 26, 24, 23, 34, 37, 35, 31,
+ 28, 26, 23, 23, 32, 36, 34, 30, 27, 25, 23, 22, 32, 36, 34, 30, 27, 25,
+ 23, 22, 32, 35, 34, 30, 27, 25, 22, 20, 31, 34, 33, 29, 27, 24, 22, 22,
+ 30, 34, 33, 29, 26, 24, 22, 21, 30, 33, 33, 29, 26, 23, 21, 21, 29, 33,
+ 33, 29, 26, 23, 20, 20, 29, 32, 32, 29, 26, 23, 21, 20, 28, 31, 33, 31,
+ 28, 25, 23, 21,
+ /* Size 32x8 */
+ 64, 65, 66, 67, 62, 61, 55, 53, 49, 43, 42, 42, 42, 42, 41, 41, 39, 39,
+ 38, 36, 36, 34, 34, 32, 32, 32, 31, 30, 30, 29, 29, 28, 62, 60, 59, 59,
+ 55, 53, 48, 47, 46, 44, 44, 44, 45, 45, 44, 44, 43, 42, 41, 40, 40, 38,
+ 37, 36, 36, 35, 34, 34, 33, 33, 32, 31, 45, 46, 46, 46, 45, 45, 43, 42,
+ 41, 40, 39, 40, 40, 40, 39, 39, 39, 38, 38, 37, 37, 36, 35, 34, 34, 34,
+ 33, 33, 33, 33, 32, 33, 42, 44, 44, 45, 45, 45, 45, 44, 41, 39, 38, 37,
+ 36, 35, 34, 34, 34, 33, 33, 32, 32, 31, 31, 30, 30, 30, 29, 29, 29, 29,
+ 29, 31, 39, 41, 42, 43, 43, 43, 44, 42, 41, 38, 38, 36, 35, 33, 32, 32,
+ 31, 30, 30, 29, 29, 28, 28, 27, 27, 27, 27, 26, 26, 26, 26, 28, 36, 38,
+ 38, 39, 40, 40, 41, 40, 38, 37, 36, 34, 33, 32, 31, 31, 29, 28, 28, 27,
+ 27, 26, 26, 25, 25, 25, 24, 24, 23, 23, 23, 25, 32, 33, 34, 35, 36, 36,
+ 37, 36, 35, 34, 33, 32, 31, 30, 29, 29, 27, 27, 26, 25, 25, 24, 23, 23,
+ 23, 22, 22, 22, 21, 20, 21, 23, 29, 31, 31, 33, 33, 33, 34, 35, 33, 33,
+ 31, 32, 29, 30, 27, 29, 26, 27, 25, 25, 24, 23, 23, 22, 22, 20, 22, 21,
+ 21, 20, 20, 21 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 58, 33, 33, 17,
+#endif
+ /* Size 4x4 */
+ 63, 59, 38, 27, 59, 42, 32, 25, 38, 32, 23, 18, 27, 25, 18, 15,
+ /* Size 8x8 */
+ 64, 64, 60, 52, 41, 33, 27, 24, 64, 61, 58, 51, 42, 35, 29, 26, 60, 58,
+ 52, 45, 38, 33, 28, 25, 52, 51, 45, 36, 31, 27, 24, 22, 41, 42, 38, 31,
+ 26, 23, 20, 19, 33, 35, 33, 27, 23, 20, 17, 17, 27, 29, 28, 24, 20, 17,
+ 15, 14, 24, 26, 25, 22, 19, 17, 14, 13,
+ /* Size 16x16 */
+ 64, 65, 65, 64, 61, 57, 52, 47, 42, 38, 35, 31, 27, 25, 24, 22, 65, 64,
+ 64, 63, 61, 59, 53, 49, 45, 40, 37, 33, 29, 27, 25, 24, 65, 64, 63, 62,
+ 60, 59, 54, 49, 46, 41, 38, 34, 30, 28, 26, 25, 64, 63, 62, 59, 57, 55,
+ 51, 48, 45, 41, 38, 34, 31, 29, 27, 25, 61, 61, 60, 57, 53, 49, 47, 44,
+ 41, 38, 36, 33, 29, 27, 26, 25, 57, 59, 59, 55, 49, 42, 41, 38, 36, 34,
+ 32, 30, 27, 26, 24, 24, 52, 53, 54, 51, 47, 41, 38, 35, 34, 32, 30, 28,
+ 25, 24, 23, 22, 47, 49, 49, 48, 44, 38, 35, 32, 31, 29, 27, 25, 24, 22,
+ 22, 21, 42, 45, 46, 45, 41, 36, 34, 31, 29, 27, 25, 24, 22, 21, 20, 19,
+ 38, 40, 41, 41, 38, 34, 32, 29, 27, 25, 24, 22, 20, 19, 19, 18, 35, 37,
+ 38, 38, 36, 32, 30, 27, 25, 24, 22, 21, 19, 18, 18, 17, 31, 33, 34, 34,
+ 33, 30, 28, 25, 24, 22, 21, 19, 18, 17, 16, 15, 27, 29, 30, 31, 29, 27,
+ 25, 24, 22, 20, 19, 18, 17, 16, 15, 15, 25, 27, 28, 29, 27, 26, 24, 22,
+ 21, 19, 18, 17, 16, 15, 14, 13, 24, 25, 26, 27, 26, 24, 23, 22, 20, 19,
+ 18, 16, 15, 14, 14, 13, 22, 24, 25, 25, 25, 24, 22, 21, 19, 18, 17, 15,
+ 15, 13, 13, 13,
+ /* Size 32x32 */
+ 64, 65, 65, 65, 65, 65, 64, 64, 61, 60, 57, 57, 52, 50, 47, 45, 42, 39,
+ 38, 35, 35, 31, 31, 29, 27, 26, 25, 25, 24, 23, 22, 22, 65, 64, 64, 64,
+ 64, 64, 63, 63, 61, 60, 59, 58, 53, 52, 48, 46, 44, 41, 40, 37, 36, 33,
+ 32, 30, 29, 27, 26, 26, 25, 24, 23, 23, 65, 64, 64, 64, 64, 63, 63, 63,
+ 61, 60, 59, 58, 53, 52, 49, 47, 45, 41, 40, 37, 37, 33, 33, 30, 29, 27,
+ 27, 26, 25, 24, 24, 23, 65, 64, 64, 63, 63, 63, 63, 63, 61, 61, 59, 59,
+ 55, 53, 50, 48, 46, 43, 41, 38, 38, 34, 34, 32, 30, 28, 28, 27, 26, 25,
+ 25, 24, 65, 64, 64, 63, 63, 62, 62, 62, 60, 59, 59, 58, 54, 53, 49, 48,
+ 46, 43, 41, 38, 38, 34, 34, 32, 30, 28, 28, 27, 26, 25, 25, 24, 65, 64,
+ 63, 63, 62, 61, 61, 60, 59, 58, 56, 56, 53, 51, 49, 47, 45, 42, 41, 38,
+ 38, 35, 34, 32, 31, 29, 28, 28, 27, 26, 25, 25, 64, 63, 63, 63, 62, 61,
+ 59, 59, 57, 57, 55, 54, 51, 51, 48, 47, 45, 42, 41, 39, 38, 35, 34, 32,
+ 31, 29, 29, 28, 27, 26, 25, 24, 64, 63, 63, 63, 62, 60, 59, 58, 56, 55,
+ 53, 53, 51, 50, 48, 47, 45, 42, 41, 39, 38, 35, 35, 33, 31, 29, 29, 28,
+ 27, 27, 26, 25, 61, 61, 61, 61, 60, 59, 57, 56, 53, 53, 49, 49, 47, 46,
+ 44, 43, 41, 39, 38, 36, 36, 33, 33, 31, 29, 28, 27, 27, 26, 26, 25, 25,
+ 60, 60, 60, 61, 59, 58, 57, 55, 53, 52, 48, 48, 46, 45, 43, 41, 40, 38,
+ 38, 35, 35, 33, 32, 30, 29, 28, 27, 27, 26, 25, 25, 23, 57, 59, 59, 59,
+ 59, 56, 55, 53, 49, 48, 42, 42, 41, 40, 38, 37, 36, 35, 34, 32, 32, 30,
+ 30, 28, 27, 26, 26, 25, 24, 24, 24, 24, 57, 58, 58, 59, 58, 56, 54, 53,
+ 49, 48, 42, 42, 40, 39, 38, 37, 36, 34, 34, 32, 32, 30, 29, 28, 27, 26,
+ 25, 25, 24, 24, 23, 22, 52, 53, 53, 55, 54, 53, 51, 51, 47, 46, 41, 40,
+ 38, 37, 35, 34, 34, 32, 32, 30, 30, 28, 28, 26, 25, 24, 24, 24, 23, 22,
+ 22, 23, 50, 52, 52, 53, 53, 51, 51, 50, 46, 45, 40, 39, 37, 36, 34, 34,
+ 33, 31, 31, 29, 29, 27, 27, 26, 25, 24, 23, 23, 23, 22, 22, 21, 47, 48,
+ 49, 50, 49, 49, 48, 48, 44, 43, 38, 38, 35, 34, 32, 32, 31, 29, 29, 27,
+ 27, 26, 25, 24, 24, 23, 22, 22, 22, 21, 21, 21, 45, 46, 47, 48, 48, 47,
+ 47, 47, 43, 41, 37, 37, 34, 34, 32, 31, 30, 28, 28, 26, 26, 25, 25, 23,
+ 23, 22, 22, 21, 21, 21, 21, 19, 42, 44, 45, 46, 46, 45, 45, 45, 41, 40,
+ 36, 36, 34, 33, 31, 30, 29, 27, 27, 26, 25, 24, 24, 23, 22, 21, 21, 21,
+ 20, 20, 19, 20, 39, 41, 41, 43, 43, 42, 42, 42, 39, 38, 35, 34, 32, 31,
+ 29, 28, 27, 26, 25, 24, 24, 23, 23, 21, 21, 20, 20, 20, 19, 19, 19, 18,
+ 38, 40, 40, 41, 41, 41, 41, 41, 38, 38, 34, 34, 32, 31, 29, 28, 27, 25,
+ 25, 24, 24, 22, 22, 21, 20, 20, 19, 19, 19, 18, 18, 19, 35, 37, 37, 38,
+ 38, 38, 39, 39, 36, 35, 32, 32, 30, 29, 27, 26, 26, 24, 24, 23, 22, 21,
+ 21, 20, 19, 19, 18, 18, 18, 18, 18, 17, 35, 36, 37, 38, 38, 38, 38, 38,
+ 36, 35, 32, 32, 30, 29, 27, 26, 25, 24, 24, 22, 22, 21, 21, 20, 19, 19,
+ 18, 18, 18, 17, 17, 18, 31, 33, 33, 34, 34, 35, 35, 35, 33, 33, 30, 30,
+ 28, 27, 26, 25, 24, 23, 22, 21, 21, 20, 19, 18, 18, 17, 17, 17, 17, 17,
+ 17, 16, 31, 32, 33, 34, 34, 34, 34, 35, 33, 32, 30, 29, 28, 27, 25, 25,
+ 24, 23, 22, 21, 21, 19, 19, 18, 18, 17, 17, 17, 16, 16, 15, 17, 29, 30,
+ 30, 32, 32, 32, 32, 33, 31, 30, 28, 28, 26, 26, 24, 23, 23, 21, 21, 20,
+ 20, 18, 18, 17, 17, 16, 16, 16, 16, 15, 16, 14, 27, 29, 29, 30, 30, 31,
+ 31, 31, 29, 29, 27, 27, 25, 25, 24, 23, 22, 21, 20, 19, 19, 18, 18, 17,
+ 17, 16, 16, 16, 15, 15, 15, 16, 26, 27, 27, 28, 28, 29, 29, 29, 28, 28,
+ 26, 26, 24, 24, 23, 22, 21, 20, 20, 19, 19, 17, 17, 16, 16, 15, 15, 15,
+ 15, 14, 15, 14, 25, 26, 27, 28, 28, 28, 29, 29, 27, 27, 26, 25, 24, 23,
+ 22, 22, 21, 20, 19, 18, 18, 17, 17, 16, 16, 15, 15, 15, 14, 14, 13, 15,
+ 25, 26, 26, 27, 27, 28, 28, 28, 27, 27, 25, 25, 24, 23, 22, 21, 21, 20,
+ 19, 18, 18, 17, 17, 16, 16, 15, 15, 15, 14, 14, 14, 13, 24, 25, 25, 26,
+ 26, 27, 27, 27, 26, 26, 24, 24, 23, 23, 22, 21, 20, 19, 19, 18, 18, 17,
+ 16, 16, 15, 15, 14, 14, 14, 14, 13, 14, 23, 24, 24, 25, 25, 26, 26, 27,
+ 26, 25, 24, 24, 22, 22, 21, 21, 20, 19, 18, 18, 17, 17, 16, 15, 15, 14,
+ 14, 14, 14, 13, 14, 13, 22, 23, 24, 25, 25, 25, 25, 26, 25, 25, 24, 23,
+ 22, 22, 21, 21, 19, 19, 18, 18, 17, 17, 15, 16, 15, 15, 13, 14, 13, 14,
+ 13, 13, 22, 23, 23, 24, 24, 25, 24, 25, 25, 23, 24, 22, 23, 21, 21, 19,
+ 20, 18, 19, 17, 18, 16, 17, 14, 16, 14, 15, 13, 14, 13, 13, 12,
+ /* Size 4x8 */
+ 64, 58, 40, 26, 63, 56, 41, 28, 60, 48, 38, 27, 53, 40, 31, 24, 43, 35,
+ 25, 20, 34, 30, 22, 17, 28, 26, 20, 15, 25, 24, 18, 14,
+ /* Size 8x4 */
+ 64, 63, 60, 53, 43, 34, 28, 25, 58, 56, 48, 40, 35, 30, 26, 24, 40, 41,
+ 38, 31, 25, 22, 20, 18, 26, 28, 27, 24, 20, 17, 15, 14,
+ /* Size 8x16 */
+ 64, 65, 61, 51, 40, 31, 26, 23, 65, 64, 61, 53, 42, 33, 27, 25, 65, 63,
+ 60, 53, 43, 34, 29, 26, 64, 62, 57, 51, 43, 35, 29, 26, 61, 60, 53, 46,
+ 39, 33, 28, 26, 57, 58, 49, 40, 35, 30, 26, 24, 52, 53, 47, 38, 32, 28,
+ 24, 23, 47, 49, 44, 35, 29, 26, 23, 21, 43, 46, 41, 33, 28, 24, 21, 20,
+ 38, 41, 38, 31, 26, 22, 20, 18, 35, 38, 36, 29, 24, 21, 19, 17, 31, 34,
+ 33, 27, 23, 19, 17, 16, 27, 30, 29, 25, 21, 18, 16, 15, 25, 28, 27, 24,
+ 20, 17, 15, 14, 24, 26, 26, 23, 19, 17, 15, 14, 22, 25, 25, 22, 19, 17,
+ 15, 13,
+ /* Size 16x8 */
+ 64, 65, 65, 64, 61, 57, 52, 47, 43, 38, 35, 31, 27, 25, 24, 22, 65, 64,
+ 63, 62, 60, 58, 53, 49, 46, 41, 38, 34, 30, 28, 26, 25, 61, 61, 60, 57,
+ 53, 49, 47, 44, 41, 38, 36, 33, 29, 27, 26, 25, 51, 53, 53, 51, 46, 40,
+ 38, 35, 33, 31, 29, 27, 25, 24, 23, 22, 40, 42, 43, 43, 39, 35, 32, 29,
+ 28, 26, 24, 23, 21, 20, 19, 19, 31, 33, 34, 35, 33, 30, 28, 26, 24, 22,
+ 21, 19, 18, 17, 17, 17, 26, 27, 29, 29, 28, 26, 24, 23, 21, 20, 19, 17,
+ 16, 15, 15, 15, 23, 25, 26, 26, 26, 24, 23, 21, 20, 18, 17, 16, 15, 14,
+ 14, 13,
+ /* Size 16x32 */
+ 64, 65, 65, 64, 61, 57, 51, 47, 40, 38, 31, 31, 26, 25, 23, 22, 65, 64,
+ 64, 63, 61, 58, 52, 48, 41, 40, 33, 32, 27, 26, 24, 23, 65, 64, 64, 63,
+ 61, 59, 53, 49, 42, 40, 33, 33, 27, 27, 25, 23, 65, 63, 63, 62, 61, 59,
+ 54, 50, 43, 41, 34, 34, 28, 28, 26, 25, 65, 63, 63, 61, 60, 58, 53, 49,
+ 43, 41, 34, 34, 29, 28, 26, 24, 64, 63, 62, 60, 59, 56, 52, 49, 43, 41,
+ 35, 34, 29, 28, 26, 25, 64, 63, 62, 59, 57, 55, 51, 48, 43, 41, 35, 34,
+ 29, 29, 26, 25, 64, 62, 61, 58, 56, 53, 50, 48, 43, 41, 35, 35, 30, 29,
+ 27, 26, 61, 61, 60, 56, 53, 49, 46, 44, 39, 38, 33, 33, 28, 27, 26, 26,
+ 60, 60, 59, 55, 53, 48, 45, 43, 39, 38, 33, 32, 28, 27, 25, 24, 57, 59,
+ 58, 53, 49, 43, 40, 38, 35, 34, 30, 30, 26, 26, 24, 24, 57, 59, 58, 53,
+ 49, 43, 40, 38, 35, 34, 30, 29, 26, 25, 24, 22, 52, 55, 53, 51, 47, 41,
+ 38, 35, 32, 32, 28, 27, 24, 24, 23, 23, 51, 53, 53, 49, 46, 40, 37, 34,
+ 32, 31, 27, 27, 24, 24, 23, 21, 47, 50, 49, 48, 44, 38, 35, 33, 29, 29,
+ 26, 25, 23, 22, 21, 22, 45, 48, 47, 46, 42, 37, 34, 32, 28, 28, 25, 25,
+ 22, 22, 21, 19, 43, 46, 46, 44, 41, 36, 33, 31, 28, 27, 24, 24, 21, 21,
+ 20, 20, 39, 43, 42, 42, 39, 35, 32, 29, 26, 25, 23, 23, 20, 20, 20, 18,
+ 38, 41, 41, 41, 38, 34, 31, 29, 26, 25, 22, 22, 20, 20, 18, 19, 35, 38,
+ 38, 38, 36, 32, 29, 27, 25, 24, 21, 21, 19, 18, 18, 17, 35, 38, 38, 38,
+ 36, 32, 29, 27, 24, 24, 21, 21, 19, 18, 17, 18, 32, 34, 34, 35, 33, 30,
+ 27, 26, 23, 22, 20, 19, 17, 17, 17, 16, 31, 34, 34, 34, 33, 30, 27, 25,
+ 23, 22, 19, 19, 17, 17, 16, 17, 29, 31, 32, 32, 31, 28, 26, 24, 22, 21,
+ 18, 18, 16, 16, 15, 15, 27, 30, 30, 31, 29, 27, 25, 24, 21, 20, 18, 18,
+ 16, 16, 15, 16, 26, 28, 28, 29, 28, 26, 24, 23, 20, 20, 17, 17, 15, 15,
+ 14, 14, 25, 28, 28, 29, 27, 25, 24, 22, 20, 20, 17, 17, 15, 15, 14, 15,
+ 25, 27, 27, 28, 27, 25, 23, 22, 20, 19, 17, 17, 15, 15, 14, 13, 24, 26,
+ 26, 27, 26, 24, 23, 22, 19, 19, 17, 16, 15, 14, 14, 14, 23, 25, 25, 26,
+ 25, 24, 22, 21, 19, 18, 17, 16, 14, 14, 13, 13, 22, 25, 25, 26, 25, 23,
+ 22, 21, 19, 18, 17, 16, 15, 14, 13, 14, 22, 24, 24, 25, 25, 22, 23, 19,
+ 20, 17, 18, 15, 16, 13, 14, 13,
+ /* Size 32x16 */
+ 64, 65, 65, 65, 65, 64, 64, 64, 61, 60, 57, 57, 52, 51, 47, 45, 43, 39,
+ 38, 35, 35, 32, 31, 29, 27, 26, 25, 25, 24, 23, 22, 22, 65, 64, 64, 63,
+ 63, 63, 63, 62, 61, 60, 59, 59, 55, 53, 50, 48, 46, 43, 41, 38, 38, 34,
+ 34, 31, 30, 28, 28, 27, 26, 25, 25, 24, 65, 64, 64, 63, 63, 62, 62, 61,
+ 60, 59, 58, 58, 53, 53, 49, 47, 46, 42, 41, 38, 38, 34, 34, 32, 30, 28,
+ 28, 27, 26, 25, 25, 24, 64, 63, 63, 62, 61, 60, 59, 58, 56, 55, 53, 53,
+ 51, 49, 48, 46, 44, 42, 41, 38, 38, 35, 34, 32, 31, 29, 29, 28, 27, 26,
+ 26, 25, 61, 61, 61, 61, 60, 59, 57, 56, 53, 53, 49, 49, 47, 46, 44, 42,
+ 41, 39, 38, 36, 36, 33, 33, 31, 29, 28, 27, 27, 26, 25, 25, 25, 57, 58,
+ 59, 59, 58, 56, 55, 53, 49, 48, 43, 43, 41, 40, 38, 37, 36, 35, 34, 32,
+ 32, 30, 30, 28, 27, 26, 25, 25, 24, 24, 23, 22, 51, 52, 53, 54, 53, 52,
+ 51, 50, 46, 45, 40, 40, 38, 37, 35, 34, 33, 32, 31, 29, 29, 27, 27, 26,
+ 25, 24, 24, 23, 23, 22, 22, 23, 47, 48, 49, 50, 49, 49, 48, 48, 44, 43,
+ 38, 38, 35, 34, 33, 32, 31, 29, 29, 27, 27, 26, 25, 24, 24, 23, 22, 22,
+ 22, 21, 21, 19, 40, 41, 42, 43, 43, 43, 43, 43, 39, 39, 35, 35, 32, 32,
+ 29, 28, 28, 26, 26, 25, 24, 23, 23, 22, 21, 20, 20, 20, 19, 19, 19, 20,
+ 38, 40, 40, 41, 41, 41, 41, 41, 38, 38, 34, 34, 32, 31, 29, 28, 27, 25,
+ 25, 24, 24, 22, 22, 21, 20, 20, 20, 19, 19, 18, 18, 17, 31, 33, 33, 34,
+ 34, 35, 35, 35, 33, 33, 30, 30, 28, 27, 26, 25, 24, 23, 22, 21, 21, 20,
+ 19, 18, 18, 17, 17, 17, 17, 17, 17, 18, 31, 32, 33, 34, 34, 34, 34, 35,
+ 33, 32, 30, 29, 27, 27, 25, 25, 24, 23, 22, 21, 21, 19, 19, 18, 18, 17,
+ 17, 17, 16, 16, 16, 15, 26, 27, 27, 28, 29, 29, 29, 30, 28, 28, 26, 26,
+ 24, 24, 23, 22, 21, 20, 20, 19, 19, 17, 17, 16, 16, 15, 15, 15, 15, 14,
+ 15, 16, 25, 26, 27, 28, 28, 28, 29, 29, 27, 27, 26, 25, 24, 24, 22, 22,
+ 21, 20, 20, 18, 18, 17, 17, 16, 16, 15, 15, 15, 14, 14, 14, 13, 23, 24,
+ 25, 26, 26, 26, 26, 27, 26, 25, 24, 24, 23, 23, 21, 21, 20, 20, 18, 18,
+ 17, 17, 16, 15, 15, 14, 14, 14, 14, 13, 13, 14, 22, 23, 23, 25, 24, 25,
+ 25, 26, 26, 24, 24, 22, 23, 21, 22, 19, 20, 18, 19, 17, 18, 16, 17, 15,
+ 16, 14, 15, 13, 14, 13, 14, 13,
+ /* Size 4x16 */
+ 65, 57, 38, 25, 64, 59, 40, 27, 63, 58, 41, 28, 63, 55, 41, 29, 61, 49,
+ 38, 27, 59, 43, 34, 26, 55, 41, 32, 24, 50, 38, 29, 22, 46, 36, 27, 21,
+ 41, 34, 25, 20, 38, 32, 24, 18, 34, 30, 22, 17, 30, 27, 20, 16, 28, 25,
+ 20, 15, 26, 24, 19, 14, 25, 23, 18, 14,
+ /* Size 16x4 */
+ 65, 64, 63, 63, 61, 59, 55, 50, 46, 41, 38, 34, 30, 28, 26, 25, 57, 59,
+ 58, 55, 49, 43, 41, 38, 36, 34, 32, 30, 27, 25, 24, 23, 38, 40, 41, 41,
+ 38, 34, 32, 29, 27, 25, 24, 22, 20, 20, 19, 18, 25, 27, 28, 29, 27, 26,
+ 24, 22, 21, 20, 18, 17, 16, 15, 14, 14,
+ /* Size 8x32 */
+ 64, 65, 61, 51, 40, 31, 26, 23, 65, 64, 61, 52, 41, 33, 27, 24, 65, 64,
+ 61, 53, 42, 33, 27, 25, 65, 63, 61, 54, 43, 34, 28, 26, 65, 63, 60, 53,
+ 43, 34, 29, 26, 64, 62, 59, 52, 43, 35, 29, 26, 64, 62, 57, 51, 43, 35,
+ 29, 26, 64, 61, 56, 50, 43, 35, 30, 27, 61, 60, 53, 46, 39, 33, 28, 26,
+ 60, 59, 53, 45, 39, 33, 28, 25, 57, 58, 49, 40, 35, 30, 26, 24, 57, 58,
+ 49, 40, 35, 30, 26, 24, 52, 53, 47, 38, 32, 28, 24, 23, 51, 53, 46, 37,
+ 32, 27, 24, 23, 47, 49, 44, 35, 29, 26, 23, 21, 45, 47, 42, 34, 28, 25,
+ 22, 21, 43, 46, 41, 33, 28, 24, 21, 20, 39, 42, 39, 32, 26, 23, 20, 20,
+ 38, 41, 38, 31, 26, 22, 20, 18, 35, 38, 36, 29, 25, 21, 19, 18, 35, 38,
+ 36, 29, 24, 21, 19, 17, 32, 34, 33, 27, 23, 20, 17, 17, 31, 34, 33, 27,
+ 23, 19, 17, 16, 29, 32, 31, 26, 22, 18, 16, 15, 27, 30, 29, 25, 21, 18,
+ 16, 15, 26, 28, 28, 24, 20, 17, 15, 14, 25, 28, 27, 24, 20, 17, 15, 14,
+ 25, 27, 27, 23, 20, 17, 15, 14, 24, 26, 26, 23, 19, 17, 15, 14, 23, 25,
+ 25, 22, 19, 17, 14, 13, 22, 25, 25, 22, 19, 17, 15, 13, 22, 24, 25, 23,
+ 20, 18, 16, 14,
+ /* Size 32x8 */
+ 64, 65, 65, 65, 65, 64, 64, 64, 61, 60, 57, 57, 52, 51, 47, 45, 43, 39,
+ 38, 35, 35, 32, 31, 29, 27, 26, 25, 25, 24, 23, 22, 22, 65, 64, 64, 63,
+ 63, 62, 62, 61, 60, 59, 58, 58, 53, 53, 49, 47, 46, 42, 41, 38, 38, 34,
+ 34, 32, 30, 28, 28, 27, 26, 25, 25, 24, 61, 61, 61, 61, 60, 59, 57, 56,
+ 53, 53, 49, 49, 47, 46, 44, 42, 41, 39, 38, 36, 36, 33, 33, 31, 29, 28,
+ 27, 27, 26, 25, 25, 25, 51, 52, 53, 54, 53, 52, 51, 50, 46, 45, 40, 40,
+ 38, 37, 35, 34, 33, 32, 31, 29, 29, 27, 27, 26, 25, 24, 24, 23, 23, 22,
+ 22, 23, 40, 41, 42, 43, 43, 43, 43, 43, 39, 39, 35, 35, 32, 32, 29, 28,
+ 28, 26, 26, 25, 24, 23, 23, 22, 21, 20, 20, 20, 19, 19, 19, 20, 31, 33,
+ 33, 34, 34, 35, 35, 35, 33, 33, 30, 30, 28, 27, 26, 25, 24, 23, 22, 21,
+ 21, 20, 19, 18, 18, 17, 17, 17, 17, 17, 17, 18, 26, 27, 27, 28, 29, 29,
+ 29, 30, 28, 28, 26, 26, 24, 24, 23, 22, 21, 20, 20, 19, 19, 17, 17, 16,
+ 16, 15, 15, 15, 15, 14, 15, 16, 23, 24, 25, 26, 26, 26, 26, 27, 26, 25,
+ 24, 24, 23, 23, 21, 21, 20, 20, 18, 18, 17, 17, 16, 15, 15, 14, 14, 14,
+ 14, 13, 13, 14 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 43, 39, 39, 25,
+#endif
+ /* Size 4x4 */
+ 64, 44, 41, 35, 44, 39, 37, 33, 41, 37, 29, 26, 35, 33, 26, 22,
+ /* Size 8x8 */
+ 65, 59, 48, 44, 41, 38, 34, 32, 59, 53, 46, 45, 43, 40, 36, 34, 48, 46,
+ 42, 41, 41, 38, 36, 34, 44, 45, 41, 37, 35, 34, 32, 31, 41, 43, 41, 35,
+ 32, 29, 28, 27, 38, 40, 38, 34, 29, 27, 25, 25, 34, 36, 36, 32, 28, 25,
+ 23, 22, 32, 34, 34, 31, 27, 25, 22, 21,
+ /* Size 16x16 */
+ 64, 66, 65, 58, 51, 42, 42, 42, 41, 39, 38, 36, 33, 32, 31, 30, 66, 65,
+ 63, 55, 49, 43, 44, 44, 43, 41, 40, 38, 36, 34, 33, 32, 65, 63, 59, 52,
+ 48, 44, 45, 46, 44, 43, 41, 39, 37, 36, 34, 33, 58, 55, 52, 47, 45, 43,
+ 44, 45, 44, 44, 42, 40, 38, 37, 36, 34, 51, 49, 48, 45, 43, 41, 42, 42,
+ 42, 41, 40, 39, 37, 36, 35, 34, 42, 43, 44, 43, 41, 39, 39, 38, 38, 38,
+ 37, 36, 34, 34, 33, 33, 42, 44, 45, 44, 42, 39, 38, 37, 36, 36, 35, 34,
+ 33, 32, 31, 31, 42, 44, 46, 45, 42, 38, 37, 35, 34, 33, 33, 32, 31, 30,
+ 30, 29, 41, 43, 44, 44, 42, 38, 36, 34, 33, 32, 32, 30, 29, 29, 28, 28,
+ 39, 41, 43, 44, 41, 38, 36, 33, 32, 31, 30, 29, 28, 27, 27, 26, 38, 40,
+ 41, 42, 40, 37, 35, 33, 32, 30, 29, 28, 27, 26, 26, 25, 36, 38, 39, 40,
+ 39, 36, 34, 32, 30, 29, 28, 26, 25, 25, 24, 23, 33, 36, 37, 38, 37, 34,
+ 33, 31, 29, 28, 27, 25, 24, 23, 23, 22, 32, 34, 36, 37, 36, 34, 32, 30,
+ 29, 27, 26, 25, 23, 23, 22, 21, 31, 33, 34, 36, 35, 33, 31, 30, 28, 27,
+ 26, 24, 23, 22, 22, 21, 30, 32, 33, 34, 34, 33, 31, 29, 28, 26, 25, 23,
22, 21, 21, 21,
- /* Size 32 */
- 64, 68, 71, 75, 79, 70, 62, 53, 45, 44, 43, 43, 42, 42, 41, 40, 40, 39,
- 38, 37, 36, 35, 34, 33, 32, 31, 30, 30, 29, 29, 29, 29, 68, 69, 70, 72,
- 73, 66, 59, 52, 44, 44, 44, 44, 44, 43, 43, 42, 42, 41, 40, 39, 38, 37,
- 36, 35, 34, 33, 32, 31, 30, 30, 30, 30, 71, 70, 69, 68, 67, 61, 56, 50,
- 44, 44, 45, 45, 45, 45, 44, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34,
- 33, 32, 31, 31, 31, 31, 75, 72, 68, 65, 61, 57, 53, 48, 44, 45, 45, 46,
- 47, 46, 46, 45, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 33,
- 33, 33, 79, 73, 67, 61, 55, 52, 50, 47, 44, 45, 46, 47, 48, 48, 47, 47,
- 47, 46, 45, 44, 43, 42, 41, 40, 38, 37, 36, 35, 34, 34, 34, 34, 70, 66,
- 61, 57, 52, 50, 47, 45, 42, 43, 44, 45, 46, 46, 45, 45, 45, 44, 43, 42,
- 42, 41, 39, 38, 37, 36, 36, 35, 34, 34, 34, 34, 62, 59, 56, 53, 50, 47,
- 45, 43, 41, 42, 42, 43, 44, 43, 43, 43, 43, 42, 42, 41, 40, 39, 38, 37,
- 37, 36, 35, 34, 33, 33, 33, 33, 53, 52, 50, 48, 47, 45, 43, 41, 39, 40,
- 40, 41, 41, 41, 41, 41, 41, 41, 40, 39, 39, 38, 37, 36, 36, 35, 34, 33,
- 32, 32, 32, 32, 45, 44, 44, 44, 44, 42, 41, 39, 38, 38, 39, 39, 39, 39,
- 39, 39, 39, 39, 38, 38, 37, 37, 36, 35, 35, 34, 33, 32, 32, 32, 32, 32,
- 44, 44, 44, 45, 45, 43, 42, 40, 38, 38, 38, 38, 38, 38, 38, 38, 38, 37,
- 37, 37, 36, 36, 35, 34, 34, 33, 32, 32, 31, 31, 31, 31, 43, 44, 45, 45,
- 46, 44, 42, 40, 39, 38, 38, 37, 37, 37, 37, 37, 36, 36, 36, 35, 35, 34,
- 34, 33, 33, 32, 31, 31, 30, 30, 30, 30, 43, 44, 45, 46, 47, 45, 43, 41,
- 39, 38, 37, 37, 36, 36, 35, 35, 35, 35, 34, 34, 34, 33, 33, 32, 32, 31,
- 30, 30, 29, 29, 29, 29, 42, 44, 45, 47, 48, 46, 44, 41, 39, 38, 37, 36,
- 35, 35, 34, 34, 33, 33, 33, 33, 32, 32, 31, 31, 31, 30, 30, 29, 29, 29,
- 29, 29, 42, 43, 45, 46, 48, 46, 43, 41, 39, 38, 37, 36, 35, 34, 34, 33,
- 33, 32, 32, 32, 31, 31, 30, 30, 30, 29, 29, 28, 28, 28, 28, 28, 41, 43,
- 44, 46, 47, 45, 43, 41, 39, 38, 37, 35, 34, 34, 33, 32, 32, 31, 31, 31,
- 30, 30, 30, 29, 29, 28, 28, 28, 27, 27, 27, 27, 40, 42, 44, 45, 47, 45,
- 43, 41, 39, 38, 37, 35, 34, 33, 32, 32, 31, 31, 30, 30, 29, 29, 29, 28,
- 28, 28, 27, 27, 26, 26, 26, 26, 40, 42, 43, 45, 47, 45, 43, 41, 39, 38,
- 36, 35, 33, 33, 32, 31, 30, 30, 29, 29, 28, 28, 28, 27, 27, 27, 26, 26,
- 26, 26, 26, 26, 39, 41, 42, 44, 46, 44, 42, 41, 39, 37, 36, 35, 33, 32,
- 31, 31, 30, 29, 29, 28, 28, 28, 27, 27, 26, 26, 26, 25, 25, 25, 25, 25,
- 38, 40, 41, 43, 45, 43, 42, 40, 38, 37, 36, 34, 33, 32, 31, 30, 29, 29,
- 28, 28, 27, 27, 27, 26, 26, 26, 25, 25, 25, 25, 25, 25, 37, 39, 40, 42,
- 44, 42, 41, 39, 38, 37, 35, 34, 33, 32, 31, 30, 29, 28, 28, 27, 27, 26,
- 26, 26, 25, 25, 25, 24, 24, 24, 24, 24, 36, 38, 39, 41, 43, 42, 40, 39,
- 37, 36, 35, 34, 32, 31, 30, 29, 28, 28, 27, 27, 26, 26, 25, 25, 25, 24,
- 24, 24, 23, 23, 23, 23, 35, 37, 38, 40, 42, 41, 39, 38, 37, 36, 34, 33,
- 32, 31, 30, 29, 28, 28, 27, 26, 26, 25, 25, 25, 24, 24, 24, 23, 23, 23,
- 23, 23, 34, 36, 37, 39, 41, 39, 38, 37, 36, 35, 34, 33, 31, 30, 30, 29,
- 28, 27, 27, 26, 25, 25, 25, 24, 24, 24, 23, 23, 23, 23, 23, 23, 33, 35,
- 36, 38, 40, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 27, 26, 26,
- 25, 25, 24, 24, 23, 23, 23, 23, 22, 22, 22, 22, 32, 34, 35, 37, 38, 37,
- 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 26, 25, 25, 24, 24, 23,
- 23, 23, 22, 22, 22, 22, 22, 22, 31, 33, 34, 36, 37, 36, 36, 35, 34, 33,
- 32, 31, 30, 29, 28, 28, 27, 26, 26, 25, 24, 24, 24, 23, 23, 22, 22, 22,
- 22, 22, 22, 22, 30, 32, 33, 35, 36, 36, 35, 34, 33, 32, 31, 30, 30, 29,
- 28, 27, 26, 26, 25, 25, 24, 24, 23, 23, 22, 22, 22, 22, 21, 21, 21, 21,
- 30, 31, 32, 34, 35, 35, 34, 33, 32, 32, 31, 30, 29, 28, 28, 27, 26, 25,
- 25, 24, 24, 23, 23, 23, 22, 22, 22, 21, 21, 21, 21, 21, 29, 30, 31, 33,
- 34, 34, 33, 32, 32, 31, 30, 29, 29, 28, 27, 26, 26, 25, 25, 24, 23, 23,
- 23, 22, 22, 22, 21, 21, 21, 21, 21, 21, 29, 30, 31, 33, 34, 34, 33, 32,
- 32, 31, 30, 29, 29, 28, 27, 26, 26, 25, 25, 24, 23, 23, 23, 22, 22, 22,
- 21, 21, 21, 21, 21, 21, 29, 30, 31, 33, 34, 34, 33, 32, 32, 31, 30, 29,
- 29, 28, 27, 26, 26, 25, 25, 24, 23, 23, 23, 22, 22, 22, 21, 21, 21, 21,
- 21, 21, 29, 30, 31, 33, 34, 34, 33, 32, 32, 31, 30, 29, 29, 28, 27, 26,
- 26, 25, 25, 24, 23, 23, 23, 22, 22, 22, 21, 21, 21, 21, 21, 21 },
- { /* Intra matrices */
- /* Size 4 */
- 142, 90, 83, 66, 90, 75, 71, 62, 83, 71, 55, 49, 66, 62, 49, 41,
- /* Size 8 */
- 132, 163, 91, 85, 80, 72, 64, 57, 163, 113, 89, 98, 95, 87, 77, 68, 91,
- 89, 76, 79, 79, 75, 69, 63, 85, 98, 79, 70, 67, 64, 60, 56, 80, 95, 79,
- 67, 60, 56, 53, 50, 72, 87, 75, 64, 56, 51, 48, 45, 64, 77, 69, 60, 53,
- 48, 44, 42, 57, 68, 63, 56, 50, 45, 42, 39,
- /* Size 16 */
- 136, 152, 168, 130, 93, 90, 88, 85, 82, 78, 74, 70, 65, 62, 58, 58, 152,
- 147, 142, 117, 92, 93, 94, 92, 90, 86, 81, 77, 72, 68, 64, 64, 168, 142,
- 116, 104, 91, 96, 101, 99, 98, 93, 89, 84, 79, 75, 70, 70, 130, 117,
- 104, 94, 85, 88, 91, 90, 90, 86, 83, 79, 75, 71, 67, 67, 93, 92, 91, 85,
- 78, 80, 81, 81, 81, 79, 77, 74, 71, 68, 65, 65, 90, 93, 96, 88, 80, 78,
- 76, 76, 75, 73, 71, 69, 67, 64, 61, 61, 88, 94, 101, 91, 81, 76, 72, 70,
- 68, 67, 66, 64, 62, 60, 58, 58, 85, 92, 99, 90, 81, 76, 70, 68, 65, 63,
- 62, 60, 58, 56, 55, 55, 82, 90, 98, 90, 81, 75, 68, 65, 61, 60, 58, 56,
- 54, 53, 51, 51, 78, 86, 93, 86, 79, 73, 67, 63, 60, 57, 55, 53, 52, 50,
- 49, 49, 74, 81, 89, 83, 77, 71, 66, 62, 58, 55, 52, 51, 49, 48, 47, 47,
- 70, 77, 84, 79, 74, 69, 64, 60, 56, 53, 51, 49, 47, 46, 45, 45, 65, 72,
- 79, 75, 71, 67, 62, 58, 54, 52, 49, 47, 46, 44, 43, 43, 62, 68, 75, 71,
- 68, 64, 60, 56, 53, 50, 48, 46, 44, 43, 42, 42, 58, 64, 70, 67, 65, 61,
- 58, 55, 51, 49, 47, 45, 43, 42, 40, 40, 58, 64, 70, 67, 65, 61, 58, 55,
- 51, 49, 47, 45, 43, 42, 40, 40,
- /* Size 32 */
- 137, 146, 154, 162, 170, 151, 132, 113, 94, 93, 92, 90, 89, 88, 86, 85,
- 83, 81, 79, 77, 75, 73, 71, 68, 66, 64, 63, 61, 59, 59, 59, 59, 146,
- 148, 151, 154, 157, 141, 125, 110, 94, 93, 93, 93, 92, 91, 90, 89, 87,
- 85, 83, 81, 79, 76, 74, 72, 70, 68, 66, 64, 62, 62, 62, 62, 154, 151,
- 149, 146, 144, 131, 119, 106, 93, 94, 94, 95, 96, 94, 93, 92, 91, 89,
- 87, 85, 83, 80, 78, 76, 73, 71, 69, 67, 65, 65, 65, 65, 162, 154, 146,
- 139, 131, 122, 112, 103, 93, 94, 96, 97, 99, 98, 97, 96, 95, 93, 91, 89,
- 86, 84, 82, 79, 77, 75, 72, 70, 68, 68, 68, 68, 170, 157, 144, 131, 118,
- 112, 105, 99, 93, 95, 97, 100, 102, 101, 101, 100, 99, 97, 95, 93, 90,
- 88, 85, 83, 80, 78, 76, 73, 71, 71, 71, 71, 151, 141, 131, 122, 112,
- 106, 100, 95, 89, 91, 93, 95, 97, 97, 96, 95, 95, 93, 91, 89, 87, 85,
- 83, 81, 78, 76, 74, 72, 70, 70, 70, 70, 132, 125, 119, 112, 105, 100,
- 96, 91, 86, 87, 89, 91, 92, 92, 91, 91, 91, 89, 88, 86, 84, 82, 80, 78,
- 76, 74, 72, 70, 68, 68, 68, 68, 113, 110, 106, 103, 99, 95, 91, 87, 83,
- 84, 85, 86, 87, 87, 87, 87, 87, 85, 84, 83, 81, 80, 78, 76, 74, 72, 70,
- 69, 67, 67, 67, 67, 94, 94, 93, 93, 93, 89, 86, 83, 79, 80, 81, 81, 82,
- 82, 82, 82, 82, 81, 80, 79, 78, 77, 75, 74, 72, 70, 69, 67, 65, 65, 65,
- 65, 93, 93, 94, 94, 95, 91, 87, 84, 80, 80, 80, 80, 80, 80, 79, 79, 79,
- 78, 77, 76, 75, 74, 73, 71, 70, 68, 67, 65, 64, 64, 64, 64, 92, 93, 94,
- 96, 97, 93, 89, 85, 81, 80, 79, 78, 77, 77, 77, 76, 76, 75, 74, 73, 72,
- 71, 70, 69, 67, 66, 65, 63, 62, 62, 62, 62, 90, 93, 95, 97, 100, 95, 91,
- 86, 81, 80, 78, 77, 75, 74, 74, 73, 73, 72, 71, 70, 69, 68, 67, 66, 65,
- 64, 63, 61, 60, 60, 60, 60, 89, 92, 96, 99, 102, 97, 92, 87, 82, 80, 77,
- 75, 73, 72, 71, 70, 69, 69, 68, 67, 67, 66, 65, 64, 63, 62, 61, 60, 59,
- 59, 59, 59, 88, 91, 94, 98, 101, 97, 92, 87, 82, 80, 77, 74, 72, 71, 70,
- 69, 68, 67, 66, 65, 64, 64, 63, 62, 61, 60, 59, 58, 57, 57, 57, 57, 86,
- 90, 93, 97, 101, 96, 91, 87, 82, 79, 77, 74, 71, 70, 68, 67, 66, 65, 64,
- 63, 62, 62, 61, 60, 59, 58, 57, 56, 55, 55, 55, 55, 85, 89, 92, 96, 100,
- 95, 91, 87, 82, 79, 76, 73, 70, 69, 67, 66, 64, 63, 62, 61, 60, 60, 59,
- 58, 57, 56, 55, 55, 54, 54, 54, 54, 83, 87, 91, 95, 99, 95, 91, 87, 82,
- 79, 76, 73, 69, 68, 66, 64, 62, 61, 60, 59, 58, 58, 57, 56, 55, 54, 54,
- 53, 52, 52, 52, 52, 81, 85, 89, 93, 97, 93, 89, 85, 81, 78, 75, 72, 69,
- 67, 65, 63, 61, 60, 59, 58, 57, 56, 55, 55, 54, 53, 52, 52, 51, 51, 51,
- 51, 79, 83, 87, 91, 95, 91, 88, 84, 80, 77, 74, 71, 68, 66, 64, 62, 60,
- 59, 58, 57, 56, 55, 54, 53, 53, 52, 51, 50, 50, 50, 50, 50, 77, 81, 85,
- 89, 93, 89, 86, 83, 79, 76, 73, 70, 67, 65, 63, 61, 59, 58, 57, 56, 54,
- 54, 53, 52, 51, 50, 50, 49, 48, 48, 48, 48, 75, 79, 83, 86, 90, 87, 84,
- 81, 78, 75, 72, 69, 67, 64, 62, 60, 58, 57, 56, 54, 53, 52, 52, 51, 50,
- 49, 48, 48, 47, 47, 47, 47, 73, 76, 80, 84, 88, 85, 82, 80, 77, 74, 71,
- 68, 66, 64, 62, 60, 58, 56, 55, 54, 52, 52, 51, 50, 49, 48, 48, 47, 46,
- 46, 46, 46, 71, 74, 78, 82, 85, 83, 80, 78, 75, 73, 70, 67, 65, 63, 61,
- 59, 57, 55, 54, 53, 52, 51, 50, 49, 48, 47, 47, 46, 45, 45, 45, 45, 68,
- 72, 76, 79, 83, 81, 78, 76, 74, 71, 69, 66, 64, 62, 60, 58, 56, 55, 53,
- 52, 51, 50, 49, 48, 47, 46, 46, 45, 44, 44, 44, 44, 66, 70, 73, 77, 80,
- 78, 76, 74, 72, 70, 67, 65, 63, 61, 59, 57, 55, 54, 53, 51, 50, 49, 48,
- 47, 46, 45, 45, 44, 44, 44, 44, 44, 64, 68, 71, 75, 78, 76, 74, 72, 70,
- 68, 66, 64, 62, 60, 58, 56, 54, 53, 52, 50, 49, 48, 47, 46, 45, 45, 44,
- 44, 43, 43, 43, 43, 63, 66, 69, 72, 76, 74, 72, 70, 69, 67, 65, 63, 61,
- 59, 57, 55, 54, 52, 51, 50, 48, 48, 47, 46, 45, 44, 44, 43, 42, 42, 42,
- 42, 61, 64, 67, 70, 73, 72, 70, 69, 67, 65, 63, 61, 60, 58, 56, 55, 53,
- 52, 50, 49, 48, 47, 46, 45, 44, 44, 43, 42, 42, 42, 42, 42, 59, 62, 65,
- 68, 71, 70, 68, 67, 65, 64, 62, 60, 59, 57, 55, 54, 52, 51, 50, 48, 47,
- 46, 45, 44, 44, 43, 42, 42, 41, 41, 41, 41, 59, 62, 65, 68, 71, 70, 68,
- 67, 65, 64, 62, 60, 59, 57, 55, 54, 52, 51, 50, 48, 47, 46, 45, 44, 44,
- 43, 42, 42, 41, 41, 41, 41, 59, 62, 65, 68, 71, 70, 68, 67, 65, 64, 62,
- 60, 59, 57, 55, 54, 52, 51, 50, 48, 47, 46, 45, 44, 44, 43, 42, 42, 41,
- 41, 41, 41, 59, 62, 65, 68, 71, 70, 68, 67, 65, 64, 62, 60, 59, 57, 55,
- 54, 52, 51, 50, 48, 47, 46, 45, 44, 44, 43, 42, 42, 41, 41, 41,
- 41 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 59, 38, 26, 59, 41, 31, 25, 38, 31, 24, 21, 26, 25, 21, 19,
- /* Size 8 */
- 64, 83, 77, 60, 47, 37, 31, 28, 83, 73, 76, 66, 53, 43, 36, 31, 77, 76,
- 56, 49, 43, 37, 32, 29, 60, 66, 49, 40, 35, 32, 29, 27, 47, 53, 43, 35,
- 31, 28, 26, 25, 37, 43, 37, 32, 28, 26, 24, 23, 31, 36, 32, 29, 26, 24,
- 23, 22, 28, 31, 29, 27, 25, 23, 22, 21,
- /* Size 16 */
- 64, 73, 83, 80, 77, 69, 60, 53, 47, 42, 37, 34, 31, 30, 28, 28, 73, 76,
- 78, 77, 77, 70, 63, 56, 50, 45, 40, 37, 34, 31, 29, 29, 83, 78, 73, 75,
- 76, 71, 66, 59, 53, 48, 43, 39, 36, 33, 31, 31, 80, 77, 75, 70, 66, 62,
- 58, 53, 48, 44, 40, 37, 34, 32, 30, 30, 77, 77, 76, 66, 56, 53, 49, 46,
- 43, 40, 37, 35, 32, 31, 29, 29, 69, 70, 71, 62, 53, 49, 45, 42, 39, 37,
- 35, 33, 31, 29, 28, 28, 60, 63, 66, 58, 49, 45, 40, 38, 35, 34, 32, 31,
- 29, 28, 27, 27, 53, 56, 59, 53, 46, 42, 38, 35, 33, 32, 30, 29, 28, 27,
- 26, 26, 47, 50, 53, 48, 43, 39, 35, 33, 31, 30, 28, 27, 26, 26, 25, 25,
- 42, 45, 48, 44, 40, 37, 34, 32, 30, 28, 27, 26, 25, 25, 24, 24, 37, 40,
- 43, 40, 37, 35, 32, 30, 28, 27, 26, 25, 24, 24, 23, 23, 34, 37, 39, 37,
- 35, 33, 31, 29, 27, 26, 25, 24, 24, 23, 23, 23, 31, 34, 36, 34, 32, 31,
- 29, 28, 26, 25, 24, 24, 23, 23, 22, 22, 30, 31, 33, 32, 31, 29, 28, 27,
- 26, 25, 24, 23, 23, 22, 22, 22, 28, 29, 31, 30, 29, 28, 27, 26, 25, 24,
- 23, 23, 22, 22, 21, 21, 28, 29, 31, 30, 29, 28, 27, 26, 25, 24, 23, 23,
- 22, 22, 21, 21,
- /* Size 32 */
- 64, 69, 73, 78, 83, 81, 80, 79, 77, 73, 69, 64, 60, 57, 53, 50, 47, 44,
- 42, 40, 37, 36, 34, 33, 31, 30, 30, 29, 28, 28, 28, 28, 69, 72, 75, 78,
- 80, 80, 79, 78, 77, 73, 69, 65, 62, 58, 55, 52, 48, 46, 44, 41, 39, 37,
- 36, 34, 33, 31, 30, 29, 28, 28, 28, 28, 73, 75, 76, 77, 78, 78, 77, 77,
- 77, 73, 70, 66, 63, 60, 56, 53, 50, 47, 45, 43, 40, 38, 37, 35, 34, 32,
- 31, 30, 29, 29, 29, 29, 78, 78, 77, 76, 76, 76, 76, 76, 76, 73, 70, 67,
- 64, 61, 58, 55, 51, 49, 46, 44, 41, 40, 38, 36, 35, 33, 32, 31, 30, 30,
- 30, 30, 83, 80, 78, 76, 73, 74, 75, 75, 76, 74, 71, 68, 66, 63, 59, 56,
- 53, 50, 48, 45, 43, 41, 39, 37, 36, 34, 33, 32, 31, 31, 31, 31, 81, 80,
- 78, 76, 74, 73, 72, 72, 71, 69, 66, 64, 62, 59, 56, 53, 51, 48, 46, 44,
- 41, 40, 38, 36, 35, 34, 33, 31, 30, 30, 30, 30, 80, 79, 77, 76, 75, 72,
- 70, 68, 66, 64, 62, 60, 58, 55, 53, 50, 48, 46, 44, 42, 40, 39, 37, 36,
- 34, 33, 32, 31, 30, 30, 30, 30, 79, 78, 77, 76, 75, 72, 68, 65, 61, 59,
- 57, 55, 53, 51, 49, 47, 46, 44, 42, 40, 39, 37, 36, 35, 33, 32, 31, 30,
- 29, 29, 29, 29, 77, 77, 77, 76, 76, 71, 66, 61, 56, 54, 53, 51, 49, 48,
- 46, 45, 43, 42, 40, 39, 37, 36, 35, 34, 32, 32, 31, 30, 29, 29, 29, 29,
- 73, 73, 73, 73, 74, 69, 64, 59, 54, 53, 51, 49, 47, 45, 44, 43, 41, 40,
- 39, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 28, 28, 28, 69, 69, 70, 70,
- 71, 66, 62, 57, 53, 51, 49, 47, 45, 43, 42, 41, 39, 38, 37, 36, 35, 34,
- 33, 32, 31, 30, 29, 29, 28, 28, 28, 28, 64, 65, 66, 67, 68, 64, 60, 55,
- 51, 49, 47, 45, 42, 41, 40, 39, 37, 36, 35, 34, 33, 32, 32, 31, 30, 29,
- 29, 28, 27, 27, 27, 27, 60, 62, 63, 64, 66, 62, 58, 53, 49, 47, 45, 42,
- 40, 39, 38, 37, 35, 35, 34, 33, 32, 31, 31, 30, 29, 28, 28, 27, 27, 27,
- 27, 27, 57, 58, 60, 61, 63, 59, 55, 51, 48, 45, 43, 41, 39, 38, 37, 35,
- 34, 33, 33, 32, 31, 30, 30, 29, 28, 28, 27, 27, 26, 26, 26, 26, 53, 55,
- 56, 58, 59, 56, 53, 49, 46, 44, 42, 40, 38, 37, 35, 34, 33, 32, 32, 31,
- 30, 30, 29, 28, 28, 27, 27, 26, 26, 26, 26, 26, 50, 52, 53, 55, 56, 53,
- 50, 47, 45, 43, 41, 39, 37, 35, 34, 33, 32, 31, 31, 30, 29, 29, 28, 28,
- 27, 27, 26, 26, 25, 25, 25, 25, 47, 48, 50, 51, 53, 51, 48, 46, 43, 41,
- 39, 37, 35, 34, 33, 32, 31, 30, 30, 29, 28, 28, 27, 27, 26, 26, 26, 25,
- 25, 25, 25, 25, 44, 46, 47, 49, 50, 48, 46, 44, 42, 40, 38, 36, 35, 33,
- 32, 31, 30, 30, 29, 28, 28, 27, 27, 26, 26, 25, 25, 25, 24, 24, 24, 24,
- 42, 44, 45, 46, 48, 46, 44, 42, 40, 39, 37, 35, 34, 33, 32, 31, 30, 29,
- 28, 28, 27, 27, 26, 26, 25, 25, 25, 24, 24, 24, 24, 24, 40, 41, 43, 44,
- 45, 44, 42, 40, 39, 37, 36, 34, 33, 32, 31, 30, 29, 28, 28, 27, 27, 26,
- 26, 25, 25, 25, 24, 24, 24, 24, 24, 24, 37, 39, 40, 41, 43, 41, 40, 39,
- 37, 36, 35, 33, 32, 31, 30, 29, 28, 28, 27, 27, 26, 26, 25, 25, 24, 24,
- 24, 24, 23, 23, 23, 23, 36, 37, 38, 40, 41, 40, 39, 37, 36, 35, 34, 32,
- 31, 30, 30, 29, 28, 27, 27, 26, 26, 25, 25, 24, 24, 24, 24, 23, 23, 23,
- 23, 23, 34, 36, 37, 38, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28,
- 27, 27, 26, 26, 25, 25, 24, 24, 24, 23, 23, 23, 23, 23, 23, 23, 33, 34,
- 35, 36, 37, 36, 36, 35, 34, 33, 32, 31, 30, 29, 28, 28, 27, 26, 26, 25,
- 25, 24, 24, 24, 23, 23, 23, 23, 22, 22, 22, 22, 31, 33, 34, 35, 36, 35,
- 34, 33, 32, 32, 31, 30, 29, 28, 28, 27, 26, 26, 25, 25, 24, 24, 24, 23,
- 23, 23, 23, 22, 22, 22, 22, 22, 30, 31, 32, 33, 34, 34, 33, 32, 32, 31,
- 30, 29, 28, 28, 27, 27, 26, 25, 25, 25, 24, 24, 23, 23, 23, 23, 22, 22,
- 22, 22, 22, 22, 30, 30, 31, 32, 33, 33, 32, 31, 31, 30, 29, 29, 28, 27,
- 27, 26, 26, 25, 25, 24, 24, 24, 23, 23, 23, 22, 22, 22, 22, 22, 22, 22,
- 29, 29, 30, 31, 32, 31, 31, 30, 30, 29, 29, 28, 27, 27, 26, 26, 25, 25,
- 24, 24, 24, 23, 23, 23, 22, 22, 22, 22, 22, 22, 22, 22, 28, 28, 29, 30,
- 31, 30, 30, 29, 29, 28, 28, 27, 27, 26, 26, 25, 25, 24, 24, 24, 23, 23,
- 23, 22, 22, 22, 22, 22, 21, 21, 21, 21, 28, 28, 29, 30, 31, 30, 30, 29,
- 29, 28, 28, 27, 27, 26, 26, 25, 25, 24, 24, 24, 23, 23, 23, 22, 22, 22,
- 22, 22, 21, 21, 21, 21, 28, 28, 29, 30, 31, 30, 30, 29, 29, 28, 28, 27,
- 27, 26, 26, 25, 25, 24, 24, 24, 23, 23, 23, 22, 22, 22, 22, 22, 21, 21,
- 21, 21, 28, 28, 29, 30, 31, 30, 30, 29, 29, 28, 28, 27, 27, 26, 26, 25,
- 25, 24, 24, 24, 23, 23, 23, 22, 22, 22, 22, 22, 21, 21, 21, 21 },
- { /* Intra matrices */
- /* Size 4 */
- 155, 142, 90, 61, 142, 97, 72, 56, 90, 72, 54, 46, 61, 56, 46, 41,
- /* Size 8 */
- 131, 172, 159, 123, 94, 74, 62, 53, 172, 151, 157, 135, 108, 86, 70, 60,
- 159, 157, 115, 99, 86, 74, 64, 56, 123, 135, 99, 80, 70, 63, 56, 51, 94,
- 108, 86, 70, 61, 55, 50, 47, 74, 86, 74, 63, 55, 50, 46, 44, 62, 70, 64,
- 56, 50, 46, 44, 42, 53, 60, 56, 51, 47, 44, 42, 40,
- /* Size 16 */
- 136, 157, 177, 171, 165, 146, 127, 112, 97, 87, 77, 70, 64, 59, 55, 55,
- 157, 162, 167, 165, 163, 148, 133, 119, 104, 93, 83, 75, 68, 63, 58, 58,
- 177, 167, 156, 159, 162, 151, 140, 126, 111, 100, 89, 81, 73, 67, 62,
- 62, 171, 165, 159, 150, 140, 131, 121, 111, 100, 91, 83, 76, 69, 65, 60,
- 60, 165, 163, 162, 140, 118, 110, 103, 96, 89, 83, 76, 71, 66, 62, 58,
- 58, 146, 148, 151, 131, 110, 102, 93, 87, 81, 76, 71, 66, 62, 59, 55,
- 55, 127, 133, 140, 121, 103, 93, 83, 78, 72, 68, 65, 61, 58, 56, 53, 53,
- 112, 119, 126, 111, 96, 87, 78, 72, 67, 64, 61, 58, 55, 53, 51, 51, 97,
- 104, 111, 100, 89, 81, 72, 67, 63, 60, 57, 54, 52, 50, 49, 49, 87, 93,
- 100, 91, 83, 76, 68, 64, 60, 57, 54, 52, 50, 49, 47, 47, 77, 83, 89, 83,
- 76, 71, 65, 61, 57, 54, 51, 50, 48, 47, 45, 45, 70, 75, 81, 76, 71, 66,
- 61, 58, 54, 52, 50, 48, 46, 45, 44, 44, 64, 68, 73, 69, 66, 62, 58, 55,
- 52, 50, 48, 46, 45, 44, 43, 43, 59, 63, 67, 65, 62, 59, 56, 53, 50, 49,
- 47, 45, 44, 43, 42, 42, 55, 58, 62, 60, 58, 55, 53, 51, 49, 47, 45, 44,
- 43, 42, 41, 41, 55, 58, 62, 60, 58, 55, 53, 51, 49, 47, 45, 44, 43, 42,
- 41, 41,
- /* Size 32 */
- 138, 148, 159, 170, 180, 177, 174, 171, 167, 158, 148, 139, 129, 122,
- 114, 106, 99, 94, 88, 83, 78, 75, 71, 68, 65, 62, 60, 58, 56, 56, 56,
- 56, 148, 155, 162, 168, 175, 173, 171, 169, 167, 158, 150, 141, 132,
- 125, 117, 110, 102, 97, 92, 86, 81, 78, 74, 71, 67, 65, 62, 60, 58, 58,
- 58, 58, 159, 162, 164, 167, 169, 169, 168, 167, 166, 159, 151, 143, 136,
- 128, 121, 113, 106, 100, 95, 90, 84, 80, 77, 73, 69, 67, 64, 62, 59, 59,
- 59, 59, 170, 168, 167, 165, 164, 164, 165, 165, 166, 159, 152, 146, 139,
- 132, 124, 117, 110, 104, 98, 93, 87, 83, 79, 76, 72, 69, 66, 64, 61, 61,
- 61, 61, 180, 175, 169, 164, 158, 160, 162, 163, 165, 159, 154, 148, 142,
- 135, 128, 120, 113, 107, 102, 96, 90, 86, 82, 78, 74, 71, 68, 66, 63,
- 63, 63, 63, 177, 173, 169, 164, 160, 159, 157, 155, 154, 149, 143, 138,
- 133, 126, 120, 114, 108, 102, 97, 92, 87, 83, 80, 76, 72, 70, 67, 64,
- 62, 62, 62, 62, 174, 171, 168, 165, 162, 157, 152, 147, 143, 138, 133,
- 128, 123, 118, 113, 107, 102, 97, 93, 88, 84, 81, 77, 74, 70, 68, 66,
- 63, 61, 61, 61, 61, 171, 169, 167, 165, 163, 155, 147, 139, 132, 127,
- 123, 118, 114, 109, 105, 101, 96, 92, 89, 85, 81, 78, 75, 72, 69, 66,
- 64, 62, 60, 60, 60, 60, 167, 167, 166, 166, 165, 154, 143, 132, 120,
- 116, 112, 108, 104, 101, 98, 94, 91, 87, 84, 81, 78, 75, 72, 70, 67, 65,
- 63, 61, 59, 59, 59, 59, 158, 158, 159, 159, 159, 149, 138, 127, 116,
- 112, 108, 104, 99, 96, 93, 90, 86, 83, 81, 78, 75, 72, 70, 67, 65, 63,
- 61, 59, 57, 57, 57, 57, 148, 150, 151, 152, 154, 143, 133, 123, 112,
- 108, 103, 99, 94, 91, 88, 85, 82, 79, 77, 74, 72, 70, 67, 65, 63, 61,
- 60, 58, 56, 56, 56, 56, 139, 141, 143, 146, 148, 138, 128, 118, 108,
- 104, 99, 94, 89, 86, 83, 81, 78, 76, 73, 71, 69, 67, 65, 63, 61, 60, 58,
- 57, 55, 55, 55, 55, 129, 132, 136, 139, 142, 133, 123, 114, 104, 99, 94,
- 89, 84, 81, 79, 76, 74, 72, 70, 68, 66, 64, 62, 61, 59, 58, 57, 55, 54,
- 54, 54, 54, 122, 125, 128, 132, 135, 126, 118, 109, 101, 96, 91, 86, 81,
- 79, 76, 74, 71, 69, 67, 66, 64, 62, 61, 59, 58, 56, 55, 54, 53, 53, 53,
- 53, 114, 117, 121, 124, 128, 120, 113, 105, 98, 93, 88, 83, 79, 76, 74,
- 71, 69, 67, 65, 63, 62, 60, 59, 57, 56, 55, 54, 53, 52, 52, 52, 52, 106,
- 110, 113, 117, 120, 114, 107, 101, 94, 90, 85, 81, 76, 74, 71, 69, 66,
- 64, 63, 61, 60, 58, 57, 56, 55, 54, 53, 52, 51, 51, 51, 51, 99, 102,
- 106, 110, 113, 108, 102, 96, 91, 86, 82, 78, 74, 71, 69, 66, 64, 62, 61,
- 59, 57, 56, 55, 54, 53, 52, 51, 50, 49, 49, 49, 49, 94, 97, 100, 104,
- 107, 102, 97, 92, 87, 83, 79, 76, 72, 69, 67, 64, 62, 61, 59, 58, 56,
- 55, 54, 53, 52, 51, 50, 49, 49, 49, 49, 49, 88, 92, 95, 98, 102, 97, 93,
- 89, 84, 81, 77, 73, 70, 67, 65, 63, 61, 59, 58, 56, 55, 54, 53, 52, 51,
- 50, 49, 49, 48, 48, 48, 48, 83, 86, 90, 93, 96, 92, 88, 85, 81, 78, 74,
- 71, 68, 66, 63, 61, 59, 58, 56, 55, 54, 53, 52, 51, 50, 49, 48, 48, 47,
- 47, 47, 47, 78, 81, 84, 87, 90, 87, 84, 81, 78, 75, 72, 69, 66, 64, 62,
- 60, 57, 56, 55, 54, 52, 51, 50, 50, 49, 48, 47, 47, 46, 46, 46, 46, 75,
- 78, 80, 83, 86, 83, 81, 78, 75, 72, 70, 67, 64, 62, 60, 58, 56, 55, 54,
- 53, 51, 51, 50, 49, 48, 47, 47, 46, 46, 46, 46, 46, 71, 74, 77, 79, 82,
- 80, 77, 75, 72, 70, 67, 65, 62, 61, 59, 57, 55, 54, 53, 52, 50, 50, 49,
- 48, 47, 47, 46, 45, 45, 45, 45, 45, 68, 71, 73, 76, 78, 76, 74, 72, 70,
- 67, 65, 63, 61, 59, 57, 56, 54, 53, 52, 51, 50, 49, 48, 47, 47, 46, 45,
- 45, 44, 44, 44, 44, 65, 67, 69, 72, 74, 72, 70, 69, 67, 65, 63, 61, 59,
- 58, 56, 55, 53, 52, 51, 50, 49, 48, 47, 47, 46, 45, 45, 44, 44, 44, 44,
- 44, 62, 65, 67, 69, 71, 70, 68, 66, 65, 63, 61, 60, 58, 56, 55, 54, 52,
- 51, 50, 49, 48, 47, 47, 46, 45, 45, 44, 44, 43, 43, 43, 43, 60, 62, 64,
- 66, 68, 67, 66, 64, 63, 61, 60, 58, 57, 55, 54, 53, 51, 50, 49, 48, 47,
- 47, 46, 45, 45, 44, 44, 43, 43, 43, 43, 43, 58, 60, 62, 64, 66, 64, 63,
- 62, 61, 59, 58, 57, 55, 54, 53, 52, 50, 49, 49, 48, 47, 46, 45, 45, 44,
- 44, 43, 43, 42, 42, 42, 42, 56, 58, 59, 61, 63, 62, 61, 60, 59, 57, 56,
- 55, 54, 53, 52, 51, 49, 49, 48, 47, 46, 46, 45, 44, 44, 43, 43, 42, 42,
- 42, 42, 42, 56, 58, 59, 61, 63, 62, 61, 60, 59, 57, 56, 55, 54, 53, 52,
- 51, 49, 49, 48, 47, 46, 46, 45, 44, 44, 43, 43, 42, 42, 42, 42, 42, 56,
- 58, 59, 61, 63, 62, 61, 60, 59, 57, 56, 55, 54, 53, 52, 51, 49, 49, 48,
- 47, 46, 46, 45, 44, 44, 43, 43, 42, 42, 42, 42, 42, 56, 58, 59, 61, 63,
- 62, 61, 60, 59, 57, 56, 55, 54, 53, 52, 51, 49, 49, 48, 47, 46, 46, 45,
- 44, 44, 43, 43, 42, 42, 42, 42, 42 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 42, 40, 32, 42, 36, 34, 31, 40, 34, 28, 25, 32, 31, 25, 22,
- /* Size 8 */
- 64, 78, 46, 43, 41, 37, 34, 31, 78, 56, 45, 49, 48, 44, 40, 36, 46, 45,
- 39, 40, 41, 39, 36, 33, 43, 49, 40, 36, 35, 34, 32, 30, 41, 48, 41, 35,
- 32, 30, 29, 28, 37, 44, 39, 34, 30, 28, 27, 26, 34, 40, 36, 32, 29, 27,
- 25, 24, 31, 36, 33, 30, 28, 26, 24, 23,
- /* Size 16 */
- 64, 71, 78, 62, 46, 45, 43, 42, 41, 39, 37, 36, 34, 32, 31, 31, 71, 69,
- 67, 56, 45, 46, 46, 45, 44, 43, 41, 39, 37, 35, 33, 33, 78, 67, 56, 50,
- 45, 47, 49, 48, 48, 46, 44, 42, 40, 38, 36, 36, 62, 56, 50, 46, 42, 43,
- 45, 44, 44, 43, 41, 40, 38, 36, 35, 35, 46, 45, 45, 42, 39, 40, 40, 40,
- 41, 40, 39, 38, 36, 35, 33, 33, 45, 46, 47, 43, 40, 39, 38, 38, 38, 37,
- 36, 35, 34, 33, 32, 32, 43, 46, 49, 45, 40, 38, 36, 36, 35, 34, 34, 33,
- 32, 31, 30, 30, 42, 45, 48, 44, 40, 38, 36, 35, 34, 33, 32, 31, 31, 30,
- 29, 29, 41, 44, 48, 44, 41, 38, 35, 34, 32, 31, 30, 30, 29, 28, 28, 28,
- 39, 43, 46, 43, 40, 37, 34, 33, 31, 30, 29, 29, 28, 27, 27, 27, 37, 41,
- 44, 41, 39, 36, 34, 32, 30, 29, 28, 27, 27, 26, 26, 26, 36, 39, 42, 40,
- 38, 35, 33, 31, 30, 29, 27, 27, 26, 25, 25, 25, 34, 37, 40, 38, 36, 34,
- 32, 31, 29, 28, 27, 26, 25, 25, 24, 24, 32, 35, 38, 36, 35, 33, 31, 30,
- 28, 27, 26, 25, 25, 24, 23, 23, 31, 33, 36, 35, 33, 32, 30, 29, 28, 27,
- 26, 25, 24, 23, 23, 23, 31, 33, 36, 35, 33, 32, 30, 29, 28, 27, 26, 25,
- 24, 23, 23, 23,
- /* Size 32 */
- 64, 67, 71, 74, 78, 70, 62, 54, 46, 45, 45, 44, 43, 43, 42, 42, 41, 40,
- 39, 38, 37, 36, 36, 35, 34, 33, 32, 31, 31, 31, 31, 31, 67, 69, 70, 71,
- 72, 66, 59, 52, 45, 45, 45, 45, 45, 44, 44, 43, 43, 42, 41, 40, 39, 38,
- 37, 36, 35, 34, 34, 33, 32, 32, 32, 32, 71, 70, 69, 68, 67, 61, 56, 51,
- 45, 46, 46, 46, 46, 46, 45, 45, 44, 43, 43, 42, 41, 40, 39, 38, 37, 36,
- 35, 34, 33, 33, 33, 33, 74, 71, 68, 65, 61, 57, 53, 49, 45, 46, 46, 47,
- 48, 47, 47, 46, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 34,
- 34, 34, 78, 72, 67, 61, 56, 53, 50, 48, 45, 46, 47, 48, 49, 49, 48, 48,
- 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 36, 36, 36, 70, 66,
- 61, 57, 53, 51, 48, 46, 44, 44, 45, 46, 47, 47, 46, 46, 46, 45, 44, 44,
- 43, 42, 41, 40, 39, 38, 37, 36, 35, 35, 35, 35, 62, 59, 56, 53, 50, 48,
- 46, 44, 42, 43, 43, 44, 45, 45, 44, 44, 44, 43, 43, 42, 41, 41, 40, 39,
- 38, 37, 36, 35, 35, 35, 35, 35, 54, 52, 51, 49, 48, 46, 44, 42, 41, 41,
- 42, 42, 43, 43, 42, 42, 42, 42, 41, 41, 40, 39, 39, 38, 37, 36, 36, 35,
- 34, 34, 34, 34, 46, 45, 45, 45, 45, 44, 42, 41, 39, 40, 40, 40, 40, 40,
- 40, 41, 41, 40, 40, 39, 39, 38, 38, 37, 36, 35, 35, 34, 33, 33, 33, 33,
- 45, 45, 46, 46, 46, 44, 43, 41, 40, 40, 40, 39, 39, 39, 39, 39, 39, 39,
- 38, 38, 38, 37, 36, 36, 35, 35, 34, 33, 33, 33, 33, 33, 45, 45, 46, 46,
- 47, 45, 43, 42, 40, 40, 39, 39, 38, 38, 38, 38, 38, 37, 37, 37, 36, 36,
- 35, 35, 34, 34, 33, 32, 32, 32, 32, 32, 44, 45, 46, 47, 48, 46, 44, 42,
- 40, 39, 39, 38, 37, 37, 37, 37, 36, 36, 36, 35, 35, 35, 34, 34, 33, 33,
- 32, 32, 31, 31, 31, 31, 43, 45, 46, 48, 49, 47, 45, 43, 40, 39, 38, 37,
- 36, 36, 36, 35, 35, 35, 34, 34, 34, 33, 33, 33, 32, 32, 31, 31, 30, 30,
- 30, 30, 43, 44, 46, 47, 49, 47, 45, 43, 40, 39, 38, 37, 36, 36, 35, 35,
- 34, 34, 34, 33, 33, 33, 32, 32, 31, 31, 31, 30, 30, 30, 30, 30, 42, 44,
- 45, 47, 48, 46, 44, 42, 40, 39, 38, 37, 36, 35, 35, 34, 34, 33, 33, 32,
- 32, 32, 31, 31, 31, 30, 30, 29, 29, 29, 29, 29, 42, 43, 45, 46, 48, 46,
- 44, 42, 41, 39, 38, 37, 35, 35, 34, 33, 33, 32, 32, 32, 31, 31, 31, 30,
- 30, 29, 29, 29, 28, 28, 28, 28, 41, 43, 44, 46, 48, 46, 44, 42, 41, 39,
- 38, 36, 35, 34, 34, 33, 32, 32, 31, 31, 30, 30, 30, 29, 29, 29, 28, 28,
- 28, 28, 28, 28, 40, 42, 43, 45, 47, 45, 43, 42, 40, 39, 37, 36, 35, 34,
- 33, 32, 32, 31, 31, 30, 30, 29, 29, 29, 28, 28, 28, 28, 27, 27, 27, 27,
- 39, 41, 43, 44, 46, 44, 43, 41, 40, 38, 37, 36, 34, 34, 33, 32, 31, 31,
- 30, 30, 29, 29, 29, 28, 28, 28, 27, 27, 27, 27, 27, 27, 38, 40, 42, 43,
- 45, 44, 42, 41, 39, 38, 37, 35, 34, 33, 32, 32, 31, 30, 30, 29, 29, 28,
- 28, 28, 27, 27, 27, 26, 26, 26, 26, 26, 37, 39, 41, 42, 44, 43, 41, 40,
- 39, 38, 36, 35, 34, 33, 32, 31, 30, 30, 29, 29, 28, 28, 27, 27, 27, 26,
- 26, 26, 26, 26, 26, 26, 36, 38, 40, 41, 43, 42, 41, 39, 38, 37, 36, 35,
- 33, 33, 32, 31, 30, 29, 29, 28, 28, 27, 27, 27, 26, 26, 26, 25, 25, 25,
- 25, 25, 36, 37, 39, 40, 42, 41, 40, 39, 38, 36, 35, 34, 33, 32, 31, 31,
- 30, 29, 29, 28, 27, 27, 27, 26, 26, 26, 25, 25, 25, 25, 25, 25, 35, 36,
- 38, 39, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 29, 28, 28,
- 27, 27, 26, 26, 26, 25, 25, 25, 24, 24, 24, 24, 34, 35, 37, 38, 40, 39,
- 38, 37, 36, 35, 34, 33, 32, 31, 31, 30, 29, 28, 28, 27, 27, 26, 26, 26,
- 25, 25, 25, 24, 24, 24, 24, 24, 33, 34, 36, 37, 39, 38, 37, 36, 35, 35,
- 34, 33, 32, 31, 30, 29, 29, 28, 28, 27, 26, 26, 26, 25, 25, 25, 24, 24,
- 24, 24, 24, 24, 32, 34, 35, 36, 38, 37, 36, 36, 35, 34, 33, 32, 31, 31,
- 30, 29, 28, 28, 27, 27, 26, 26, 25, 25, 25, 24, 24, 24, 23, 23, 23, 23,
- 31, 33, 34, 35, 37, 36, 35, 35, 34, 33, 32, 32, 31, 30, 29, 29, 28, 28,
- 27, 26, 26, 25, 25, 25, 24, 24, 24, 23, 23, 23, 23, 23, 31, 32, 33, 34,
- 36, 35, 35, 34, 33, 33, 32, 31, 30, 30, 29, 28, 28, 27, 27, 26, 26, 25,
- 25, 24, 24, 24, 23, 23, 23, 23, 23, 23, 31, 32, 33, 34, 36, 35, 35, 34,
- 33, 33, 32, 31, 30, 30, 29, 28, 28, 27, 27, 26, 26, 25, 25, 24, 24, 24,
- 23, 23, 23, 23, 23, 23, 31, 32, 33, 34, 36, 35, 35, 34, 33, 33, 32, 31,
- 30, 30, 29, 28, 28, 27, 27, 26, 26, 25, 25, 24, 24, 24, 23, 23, 23, 23,
- 23, 23, 31, 32, 33, 34, 36, 35, 35, 34, 33, 33, 32, 31, 30, 30, 29, 28,
- 28, 27, 27, 26, 26, 25, 25, 24, 24, 24, 23, 23, 23, 23, 23, 23 },
- { /* Intra matrices */
- /* Size 4 */
- 133, 87, 80, 65, 87, 73, 69, 61, 80, 69, 56, 50, 65, 61, 50, 43,
- /* Size 8 */
- 124, 152, 87, 83, 78, 70, 63, 57, 152, 107, 86, 94, 91, 84, 75, 67, 87,
- 86, 74, 77, 77, 73, 68, 62, 83, 94, 77, 69, 66, 63, 60, 56, 78, 91, 77,
- 66, 60, 56, 54, 51, 70, 84, 73, 63, 56, 52, 49, 47, 63, 75, 68, 60, 54,
- 49, 46, 44, 57, 67, 62, 56, 51, 47, 44, 41,
- /* Size 16 */
- 127, 141, 155, 122, 89, 87, 84, 82, 80, 76, 72, 68, 65, 61, 58, 58, 141,
- 137, 133, 111, 88, 89, 90, 88, 87, 83, 79, 75, 71, 67, 63, 63, 155, 133,
- 110, 99, 88, 92, 96, 95, 93, 90, 86, 81, 77, 73, 69, 69, 122, 111, 99,
- 90, 82, 85, 87, 87, 86, 83, 80, 77, 73, 70, 66, 66, 89, 88, 88, 82, 76,
- 77, 78, 79, 79, 77, 75, 72, 70, 67, 64, 64, 87, 89, 92, 85, 77, 76, 74,
- 74, 73, 71, 70, 68, 66, 63, 61, 61, 84, 90, 96, 87, 78, 74, 70, 69, 67,
- 66, 65, 63, 62, 60, 58, 58, 82, 88, 95, 87, 79, 74, 69, 67, 64, 63, 61,
- 60, 58, 57, 55, 55, 80, 87, 93, 86, 79, 73, 67, 64, 61, 59, 58, 56, 55,
- 54, 52, 52, 76, 83, 90, 83, 77, 71, 66, 63, 59, 57, 55, 54, 53, 51, 50,
- 50, 72, 79, 86, 80, 75, 70, 65, 61, 58, 55, 53, 52, 50, 49, 48, 48, 68,
- 75, 81, 77, 72, 68, 63, 60, 56, 54, 52, 50, 49, 47, 46, 46, 65, 71, 77,
- 73, 70, 66, 62, 58, 55, 53, 50, 49, 47, 46, 45, 45, 61, 67, 73, 70, 67,
- 63, 60, 57, 54, 51, 49, 47, 46, 45, 43, 43, 58, 63, 69, 66, 64, 61, 58,
- 55, 52, 50, 48, 46, 45, 43, 42, 42, 58, 63, 69, 66, 64, 61, 58, 55, 52,
- 50, 48, 46, 45, 43, 42, 42,
- /* Size 32 */
- 129, 136, 143, 150, 157, 141, 124, 107, 90, 89, 88, 87, 86, 84, 83, 82,
- 81, 79, 77, 75, 73, 71, 69, 67, 65, 64, 62, 60, 59, 59, 59, 59, 136,
- 138, 141, 143, 146, 132, 118, 104, 90, 90, 89, 89, 88, 87, 86, 85, 84,
- 82, 80, 78, 76, 74, 72, 71, 69, 67, 65, 63, 62, 62, 62, 62, 143, 141,
- 139, 137, 134, 123, 112, 101, 89, 90, 90, 91, 91, 90, 89, 89, 88, 86,
- 84, 82, 80, 78, 76, 74, 72, 70, 68, 66, 64, 64, 64, 64, 150, 143, 137,
- 130, 123, 114, 106, 98, 89, 90, 92, 93, 94, 93, 93, 92, 91, 89, 87, 85,
- 83, 81, 79, 77, 75, 73, 71, 69, 67, 67, 67, 67, 157, 146, 134, 123, 111,
- 106, 100, 94, 89, 91, 93, 95, 97, 97, 96, 95, 95, 93, 91, 89, 87, 85,
- 82, 80, 78, 76, 74, 72, 70, 70, 70, 70, 141, 132, 123, 114, 106, 101,
- 96, 91, 86, 88, 89, 91, 93, 92, 92, 91, 91, 89, 87, 86, 84, 82, 80, 78,
- 76, 74, 72, 70, 68, 68, 68, 68, 124, 118, 112, 106, 100, 96, 91, 87, 83,
- 84, 86, 87, 88, 88, 88, 87, 87, 86, 84, 83, 81, 80, 78, 76, 74, 72, 71,
- 69, 67, 67, 67, 67, 107, 104, 101, 98, 94, 91, 87, 84, 80, 81, 82, 83,
- 84, 84, 84, 83, 83, 82, 81, 80, 79, 77, 76, 74, 72, 71, 69, 68, 66, 66,
- 66, 66, 90, 90, 89, 89, 89, 86, 83, 80, 77, 78, 78, 79, 79, 79, 80, 80,
- 80, 79, 78, 77, 76, 75, 73, 72, 71, 69, 68, 66, 65, 65, 65, 65, 89, 90,
- 90, 90, 91, 88, 84, 81, 78, 78, 77, 77, 77, 77, 77, 77, 77, 76, 75, 74,
- 73, 72, 71, 70, 69, 67, 66, 64, 63, 63, 63, 63, 88, 89, 90, 92, 93, 89,
- 86, 82, 78, 77, 77, 76, 75, 75, 75, 74, 74, 73, 72, 72, 71, 70, 69, 68,
- 66, 65, 64, 63, 62, 62, 62, 62, 87, 89, 91, 93, 95, 91, 87, 83, 79, 77,
- 76, 75, 73, 73, 72, 72, 71, 70, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61,
- 60, 60, 60, 60, 86, 88, 91, 94, 97, 93, 88, 84, 79, 77, 75, 73, 71, 70,
- 70, 69, 68, 68, 67, 66, 66, 65, 64, 63, 62, 61, 60, 59, 59, 59, 59, 59,
- 84, 87, 90, 93, 97, 92, 88, 84, 79, 77, 75, 73, 70, 69, 68, 68, 67, 66,
- 65, 65, 64, 63, 62, 61, 61, 60, 59, 58, 57, 57, 57, 57, 83, 86, 89, 93,
- 96, 92, 88, 84, 80, 77, 75, 72, 70, 68, 67, 66, 65, 64, 64, 63, 62, 61,
- 60, 60, 59, 58, 57, 57, 56, 56, 56, 56, 82, 85, 89, 92, 95, 91, 87, 83,
- 80, 77, 74, 72, 69, 68, 66, 65, 63, 63, 62, 61, 60, 59, 59, 58, 57, 57,
- 56, 55, 54, 54, 54, 54, 81, 84, 88, 91, 95, 91, 87, 83, 80, 77, 74, 71,
- 68, 67, 65, 63, 62, 61, 60, 59, 58, 58, 57, 56, 56, 55, 54, 54, 53, 53,
- 53, 53, 79, 82, 86, 89, 93, 89, 86, 82, 79, 76, 73, 70, 68, 66, 64, 63,
- 61, 60, 59, 58, 57, 57, 56, 55, 54, 54, 53, 52, 52, 52, 52, 52, 77, 80,
- 84, 87, 91, 87, 84, 81, 78, 75, 72, 70, 67, 65, 64, 62, 60, 59, 58, 57,
- 56, 55, 55, 54, 53, 53, 52, 51, 51, 51, 51, 51, 75, 78, 82, 85, 89, 86,
- 83, 80, 77, 74, 72, 69, 66, 65, 63, 61, 59, 58, 57, 56, 55, 54, 53, 53,
- 52, 51, 51, 50, 50, 50, 50, 50, 73, 76, 80, 83, 87, 84, 81, 79, 76, 73,
- 71, 68, 66, 64, 62, 60, 58, 57, 56, 55, 54, 53, 52, 52, 51, 50, 50, 49,
- 48, 48, 48, 48, 71, 74, 78, 81, 85, 82, 80, 77, 75, 72, 70, 67, 65, 63,
- 61, 59, 58, 57, 55, 54, 53, 52, 52, 51, 50, 49, 49, 48, 48, 48, 48, 48,
- 69, 72, 76, 79, 82, 80, 78, 76, 73, 71, 69, 66, 64, 62, 60, 59, 57, 56,
- 55, 53, 52, 52, 51, 50, 49, 49, 48, 47, 47, 47, 47, 47, 67, 71, 74, 77,
- 80, 78, 76, 74, 72, 70, 68, 65, 63, 61, 60, 58, 56, 55, 54, 53, 52, 51,
- 50, 49, 48, 48, 47, 47, 46, 46, 46, 46, 65, 69, 72, 75, 78, 76, 74, 72,
- 71, 69, 66, 64, 62, 61, 59, 57, 56, 54, 53, 52, 51, 50, 49, 48, 48, 47,
- 46, 46, 45, 45, 45, 45, 64, 67, 70, 73, 76, 74, 72, 71, 69, 67, 65, 63,
- 61, 60, 58, 57, 55, 54, 53, 51, 50, 49, 49, 48, 47, 46, 46, 45, 45, 45,
- 45, 45, 62, 65, 68, 71, 74, 72, 71, 69, 68, 66, 64, 62, 60, 59, 57, 56,
- 54, 53, 52, 51, 50, 49, 48, 47, 46, 46, 45, 45, 44, 44, 44, 44, 60, 63,
- 66, 69, 72, 70, 69, 68, 66, 64, 63, 61, 59, 58, 57, 55, 54, 52, 51, 50,
- 49, 48, 47, 47, 46, 45, 45, 44, 43, 43, 43, 43, 59, 62, 64, 67, 70, 68,
- 67, 66, 65, 63, 62, 60, 59, 57, 56, 54, 53, 52, 51, 50, 48, 48, 47, 46,
- 45, 45, 44, 43, 43, 43, 43, 43, 59, 62, 64, 67, 70, 68, 67, 66, 65, 63,
- 62, 60, 59, 57, 56, 54, 53, 52, 51, 50, 48, 48, 47, 46, 45, 45, 44, 43,
- 43, 43, 43, 43, 59, 62, 64, 67, 70, 68, 67, 66, 65, 63, 62, 60, 59, 57,
- 56, 54, 53, 52, 51, 50, 48, 48, 47, 46, 45, 45, 44, 43, 43, 43, 43, 43,
- 59, 62, 64, 67, 70, 68, 67, 66, 65, 63, 62, 60, 59, 57, 56, 54, 53, 52,
- 51, 50, 48, 48, 47, 46, 45, 45, 44, 43, 43, 43, 43, 43 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 59, 40, 29, 59, 42, 33, 27, 40, 33, 26, 23, 29, 27, 23, 21,
- /* Size 8 */
- 64, 82, 76, 60, 48, 39, 34, 30, 82, 73, 75, 66, 54, 44, 38, 33, 76, 75,
- 57, 50, 44, 39, 35, 31, 60, 66, 50, 42, 37, 34, 31, 29, 48, 54, 44, 37,
- 33, 31, 29, 27, 39, 44, 39, 34, 31, 29, 27, 26, 34, 38, 35, 31, 29, 27,
- 26, 25, 30, 33, 31, 29, 27, 26, 25, 24,
- /* Size 16 */
- 64, 73, 82, 79, 76, 68, 60, 54, 48, 44, 39, 36, 34, 32, 30, 30, 73, 75,
- 77, 76, 76, 69, 63, 57, 51, 46, 42, 39, 36, 34, 31, 31, 82, 77, 73, 74,
- 75, 71, 66, 60, 54, 49, 44, 41, 38, 35, 33, 33, 79, 76, 74, 70, 66, 62,
- 58, 54, 49, 45, 42, 39, 36, 34, 32, 32, 76, 76, 75, 66, 57, 53, 50, 47,
- 44, 42, 39, 37, 35, 33, 31, 31, 68, 69, 71, 62, 53, 50, 46, 43, 41, 39,
- 37, 35, 33, 32, 30, 30, 60, 63, 66, 58, 50, 46, 42, 40, 37, 36, 34, 33,
- 31, 30, 29, 29, 54, 57, 60, 54, 47, 43, 40, 37, 35, 34, 32, 31, 30, 29,
- 28, 28, 48, 51, 54, 49, 44, 41, 37, 35, 33, 32, 31, 30, 29, 28, 27, 27,
- 44, 46, 49, 45, 42, 39, 36, 34, 32, 31, 30, 29, 28, 27, 27, 27, 39, 42,
- 44, 42, 39, 37, 34, 32, 31, 30, 29, 28, 27, 27, 26, 26, 36, 39, 41, 39,
- 37, 35, 33, 31, 30, 29, 28, 27, 26, 26, 25, 25, 34, 36, 38, 36, 35, 33,
- 31, 30, 29, 28, 27, 26, 26, 25, 25, 25, 32, 34, 35, 34, 33, 32, 30, 29,
- 28, 27, 27, 26, 25, 25, 25, 25, 30, 31, 33, 32, 31, 30, 29, 28, 27, 27,
- 26, 25, 25, 25, 24, 24, 30, 31, 33, 32, 31, 30, 29, 28, 27, 27, 26, 25,
- 25, 25, 24, 24,
- /* Size 32 */
- 64, 68, 73, 77, 82, 80, 79, 78, 76, 72, 68, 64, 60, 57, 54, 51, 48, 46,
- 44, 41, 39, 38, 36, 35, 34, 33, 32, 31, 30, 30, 30, 30, 68, 71, 74, 77,
- 79, 79, 78, 77, 76, 72, 69, 65, 62, 59, 56, 52, 49, 47, 45, 43, 41, 39,
- 38, 36, 35, 34, 33, 32, 31, 31, 31, 31, 73, 74, 75, 76, 77, 77, 76, 76,
- 76, 73, 69, 66, 63, 60, 57, 54, 51, 49, 46, 44, 42, 40, 39, 37, 36, 35,
- 34, 32, 31, 31, 31, 31, 77, 77, 76, 75, 75, 75, 75, 75, 76, 73, 70, 67,
- 64, 61, 58, 55, 52, 50, 48, 45, 43, 41, 40, 38, 37, 35, 34, 33, 32, 32,
- 32, 32, 82, 79, 77, 75, 73, 73, 74, 75, 75, 73, 71, 68, 66, 63, 60, 57,
- 54, 51, 49, 47, 44, 43, 41, 39, 38, 36, 35, 34, 33, 33, 33, 33, 80, 79,
- 77, 75, 73, 73, 72, 71, 71, 68, 66, 64, 62, 59, 57, 54, 51, 49, 47, 45,
- 43, 41, 40, 38, 37, 36, 35, 34, 32, 32, 32, 32, 79, 78, 76, 75, 74, 72,
- 70, 68, 66, 64, 62, 60, 58, 56, 54, 51, 49, 47, 45, 44, 42, 40, 39, 37,
- 36, 35, 34, 33, 32, 32, 32, 32, 78, 77, 76, 75, 75, 71, 68, 65, 61, 60,
- 58, 56, 54, 52, 50, 49, 47, 45, 44, 42, 40, 39, 38, 37, 35, 34, 33, 33,
- 32, 32, 32, 32, 76, 76, 76, 76, 75, 71, 66, 61, 57, 55, 53, 52, 50, 49,
- 47, 46, 44, 43, 42, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 31, 31, 31,
- 72, 72, 73, 73, 73, 68, 64, 60, 55, 53, 52, 50, 48, 47, 45, 44, 43, 41,
- 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 31, 31, 31, 31, 68, 69, 69, 70,
- 71, 66, 62, 58, 53, 52, 50, 48, 46, 45, 43, 42, 41, 40, 39, 38, 37, 36,
- 35, 34, 33, 32, 32, 31, 30, 30, 30, 30, 64, 65, 66, 67, 68, 64, 60, 56,
- 52, 50, 48, 46, 44, 43, 41, 40, 39, 38, 37, 36, 35, 35, 34, 33, 32, 32,
- 31, 30, 30, 30, 30, 30, 60, 62, 63, 64, 66, 62, 58, 54, 50, 48, 46, 44,
- 42, 41, 40, 38, 37, 37, 36, 35, 34, 33, 33, 32, 31, 31, 30, 30, 29, 29,
- 29, 29, 57, 59, 60, 61, 63, 59, 56, 52, 49, 47, 45, 43, 41, 40, 38, 37,
- 36, 36, 35, 34, 33, 33, 32, 31, 31, 30, 30, 29, 29, 29, 29, 29, 54, 56,
- 57, 58, 60, 57, 54, 50, 47, 45, 43, 41, 40, 38, 37, 36, 35, 35, 34, 33,
- 32, 32, 31, 31, 30, 30, 29, 29, 28, 28, 28, 28, 51, 52, 54, 55, 57, 54,
- 51, 49, 46, 44, 42, 40, 38, 37, 36, 35, 34, 34, 33, 32, 32, 31, 31, 30,
- 30, 29, 29, 28, 28, 28, 28, 28, 48, 49, 51, 52, 54, 51, 49, 47, 44, 43,
- 41, 39, 37, 36, 35, 34, 33, 33, 32, 31, 31, 30, 30, 29, 29, 28, 28, 28,
- 27, 27, 27, 27, 46, 47, 49, 50, 51, 49, 47, 45, 43, 41, 40, 38, 37, 36,
- 35, 34, 33, 32, 31, 31, 30, 30, 29, 29, 28, 28, 28, 27, 27, 27, 27, 27,
- 44, 45, 46, 48, 49, 47, 45, 44, 42, 40, 39, 37, 36, 35, 34, 33, 32, 31,
- 31, 30, 30, 29, 29, 28, 28, 28, 27, 27, 27, 27, 27, 27, 41, 43, 44, 45,
- 47, 45, 44, 42, 40, 39, 38, 36, 35, 34, 33, 32, 31, 31, 30, 30, 29, 29,
- 28, 28, 28, 27, 27, 27, 26, 26, 26, 26, 39, 41, 42, 43, 44, 43, 42, 40,
- 39, 38, 37, 35, 34, 33, 32, 32, 31, 30, 30, 29, 29, 28, 28, 27, 27, 27,
- 27, 26, 26, 26, 26, 26, 38, 39, 40, 41, 43, 41, 40, 39, 38, 37, 36, 35,
- 33, 33, 32, 31, 30, 30, 29, 29, 28, 28, 27, 27, 27, 27, 26, 26, 26, 26,
- 26, 26, 36, 38, 39, 40, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 31,
- 30, 29, 29, 28, 28, 27, 27, 27, 26, 26, 26, 26, 25, 25, 25, 25, 35, 36,
- 37, 38, 39, 38, 37, 37, 36, 35, 34, 33, 32, 31, 31, 30, 29, 29, 28, 28,
- 27, 27, 27, 26, 26, 26, 26, 25, 25, 25, 25, 25, 34, 35, 36, 37, 38, 37,
- 36, 35, 35, 34, 33, 32, 31, 31, 30, 30, 29, 28, 28, 28, 27, 27, 26, 26,
- 26, 26, 25, 25, 25, 25, 25, 25, 33, 34, 35, 35, 36, 36, 35, 34, 34, 33,
- 32, 32, 31, 30, 30, 29, 28, 28, 28, 27, 27, 27, 26, 26, 26, 25, 25, 25,
- 25, 25, 25, 25, 32, 33, 34, 34, 35, 35, 34, 33, 33, 32, 32, 31, 30, 30,
- 29, 29, 28, 28, 27, 27, 27, 26, 26, 26, 25, 25, 25, 25, 25, 25, 25, 25,
- 31, 32, 32, 33, 34, 34, 33, 33, 32, 31, 31, 30, 30, 29, 29, 28, 28, 27,
- 27, 27, 26, 26, 26, 25, 25, 25, 25, 25, 24, 24, 24, 24, 30, 31, 31, 32,
- 33, 32, 32, 32, 31, 31, 30, 30, 29, 29, 28, 28, 27, 27, 27, 26, 26, 26,
- 25, 25, 25, 25, 25, 24, 24, 24, 24, 24, 30, 31, 31, 32, 33, 32, 32, 32,
- 31, 31, 30, 30, 29, 29, 28, 28, 27, 27, 27, 26, 26, 26, 25, 25, 25, 25,
- 25, 24, 24, 24, 24, 24, 30, 31, 31, 32, 33, 32, 32, 32, 31, 31, 30, 30,
- 29, 29, 28, 28, 27, 27, 27, 26, 26, 26, 25, 25, 25, 25, 25, 24, 24, 24,
- 24, 24, 30, 31, 31, 32, 33, 32, 32, 32, 31, 31, 30, 30, 29, 29, 28, 28,
- 27, 27, 27, 26, 26, 26, 25, 25, 25, 25, 25, 24, 24, 24, 24, 24 },
- { /* Intra matrices */
- /* Size 4 */
- 141, 130, 85, 60, 130, 91, 70, 56, 85, 70, 55, 48, 60, 56, 48, 43,
- /* Size 8 */
- 120, 155, 144, 113, 88, 72, 61, 53, 155, 137, 143, 124, 100, 82, 68, 59,
- 144, 143, 106, 93, 82, 71, 63, 56, 113, 124, 93, 77, 68, 62, 56, 52, 88,
- 100, 82, 68, 60, 55, 51, 48, 72, 82, 71, 62, 55, 51, 48, 46, 61, 68, 63,
- 56, 51, 48, 45, 44, 53, 59, 56, 52, 48, 46, 44, 42,
- /* Size 16 */
- 124, 142, 160, 154, 149, 133, 117, 104, 91, 82, 74, 68, 63, 59, 55, 55,
- 142, 146, 150, 149, 148, 135, 122, 110, 97, 88, 79, 73, 66, 62, 58, 58,
- 160, 150, 141, 144, 147, 137, 128, 115, 103, 94, 84, 77, 70, 66, 61, 61,
- 154, 149, 144, 136, 128, 120, 112, 103, 94, 86, 79, 73, 67, 63, 59, 59,
- 149, 148, 147, 128, 109, 103, 96, 90, 84, 79, 73, 69, 64, 61, 58, 58,
- 133, 135, 137, 120, 103, 95, 87, 82, 77, 73, 68, 65, 61, 58, 56, 56,
- 117, 122, 128, 112, 96, 87, 79, 74, 70, 67, 63, 61, 58, 56, 53, 53, 104,
- 110, 115, 103, 90, 82, 74, 70, 66, 63, 60, 58, 55, 53, 52, 52, 91, 97,
- 103, 94, 84, 77, 70, 66, 62, 59, 57, 55, 53, 51, 50, 50, 82, 88, 94, 86,
- 79, 73, 67, 63, 59, 57, 54, 53, 51, 50, 48, 48, 74, 79, 84, 79, 73, 68,
- 63, 60, 57, 54, 52, 51, 49, 48, 47, 47, 68, 73, 77, 73, 69, 65, 61, 58,
- 55, 53, 51, 49, 48, 47, 46, 46, 63, 66, 70, 67, 64, 61, 58, 55, 53, 51,
- 49, 48, 47, 46, 45, 45, 59, 62, 66, 63, 61, 58, 56, 53, 51, 50, 48, 47,
- 46, 45, 44, 44, 55, 58, 61, 59, 58, 56, 53, 52, 50, 48, 47, 46, 45, 44,
- 44, 44, 55, 58, 61, 59, 58, 56, 53, 52, 50, 48, 47, 46, 45, 44, 44, 44,
- /* Size 32 */
- 126, 135, 144, 153, 162, 159, 157, 154, 151, 143, 135, 127, 118, 112,
- 105, 99, 92, 88, 84, 79, 75, 72, 69, 66, 63, 62, 60, 58, 56, 56, 56, 56,
- 135, 141, 146, 152, 157, 156, 154, 152, 151, 143, 136, 129, 121, 115,
- 108, 102, 96, 91, 87, 82, 78, 75, 71, 68, 65, 63, 61, 59, 57, 57, 57,
- 57, 144, 146, 148, 151, 153, 152, 151, 151, 150, 144, 137, 130, 124,
- 118, 111, 105, 99, 94, 89, 85, 80, 77, 74, 71, 67, 65, 63, 61, 59, 59,
- 59, 59, 153, 152, 151, 149, 148, 148, 149, 149, 150, 144, 138, 132, 127,
- 120, 114, 108, 102, 97, 92, 87, 83, 79, 76, 73, 69, 67, 65, 63, 60, 60,
- 60, 60, 162, 157, 153, 148, 143, 145, 146, 148, 149, 144, 139, 134, 130,
- 123, 117, 111, 105, 100, 95, 90, 85, 82, 78, 75, 71, 69, 67, 64, 62, 62,
- 62, 62, 159, 156, 152, 148, 145, 143, 142, 141, 139, 135, 130, 126, 121,
- 116, 111, 105, 100, 96, 91, 87, 83, 79, 76, 73, 70, 68, 65, 63, 61, 61,
- 61, 61, 157, 154, 151, 149, 146, 142, 138, 134, 130, 126, 122, 118, 113,
- 109, 104, 100, 95, 91, 88, 84, 80, 77, 74, 71, 68, 66, 64, 62, 60, 60,
- 60, 60, 154, 152, 151, 149, 148, 141, 134, 127, 120, 117, 113, 109, 105,
- 102, 98, 94, 90, 87, 84, 81, 77, 75, 72, 69, 67, 65, 63, 61, 59, 59, 59,
- 59, 151, 151, 150, 150, 149, 139, 130, 120, 111, 108, 104, 101, 97, 94,
- 91, 89, 86, 83, 80, 77, 75, 72, 70, 68, 65, 64, 62, 60, 58, 58, 58, 58,
- 143, 143, 144, 144, 144, 135, 126, 117, 108, 104, 100, 97, 93, 90, 87,
- 85, 82, 79, 77, 74, 72, 70, 68, 66, 64, 62, 61, 59, 57, 57, 57, 57, 135,
- 136, 137, 138, 139, 130, 122, 113, 104, 100, 96, 93, 89, 86, 84, 81, 78,
- 76, 74, 72, 69, 68, 66, 64, 62, 61, 59, 58, 56, 56, 56, 56, 127, 129,
- 130, 132, 134, 126, 118, 109, 101, 97, 93, 88, 84, 82, 80, 77, 75, 73,
- 71, 69, 67, 65, 64, 62, 60, 59, 58, 57, 55, 55, 55, 55, 118, 121, 124,
- 127, 130, 121, 113, 105, 97, 93, 89, 84, 80, 78, 76, 73, 71, 69, 68, 66,
- 64, 63, 62, 60, 59, 58, 57, 55, 54, 54, 54, 54, 112, 115, 118, 120, 123,
- 116, 109, 102, 94, 90, 86, 82, 78, 76, 73, 71, 69, 67, 66, 64, 63, 61,
- 60, 59, 58, 56, 55, 54, 53, 53, 53, 53, 105, 108, 111, 114, 117, 111,
- 104, 98, 91, 87, 84, 80, 76, 73, 71, 69, 67, 65, 64, 62, 61, 60, 59, 57,
- 56, 55, 54, 53, 52, 52, 52, 52, 99, 102, 105, 108, 111, 105, 100, 94,
- 89, 85, 81, 77, 73, 71, 69, 67, 65, 63, 62, 60, 59, 58, 57, 56, 55, 54,
- 53, 52, 51, 51, 51, 51, 92, 96, 99, 102, 105, 100, 95, 90, 86, 82, 78,
- 75, 71, 69, 67, 65, 63, 61, 60, 59, 57, 56, 55, 55, 54, 53, 52, 51, 51,
- 51, 51, 51, 88, 91, 94, 97, 100, 96, 91, 87, 83, 79, 76, 73, 69, 67, 65,
- 63, 61, 60, 59, 57, 56, 55, 54, 54, 53, 52, 51, 51, 50, 50, 50, 50, 84,
- 87, 89, 92, 95, 91, 88, 84, 80, 77, 74, 71, 68, 66, 64, 62, 60, 59, 58,
- 56, 55, 54, 53, 53, 52, 51, 50, 50, 49, 49, 49, 49, 79, 82, 85, 87, 90,
- 87, 84, 81, 77, 74, 72, 69, 66, 64, 62, 60, 59, 57, 56, 55, 54, 53, 52,
- 52, 51, 50, 50, 49, 48, 48, 48, 48, 75, 78, 80, 83, 85, 83, 80, 77, 75,
- 72, 69, 67, 64, 63, 61, 59, 57, 56, 55, 54, 53, 52, 51, 51, 50, 49, 49,
- 48, 48, 48, 48, 48, 72, 75, 77, 79, 82, 79, 77, 75, 72, 70, 68, 65, 63,
- 61, 60, 58, 56, 55, 54, 53, 52, 51, 51, 50, 49, 49, 48, 48, 47, 47, 47,
- 47, 69, 71, 74, 76, 78, 76, 74, 72, 70, 68, 66, 64, 62, 60, 59, 57, 55,
- 54, 53, 52, 51, 51, 50, 49, 49, 48, 48, 47, 47, 47, 47, 47, 66, 68, 71,
- 73, 75, 73, 71, 69, 68, 66, 64, 62, 60, 59, 57, 56, 55, 54, 53, 52, 51,
- 50, 49, 49, 48, 48, 47, 47, 46, 46, 46, 46, 63, 65, 67, 69, 71, 70, 68,
- 67, 65, 64, 62, 60, 59, 58, 56, 55, 54, 53, 52, 51, 50, 49, 49, 48, 47,
- 47, 47, 46, 46, 46, 46, 46, 62, 63, 65, 67, 69, 68, 66, 65, 64, 62, 61,
- 59, 58, 56, 55, 54, 53, 52, 51, 50, 49, 49, 48, 48, 47, 47, 46, 46, 45,
- 45, 45, 45, 60, 61, 63, 65, 67, 65, 64, 63, 62, 61, 59, 58, 57, 55, 54,
- 53, 52, 51, 50, 50, 49, 48, 48, 47, 47, 46, 46, 45, 45, 45, 45, 45, 58,
- 59, 61, 63, 64, 63, 62, 61, 60, 59, 58, 57, 55, 54, 53, 52, 51, 51, 50,
- 49, 48, 48, 47, 47, 46, 46, 45, 45, 45, 45, 45, 45, 56, 57, 59, 60, 62,
- 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 51, 50, 49, 48, 48, 47, 47,
- 46, 46, 45, 45, 45, 44, 44, 44, 44, 56, 57, 59, 60, 62, 61, 60, 59, 58,
- 57, 56, 55, 54, 53, 52, 51, 51, 50, 49, 48, 48, 47, 47, 46, 46, 45, 45,
- 45, 44, 44, 44, 44, 56, 57, 59, 60, 62, 61, 60, 59, 58, 57, 56, 55, 54,
- 53, 52, 51, 51, 50, 49, 48, 48, 47, 47, 46, 46, 45, 45, 45, 44, 44, 44,
- 44, 56, 57, 59, 60, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 51,
- 50, 49, 48, 48, 47, 47, 46, 46, 45, 45, 45, 44, 44, 44, 44 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 44, 41, 34, 44, 38, 36, 33, 41, 36, 30, 27, 34, 33, 27, 25,
- /* Size 8 */
- 64, 77, 47, 45, 42, 39, 36, 33, 77, 56, 46, 50, 49, 45, 41, 37, 47, 46,
- 41, 42, 42, 40, 38, 35, 45, 50, 42, 38, 37, 36, 34, 32, 42, 49, 42, 37,
- 34, 32, 31, 30, 39, 45, 40, 36, 32, 30, 29, 28, 36, 41, 38, 34, 31, 29,
- 27, 26, 33, 37, 35, 32, 30, 28, 26, 25,
- /* Size 16 */
- 64, 71, 77, 62, 47, 46, 45, 43, 42, 41, 39, 37, 36, 34, 33, 33, 71, 69,
- 67, 57, 46, 47, 47, 46, 46, 44, 42, 40, 38, 37, 35, 35, 77, 67, 56, 51,
- 46, 48, 50, 49, 49, 47, 45, 43, 41, 39, 37, 37, 62, 57, 51, 47, 43, 45,
- 46, 46, 45, 44, 43, 41, 40, 38, 36, 36, 47, 46, 46, 43, 41, 41, 42, 42,
- 42, 41, 40, 39, 38, 37, 35, 35, 46, 47, 48, 45, 41, 41, 40, 40, 39, 39,
- 38, 37, 36, 35, 34, 34, 45, 47, 50, 46, 42, 40, 38, 37, 37, 36, 36, 35,
- 34, 33, 32, 32, 43, 46, 49, 46, 42, 40, 37, 36, 35, 35, 34, 33, 33, 32,
- 31, 31, 42, 46, 49, 45, 42, 39, 37, 35, 34, 33, 32, 32, 31, 30, 30, 30,
- 41, 44, 47, 44, 41, 39, 36, 35, 33, 32, 31, 31, 30, 29, 29, 29, 39, 42,
- 45, 43, 40, 38, 36, 34, 32, 31, 30, 30, 29, 28, 28, 28, 37, 40, 43, 41,
- 39, 37, 35, 33, 32, 31, 30, 29, 28, 28, 27, 27, 36, 38, 41, 40, 38, 36,
- 34, 33, 31, 30, 29, 28, 27, 27, 26, 26, 34, 37, 39, 38, 37, 35, 33, 32,
- 30, 29, 28, 28, 27, 26, 26, 26, 33, 35, 37, 36, 35, 34, 32, 31, 30, 29,
- 28, 27, 26, 26, 25, 25, 33, 35, 37, 36, 35, 34, 32, 31, 30, 29, 28, 27,
- 26, 26, 25, 25,
- /* Size 32 */
- 64, 67, 71, 74, 77, 69, 62, 54, 47, 46, 46, 45, 45, 44, 43, 43, 42, 42,
- 41, 40, 39, 38, 37, 36, 36, 35, 34, 33, 33, 33, 33, 33, 67, 68, 70, 71,
- 72, 66, 59, 53, 47, 46, 46, 46, 46, 45, 45, 44, 44, 43, 42, 41, 40, 40,
- 39, 38, 37, 36, 35, 35, 34, 34, 34, 34, 71, 70, 69, 68, 67, 62, 57, 51,
- 46, 47, 47, 47, 47, 47, 46, 46, 46, 45, 44, 43, 42, 41, 40, 39, 38, 38,
- 37, 36, 35, 35, 35, 35, 74, 71, 68, 65, 61, 58, 54, 50, 46, 47, 47, 48,
- 49, 48, 48, 47, 47, 46, 45, 44, 44, 43, 42, 41, 40, 39, 38, 37, 36, 36,
- 36, 36, 77, 72, 67, 61, 56, 54, 51, 49, 46, 47, 48, 49, 50, 50, 49, 49,
- 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 37, 37, 37, 69, 66,
- 62, 58, 54, 51, 49, 47, 45, 46, 46, 47, 48, 48, 47, 47, 47, 46, 45, 45,
- 44, 43, 42, 41, 40, 39, 39, 38, 37, 37, 37, 37, 62, 59, 57, 54, 51, 49,
- 47, 45, 43, 44, 45, 45, 46, 46, 46, 45, 45, 45, 44, 43, 43, 42, 41, 40,
- 40, 39, 38, 37, 36, 36, 36, 36, 54, 53, 51, 50, 49, 47, 45, 44, 42, 43,
- 43, 43, 44, 44, 44, 44, 44, 43, 43, 42, 42, 41, 40, 39, 39, 38, 37, 36,
- 36, 36, 36, 36, 47, 47, 46, 46, 46, 45, 43, 42, 41, 41, 41, 42, 42, 42,
- 42, 42, 42, 42, 41, 41, 40, 40, 39, 38, 38, 37, 37, 36, 35, 35, 35, 35,
- 46, 46, 47, 47, 47, 46, 44, 43, 41, 41, 41, 41, 41, 41, 41, 41, 41, 40,
- 40, 40, 39, 39, 38, 37, 37, 36, 36, 35, 34, 34, 34, 34, 46, 46, 47, 47,
- 48, 46, 45, 43, 41, 41, 41, 40, 40, 40, 40, 40, 39, 39, 39, 38, 38, 37,
- 37, 36, 36, 35, 35, 34, 34, 34, 34, 34, 45, 46, 47, 48, 49, 47, 45, 43,
- 42, 41, 40, 40, 39, 39, 39, 38, 38, 38, 37, 37, 37, 36, 36, 36, 35, 35,
- 34, 34, 33, 33, 33, 33, 45, 46, 47, 49, 50, 48, 46, 44, 42, 41, 40, 39,
- 38, 38, 37, 37, 37, 36, 36, 36, 36, 35, 35, 35, 34, 34, 33, 33, 32, 32,
- 32, 32, 44, 45, 47, 48, 50, 48, 46, 44, 42, 41, 40, 39, 38, 37, 37, 36,
- 36, 36, 35, 35, 35, 34, 34, 34, 33, 33, 33, 32, 32, 32, 32, 32, 43, 45,
- 46, 48, 49, 47, 46, 44, 42, 41, 40, 39, 37, 37, 36, 36, 35, 35, 35, 34,
- 34, 34, 33, 33, 33, 32, 32, 32, 31, 31, 31, 31, 43, 44, 46, 47, 49, 47,
- 45, 44, 42, 41, 40, 38, 37, 36, 36, 35, 35, 34, 34, 34, 33, 33, 33, 32,
- 32, 32, 31, 31, 31, 31, 31, 31, 42, 44, 46, 47, 49, 47, 45, 44, 42, 41,
- 39, 38, 37, 36, 35, 35, 34, 34, 33, 33, 32, 32, 32, 31, 31, 31, 30, 30,
- 30, 30, 30, 30, 42, 43, 45, 46, 48, 46, 45, 43, 42, 40, 39, 38, 36, 36,
- 35, 34, 34, 33, 33, 32, 32, 32, 31, 31, 31, 30, 30, 30, 29, 29, 29, 29,
- 41, 42, 44, 45, 47, 45, 44, 43, 41, 40, 39, 37, 36, 35, 35, 34, 33, 33,
- 32, 32, 31, 31, 31, 30, 30, 30, 29, 29, 29, 29, 29, 29, 40, 41, 43, 44,
- 46, 45, 43, 42, 41, 40, 38, 37, 36, 35, 34, 34, 33, 32, 32, 31, 31, 30,
- 30, 30, 29, 29, 29, 29, 28, 28, 28, 28, 39, 40, 42, 44, 45, 44, 43, 42,
- 40, 39, 38, 37, 36, 35, 34, 33, 32, 32, 31, 31, 30, 30, 30, 29, 29, 29,
- 28, 28, 28, 28, 28, 28, 38, 40, 41, 43, 44, 43, 42, 41, 40, 39, 37, 36,
- 35, 34, 34, 33, 32, 32, 31, 30, 30, 30, 29, 29, 29, 28, 28, 28, 28, 28,
- 28, 28, 37, 39, 40, 42, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 33,
- 32, 31, 31, 30, 30, 29, 29, 29, 28, 28, 28, 27, 27, 27, 27, 27, 36, 38,
- 39, 41, 42, 41, 40, 39, 38, 37, 36, 36, 35, 34, 33, 32, 31, 31, 30, 30,
- 29, 29, 29, 28, 28, 28, 27, 27, 27, 27, 27, 27, 36, 37, 38, 40, 41, 40,
- 40, 39, 38, 37, 36, 35, 34, 33, 33, 32, 31, 31, 30, 29, 29, 29, 28, 28,
- 27, 27, 27, 27, 26, 26, 26, 26, 35, 36, 38, 39, 40, 39, 39, 38, 37, 36,
- 35, 35, 34, 33, 32, 32, 31, 30, 30, 29, 29, 28, 28, 28, 27, 27, 27, 26,
- 26, 26, 26, 26, 34, 35, 37, 38, 39, 39, 38, 37, 37, 36, 35, 34, 33, 33,
- 32, 31, 30, 30, 29, 29, 28, 28, 28, 27, 27, 27, 26, 26, 26, 26, 26, 26,
- 33, 35, 36, 37, 38, 38, 37, 36, 36, 35, 34, 34, 33, 32, 32, 31, 30, 30,
- 29, 29, 28, 28, 27, 27, 27, 26, 26, 26, 26, 26, 26, 26, 33, 34, 35, 36,
- 37, 37, 36, 36, 35, 34, 34, 33, 32, 32, 31, 31, 30, 29, 29, 28, 28, 28,
- 27, 27, 26, 26, 26, 26, 25, 25, 25, 25, 33, 34, 35, 36, 37, 37, 36, 36,
- 35, 34, 34, 33, 32, 32, 31, 31, 30, 29, 29, 28, 28, 28, 27, 27, 26, 26,
- 26, 26, 25, 25, 25, 25, 33, 34, 35, 36, 37, 37, 36, 36, 35, 34, 34, 33,
- 32, 32, 31, 31, 30, 29, 29, 28, 28, 28, 27, 27, 26, 26, 26, 26, 25, 25,
- 25, 25, 33, 34, 35, 36, 37, 37, 36, 36, 35, 34, 34, 33, 32, 32, 31, 31,
- 30, 29, 29, 28, 28, 28, 27, 27, 26, 26, 26, 26, 25, 25, 25, 25 },
- { /* Intra matrices */
- /* Size 4 */
- 125, 84, 78, 64, 84, 72, 68, 61, 78, 68, 56, 51, 64, 61, 51, 45,
- /* Size 8 */
- 117, 141, 84, 80, 76, 69, 63, 57, 141, 102, 83, 90, 88, 81, 73, 66, 84,
- 83, 73, 75, 75, 72, 67, 62, 80, 90, 75, 68, 65, 63, 60, 57, 76, 88, 75,
- 65, 60, 57, 54, 52, 69, 81, 72, 63, 57, 53, 50, 48, 63, 73, 67, 60, 54,
- 50, 47, 45, 57, 66, 62, 57, 52, 48, 45, 43,
- /* Size 16 */
- 119, 132, 144, 115, 86, 84, 82, 79, 77, 74, 71, 67, 64, 61, 58, 58, 132,
- 128, 124, 105, 85, 86, 87, 85, 83, 80, 77, 73, 69, 66, 63, 63, 144, 124,
- 104, 94, 84, 88, 92, 91, 89, 86, 83, 79, 75, 71, 68, 68, 115, 105, 94,
- 87, 79, 82, 84, 83, 83, 80, 78, 75, 72, 69, 65, 65, 86, 85, 84, 79, 74,
- 75, 76, 76, 76, 75, 73, 71, 68, 66, 63, 63, 84, 86, 88, 82, 75, 74, 73,
- 72, 71, 70, 69, 67, 65, 63, 61, 61, 82, 87, 92, 84, 76, 73, 69, 68, 66,
- 65, 64, 63, 61, 60, 58, 58, 79, 85, 91, 83, 76, 72, 68, 66, 64, 62, 61,
- 60, 58, 57, 56, 56, 77, 83, 89, 83, 76, 71, 66, 64, 61, 59, 58, 57, 55,
- 54, 53, 53, 74, 80, 86, 80, 75, 70, 65, 62, 59, 58, 56, 55, 53, 52, 51,
- 51, 71, 77, 83, 78, 73, 69, 64, 61, 58, 56, 54, 53, 51, 50, 49, 49, 67,
- 73, 79, 75, 71, 67, 63, 60, 57, 55, 53, 51, 50, 49, 48, 48, 64, 69, 75,
- 72, 68, 65, 61, 58, 55, 53, 51, 50, 48, 47, 46, 46, 61, 66, 71, 69, 66,
- 63, 60, 57, 54, 52, 50, 49, 47, 46, 45, 45, 58, 63, 68, 65, 63, 61, 58,
- 56, 53, 51, 49, 48, 46, 45, 44, 44, 58, 63, 68, 65, 63, 61, 58, 56, 53,
- 51, 49, 48, 46, 45, 44, 44,
- /* Size 32 */
- 120, 127, 133, 140, 146, 131, 116, 101, 87, 86, 85, 84, 82, 81, 80, 79,
- 78, 76, 75, 73, 71, 70, 68, 66, 65, 63, 62, 60, 59, 59, 59, 59, 127,
- 129, 131, 134, 136, 123, 111, 99, 86, 86, 86, 85, 85, 84, 83, 82, 81,
- 80, 78, 76, 74, 73, 71, 69, 67, 66, 64, 63, 61, 61, 61, 61, 133, 131,
- 129, 127, 126, 116, 106, 96, 86, 86, 87, 87, 88, 87, 86, 85, 84, 83, 81,
- 79, 77, 76, 74, 72, 70, 69, 67, 65, 64, 64, 64, 64, 140, 134, 127, 121,
- 115, 108, 101, 93, 86, 87, 88, 89, 90, 89, 89, 88, 87, 86, 84, 82, 81,
- 79, 77, 75, 73, 71, 70, 68, 66, 66, 66, 66, 146, 136, 126, 115, 105,
- 100, 95, 90, 85, 87, 89, 91, 93, 92, 92, 91, 90, 89, 87, 85, 84, 82, 80,
- 78, 76, 74, 72, 70, 68, 68, 68, 68, 131, 123, 116, 108, 100, 96, 92, 87,
- 83, 84, 86, 87, 89, 88, 88, 88, 87, 86, 84, 83, 81, 79, 78, 76, 74, 72,
- 71, 69, 67, 67, 67, 67, 116, 111, 106, 101, 95, 92, 88, 84, 80, 81, 83,
- 84, 85, 85, 84, 84, 84, 83, 81, 80, 79, 77, 76, 74, 72, 71, 69, 68, 66,
- 66, 66, 66, 101, 99, 96, 93, 90, 87, 84, 81, 78, 78, 79, 80, 81, 81, 81,
- 81, 81, 80, 79, 78, 76, 75, 74, 72, 71, 69, 68, 67, 65, 65, 65, 65, 87,
- 86, 86, 86, 85, 83, 80, 78, 75, 75, 76, 77, 77, 77, 77, 77, 77, 76, 76,
- 75, 74, 73, 72, 70, 69, 68, 67, 65, 64, 64, 64, 64, 86, 86, 86, 87, 87,
- 84, 81, 78, 75, 75, 75, 75, 75, 75, 75, 75, 75, 74, 73, 73, 72, 71, 70,
- 69, 67, 66, 65, 64, 63, 63, 63, 63, 85, 86, 87, 88, 89, 86, 83, 79, 76,
- 75, 75, 74, 73, 73, 73, 73, 72, 72, 71, 70, 70, 69, 68, 67, 66, 65, 63,
- 62, 61, 61, 61, 61, 84, 85, 87, 89, 91, 87, 84, 80, 77, 75, 74, 73, 72,
- 71, 71, 70, 70, 69, 68, 68, 67, 66, 66, 65, 64, 63, 62, 61, 60, 60, 60,
- 60, 82, 85, 88, 90, 93, 89, 85, 81, 77, 75, 73, 72, 70, 69, 68, 68, 67,
- 67, 66, 65, 65, 64, 63, 63, 62, 61, 60, 59, 59, 59, 59, 59, 81, 84, 87,
- 89, 92, 88, 85, 81, 77, 75, 73, 71, 69, 68, 67, 67, 66, 65, 65, 64, 63,
- 63, 62, 61, 61, 60, 59, 58, 57, 57, 57, 57, 80, 83, 86, 89, 92, 88, 84,
- 81, 77, 75, 73, 71, 68, 67, 66, 65, 64, 64, 63, 62, 62, 61, 60, 60, 59,
- 58, 58, 57, 56, 56, 56, 56, 79, 82, 85, 88, 91, 88, 84, 81, 77, 75, 73,
- 70, 68, 67, 65, 64, 63, 62, 62, 61, 60, 59, 59, 58, 58, 57, 56, 56, 55,
- 55, 55, 55, 78, 81, 84, 87, 90, 87, 84, 81, 77, 75, 72, 70, 67, 66, 64,
- 63, 62, 61, 60, 59, 58, 58, 57, 57, 56, 55, 55, 54, 54, 54, 54, 54, 76,
- 80, 83, 86, 89, 86, 83, 80, 76, 74, 72, 69, 67, 65, 64, 62, 61, 60, 59,
- 58, 57, 57, 56, 56, 55, 54, 54, 53, 53, 53, 53, 53, 75, 78, 81, 84, 87,
- 84, 81, 79, 76, 73, 71, 68, 66, 65, 63, 62, 60, 59, 58, 57, 56, 56, 55,
- 55, 54, 53, 53, 52, 52, 52, 52, 52, 73, 76, 79, 82, 85, 83, 80, 78, 75,
- 73, 70, 68, 65, 64, 62, 61, 59, 58, 57, 56, 55, 55, 54, 54, 53, 52, 52,
- 51, 51, 51, 51, 51, 71, 74, 77, 81, 84, 81, 79, 76, 74, 72, 70, 67, 65,
- 63, 62, 60, 58, 57, 56, 55, 54, 54, 53, 52, 52, 51, 51, 50, 50, 50, 50,
- 50, 70, 73, 76, 79, 82, 79, 77, 75, 73, 71, 69, 66, 64, 63, 61, 59, 58,
- 57, 56, 55, 54, 53, 52, 52, 51, 51, 50, 50, 49, 49, 49, 49, 68, 71, 74,
- 77, 80, 78, 76, 74, 72, 70, 68, 66, 63, 62, 60, 59, 57, 56, 55, 54, 53,
- 52, 52, 51, 50, 50, 49, 49, 48, 48, 48, 48, 66, 69, 72, 75, 78, 76, 74,
- 72, 70, 69, 67, 65, 63, 61, 60, 58, 57, 56, 55, 54, 52, 52, 51, 50, 50,
- 49, 49, 48, 48, 48, 48, 48, 65, 67, 70, 73, 76, 74, 72, 71, 69, 67, 66,
- 64, 62, 61, 59, 58, 56, 55, 54, 53, 52, 51, 50, 50, 49, 48, 48, 47, 47,
- 47, 47, 47, 63, 66, 69, 71, 74, 72, 71, 69, 68, 66, 65, 63, 61, 60, 58,
- 57, 55, 54, 53, 52, 51, 51, 50, 49, 48, 48, 47, 47, 46, 46, 46, 46, 62,
- 64, 67, 70, 72, 71, 69, 68, 67, 65, 63, 62, 60, 59, 58, 56, 55, 54, 53,
- 52, 51, 50, 49, 49, 48, 47, 47, 46, 46, 46, 46, 46, 60, 63, 65, 68, 70,
- 69, 68, 67, 65, 64, 62, 61, 59, 58, 57, 56, 54, 53, 52, 51, 50, 50, 49,
- 48, 47, 47, 46, 46, 45, 45, 45, 45, 59, 61, 64, 66, 68, 67, 66, 65, 64,
- 63, 61, 60, 59, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 48, 47, 46, 46,
- 45, 45, 45, 45, 45, 59, 61, 64, 66, 68, 67, 66, 65, 64, 63, 61, 60, 59,
- 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 48, 47, 46, 46, 45, 45, 45, 45,
- 45, 59, 61, 64, 66, 68, 67, 66, 65, 64, 63, 61, 60, 59, 57, 56, 55, 54,
- 53, 52, 51, 50, 49, 48, 48, 47, 46, 46, 45, 45, 45, 45, 45, 59, 61, 64,
- 66, 68, 67, 66, 65, 64, 63, 61, 60, 59, 57, 56, 55, 54, 53, 52, 51, 50,
- 49, 48, 48, 47, 46, 46, 45, 45, 45, 45, 45 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 60, 41, 31, 60, 44, 35, 29, 41, 35, 29, 26, 31, 29, 26, 24,
- /* Size 8 */
- 64, 80, 75, 61, 49, 41, 36, 33, 80, 72, 74, 66, 55, 46, 40, 35, 75, 74,
- 57, 51, 46, 41, 37, 34, 61, 66, 51, 43, 39, 36, 34, 32, 49, 55, 46, 39,
- 36, 33, 32, 30, 41, 46, 41, 36, 33, 31, 30, 29, 36, 40, 37, 34, 32, 30,
- 29, 28, 33, 35, 34, 32, 30, 29, 28, 27,
- /* Size 16 */
- 64, 72, 80, 78, 75, 68, 61, 55, 49, 45, 41, 39, 36, 34, 33, 33, 72, 74,
- 76, 75, 75, 69, 63, 57, 52, 48, 43, 41, 38, 36, 34, 34, 80, 76, 72, 73,
- 74, 70, 66, 60, 55, 50, 46, 43, 40, 37, 35, 35, 78, 75, 73, 69, 66, 62,
- 58, 54, 50, 47, 43, 41, 38, 36, 34, 34, 75, 75, 74, 66, 57, 54, 51, 49,
- 46, 43, 41, 39, 37, 35, 34, 34, 68, 69, 70, 62, 54, 51, 47, 45, 43, 41,
- 39, 37, 35, 34, 33, 33, 61, 63, 66, 58, 51, 47, 43, 41, 39, 38, 36, 35,
- 34, 33, 32, 32, 55, 57, 60, 54, 49, 45, 41, 39, 37, 36, 35, 34, 33, 32,
- 31, 31, 49, 52, 55, 50, 46, 43, 39, 37, 36, 34, 33, 32, 32, 31, 30, 30,
- 45, 48, 50, 47, 43, 41, 38, 36, 34, 33, 32, 31, 31, 30, 30, 30, 41, 43,
- 46, 43, 41, 39, 36, 35, 33, 32, 31, 31, 30, 29, 29, 29, 39, 41, 43, 41,
- 39, 37, 35, 34, 32, 31, 31, 30, 29, 29, 28, 28, 36, 38, 40, 38, 37, 35,
- 34, 33, 32, 31, 30, 29, 29, 28, 28, 28, 34, 36, 37, 36, 35, 34, 33, 32,
- 31, 30, 29, 29, 28, 28, 28, 28, 33, 34, 35, 34, 34, 33, 32, 31, 30, 30,
- 29, 28, 28, 28, 27, 27, 33, 34, 35, 34, 34, 33, 32, 31, 30, 30, 29, 28,
- 28, 28, 27, 27,
- /* Size 32 */
- 64, 68, 72, 76, 80, 79, 78, 77, 75, 72, 68, 64, 61, 58, 55, 52, 49, 47,
- 45, 43, 41, 40, 39, 37, 36, 35, 34, 33, 33, 33, 33, 33, 68, 71, 73, 76,
- 78, 77, 77, 76, 75, 72, 69, 65, 62, 59, 56, 53, 50, 48, 46, 44, 42, 41,
- 40, 38, 37, 36, 35, 34, 33, 33, 33, 33, 72, 73, 74, 75, 76, 76, 75, 75,
- 75, 72, 69, 66, 63, 60, 57, 55, 52, 50, 48, 46, 43, 42, 41, 39, 38, 37,
- 36, 35, 34, 34, 34, 34, 76, 76, 75, 75, 74, 74, 74, 74, 75, 72, 70, 67,
- 64, 62, 59, 56, 53, 51, 49, 47, 45, 43, 42, 40, 39, 38, 37, 36, 35, 35,
- 35, 35, 80, 78, 76, 74, 72, 72, 73, 74, 74, 72, 70, 68, 66, 63, 60, 57,
- 55, 52, 50, 48, 46, 44, 43, 41, 40, 38, 37, 36, 35, 35, 35, 35, 79, 77,
- 76, 74, 72, 72, 71, 71, 70, 68, 66, 64, 62, 60, 57, 55, 52, 50, 48, 47,
- 45, 43, 42, 40, 39, 38, 37, 36, 35, 35, 35, 35, 78, 77, 75, 74, 73, 71,
- 69, 68, 66, 64, 62, 60, 58, 56, 54, 52, 50, 49, 47, 45, 43, 42, 41, 39,
- 38, 37, 36, 35, 34, 34, 34, 34, 77, 76, 75, 74, 74, 71, 68, 65, 62, 60,
- 58, 56, 55, 53, 51, 50, 48, 47, 45, 44, 42, 41, 40, 39, 38, 37, 36, 35,
- 34, 34, 34, 34, 75, 75, 75, 75, 74, 70, 66, 62, 57, 56, 54, 53, 51, 50,
- 49, 47, 46, 45, 43, 42, 41, 40, 39, 38, 37, 36, 35, 35, 34, 34, 34, 34,
- 72, 72, 72, 72, 72, 68, 64, 60, 56, 54, 53, 51, 49, 48, 47, 46, 44, 43,
- 42, 41, 40, 39, 38, 37, 36, 35, 35, 34, 33, 33, 33, 33, 68, 69, 69, 70,
- 70, 66, 62, 58, 54, 53, 51, 49, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38,
- 37, 36, 35, 35, 34, 33, 33, 33, 33, 33, 64, 65, 66, 67, 68, 64, 60, 56,
- 53, 51, 49, 47, 45, 44, 43, 42, 41, 40, 39, 38, 38, 37, 36, 35, 35, 34,
- 33, 33, 32, 32, 32, 32, 61, 62, 63, 64, 66, 62, 58, 55, 51, 49, 47, 45,
- 43, 42, 41, 40, 39, 39, 38, 37, 36, 36, 35, 35, 34, 33, 33, 32, 32, 32,
- 32, 32, 58, 59, 60, 62, 63, 60, 56, 53, 50, 48, 46, 44, 42, 41, 40, 39,
- 38, 38, 37, 36, 36, 35, 34, 34, 33, 33, 32, 32, 31, 31, 31, 31, 55, 56,
- 57, 59, 60, 57, 54, 51, 49, 47, 45, 43, 41, 40, 39, 38, 37, 37, 36, 35,
- 35, 34, 34, 33, 33, 32, 32, 31, 31, 31, 31, 31, 52, 53, 55, 56, 57, 55,
- 52, 50, 47, 46, 44, 42, 40, 39, 38, 37, 37, 36, 35, 35, 34, 34, 33, 33,
- 32, 32, 31, 31, 31, 31, 31, 31, 49, 50, 52, 53, 55, 52, 50, 48, 46, 44,
- 43, 41, 39, 38, 37, 37, 36, 35, 34, 34, 33, 33, 32, 32, 32, 31, 31, 31,
- 30, 30, 30, 30, 47, 48, 50, 51, 52, 50, 49, 47, 45, 43, 42, 40, 39, 38,
- 37, 36, 35, 34, 34, 33, 33, 32, 32, 32, 31, 31, 31, 30, 30, 30, 30, 30,
- 45, 46, 48, 49, 50, 48, 47, 45, 43, 42, 41, 39, 38, 37, 36, 35, 34, 34,
- 33, 33, 32, 32, 31, 31, 31, 30, 30, 30, 30, 30, 30, 30, 43, 44, 46, 47,
- 48, 47, 45, 44, 42, 41, 40, 38, 37, 36, 35, 35, 34, 33, 33, 32, 32, 31,
- 31, 31, 30, 30, 30, 29, 29, 29, 29, 29, 41, 42, 43, 45, 46, 45, 43, 42,
- 41, 40, 39, 38, 36, 36, 35, 34, 33, 33, 32, 32, 31, 31, 31, 30, 30, 30,
- 29, 29, 29, 29, 29, 29, 40, 41, 42, 43, 44, 43, 42, 41, 40, 39, 38, 37,
- 36, 35, 34, 34, 33, 32, 32, 31, 31, 31, 30, 30, 30, 29, 29, 29, 29, 29,
- 29, 29, 39, 40, 41, 42, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 34, 33,
- 32, 32, 31, 31, 31, 30, 30, 30, 29, 29, 29, 29, 28, 28, 28, 28, 37, 38,
- 39, 40, 41, 40, 39, 39, 38, 37, 36, 35, 35, 34, 33, 33, 32, 32, 31, 31,
- 30, 30, 30, 29, 29, 29, 29, 28, 28, 28, 28, 28, 36, 37, 38, 39, 40, 39,
- 38, 38, 37, 36, 35, 35, 34, 33, 33, 32, 32, 31, 31, 30, 30, 30, 29, 29,
- 29, 29, 28, 28, 28, 28, 28, 28, 35, 36, 37, 38, 38, 38, 37, 37, 36, 35,
- 35, 34, 33, 33, 32, 32, 31, 31, 30, 30, 30, 29, 29, 29, 29, 28, 28, 28,
- 28, 28, 28, 28, 34, 35, 36, 37, 37, 37, 36, 36, 35, 35, 34, 33, 33, 32,
- 32, 31, 31, 31, 30, 30, 29, 29, 29, 29, 28, 28, 28, 28, 28, 28, 28, 28,
- 33, 34, 35, 36, 36, 36, 35, 35, 35, 34, 33, 33, 32, 32, 31, 31, 31, 30,
- 30, 29, 29, 29, 29, 28, 28, 28, 28, 28, 27, 27, 27, 27, 33, 33, 34, 35,
- 35, 35, 34, 34, 34, 33, 33, 32, 32, 31, 31, 31, 30, 30, 30, 29, 29, 29,
- 28, 28, 28, 28, 28, 27, 27, 27, 27, 27, 33, 33, 34, 35, 35, 35, 34, 34,
- 34, 33, 33, 32, 32, 31, 31, 31, 30, 30, 30, 29, 29, 29, 28, 28, 28, 28,
- 28, 27, 27, 27, 27, 27, 33, 33, 34, 35, 35, 35, 34, 34, 34, 33, 33, 32,
- 32, 31, 31, 31, 30, 30, 30, 29, 29, 29, 28, 28, 28, 28, 28, 27, 27, 27,
- 27, 27, 33, 33, 34, 35, 35, 35, 34, 34, 34, 33, 33, 32, 32, 31, 31, 31,
- 30, 30, 30, 29, 29, 29, 28, 28, 28, 28, 28, 27, 27, 27, 27, 27 },
- { /* Intra matrices */
- /* Size 4 */
- 129, 119, 81, 60, 119, 86, 68, 56, 81, 68, 55, 49, 60, 56, 49, 45,
- /* Size 8 */
- 111, 141, 132, 105, 84, 70, 60, 54, 141, 125, 130, 114, 94, 78, 67, 59,
- 132, 130, 99, 88, 78, 69, 62, 56, 105, 114, 88, 74, 66, 61, 56, 53, 84,
- 94, 78, 66, 59, 55, 52, 50, 70, 78, 69, 61, 55, 52, 49, 47, 60, 67, 62,
- 56, 52, 49, 47, 46, 54, 59, 56, 53, 50, 47, 46, 44,
- /* Size 16 */
- 114, 129, 144, 140, 135, 122, 108, 97, 86, 79, 71, 67, 62, 59, 55, 55,
- 129, 133, 137, 135, 134, 123, 113, 102, 91, 84, 76, 70, 65, 62, 58, 58,
- 144, 137, 129, 131, 134, 125, 117, 107, 96, 88, 80, 74, 68, 64, 60, 60,
- 140, 135, 131, 124, 118, 111, 104, 96, 88, 82, 76, 71, 66, 62, 59, 59,
- 135, 134, 134, 118, 102, 96, 90, 85, 80, 76, 71, 67, 63, 60, 58, 58,
- 122, 123, 125, 111, 96, 89, 83, 79, 74, 71, 67, 64, 61, 58, 56, 56, 108,
- 113, 117, 104, 90, 83, 76, 72, 68, 65, 63, 60, 58, 56, 54, 54, 97, 102,
- 107, 96, 85, 79, 72, 68, 65, 62, 60, 58, 56, 54, 53, 53, 86, 91, 96, 88,
- 80, 74, 68, 65, 61, 59, 57, 55, 54, 52, 51, 51, 79, 84, 88, 82, 76, 71,
- 65, 62, 59, 57, 55, 53, 52, 51, 50, 50, 71, 76, 80, 76, 71, 67, 63, 60,
- 57, 55, 53, 52, 50, 50, 49, 49, 67, 70, 74, 71, 67, 64, 60, 58, 55, 53,
- 52, 51, 49, 49, 48, 48, 62, 65, 68, 66, 63, 61, 58, 56, 54, 52, 50, 49,
- 48, 48, 47, 47, 59, 62, 64, 62, 60, 58, 56, 54, 52, 51, 50, 49, 48, 47,
- 46, 46, 55, 58, 60, 59, 58, 56, 54, 53, 51, 50, 49, 48, 47, 46, 46, 46,
- 55, 58, 60, 59, 58, 56, 54, 53, 51, 50, 49, 48, 47, 46, 46, 46,
- /* Size 32 */
- 116, 123, 131, 139, 146, 144, 142, 139, 137, 130, 123, 116, 109, 104,
- 98, 93, 87, 84, 80, 76, 72, 70, 68, 65, 63, 61, 59, 58, 56, 56, 56, 56,
- 123, 128, 133, 138, 142, 141, 140, 138, 137, 130, 124, 118, 112, 106,
- 101, 95, 90, 86, 82, 78, 75, 72, 69, 67, 64, 63, 61, 59, 57, 57, 57, 57,
- 131, 133, 135, 137, 138, 138, 137, 137, 136, 131, 125, 120, 114, 109,
- 103, 98, 93, 89, 85, 81, 77, 74, 71, 69, 66, 64, 62, 61, 59, 59, 59, 59,
- 139, 138, 137, 136, 134, 135, 135, 135, 136, 131, 126, 121, 116, 111,
- 106, 100, 95, 91, 87, 83, 79, 76, 73, 71, 68, 66, 64, 62, 60, 60, 60,
- 60, 146, 142, 138, 134, 130, 132, 133, 134, 135, 131, 127, 123, 119,
- 113, 108, 103, 98, 94, 89, 85, 81, 78, 75, 72, 69, 67, 65, 63, 61, 61,
- 61, 61, 144, 141, 138, 135, 132, 131, 129, 128, 127, 123, 120, 116, 112,
- 107, 103, 98, 94, 90, 86, 83, 79, 76, 73, 71, 68, 66, 64, 62, 61, 61,
- 61, 61, 142, 140, 137, 135, 133, 129, 126, 123, 119, 116, 112, 109, 105,
- 101, 97, 93, 90, 86, 83, 80, 77, 74, 72, 69, 67, 65, 63, 62, 60, 60, 60,
- 60, 139, 138, 137, 135, 134, 128, 123, 117, 111, 108, 105, 101, 98, 95,
- 92, 89, 86, 83, 80, 77, 74, 72, 70, 68, 66, 64, 62, 61, 59, 59, 59, 59,
- 137, 137, 136, 136, 135, 127, 119, 111, 103, 100, 97, 94, 91, 89, 86,
- 84, 81, 79, 77, 74, 72, 70, 68, 66, 64, 63, 61, 60, 58, 58, 58, 58, 130,
- 130, 131, 131, 131, 123, 116, 108, 100, 97, 94, 91, 88, 85, 83, 81, 78,
- 76, 74, 72, 70, 68, 66, 65, 63, 62, 60, 59, 57, 57, 57, 57, 123, 124,
- 125, 126, 127, 120, 112, 105, 97, 94, 91, 87, 84, 82, 80, 77, 75, 73,
- 71, 70, 68, 66, 65, 63, 61, 60, 59, 58, 57, 57, 57, 57, 116, 118, 120,
- 121, 123, 116, 109, 101, 94, 91, 87, 84, 80, 78, 76, 74, 72, 71, 69, 67,
- 66, 64, 63, 61, 60, 59, 58, 57, 56, 56, 56, 56, 109, 112, 114, 116, 119,
- 112, 105, 98, 91, 88, 84, 80, 77, 75, 73, 71, 69, 68, 66, 65, 63, 62,
- 61, 60, 59, 58, 57, 56, 55, 55, 55, 55, 104, 106, 109, 111, 113, 107,
- 101, 95, 89, 85, 82, 78, 75, 73, 71, 69, 67, 66, 65, 63, 62, 61, 60, 59,
- 58, 57, 56, 55, 54, 54, 54, 54, 98, 101, 103, 106, 108, 103, 97, 92, 86,
- 83, 80, 76, 73, 71, 69, 67, 65, 64, 63, 62, 60, 59, 58, 57, 56, 56, 55,
- 54, 53, 53, 53, 53, 93, 95, 98, 100, 103, 98, 93, 89, 84, 81, 77, 74,
- 71, 69, 67, 65, 64, 62, 61, 60, 59, 58, 57, 56, 55, 55, 54, 53, 52, 52,
- 52, 52, 87, 90, 93, 95, 98, 94, 90, 86, 81, 78, 75, 72, 69, 67, 65, 64,
- 62, 61, 60, 59, 57, 57, 56, 55, 54, 54, 53, 52, 52, 52, 52, 52, 84, 86,
- 89, 91, 94, 90, 86, 83, 79, 76, 73, 71, 68, 66, 64, 62, 61, 60, 59, 58,
- 56, 56, 55, 54, 53, 53, 52, 52, 51, 51, 51, 51, 80, 82, 85, 87, 89, 86,
- 83, 80, 77, 74, 71, 69, 66, 65, 63, 61, 60, 59, 58, 57, 56, 55, 54, 53,
- 53, 52, 52, 51, 50, 50, 50, 50, 76, 78, 81, 83, 85, 83, 80, 77, 74, 72,
- 70, 67, 65, 63, 62, 60, 59, 58, 57, 56, 55, 54, 53, 53, 52, 51, 51, 50,
- 50, 50, 50, 50, 72, 75, 77, 79, 81, 79, 77, 74, 72, 70, 68, 66, 63, 62,
- 60, 59, 57, 56, 56, 55, 54, 53, 52, 52, 51, 51, 50, 50, 49, 49, 49, 49,
- 70, 72, 74, 76, 78, 76, 74, 72, 70, 68, 66, 64, 62, 61, 59, 58, 57, 56,
- 55, 54, 53, 52, 52, 51, 51, 50, 50, 49, 49, 49, 49, 49, 68, 69, 71, 73,
- 75, 73, 72, 70, 68, 66, 65, 63, 61, 60, 58, 57, 56, 55, 54, 53, 52, 52,
- 51, 51, 50, 50, 49, 49, 48, 48, 48, 48, 65, 67, 69, 71, 72, 71, 69, 68,
- 66, 65, 63, 61, 60, 59, 57, 56, 55, 54, 53, 53, 52, 51, 51, 50, 50, 49,
- 49, 48, 48, 48, 48, 48, 63, 64, 66, 68, 69, 68, 67, 66, 64, 63, 61, 60,
- 59, 58, 56, 55, 54, 53, 53, 52, 51, 51, 50, 50, 49, 49, 48, 48, 47, 47,
- 47, 47, 61, 63, 64, 66, 67, 66, 65, 64, 63, 62, 60, 59, 58, 57, 56, 55,
- 54, 53, 52, 51, 51, 50, 50, 49, 49, 48, 48, 48, 47, 47, 47, 47, 59, 61,
- 62, 64, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 52, 51,
- 50, 50, 49, 49, 48, 48, 48, 47, 47, 47, 47, 47, 58, 59, 61, 62, 63, 62,
- 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 52, 51, 50, 50, 49, 49, 48,
- 48, 48, 47, 47, 47, 47, 47, 47, 56, 57, 59, 60, 61, 61, 60, 59, 58, 57,
- 57, 56, 55, 54, 53, 52, 52, 51, 50, 50, 49, 49, 48, 48, 47, 47, 47, 47,
- 46, 46, 46, 46, 56, 57, 59, 60, 61, 61, 60, 59, 58, 57, 57, 56, 55, 54,
- 53, 52, 52, 51, 50, 50, 49, 49, 48, 48, 47, 47, 47, 47, 46, 46, 46, 46,
- 56, 57, 59, 60, 61, 61, 60, 59, 58, 57, 57, 56, 55, 54, 53, 52, 52, 51,
- 50, 50, 49, 49, 48, 48, 47, 47, 47, 47, 46, 46, 46, 46, 56, 57, 59, 60,
- 61, 61, 60, 59, 58, 57, 57, 56, 55, 54, 53, 52, 52, 51, 50, 50, 49, 49,
- 48, 48, 47, 47, 47, 47, 46, 46, 46, 46 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 45, 42, 36, 45, 40, 38, 35, 42, 38, 32, 30, 36, 35, 30, 27,
- /* Size 8 */
- 64, 76, 48, 46, 44, 41, 37, 35, 76, 57, 47, 51, 50, 46, 43, 39, 48, 47,
- 42, 43, 43, 42, 40, 37, 46, 51, 43, 40, 39, 38, 36, 35, 44, 50, 43, 39,
- 36, 34, 33, 32, 41, 46, 42, 38, 34, 33, 31, 30, 37, 43, 40, 36, 33, 31,
- 30, 29, 35, 39, 37, 35, 32, 30, 29, 28,
- /* Size 16 */
- 64, 70, 76, 62, 48, 47, 46, 45, 44, 42, 41, 39, 37, 36, 35, 35, 70, 68,
- 66, 57, 48, 48, 48, 48, 47, 45, 44, 42, 40, 39, 37, 37, 76, 66, 57, 52,
- 47, 49, 51, 50, 50, 48, 46, 45, 43, 41, 39, 39, 62, 57, 52, 48, 45, 46,
- 47, 47, 47, 45, 44, 43, 41, 40, 38, 38, 48, 48, 47, 45, 42, 43, 43, 43,
- 43, 43, 42, 41, 40, 38, 37, 37, 47, 48, 49, 46, 43, 42, 42, 41, 41, 40,
- 40, 39, 38, 37, 36, 36, 46, 48, 51, 47, 43, 42, 40, 39, 39, 38, 38, 37,
- 36, 35, 35, 35, 45, 48, 50, 47, 43, 41, 39, 38, 37, 37, 36, 35, 35, 34,
- 33, 33, 44, 47, 50, 47, 43, 41, 39, 37, 36, 35, 34, 34, 33, 33, 32, 32,
- 42, 45, 48, 45, 43, 40, 38, 37, 35, 34, 34, 33, 32, 32, 31, 31, 41, 44,
- 46, 44, 42, 40, 38, 36, 34, 34, 33, 32, 31, 31, 30, 30, 39, 42, 45, 43,
- 41, 39, 37, 35, 34, 33, 32, 31, 31, 30, 30, 30, 37, 40, 43, 41, 40, 38,
- 36, 35, 33, 32, 31, 31, 30, 29, 29, 29, 36, 39, 41, 40, 38, 37, 35, 34,
- 33, 32, 31, 30, 29, 29, 28, 28, 35, 37, 39, 38, 37, 36, 35, 33, 32, 31,
- 30, 30, 29, 28, 28, 28, 35, 37, 39, 38, 37, 36, 35, 33, 32, 31, 30, 30,
- 29, 28, 28, 28,
- /* Size 32 */
- 64, 67, 70, 73, 76, 69, 62, 55, 48, 47, 47, 46, 46, 45, 45, 44, 44, 43,
- 42, 41, 41, 40, 39, 38, 37, 37, 36, 35, 35, 35, 35, 35, 67, 68, 69, 70,
- 71, 65, 60, 54, 48, 48, 47, 47, 47, 47, 46, 46, 45, 44, 44, 43, 42, 41,
- 40, 40, 39, 38, 37, 37, 36, 36, 36, 36, 70, 69, 68, 67, 66, 62, 57, 52,
- 48, 48, 48, 48, 48, 48, 48, 47, 47, 46, 45, 44, 44, 43, 42, 41, 40, 39,
- 39, 38, 37, 37, 37, 37, 73, 70, 67, 65, 62, 58, 55, 51, 47, 48, 49, 49,
- 50, 49, 49, 49, 48, 47, 47, 46, 45, 44, 43, 42, 41, 41, 40, 39, 38, 38,
- 38, 38, 76, 71, 66, 62, 57, 54, 52, 50, 47, 48, 49, 50, 51, 51, 50, 50,
- 50, 49, 48, 47, 46, 46, 45, 44, 43, 42, 41, 40, 39, 39, 39, 39, 69, 65,
- 62, 58, 54, 52, 50, 48, 46, 47, 47, 48, 49, 49, 49, 48, 48, 47, 47, 46,
- 45, 44, 44, 43, 42, 41, 40, 39, 39, 39, 39, 39, 62, 60, 57, 55, 52, 50,
- 48, 47, 45, 45, 46, 46, 47, 47, 47, 47, 47, 46, 45, 45, 44, 43, 43, 42,
- 41, 40, 40, 39, 38, 38, 38, 38, 55, 54, 52, 51, 50, 48, 47, 45, 44, 44,
- 44, 45, 45, 45, 45, 45, 45, 45, 44, 44, 43, 42, 42, 41, 40, 40, 39, 38,
- 38, 38, 38, 38, 48, 48, 48, 47, 47, 46, 45, 44, 42, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 42, 42, 41, 41, 40, 40, 39, 38, 38, 37, 37, 37, 37,
- 47, 48, 48, 48, 48, 47, 45, 44, 43, 43, 43, 42, 42, 42, 42, 42, 42, 42,
- 42, 41, 41, 40, 40, 39, 39, 38, 38, 37, 36, 36, 36, 36, 47, 47, 48, 49,
- 49, 47, 46, 44, 43, 43, 42, 42, 42, 41, 41, 41, 41, 41, 40, 40, 40, 39,
- 39, 38, 38, 37, 37, 36, 36, 36, 36, 36, 46, 47, 48, 49, 50, 48, 46, 45,
- 43, 42, 42, 41, 41, 40, 40, 40, 40, 40, 39, 39, 39, 38, 38, 37, 37, 37,
- 36, 36, 35, 35, 35, 35, 46, 47, 48, 50, 51, 49, 47, 45, 43, 42, 42, 41,
- 40, 40, 39, 39, 39, 38, 38, 38, 38, 37, 37, 37, 36, 36, 35, 35, 35, 35,
- 35, 35, 45, 47, 48, 49, 51, 49, 47, 45, 43, 42, 41, 40, 40, 39, 39, 38,
- 38, 38, 37, 37, 37, 36, 36, 36, 35, 35, 35, 34, 34, 34, 34, 34, 45, 46,
- 48, 49, 50, 49, 47, 45, 43, 42, 41, 40, 39, 39, 38, 38, 37, 37, 37, 36,
- 36, 36, 35, 35, 35, 34, 34, 34, 33, 33, 33, 33, 44, 46, 47, 49, 50, 48,
- 47, 45, 43, 42, 41, 40, 39, 38, 38, 37, 37, 36, 36, 36, 35, 35, 35, 34,
- 34, 34, 33, 33, 33, 33, 33, 33, 44, 45, 47, 48, 50, 48, 47, 45, 43, 42,
- 41, 40, 39, 38, 37, 37, 36, 36, 35, 35, 34, 34, 34, 34, 33, 33, 33, 32,
- 32, 32, 32, 32, 43, 44, 46, 47, 49, 47, 46, 45, 43, 42, 41, 40, 38, 38,
- 37, 36, 36, 35, 35, 34, 34, 34, 33, 33, 33, 33, 32, 32, 32, 32, 32, 32,
- 42, 44, 45, 47, 48, 47, 45, 44, 43, 42, 40, 39, 38, 37, 37, 36, 35, 35,
- 34, 34, 34, 33, 33, 33, 32, 32, 32, 32, 31, 31, 31, 31, 41, 43, 44, 46,
- 47, 46, 45, 44, 42, 41, 40, 39, 38, 37, 36, 36, 35, 34, 34, 33, 33, 33,
- 32, 32, 32, 32, 31, 31, 31, 31, 31, 31, 41, 42, 44, 45, 46, 45, 44, 43,
- 42, 41, 40, 39, 38, 37, 36, 35, 34, 34, 34, 33, 33, 32, 32, 32, 31, 31,
- 31, 31, 30, 30, 30, 30, 40, 41, 43, 44, 46, 44, 43, 42, 41, 40, 39, 38,
- 37, 36, 36, 35, 34, 34, 33, 33, 32, 32, 32, 31, 31, 31, 30, 30, 30, 30,
- 30, 30, 39, 40, 42, 43, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 35,
- 34, 33, 33, 32, 32, 32, 31, 31, 31, 30, 30, 30, 30, 30, 30, 30, 38, 40,
- 41, 42, 44, 43, 42, 41, 40, 39, 38, 37, 37, 36, 35, 34, 34, 33, 33, 32,
- 32, 31, 31, 31, 30, 30, 30, 30, 29, 29, 29, 29, 37, 39, 40, 41, 43, 42,
- 41, 40, 40, 39, 38, 37, 36, 35, 35, 34, 33, 33, 32, 32, 31, 31, 31, 30,
- 30, 30, 29, 29, 29, 29, 29, 29, 37, 38, 39, 41, 42, 41, 40, 40, 39, 38,
- 37, 37, 36, 35, 34, 34, 33, 33, 32, 32, 31, 31, 30, 30, 30, 29, 29, 29,
- 29, 29, 29, 29, 36, 37, 39, 40, 41, 40, 40, 39, 38, 38, 37, 36, 35, 35,
- 34, 33, 33, 32, 32, 31, 31, 30, 30, 30, 29, 29, 29, 29, 28, 28, 28, 28,
- 35, 37, 38, 39, 40, 39, 39, 38, 38, 37, 36, 36, 35, 34, 34, 33, 32, 32,
- 32, 31, 31, 30, 30, 30, 29, 29, 29, 28, 28, 28, 28, 28, 35, 36, 37, 38,
- 39, 39, 38, 38, 37, 36, 36, 35, 35, 34, 33, 33, 32, 32, 31, 31, 30, 30,
- 30, 29, 29, 29, 28, 28, 28, 28, 28, 28, 35, 36, 37, 38, 39, 39, 38, 38,
- 37, 36, 36, 35, 35, 34, 33, 33, 32, 32, 31, 31, 30, 30, 30, 29, 29, 29,
- 28, 28, 28, 28, 28, 28, 35, 36, 37, 38, 39, 39, 38, 38, 37, 36, 36, 35,
- 35, 34, 33, 33, 32, 32, 31, 31, 30, 30, 30, 29, 29, 29, 28, 28, 28, 28,
- 28, 28, 35, 36, 37, 38, 39, 39, 38, 38, 37, 36, 36, 35, 35, 34, 33, 33,
- 32, 32, 31, 31, 30, 30, 30, 29, 29, 29, 28, 28, 28, 28, 28, 28 },
- { /* Intra matrices */
- /* Size 4 */
- 117, 81, 76, 64, 81, 71, 67, 61, 76, 67, 57, 52, 64, 61, 52, 47,
- /* Size 8 */
- 110, 131, 81, 77, 74, 68, 62, 57, 131, 97, 80, 86, 84, 78, 72, 65, 81,
- 80, 71, 73, 73, 70, 66, 62, 77, 86, 73, 67, 64, 63, 60, 57, 74, 84, 73,
- 64, 60, 57, 55, 53, 68, 78, 70, 63, 57, 54, 51, 50, 62, 72, 66, 60, 55,
- 51, 49, 47, 57, 65, 62, 57, 53, 50, 47, 45,
- /* Size 16 */
- 112, 123, 134, 108, 83, 81, 79, 77, 75, 72, 69, 66, 64, 61, 59, 59, 123,
- 120, 116, 99, 82, 83, 83, 82, 81, 78, 75, 71, 68, 65, 63, 63, 134, 116,
- 99, 90, 81, 85, 88, 87, 86, 83, 80, 77, 73, 70, 67, 67, 108, 99, 90, 84,
- 77, 79, 81, 81, 80, 78, 76, 73, 70, 68, 65, 65, 83, 82, 81, 77, 72, 73,
- 74, 74, 74, 73, 72, 70, 67, 65, 63, 63, 81, 83, 85, 79, 73, 72, 71, 71,
- 70, 69, 68, 66, 64, 62, 61, 61, 79, 83, 88, 81, 74, 71, 68, 67, 66, 65,
- 64, 62, 61, 60, 58, 58, 77, 82, 87, 81, 74, 71, 67, 65, 63, 62, 61, 60,
- 59, 57, 56, 56, 75, 81, 86, 80, 74, 70, 66, 63, 61, 59, 58, 57, 56, 55,
- 54, 54, 72, 78, 83, 78, 73, 69, 65, 62, 59, 58, 56, 55, 54, 53, 52, 52,
- 69, 75, 80, 76, 72, 68, 64, 61, 58, 56, 55, 54, 52, 51, 51, 51, 66, 71,
- 77, 73, 70, 66, 62, 60, 57, 55, 54, 52, 51, 50, 49, 49, 64, 68, 73, 70,
- 67, 64, 61, 59, 56, 54, 52, 51, 50, 49, 48, 48, 61, 65, 70, 68, 65, 62,
- 60, 57, 55, 53, 51, 50, 49, 48, 47, 47, 59, 63, 67, 65, 63, 61, 58, 56,
- 54, 52, 51, 49, 48, 47, 46, 46, 59, 63, 67, 65, 63, 61, 58, 56, 54, 52,
- 51, 49, 48, 47, 46, 46,
- /* Size 32 */
- 113, 119, 124, 130, 135, 122, 109, 96, 83, 82, 82, 81, 80, 79, 78, 77,
- 76, 74, 73, 71, 70, 69, 67, 66, 64, 63, 62, 60, 59, 59, 59, 59, 119,
- 121, 123, 124, 126, 116, 105, 94, 83, 83, 83, 82, 82, 81, 80, 79, 79,
- 77, 76, 74, 73, 71, 70, 68, 67, 65, 64, 63, 61, 61, 61, 61, 124, 123,
- 121, 119, 118, 109, 100, 91, 83, 83, 84, 84, 84, 84, 83, 82, 81, 80, 78,
- 77, 75, 74, 72, 71, 69, 68, 66, 65, 63, 63, 63, 63, 130, 124, 119, 114,
- 109, 102, 96, 89, 83, 84, 84, 85, 86, 86, 85, 85, 84, 83, 81, 80, 78,
- 76, 75, 73, 71, 70, 68, 67, 65, 65, 65, 65, 135, 126, 118, 109, 100, 95,
- 91, 87, 82, 84, 85, 87, 89, 88, 88, 87, 87, 85, 84, 82, 81, 79, 77, 76,
- 74, 72, 71, 69, 67, 67, 67, 67, 122, 116, 109, 102, 95, 92, 88, 84, 80,
- 81, 83, 84, 85, 85, 85, 84, 84, 83, 81, 80, 79, 77, 76, 74, 72, 71, 69,
- 68, 66, 66, 66, 66, 109, 105, 100, 96, 91, 88, 84, 81, 78, 79, 80, 81,
- 82, 82, 81, 81, 81, 80, 79, 78, 77, 75, 74, 72, 71, 70, 68, 67, 65, 65,
- 65, 65, 96, 94, 91, 89, 87, 84, 81, 78, 75, 76, 77, 78, 78, 78, 78, 78,
- 78, 77, 76, 75, 74, 73, 72, 71, 70, 68, 67, 66, 65, 65, 65, 65, 83, 83,
- 83, 83, 82, 80, 78, 75, 73, 74, 74, 75, 75, 75, 75, 75, 75, 74, 74, 73,
- 72, 71, 70, 69, 68, 67, 66, 65, 64, 64, 64, 64, 82, 83, 83, 84, 84, 81,
- 79, 76, 74, 74, 73, 73, 73, 73, 73, 73, 73, 72, 72, 71, 70, 69, 68, 68,
- 67, 66, 64, 63, 62, 62, 62, 62, 82, 83, 84, 84, 85, 83, 80, 77, 74, 73,
- 73, 72, 72, 72, 71, 71, 71, 70, 70, 69, 68, 68, 67, 66, 65, 64, 63, 62,
- 61, 61, 61, 61, 81, 82, 84, 85, 87, 84, 81, 78, 75, 73, 72, 71, 70, 70,
- 69, 69, 69, 68, 67, 67, 66, 66, 65, 64, 63, 63, 62, 61, 60, 60, 60, 60,
- 80, 82, 84, 86, 89, 85, 82, 78, 75, 73, 72, 70, 69, 68, 67, 67, 66, 66,
- 65, 65, 64, 64, 63, 62, 62, 61, 60, 60, 59, 59, 59, 59, 79, 81, 84, 86,
- 88, 85, 82, 78, 75, 73, 72, 70, 68, 67, 67, 66, 65, 65, 64, 63, 63, 62,
- 62, 61, 60, 60, 59, 58, 58, 58, 58, 58, 78, 80, 83, 85, 88, 85, 81, 78,
- 75, 73, 71, 69, 67, 67, 66, 65, 64, 63, 63, 62, 62, 61, 60, 60, 59, 59,
- 58, 57, 57, 57, 57, 57, 77, 79, 82, 85, 87, 84, 81, 78, 75, 73, 71, 69,
- 67, 66, 65, 64, 63, 62, 61, 61, 60, 60, 59, 58, 58, 57, 57, 56, 56, 56,
- 56, 56, 76, 79, 81, 84, 87, 84, 81, 78, 75, 73, 71, 69, 66, 65, 64, 63,
- 61, 61, 60, 59, 59, 58, 58, 57, 57, 56, 56, 55, 54, 54, 54, 54, 74, 77,
- 80, 83, 85, 83, 80, 77, 74, 72, 70, 68, 66, 65, 63, 62, 61, 60, 59, 59,
- 58, 57, 57, 56, 56, 55, 55, 54, 54, 54, 54, 54, 73, 76, 78, 81, 84, 81,
- 79, 76, 74, 72, 70, 67, 65, 64, 63, 61, 60, 59, 59, 58, 57, 56, 56, 55,
- 55, 54, 54, 53, 53, 53, 53, 53, 71, 74, 77, 80, 82, 80, 78, 75, 73, 71,
- 69, 67, 65, 63, 62, 61, 59, 59, 58, 57, 56, 56, 55, 54, 54, 53, 53, 52,
- 52, 52, 52, 52, 70, 73, 75, 78, 81, 79, 77, 74, 72, 70, 68, 66, 64, 63,
- 62, 60, 59, 58, 57, 56, 55, 55, 54, 53, 53, 52, 52, 51, 51, 51, 51, 51,
- 69, 71, 74, 76, 79, 77, 75, 73, 71, 69, 68, 66, 64, 62, 61, 60, 58, 57,
- 56, 56, 55, 54, 53, 53, 52, 52, 51, 51, 50, 50, 50, 50, 67, 70, 72, 75,
- 77, 76, 74, 72, 70, 68, 67, 65, 63, 62, 60, 59, 58, 57, 56, 55, 54, 53,
- 53, 52, 52, 51, 51, 50, 50, 50, 50, 50, 66, 68, 71, 73, 76, 74, 72, 71,
- 69, 68, 66, 64, 62, 61, 60, 58, 57, 56, 55, 54, 53, 53, 52, 52, 51, 51,
- 50, 50, 49, 49, 49, 49, 64, 67, 69, 71, 74, 72, 71, 70, 68, 67, 65, 63,
- 62, 60, 59, 58, 57, 56, 55, 54, 53, 52, 52, 51, 50, 50, 49, 49, 49, 49,
- 49, 49, 63, 65, 68, 70, 72, 71, 70, 68, 67, 66, 64, 63, 61, 60, 59, 57,
- 56, 55, 54, 53, 52, 52, 51, 51, 50, 49, 49, 49, 48, 48, 48, 48, 62, 64,
- 66, 68, 71, 69, 68, 67, 66, 64, 63, 62, 60, 59, 58, 57, 56, 55, 54, 53,
- 52, 51, 51, 50, 49, 49, 49, 48, 48, 48, 48, 48, 60, 63, 65, 67, 69, 68,
- 67, 66, 65, 63, 62, 61, 60, 58, 57, 56, 55, 54, 53, 52, 51, 51, 50, 50,
- 49, 49, 48, 48, 47, 47, 47, 47, 59, 61, 63, 65, 67, 66, 65, 65, 64, 62,
- 61, 60, 59, 58, 57, 56, 54, 54, 53, 52, 51, 50, 50, 49, 49, 48, 48, 47,
- 47, 47, 47, 47, 59, 61, 63, 65, 67, 66, 65, 65, 64, 62, 61, 60, 59, 58,
- 57, 56, 54, 54, 53, 52, 51, 50, 50, 49, 49, 48, 48, 47, 47, 47, 47, 47,
- 59, 61, 63, 65, 67, 66, 65, 65, 64, 62, 61, 60, 59, 58, 57, 56, 54, 54,
- 53, 52, 51, 50, 50, 49, 49, 48, 48, 47, 47, 47, 47, 47, 59, 61, 63, 65,
- 67, 66, 65, 65, 64, 62, 61, 60, 59, 58, 57, 56, 54, 54, 53, 52, 51, 50,
- 50, 49, 49, 48, 48, 47, 47, 47, 47, 47 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 60, 43, 33, 60, 45, 37, 32, 43, 37, 31, 29, 33, 32, 29, 27,
- /* Size 8 */
- 64, 79, 74, 61, 50, 43, 38, 35, 79, 71, 73, 66, 55, 47, 42, 38, 74, 73,
- 58, 52, 48, 43, 39, 36, 61, 66, 52, 45, 42, 39, 37, 35, 50, 55, 48, 42,
- 38, 36, 34, 33, 43, 47, 43, 39, 36, 34, 33, 32, 38, 42, 39, 37, 34, 33,
- 32, 31, 35, 38, 36, 35, 33, 32, 31, 31,
- /* Size 16 */
- 64, 71, 79, 77, 74, 68, 61, 56, 50, 47, 43, 41, 38, 37, 35, 35, 71, 73,
- 75, 74, 74, 69, 63, 58, 53, 49, 45, 43, 40, 38, 37, 37, 79, 75, 71, 72,
- 73, 70, 66, 60, 55, 51, 47, 45, 42, 40, 38, 38, 77, 74, 72, 69, 66, 62,
- 59, 55, 51, 48, 45, 43, 40, 39, 37, 37, 74, 74, 73, 66, 58, 55, 52, 50,
- 48, 45, 43, 41, 39, 38, 36, 36, 68, 69, 70, 62, 55, 52, 49, 47, 45, 43,
- 41, 39, 38, 37, 36, 36, 61, 63, 66, 59, 52, 49, 45, 43, 42, 40, 39, 38,
- 37, 36, 35, 35, 56, 58, 60, 55, 50, 47, 43, 42, 40, 39, 37, 36, 35, 35,
- 34, 34, 50, 53, 55, 51, 48, 45, 42, 40, 38, 37, 36, 35, 34, 34, 33, 33,
- 47, 49, 51, 48, 45, 43, 40, 39, 37, 36, 35, 34, 34, 33, 33, 33, 43, 45,
- 47, 45, 43, 41, 39, 37, 36, 35, 34, 33, 33, 32, 32, 32, 41, 43, 45, 43,
- 41, 39, 38, 36, 35, 34, 33, 33, 32, 32, 32, 32, 38, 40, 42, 40, 39, 38,
- 37, 35, 34, 34, 33, 32, 32, 31, 31, 31, 37, 38, 40, 39, 38, 37, 36, 35,
- 34, 33, 32, 32, 31, 31, 31, 31, 35, 37, 38, 37, 36, 36, 35, 34, 33, 33,
- 32, 32, 31, 31, 31, 31, 35, 37, 38, 37, 36, 36, 35, 34, 33, 33, 32, 32,
- 31, 31, 31, 31,
- /* Size 32 */
- 64, 68, 71, 75, 79, 78, 77, 75, 74, 71, 68, 64, 61, 58, 56, 53, 50, 49,
- 47, 45, 43, 42, 41, 40, 38, 38, 37, 36, 35, 35, 35, 35, 68, 70, 72, 75,
- 77, 76, 76, 75, 74, 71, 68, 65, 62, 59, 57, 54, 52, 50, 48, 46, 44, 43,
- 42, 40, 39, 38, 38, 37, 36, 36, 36, 36, 71, 72, 73, 74, 75, 75, 74, 74,
- 74, 71, 69, 66, 63, 61, 58, 55, 53, 51, 49, 47, 45, 44, 43, 41, 40, 39,
- 38, 37, 37, 37, 37, 37, 75, 75, 74, 74, 73, 73, 73, 74, 74, 71, 69, 67,
- 64, 62, 59, 57, 54, 52, 50, 48, 46, 45, 44, 42, 41, 40, 39, 38, 37, 37,
- 37, 37, 79, 77, 75, 73, 71, 72, 72, 73, 73, 72, 70, 68, 66, 63, 60, 58,
- 55, 53, 51, 49, 47, 46, 45, 43, 42, 41, 40, 39, 38, 38, 38, 38, 78, 76,
- 75, 73, 72, 71, 71, 70, 70, 68, 66, 64, 62, 60, 58, 56, 53, 52, 50, 48,
- 46, 45, 44, 42, 41, 40, 39, 38, 37, 37, 37, 37, 77, 76, 74, 73, 72, 71,
- 69, 67, 66, 64, 62, 61, 59, 57, 55, 53, 51, 50, 48, 47, 45, 44, 43, 42,
- 40, 40, 39, 38, 37, 37, 37, 37, 75, 75, 74, 74, 73, 70, 67, 65, 62, 60,
- 59, 57, 56, 54, 53, 51, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37,
- 37, 37, 37, 37, 74, 74, 74, 74, 73, 70, 66, 62, 58, 56, 55, 54, 52, 51,
- 50, 49, 48, 46, 45, 44, 43, 42, 41, 40, 39, 39, 38, 37, 36, 36, 36, 36,
- 71, 71, 71, 71, 72, 68, 64, 60, 56, 55, 54, 52, 51, 49, 48, 47, 46, 45,
- 44, 43, 42, 41, 40, 39, 39, 38, 37, 37, 36, 36, 36, 36, 68, 68, 69, 69,
- 70, 66, 62, 59, 55, 54, 52, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40,
- 39, 39, 38, 37, 37, 36, 36, 36, 36, 36, 64, 65, 66, 67, 68, 64, 61, 57,
- 54, 52, 50, 49, 47, 46, 45, 44, 43, 42, 41, 41, 40, 39, 39, 38, 37, 37,
- 36, 36, 35, 35, 35, 35, 61, 62, 63, 64, 66, 62, 59, 56, 52, 51, 49, 47,
- 45, 44, 43, 42, 42, 41, 40, 39, 39, 38, 38, 37, 37, 36, 36, 35, 35, 35,
- 35, 35, 58, 59, 61, 62, 63, 60, 57, 54, 51, 49, 48, 46, 44, 43, 42, 42,
- 41, 40, 39, 39, 38, 38, 37, 37, 36, 36, 35, 35, 34, 34, 34, 34, 56, 57,
- 58, 59, 60, 58, 55, 53, 50, 48, 47, 45, 43, 42, 42, 41, 40, 39, 39, 38,
- 37, 37, 36, 36, 35, 35, 35, 34, 34, 34, 34, 34, 53, 54, 55, 57, 58, 56,
- 53, 51, 49, 47, 46, 44, 42, 42, 41, 40, 39, 38, 38, 37, 37, 36, 36, 35,
- 35, 35, 34, 34, 34, 34, 34, 34, 50, 52, 53, 54, 55, 53, 51, 49, 48, 46,
- 45, 43, 42, 41, 40, 39, 38, 38, 37, 36, 36, 36, 35, 35, 34, 34, 34, 33,
- 33, 33, 33, 33, 49, 50, 51, 52, 53, 52, 50, 48, 46, 45, 44, 42, 41, 40,
- 39, 38, 38, 37, 36, 36, 35, 35, 35, 34, 34, 34, 33, 33, 33, 33, 33, 33,
- 47, 48, 49, 50, 51, 50, 48, 47, 45, 44, 43, 41, 40, 39, 39, 38, 37, 36,
- 36, 36, 35, 35, 34, 34, 34, 33, 33, 33, 33, 33, 33, 33, 45, 46, 47, 48,
- 49, 48, 47, 45, 44, 43, 42, 41, 39, 39, 38, 37, 36, 36, 36, 35, 35, 34,
- 34, 34, 33, 33, 33, 33, 32, 32, 32, 32, 43, 44, 45, 46, 47, 46, 45, 44,
- 43, 42, 41, 40, 39, 38, 37, 37, 36, 35, 35, 35, 34, 34, 33, 33, 33, 33,
- 32, 32, 32, 32, 32, 32, 42, 43, 44, 45, 46, 45, 44, 43, 42, 41, 40, 39,
- 38, 38, 37, 36, 36, 35, 35, 34, 34, 33, 33, 33, 33, 32, 32, 32, 32, 32,
- 32, 32, 41, 42, 43, 44, 45, 44, 43, 42, 41, 40, 39, 39, 38, 37, 36, 36,
- 35, 35, 34, 34, 33, 33, 33, 33, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40,
- 41, 42, 43, 42, 42, 41, 40, 39, 39, 38, 37, 37, 36, 35, 35, 34, 34, 34,
- 33, 33, 33, 32, 32, 32, 32, 32, 31, 31, 31, 31, 38, 39, 40, 41, 42, 41,
- 40, 40, 39, 39, 38, 37, 37, 36, 35, 35, 34, 34, 34, 33, 33, 33, 32, 32,
- 32, 32, 31, 31, 31, 31, 31, 31, 38, 38, 39, 40, 41, 40, 40, 39, 39, 38,
- 37, 37, 36, 36, 35, 35, 34, 34, 33, 33, 33, 32, 32, 32, 32, 31, 31, 31,
- 31, 31, 31, 31, 37, 38, 38, 39, 40, 39, 39, 38, 38, 37, 37, 36, 36, 35,
- 35, 34, 34, 33, 33, 33, 32, 32, 32, 32, 31, 31, 31, 31, 31, 31, 31, 31,
- 36, 37, 37, 38, 39, 38, 38, 37, 37, 37, 36, 36, 35, 35, 34, 34, 33, 33,
- 33, 33, 32, 32, 32, 32, 31, 31, 31, 31, 31, 31, 31, 31, 35, 36, 37, 37,
- 38, 37, 37, 37, 36, 36, 36, 35, 35, 34, 34, 34, 33, 33, 33, 32, 32, 32,
- 32, 31, 31, 31, 31, 31, 31, 31, 31, 31, 35, 36, 37, 37, 38, 37, 37, 37,
- 36, 36, 36, 35, 35, 34, 34, 34, 33, 33, 33, 32, 32, 32, 32, 31, 31, 31,
- 31, 31, 31, 31, 31, 31, 35, 36, 37, 37, 38, 37, 37, 37, 36, 36, 36, 35,
- 35, 34, 34, 34, 33, 33, 33, 32, 32, 32, 32, 31, 31, 31, 31, 31, 31, 31,
- 31, 31, 35, 36, 37, 37, 38, 37, 37, 37, 36, 36, 36, 35, 35, 34, 34, 34,
- 33, 33, 33, 32, 32, 32, 32, 31, 31, 31, 31, 31, 31, 31, 31, 31 },
- { /* Intra matrices */
- /* Size 4 */
- 118, 110, 77, 59, 110, 82, 67, 57, 77, 67, 56, 51, 59, 57, 51, 47,
- /* Size 8 */
- 103, 128, 121, 98, 80, 68, 60, 55, 128, 115, 119, 106, 89, 75, 65, 59,
- 121, 119, 93, 83, 75, 68, 61, 56, 98, 106, 83, 71, 65, 61, 57, 54, 80,
- 89, 75, 65, 59, 56, 53, 51, 68, 75, 68, 61, 56, 53, 51, 49, 60, 65, 61,
- 57, 53, 51, 49, 48, 55, 59, 56, 54, 51, 49, 48, 47,
- /* Size 16 */
- 106, 118, 131, 127, 123, 112, 100, 91, 82, 76, 69, 65, 61, 59, 56, 56,
- 118, 122, 125, 124, 123, 113, 104, 95, 86, 80, 73, 69, 64, 61, 58, 58,
- 131, 125, 118, 120, 122, 115, 108, 99, 91, 84, 77, 72, 67, 64, 60, 60,
- 127, 124, 120, 114, 108, 103, 97, 90, 84, 78, 73, 69, 65, 62, 59, 59,
- 123, 123, 122, 108, 95, 90, 85, 81, 77, 73, 69, 66, 63, 60, 58, 58, 112,
- 113, 115, 103, 90, 85, 79, 76, 72, 69, 66, 63, 60, 58, 56, 56, 100, 104,
- 108, 97, 85, 79, 73, 70, 67, 64, 62, 60, 58, 56, 55, 55, 91, 95, 99, 90,
- 81, 76, 70, 67, 64, 62, 60, 58, 56, 55, 54, 54, 82, 86, 91, 84, 77, 72,
- 67, 64, 61, 59, 57, 56, 54, 53, 52, 52, 76, 80, 84, 78, 73, 69, 64, 62,
- 59, 57, 55, 54, 53, 52, 51, 51, 69, 73, 77, 73, 69, 66, 62, 60, 57, 55,
- 54, 53, 52, 51, 50, 50, 65, 69, 72, 69, 66, 63, 60, 58, 56, 54, 53, 52,
- 51, 50, 49, 49, 61, 64, 67, 65, 63, 60, 58, 56, 54, 53, 52, 51, 50, 49,
- 49, 49, 59, 61, 64, 62, 60, 58, 56, 55, 53, 52, 51, 50, 49, 49, 48, 48,
- 56, 58, 60, 59, 58, 56, 55, 54, 52, 51, 50, 49, 49, 48, 48, 48, 56, 58,
- 60, 59, 58, 56, 55, 54, 52, 51, 50, 49, 49, 48, 48, 48,
- /* Size 32 */
- 107, 113, 120, 126, 133, 131, 129, 127, 125, 119, 113, 107, 102, 97, 92,
- 88, 83, 80, 77, 73, 70, 68, 66, 64, 62, 61, 59, 58, 57, 57, 57, 57, 113,
- 117, 121, 125, 129, 128, 127, 126, 125, 119, 114, 109, 104, 99, 94, 90,
- 85, 82, 79, 75, 72, 70, 68, 66, 64, 62, 61, 59, 58, 58, 58, 58, 120,
- 121, 123, 125, 126, 126, 125, 125, 124, 119, 115, 110, 105, 101, 96, 92,
- 87, 84, 81, 77, 74, 72, 69, 67, 65, 63, 62, 60, 59, 59, 59, 59, 126,
- 125, 125, 124, 123, 123, 123, 124, 124, 120, 116, 112, 107, 103, 98, 94,
- 90, 86, 83, 79, 76, 73, 71, 69, 66, 65, 63, 61, 60, 60, 60, 60, 133,
- 129, 126, 123, 119, 120, 121, 122, 123, 120, 116, 113, 109, 105, 101,
- 96, 92, 88, 85, 81, 78, 75, 73, 70, 68, 66, 64, 63, 61, 61, 61, 61, 131,
- 128, 126, 123, 120, 119, 118, 118, 117, 113, 110, 107, 104, 100, 96, 92,
- 88, 85, 82, 79, 76, 74, 71, 69, 67, 65, 64, 62, 60, 60, 60, 60, 129,
- 127, 125, 123, 121, 118, 116, 113, 110, 107, 104, 101, 98, 95, 91, 88,
- 85, 82, 79, 77, 74, 72, 70, 68, 66, 64, 63, 61, 60, 60, 60, 60, 127,
- 126, 125, 124, 122, 118, 113, 108, 103, 100, 98, 95, 92, 89, 87, 84, 81,
- 79, 77, 74, 72, 70, 68, 66, 65, 63, 62, 60, 59, 59, 59, 59, 125, 125,
- 124, 124, 123, 117, 110, 103, 96, 94, 91, 89, 86, 84, 82, 80, 78, 76,
- 74, 72, 70, 68, 67, 65, 63, 62, 61, 60, 58, 58, 58, 58, 119, 119, 119,
- 120, 120, 113, 107, 100, 94, 91, 88, 86, 83, 81, 79, 77, 75, 74, 72, 70,
- 68, 67, 65, 64, 62, 61, 60, 59, 58, 58, 58, 58, 113, 114, 115, 116, 116,
- 110, 104, 98, 91, 88, 86, 83, 80, 78, 76, 75, 73, 71, 70, 68, 66, 65,
- 64, 62, 61, 60, 59, 58, 57, 57, 57, 57, 107, 109, 110, 112, 113, 107,
- 101, 95, 89, 86, 83, 80, 77, 75, 74, 72, 70, 69, 67, 66, 65, 63, 62, 61,
- 60, 59, 58, 57, 56, 56, 56, 56, 102, 104, 105, 107, 109, 104, 98, 92,
- 86, 83, 80, 77, 74, 72, 71, 69, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58,
- 57, 56, 55, 55, 55, 55, 97, 99, 101, 103, 105, 100, 95, 89, 84, 81, 78,
- 75, 72, 71, 69, 68, 66, 65, 64, 63, 61, 61, 60, 59, 58, 57, 56, 56, 55,
- 55, 55, 55, 92, 94, 96, 98, 101, 96, 91, 87, 82, 79, 76, 74, 71, 69, 68,
- 66, 64, 63, 62, 61, 60, 59, 59, 58, 57, 56, 56, 55, 54, 54, 54, 54, 88,
- 90, 92, 94, 96, 92, 88, 84, 80, 77, 75, 72, 69, 68, 66, 64, 63, 62, 61,
- 60, 59, 58, 57, 57, 56, 55, 55, 54, 53, 53, 53, 53, 83, 85, 87, 90, 92,
- 88, 85, 81, 78, 75, 73, 70, 67, 66, 64, 63, 61, 60, 60, 59, 58, 57, 56,
- 56, 55, 54, 54, 53, 53, 53, 53, 53, 80, 82, 84, 86, 88, 85, 82, 79, 76,
- 74, 71, 69, 66, 65, 63, 62, 60, 60, 59, 58, 57, 56, 56, 55, 54, 54, 53,
- 53, 52, 52, 52, 52, 77, 79, 81, 83, 85, 82, 79, 77, 74, 72, 70, 67, 65,
- 64, 62, 61, 60, 59, 58, 57, 56, 55, 55, 54, 54, 53, 53, 52, 52, 52, 52,
- 52, 73, 75, 77, 79, 81, 79, 77, 74, 72, 70, 68, 66, 64, 63, 61, 60, 59,
- 58, 57, 56, 55, 55, 54, 54, 53, 53, 52, 52, 51, 51, 51, 51, 70, 72, 74,
- 76, 78, 76, 74, 72, 70, 68, 66, 65, 63, 61, 60, 59, 58, 57, 56, 55, 54,
- 54, 53, 53, 52, 52, 52, 51, 51, 51, 51, 51, 68, 70, 72, 73, 75, 74, 72,
- 70, 68, 67, 65, 63, 62, 61, 59, 58, 57, 56, 55, 55, 54, 53, 53, 52, 52,
- 52, 51, 51, 50, 50, 50, 50, 66, 68, 69, 71, 73, 71, 70, 68, 67, 65, 64,
- 62, 61, 60, 59, 57, 56, 56, 55, 54, 53, 53, 52, 52, 51, 51, 51, 50, 50,
- 50, 50, 50, 64, 66, 67, 69, 70, 69, 68, 66, 65, 64, 62, 61, 60, 59, 58,
- 57, 56, 55, 54, 54, 53, 52, 52, 51, 51, 51, 50, 50, 50, 50, 50, 50, 62,
- 64, 65, 66, 68, 67, 66, 65, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 54,
- 53, 52, 52, 51, 51, 51, 50, 50, 50, 49, 49, 49, 49, 61, 62, 63, 65, 66,
- 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 54, 53, 53, 52, 52, 51,
- 51, 50, 50, 50, 49, 49, 49, 49, 49, 59, 61, 62, 63, 64, 64, 63, 62, 61,
- 60, 59, 58, 57, 56, 56, 55, 54, 53, 53, 52, 52, 51, 51, 50, 50, 50, 49,
- 49, 49, 49, 49, 49, 58, 59, 60, 61, 63, 62, 61, 60, 60, 59, 58, 57, 56,
- 56, 55, 54, 53, 53, 52, 52, 51, 51, 50, 50, 50, 49, 49, 49, 49, 49, 49,
- 49, 57, 58, 59, 60, 61, 60, 60, 59, 58, 58, 57, 56, 55, 55, 54, 53, 53,
- 52, 52, 51, 51, 50, 50, 50, 49, 49, 49, 49, 48, 48, 48, 48, 57, 58, 59,
- 60, 61, 60, 60, 59, 58, 58, 57, 56, 55, 55, 54, 53, 53, 52, 52, 51, 51,
- 50, 50, 50, 49, 49, 49, 49, 48, 48, 48, 48, 57, 58, 59, 60, 61, 60, 60,
- 59, 58, 58, 57, 56, 55, 55, 54, 53, 53, 52, 52, 51, 51, 50, 50, 50, 49,
- 49, 49, 49, 48, 48, 48, 48, 57, 58, 59, 60, 61, 60, 60, 59, 58, 58, 57,
- 56, 55, 55, 54, 53, 53, 52, 52, 51, 51, 50, 50, 50, 49, 49, 49, 49, 48,
- 48, 48, 48 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 46, 44, 38, 46, 41, 40, 37, 44, 40, 35, 32, 38, 37, 32, 30,
- /* Size 8 */
- 64, 75, 49, 47, 45, 42, 40, 37, 75, 57, 49, 52, 51, 48, 44, 41, 49, 49,
- 44, 45, 45, 44, 42, 39, 47, 52, 45, 42, 41, 40, 38, 37, 45, 51, 45, 41,
- 38, 37, 36, 35, 42, 48, 44, 40, 37, 35, 34, 33, 40, 44, 42, 38, 36, 34,
- 33, 32, 37, 41, 39, 37, 35, 33, 32, 31,
- /* Size 16 */
- 64, 70, 75, 62, 49, 48, 47, 46, 45, 44, 42, 41, 40, 38, 37, 37, 70, 68,
- 66, 58, 49, 49, 50, 49, 48, 47, 45, 44, 42, 40, 39, 39, 75, 66, 57, 53,
- 49, 50, 52, 51, 51, 49, 48, 46, 44, 43, 41, 41, 62, 58, 53, 50, 46, 47,
- 48, 48, 48, 47, 46, 44, 43, 42, 40, 40, 49, 49, 49, 46, 44, 44, 45, 45,
- 45, 44, 44, 43, 42, 40, 39, 39, 48, 49, 50, 47, 44, 44, 43, 43, 43, 42,
- 42, 41, 40, 39, 38, 38, 47, 50, 52, 48, 45, 43, 42, 41, 41, 40, 40, 39,
- 38, 38, 37, 37, 46, 49, 51, 48, 45, 43, 41, 40, 39, 39, 38, 38, 37, 36,
- 36, 36, 45, 48, 51, 48, 45, 43, 41, 39, 38, 37, 37, 36, 36, 35, 35, 35,
- 44, 47, 49, 47, 44, 42, 40, 39, 37, 37, 36, 35, 35, 34, 34, 34, 42, 45,
- 48, 46, 44, 42, 40, 38, 37, 36, 35, 34, 34, 33, 33, 33, 41, 44, 46, 44,
- 43, 41, 39, 38, 36, 35, 34, 34, 33, 33, 32, 32, 40, 42, 44, 43, 42, 40,
- 38, 37, 36, 35, 34, 33, 33, 32, 32, 32, 38, 40, 43, 42, 40, 39, 38, 36,
- 35, 34, 33, 33, 32, 32, 31, 31, 37, 39, 41, 40, 39, 38, 37, 36, 35, 34,
- 33, 32, 32, 31, 31, 31, 37, 39, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32,
- 32, 31, 31, 31,
- /* Size 32 */
- 64, 67, 70, 72, 75, 69, 62, 56, 49, 49, 48, 48, 47, 47, 46, 46, 45, 45,
- 44, 43, 42, 42, 41, 40, 40, 39, 38, 38, 37, 37, 37, 37, 67, 68, 69, 70,
- 71, 65, 60, 54, 49, 49, 49, 49, 48, 48, 48, 47, 47, 46, 45, 45, 44, 43,
- 42, 41, 41, 40, 39, 39, 38, 38, 38, 38, 70, 69, 68, 67, 66, 62, 58, 53,
- 49, 49, 49, 49, 50, 49, 49, 48, 48, 47, 47, 46, 45, 44, 44, 43, 42, 41,
- 40, 40, 39, 39, 39, 39, 72, 70, 67, 64, 62, 59, 55, 52, 49, 49, 50, 50,
- 51, 50, 50, 50, 49, 49, 48, 47, 46, 46, 45, 44, 43, 42, 42, 41, 40, 40,
- 40, 40, 75, 71, 66, 62, 57, 55, 53, 51, 49, 49, 50, 51, 52, 52, 51, 51,
- 51, 50, 49, 49, 48, 47, 46, 45, 44, 44, 43, 42, 41, 41, 41, 41, 69, 65,
- 62, 59, 55, 53, 51, 49, 47, 48, 49, 49, 50, 50, 50, 50, 49, 49, 48, 47,
- 47, 46, 45, 44, 44, 43, 42, 41, 41, 41, 41, 41, 62, 60, 58, 55, 53, 51,
- 50, 48, 46, 47, 47, 48, 48, 48, 48, 48, 48, 47, 47, 46, 46, 45, 44, 44,
- 43, 42, 42, 41, 40, 40, 40, 40, 56, 54, 53, 52, 51, 49, 48, 47, 45, 46,
- 46, 46, 47, 47, 47, 47, 46, 46, 46, 45, 45, 44, 43, 43, 42, 42, 41, 40,
- 40, 40, 40, 40, 49, 49, 49, 49, 49, 47, 46, 45, 44, 44, 44, 45, 45, 45,
- 45, 45, 45, 45, 44, 44, 44, 43, 43, 42, 42, 41, 40, 40, 39, 39, 39, 39,
- 49, 49, 49, 49, 49, 48, 47, 46, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
- 43, 43, 43, 42, 42, 41, 41, 40, 40, 39, 39, 39, 39, 39, 48, 49, 49, 50,
- 50, 49, 47, 46, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 42, 42, 42, 41,
- 41, 40, 40, 39, 39, 38, 38, 38, 38, 38, 48, 49, 49, 50, 51, 49, 48, 46,
- 45, 44, 44, 43, 43, 42, 42, 42, 42, 41, 41, 41, 41, 40, 40, 39, 39, 39,
- 38, 38, 37, 37, 37, 37, 47, 48, 50, 51, 52, 50, 48, 47, 45, 44, 43, 43,
- 42, 41, 41, 41, 41, 40, 40, 40, 40, 39, 39, 39, 38, 38, 38, 37, 37, 37,
- 37, 37, 47, 48, 49, 50, 52, 50, 48, 47, 45, 44, 43, 42, 41, 41, 41, 40,
- 40, 40, 39, 39, 39, 39, 38, 38, 38, 37, 37, 37, 36, 36, 36, 36, 46, 48,
- 49, 50, 51, 50, 48, 47, 45, 44, 43, 42, 41, 41, 40, 40, 39, 39, 39, 38,
- 38, 38, 38, 37, 37, 37, 36, 36, 36, 36, 36, 36, 46, 47, 48, 50, 51, 50,
- 48, 47, 45, 44, 43, 42, 41, 40, 40, 39, 39, 38, 38, 38, 37, 37, 37, 37,
- 36, 36, 36, 35, 35, 35, 35, 35, 45, 47, 48, 49, 51, 49, 48, 46, 45, 44,
- 43, 42, 41, 40, 39, 39, 38, 38, 37, 37, 37, 37, 36, 36, 36, 35, 35, 35,
- 35, 35, 35, 35, 45, 46, 47, 49, 50, 49, 47, 46, 45, 44, 43, 41, 40, 40,
- 39, 38, 38, 37, 37, 37, 36, 36, 36, 36, 35, 35, 35, 34, 34, 34, 34, 34,
- 44, 45, 47, 48, 49, 48, 47, 46, 44, 43, 42, 41, 40, 39, 39, 38, 37, 37,
- 37, 36, 36, 36, 35, 35, 35, 35, 34, 34, 34, 34, 34, 34, 43, 45, 46, 47,
- 49, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 38, 37, 37, 36, 36, 35, 35,
- 35, 35, 34, 34, 34, 34, 33, 33, 33, 33, 42, 44, 45, 46, 48, 47, 46, 45,
- 44, 43, 42, 41, 40, 39, 38, 37, 37, 36, 36, 35, 35, 35, 34, 34, 34, 34,
- 33, 33, 33, 33, 33, 33, 42, 43, 44, 46, 47, 46, 45, 44, 43, 42, 41, 40,
- 39, 39, 38, 37, 37, 36, 36, 35, 35, 34, 34, 34, 34, 33, 33, 33, 33, 33,
- 33, 33, 41, 42, 44, 45, 46, 45, 44, 43, 43, 42, 41, 40, 39, 38, 38, 37,
- 36, 36, 35, 35, 34, 34, 34, 34, 33, 33, 33, 33, 32, 32, 32, 32, 40, 41,
- 43, 44, 45, 44, 44, 43, 42, 41, 40, 39, 39, 38, 37, 37, 36, 36, 35, 35,
- 34, 34, 34, 33, 33, 33, 32, 32, 32, 32, 32, 32, 40, 41, 42, 43, 44, 44,
- 43, 42, 42, 41, 40, 39, 38, 38, 37, 36, 36, 35, 35, 34, 34, 34, 33, 33,
- 33, 32, 32, 32, 32, 32, 32, 32, 39, 40, 41, 42, 44, 43, 42, 42, 41, 40,
- 39, 39, 38, 37, 37, 36, 35, 35, 35, 34, 34, 33, 33, 33, 32, 32, 32, 32,
- 31, 31, 31, 31, 38, 39, 40, 42, 43, 42, 42, 41, 40, 40, 39, 38, 38, 37,
- 36, 36, 35, 35, 34, 34, 33, 33, 33, 32, 32, 32, 32, 31, 31, 31, 31, 31,
- 38, 39, 40, 41, 42, 41, 41, 40, 40, 39, 38, 38, 37, 37, 36, 35, 35, 34,
- 34, 34, 33, 33, 33, 32, 32, 32, 31, 31, 31, 31, 31, 31, 37, 38, 39, 40,
- 41, 41, 40, 40, 39, 39, 38, 37, 37, 36, 36, 35, 35, 34, 34, 33, 33, 33,
- 32, 32, 32, 31, 31, 31, 31, 31, 31, 31, 37, 38, 39, 40, 41, 41, 40, 40,
- 39, 39, 38, 37, 37, 36, 36, 35, 35, 34, 34, 33, 33, 33, 32, 32, 32, 31,
- 31, 31, 31, 31, 31, 31, 37, 38, 39, 40, 41, 41, 40, 40, 39, 39, 38, 37,
- 37, 36, 36, 35, 35, 34, 34, 33, 33, 33, 32, 32, 32, 31, 31, 31, 31, 31,
- 31, 31, 37, 38, 39, 40, 41, 41, 40, 40, 39, 39, 38, 37, 37, 36, 36, 35,
- 35, 34, 34, 33, 33, 33, 32, 32, 32, 31, 31, 31, 31, 31, 31, 31 },
- { /* Intra matrices */
- /* Size 4 */
- 110, 78, 74, 64, 78, 69, 66, 61, 74, 66, 57, 53, 64, 61, 53, 49,
- /* Size 8 */
- 103, 122, 78, 75, 72, 67, 62, 58, 122, 92, 77, 83, 81, 76, 70, 65, 78,
- 77, 70, 71, 71, 69, 66, 62, 75, 83, 71, 66, 64, 62, 60, 58, 72, 81, 71,
- 64, 60, 58, 56, 54, 67, 76, 69, 62, 58, 55, 53, 51, 62, 70, 66, 60, 56,
- 53, 50, 49, 58, 65, 62, 58, 54, 51, 49, 47,
- /* Size 16 */
- 105, 115, 124, 102, 80, 78, 77, 75, 73, 71, 68, 66, 63, 61, 59, 59, 115,
- 112, 109, 94, 79, 80, 80, 79, 78, 75, 73, 70, 67, 65, 62, 62, 124, 109,
- 94, 86, 79, 82, 84, 83, 83, 80, 77, 74, 72, 69, 66, 66, 102, 94, 86, 81,
- 75, 77, 78, 78, 78, 76, 74, 71, 69, 67, 64, 64, 80, 79, 79, 75, 71, 72,
- 73, 73, 73, 71, 70, 68, 67, 65, 63, 63, 78, 80, 82, 77, 72, 71, 70, 69,
- 69, 68, 67, 65, 64, 62, 61, 61, 77, 80, 84, 78, 73, 70, 67, 66, 65, 64,
- 63, 62, 61, 60, 59, 59, 75, 79, 83, 78, 73, 69, 66, 64, 63, 62, 61, 60,
- 59, 58, 57, 57, 73, 78, 83, 78, 73, 69, 65, 63, 61, 60, 59, 58, 57, 56,
- 55, 55, 71, 75, 80, 76, 71, 68, 64, 62, 60, 58, 57, 56, 55, 54, 53, 53,
- 68, 73, 77, 74, 70, 67, 63, 61, 59, 57, 55, 54, 53, 53, 52, 52, 66, 70,
- 74, 71, 68, 65, 62, 60, 58, 56, 54, 53, 52, 52, 51, 51, 63, 67, 72, 69,
- 67, 64, 61, 59, 57, 55, 53, 52, 51, 51, 50, 50, 61, 65, 69, 67, 65, 62,
- 60, 58, 56, 54, 53, 52, 51, 50, 49, 49, 59, 62, 66, 64, 63, 61, 59, 57,
- 55, 53, 52, 51, 50, 49, 48, 48, 59, 62, 66, 64, 63, 61, 59, 57, 55, 53,
- 52, 51, 50, 49, 48, 48,
- /* Size 32 */
- 106, 111, 116, 121, 126, 114, 103, 92, 80, 80, 79, 78, 77, 76, 76, 75,
- 74, 73, 71, 70, 69, 68, 66, 65, 64, 63, 62, 60, 59, 59, 59, 59, 111,
- 113, 114, 116, 118, 108, 99, 90, 80, 80, 80, 79, 79, 79, 78, 77, 76, 75,
- 74, 72, 71, 70, 69, 67, 66, 65, 64, 62, 61, 61, 61, 61, 116, 114, 113,
- 112, 110, 103, 95, 87, 80, 80, 81, 81, 81, 81, 80, 79, 79, 77, 76, 75,
- 73, 72, 71, 69, 68, 67, 65, 64, 63, 63, 63, 63, 121, 116, 112, 107, 102,
- 97, 91, 85, 80, 81, 81, 82, 83, 83, 82, 82, 81, 80, 78, 77, 76, 74, 73,
- 71, 70, 69, 67, 66, 65, 65, 65, 65, 126, 118, 110, 102, 95, 91, 87, 83,
- 79, 81, 82, 84, 85, 85, 84, 84, 83, 82, 81, 79, 78, 77, 75, 74, 72, 71,
- 69, 68, 67, 67, 67, 67, 114, 108, 103, 97, 91, 87, 84, 81, 77, 79, 80,
- 81, 82, 82, 81, 81, 81, 80, 79, 77, 76, 75, 74, 72, 71, 70, 68, 67, 66,
- 66, 66, 66, 103, 99, 95, 91, 87, 84, 81, 78, 75, 76, 77, 78, 79, 79, 79,
- 79, 78, 77, 76, 75, 75, 73, 72, 71, 70, 68, 67, 66, 65, 65, 65, 65, 92,
- 90, 87, 85, 83, 81, 78, 76, 74, 74, 75, 75, 76, 76, 76, 76, 76, 75, 74,
- 73, 73, 72, 71, 70, 68, 67, 66, 65, 64, 64, 64, 64, 80, 80, 80, 80, 79,
- 77, 75, 74, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73, 72, 72, 71, 70, 69,
- 68, 67, 66, 65, 64, 63, 63, 63, 63, 80, 80, 80, 81, 81, 79, 76, 74, 72,
- 72, 72, 72, 72, 72, 72, 71, 71, 71, 70, 70, 69, 68, 68, 67, 66, 65, 64,
- 63, 62, 62, 62, 62, 79, 80, 81, 81, 82, 80, 77, 75, 72, 72, 71, 71, 70,
- 70, 70, 70, 69, 69, 68, 68, 67, 67, 66, 65, 64, 64, 63, 62, 61, 61, 61,
- 61, 78, 79, 81, 82, 84, 81, 78, 75, 73, 72, 71, 70, 69, 69, 68, 68, 68,
- 67, 67, 66, 66, 65, 64, 64, 63, 62, 62, 61, 60, 60, 60, 60, 77, 79, 81,
- 83, 85, 82, 79, 76, 73, 72, 70, 69, 68, 67, 67, 66, 66, 65, 65, 64, 64,
- 63, 63, 62, 62, 61, 60, 60, 59, 59, 59, 59, 76, 79, 81, 83, 85, 82, 79,
- 76, 73, 72, 70, 69, 67, 66, 66, 65, 65, 64, 64, 63, 63, 62, 62, 61, 61,
- 60, 59, 59, 58, 58, 58, 58, 76, 78, 80, 82, 84, 81, 79, 76, 73, 72, 70,
- 68, 67, 66, 65, 64, 64, 63, 62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 57,
- 57, 57, 57, 75, 77, 79, 82, 84, 81, 79, 76, 73, 71, 70, 68, 66, 65, 64,
- 63, 62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 57, 57, 56, 56, 56, 56, 74,
- 76, 79, 81, 83, 81, 78, 76, 73, 71, 69, 68, 66, 65, 64, 62, 61, 61, 60,
- 60, 59, 59, 58, 58, 57, 57, 56, 56, 55, 55, 55, 55, 73, 75, 77, 80, 82,
- 80, 77, 75, 73, 71, 69, 67, 65, 64, 63, 62, 61, 60, 60, 59, 58, 58, 57,
- 57, 56, 56, 55, 55, 55, 55, 55, 55, 71, 74, 76, 78, 81, 79, 76, 74, 72,
- 70, 68, 67, 65, 64, 62, 61, 60, 60, 59, 58, 58, 57, 57, 56, 56, 55, 55,
- 54, 54, 54, 54, 54, 70, 72, 75, 77, 79, 77, 75, 73, 72, 70, 68, 66, 64,
- 63, 62, 61, 60, 59, 58, 57, 57, 56, 56, 55, 55, 54, 54, 54, 53, 53, 53,
- 53, 69, 71, 73, 76, 78, 76, 75, 73, 71, 69, 67, 66, 64, 63, 61, 60, 59,
- 58, 58, 57, 56, 55, 55, 54, 54, 54, 53, 53, 52, 52, 52, 52, 68, 70, 72,
- 74, 77, 75, 73, 72, 70, 68, 67, 65, 63, 62, 61, 60, 59, 58, 57, 56, 55,
- 55, 54, 54, 53, 53, 53, 52, 52, 52, 52, 52, 66, 69, 71, 73, 75, 74, 72,
- 71, 69, 68, 66, 64, 63, 62, 60, 59, 58, 57, 57, 56, 55, 54, 54, 53, 53,
- 52, 52, 52, 51, 51, 51, 51, 65, 67, 69, 71, 74, 72, 71, 70, 68, 67, 65,
- 64, 62, 61, 60, 59, 58, 57, 56, 55, 54, 54, 53, 53, 52, 52, 52, 51, 51,
- 51, 51, 51, 64, 66, 68, 70, 72, 71, 70, 68, 67, 66, 64, 63, 62, 61, 59,
- 58, 57, 56, 56, 55, 54, 53, 53, 52, 52, 51, 51, 51, 50, 50, 50, 50, 63,
- 65, 67, 69, 71, 70, 68, 67, 66, 65, 64, 62, 61, 60, 59, 58, 57, 56, 55,
- 54, 54, 53, 52, 52, 51, 51, 51, 50, 50, 50, 50, 50, 62, 64, 65, 67, 69,
- 68, 67, 66, 65, 64, 63, 62, 60, 59, 58, 57, 56, 55, 55, 54, 53, 53, 52,
- 52, 51, 51, 50, 50, 49, 49, 49, 49, 60, 62, 64, 66, 68, 67, 66, 65, 64,
- 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 54, 53, 52, 52, 51, 51, 50, 50,
- 49, 49, 49, 49, 49, 59, 61, 63, 65, 67, 66, 65, 64, 63, 62, 61, 60, 59,
- 58, 57, 56, 55, 55, 54, 53, 52, 52, 51, 51, 50, 50, 49, 49, 49, 49, 49,
- 49, 59, 61, 63, 65, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55,
- 55, 54, 53, 52, 52, 51, 51, 50, 50, 49, 49, 49, 49, 49, 49, 59, 61, 63,
- 65, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 55, 54, 53, 52,
- 52, 51, 51, 50, 50, 49, 49, 49, 49, 49, 49, 59, 61, 63, 65, 67, 66, 65,
- 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 55, 54, 53, 52, 52, 51, 51, 50,
- 50, 49, 49, 49, 49, 49, 49 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 60, 45, 36, 60, 47, 40, 35, 45, 40, 34, 32, 36, 35, 32, 31,
- /* Size 8 */
- 64, 77, 73, 61, 52, 45, 41, 38, 77, 70, 73, 65, 56, 49, 44, 40, 73, 73,
- 58, 53, 49, 45, 42, 39, 61, 65, 53, 47, 44, 41, 39, 38, 52, 56, 49, 44,
- 41, 39, 37, 36, 45, 49, 45, 41, 39, 37, 36, 35, 41, 44, 42, 39, 37, 36,
- 35, 34, 38, 40, 39, 38, 36, 35, 34, 34,
- /* Size 16 */
- 64, 71, 77, 75, 73, 67, 61, 56, 52, 48, 45, 43, 41, 40, 38, 38, 71, 72,
- 74, 73, 73, 68, 63, 59, 54, 51, 47, 45, 42, 41, 39, 39, 77, 74, 70, 71,
- 73, 69, 65, 61, 56, 53, 49, 46, 44, 42, 40, 40, 75, 73, 71, 69, 66, 62,
- 59, 56, 53, 50, 47, 45, 43, 41, 40, 40, 73, 73, 73, 66, 58, 56, 53, 51,
- 49, 47, 45, 43, 42, 40, 39, 39, 67, 68, 69, 62, 56, 53, 50, 48, 46, 45,
- 43, 42, 41, 39, 38, 38, 61, 63, 65, 59, 53, 50, 47, 45, 44, 43, 41, 40,
- 39, 38, 38, 38, 56, 59, 61, 56, 51, 48, 45, 44, 42, 41, 40, 39, 38, 38,
- 37, 37, 52, 54, 56, 53, 49, 46, 44, 42, 41, 40, 39, 38, 37, 37, 36, 36,
- 48, 51, 53, 50, 47, 45, 43, 41, 40, 39, 38, 37, 37, 36, 36, 36, 45, 47,
- 49, 47, 45, 43, 41, 40, 39, 38, 37, 37, 36, 36, 35, 35, 43, 45, 46, 45,
- 43, 42, 40, 39, 38, 37, 37, 36, 36, 35, 35, 35, 41, 42, 44, 43, 42, 41,
- 39, 38, 37, 37, 36, 36, 35, 35, 34, 34, 40, 41, 42, 41, 40, 39, 38, 38,
- 37, 36, 36, 35, 35, 34, 34, 34, 38, 39, 40, 40, 39, 38, 38, 37, 36, 36,
- 35, 35, 34, 34, 34, 34, 38, 39, 40, 40, 39, 38, 38, 37, 36, 36, 35, 35,
- 34, 34, 34, 34,
- /* Size 32 */
- 64, 67, 71, 74, 77, 76, 75, 74, 73, 70, 67, 64, 61, 59, 56, 54, 52, 50,
- 48, 47, 45, 44, 43, 42, 41, 40, 40, 39, 38, 38, 38, 38, 67, 69, 71, 74,
- 76, 75, 74, 74, 73, 70, 68, 65, 62, 60, 58, 55, 53, 51, 50, 48, 46, 45,
- 44, 43, 42, 41, 40, 40, 39, 39, 39, 39, 71, 71, 72, 73, 74, 74, 73, 73,
- 73, 71, 68, 66, 63, 61, 59, 56, 54, 52, 51, 49, 47, 46, 45, 44, 42, 42,
- 41, 40, 39, 39, 39, 39, 74, 74, 73, 73, 72, 72, 72, 73, 73, 71, 69, 66,
- 64, 62, 60, 57, 55, 53, 52, 50, 48, 47, 46, 44, 43, 42, 42, 41, 40, 40,
- 40, 40, 77, 76, 74, 72, 70, 71, 71, 72, 73, 71, 69, 67, 65, 63, 61, 59,
- 56, 54, 53, 51, 49, 48, 46, 45, 44, 43, 42, 41, 40, 40, 40, 40, 76, 75,
- 74, 72, 71, 70, 70, 70, 69, 67, 66, 64, 62, 60, 58, 56, 54, 53, 51, 50,
- 48, 47, 46, 45, 43, 43, 42, 41, 40, 40, 40, 40, 75, 74, 73, 72, 71, 70,
- 69, 67, 66, 64, 62, 61, 59, 58, 56, 54, 53, 51, 50, 48, 47, 46, 45, 44,
- 43, 42, 41, 41, 40, 40, 40, 40, 74, 74, 73, 73, 72, 70, 67, 65, 62, 61,
- 59, 58, 56, 55, 54, 52, 51, 50, 49, 47, 46, 45, 44, 43, 42, 42, 41, 40,
- 39, 39, 39, 39, 73, 73, 73, 73, 73, 69, 66, 62, 58, 57, 56, 55, 53, 52,
- 51, 50, 49, 48, 47, 46, 45, 44, 43, 43, 42, 41, 40, 40, 39, 39, 39, 39,
- 70, 70, 71, 71, 71, 67, 64, 61, 57, 56, 55, 53, 52, 51, 50, 49, 48, 47,
- 46, 45, 44, 43, 43, 42, 41, 41, 40, 39, 39, 39, 39, 39, 67, 68, 68, 69,
- 69, 66, 62, 59, 56, 55, 53, 52, 50, 49, 48, 47, 46, 46, 45, 44, 43, 43,
- 42, 41, 41, 40, 39, 39, 38, 38, 38, 38, 64, 65, 66, 66, 67, 64, 61, 58,
- 55, 53, 52, 50, 49, 48, 47, 46, 45, 44, 44, 43, 42, 42, 41, 41, 40, 39,
- 39, 38, 38, 38, 38, 38, 61, 62, 63, 64, 65, 62, 59, 56, 53, 52, 50, 49,
- 47, 46, 45, 45, 44, 43, 43, 42, 41, 41, 40, 40, 39, 39, 38, 38, 38, 38,
- 38, 38, 59, 60, 61, 62, 63, 60, 58, 55, 52, 51, 49, 48, 46, 45, 45, 44,
- 43, 42, 42, 41, 41, 40, 40, 39, 39, 38, 38, 38, 37, 37, 37, 37, 56, 58,
- 59, 60, 61, 58, 56, 54, 51, 50, 48, 47, 45, 45, 44, 43, 42, 42, 41, 41,
- 40, 40, 39, 39, 38, 38, 38, 37, 37, 37, 37, 37, 54, 55, 56, 57, 59, 56,
- 54, 52, 50, 49, 47, 46, 45, 44, 43, 42, 41, 41, 40, 40, 39, 39, 39, 38,
- 38, 38, 37, 37, 37, 37, 37, 37, 52, 53, 54, 55, 56, 54, 53, 51, 49, 48,
- 46, 45, 44, 43, 42, 41, 41, 40, 40, 39, 39, 38, 38, 38, 37, 37, 37, 37,
- 36, 36, 36, 36, 50, 51, 52, 53, 54, 53, 51, 50, 48, 47, 46, 44, 43, 42,
- 42, 41, 40, 40, 39, 39, 38, 38, 38, 37, 37, 37, 37, 36, 36, 36, 36, 36,
- 48, 50, 51, 52, 53, 51, 50, 49, 47, 46, 45, 44, 43, 42, 41, 40, 40, 39,
- 39, 38, 38, 38, 37, 37, 37, 36, 36, 36, 36, 36, 36, 36, 47, 48, 49, 50,
- 51, 50, 48, 47, 46, 45, 44, 43, 42, 41, 41, 40, 39, 39, 38, 38, 38, 37,
- 37, 37, 36, 36, 36, 36, 35, 35, 35, 35, 45, 46, 47, 48, 49, 48, 47, 46,
- 45, 44, 43, 42, 41, 41, 40, 39, 39, 38, 38, 38, 37, 37, 37, 36, 36, 36,
- 36, 35, 35, 35, 35, 35, 44, 45, 46, 47, 48, 47, 46, 45, 44, 43, 43, 42,
- 41, 40, 40, 39, 38, 38, 38, 37, 37, 37, 36, 36, 36, 36, 35, 35, 35, 35,
- 35, 35, 43, 44, 45, 46, 46, 46, 45, 44, 43, 43, 42, 41, 40, 40, 39, 39,
- 38, 38, 37, 37, 37, 36, 36, 36, 36, 35, 35, 35, 35, 35, 35, 35, 42, 43,
- 44, 44, 45, 45, 44, 43, 43, 42, 41, 41, 40, 39, 39, 38, 38, 37, 37, 37,
- 36, 36, 36, 36, 35, 35, 35, 35, 35, 35, 35, 35, 41, 42, 42, 43, 44, 43,
- 43, 42, 42, 41, 41, 40, 39, 39, 38, 38, 37, 37, 37, 36, 36, 36, 36, 35,
- 35, 35, 35, 35, 34, 34, 34, 34, 40, 41, 42, 42, 43, 43, 42, 42, 41, 41,
- 40, 39, 39, 38, 38, 38, 37, 37, 36, 36, 36, 36, 35, 35, 35, 35, 35, 34,
- 34, 34, 34, 34, 40, 40, 41, 42, 42, 42, 41, 41, 40, 40, 39, 39, 38, 38,
- 38, 37, 37, 37, 36, 36, 36, 35, 35, 35, 35, 35, 34, 34, 34, 34, 34, 34,
- 39, 40, 40, 41, 41, 41, 41, 40, 40, 39, 39, 38, 38, 38, 37, 37, 37, 36,
- 36, 36, 35, 35, 35, 35, 35, 34, 34, 34, 34, 34, 34, 34, 38, 39, 39, 40,
- 40, 40, 40, 39, 39, 39, 38, 38, 38, 37, 37, 37, 36, 36, 36, 35, 35, 35,
- 35, 35, 34, 34, 34, 34, 34, 34, 34, 34, 38, 39, 39, 40, 40, 40, 40, 39,
- 39, 39, 38, 38, 38, 37, 37, 37, 36, 36, 36, 35, 35, 35, 35, 35, 34, 34,
- 34, 34, 34, 34, 34, 34, 38, 39, 39, 40, 40, 40, 40, 39, 39, 39, 38, 38,
- 38, 37, 37, 37, 36, 36, 36, 35, 35, 35, 35, 35, 34, 34, 34, 34, 34, 34,
- 34, 34, 38, 39, 39, 40, 40, 40, 40, 39, 39, 39, 38, 38, 38, 37, 37, 37,
- 36, 36, 36, 35, 35, 35, 35, 35, 34, 34, 34, 34, 34, 34, 34, 34 },
- { /* Intra matrices */
- /* Size 4 */
- 109, 102, 75, 59, 102, 79, 66, 57, 75, 66, 56, 52, 59, 57, 52, 49,
- /* Size 8 */
- 96, 117, 111, 92, 77, 67, 60, 55, 117, 106, 110, 98, 84, 73, 64, 59,
- 111, 110, 87, 80, 73, 66, 61, 57, 92, 98, 80, 69, 64, 60, 57, 55, 77,
- 84, 73, 64, 59, 56, 54, 52, 67, 73, 66, 60, 56, 54, 52, 51, 60, 64, 61,
- 57, 54, 52, 51, 49, 55, 59, 57, 55, 52, 51, 49, 49,
- /* Size 16 */
- 98, 109, 120, 116, 113, 103, 94, 86, 78, 73, 68, 65, 61, 59, 57, 57,
- 109, 111, 114, 113, 112, 105, 97, 89, 82, 76, 71, 67, 63, 61, 58, 58,
- 120, 114, 108, 110, 112, 106, 100, 93, 86, 80, 74, 70, 66, 63, 60, 60,
- 116, 113, 110, 105, 101, 96, 91, 85, 80, 75, 71, 67, 64, 62, 59, 59,
- 113, 112, 112, 101, 89, 85, 81, 78, 74, 71, 68, 65, 62, 60, 58, 58, 103,
- 105, 106, 96, 85, 81, 76, 73, 70, 67, 65, 62, 60, 59, 57, 57, 94, 97,
- 100, 91, 81, 76, 71, 68, 66, 64, 62, 60, 58, 57, 56, 56, 86, 89, 93, 85,
- 78, 73, 68, 66, 63, 61, 60, 58, 57, 56, 55, 55, 78, 82, 86, 80, 74, 70,
- 66, 63, 61, 59, 57, 56, 55, 54, 53, 53, 73, 76, 80, 75, 71, 67, 64, 61,
- 59, 58, 56, 55, 54, 53, 53, 53, 68, 71, 74, 71, 68, 65, 62, 60, 57, 56,
- 55, 54, 53, 52, 52, 52, 65, 67, 70, 67, 65, 62, 60, 58, 56, 55, 54, 53,
- 52, 52, 51, 51, 61, 63, 66, 64, 62, 60, 58, 57, 55, 54, 53, 52, 52, 51,
- 51, 51, 59, 61, 63, 62, 60, 59, 57, 56, 54, 53, 52, 52, 51, 51, 50, 50,
- 57, 58, 60, 59, 58, 57, 56, 55, 53, 53, 52, 51, 51, 50, 50, 50, 57, 58,
- 60, 59, 58, 57, 56, 55, 53, 53, 52, 51, 51, 50, 50, 50,
- /* Size 32 */
- 99, 105, 110, 115, 121, 119, 118, 116, 114, 109, 104, 100, 95, 91, 87,
- 83, 79, 76, 74, 71, 69, 67, 65, 63, 62, 61, 59, 58, 57, 57, 57, 57, 105,
- 108, 111, 115, 118, 117, 116, 115, 114, 110, 105, 101, 96, 93, 89, 85,
- 81, 78, 76, 73, 70, 68, 67, 65, 63, 62, 61, 59, 58, 58, 58, 58, 110,
- 111, 113, 114, 115, 115, 114, 114, 114, 110, 106, 102, 98, 94, 90, 87,
- 83, 80, 77, 74, 72, 70, 68, 66, 64, 63, 62, 60, 59, 59, 59, 59, 115,
- 115, 114, 113, 112, 113, 113, 113, 113, 110, 106, 103, 100, 96, 92, 88,
- 85, 82, 79, 76, 73, 71, 69, 67, 65, 64, 63, 61, 60, 60, 60, 60, 121,
- 118, 115, 112, 110, 110, 111, 112, 113, 110, 107, 104, 101, 98, 94, 90,
- 87, 84, 81, 78, 75, 73, 71, 69, 67, 65, 64, 62, 61, 61, 61, 61, 119,
- 117, 115, 113, 110, 110, 109, 108, 107, 105, 102, 99, 96, 93, 90, 87,
- 84, 81, 78, 76, 73, 71, 69, 68, 66, 64, 63, 62, 60, 60, 60, 60, 118,
- 116, 114, 113, 111, 109, 106, 104, 102, 99, 97, 94, 92, 89, 86, 83, 81,
- 78, 76, 74, 72, 70, 68, 66, 65, 63, 62, 61, 60, 60, 60, 60, 116, 115,
- 114, 113, 112, 108, 104, 100, 96, 94, 91, 89, 87, 85, 82, 80, 78, 76,
- 74, 72, 70, 68, 67, 65, 64, 63, 62, 60, 59, 59, 59, 59, 114, 114, 114,
- 113, 113, 107, 102, 96, 90, 88, 86, 84, 82, 80, 79, 77, 75, 73, 72, 70,
- 68, 67, 66, 64, 63, 62, 61, 60, 59, 59, 59, 59, 109, 110, 110, 110, 110,
- 105, 99, 94, 88, 86, 84, 82, 79, 78, 76, 74, 73, 71, 70, 68, 67, 66, 64,
- 63, 62, 61, 60, 59, 58, 58, 58, 58, 104, 105, 106, 106, 107, 102, 97,
- 91, 86, 84, 81, 79, 77, 75, 74, 72, 71, 69, 68, 67, 65, 64, 63, 62, 61,
- 60, 59, 58, 57, 57, 57, 57, 100, 101, 102, 103, 104, 99, 94, 89, 84, 82,
- 79, 77, 74, 73, 71, 70, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 58,
- 57, 57, 57, 57, 95, 96, 98, 100, 101, 96, 92, 87, 82, 79, 77, 74, 72,
- 70, 69, 68, 66, 65, 64, 63, 62, 61, 61, 60, 59, 58, 58, 57, 56, 56, 56,
- 56, 91, 93, 94, 96, 98, 93, 89, 85, 80, 78, 75, 73, 70, 69, 68, 66, 65,
- 64, 63, 62, 61, 60, 60, 59, 58, 58, 57, 56, 56, 56, 56, 56, 87, 89, 90,
- 92, 94, 90, 86, 82, 79, 76, 74, 71, 69, 68, 66, 65, 64, 63, 62, 61, 60,
- 59, 59, 58, 57, 57, 56, 56, 55, 55, 55, 55, 83, 85, 87, 88, 90, 87, 83,
- 80, 77, 74, 72, 70, 68, 66, 65, 64, 62, 62, 61, 60, 59, 59, 58, 57, 57,
- 56, 56, 55, 55, 55, 55, 55, 79, 81, 83, 85, 87, 84, 81, 78, 75, 73, 71,
- 68, 66, 65, 64, 62, 61, 60, 60, 59, 58, 58, 57, 56, 56, 55, 55, 54, 54,
- 54, 54, 54, 76, 78, 80, 82, 84, 81, 78, 76, 73, 71, 69, 67, 65, 64, 63,
- 62, 60, 60, 59, 58, 57, 57, 56, 56, 55, 55, 54, 54, 54, 54, 54, 54, 74,
- 76, 77, 79, 81, 78, 76, 74, 72, 70, 68, 66, 64, 63, 62, 61, 60, 59, 58,
- 57, 57, 56, 56, 55, 55, 54, 54, 54, 53, 53, 53, 53, 71, 73, 74, 76, 78,
- 76, 74, 72, 70, 68, 67, 65, 63, 62, 61, 60, 59, 58, 57, 57, 56, 56, 55,
- 55, 54, 54, 53, 53, 53, 53, 53, 53, 69, 70, 72, 73, 75, 73, 72, 70, 68,
- 67, 65, 64, 62, 61, 60, 59, 58, 57, 57, 56, 55, 55, 55, 54, 54, 53, 53,
- 53, 52, 52, 52, 52, 67, 68, 70, 71, 73, 71, 70, 68, 67, 66, 64, 63, 61,
- 60, 59, 59, 58, 57, 56, 56, 55, 55, 54, 54, 53, 53, 53, 52, 52, 52, 52,
- 52, 65, 67, 68, 69, 71, 69, 68, 67, 66, 64, 63, 62, 61, 60, 59, 58, 57,
- 56, 56, 55, 55, 54, 54, 53, 53, 53, 52, 52, 52, 52, 52, 52, 63, 65, 66,
- 67, 69, 68, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 56, 55, 55, 54,
- 54, 53, 53, 52, 52, 52, 52, 51, 51, 51, 51, 62, 63, 64, 65, 67, 66, 65,
- 64, 63, 62, 61, 60, 59, 58, 57, 57, 56, 55, 55, 54, 54, 53, 53, 52, 52,
- 52, 52, 51, 51, 51, 51, 51, 61, 62, 63, 64, 65, 64, 63, 63, 62, 61, 60,
- 59, 58, 58, 57, 56, 55, 55, 54, 54, 53, 53, 53, 52, 52, 52, 51, 51, 51,
- 51, 51, 51, 59, 61, 62, 63, 64, 63, 62, 62, 61, 60, 59, 58, 58, 57, 56,
- 56, 55, 54, 54, 53, 53, 53, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 58,
- 59, 60, 61, 62, 62, 61, 60, 60, 59, 58, 58, 57, 56, 56, 55, 54, 54, 54,
- 53, 53, 52, 52, 52, 51, 51, 51, 51, 50, 50, 50, 50, 57, 58, 59, 60, 61,
- 60, 60, 59, 59, 58, 57, 57, 56, 56, 55, 55, 54, 54, 53, 53, 52, 52, 52,
- 51, 51, 51, 51, 50, 50, 50, 50, 50, 57, 58, 59, 60, 61, 60, 60, 59, 59,
- 58, 57, 57, 56, 56, 55, 55, 54, 54, 53, 53, 52, 52, 52, 51, 51, 51, 51,
- 50, 50, 50, 50, 50, 57, 58, 59, 60, 61, 60, 60, 59, 59, 58, 57, 57, 56,
- 56, 55, 55, 54, 54, 53, 53, 52, 52, 52, 51, 51, 51, 51, 50, 50, 50, 50,
- 50, 57, 58, 59, 60, 61, 60, 60, 59, 59, 58, 57, 57, 56, 56, 55, 55, 54,
- 54, 53, 53, 52, 52, 52, 51, 51, 51, 51, 50, 50, 50, 50, 50 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 48, 46, 40, 48, 43, 42, 39, 46, 42, 37, 35, 40, 39, 35, 33,
- /* Size 8 */
- 64, 74, 50, 49, 47, 44, 42, 39, 74, 58, 50, 53, 52, 49, 46, 43, 50, 50,
- 46, 47, 47, 45, 44, 41, 49, 53, 47, 44, 43, 42, 41, 39, 47, 52, 47, 43,
- 40, 39, 38, 37, 44, 49, 45, 42, 39, 38, 37, 36, 42, 46, 44, 41, 38, 37,
- 35, 35, 39, 43, 41, 39, 37, 36, 35, 34,
- /* Size 16 */
- 64, 69, 74, 62, 50, 50, 49, 48, 47, 46, 44, 43, 42, 41, 39, 39, 69, 68,
- 66, 58, 50, 51, 51, 50, 50, 48, 47, 45, 44, 43, 41, 41, 74, 66, 58, 54,
- 50, 51, 53, 52, 52, 51, 49, 48, 46, 45, 43, 43, 62, 58, 54, 51, 48, 49,
- 50, 50, 49, 48, 47, 46, 45, 44, 42, 42, 50, 50, 50, 48, 46, 46, 47, 47,
- 47, 46, 45, 45, 44, 43, 41, 41, 50, 51, 51, 49, 46, 46, 45, 45, 45, 44,
- 44, 43, 42, 41, 40, 40, 49, 51, 53, 50, 47, 45, 44, 43, 43, 42, 42, 41,
- 41, 40, 39, 39, 48, 50, 52, 50, 47, 45, 43, 42, 42, 41, 41, 40, 39, 39,
- 38, 38, 47, 50, 52, 49, 47, 45, 43, 42, 40, 40, 39, 39, 38, 38, 37, 37,
- 46, 48, 51, 48, 46, 44, 42, 41, 40, 39, 38, 38, 37, 37, 37, 37, 44, 47,
- 49, 47, 45, 44, 42, 41, 39, 38, 38, 37, 37, 36, 36, 36, 43, 45, 48, 46,
- 45, 43, 41, 40, 39, 38, 37, 37, 36, 36, 35, 35, 42, 44, 46, 45, 44, 42,
- 41, 39, 38, 37, 37, 36, 35, 35, 35, 35, 41, 43, 45, 44, 43, 41, 40, 39,
- 38, 37, 36, 36, 35, 35, 34, 34, 39, 41, 43, 42, 41, 40, 39, 38, 37, 37,
- 36, 35, 35, 34, 34, 34, 39, 41, 43, 42, 41, 40, 39, 38, 37, 37, 36, 35,
- 35, 34, 34, 34,
- /* Size 32 */
- 64, 67, 69, 72, 74, 68, 62, 56, 50, 50, 50, 49, 49, 48, 48, 48, 47, 46,
- 46, 45, 44, 44, 43, 42, 42, 41, 41, 40, 39, 39, 39, 39, 67, 67, 68, 69,
- 70, 65, 60, 55, 50, 50, 50, 50, 50, 49, 49, 49, 48, 48, 47, 46, 46, 45,
- 44, 44, 43, 42, 42, 41, 40, 40, 40, 40, 69, 68, 68, 67, 66, 62, 58, 54,
- 50, 50, 51, 51, 51, 51, 50, 50, 50, 49, 48, 48, 47, 46, 45, 45, 44, 43,
- 43, 42, 41, 41, 41, 41, 72, 69, 67, 64, 62, 59, 56, 53, 50, 51, 51, 51,
- 52, 52, 51, 51, 51, 50, 49, 49, 48, 47, 47, 46, 45, 44, 44, 43, 42, 42,
- 42, 42, 74, 70, 66, 62, 58, 56, 54, 52, 50, 51, 51, 52, 53, 53, 52, 52,
- 52, 51, 51, 50, 49, 48, 48, 47, 46, 45, 45, 44, 43, 43, 43, 43, 68, 65,
- 62, 59, 56, 54, 52, 51, 49, 50, 50, 51, 51, 51, 51, 51, 51, 50, 50, 49,
- 48, 48, 47, 46, 45, 45, 44, 43, 43, 43, 43, 43, 62, 60, 58, 56, 54, 52,
- 51, 49, 48, 48, 49, 49, 50, 50, 50, 49, 49, 49, 48, 48, 47, 47, 46, 45,
- 45, 44, 44, 43, 42, 42, 42, 42, 56, 55, 54, 53, 52, 51, 49, 48, 47, 47,
- 48, 48, 48, 48, 48, 48, 48, 48, 47, 47, 46, 46, 45, 45, 44, 44, 43, 42,
- 42, 42, 42, 42, 50, 50, 50, 50, 50, 49, 48, 47, 46, 46, 46, 46, 47, 47,
- 47, 47, 47, 46, 46, 46, 45, 45, 45, 44, 44, 43, 43, 42, 41, 41, 41, 41,
- 50, 50, 50, 51, 51, 50, 48, 47, 46, 46, 46, 46, 46, 46, 46, 46, 46, 45,
- 45, 45, 45, 44, 44, 43, 43, 42, 42, 41, 41, 41, 41, 41, 50, 50, 51, 51,
- 51, 50, 49, 48, 46, 46, 46, 45, 45, 45, 45, 45, 45, 44, 44, 44, 44, 43,
- 43, 42, 42, 42, 41, 41, 40, 40, 40, 40, 49, 50, 51, 51, 52, 51, 49, 48,
- 46, 46, 45, 45, 44, 44, 44, 44, 44, 43, 43, 43, 43, 42, 42, 42, 41, 41,
- 41, 40, 40, 40, 40, 40, 49, 50, 51, 52, 53, 51, 50, 48, 47, 46, 45, 44,
- 44, 43, 43, 43, 43, 42, 42, 42, 42, 42, 41, 41, 41, 40, 40, 40, 39, 39,
- 39, 39, 48, 49, 51, 52, 53, 51, 50, 48, 47, 46, 45, 44, 43, 43, 43, 42,
- 42, 42, 42, 41, 41, 41, 41, 40, 40, 40, 39, 39, 39, 39, 39, 39, 48, 49,
- 50, 51, 52, 51, 50, 48, 47, 46, 45, 44, 43, 43, 42, 42, 42, 41, 41, 41,
- 41, 40, 40, 40, 39, 39, 39, 39, 38, 38, 38, 38, 48, 49, 50, 51, 52, 51,
- 49, 48, 47, 46, 45, 44, 43, 42, 42, 42, 41, 41, 40, 40, 40, 40, 39, 39,
- 39, 39, 38, 38, 38, 38, 38, 38, 47, 48, 50, 51, 52, 51, 49, 48, 47, 46,
- 45, 44, 43, 42, 42, 41, 40, 40, 40, 40, 39, 39, 39, 39, 38, 38, 38, 38,
- 37, 37, 37, 37, 46, 48, 49, 50, 51, 50, 49, 48, 46, 45, 44, 43, 42, 42,
- 41, 41, 40, 40, 40, 39, 39, 39, 38, 38, 38, 38, 37, 37, 37, 37, 37, 37,
- 46, 47, 48, 49, 51, 50, 48, 47, 46, 45, 44, 43, 42, 42, 41, 40, 40, 40,
- 39, 39, 38, 38, 38, 38, 37, 37, 37, 37, 37, 37, 37, 37, 45, 46, 48, 49,
- 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 41, 40, 40, 39, 39, 38, 38, 38,
- 38, 37, 37, 37, 37, 36, 36, 36, 36, 36, 44, 46, 47, 48, 49, 48, 47, 46,
- 45, 45, 44, 43, 42, 41, 41, 40, 39, 39, 38, 38, 38, 37, 37, 37, 37, 36,
- 36, 36, 36, 36, 36, 36, 44, 45, 46, 47, 48, 48, 47, 46, 45, 44, 43, 42,
- 42, 41, 40, 40, 39, 39, 38, 38, 37, 37, 37, 37, 36, 36, 36, 36, 35, 35,
- 35, 35, 43, 44, 45, 47, 48, 47, 46, 45, 45, 44, 43, 42, 41, 41, 40, 39,
- 39, 38, 38, 38, 37, 37, 37, 36, 36, 36, 36, 35, 35, 35, 35, 35, 42, 44,
- 45, 46, 47, 46, 45, 45, 44, 43, 42, 42, 41, 40, 40, 39, 39, 38, 38, 37,
- 37, 37, 36, 36, 36, 36, 35, 35, 35, 35, 35, 35, 42, 43, 44, 45, 46, 45,
- 45, 44, 44, 43, 42, 41, 41, 40, 39, 39, 38, 38, 37, 37, 37, 36, 36, 36,
- 35, 35, 35, 35, 35, 35, 35, 35, 41, 42, 43, 44, 45, 45, 44, 44, 43, 42,
- 42, 41, 40, 40, 39, 39, 38, 38, 37, 37, 36, 36, 36, 36, 35, 35, 35, 35,
- 34, 34, 34, 34, 41, 42, 43, 44, 45, 44, 44, 43, 43, 42, 41, 41, 40, 39,
- 39, 38, 38, 37, 37, 37, 36, 36, 36, 35, 35, 35, 35, 34, 34, 34, 34, 34,
- 40, 41, 42, 43, 44, 43, 43, 42, 42, 41, 41, 40, 40, 39, 39, 38, 38, 37,
- 37, 36, 36, 36, 35, 35, 35, 35, 34, 34, 34, 34, 34, 34, 39, 40, 41, 42,
- 43, 43, 42, 42, 41, 41, 40, 40, 39, 39, 38, 38, 37, 37, 37, 36, 36, 35,
- 35, 35, 35, 34, 34, 34, 34, 34, 34, 34, 39, 40, 41, 42, 43, 43, 42, 42,
- 41, 41, 40, 40, 39, 39, 38, 38, 37, 37, 37, 36, 36, 35, 35, 35, 35, 34,
- 34, 34, 34, 34, 34, 34, 39, 40, 41, 42, 43, 43, 42, 42, 41, 41, 40, 40,
- 39, 39, 38, 38, 37, 37, 37, 36, 36, 35, 35, 35, 35, 34, 34, 34, 34, 34,
- 34, 34, 39, 40, 41, 42, 43, 43, 42, 42, 41, 41, 40, 40, 39, 39, 38, 38,
- 37, 37, 37, 36, 36, 35, 35, 35, 35, 34, 34, 34, 34, 34, 34, 34 },
- { /* Intra matrices */
- /* Size 4 */
- 103, 76, 72, 63, 76, 68, 66, 61, 72, 66, 58, 54, 63, 61, 54, 51,
- /* Size 8 */
- 98, 114, 76, 73, 71, 66, 62, 58, 114, 88, 75, 80, 78, 74, 69, 64, 76,
- 75, 69, 70, 70, 68, 65, 62, 73, 80, 70, 65, 64, 62, 60, 58, 71, 78, 70,
- 64, 60, 58, 57, 55, 66, 74, 68, 62, 58, 56, 54, 53, 62, 69, 65, 60, 57,
- 54, 52, 51, 58, 64, 62, 58, 55, 53, 51, 49,
- /* Size 16 */
- 99, 107, 115, 96, 77, 76, 74, 73, 72, 69, 67, 65, 63, 61, 59, 59, 107,
- 105, 102, 90, 77, 77, 78, 77, 76, 73, 71, 69, 67, 64, 62, 62, 115, 102,
- 89, 83, 76, 79, 81, 80, 80, 77, 75, 73, 70, 68, 65, 65, 96, 90, 83, 78,
- 73, 74, 76, 76, 75, 74, 72, 70, 68, 66, 64, 64, 77, 77, 76, 73, 70, 70,
- 71, 71, 71, 70, 69, 68, 66, 64, 63, 63, 76, 77, 79, 74, 70, 69, 69, 68,
- 68, 67, 66, 65, 64, 62, 61, 61, 74, 78, 81, 76, 71, 69, 66, 65, 65, 64,
- 63, 62, 61, 60, 59, 59, 73, 77, 80, 76, 71, 68, 65, 64, 63, 62, 61, 60,
- 59, 58, 57, 57, 72, 76, 80, 75, 71, 68, 65, 63, 61, 60, 59, 58, 57, 57,
- 56, 56, 69, 73, 77, 74, 70, 67, 64, 62, 60, 59, 58, 57, 56, 55, 55, 55,
- 67, 71, 75, 72, 69, 66, 63, 61, 59, 58, 56, 56, 55, 54, 53, 53, 65, 69,
- 73, 70, 68, 65, 62, 60, 58, 57, 56, 55, 54, 53, 52, 52, 63, 67, 70, 68,
- 66, 64, 61, 59, 57, 56, 55, 54, 53, 52, 51, 51, 61, 64, 68, 66, 64, 62,
- 60, 58, 57, 55, 54, 53, 52, 51, 51, 51, 59, 62, 65, 64, 63, 61, 59, 57,
- 56, 55, 53, 52, 51, 51, 50, 50, 59, 62, 65, 64, 63, 61, 59, 57, 56, 55,
- 53, 52, 51, 51, 50, 50,
- /* Size 32 */
- 100, 104, 108, 112, 116, 107, 97, 87, 78, 77, 76, 76, 75, 74, 74, 73,
- 72, 71, 70, 69, 68, 67, 66, 65, 63, 63, 62, 61, 60, 60, 60, 60, 104,
- 105, 107, 108, 110, 102, 94, 86, 78, 77, 77, 77, 77, 76, 75, 75, 74, 73,
- 72, 71, 70, 69, 68, 66, 65, 64, 63, 62, 61, 61, 61, 61, 108, 107, 106,
- 104, 103, 97, 90, 84, 77, 78, 78, 78, 78, 78, 77, 77, 76, 75, 74, 73,
- 72, 71, 69, 68, 67, 66, 65, 64, 63, 63, 63, 63, 112, 108, 104, 100, 96,
- 92, 87, 82, 77, 78, 79, 79, 80, 80, 79, 79, 78, 77, 76, 75, 74, 73, 71,
- 70, 69, 68, 67, 65, 64, 64, 64, 64, 116, 110, 103, 96, 90, 87, 83, 80,
- 77, 78, 79, 81, 82, 81, 81, 81, 80, 79, 78, 77, 76, 74, 73, 72, 71, 69,
- 68, 67, 66, 66, 66, 66, 107, 102, 97, 92, 87, 84, 81, 78, 75, 76, 77,
- 78, 79, 79, 79, 78, 78, 77, 76, 75, 74, 73, 72, 71, 70, 68, 67, 66, 65,
- 65, 65, 65, 97, 94, 90, 87, 83, 81, 78, 76, 74, 74, 75, 76, 77, 76, 76,
- 76, 76, 75, 74, 73, 73, 72, 71, 70, 69, 68, 67, 65, 64, 64, 64, 64, 87,
- 86, 84, 82, 80, 78, 76, 74, 72, 72, 73, 73, 74, 74, 74, 74, 74, 73, 72,
- 72, 71, 70, 69, 68, 67, 67, 66, 65, 64, 64, 64, 64, 78, 78, 77, 77, 77,
- 75, 74, 72, 70, 70, 71, 71, 72, 72, 72, 72, 72, 71, 71, 70, 70, 69, 68,
- 67, 66, 66, 65, 64, 63, 63, 63, 63, 77, 77, 78, 78, 78, 76, 74, 72, 70,
- 70, 70, 70, 70, 70, 70, 70, 70, 70, 69, 69, 68, 67, 67, 66, 65, 64, 64,
- 63, 62, 62, 62, 62, 76, 77, 78, 79, 79, 77, 75, 73, 71, 70, 70, 70, 69,
- 69, 69, 69, 68, 68, 67, 67, 67, 66, 65, 65, 64, 63, 63, 62, 61, 61, 61,
- 61, 76, 77, 78, 79, 81, 78, 76, 73, 71, 70, 70, 69, 68, 68, 67, 67, 67,
- 66, 66, 66, 65, 65, 64, 63, 63, 62, 62, 61, 60, 60, 60, 60, 75, 77, 78,
- 80, 82, 79, 77, 74, 72, 70, 69, 68, 67, 66, 66, 65, 65, 65, 64, 64, 64,
- 63, 63, 62, 62, 61, 61, 60, 60, 60, 60, 60, 74, 76, 78, 80, 81, 79, 76,
- 74, 72, 70, 69, 68, 66, 66, 65, 65, 64, 64, 63, 63, 63, 62, 62, 61, 61,
- 60, 60, 59, 59, 59, 59, 59, 74, 75, 77, 79, 81, 79, 76, 74, 72, 70, 69,
- 67, 66, 65, 65, 64, 63, 63, 62, 62, 62, 61, 61, 60, 60, 59, 59, 58, 58,
- 58, 58, 58, 73, 75, 77, 79, 81, 78, 76, 74, 72, 70, 69, 67, 65, 65, 64,
- 63, 62, 62, 61, 61, 60, 60, 60, 59, 59, 58, 58, 58, 57, 57, 57, 57, 72,
- 74, 76, 78, 80, 78, 76, 74, 72, 70, 68, 67, 65, 64, 63, 62, 61, 61, 60,
- 60, 59, 59, 59, 58, 58, 57, 57, 57, 56, 56, 56, 56, 71, 73, 75, 77, 79,
- 77, 75, 73, 71, 70, 68, 66, 65, 64, 63, 62, 61, 60, 60, 59, 59, 58, 58,
- 58, 57, 57, 56, 56, 56, 56, 56, 56, 70, 72, 74, 76, 78, 76, 74, 72, 71,
- 69, 67, 66, 64, 63, 62, 61, 60, 60, 59, 59, 58, 58, 57, 57, 56, 56, 56,
- 55, 55, 55, 55, 55, 69, 71, 73, 75, 77, 75, 73, 72, 70, 69, 67, 66, 64,
- 63, 62, 61, 60, 59, 59, 58, 57, 57, 57, 56, 56, 55, 55, 55, 54, 54, 54,
- 54, 68, 70, 72, 74, 76, 74, 73, 71, 70, 68, 67, 65, 64, 63, 62, 60, 59,
- 59, 58, 57, 57, 56, 56, 56, 55, 55, 54, 54, 54, 54, 54, 54, 67, 69, 71,
- 73, 74, 73, 72, 70, 69, 67, 66, 65, 63, 62, 61, 60, 59, 58, 58, 57, 56,
- 56, 56, 55, 55, 54, 54, 54, 53, 53, 53, 53, 66, 68, 69, 71, 73, 72, 71,
- 69, 68, 67, 65, 64, 63, 62, 61, 60, 59, 58, 57, 57, 56, 56, 55, 55, 54,
- 54, 53, 53, 53, 53, 53, 53, 65, 66, 68, 70, 72, 71, 70, 68, 67, 66, 65,
- 63, 62, 61, 60, 59, 58, 58, 57, 56, 56, 55, 55, 54, 54, 53, 53, 53, 52,
- 52, 52, 52, 63, 65, 67, 69, 71, 70, 69, 67, 66, 65, 64, 63, 62, 61, 60,
- 59, 58, 57, 56, 56, 55, 55, 54, 54, 53, 53, 53, 52, 52, 52, 52, 52, 63,
- 64, 66, 68, 69, 68, 68, 67, 66, 64, 63, 62, 61, 60, 59, 58, 57, 57, 56,
- 55, 55, 54, 54, 53, 53, 53, 52, 52, 52, 52, 52, 52, 62, 63, 65, 67, 68,
- 67, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 56, 55, 54, 54, 53,
- 53, 53, 52, 52, 52, 51, 51, 51, 51, 61, 62, 64, 65, 67, 66, 65, 65, 64,
- 63, 62, 61, 60, 59, 58, 58, 57, 56, 55, 55, 54, 54, 53, 53, 52, 52, 52,
- 51, 51, 51, 51, 51, 60, 61, 63, 64, 66, 65, 64, 64, 63, 62, 61, 60, 60,
- 59, 58, 57, 56, 56, 55, 54, 54, 53, 53, 52, 52, 52, 51, 51, 51, 51, 51,
- 51, 60, 61, 63, 64, 66, 65, 64, 64, 63, 62, 61, 60, 60, 59, 58, 57, 56,
- 56, 55, 54, 54, 53, 53, 52, 52, 52, 51, 51, 51, 51, 51, 51, 60, 61, 63,
- 64, 66, 65, 64, 64, 63, 62, 61, 60, 60, 59, 58, 57, 56, 56, 55, 54, 54,
- 53, 53, 52, 52, 52, 51, 51, 51, 51, 51, 51, 60, 61, 63, 64, 66, 65, 64,
- 64, 63, 62, 61, 60, 60, 59, 58, 57, 56, 56, 55, 54, 54, 53, 53, 52, 52,
- 52, 51, 51, 51, 51, 51, 51 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 61, 47, 39, 61, 49, 42, 38, 47, 42, 38, 35, 39, 38, 35, 34,
- /* Size 8 */
- 64, 76, 72, 62, 53, 47, 44, 41, 76, 70, 72, 65, 57, 51, 46, 43, 72, 72,
- 59, 55, 51, 47, 44, 42, 62, 65, 55, 49, 46, 44, 42, 41, 53, 57, 51, 46,
- 43, 42, 41, 40, 47, 51, 47, 44, 42, 40, 39, 39, 44, 46, 44, 42, 41, 39,
- 39, 38, 41, 43, 42, 41, 40, 39, 38, 37,
- /* Size 16 */
- 64, 70, 76, 74, 72, 67, 62, 57, 53, 50, 47, 46, 44, 43, 41, 41, 70, 71,
- 73, 72, 72, 68, 63, 59, 55, 52, 49, 47, 45, 44, 42, 42, 76, 73, 70, 71,
- 72, 68, 65, 61, 57, 54, 51, 49, 46, 45, 43, 43, 74, 72, 71, 68, 65, 63,
- 60, 57, 54, 52, 49, 47, 45, 44, 43, 43, 72, 72, 72, 65, 59, 57, 55, 53,
- 51, 49, 47, 46, 44, 43, 42, 42, 67, 68, 68, 63, 57, 54, 52, 50, 49, 47,
- 46, 44, 43, 42, 41, 41, 62, 63, 65, 60, 55, 52, 49, 48, 46, 45, 44, 43,
- 42, 41, 41, 41, 57, 59, 61, 57, 53, 50, 48, 46, 45, 44, 43, 42, 41, 41,
- 40, 40, 53, 55, 57, 54, 51, 49, 46, 45, 43, 43, 42, 41, 41, 40, 40, 40,
- 50, 52, 54, 52, 49, 47, 45, 44, 43, 42, 41, 40, 40, 40, 39, 39, 47, 49,
- 51, 49, 47, 46, 44, 43, 42, 41, 40, 40, 39, 39, 39, 39, 46, 47, 49, 47,
- 46, 44, 43, 42, 41, 40, 40, 39, 39, 39, 38, 38, 44, 45, 46, 45, 44, 43,
- 42, 41, 41, 40, 39, 39, 39, 38, 38, 38, 43, 44, 45, 44, 43, 42, 41, 41,
- 40, 40, 39, 39, 38, 38, 38, 38, 41, 42, 43, 43, 42, 41, 41, 40, 40, 39,
- 39, 38, 38, 38, 37, 37, 41, 42, 43, 43, 42, 41, 41, 40, 40, 39, 39, 38,
- 38, 38, 37, 37,
- /* Size 32 */
- 64, 67, 70, 73, 76, 75, 74, 73, 72, 70, 67, 64, 62, 60, 57, 55, 53, 52,
- 50, 49, 47, 47, 46, 45, 44, 43, 43, 42, 41, 41, 41, 41, 67, 69, 71, 72,
- 74, 74, 73, 73, 72, 70, 67, 65, 63, 60, 58, 56, 54, 53, 51, 50, 48, 47,
- 46, 45, 44, 44, 43, 42, 42, 42, 42, 42, 70, 71, 71, 72, 73, 73, 72, 72,
- 72, 70, 68, 66, 63, 61, 59, 57, 55, 54, 52, 51, 49, 48, 47, 46, 45, 44,
- 44, 43, 42, 42, 42, 42, 73, 72, 72, 72, 71, 71, 71, 72, 72, 70, 68, 66,
- 64, 62, 60, 58, 56, 55, 53, 52, 50, 49, 48, 47, 46, 45, 44, 43, 43, 43,
- 43, 43, 76, 74, 73, 71, 70, 70, 71, 71, 72, 70, 68, 67, 65, 63, 61, 59,
- 57, 56, 54, 52, 51, 50, 49, 47, 46, 46, 45, 44, 43, 43, 43, 43, 75, 74,
- 73, 71, 70, 70, 69, 69, 68, 67, 66, 64, 63, 61, 59, 57, 56, 54, 53, 51,
- 50, 49, 48, 47, 46, 45, 44, 44, 43, 43, 43, 43, 74, 73, 72, 71, 71, 69,
- 68, 67, 65, 64, 63, 61, 60, 58, 57, 56, 54, 53, 52, 50, 49, 48, 47, 46,
- 45, 45, 44, 43, 43, 43, 43, 43, 73, 73, 72, 72, 71, 69, 67, 64, 62, 61,
- 60, 59, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 47, 46, 45, 44, 44, 43,
- 42, 42, 42, 42, 72, 72, 72, 72, 72, 68, 65, 62, 59, 58, 57, 56, 55, 54,
- 53, 52, 51, 50, 49, 48, 47, 47, 46, 45, 44, 44, 43, 43, 42, 42, 42, 42,
- 70, 70, 70, 70, 70, 67, 64, 61, 58, 57, 56, 55, 53, 52, 52, 51, 50, 49,
- 48, 47, 47, 46, 45, 45, 44, 43, 43, 42, 42, 42, 42, 42, 67, 67, 68, 68,
- 68, 66, 63, 60, 57, 56, 54, 53, 52, 51, 50, 49, 49, 48, 47, 46, 46, 45,
- 44, 44, 43, 43, 42, 42, 41, 41, 41, 41, 64, 65, 66, 66, 67, 64, 61, 59,
- 56, 55, 53, 52, 51, 50, 49, 48, 47, 47, 46, 45, 45, 44, 44, 43, 43, 42,
- 42, 42, 41, 41, 41, 41, 62, 63, 63, 64, 65, 63, 60, 57, 55, 53, 52, 51,
- 49, 48, 48, 47, 46, 46, 45, 45, 44, 44, 43, 43, 42, 42, 41, 41, 41, 41,
- 41, 41, 60, 60, 61, 62, 63, 61, 58, 56, 54, 52, 51, 50, 48, 48, 47, 46,
- 46, 45, 44, 44, 43, 43, 43, 42, 42, 41, 41, 41, 40, 40, 40, 40, 57, 58,
- 59, 60, 61, 59, 57, 55, 53, 52, 50, 49, 48, 47, 46, 46, 45, 44, 44, 43,
- 43, 43, 42, 42, 41, 41, 41, 40, 40, 40, 40, 40, 55, 56, 57, 58, 59, 57,
- 56, 54, 52, 51, 49, 48, 47, 46, 46, 45, 44, 44, 43, 43, 42, 42, 42, 41,
- 41, 41, 40, 40, 40, 40, 40, 40, 53, 54, 55, 56, 57, 56, 54, 52, 51, 50,
- 49, 47, 46, 46, 45, 44, 43, 43, 43, 42, 42, 41, 41, 41, 41, 40, 40, 40,
- 40, 40, 40, 40, 52, 53, 54, 55, 56, 54, 53, 51, 50, 49, 48, 47, 46, 45,
- 44, 44, 43, 43, 42, 42, 41, 41, 41, 41, 40, 40, 40, 40, 39, 39, 39, 39,
- 50, 51, 52, 53, 54, 53, 52, 50, 49, 48, 47, 46, 45, 44, 44, 43, 43, 42,
- 42, 41, 41, 41, 40, 40, 40, 40, 40, 39, 39, 39, 39, 39, 49, 50, 51, 52,
- 52, 51, 50, 49, 48, 47, 46, 45, 45, 44, 43, 43, 42, 42, 41, 41, 41, 40,
- 40, 40, 40, 39, 39, 39, 39, 39, 39, 39, 47, 48, 49, 50, 51, 50, 49, 48,
- 47, 47, 46, 45, 44, 43, 43, 42, 42, 41, 41, 41, 40, 40, 40, 40, 39, 39,
- 39, 39, 39, 39, 39, 39, 47, 47, 48, 49, 50, 49, 48, 47, 47, 46, 45, 44,
- 44, 43, 43, 42, 41, 41, 41, 40, 40, 40, 40, 39, 39, 39, 39, 39, 38, 38,
- 38, 38, 46, 46, 47, 48, 49, 48, 47, 47, 46, 45, 44, 44, 43, 43, 42, 42,
- 41, 41, 40, 40, 40, 40, 39, 39, 39, 39, 39, 38, 38, 38, 38, 38, 45, 45,
- 46, 47, 47, 47, 46, 46, 45, 45, 44, 43, 43, 42, 42, 41, 41, 41, 40, 40,
- 40, 39, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 44, 44, 45, 46, 46, 46,
- 45, 45, 44, 44, 43, 43, 42, 42, 41, 41, 41, 40, 40, 40, 39, 39, 39, 39,
- 39, 38, 38, 38, 38, 38, 38, 38, 43, 44, 44, 45, 46, 45, 45, 44, 44, 43,
- 43, 42, 42, 41, 41, 41, 40, 40, 40, 39, 39, 39, 39, 39, 38, 38, 38, 38,
- 38, 38, 38, 38, 43, 43, 44, 44, 45, 44, 44, 44, 43, 43, 42, 42, 41, 41,
- 41, 40, 40, 40, 40, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 42, 42, 43, 43, 44, 44, 43, 43, 43, 42, 42, 42, 41, 41, 40, 40, 40, 40,
- 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 41, 42, 42, 43,
- 43, 43, 43, 42, 42, 42, 41, 41, 41, 40, 40, 40, 40, 39, 39, 39, 39, 38,
- 38, 38, 38, 38, 38, 38, 37, 37, 37, 37, 41, 42, 42, 43, 43, 43, 43, 42,
- 42, 42, 41, 41, 41, 40, 40, 40, 40, 39, 39, 39, 39, 38, 38, 38, 38, 38,
- 38, 38, 37, 37, 37, 37, 41, 42, 42, 43, 43, 43, 43, 42, 42, 42, 41, 41,
- 41, 40, 40, 40, 40, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 38, 37, 37,
- 37, 37, 41, 42, 42, 43, 43, 43, 43, 42, 42, 42, 41, 41, 41, 40, 40, 40,
- 40, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 38, 37, 37, 37, 37 },
- { /* Intra matrices */
- /* Size 4 */
- 100, 95, 72, 60, 95, 76, 65, 58, 72, 65, 57, 54, 60, 58, 54, 51,
- /* Size 8 */
- 90, 107, 102, 86, 74, 65, 60, 56, 107, 98, 101, 92, 80, 70, 64, 59, 102,
- 101, 83, 76, 71, 65, 61, 58, 86, 92, 76, 68, 64, 60, 58, 56, 74, 80, 71,
- 64, 60, 57, 55, 54, 65, 70, 65, 60, 57, 55, 53, 52, 60, 64, 61, 58, 55,
- 53, 52, 51, 56, 59, 58, 56, 54, 52, 51, 51,
- /* Size 16 */
- 92, 100, 109, 107, 104, 96, 88, 82, 75, 71, 67, 64, 61, 59, 57, 57, 100,
- 102, 105, 104, 103, 97, 91, 84, 78, 74, 69, 66, 63, 61, 59, 59, 109,
- 105, 100, 101, 103, 98, 93, 87, 81, 76, 72, 68, 65, 63, 60, 60, 107,
- 104, 101, 97, 94, 89, 85, 81, 77, 73, 69, 66, 63, 61, 59, 59, 104, 103,
- 103, 94, 84, 81, 78, 75, 72, 69, 66, 64, 62, 60, 59, 59, 96, 97, 98, 89,
- 81, 77, 73, 71, 68, 66, 64, 62, 60, 59, 58, 58, 88, 91, 93, 85, 78, 73,
- 69, 67, 65, 63, 62, 60, 59, 58, 57, 57, 82, 84, 87, 81, 75, 71, 67, 65,
- 63, 61, 60, 59, 58, 57, 56, 56, 75, 78, 81, 77, 72, 68, 65, 63, 61, 59,
- 58, 57, 56, 55, 55, 55, 71, 74, 76, 73, 69, 66, 63, 61, 59, 58, 57, 56,
- 55, 55, 54, 54, 67, 69, 72, 69, 66, 64, 62, 60, 58, 57, 56, 55, 54, 54,
- 53, 53, 64, 66, 68, 66, 64, 62, 60, 59, 57, 56, 55, 54, 54, 53, 53, 53,
- 61, 63, 65, 63, 62, 60, 59, 58, 56, 55, 54, 54, 53, 53, 52, 52, 59, 61,
- 63, 61, 60, 59, 58, 57, 55, 55, 54, 53, 53, 52, 52, 52, 57, 59, 60, 59,
- 59, 58, 57, 56, 55, 54, 53, 53, 52, 52, 52, 52, 57, 59, 60, 59, 59, 58,
- 57, 56, 55, 54, 53, 53, 52, 52, 52, 52,
- /* Size 32 */
- 92, 97, 101, 106, 110, 109, 107, 106, 105, 101, 97, 93, 89, 86, 82, 79,
- 76, 74, 72, 69, 67, 66, 64, 63, 62, 61, 60, 59, 58, 58, 58, 58, 97, 100,
- 102, 105, 108, 107, 106, 105, 104, 101, 97, 94, 90, 87, 84, 81, 77, 75,
- 73, 71, 69, 67, 66, 64, 63, 62, 61, 60, 59, 59, 59, 59, 101, 102, 103,
- 105, 106, 105, 105, 105, 104, 101, 98, 95, 91, 88, 85, 82, 79, 77, 74,
- 72, 70, 68, 67, 65, 64, 63, 61, 60, 59, 59, 59, 59, 106, 105, 105, 104,
- 103, 103, 104, 104, 104, 101, 98, 96, 93, 90, 87, 84, 80, 78, 76, 73,
- 71, 69, 68, 66, 65, 63, 62, 61, 60, 60, 60, 60, 110, 108, 106, 103, 101,
- 102, 102, 103, 104, 101, 99, 97, 94, 91, 88, 85, 82, 80, 77, 75, 72, 71,
- 69, 67, 66, 64, 63, 62, 61, 61, 61, 61, 109, 107, 105, 103, 102, 101,
- 100, 100, 99, 97, 95, 92, 90, 88, 85, 82, 80, 77, 75, 73, 71, 69, 68,
- 66, 65, 64, 63, 61, 60, 60, 60, 60, 107, 106, 105, 104, 102, 100, 98,
- 96, 94, 92, 90, 88, 86, 84, 82, 79, 77, 75, 73, 72, 70, 68, 67, 65, 64,
- 63, 62, 61, 60, 60, 60, 60, 106, 105, 105, 104, 103, 100, 96, 93, 90,
- 88, 86, 84, 82, 80, 79, 77, 75, 73, 72, 70, 68, 67, 66, 65, 63, 62, 61,
- 60, 60, 60, 60, 60, 105, 104, 104, 104, 104, 99, 94, 90, 85, 83, 82, 80,
- 78, 77, 75, 74, 73, 71, 70, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 59,
- 59, 59, 101, 101, 101, 101, 101, 97, 92, 88, 83, 82, 80, 78, 76, 75, 73,
- 72, 71, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 59, 59, 59, 59, 97,
- 97, 98, 98, 99, 95, 90, 86, 82, 80, 78, 76, 74, 73, 71, 70, 69, 68, 67,
- 66, 65, 64, 63, 62, 61, 60, 60, 59, 58, 58, 58, 58, 93, 94, 95, 96, 97,
- 92, 88, 84, 80, 78, 76, 74, 72, 71, 70, 68, 67, 66, 65, 64, 63, 63, 62,
- 61, 60, 59, 59, 58, 58, 58, 58, 58, 89, 90, 91, 93, 94, 90, 86, 82, 78,
- 76, 74, 72, 70, 69, 68, 66, 65, 65, 64, 63, 62, 61, 61, 60, 59, 59, 58,
- 58, 57, 57, 57, 57, 86, 87, 88, 90, 91, 88, 84, 80, 77, 75, 73, 71, 69,
- 68, 66, 65, 64, 64, 63, 62, 61, 61, 60, 59, 59, 58, 58, 57, 57, 57, 57,
- 57, 82, 84, 85, 87, 88, 85, 82, 79, 75, 73, 71, 70, 68, 66, 65, 64, 63,
- 63, 62, 61, 60, 60, 59, 59, 58, 58, 57, 57, 56, 56, 56, 56, 79, 81, 82,
- 84, 85, 82, 79, 77, 74, 72, 70, 68, 66, 65, 64, 63, 62, 62, 61, 60, 59,
- 59, 58, 58, 57, 57, 57, 56, 56, 56, 56, 56, 76, 77, 79, 80, 82, 80, 77,
- 75, 73, 71, 69, 67, 65, 64, 63, 62, 61, 61, 60, 59, 59, 58, 58, 57, 57,
- 56, 56, 56, 55, 55, 55, 55, 74, 75, 77, 78, 80, 77, 75, 73, 71, 69, 68,
- 66, 65, 64, 63, 62, 61, 60, 59, 59, 58, 58, 57, 57, 56, 56, 56, 55, 55,
- 55, 55, 55, 72, 73, 74, 76, 77, 75, 73, 72, 70, 68, 67, 65, 64, 63, 62,
- 61, 60, 59, 59, 58, 57, 57, 57, 56, 56, 55, 55, 55, 55, 55, 55, 55, 69,
- 71, 72, 73, 75, 73, 72, 70, 68, 67, 66, 64, 63, 62, 61, 60, 59, 59, 58,
- 58, 57, 57, 56, 56, 55, 55, 55, 54, 54, 54, 54, 54, 67, 69, 70, 71, 72,
- 71, 70, 68, 67, 66, 65, 63, 62, 61, 60, 59, 59, 58, 57, 57, 56, 56, 56,
- 55, 55, 55, 54, 54, 54, 54, 54, 54, 66, 67, 68, 69, 71, 69, 68, 67, 66,
- 65, 64, 63, 61, 61, 60, 59, 58, 58, 57, 57, 56, 56, 55, 55, 55, 54, 54,
- 54, 54, 54, 54, 54, 64, 66, 67, 68, 69, 68, 67, 66, 65, 64, 63, 62, 61,
- 60, 59, 58, 58, 57, 57, 56, 56, 55, 55, 55, 54, 54, 54, 54, 53, 53, 53,
- 53, 63, 64, 65, 66, 67, 66, 65, 65, 64, 63, 62, 61, 60, 59, 59, 58, 57,
- 57, 56, 56, 55, 55, 55, 54, 54, 54, 54, 53, 53, 53, 53, 53, 62, 63, 64,
- 65, 66, 65, 64, 63, 63, 62, 61, 60, 59, 59, 58, 57, 57, 56, 56, 55, 55,
- 55, 54, 54, 54, 53, 53, 53, 53, 53, 53, 53, 61, 62, 63, 63, 64, 64, 63,
- 62, 62, 61, 60, 59, 59, 58, 58, 57, 56, 56, 55, 55, 55, 54, 54, 54, 53,
- 53, 53, 53, 53, 53, 53, 53, 60, 61, 61, 62, 63, 63, 62, 61, 61, 60, 60,
- 59, 58, 58, 57, 57, 56, 56, 55, 55, 54, 54, 54, 54, 53, 53, 53, 53, 52,
- 52, 52, 52, 59, 60, 60, 61, 62, 61, 61, 60, 60, 59, 59, 58, 58, 57, 57,
- 56, 56, 55, 55, 54, 54, 54, 54, 53, 53, 53, 53, 52, 52, 52, 52, 52, 58,
- 59, 59, 60, 61, 60, 60, 60, 59, 59, 58, 58, 57, 57, 56, 56, 55, 55, 55,
- 54, 54, 54, 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 58, 59, 59, 60, 61,
- 60, 60, 60, 59, 59, 58, 58, 57, 57, 56, 56, 55, 55, 55, 54, 54, 54, 53,
- 53, 53, 53, 52, 52, 52, 52, 52, 52, 58, 59, 59, 60, 61, 60, 60, 60, 59,
- 59, 58, 58, 57, 57, 56, 56, 55, 55, 55, 54, 54, 54, 53, 53, 53, 53, 52,
- 52, 52, 52, 52, 52, 58, 59, 59, 60, 61, 60, 60, 60, 59, 59, 58, 58, 57,
- 57, 56, 56, 55, 55, 55, 54, 54, 54, 53, 53, 53, 53, 52, 52, 52, 52, 52,
- 52 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 50, 48, 43, 50, 45, 44, 42, 48, 44, 40, 38, 43, 42, 38, 36,
- /* Size 8 */
- 64, 73, 52, 50, 49, 47, 44, 42, 73, 59, 51, 54, 53, 51, 48, 45, 52, 51,
- 48, 49, 49, 47, 46, 44, 50, 54, 49, 46, 45, 44, 43, 42, 49, 53, 49, 45,
- 43, 42, 41, 40, 47, 51, 47, 44, 42, 40, 40, 39, 44, 48, 46, 43, 41, 40,
- 39, 38, 42, 45, 44, 42, 40, 39, 38, 37,
- /* Size 16 */
- 64, 69, 73, 63, 52, 51, 50, 50, 49, 48, 47, 45, 44, 43, 42, 42, 69, 67,
- 66, 59, 52, 52, 52, 52, 51, 50, 49, 47, 46, 45, 44, 44, 73, 66, 59, 55,
- 51, 53, 54, 54, 53, 52, 51, 49, 48, 47, 45, 45, 63, 59, 55, 52, 50, 50,
- 51, 51, 51, 50, 49, 48, 47, 46, 45, 45, 52, 52, 51, 50, 48, 48, 49, 49,
- 49, 48, 47, 47, 46, 45, 44, 44, 51, 52, 53, 50, 48, 48, 47, 47, 47, 46,
- 46, 45, 44, 44, 43, 43, 50, 52, 54, 51, 49, 47, 46, 45, 45, 45, 44, 44,
- 43, 43, 42, 42, 50, 52, 54, 51, 49, 47, 45, 45, 44, 44, 43, 43, 42, 42,
- 41, 41, 49, 51, 53, 51, 49, 47, 45, 44, 43, 42, 42, 41, 41, 41, 40, 40,
- 48, 50, 52, 50, 48, 46, 45, 44, 42, 42, 41, 41, 40, 40, 39, 39, 47, 49,
- 51, 49, 47, 46, 44, 43, 42, 41, 40, 40, 40, 39, 39, 39, 45, 47, 49, 48,
- 47, 45, 44, 43, 41, 41, 40, 40, 39, 39, 38, 38, 44, 46, 48, 47, 46, 44,
- 43, 42, 41, 40, 40, 39, 39, 38, 38, 38, 43, 45, 47, 46, 45, 44, 43, 42,
- 41, 40, 39, 39, 38, 38, 37, 37, 42, 44, 45, 45, 44, 43, 42, 41, 40, 39,
- 39, 38, 38, 37, 37, 37, 42, 44, 45, 45, 44, 43, 42, 41, 40, 39, 39, 38,
- 38, 37, 37, 37,
- /* Size 32 */
- 64, 66, 69, 71, 73, 68, 63, 57, 52, 52, 51, 51, 50, 50, 50, 49, 49, 48,
- 48, 47, 47, 46, 45, 45, 44, 44, 43, 43, 42, 42, 42, 42, 66, 67, 68, 69,
- 69, 65, 61, 56, 52, 52, 52, 52, 51, 51, 51, 50, 50, 49, 49, 48, 48, 47,
- 46, 46, 45, 45, 44, 43, 43, 43, 43, 43, 69, 68, 67, 67, 66, 62, 59, 55,
- 52, 52, 52, 52, 52, 52, 52, 51, 51, 51, 50, 49, 49, 48, 47, 47, 46, 46,
- 45, 44, 44, 44, 44, 44, 71, 69, 67, 64, 62, 60, 57, 54, 52, 52, 52, 53,
- 53, 53, 53, 52, 52, 52, 51, 50, 50, 49, 48, 48, 47, 46, 46, 45, 45, 45,
- 45, 45, 73, 69, 66, 62, 59, 57, 55, 53, 51, 52, 53, 53, 54, 54, 54, 54,
- 53, 53, 52, 51, 51, 50, 49, 49, 48, 47, 47, 46, 45, 45, 45, 45, 68, 65,
- 62, 60, 57, 55, 54, 52, 51, 51, 52, 52, 53, 53, 52, 52, 52, 52, 51, 51,
- 50, 49, 49, 48, 47, 47, 46, 46, 45, 45, 45, 45, 63, 61, 59, 57, 55, 54,
- 52, 51, 50, 50, 50, 51, 51, 51, 51, 51, 51, 51, 50, 50, 49, 49, 48, 47,
- 47, 46, 46, 45, 45, 45, 45, 45, 57, 56, 55, 54, 53, 52, 51, 50, 49, 49,
- 49, 50, 50, 50, 50, 50, 50, 49, 49, 49, 48, 48, 47, 47, 46, 46, 45, 45,
- 44, 44, 44, 44, 52, 52, 52, 52, 51, 51, 50, 49, 48, 48, 48, 48, 49, 49,
- 49, 49, 49, 48, 48, 48, 47, 47, 47, 46, 46, 45, 45, 44, 44, 44, 44, 44,
- 52, 52, 52, 52, 52, 51, 50, 49, 48, 48, 48, 48, 48, 48, 48, 48, 48, 47,
- 47, 47, 47, 46, 46, 46, 45, 45, 44, 44, 43, 43, 43, 43, 51, 52, 52, 52,
- 53, 52, 50, 49, 48, 48, 48, 47, 47, 47, 47, 47, 47, 47, 46, 46, 46, 46,
- 45, 45, 44, 44, 44, 43, 43, 43, 43, 43, 51, 52, 52, 53, 53, 52, 51, 50,
- 48, 48, 47, 47, 47, 46, 46, 46, 46, 46, 45, 45, 45, 45, 44, 44, 44, 43,
- 43, 43, 42, 42, 42, 42, 50, 51, 52, 53, 54, 53, 51, 50, 49, 48, 47, 47,
- 46, 46, 45, 45, 45, 45, 45, 44, 44, 44, 44, 43, 43, 43, 43, 42, 42, 42,
- 42, 42, 50, 51, 52, 53, 54, 53, 51, 50, 49, 48, 47, 46, 46, 45, 45, 45,
- 45, 44, 44, 44, 44, 43, 43, 43, 43, 42, 42, 42, 42, 42, 42, 42, 50, 51,
- 52, 53, 54, 52, 51, 50, 49, 48, 47, 46, 45, 45, 45, 44, 44, 44, 44, 43,
- 43, 43, 43, 42, 42, 42, 42, 41, 41, 41, 41, 41, 49, 50, 51, 52, 54, 52,
- 51, 50, 49, 48, 47, 46, 45, 45, 44, 44, 44, 43, 43, 43, 42, 42, 42, 42,
- 42, 41, 41, 41, 41, 41, 41, 41, 49, 50, 51, 52, 53, 52, 51, 50, 49, 48,
- 47, 46, 45, 45, 44, 44, 43, 43, 42, 42, 42, 42, 41, 41, 41, 41, 41, 40,
- 40, 40, 40, 40, 48, 49, 51, 52, 53, 52, 51, 49, 48, 47, 47, 46, 45, 44,
- 44, 43, 43, 42, 42, 42, 42, 41, 41, 41, 41, 40, 40, 40, 40, 40, 40, 40,
- 48, 49, 50, 51, 52, 51, 50, 49, 48, 47, 46, 45, 45, 44, 44, 43, 42, 42,
- 42, 42, 41, 41, 41, 41, 40, 40, 40, 40, 39, 39, 39, 39, 47, 48, 49, 50,
- 51, 51, 50, 49, 48, 47, 46, 45, 44, 44, 43, 43, 42, 42, 42, 41, 41, 41,
- 40, 40, 40, 40, 40, 39, 39, 39, 39, 39, 47, 48, 49, 50, 51, 50, 49, 48,
- 47, 47, 46, 45, 44, 44, 43, 42, 42, 42, 41, 41, 40, 40, 40, 40, 40, 39,
- 39, 39, 39, 39, 39, 39, 46, 47, 48, 49, 50, 49, 49, 48, 47, 46, 46, 45,
- 44, 43, 43, 42, 42, 41, 41, 41, 40, 40, 40, 40, 39, 39, 39, 39, 39, 39,
- 39, 39, 45, 46, 47, 48, 49, 49, 48, 47, 47, 46, 45, 44, 44, 43, 43, 42,
- 41, 41, 41, 40, 40, 40, 40, 39, 39, 39, 39, 38, 38, 38, 38, 38, 45, 46,
- 47, 48, 49, 48, 47, 47, 46, 46, 45, 44, 43, 43, 42, 42, 41, 41, 41, 40,
- 40, 40, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 44, 45, 46, 47, 48, 47,
- 47, 46, 46, 45, 44, 44, 43, 43, 42, 42, 41, 41, 40, 40, 40, 39, 39, 39,
- 39, 38, 38, 38, 38, 38, 38, 38, 44, 45, 46, 46, 47, 47, 46, 46, 45, 45,
- 44, 43, 43, 42, 42, 41, 41, 40, 40, 40, 39, 39, 39, 39, 38, 38, 38, 38,
- 38, 38, 38, 38, 43, 44, 45, 46, 47, 46, 46, 45, 45, 44, 44, 43, 43, 42,
- 42, 41, 41, 40, 40, 40, 39, 39, 39, 38, 38, 38, 38, 38, 37, 37, 37, 37,
- 43, 43, 44, 45, 46, 46, 45, 45, 44, 44, 43, 43, 42, 42, 41, 41, 40, 40,
- 40, 39, 39, 39, 38, 38, 38, 38, 38, 37, 37, 37, 37, 37, 42, 43, 44, 45,
- 45, 45, 45, 44, 44, 43, 43, 42, 42, 42, 41, 41, 40, 40, 39, 39, 39, 39,
- 38, 38, 38, 38, 37, 37, 37, 37, 37, 37, 42, 43, 44, 45, 45, 45, 45, 44,
- 44, 43, 43, 42, 42, 42, 41, 41, 40, 40, 39, 39, 39, 39, 38, 38, 38, 38,
- 37, 37, 37, 37, 37, 37, 42, 43, 44, 45, 45, 45, 45, 44, 44, 43, 43, 42,
- 42, 42, 41, 41, 40, 40, 39, 39, 39, 39, 38, 38, 38, 38, 37, 37, 37, 37,
- 37, 37, 42, 43, 44, 45, 45, 45, 45, 44, 44, 43, 43, 42, 42, 42, 41, 41,
- 40, 40, 39, 39, 39, 39, 38, 38, 38, 38, 37, 37, 37, 37, 37, 37 },
- { /* Intra matrices */
- /* Size 4 */
- 97, 74, 71, 63, 74, 67, 65, 61, 71, 65, 58, 56, 63, 61, 56, 52,
- /* Size 8 */
- 92, 106, 74, 72, 69, 66, 62, 59, 106, 84, 73, 77, 76, 72, 68, 64, 74,
- 73, 68, 69, 69, 67, 65, 62, 72, 77, 69, 65, 63, 62, 61, 59, 69, 76, 69,
- 63, 60, 59, 57, 56, 66, 72, 67, 62, 59, 57, 55, 54, 62, 68, 65, 61, 57,
- 55, 54, 53, 59, 64, 62, 59, 56, 54, 53, 51,
- /* Size 16 */
- 93, 100, 107, 91, 75, 74, 73, 71, 70, 68, 67, 65, 63, 61, 60, 60, 100,
- 98, 96, 85, 74, 75, 75, 74, 74, 72, 70, 68, 66, 64, 62, 62, 107, 96, 85,
- 79, 74, 76, 78, 77, 77, 75, 73, 71, 69, 67, 65, 65, 91, 85, 79, 75, 71,
- 73, 74, 74, 73, 72, 71, 69, 67, 65, 64, 64, 75, 74, 74, 71, 68, 69, 70,
- 70, 70, 69, 68, 67, 65, 64, 63, 63, 74, 75, 76, 73, 69, 68, 68, 67, 67,
- 66, 65, 64, 63, 62, 61, 61, 73, 75, 78, 74, 70, 68, 66, 65, 64, 64, 63,
- 62, 61, 60, 60, 60, 71, 74, 77, 74, 70, 67, 65, 64, 63, 62, 61, 61, 60,
- 59, 58, 58, 70, 74, 77, 73, 70, 67, 64, 63, 61, 60, 59, 59, 58, 58, 57,
- 57, 68, 72, 75, 72, 69, 66, 64, 62, 60, 59, 58, 58, 57, 56, 56, 56, 67,
- 70, 73, 71, 68, 65, 63, 61, 59, 58, 57, 57, 56, 55, 55, 55, 65, 68, 71,
- 69, 67, 64, 62, 61, 59, 58, 57, 56, 55, 55, 54, 54, 63, 66, 69, 67, 65,
- 63, 61, 60, 58, 57, 56, 55, 54, 54, 53, 53, 61, 64, 67, 65, 64, 62, 60,
- 59, 58, 56, 55, 55, 54, 53, 53, 53, 60, 62, 65, 64, 63, 61, 60, 58, 57,
- 56, 55, 54, 53, 53, 52, 52, 60, 62, 65, 64, 63, 61, 60, 58, 57, 56, 55,
- 54, 53, 53, 52, 52,
- /* Size 32 */
- 94, 97, 101, 104, 108, 100, 91, 83, 75, 75, 74, 74, 73, 72, 72, 71, 71,
- 70, 69, 68, 67, 66, 65, 64, 63, 63, 62, 61, 60, 60, 60, 60, 97, 98, 100,
- 101, 102, 95, 89, 82, 75, 75, 75, 75, 74, 74, 73, 73, 72, 71, 70, 70,
- 69, 68, 67, 66, 65, 64, 63, 62, 61, 61, 61, 61, 101, 100, 99, 98, 97,
- 91, 86, 80, 75, 75, 75, 76, 76, 75, 75, 74, 74, 73, 72, 71, 70, 69, 68,
- 67, 66, 65, 65, 64, 63, 63, 63, 63, 104, 101, 98, 94, 91, 87, 83, 79,
- 75, 75, 76, 77, 77, 77, 76, 76, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67,
- 66, 65, 64, 64, 64, 64, 108, 102, 97, 91, 85, 83, 80, 77, 75, 76, 77,
- 78, 79, 78, 78, 78, 77, 76, 75, 75, 74, 73, 71, 70, 69, 68, 67, 66, 65,
- 65, 65, 65, 100, 95, 91, 87, 83, 80, 78, 76, 73, 74, 75, 76, 76, 76, 76,
- 76, 76, 75, 74, 73, 72, 71, 70, 69, 68, 68, 67, 66, 65, 65, 65, 65, 91,
- 89, 86, 83, 80, 78, 76, 74, 72, 72, 73, 74, 74, 74, 74, 74, 74, 73, 72,
- 72, 71, 70, 69, 68, 68, 67, 66, 65, 64, 64, 64, 64, 83, 82, 80, 79, 77,
- 76, 74, 72, 70, 71, 71, 72, 72, 72, 72, 72, 72, 71, 71, 70, 70, 69, 68,
- 67, 67, 66, 65, 64, 64, 64, 64, 64, 75, 75, 75, 75, 75, 73, 72, 70, 69,
- 69, 69, 70, 70, 70, 70, 70, 70, 70, 69, 69, 68, 68, 67, 66, 66, 65, 64,
- 64, 63, 63, 63, 63, 75, 75, 75, 75, 76, 74, 72, 71, 69, 69, 69, 69, 69,
- 69, 69, 69, 69, 68, 68, 68, 67, 67, 66, 65, 65, 64, 63, 63, 62, 62, 62,
- 62, 74, 75, 75, 76, 77, 75, 73, 71, 69, 69, 69, 68, 68, 68, 68, 68, 67,
- 67, 67, 66, 66, 65, 65, 64, 64, 63, 63, 62, 61, 61, 61, 61, 74, 75, 76,
- 77, 78, 76, 74, 72, 70, 69, 68, 68, 67, 67, 67, 66, 66, 66, 65, 65, 65,
- 64, 64, 63, 63, 62, 62, 61, 61, 61, 61, 61, 73, 74, 76, 77, 79, 76, 74,
- 72, 70, 69, 68, 67, 66, 66, 65, 65, 65, 64, 64, 64, 63, 63, 63, 62, 62,
- 61, 61, 60, 60, 60, 60, 60, 72, 74, 75, 77, 78, 76, 74, 72, 70, 69, 68,
- 67, 66, 65, 65, 64, 64, 64, 63, 63, 63, 62, 62, 61, 61, 61, 60, 60, 59,
- 59, 59, 59, 72, 73, 75, 76, 78, 76, 74, 72, 70, 69, 68, 67, 65, 65, 64,
- 64, 63, 63, 62, 62, 62, 61, 61, 61, 60, 60, 59, 59, 59, 59, 59, 59, 71,
- 73, 74, 76, 78, 76, 74, 72, 70, 69, 68, 66, 65, 64, 64, 63, 62, 62, 62,
- 61, 61, 60, 60, 60, 59, 59, 59, 58, 58, 58, 58, 58, 71, 72, 74, 76, 77,
- 76, 74, 72, 70, 69, 67, 66, 65, 64, 63, 62, 62, 61, 61, 60, 60, 60, 59,
- 59, 59, 58, 58, 58, 57, 57, 57, 57, 70, 71, 73, 75, 76, 75, 73, 71, 70,
- 68, 67, 66, 64, 64, 63, 62, 61, 61, 60, 60, 59, 59, 59, 58, 58, 58, 57,
- 57, 57, 57, 57, 57, 69, 70, 72, 74, 75, 74, 72, 71, 69, 68, 67, 65, 64,
- 63, 62, 62, 61, 60, 60, 59, 59, 58, 58, 58, 57, 57, 57, 56, 56, 56, 56,
- 56, 68, 70, 71, 73, 75, 73, 72, 70, 69, 68, 66, 65, 64, 63, 62, 61, 60,
- 60, 59, 59, 58, 58, 58, 57, 57, 57, 56, 56, 56, 56, 56, 56, 67, 69, 70,
- 72, 74, 72, 71, 70, 68, 67, 66, 65, 63, 63, 62, 61, 60, 59, 59, 58, 58,
- 57, 57, 57, 56, 56, 56, 55, 55, 55, 55, 55, 66, 68, 69, 71, 73, 71, 70,
- 69, 68, 67, 65, 64, 63, 62, 61, 60, 60, 59, 58, 58, 57, 57, 57, 56, 56,
- 56, 55, 55, 55, 55, 55, 55, 65, 67, 68, 70, 71, 70, 69, 68, 67, 66, 65,
- 64, 63, 62, 61, 60, 59, 59, 58, 58, 57, 57, 56, 56, 55, 55, 55, 55, 54,
- 54, 54, 54, 64, 66, 67, 69, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 61,
- 60, 59, 58, 58, 57, 57, 56, 56, 55, 55, 55, 55, 54, 54, 54, 54, 54, 63,
- 65, 66, 68, 69, 68, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 59, 58, 57,
- 57, 56, 56, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 63, 64, 65, 67, 68,
- 68, 67, 66, 65, 64, 63, 62, 61, 61, 60, 59, 58, 58, 57, 57, 56, 56, 55,
- 55, 54, 54, 54, 54, 53, 53, 53, 53, 62, 63, 65, 66, 67, 67, 66, 65, 64,
- 63, 63, 62, 61, 60, 59, 59, 58, 57, 57, 56, 56, 55, 55, 55, 54, 54, 54,
- 53, 53, 53, 53, 53, 61, 62, 64, 65, 66, 66, 65, 64, 64, 63, 62, 61, 60,
- 60, 59, 58, 58, 57, 56, 56, 55, 55, 55, 54, 54, 54, 53, 53, 53, 53, 53,
- 53, 60, 61, 63, 64, 65, 65, 64, 64, 63, 62, 61, 61, 60, 59, 59, 58, 57,
- 57, 56, 56, 55, 55, 54, 54, 54, 53, 53, 53, 52, 52, 52, 52, 60, 61, 63,
- 64, 65, 65, 64, 64, 63, 62, 61, 61, 60, 59, 59, 58, 57, 57, 56, 56, 55,
- 55, 54, 54, 54, 53, 53, 53, 52, 52, 52, 52, 60, 61, 63, 64, 65, 65, 64,
- 64, 63, 62, 61, 61, 60, 59, 59, 58, 57, 57, 56, 56, 55, 55, 54, 54, 54,
- 53, 53, 53, 52, 52, 52, 52, 60, 61, 63, 64, 65, 65, 64, 64, 63, 62, 61,
- 61, 60, 59, 59, 58, 57, 57, 56, 56, 55, 55, 54, 54, 54, 53, 53, 53, 52,
- 52, 52, 52 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 61, 49, 42, 61, 51, 45, 41, 49, 45, 41, 39, 42, 41, 39, 38,
- /* Size 8 */
- 64, 74, 71, 62, 55, 50, 47, 45, 74, 69, 70, 65, 58, 53, 49, 46, 71, 70,
- 60, 56, 53, 50, 47, 45, 62, 65, 56, 51, 49, 47, 45, 44, 55, 58, 53, 49,
- 46, 45, 44, 43, 50, 53, 50, 47, 45, 44, 43, 42, 47, 49, 47, 45, 44, 43,
- 42, 42, 45, 46, 45, 44, 43, 42, 42, 41,
- /* Size 16 */
- 64, 69, 74, 73, 71, 66, 62, 58, 55, 52, 50, 48, 47, 46, 45, 45, 69, 70,
- 71, 71, 71, 67, 63, 60, 56, 54, 51, 49, 48, 47, 45, 45, 74, 71, 69, 70,
- 70, 68, 65, 62, 58, 55, 53, 51, 49, 48, 46, 46, 73, 71, 70, 67, 65, 63,
- 61, 58, 55, 53, 51, 50, 48, 47, 46, 46, 71, 71, 70, 65, 60, 58, 56, 54,
- 53, 51, 50, 48, 47, 46, 45, 45, 66, 67, 68, 63, 58, 56, 54, 52, 51, 50,
- 48, 47, 46, 45, 45, 45, 62, 63, 65, 61, 56, 54, 51, 50, 49, 48, 47, 46,
- 45, 45, 44, 44, 58, 60, 62, 58, 54, 52, 50, 49, 48, 47, 46, 45, 45, 44,
- 44, 44, 55, 56, 58, 55, 53, 51, 49, 48, 46, 46, 45, 44, 44, 43, 43, 43,
- 52, 54, 55, 53, 51, 50, 48, 47, 46, 45, 44, 44, 43, 43, 43, 43, 50, 51,
- 53, 51, 50, 48, 47, 46, 45, 44, 44, 43, 43, 43, 42, 42, 48, 49, 51, 50,
- 48, 47, 46, 45, 44, 44, 43, 43, 42, 42, 42, 42, 47, 48, 49, 48, 47, 46,
- 45, 45, 44, 43, 43, 42, 42, 42, 42, 42, 46, 47, 48, 47, 46, 45, 45, 44,
- 43, 43, 43, 42, 42, 42, 41, 41, 45, 45, 46, 46, 45, 45, 44, 44, 43, 43,
- 42, 42, 42, 41, 41, 41, 45, 45, 46, 46, 45, 45, 44, 44, 43, 43, 42, 42,
- 42, 41, 41, 41,
- /* Size 32 */
- 64, 67, 69, 72, 74, 73, 73, 72, 71, 69, 66, 64, 62, 60, 58, 57, 55, 53,
- 52, 51, 50, 49, 48, 47, 47, 46, 46, 45, 45, 45, 45, 45, 67, 68, 70, 71,
- 73, 72, 72, 71, 71, 69, 67, 65, 63, 61, 59, 57, 56, 54, 53, 52, 51, 50,
- 49, 48, 47, 47, 46, 45, 45, 45, 45, 45, 69, 70, 70, 71, 71, 71, 71, 71,
- 71, 69, 67, 65, 63, 62, 60, 58, 56, 55, 54, 53, 51, 50, 49, 49, 48, 47,
- 47, 46, 45, 45, 45, 45, 72, 71, 71, 71, 70, 70, 70, 70, 71, 69, 67, 66,
- 64, 63, 61, 59, 57, 56, 55, 53, 52, 51, 50, 49, 48, 48, 47, 46, 46, 46,
- 46, 46, 74, 73, 71, 70, 69, 69, 70, 70, 70, 69, 68, 66, 65, 63, 62, 60,
- 58, 57, 55, 54, 53, 52, 51, 50, 49, 48, 48, 47, 46, 46, 46, 46, 73, 72,
- 71, 70, 69, 69, 69, 68, 68, 67, 65, 64, 63, 61, 60, 58, 57, 56, 54, 53,
- 52, 51, 50, 49, 48, 48, 47, 47, 46, 46, 46, 46, 73, 72, 71, 70, 70, 69,
- 67, 66, 65, 64, 63, 62, 61, 59, 58, 57, 55, 54, 53, 52, 51, 50, 50, 49,
- 48, 47, 47, 46, 46, 46, 46, 46, 72, 71, 71, 70, 70, 68, 66, 64, 62, 61,
- 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 50, 49, 48, 48, 47, 47, 46,
- 45, 45, 45, 45, 71, 71, 71, 71, 70, 68, 65, 62, 60, 59, 58, 57, 56, 55,
- 54, 54, 53, 52, 51, 50, 50, 49, 48, 48, 47, 47, 46, 46, 45, 45, 45, 45,
- 69, 69, 69, 69, 69, 67, 64, 61, 59, 58, 57, 56, 55, 54, 53, 53, 52, 51,
- 50, 50, 49, 48, 48, 47, 47, 46, 46, 45, 45, 45, 45, 45, 66, 67, 67, 67,
- 68, 65, 63, 60, 58, 57, 56, 55, 54, 53, 52, 51, 51, 50, 50, 49, 48, 48,
- 47, 47, 46, 46, 45, 45, 45, 45, 45, 45, 64, 65, 65, 66, 66, 64, 62, 59,
- 57, 56, 55, 54, 52, 52, 51, 50, 50, 49, 49, 48, 48, 47, 47, 46, 46, 45,
- 45, 45, 44, 44, 44, 44, 62, 63, 63, 64, 65, 63, 61, 58, 56, 55, 54, 52,
- 51, 51, 50, 49, 49, 48, 48, 47, 47, 46, 46, 46, 45, 45, 45, 44, 44, 44,
- 44, 44, 60, 61, 62, 63, 63, 61, 59, 57, 55, 54, 53, 52, 51, 50, 49, 49,
- 48, 48, 47, 47, 46, 46, 46, 45, 45, 45, 44, 44, 44, 44, 44, 44, 58, 59,
- 60, 61, 62, 60, 58, 56, 54, 53, 52, 51, 50, 49, 49, 48, 48, 47, 47, 46,
- 46, 46, 45, 45, 45, 44, 44, 44, 44, 44, 44, 44, 57, 57, 58, 59, 60, 58,
- 57, 55, 54, 53, 51, 50, 49, 49, 48, 48, 47, 47, 46, 46, 45, 45, 45, 45,
- 44, 44, 44, 44, 43, 43, 43, 43, 55, 56, 56, 57, 58, 57, 55, 54, 53, 52,
- 51, 50, 49, 48, 48, 47, 46, 46, 46, 45, 45, 45, 44, 44, 44, 44, 43, 43,
- 43, 43, 43, 43, 53, 54, 55, 56, 57, 56, 54, 53, 52, 51, 50, 49, 48, 48,
- 47, 47, 46, 46, 45, 45, 45, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43,
- 52, 53, 54, 55, 55, 54, 53, 52, 51, 50, 50, 49, 48, 47, 47, 46, 46, 45,
- 45, 45, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 51, 52, 53, 53,
- 54, 53, 52, 51, 50, 50, 49, 48, 47, 47, 46, 46, 45, 45, 45, 44, 44, 44,
- 44, 43, 43, 43, 43, 43, 42, 42, 42, 42, 50, 51, 51, 52, 53, 52, 51, 50,
- 50, 49, 48, 48, 47, 46, 46, 45, 45, 45, 44, 44, 44, 43, 43, 43, 43, 43,
- 43, 42, 42, 42, 42, 42, 49, 50, 50, 51, 52, 51, 50, 50, 49, 48, 48, 47,
- 46, 46, 46, 45, 45, 44, 44, 44, 43, 43, 43, 43, 43, 43, 42, 42, 42, 42,
- 42, 42, 48, 49, 49, 50, 51, 50, 50, 49, 48, 48, 47, 47, 46, 46, 45, 45,
- 44, 44, 44, 44, 43, 43, 43, 43, 42, 42, 42, 42, 42, 42, 42, 42, 47, 48,
- 49, 49, 50, 49, 49, 48, 48, 47, 47, 46, 46, 45, 45, 45, 44, 44, 44, 43,
- 43, 43, 43, 43, 42, 42, 42, 42, 42, 42, 42, 42, 47, 47, 48, 48, 49, 48,
- 48, 48, 47, 47, 46, 46, 45, 45, 45, 44, 44, 44, 43, 43, 43, 43, 42, 42,
- 42, 42, 42, 42, 42, 42, 42, 42, 46, 47, 47, 48, 48, 48, 47, 47, 47, 46,
- 46, 45, 45, 45, 44, 44, 44, 43, 43, 43, 43, 43, 42, 42, 42, 42, 42, 42,
- 42, 42, 42, 42, 46, 46, 47, 47, 48, 47, 47, 47, 46, 46, 45, 45, 45, 44,
- 44, 44, 43, 43, 43, 43, 43, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 41,
- 45, 45, 46, 46, 47, 47, 46, 46, 46, 45, 45, 45, 44, 44, 44, 44, 43, 43,
- 43, 43, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 41, 41, 45, 45, 45, 46,
- 46, 46, 46, 45, 45, 45, 45, 44, 44, 44, 44, 43, 43, 43, 43, 42, 42, 42,
- 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 45, 45, 45, 46, 46, 46, 46, 45,
- 45, 45, 45, 44, 44, 44, 44, 43, 43, 43, 43, 42, 42, 42, 42, 42, 42, 42,
- 41, 41, 41, 41, 41, 41, 45, 45, 45, 46, 46, 46, 46, 45, 45, 45, 45, 44,
- 44, 44, 44, 43, 43, 43, 43, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 41,
- 41, 41, 45, 45, 45, 46, 46, 46, 46, 45, 45, 45, 45, 44, 44, 44, 44, 43,
- 43, 43, 43, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41 },
- { /* Intra matrices */
- /* Size 4 */
- 93, 88, 70, 60, 88, 73, 64, 58, 70, 64, 58, 55, 60, 58, 55, 53,
- /* Size 8 */
- 84, 98, 94, 82, 71, 65, 60, 57, 98, 91, 93, 86, 76, 69, 63, 60, 94, 93,
- 79, 73, 69, 65, 61, 58, 82, 86, 73, 67, 63, 61, 58, 57, 71, 76, 69, 63,
- 60, 58, 56, 55, 65, 69, 65, 61, 58, 56, 55, 54, 60, 63, 61, 58, 56, 55,
- 54, 53, 57, 60, 58, 57, 55, 54, 53, 53,
- /* Size 16 */
- 86, 93, 100, 98, 96, 89, 83, 78, 73, 69, 66, 63, 61, 60, 58, 58, 93, 94,
- 96, 96, 95, 90, 85, 80, 75, 71, 68, 65, 63, 61, 59, 59, 100, 96, 93, 94,
- 95, 91, 87, 82, 77, 74, 70, 67, 64, 62, 61, 61, 98, 96, 94, 90, 87, 84,
- 81, 77, 74, 71, 68, 65, 63, 61, 60, 60, 96, 95, 95, 87, 80, 77, 74, 72,
- 70, 68, 66, 64, 62, 61, 59, 59, 89, 90, 91, 84, 77, 74, 71, 69, 67, 65,
- 64, 62, 61, 59, 58, 58, 83, 85, 87, 81, 74, 71, 68, 66, 64, 63, 62, 60,
- 59, 58, 58, 58, 78, 80, 82, 77, 72, 69, 66, 64, 62, 61, 60, 59, 58, 58,
- 57, 57, 73, 75, 77, 74, 70, 67, 64, 62, 61, 60, 59, 58, 57, 57, 56, 56,
- 69, 71, 74, 71, 68, 65, 63, 61, 60, 59, 58, 57, 57, 56, 56, 56, 66, 68,
- 70, 68, 66, 64, 62, 60, 59, 58, 57, 56, 56, 55, 55, 55, 63, 65, 67, 65,
- 64, 62, 60, 59, 58, 57, 56, 56, 55, 55, 55, 55, 61, 63, 64, 63, 62, 61,
- 59, 58, 57, 57, 56, 55, 55, 55, 54, 54, 60, 61, 62, 61, 61, 59, 58, 58,
- 57, 56, 55, 55, 55, 54, 54, 54, 58, 59, 61, 60, 59, 58, 58, 57, 56, 56,
- 55, 55, 54, 54, 54, 54, 58, 59, 61, 60, 59, 58, 58, 57, 56, 56, 55, 55,
- 54, 54, 54, 54,
- /* Size 32 */
- 86, 90, 93, 97, 101, 100, 98, 97, 96, 93, 90, 87, 83, 81, 78, 76, 73,
- 71, 70, 68, 66, 65, 64, 63, 62, 61, 60, 59, 59, 59, 59, 59, 90, 92, 94,
- 97, 99, 98, 97, 97, 96, 93, 90, 87, 84, 82, 79, 77, 74, 73, 71, 69, 67,
- 66, 65, 64, 62, 62, 61, 60, 59, 59, 59, 59, 93, 94, 95, 96, 97, 97, 96,
- 96, 96, 93, 91, 88, 86, 83, 81, 78, 76, 74, 72, 70, 68, 67, 66, 64, 63,
- 62, 62, 61, 60, 60, 60, 60, 97, 97, 96, 96, 95, 95, 95, 96, 96, 93, 91,
- 89, 87, 84, 82, 79, 77, 75, 73, 71, 69, 68, 67, 65, 64, 63, 62, 61, 60,
- 60, 60, 60, 101, 99, 97, 95, 93, 94, 94, 95, 95, 94, 92, 90, 88, 85, 83,
- 80, 78, 76, 74, 72, 70, 69, 68, 66, 65, 64, 63, 62, 61, 61, 61, 61, 100,
- 98, 97, 95, 94, 93, 93, 92, 92, 90, 88, 86, 85, 82, 80, 78, 76, 74, 73,
- 71, 69, 68, 67, 65, 64, 63, 62, 62, 61, 61, 61, 61, 98, 97, 96, 95, 94,
- 93, 91, 90, 88, 86, 85, 83, 81, 80, 78, 76, 74, 73, 71, 70, 68, 67, 66,
- 65, 64, 63, 62, 61, 60, 60, 60, 60, 97, 97, 96, 96, 95, 92, 90, 87, 84,
- 83, 81, 80, 78, 77, 75, 74, 72, 71, 70, 68, 67, 66, 65, 64, 63, 62, 61,
- 61, 60, 60, 60, 60, 96, 96, 96, 96, 95, 92, 88, 84, 80, 79, 78, 76, 75,
- 74, 73, 72, 70, 69, 68, 67, 66, 65, 64, 63, 62, 62, 61, 60, 60, 60, 60,
- 60, 93, 93, 93, 93, 94, 90, 86, 83, 79, 78, 76, 75, 73, 72, 71, 70, 69,
- 68, 67, 66, 65, 64, 63, 63, 62, 61, 60, 60, 59, 59, 59, 59, 90, 90, 91,
- 91, 92, 88, 85, 81, 78, 76, 75, 73, 72, 71, 70, 69, 67, 67, 66, 65, 64,
- 63, 63, 62, 61, 61, 60, 59, 59, 59, 59, 59, 87, 87, 88, 89, 90, 86, 83,
- 80, 76, 75, 73, 72, 70, 69, 68, 67, 66, 65, 65, 64, 63, 62, 62, 61, 60,
- 60, 59, 59, 58, 58, 58, 58, 83, 84, 86, 87, 88, 85, 81, 78, 75, 73, 72,
- 70, 68, 67, 66, 66, 65, 64, 63, 63, 62, 61, 61, 60, 60, 59, 59, 58, 58,
- 58, 58, 58, 81, 82, 83, 84, 85, 82, 80, 77, 74, 72, 71, 69, 67, 66, 66,
- 65, 64, 63, 63, 62, 61, 61, 60, 60, 59, 59, 58, 58, 58, 58, 58, 58, 78,
- 79, 81, 82, 83, 80, 78, 75, 73, 71, 70, 68, 66, 66, 65, 64, 63, 62, 62,
- 61, 61, 60, 60, 59, 59, 58, 58, 58, 57, 57, 57, 57, 76, 77, 78, 79, 80,
- 78, 76, 74, 72, 70, 69, 67, 66, 65, 64, 63, 62, 62, 61, 60, 60, 59, 59,
- 59, 58, 58, 58, 57, 57, 57, 57, 57, 73, 74, 76, 77, 78, 76, 74, 72, 70,
- 69, 67, 66, 65, 64, 63, 62, 61, 61, 60, 60, 59, 59, 58, 58, 58, 57, 57,
- 57, 57, 57, 57, 57, 71, 73, 74, 75, 76, 74, 73, 71, 69, 68, 67, 65, 64,
- 63, 62, 62, 61, 60, 60, 59, 59, 58, 58, 58, 57, 57, 57, 57, 56, 56, 56,
- 56, 70, 71, 72, 73, 74, 73, 71, 70, 68, 67, 66, 65, 63, 63, 62, 61, 60,
- 60, 59, 59, 58, 58, 58, 57, 57, 57, 56, 56, 56, 56, 56, 56, 68, 69, 70,
- 71, 72, 71, 70, 68, 67, 66, 65, 64, 63, 62, 61, 60, 60, 59, 59, 58, 58,
- 58, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 66, 67, 68, 69, 70, 69, 68,
- 67, 66, 65, 64, 63, 62, 61, 61, 60, 59, 59, 58, 58, 57, 57, 57, 57, 56,
- 56, 56, 56, 55, 55, 55, 55, 65, 66, 67, 68, 69, 68, 67, 66, 65, 64, 63,
- 62, 61, 61, 60, 59, 59, 58, 58, 58, 57, 57, 57, 56, 56, 56, 56, 55, 55,
- 55, 55, 55, 64, 65, 66, 67, 68, 67, 66, 65, 64, 63, 63, 62, 61, 60, 60,
- 59, 58, 58, 58, 57, 57, 57, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 63,
- 64, 64, 65, 66, 65, 65, 64, 63, 63, 62, 61, 60, 60, 59, 59, 58, 58, 57,
- 57, 57, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 62, 62, 63, 64, 65,
- 64, 64, 63, 62, 62, 61, 60, 60, 59, 59, 58, 58, 57, 57, 57, 56, 56, 56,
- 56, 55, 55, 55, 55, 55, 55, 55, 55, 61, 62, 62, 63, 64, 63, 63, 62, 62,
- 61, 61, 60, 59, 59, 58, 58, 57, 57, 57, 56, 56, 56, 56, 55, 55, 55, 55,
- 55, 54, 54, 54, 54, 60, 61, 62, 62, 63, 62, 62, 61, 61, 60, 60, 59, 59,
- 58, 58, 58, 57, 57, 56, 56, 56, 56, 55, 55, 55, 55, 55, 54, 54, 54, 54,
- 54, 59, 60, 61, 61, 62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 58, 57, 57,
- 57, 56, 56, 56, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 59, 59, 60,
- 60, 61, 61, 60, 60, 60, 59, 59, 58, 58, 58, 57, 57, 57, 56, 56, 56, 55,
- 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 59, 59, 60, 60, 61, 61, 60,
- 60, 60, 59, 59, 58, 58, 58, 57, 57, 57, 56, 56, 56, 55, 55, 55, 55, 55,
- 54, 54, 54, 54, 54, 54, 54, 59, 59, 60, 60, 61, 61, 60, 60, 60, 59, 59,
- 58, 58, 58, 57, 57, 57, 56, 56, 56, 55, 55, 55, 55, 55, 54, 54, 54, 54,
- 54, 54, 54, 59, 59, 60, 60, 61, 61, 60, 60, 60, 59, 59, 58, 58, 58, 57,
- 57, 57, 56, 56, 56, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 51, 50, 45, 51, 48, 47, 44, 50, 47, 43, 41, 45, 44, 41, 40,
- /* Size 8 */
- 64, 72, 54, 52, 51, 49, 47, 45, 72, 59, 53, 55, 55, 53, 50, 48, 54, 53,
- 50, 51, 51, 50, 48, 47, 52, 55, 51, 48, 48, 47, 46, 45, 51, 55, 51, 48,
- 46, 45, 44, 43, 49, 53, 50, 47, 45, 44, 43, 42, 47, 50, 48, 46, 44, 43,
- 42, 41, 45, 48, 47, 45, 43, 42, 41, 41,
- /* Size 16 */
- 64, 68, 72, 63, 54, 53, 52, 52, 51, 50, 49, 48, 47, 46, 45, 45, 68, 67,
- 66, 59, 53, 54, 54, 53, 53, 52, 51, 50, 48, 47, 46, 46, 72, 66, 59, 56,
- 53, 54, 55, 55, 55, 54, 53, 51, 50, 49, 48, 48, 63, 59, 56, 54, 52, 52,
- 53, 53, 53, 52, 51, 50, 49, 48, 47, 47, 54, 53, 53, 52, 50, 50, 51, 51,
- 51, 50, 50, 49, 48, 47, 47, 47, 53, 54, 54, 52, 50, 50, 49, 49, 49, 49,
- 48, 48, 47, 46, 46, 46, 52, 54, 55, 53, 51, 49, 48, 48, 48, 47, 47, 46,
- 46, 45, 45, 45, 52, 53, 55, 53, 51, 49, 48, 47, 47, 46, 46, 45, 45, 45,
- 44, 44, 51, 53, 55, 53, 51, 49, 48, 47, 46, 45, 45, 44, 44, 44, 43, 43,
- 50, 52, 54, 52, 50, 49, 47, 46, 45, 45, 44, 44, 43, 43, 43, 43, 49, 51,
- 53, 51, 50, 48, 47, 46, 45, 44, 44, 43, 43, 42, 42, 42, 48, 50, 51, 50,
- 49, 48, 46, 45, 44, 44, 43, 43, 42, 42, 42, 42, 47, 48, 50, 49, 48, 47,
- 46, 45, 44, 43, 43, 42, 42, 42, 41, 41, 46, 47, 49, 48, 47, 46, 45, 45,
- 44, 43, 42, 42, 42, 41, 41, 41, 45, 46, 48, 47, 47, 46, 45, 44, 43, 43,
- 42, 42, 41, 41, 41, 41, 45, 46, 48, 47, 47, 46, 45, 44, 43, 43, 42, 42,
- 41, 41, 41, 41,
- /* Size 32 */
- 64, 66, 68, 70, 72, 67, 63, 58, 54, 53, 53, 53, 52, 52, 52, 51, 51, 50,
- 50, 49, 49, 48, 48, 47, 47, 46, 46, 45, 45, 45, 45, 45, 66, 67, 67, 68,
- 69, 65, 61, 57, 53, 53, 53, 53, 53, 53, 52, 52, 52, 51, 51, 50, 50, 49,
- 49, 48, 48, 47, 47, 46, 46, 46, 46, 46, 68, 67, 67, 66, 66, 63, 59, 56,
- 53, 53, 54, 54, 54, 54, 53, 53, 53, 52, 52, 51, 51, 50, 50, 49, 48, 48,
- 47, 47, 46, 46, 46, 46, 70, 68, 66, 64, 62, 60, 58, 56, 53, 54, 54, 54,
- 55, 54, 54, 54, 54, 53, 53, 52, 52, 51, 50, 50, 49, 49, 48, 48, 47, 47,
- 47, 47, 72, 69, 66, 62, 59, 58, 56, 55, 53, 54, 54, 55, 55, 55, 55, 55,
- 55, 54, 54, 53, 53, 52, 51, 51, 50, 50, 49, 48, 48, 48, 48, 48, 67, 65,
- 63, 60, 58, 56, 55, 54, 52, 53, 53, 54, 54, 54, 54, 54, 54, 53, 53, 52,
- 52, 51, 51, 50, 50, 49, 49, 48, 48, 48, 48, 48, 63, 61, 59, 58, 56, 55,
- 54, 53, 52, 52, 52, 53, 53, 53, 53, 53, 53, 52, 52, 52, 51, 51, 50, 50,
- 49, 49, 48, 48, 47, 47, 47, 47, 58, 57, 56, 56, 55, 54, 53, 52, 51, 51,
- 51, 52, 52, 52, 52, 52, 52, 51, 51, 51, 50, 50, 50, 49, 49, 48, 48, 47,
- 47, 47, 47, 47, 54, 53, 53, 53, 53, 52, 52, 51, 50, 50, 50, 50, 51, 51,
- 51, 51, 51, 50, 50, 50, 50, 49, 49, 49, 48, 48, 47, 47, 47, 47, 47, 47,
- 53, 53, 53, 54, 54, 53, 52, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 49, 49, 49, 49, 48, 48, 48, 47, 47, 46, 46, 46, 46, 46, 53, 53, 54, 54,
- 54, 53, 52, 51, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 48, 48, 48,
- 48, 47, 47, 47, 46, 46, 46, 46, 46, 46, 53, 53, 54, 54, 55, 54, 53, 52,
- 50, 50, 50, 49, 49, 49, 49, 48, 48, 48, 48, 48, 48, 47, 47, 47, 46, 46,
- 46, 46, 45, 45, 45, 45, 52, 53, 54, 55, 55, 54, 53, 52, 51, 50, 49, 49,
- 48, 48, 48, 48, 48, 47, 47, 47, 47, 47, 46, 46, 46, 46, 45, 45, 45, 45,
- 45, 45, 52, 53, 54, 54, 55, 54, 53, 52, 51, 50, 49, 49, 48, 48, 48, 47,
- 47, 47, 47, 47, 46, 46, 46, 46, 45, 45, 45, 45, 44, 44, 44, 44, 52, 52,
- 53, 54, 55, 54, 53, 52, 51, 50, 49, 49, 48, 48, 47, 47, 47, 46, 46, 46,
- 46, 46, 45, 45, 45, 45, 45, 44, 44, 44, 44, 44, 51, 52, 53, 54, 55, 54,
- 53, 52, 51, 50, 49, 48, 48, 47, 47, 47, 46, 46, 46, 46, 45, 45, 45, 45,
- 45, 44, 44, 44, 44, 44, 44, 44, 51, 52, 53, 54, 55, 54, 53, 52, 51, 50,
- 49, 48, 48, 47, 47, 46, 46, 46, 45, 45, 45, 45, 44, 44, 44, 44, 44, 44,
- 43, 43, 43, 43, 50, 51, 52, 53, 54, 53, 52, 51, 50, 50, 49, 48, 47, 47,
- 46, 46, 46, 45, 45, 45, 45, 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43,
- 50, 51, 52, 53, 54, 53, 52, 51, 50, 49, 49, 48, 47, 47, 46, 46, 45, 45,
- 45, 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 49, 50, 51, 52,
- 53, 52, 52, 51, 50, 49, 48, 48, 47, 47, 46, 46, 45, 45, 44, 44, 44, 44,
- 43, 43, 43, 43, 43, 43, 42, 42, 42, 42, 49, 50, 51, 52, 53, 52, 51, 50,
- 50, 49, 48, 48, 47, 46, 46, 45, 45, 45, 44, 44, 44, 43, 43, 43, 43, 43,
- 42, 42, 42, 42, 42, 42, 48, 49, 50, 51, 52, 51, 51, 50, 49, 49, 48, 47,
- 47, 46, 46, 45, 45, 44, 44, 44, 43, 43, 43, 43, 43, 42, 42, 42, 42, 42,
- 42, 42, 48, 49, 50, 50, 51, 51, 50, 50, 49, 48, 48, 47, 46, 46, 45, 45,
- 44, 44, 44, 43, 43, 43, 43, 43, 42, 42, 42, 42, 42, 42, 42, 42, 47, 48,
- 49, 50, 51, 50, 50, 49, 49, 48, 47, 47, 46, 46, 45, 45, 44, 44, 44, 43,
- 43, 43, 43, 42, 42, 42, 42, 42, 41, 41, 41, 41, 47, 48, 48, 49, 50, 50,
- 49, 49, 48, 48, 47, 46, 46, 45, 45, 45, 44, 44, 43, 43, 43, 43, 42, 42,
- 42, 42, 42, 41, 41, 41, 41, 41, 46, 47, 48, 49, 50, 49, 49, 48, 48, 47,
- 47, 46, 46, 45, 45, 44, 44, 44, 43, 43, 43, 42, 42, 42, 42, 42, 41, 41,
- 41, 41, 41, 41, 46, 47, 47, 48, 49, 49, 48, 48, 47, 47, 46, 46, 45, 45,
- 45, 44, 44, 43, 43, 43, 42, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41,
- 45, 46, 47, 48, 48, 48, 48, 47, 47, 46, 46, 46, 45, 45, 44, 44, 44, 43,
- 43, 43, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41, 45, 46, 46, 47,
- 48, 48, 47, 47, 47, 46, 46, 45, 45, 44, 44, 44, 43, 43, 43, 42, 42, 42,
- 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 45, 46, 46, 47, 48, 48, 47, 47,
- 47, 46, 46, 45, 45, 44, 44, 44, 43, 43, 43, 42, 42, 42, 42, 41, 41, 41,
- 41, 41, 41, 41, 41, 41, 45, 46, 46, 47, 48, 48, 47, 47, 47, 46, 46, 45,
- 45, 44, 44, 44, 43, 43, 43, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41,
- 41, 41, 45, 46, 46, 47, 48, 48, 47, 47, 47, 46, 46, 45, 45, 44, 44, 44,
- 43, 43, 43, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41 },
- { /* Intra matrices */
- /* Size 4 */
- 90, 72, 69, 63, 72, 66, 65, 62, 69, 65, 59, 57, 63, 62, 57, 54,
- /* Size 8 */
- 87, 98, 72, 70, 68, 65, 62, 60, 98, 80, 71, 74, 74, 70, 67, 64, 72, 71,
- 67, 68, 68, 66, 64, 62, 70, 74, 68, 64, 63, 62, 61, 59, 68, 74, 68, 63,
- 61, 59, 58, 57, 65, 70, 66, 62, 59, 58, 57, 56, 62, 67, 64, 61, 58, 57,
- 55, 54, 60, 64, 62, 59, 57, 56, 54, 53,
- /* Size 16 */
- 88, 93, 99, 86, 73, 72, 71, 70, 69, 67, 66, 64, 63, 62, 60, 60, 93, 92,
- 90, 81, 72, 73, 73, 72, 72, 70, 69, 67, 65, 64, 62, 62, 99, 90, 81, 76,
- 72, 74, 75, 75, 74, 73, 71, 69, 68, 66, 65, 65, 86, 81, 76, 73, 70, 71,
- 72, 72, 71, 70, 69, 68, 66, 65, 64, 64, 73, 72, 72, 70, 67, 68, 68, 68,
- 68, 68, 67, 66, 65, 64, 63, 63, 72, 73, 74, 71, 68, 67, 67, 66, 66, 66,
- 65, 64, 63, 62, 61, 61, 71, 73, 75, 72, 68, 67, 65, 65, 64, 63, 63, 62,
- 62, 61, 60, 60, 70, 72, 75, 72, 68, 66, 65, 64, 63, 62, 62, 61, 60, 60,
- 59, 59, 69, 72, 74, 71, 68, 66, 64, 63, 61, 61, 60, 60, 59, 58, 58, 58,
- 67, 70, 73, 70, 68, 66, 63, 62, 61, 60, 59, 59, 58, 58, 57, 57, 66, 69,
- 71, 69, 67, 65, 63, 62, 60, 59, 58, 58, 57, 57, 56, 56, 64, 67, 69, 68,
- 66, 64, 62, 61, 60, 59, 58, 57, 56, 56, 56, 56, 63, 65, 68, 66, 65, 63,
- 62, 60, 59, 58, 57, 56, 56, 55, 55, 55, 62, 64, 66, 65, 64, 62, 61, 60,
- 58, 58, 57, 56, 55, 55, 54, 54, 60, 62, 65, 64, 63, 61, 60, 59, 58, 57,
- 56, 56, 55, 54, 54, 54, 60, 62, 65, 64, 63, 61, 60, 59, 58, 57, 56, 56,
- 55, 54, 54, 54,
- /* Size 32 */
- 88, 91, 94, 97, 100, 93, 86, 80, 73, 73, 72, 72, 71, 71, 70, 70, 69, 68,
- 68, 67, 66, 65, 65, 64, 63, 63, 62, 61, 61, 61, 61, 61, 91, 92, 93, 94,
- 95, 89, 84, 78, 73, 73, 73, 72, 72, 72, 71, 71, 71, 70, 69, 68, 68, 67,
- 66, 65, 64, 64, 63, 62, 62, 62, 62, 62, 94, 93, 92, 91, 90, 86, 82, 77,
- 73, 73, 73, 73, 73, 73, 73, 72, 72, 71, 70, 70, 69, 68, 67, 66, 66, 65,
- 64, 63, 63, 63, 63, 63, 97, 94, 91, 89, 86, 83, 79, 76, 73, 73, 74, 74,
- 75, 74, 74, 74, 73, 73, 72, 71, 70, 69, 69, 68, 67, 66, 65, 65, 64, 64,
- 64, 64, 100, 95, 90, 86, 81, 79, 77, 75, 72, 73, 74, 75, 76, 75, 75, 75,
- 75, 74, 73, 72, 72, 71, 70, 69, 68, 67, 66, 66, 65, 65, 65, 65, 93, 89,
- 86, 83, 79, 77, 75, 73, 71, 72, 73, 73, 74, 74, 74, 73, 73, 73, 72, 71,
- 71, 70, 69, 68, 67, 67, 66, 65, 64, 64, 64, 64, 86, 84, 82, 79, 77, 75,
- 73, 72, 70, 71, 71, 72, 72, 72, 72, 72, 72, 71, 71, 70, 70, 69, 68, 67,
- 67, 66, 65, 65, 64, 64, 64, 64, 80, 78, 77, 76, 75, 73, 72, 70, 69, 69,
- 70, 70, 70, 70, 70, 70, 70, 70, 69, 69, 68, 68, 67, 67, 66, 65, 65, 64,
- 63, 63, 63, 63, 73, 73, 73, 73, 72, 71, 70, 69, 68, 68, 68, 68, 69, 69,
- 69, 69, 69, 68, 68, 68, 67, 67, 66, 66, 65, 65, 64, 63, 63, 63, 63, 63,
- 73, 73, 73, 73, 73, 72, 71, 69, 68, 68, 68, 68, 68, 68, 68, 68, 68, 67,
- 67, 67, 66, 66, 65, 65, 64, 64, 63, 63, 62, 62, 62, 62, 72, 73, 73, 74,
- 74, 73, 71, 70, 68, 68, 68, 67, 67, 67, 67, 67, 67, 66, 66, 66, 65, 65,
- 64, 64, 64, 63, 63, 62, 62, 62, 62, 62, 72, 72, 73, 74, 75, 73, 72, 70,
- 68, 68, 67, 67, 66, 66, 66, 66, 65, 65, 65, 65, 64, 64, 64, 63, 63, 62,
- 62, 62, 61, 61, 61, 61, 71, 72, 73, 75, 76, 74, 72, 70, 69, 68, 67, 66,
- 65, 65, 65, 65, 64, 64, 64, 64, 63, 63, 63, 62, 62, 62, 61, 61, 60, 60,
- 60, 60, 71, 72, 73, 74, 75, 74, 72, 70, 69, 68, 67, 66, 65, 65, 64, 64,
- 64, 63, 63, 63, 63, 62, 62, 62, 61, 61, 61, 60, 60, 60, 60, 60, 70, 71,
- 73, 74, 75, 74, 72, 70, 69, 68, 67, 66, 65, 64, 64, 64, 63, 63, 62, 62,
- 62, 62, 61, 61, 61, 60, 60, 60, 59, 59, 59, 59, 70, 71, 72, 74, 75, 73,
- 72, 70, 69, 68, 67, 66, 65, 64, 64, 63, 62, 62, 62, 61, 61, 61, 61, 60,
- 60, 60, 59, 59, 59, 59, 59, 59, 69, 71, 72, 73, 75, 73, 72, 70, 69, 68,
- 67, 65, 64, 64, 63, 62, 62, 61, 61, 61, 60, 60, 60, 60, 59, 59, 59, 59,
- 58, 58, 58, 58, 68, 70, 71, 73, 74, 73, 71, 70, 68, 67, 66, 65, 64, 63,
- 63, 62, 61, 61, 61, 60, 60, 60, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58,
- 68, 69, 70, 72, 73, 72, 71, 69, 68, 67, 66, 65, 64, 63, 62, 62, 61, 61,
- 60, 60, 60, 59, 59, 59, 58, 58, 58, 58, 57, 57, 57, 57, 67, 68, 70, 71,
- 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 61, 60, 60, 60, 59, 59,
- 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 66, 68, 69, 70, 72, 71, 70, 68,
- 67, 66, 65, 64, 63, 63, 62, 61, 60, 60, 60, 59, 59, 58, 58, 58, 57, 57,
- 57, 57, 57, 57, 57, 57, 65, 67, 68, 69, 71, 70, 69, 68, 67, 66, 65, 64,
- 63, 62, 62, 61, 60, 60, 59, 59, 58, 58, 58, 57, 57, 57, 57, 56, 56, 56,
- 56, 56, 65, 66, 67, 69, 70, 69, 68, 67, 66, 65, 64, 64, 63, 62, 61, 61,
- 60, 59, 59, 58, 58, 58, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 64, 65,
- 66, 68, 69, 68, 67, 67, 66, 65, 64, 63, 62, 62, 61, 60, 60, 59, 59, 58,
- 58, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 56, 63, 64, 66, 67, 68, 67,
- 67, 66, 65, 64, 64, 63, 62, 61, 61, 60, 59, 59, 58, 58, 57, 57, 57, 56,
- 56, 56, 56, 55, 55, 55, 55, 55, 63, 64, 65, 66, 67, 67, 66, 65, 65, 64,
- 63, 62, 62, 61, 60, 60, 59, 59, 58, 58, 57, 57, 57, 56, 56, 56, 55, 55,
- 55, 55, 55, 55, 62, 63, 64, 65, 66, 66, 65, 65, 64, 63, 63, 62, 61, 61,
- 60, 59, 59, 58, 58, 57, 57, 57, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55,
- 61, 62, 63, 65, 66, 65, 65, 64, 63, 63, 62, 62, 61, 60, 60, 59, 59, 58,
- 58, 57, 57, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 61, 62, 63, 64,
- 65, 64, 64, 63, 63, 62, 62, 61, 60, 60, 59, 59, 58, 58, 57, 57, 57, 56,
- 56, 56, 55, 55, 55, 55, 54, 54, 54, 54, 61, 62, 63, 64, 65, 64, 64, 63,
- 63, 62, 62, 61, 60, 60, 59, 59, 58, 58, 57, 57, 57, 56, 56, 56, 55, 55,
- 55, 55, 54, 54, 54, 54, 61, 62, 63, 64, 65, 64, 64, 63, 63, 62, 62, 61,
- 60, 60, 59, 59, 58, 58, 57, 57, 57, 56, 56, 56, 55, 55, 55, 55, 54, 54,
- 54, 54, 61, 62, 63, 64, 65, 64, 64, 63, 63, 62, 62, 61, 60, 60, 59, 59,
- 58, 58, 57, 57, 57, 56, 56, 56, 55, 55, 55, 55, 54, 54, 54, 54 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 62, 51, 46, 62, 53, 48, 45, 51, 48, 45, 43, 46, 45, 43, 42,
- /* Size 8 */
- 64, 72, 70, 62, 56, 52, 50, 48, 72, 68, 69, 65, 59, 55, 52, 49, 70, 69,
- 61, 57, 55, 52, 50, 49, 62, 65, 57, 53, 51, 50, 49, 48, 56, 59, 55, 51,
- 49, 48, 47, 47, 52, 55, 52, 50, 48, 47, 47, 46, 50, 52, 50, 49, 47, 47,
- 46, 46, 48, 49, 49, 48, 47, 46, 46, 45,
- /* Size 16 */
- 64, 68, 72, 71, 70, 66, 62, 59, 56, 54, 52, 51, 50, 49, 48, 48, 68, 69,
- 70, 70, 70, 67, 64, 61, 58, 56, 54, 52, 51, 50, 49, 49, 72, 70, 68, 69,
- 69, 67, 65, 62, 59, 57, 55, 53, 52, 50, 49, 49, 71, 70, 69, 67, 65, 63,
- 61, 59, 57, 55, 53, 52, 51, 50, 49, 49, 70, 70, 69, 65, 61, 59, 57, 56,
- 55, 53, 52, 51, 50, 49, 49, 49, 66, 67, 67, 63, 59, 57, 55, 54, 53, 52,
- 51, 50, 49, 49, 48, 48, 62, 64, 65, 61, 57, 55, 53, 52, 51, 51, 50, 49,
- 49, 48, 48, 48, 59, 61, 62, 59, 56, 54, 52, 51, 50, 50, 49, 49, 48, 48,
- 47, 47, 56, 58, 59, 57, 55, 53, 51, 50, 49, 49, 48, 48, 47, 47, 47, 47,
- 54, 56, 57, 55, 53, 52, 51, 50, 49, 48, 48, 47, 47, 47, 46, 46, 52, 54,
- 55, 53, 52, 51, 50, 49, 48, 48, 47, 47, 47, 46, 46, 46, 51, 52, 53, 52,
- 51, 50, 49, 49, 48, 47, 47, 47, 46, 46, 46, 46, 50, 51, 52, 51, 50, 49,
- 49, 48, 47, 47, 47, 46, 46, 46, 46, 46, 49, 50, 50, 50, 49, 49, 48, 48,
- 47, 47, 46, 46, 46, 46, 45, 45, 48, 49, 49, 49, 49, 48, 48, 47, 47, 46,
- 46, 46, 46, 45, 45, 45, 48, 49, 49, 49, 49, 48, 48, 47, 47, 46, 46, 46,
- 46, 45, 45, 45,
- /* Size 32 */
- 64, 66, 68, 70, 72, 72, 71, 70, 70, 68, 66, 64, 62, 61, 59, 58, 56, 55,
- 54, 53, 52, 52, 51, 50, 50, 49, 49, 48, 48, 48, 48, 48, 66, 67, 69, 70,
- 71, 71, 70, 70, 70, 68, 66, 65, 63, 61, 60, 59, 57, 56, 55, 54, 53, 52,
- 52, 51, 50, 50, 49, 49, 48, 48, 48, 48, 68, 69, 69, 70, 70, 70, 70, 70,
- 70, 68, 67, 65, 64, 62, 61, 59, 58, 57, 56, 55, 54, 53, 52, 51, 51, 50,
- 50, 49, 49, 49, 49, 49, 70, 70, 70, 69, 69, 69, 69, 69, 69, 68, 67, 66,
- 64, 63, 61, 60, 58, 57, 56, 55, 54, 53, 53, 52, 51, 51, 50, 49, 49, 49,
- 49, 49, 72, 71, 70, 69, 68, 68, 69, 69, 69, 68, 67, 66, 65, 63, 62, 61,
- 59, 58, 57, 56, 55, 54, 53, 52, 52, 51, 50, 50, 49, 49, 49, 49, 72, 71,
- 70, 69, 68, 68, 68, 67, 67, 66, 65, 64, 63, 62, 61, 59, 58, 57, 56, 55,
- 54, 53, 53, 52, 51, 51, 50, 50, 49, 49, 49, 49, 71, 70, 70, 69, 69, 68,
- 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 53, 52, 51,
- 51, 50, 50, 49, 49, 49, 49, 49, 70, 70, 70, 69, 69, 67, 66, 64, 63, 62,
- 61, 60, 59, 58, 58, 57, 56, 55, 54, 54, 53, 52, 52, 51, 50, 50, 50, 49,
- 49, 49, 49, 49, 70, 70, 70, 69, 69, 67, 65, 63, 61, 60, 59, 58, 57, 57,
- 56, 55, 55, 54, 53, 53, 52, 52, 51, 51, 50, 50, 49, 49, 49, 49, 49, 49,
- 68, 68, 68, 68, 68, 66, 64, 62, 60, 59, 58, 57, 56, 56, 55, 55, 54, 53,
- 53, 52, 52, 51, 51, 50, 50, 49, 49, 49, 48, 48, 48, 48, 66, 66, 67, 67,
- 67, 65, 63, 61, 59, 58, 57, 56, 55, 55, 54, 54, 53, 53, 52, 52, 51, 51,
- 50, 50, 49, 49, 49, 48, 48, 48, 48, 48, 64, 65, 65, 66, 66, 64, 62, 60,
- 58, 57, 56, 55, 54, 54, 53, 53, 52, 52, 51, 51, 50, 50, 50, 49, 49, 49,
- 48, 48, 48, 48, 48, 48, 62, 63, 64, 64, 65, 63, 61, 59, 57, 56, 55, 54,
- 53, 53, 52, 52, 51, 51, 51, 50, 50, 50, 49, 49, 49, 48, 48, 48, 48, 48,
- 48, 48, 61, 61, 62, 63, 63, 62, 60, 58, 57, 56, 55, 54, 53, 52, 52, 51,
- 51, 51, 50, 50, 49, 49, 49, 49, 48, 48, 48, 48, 47, 47, 47, 47, 59, 60,
- 61, 61, 62, 61, 59, 58, 56, 55, 54, 53, 52, 52, 51, 51, 50, 50, 50, 49,
- 49, 49, 49, 48, 48, 48, 48, 47, 47, 47, 47, 47, 58, 59, 59, 60, 61, 59,
- 58, 57, 55, 55, 54, 53, 52, 51, 51, 50, 50, 50, 49, 49, 49, 48, 48, 48,
- 48, 48, 47, 47, 47, 47, 47, 47, 56, 57, 58, 58, 59, 58, 57, 56, 55, 54,
- 53, 52, 51, 51, 50, 50, 49, 49, 49, 49, 48, 48, 48, 48, 47, 47, 47, 47,
- 47, 47, 47, 47, 55, 56, 57, 57, 58, 57, 56, 55, 54, 53, 53, 52, 51, 51,
- 50, 50, 49, 49, 49, 48, 48, 48, 48, 47, 47, 47, 47, 47, 47, 47, 47, 47,
- 54, 55, 56, 56, 57, 56, 55, 54, 53, 53, 52, 51, 51, 50, 50, 49, 49, 49,
- 48, 48, 48, 48, 47, 47, 47, 47, 47, 47, 46, 46, 46, 46, 53, 54, 55, 55,
- 56, 55, 54, 54, 53, 52, 52, 51, 50, 50, 49, 49, 49, 48, 48, 48, 48, 47,
- 47, 47, 47, 47, 47, 46, 46, 46, 46, 46, 52, 53, 54, 54, 55, 54, 53, 53,
- 52, 52, 51, 50, 50, 49, 49, 49, 48, 48, 48, 48, 47, 47, 47, 47, 47, 46,
- 46, 46, 46, 46, 46, 46, 52, 52, 53, 53, 54, 53, 53, 52, 52, 51, 51, 50,
- 50, 49, 49, 48, 48, 48, 48, 47, 47, 47, 47, 47, 46, 46, 46, 46, 46, 46,
- 46, 46, 51, 52, 52, 53, 53, 53, 52, 52, 51, 51, 50, 50, 49, 49, 49, 48,
- 48, 48, 47, 47, 47, 47, 47, 46, 46, 46, 46, 46, 46, 46, 46, 46, 50, 51,
- 51, 52, 52, 52, 51, 51, 51, 50, 50, 49, 49, 49, 48, 48, 48, 47, 47, 47,
- 47, 47, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 50, 50, 51, 51, 52, 51,
- 51, 50, 50, 50, 49, 49, 49, 48, 48, 48, 47, 47, 47, 47, 47, 46, 46, 46,
- 46, 46, 46, 46, 46, 46, 46, 46, 49, 50, 50, 51, 51, 51, 50, 50, 50, 49,
- 49, 49, 48, 48, 48, 48, 47, 47, 47, 47, 46, 46, 46, 46, 46, 46, 46, 46,
- 46, 46, 46, 46, 49, 49, 50, 50, 50, 50, 50, 50, 49, 49, 49, 48, 48, 48,
- 48, 47, 47, 47, 47, 47, 46, 46, 46, 46, 46, 46, 46, 46, 45, 45, 45, 45,
- 48, 49, 49, 49, 50, 50, 49, 49, 49, 49, 48, 48, 48, 48, 47, 47, 47, 47,
- 47, 46, 46, 46, 46, 46, 46, 46, 46, 45, 45, 45, 45, 45, 48, 48, 49, 49,
- 49, 49, 49, 49, 49, 48, 48, 48, 48, 47, 47, 47, 47, 47, 46, 46, 46, 46,
- 46, 46, 46, 46, 45, 45, 45, 45, 45, 45, 48, 48, 49, 49, 49, 49, 49, 49,
- 49, 48, 48, 48, 48, 47, 47, 47, 47, 47, 46, 46, 46, 46, 46, 46, 46, 46,
- 45, 45, 45, 45, 45, 45, 48, 48, 49, 49, 49, 49, 49, 49, 49, 48, 48, 48,
- 48, 47, 47, 47, 47, 47, 46, 46, 46, 46, 46, 46, 46, 46, 45, 45, 45, 45,
- 45, 45, 48, 48, 49, 49, 49, 49, 49, 49, 49, 48, 48, 48, 48, 47, 47, 47,
- 47, 47, 46, 46, 46, 46, 46, 46, 46, 46, 45, 45, 45, 45, 45, 45 },
- { /* Intra matrices */
- /* Size 4 */
- 86, 83, 68, 60, 83, 70, 64, 59, 68, 64, 59, 57, 60, 59, 57, 55,
- /* Size 8 */
- 79, 90, 87, 77, 69, 64, 61, 58, 90, 85, 86, 80, 73, 67, 63, 60, 87, 86,
- 75, 71, 67, 64, 61, 59, 77, 80, 71, 66, 63, 61, 59, 58, 69, 73, 67, 63,
- 60, 59, 58, 57, 64, 67, 64, 61, 59, 57, 57, 56, 61, 63, 61, 59, 58, 57,
- 56, 55, 58, 60, 59, 58, 57, 56, 55, 55,
- /* Size 16 */
- 80, 86, 91, 90, 88, 83, 78, 74, 70, 68, 65, 63, 61, 60, 59, 59, 86, 87,
- 89, 88, 88, 84, 80, 76, 72, 69, 66, 65, 63, 61, 60, 60, 91, 89, 86, 87,
- 87, 84, 82, 78, 74, 71, 68, 66, 64, 62, 61, 61, 90, 88, 87, 84, 82, 79,
- 77, 74, 71, 69, 66, 65, 63, 62, 60, 60, 88, 88, 87, 82, 76, 74, 72, 70,
- 68, 66, 65, 63, 62, 61, 60, 60, 83, 84, 84, 79, 74, 71, 69, 68, 66, 65,
- 63, 62, 61, 60, 59, 59, 78, 80, 82, 77, 72, 69, 66, 65, 64, 63, 62, 61,
- 60, 59, 59, 59, 74, 76, 78, 74, 70, 68, 65, 64, 62, 62, 61, 60, 59, 59,
- 58, 58, 70, 72, 74, 71, 68, 66, 64, 62, 61, 60, 60, 59, 58, 58, 57, 57,
- 68, 69, 71, 69, 66, 65, 63, 62, 60, 60, 59, 58, 58, 57, 57, 57, 65, 66,
- 68, 66, 65, 63, 62, 61, 60, 59, 58, 58, 57, 57, 57, 57, 63, 65, 66, 65,
- 63, 62, 61, 60, 59, 58, 58, 57, 57, 57, 56, 56, 61, 63, 64, 63, 62, 61,
- 60, 59, 58, 58, 57, 57, 57, 56, 56, 56, 60, 61, 62, 62, 61, 60, 59, 59,
- 58, 57, 57, 57, 56, 56, 56, 56, 59, 60, 61, 60, 60, 59, 59, 58, 57, 57,
- 57, 56, 56, 56, 56, 56, 59, 60, 61, 60, 60, 59, 59, 58, 57, 57, 57, 56,
- 56, 56, 56, 56,
- /* Size 32 */
- 81, 84, 86, 89, 92, 91, 90, 89, 89, 86, 84, 81, 79, 77, 75, 73, 71, 69,
- 68, 67, 65, 64, 64, 63, 62, 61, 61, 60, 59, 59, 59, 59, 84, 85, 87, 89,
- 91, 90, 89, 89, 88, 86, 84, 82, 79, 78, 76, 74, 72, 70, 69, 67, 66, 65,
- 64, 63, 62, 62, 61, 61, 60, 60, 60, 60, 86, 87, 88, 88, 89, 89, 89, 88,
- 88, 86, 84, 82, 80, 78, 76, 75, 73, 71, 70, 68, 67, 66, 65, 64, 63, 62,
- 62, 61, 60, 60, 60, 60, 89, 89, 88, 88, 88, 88, 88, 88, 88, 86, 85, 83,
- 81, 79, 77, 75, 74, 72, 71, 69, 68, 67, 66, 65, 64, 63, 62, 62, 61, 61,
- 61, 61, 92, 91, 89, 88, 86, 87, 87, 88, 88, 86, 85, 83, 82, 80, 78, 76,
- 74, 73, 71, 70, 68, 67, 66, 65, 64, 64, 63, 62, 61, 61, 61, 61, 91, 90,
- 89, 88, 87, 86, 86, 85, 85, 84, 82, 81, 80, 78, 76, 75, 73, 72, 70, 69,
- 68, 67, 66, 65, 64, 63, 62, 62, 61, 61, 61, 61, 90, 89, 89, 88, 87, 86,
- 85, 83, 82, 81, 80, 78, 77, 76, 74, 73, 72, 70, 69, 68, 67, 66, 65, 64,
- 63, 63, 62, 61, 61, 61, 61, 61, 89, 89, 88, 88, 88, 85, 83, 81, 79, 78,
- 77, 76, 75, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 64, 63, 62, 62, 61,
- 61, 61, 61, 61, 89, 88, 88, 88, 88, 85, 82, 79, 76, 75, 74, 73, 72, 71,
- 70, 69, 69, 68, 67, 66, 65, 64, 64, 63, 62, 62, 61, 61, 60, 60, 60, 60,
- 86, 86, 86, 86, 86, 84, 81, 78, 75, 74, 73, 72, 71, 70, 69, 68, 67, 67,
- 66, 65, 64, 64, 63, 63, 62, 61, 61, 60, 60, 60, 60, 60, 84, 84, 84, 85,
- 85, 82, 80, 77, 74, 73, 72, 71, 70, 69, 68, 67, 66, 66, 65, 64, 64, 63,
- 63, 62, 61, 61, 61, 60, 60, 60, 60, 60, 81, 82, 82, 83, 83, 81, 78, 76,
- 73, 72, 71, 69, 68, 67, 67, 66, 65, 65, 64, 63, 63, 62, 62, 61, 61, 60,
- 60, 60, 59, 59, 59, 59, 79, 79, 80, 81, 82, 80, 77, 75, 72, 71, 70, 68,
- 67, 66, 65, 65, 64, 64, 63, 63, 62, 62, 61, 61, 60, 60, 60, 59, 59, 59,
- 59, 59, 77, 78, 78, 79, 80, 78, 76, 73, 71, 70, 69, 67, 66, 66, 65, 64,
- 63, 63, 63, 62, 62, 61, 61, 60, 60, 60, 59, 59, 59, 59, 59, 59, 75, 76,
- 76, 77, 78, 76, 74, 72, 70, 69, 68, 67, 65, 65, 64, 63, 63, 62, 62, 61,
- 61, 61, 60, 60, 60, 59, 59, 59, 58, 58, 58, 58, 73, 74, 75, 75, 76, 75,
- 73, 71, 69, 68, 67, 66, 65, 64, 63, 63, 62, 62, 61, 61, 60, 60, 60, 60,
- 59, 59, 59, 58, 58, 58, 58, 58, 71, 72, 73, 74, 74, 73, 72, 70, 69, 67,
- 66, 65, 64, 63, 63, 62, 62, 61, 61, 60, 60, 60, 59, 59, 59, 59, 58, 58,
- 58, 58, 58, 58, 69, 70, 71, 72, 73, 72, 70, 69, 68, 67, 66, 65, 64, 63,
- 62, 62, 61, 61, 60, 60, 60, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 58,
- 68, 69, 70, 71, 71, 70, 69, 68, 67, 66, 65, 64, 63, 63, 62, 61, 61, 60,
- 60, 60, 59, 59, 59, 58, 58, 58, 58, 58, 57, 57, 57, 57, 67, 67, 68, 69,
- 70, 69, 68, 67, 66, 65, 64, 63, 63, 62, 61, 61, 60, 60, 60, 59, 59, 59,
- 58, 58, 58, 58, 58, 57, 57, 57, 57, 57, 65, 66, 67, 68, 68, 68, 67, 66,
- 65, 64, 64, 63, 62, 62, 61, 60, 60, 60, 59, 59, 59, 58, 58, 58, 58, 57,
- 57, 57, 57, 57, 57, 57, 64, 65, 66, 67, 67, 67, 66, 65, 64, 64, 63, 62,
- 62, 61, 61, 60, 60, 59, 59, 59, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57,
- 57, 57, 64, 64, 65, 66, 66, 66, 65, 64, 64, 63, 63, 62, 61, 61, 60, 60,
- 59, 59, 59, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 57, 57, 57, 63, 63,
- 64, 65, 65, 65, 64, 64, 63, 63, 62, 61, 61, 60, 60, 60, 59, 59, 58, 58,
- 58, 58, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 62, 62, 63, 64, 64, 64,
- 63, 63, 62, 62, 61, 61, 60, 60, 60, 59, 59, 58, 58, 58, 58, 57, 57, 57,
- 57, 57, 57, 56, 56, 56, 56, 56, 61, 62, 62, 63, 64, 63, 63, 62, 62, 61,
- 61, 60, 60, 60, 59, 59, 59, 58, 58, 58, 57, 57, 57, 57, 57, 57, 56, 56,
- 56, 56, 56, 56, 61, 61, 62, 62, 63, 62, 62, 62, 61, 61, 61, 60, 60, 59,
- 59, 59, 58, 58, 58, 58, 57, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56,
- 60, 61, 61, 62, 62, 62, 61, 61, 61, 60, 60, 60, 59, 59, 59, 58, 58, 58,
- 58, 57, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 56, 59, 60, 60, 61,
- 61, 61, 61, 61, 60, 60, 60, 59, 59, 59, 58, 58, 58, 58, 57, 57, 57, 57,
- 57, 57, 56, 56, 56, 56, 56, 56, 56, 56, 59, 60, 60, 61, 61, 61, 61, 61,
- 60, 60, 60, 59, 59, 59, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 56, 56,
- 56, 56, 56, 56, 56, 56, 59, 60, 60, 61, 61, 61, 61, 61, 60, 60, 60, 59,
- 59, 59, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56,
- 56, 56, 59, 60, 60, 61, 61, 61, 61, 61, 60, 60, 60, 59, 59, 59, 58, 58,
- 58, 58, 57, 57, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 56 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 53, 52, 48, 53, 50, 49, 48, 52, 49, 46, 45, 48, 48, 45, 43,
- /* Size 8 */
- 64, 71, 55, 54, 53, 51, 50, 48, 71, 60, 55, 57, 56, 54, 52, 51, 55, 55,
- 52, 53, 53, 52, 51, 49, 54, 57, 53, 51, 50, 50, 49, 48, 53, 56, 53, 50,
- 49, 48, 47, 47, 51, 54, 52, 50, 48, 47, 46, 46, 50, 52, 51, 49, 47, 46,
- 46, 45, 48, 51, 49, 48, 47, 46, 45, 44,
- /* Size 16 */
- 64, 67, 71, 63, 55, 55, 54, 54, 53, 52, 51, 50, 50, 49, 48, 48, 67, 66,
- 65, 60, 55, 55, 56, 55, 55, 54, 53, 52, 51, 50, 49, 49, 71, 65, 60, 58,
- 55, 56, 57, 57, 56, 55, 54, 53, 52, 51, 51, 51, 63, 60, 58, 56, 54, 54,
- 55, 55, 55, 54, 53, 52, 52, 51, 50, 50, 55, 55, 55, 54, 52, 53, 53, 53,
- 53, 52, 52, 51, 51, 50, 49, 49, 55, 55, 56, 54, 53, 52, 52, 52, 52, 51,
- 51, 50, 50, 49, 49, 49, 54, 56, 57, 55, 53, 52, 51, 51, 50, 50, 50, 49,
- 49, 48, 48, 48, 54, 55, 57, 55, 53, 52, 51, 50, 50, 49, 49, 48, 48, 48,
- 47, 47, 53, 55, 56, 55, 53, 52, 50, 50, 49, 48, 48, 48, 47, 47, 47, 47,
- 52, 54, 55, 54, 52, 51, 50, 49, 48, 48, 47, 47, 47, 47, 46, 46, 51, 53,
- 54, 53, 52, 51, 50, 49, 48, 47, 47, 47, 46, 46, 46, 46, 50, 52, 53, 52,
- 51, 50, 49, 48, 48, 47, 47, 46, 46, 46, 45, 45, 50, 51, 52, 52, 51, 50,
- 49, 48, 47, 47, 46, 46, 46, 45, 45, 45, 49, 50, 51, 51, 50, 49, 48, 48,
- 47, 47, 46, 46, 45, 45, 45, 45, 48, 49, 51, 50, 49, 49, 48, 47, 47, 46,
- 46, 45, 45, 45, 44, 44, 48, 49, 51, 50, 49, 49, 48, 47, 47, 46, 46, 45,
- 45, 45, 44, 44,
- /* Size 32 */
- 64, 66, 67, 69, 71, 67, 63, 59, 55, 55, 55, 54, 54, 54, 54, 53, 53, 53,
- 52, 52, 51, 51, 50, 50, 50, 49, 49, 48, 48, 48, 48, 48, 66, 66, 67, 67,
- 68, 65, 62, 58, 55, 55, 55, 55, 55, 55, 54, 54, 54, 53, 53, 53, 52, 52,
- 51, 51, 50, 50, 50, 49, 49, 49, 49, 49, 67, 67, 66, 66, 65, 63, 60, 58,
- 55, 55, 55, 55, 56, 55, 55, 55, 55, 54, 54, 53, 53, 52, 52, 51, 51, 51,
- 50, 50, 49, 49, 49, 49, 69, 67, 66, 64, 63, 61, 59, 57, 55, 55, 56, 56,
- 56, 56, 56, 56, 55, 55, 55, 54, 54, 53, 53, 52, 52, 51, 51, 50, 50, 50,
- 50, 50, 71, 68, 65, 63, 60, 59, 58, 56, 55, 55, 56, 56, 57, 57, 57, 56,
- 56, 56, 55, 55, 54, 54, 53, 53, 52, 52, 51, 51, 51, 51, 51, 51, 67, 65,
- 63, 61, 59, 58, 57, 55, 54, 55, 55, 55, 56, 56, 56, 56, 55, 55, 55, 54,
- 54, 53, 53, 52, 52, 52, 51, 51, 50, 50, 50, 50, 63, 62, 60, 59, 58, 57,
- 56, 55, 54, 54, 54, 54, 55, 55, 55, 55, 55, 54, 54, 54, 53, 53, 52, 52,
- 52, 51, 51, 50, 50, 50, 50, 50, 59, 58, 58, 57, 56, 55, 55, 54, 53, 53,
- 53, 54, 54, 54, 54, 54, 54, 53, 53, 53, 53, 52, 52, 52, 51, 51, 50, 50,
- 50, 50, 50, 50, 55, 55, 55, 55, 55, 54, 54, 53, 52, 52, 53, 53, 53, 53,
- 53, 53, 53, 53, 52, 52, 52, 52, 51, 51, 51, 50, 50, 50, 49, 49, 49, 49,
- 55, 55, 55, 55, 55, 55, 54, 53, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
- 52, 52, 51, 51, 51, 51, 50, 50, 50, 49, 49, 49, 49, 49, 55, 55, 55, 56,
- 56, 55, 54, 53, 53, 52, 52, 52, 52, 52, 52, 52, 52, 51, 51, 51, 51, 51,
- 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 54, 55, 55, 56, 56, 55, 54, 54,
- 53, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 49, 49,
- 49, 49, 48, 48, 48, 48, 54, 55, 56, 56, 57, 56, 55, 54, 53, 52, 52, 51,
- 51, 51, 51, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 48, 48, 48, 48,
- 48, 48, 54, 55, 55, 56, 57, 56, 55, 54, 53, 52, 52, 51, 51, 51, 50, 50,
- 50, 50, 50, 49, 49, 49, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48, 54, 54,
- 55, 56, 57, 56, 55, 54, 53, 52, 52, 51, 51, 50, 50, 50, 50, 49, 49, 49,
- 49, 49, 48, 48, 48, 48, 48, 48, 47, 47, 47, 47, 53, 54, 55, 56, 56, 56,
- 55, 54, 53, 52, 52, 51, 50, 50, 50, 49, 49, 49, 49, 49, 48, 48, 48, 48,
- 48, 48, 47, 47, 47, 47, 47, 47, 53, 54, 55, 55, 56, 55, 55, 54, 53, 52,
- 52, 51, 50, 50, 50, 49, 49, 49, 48, 48, 48, 48, 48, 48, 47, 47, 47, 47,
- 47, 47, 47, 47, 53, 53, 54, 55, 56, 55, 54, 53, 53, 52, 51, 51, 50, 50,
- 49, 49, 49, 48, 48, 48, 48, 48, 47, 47, 47, 47, 47, 47, 46, 46, 46, 46,
- 52, 53, 54, 55, 55, 55, 54, 53, 52, 52, 51, 51, 50, 50, 49, 49, 48, 48,
- 48, 48, 47, 47, 47, 47, 47, 47, 47, 46, 46, 46, 46, 46, 52, 53, 53, 54,
- 55, 54, 54, 53, 52, 52, 51, 50, 50, 49, 49, 49, 48, 48, 48, 47, 47, 47,
- 47, 47, 47, 46, 46, 46, 46, 46, 46, 46, 51, 52, 53, 54, 54, 54, 53, 53,
- 52, 51, 51, 50, 50, 49, 49, 48, 48, 48, 47, 47, 47, 47, 47, 46, 46, 46,
- 46, 46, 46, 46, 46, 46, 51, 52, 52, 53, 54, 53, 53, 52, 52, 51, 51, 50,
- 49, 49, 49, 48, 48, 48, 47, 47, 47, 47, 46, 46, 46, 46, 46, 46, 46, 46,
- 46, 46, 50, 51, 52, 53, 53, 53, 52, 52, 51, 51, 50, 50, 49, 49, 48, 48,
- 48, 47, 47, 47, 47, 46, 46, 46, 46, 46, 46, 45, 45, 45, 45, 45, 50, 51,
- 51, 52, 53, 52, 52, 52, 51, 51, 50, 50, 49, 49, 48, 48, 48, 47, 47, 47,
- 46, 46, 46, 46, 46, 46, 45, 45, 45, 45, 45, 45, 50, 50, 51, 52, 52, 52,
- 52, 51, 51, 50, 50, 49, 49, 49, 48, 48, 47, 47, 47, 47, 46, 46, 46, 46,
- 46, 45, 45, 45, 45, 45, 45, 45, 49, 50, 51, 51, 52, 52, 51, 51, 50, 50,
- 50, 49, 49, 48, 48, 48, 47, 47, 47, 46, 46, 46, 46, 46, 45, 45, 45, 45,
- 45, 45, 45, 45, 49, 50, 50, 51, 51, 51, 51, 50, 50, 50, 49, 49, 48, 48,
- 48, 47, 47, 47, 47, 46, 46, 46, 46, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 48, 49, 50, 50, 51, 51, 50, 50, 50, 49, 49, 49, 48, 48, 48, 47, 47, 47,
- 46, 46, 46, 46, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 48, 49, 49, 50,
- 51, 50, 50, 50, 49, 49, 49, 48, 48, 48, 47, 47, 47, 46, 46, 46, 46, 46,
- 45, 45, 45, 45, 45, 45, 44, 44, 44, 44, 48, 49, 49, 50, 51, 50, 50, 50,
- 49, 49, 49, 48, 48, 48, 47, 47, 47, 46, 46, 46, 46, 46, 45, 45, 45, 45,
- 45, 45, 44, 44, 44, 44, 48, 49, 49, 50, 51, 50, 50, 50, 49, 49, 49, 48,
- 48, 48, 47, 47, 47, 46, 46, 46, 46, 46, 45, 45, 45, 45, 45, 45, 44, 44,
- 44, 44, 48, 49, 49, 50, 51, 50, 50, 50, 49, 49, 49, 48, 48, 48, 47, 47,
- 47, 46, 46, 46, 46, 46, 45, 45, 45, 45, 45, 45, 44, 44, 44, 44 },
- { /* Intra matrices */
- /* Size 4 */
- 85, 70, 68, 63, 70, 66, 64, 62, 68, 64, 60, 58, 63, 62, 58, 56,
- /* Size 8 */
- 82, 91, 70, 69, 67, 65, 62, 60, 91, 76, 70, 72, 71, 69, 66, 64, 70, 70,
- 66, 67, 67, 66, 64, 62, 69, 72, 67, 64, 63, 62, 61, 60, 67, 71, 67, 63,
- 61, 60, 59, 59, 65, 69, 66, 62, 60, 59, 58, 57, 62, 66, 64, 61, 59, 58,
- 57, 56, 60, 64, 62, 60, 59, 57, 56, 55,
- /* Size 16 */
- 82, 87, 91, 81, 71, 70, 69, 68, 68, 66, 65, 64, 63, 62, 61, 61, 87, 86,
- 84, 77, 70, 71, 71, 70, 70, 69, 67, 66, 65, 64, 63, 63, 91, 84, 77, 74,
- 70, 71, 73, 72, 72, 71, 70, 68, 67, 65, 64, 64, 81, 77, 74, 71, 68, 69,
- 70, 70, 70, 69, 68, 67, 66, 65, 63, 63, 71, 70, 70, 68, 67, 67, 67, 67,
- 67, 67, 66, 65, 65, 64, 63, 63, 70, 71, 71, 69, 67, 66, 66, 66, 66, 65,
- 65, 64, 63, 62, 62, 62, 69, 71, 73, 70, 67, 66, 65, 64, 64, 63, 63, 62,
- 62, 61, 61, 61, 68, 70, 72, 70, 67, 66, 64, 64, 63, 62, 62, 61, 61, 60,
- 60, 60, 68, 70, 72, 70, 67, 66, 64, 63, 62, 61, 61, 60, 60, 59, 59, 59,
- 66, 69, 71, 69, 67, 65, 63, 62, 61, 61, 60, 60, 59, 59, 58, 58, 65, 67,
- 70, 68, 66, 65, 63, 62, 61, 60, 59, 59, 58, 58, 58, 58, 64, 66, 68, 67,
- 65, 64, 62, 61, 60, 60, 59, 58, 58, 58, 57, 57, 63, 65, 67, 66, 65, 63,
- 62, 61, 60, 59, 58, 58, 57, 57, 57, 57, 62, 64, 65, 65, 64, 62, 61, 60,
- 59, 59, 58, 58, 57, 57, 56, 56, 61, 63, 64, 63, 63, 62, 61, 60, 59, 58,
- 58, 57, 57, 56, 56, 56, 61, 63, 64, 63, 63, 62, 61, 60, 59, 58, 58, 57,
- 57, 56, 56, 56,
- /* Size 32 */
- 83, 85, 87, 90, 92, 87, 81, 76, 71, 71, 70, 70, 69, 69, 69, 68, 68, 67,
- 67, 66, 66, 65, 64, 64, 63, 63, 62, 62, 61, 61, 61, 61, 85, 86, 87, 87,
- 88, 84, 79, 75, 71, 71, 71, 70, 70, 70, 70, 69, 69, 68, 68, 67, 67, 66,
- 65, 65, 64, 64, 63, 63, 62, 62, 62, 62, 87, 87, 86, 85, 85, 81, 78, 74,
- 71, 71, 71, 71, 71, 71, 71, 70, 70, 69, 69, 68, 68, 67, 66, 66, 65, 65,
- 64, 63, 63, 63, 63, 63, 90, 87, 85, 83, 81, 78, 76, 73, 71, 71, 71, 72,
- 72, 72, 72, 71, 71, 71, 70, 69, 69, 68, 67, 67, 66, 66, 65, 64, 64, 64,
- 64, 64, 92, 88, 85, 81, 77, 76, 74, 72, 70, 71, 72, 72, 73, 73, 73, 72,
- 72, 72, 71, 70, 70, 69, 68, 68, 67, 66, 66, 65, 65, 65, 65, 65, 87, 84,
- 81, 78, 76, 74, 73, 71, 70, 70, 71, 71, 72, 72, 71, 71, 71, 71, 70, 70,
- 69, 68, 68, 67, 67, 66, 65, 65, 64, 64, 64, 64, 81, 79, 78, 76, 74, 73,
- 71, 70, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 69, 69, 68, 68, 67, 66,
- 66, 65, 65, 64, 64, 64, 64, 64, 76, 75, 74, 73, 72, 71, 70, 69, 68, 68,
- 68, 69, 69, 69, 69, 69, 69, 68, 68, 68, 67, 67, 66, 66, 65, 65, 64, 64,
- 63, 63, 63, 63, 71, 71, 71, 71, 70, 70, 69, 68, 67, 67, 67, 67, 68, 68,
- 68, 68, 68, 67, 67, 67, 67, 66, 66, 65, 65, 64, 64, 63, 63, 63, 63, 63,
- 71, 71, 71, 71, 71, 70, 69, 68, 67, 67, 67, 67, 67, 67, 67, 67, 67, 66,
- 66, 66, 66, 65, 65, 65, 64, 64, 63, 63, 62, 62, 62, 62, 70, 71, 71, 71,
- 72, 71, 69, 68, 67, 67, 67, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65,
- 64, 64, 64, 63, 63, 62, 62, 62, 62, 62, 70, 70, 71, 72, 72, 71, 70, 69,
- 67, 67, 66, 66, 66, 65, 65, 65, 65, 65, 65, 64, 64, 64, 63, 63, 63, 63,
- 62, 62, 62, 62, 62, 62, 69, 70, 71, 72, 73, 72, 70, 69, 68, 67, 66, 66,
- 65, 65, 65, 64, 64, 64, 64, 63, 63, 63, 63, 63, 62, 62, 62, 61, 61, 61,
- 61, 61, 69, 70, 71, 72, 73, 72, 70, 69, 68, 67, 66, 65, 65, 64, 64, 64,
- 64, 63, 63, 63, 63, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 69, 70,
- 71, 72, 73, 71, 70, 69, 68, 67, 66, 65, 65, 64, 64, 63, 63, 63, 63, 62,
- 62, 62, 62, 61, 61, 61, 61, 60, 60, 60, 60, 60, 68, 69, 70, 71, 72, 71,
- 70, 69, 68, 67, 66, 65, 64, 64, 63, 63, 63, 62, 62, 62, 62, 61, 61, 61,
- 61, 60, 60, 60, 60, 60, 60, 60, 68, 69, 70, 71, 72, 71, 70, 69, 68, 67,
- 66, 65, 64, 64, 63, 63, 62, 62, 62, 61, 61, 61, 61, 60, 60, 60, 60, 60,
- 59, 59, 59, 59, 67, 68, 69, 71, 72, 71, 70, 68, 67, 66, 66, 65, 64, 63,
- 63, 62, 62, 62, 61, 61, 61, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59,
- 67, 68, 69, 70, 71, 70, 69, 68, 67, 66, 65, 65, 64, 63, 63, 62, 62, 61,
- 61, 61, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 66, 67, 68, 69,
- 70, 70, 69, 68, 67, 66, 65, 64, 63, 63, 62, 62, 61, 61, 61, 60, 60, 60,
- 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 66, 67, 68, 69, 70, 69, 68, 67,
- 67, 66, 65, 64, 63, 63, 62, 62, 61, 61, 60, 60, 60, 59, 59, 59, 59, 58,
- 58, 58, 58, 58, 58, 58, 65, 66, 67, 68, 69, 68, 68, 67, 66, 65, 65, 64,
- 63, 62, 62, 61, 61, 60, 60, 60, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58,
- 58, 58, 64, 65, 66, 67, 68, 68, 67, 66, 66, 65, 64, 63, 63, 62, 62, 61,
- 61, 60, 60, 59, 59, 59, 59, 58, 58, 58, 58, 58, 57, 57, 57, 57, 64, 65,
- 66, 67, 68, 67, 66, 66, 65, 65, 64, 63, 63, 62, 61, 61, 60, 60, 60, 59,
- 59, 59, 58, 58, 58, 58, 58, 57, 57, 57, 57, 57, 63, 64, 65, 66, 67, 67,
- 66, 65, 65, 64, 64, 63, 62, 62, 61, 61, 60, 60, 59, 59, 59, 58, 58, 58,
- 58, 57, 57, 57, 57, 57, 57, 57, 63, 64, 65, 66, 66, 66, 65, 65, 64, 64,
- 63, 63, 62, 61, 61, 60, 60, 60, 59, 59, 58, 58, 58, 58, 57, 57, 57, 57,
- 57, 57, 57, 57, 62, 63, 64, 65, 66, 65, 65, 64, 64, 63, 63, 62, 62, 61,
- 61, 60, 60, 59, 59, 59, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 57, 57,
- 62, 63, 63, 64, 65, 65, 64, 64, 63, 63, 62, 62, 61, 61, 60, 60, 60, 59,
- 59, 58, 58, 58, 58, 57, 57, 57, 57, 57, 56, 56, 56, 56, 61, 62, 63, 64,
- 65, 64, 64, 63, 63, 62, 62, 62, 61, 61, 60, 60, 59, 59, 59, 58, 58, 58,
- 57, 57, 57, 57, 57, 56, 56, 56, 56, 56, 61, 62, 63, 64, 65, 64, 64, 63,
- 63, 62, 62, 62, 61, 61, 60, 60, 59, 59, 59, 58, 58, 58, 57, 57, 57, 57,
- 57, 56, 56, 56, 56, 56, 61, 62, 63, 64, 65, 64, 64, 63, 63, 62, 62, 62,
- 61, 61, 60, 60, 59, 59, 59, 58, 58, 58, 57, 57, 57, 57, 57, 56, 56, 56,
- 56, 56, 61, 62, 63, 64, 65, 64, 64, 63, 63, 62, 62, 62, 61, 61, 60, 60,
- 59, 59, 59, 58, 58, 58, 57, 57, 57, 57, 57, 56, 56, 56, 56, 56 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 62, 54, 50, 62, 55, 52, 49, 54, 52, 49, 48, 50, 49, 48, 47,
- /* Size 8 */
- 64, 70, 68, 63, 58, 55, 53, 52, 70, 67, 68, 65, 60, 57, 54, 53, 68, 68,
- 61, 59, 57, 55, 53, 52, 63, 65, 59, 56, 54, 53, 52, 51, 58, 60, 57, 54,
- 53, 52, 51, 51, 55, 57, 55, 53, 52, 51, 51, 50, 53, 54, 53, 52, 51, 51,
- 50, 50, 52, 53, 52, 51, 51, 50, 50, 50,
- /* Size 16 */
- 64, 67, 70, 69, 68, 66, 63, 60, 58, 57, 55, 54, 53, 52, 52, 52, 67, 68,
- 69, 69, 68, 66, 64, 61, 59, 58, 56, 55, 54, 53, 52, 52, 70, 69, 67, 68,
- 68, 66, 65, 62, 60, 59, 57, 56, 54, 53, 53, 53, 69, 69, 68, 66, 65, 63,
- 62, 60, 59, 57, 56, 55, 54, 53, 52, 52, 68, 68, 68, 65, 61, 60, 59, 58,
- 57, 56, 55, 54, 53, 53, 52, 52, 66, 66, 66, 63, 60, 59, 57, 56, 56, 55,
- 54, 53, 53, 52, 52, 52, 63, 64, 65, 62, 59, 57, 56, 55, 54, 54, 53, 53,
- 52, 52, 51, 51, 60, 61, 62, 60, 58, 56, 55, 54, 54, 53, 52, 52, 52, 51,
- 51, 51, 58, 59, 60, 59, 57, 56, 54, 54, 53, 52, 52, 52, 51, 51, 51, 51,
- 57, 58, 59, 57, 56, 55, 54, 53, 52, 52, 51, 51, 51, 51, 50, 50, 55, 56,
- 57, 56, 55, 54, 53, 52, 52, 51, 51, 51, 51, 50, 50, 50, 54, 55, 56, 55,
- 54, 53, 53, 52, 52, 51, 51, 51, 50, 50, 50, 50, 53, 54, 54, 54, 53, 53,
- 52, 52, 51, 51, 51, 50, 50, 50, 50, 50, 52, 53, 53, 53, 53, 52, 52, 51,
- 51, 51, 50, 50, 50, 50, 50, 50, 52, 52, 53, 52, 52, 52, 51, 51, 51, 50,
- 50, 50, 50, 50, 50, 50, 52, 52, 53, 52, 52, 52, 51, 51, 51, 50, 50, 50,
- 50, 50, 50, 50,
- /* Size 32 */
- 64, 66, 67, 69, 70, 70, 69, 69, 68, 67, 66, 64, 63, 62, 60, 59, 58, 57,
- 57, 56, 55, 54, 54, 53, 53, 53, 52, 52, 52, 52, 52, 52, 66, 67, 68, 69,
- 70, 69, 69, 69, 68, 67, 66, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 55,
- 54, 54, 53, 53, 53, 52, 52, 52, 52, 52, 67, 68, 68, 68, 69, 69, 69, 68,
- 68, 67, 66, 65, 64, 63, 61, 60, 59, 58, 58, 57, 56, 55, 55, 54, 54, 53,
- 53, 52, 52, 52, 52, 52, 69, 69, 68, 68, 68, 68, 68, 68, 68, 67, 66, 65,
- 64, 63, 62, 61, 60, 59, 58, 57, 56, 56, 55, 55, 54, 54, 53, 53, 52, 52,
- 52, 52, 70, 70, 69, 68, 67, 67, 68, 68, 68, 67, 66, 66, 65, 64, 62, 61,
- 60, 59, 59, 58, 57, 56, 56, 55, 54, 54, 53, 53, 53, 53, 53, 53, 70, 69,
- 69, 68, 67, 67, 67, 67, 66, 66, 65, 64, 63, 62, 61, 60, 59, 59, 58, 57,
- 56, 56, 55, 55, 54, 54, 53, 53, 52, 52, 52, 52, 69, 69, 69, 68, 68, 67,
- 66, 65, 65, 64, 63, 63, 62, 61, 60, 59, 59, 58, 57, 57, 56, 55, 55, 54,
- 54, 53, 53, 53, 52, 52, 52, 52, 69, 69, 68, 68, 68, 67, 65, 64, 63, 62,
- 62, 61, 60, 60, 59, 58, 58, 57, 57, 56, 55, 55, 54, 54, 54, 53, 53, 53,
- 52, 52, 52, 52, 68, 68, 68, 68, 68, 66, 65, 63, 61, 61, 60, 60, 59, 58,
- 58, 57, 57, 56, 56, 55, 55, 54, 54, 54, 53, 53, 53, 52, 52, 52, 52, 52,
- 67, 67, 67, 67, 67, 66, 64, 62, 61, 60, 59, 59, 58, 58, 57, 57, 56, 56,
- 55, 55, 54, 54, 54, 53, 53, 53, 52, 52, 52, 52, 52, 52, 66, 66, 66, 66,
- 66, 65, 63, 62, 60, 59, 59, 58, 57, 57, 56, 56, 56, 55, 55, 54, 54, 54,
- 53, 53, 53, 52, 52, 52, 52, 52, 52, 52, 64, 64, 65, 65, 66, 64, 63, 61,
- 60, 59, 58, 57, 57, 56, 56, 55, 55, 55, 54, 54, 54, 53, 53, 53, 52, 52,
- 52, 52, 51, 51, 51, 51, 63, 63, 64, 64, 65, 63, 62, 60, 59, 58, 57, 57,
- 56, 55, 55, 55, 54, 54, 54, 53, 53, 53, 53, 52, 52, 52, 52, 51, 51, 51,
- 51, 51, 62, 62, 63, 63, 64, 62, 61, 60, 58, 58, 57, 56, 55, 55, 55, 54,
- 54, 54, 53, 53, 53, 53, 52, 52, 52, 52, 52, 51, 51, 51, 51, 51, 60, 61,
- 61, 62, 62, 61, 60, 59, 58, 57, 56, 56, 55, 55, 54, 54, 54, 53, 53, 53,
- 52, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 59, 60, 60, 61, 61, 60,
- 59, 58, 57, 57, 56, 55, 55, 54, 54, 54, 53, 53, 53, 52, 52, 52, 52, 52,
- 51, 51, 51, 51, 51, 51, 51, 51, 58, 59, 59, 60, 60, 59, 59, 58, 57, 56,
- 56, 55, 54, 54, 54, 53, 53, 53, 52, 52, 52, 52, 52, 51, 51, 51, 51, 51,
- 51, 51, 51, 51, 57, 58, 58, 59, 59, 59, 58, 57, 56, 56, 55, 55, 54, 54,
- 53, 53, 53, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
- 57, 57, 58, 58, 59, 58, 57, 57, 56, 55, 55, 54, 54, 53, 53, 53, 52, 52,
- 52, 52, 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 56, 56, 57, 57,
- 58, 57, 57, 56, 55, 55, 54, 54, 53, 53, 53, 52, 52, 52, 52, 51, 51, 51,
- 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 55, 55, 56, 56, 57, 56, 56, 55,
- 55, 54, 54, 54, 53, 53, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 50,
- 50, 50, 50, 50, 50, 50, 54, 55, 55, 56, 56, 56, 55, 55, 54, 54, 54, 53,
- 53, 53, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50,
- 50, 50, 54, 54, 55, 55, 56, 55, 55, 54, 54, 54, 53, 53, 53, 52, 52, 52,
- 52, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 53, 54,
- 54, 55, 55, 55, 54, 54, 54, 53, 53, 53, 52, 52, 52, 52, 51, 51, 51, 51,
- 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 53, 53, 54, 54, 54, 54,
- 54, 54, 53, 53, 53, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 53, 53, 53, 54, 54, 54, 53, 53, 53, 53,
- 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 52, 53, 53, 53, 53, 53, 53, 53, 53, 52, 52, 52, 52, 52,
- 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 52, 52, 52, 53, 53, 53, 53, 53, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 52, 52, 52, 52,
- 53, 52, 52, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 52, 52, 52, 52, 53, 52, 52, 52,
- 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 52, 52, 52, 52, 53, 52, 52, 52, 52, 52, 52, 51,
- 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 52, 52, 52, 52, 53, 52, 52, 52, 52, 52, 52, 51, 51, 51, 51, 51,
- 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50 },
- { /* Intra matrices */
- /* Size 4 */
- 80, 77, 67, 61, 77, 68, 63, 60, 67, 63, 60, 58, 61, 60, 58, 57,
- /* Size 8 */
- 75, 83, 80, 73, 68, 64, 61, 60, 83, 79, 80, 76, 70, 66, 63, 61, 80, 80,
- 72, 69, 66, 64, 62, 60, 73, 76, 69, 65, 63, 61, 60, 59, 68, 70, 66, 63,
- 61, 60, 59, 58, 64, 66, 64, 61, 60, 59, 58, 58, 61, 63, 62, 60, 59, 58,
- 58, 57, 60, 61, 60, 59, 58, 58, 57, 57,
- /* Size 16 */
- 76, 80, 84, 82, 81, 78, 74, 71, 68, 66, 64, 63, 62, 61, 60, 60, 80, 81,
- 82, 81, 81, 78, 75, 72, 70, 68, 66, 64, 63, 62, 61, 61, 84, 82, 80, 80,
- 81, 79, 76, 74, 71, 69, 67, 65, 64, 63, 61, 61, 82, 81, 80, 78, 77, 75,
- 73, 71, 69, 67, 65, 64, 63, 62, 61, 61, 81, 81, 81, 77, 72, 71, 69, 68,
- 67, 66, 64, 63, 62, 61, 61, 61, 78, 78, 79, 75, 71, 69, 67, 66, 65, 64,
- 63, 62, 62, 61, 60, 60, 74, 75, 76, 73, 69, 67, 66, 65, 64, 63, 62, 61,
- 61, 60, 60, 60, 71, 72, 74, 71, 68, 66, 65, 64, 63, 62, 61, 61, 60, 60,
- 59, 59, 68, 70, 71, 69, 67, 65, 64, 63, 62, 61, 60, 60, 60, 59, 59, 59,
- 66, 68, 69, 67, 66, 64, 63, 62, 61, 61, 60, 60, 59, 59, 59, 59, 64, 66,
- 67, 65, 64, 63, 62, 61, 60, 60, 59, 59, 59, 59, 58, 58, 63, 64, 65, 64,
- 63, 62, 61, 61, 60, 60, 59, 59, 59, 58, 58, 58, 62, 63, 64, 63, 62, 62,
- 61, 60, 60, 59, 59, 59, 58, 58, 58, 58, 61, 62, 63, 62, 61, 61, 60, 60,
- 59, 59, 59, 58, 58, 58, 58, 58, 60, 61, 61, 61, 61, 60, 60, 59, 59, 59,
- 58, 58, 58, 58, 58, 58, 60, 61, 61, 61, 61, 60, 60, 59, 59, 59, 58, 58,
- 58, 58, 58, 58,
- /* Size 32 */
- 76, 78, 80, 82, 84, 83, 83, 82, 82, 80, 78, 76, 74, 73, 71, 70, 69, 68,
- 67, 66, 65, 64, 63, 63, 62, 62, 61, 61, 60, 60, 60, 60, 78, 79, 81, 82,
- 83, 83, 82, 82, 82, 80, 78, 77, 75, 74, 72, 71, 69, 68, 67, 66, 65, 65,
- 64, 63, 63, 62, 62, 61, 61, 61, 61, 61, 80, 81, 81, 82, 82, 82, 82, 82,
- 81, 80, 79, 77, 76, 74, 73, 71, 70, 69, 68, 67, 66, 65, 64, 64, 63, 63,
- 62, 62, 61, 61, 61, 61, 82, 82, 82, 81, 81, 81, 81, 81, 81, 80, 79, 77,
- 76, 75, 73, 72, 71, 70, 69, 67, 66, 66, 65, 64, 63, 63, 62, 62, 61, 61,
- 61, 61, 84, 83, 82, 81, 80, 80, 81, 81, 81, 80, 79, 78, 77, 75, 74, 73,
- 71, 70, 69, 68, 67, 66, 65, 65, 64, 63, 63, 62, 62, 62, 62, 62, 83, 83,
- 82, 81, 80, 80, 80, 79, 79, 78, 77, 76, 75, 74, 73, 71, 70, 69, 68, 67,
- 66, 66, 65, 64, 64, 63, 63, 62, 62, 62, 62, 62, 83, 82, 82, 81, 81, 80,
- 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 67, 66, 65, 65, 64,
- 63, 63, 62, 62, 61, 61, 61, 61, 82, 82, 82, 81, 81, 79, 78, 76, 75, 74,
- 73, 72, 71, 71, 70, 69, 68, 67, 67, 66, 65, 65, 64, 63, 63, 62, 62, 62,
- 61, 61, 61, 61, 82, 82, 81, 81, 81, 79, 77, 75, 73, 72, 71, 70, 70, 69,
- 68, 68, 67, 66, 66, 65, 65, 64, 64, 63, 63, 62, 62, 61, 61, 61, 61, 61,
- 80, 80, 80, 80, 80, 78, 76, 74, 72, 71, 70, 70, 69, 68, 67, 67, 66, 66,
- 65, 65, 64, 64, 63, 63, 62, 62, 61, 61, 61, 61, 61, 61, 78, 78, 79, 79,
- 79, 77, 75, 73, 71, 70, 69, 69, 68, 67, 67, 66, 65, 65, 64, 64, 63, 63,
- 63, 62, 62, 62, 61, 61, 61, 61, 61, 61, 76, 77, 77, 77, 78, 76, 74, 72,
- 70, 70, 69, 68, 67, 66, 66, 65, 65, 64, 64, 63, 63, 63, 62, 62, 61, 61,
- 61, 61, 60, 60, 60, 60, 74, 75, 76, 76, 77, 75, 73, 71, 70, 69, 68, 67,
- 66, 65, 65, 64, 64, 63, 63, 63, 62, 62, 62, 61, 61, 61, 61, 60, 60, 60,
- 60, 60, 73, 74, 74, 75, 75, 74, 72, 71, 69, 68, 67, 66, 65, 65, 64, 64,
- 63, 63, 63, 62, 62, 62, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 71, 72,
- 73, 73, 74, 73, 71, 70, 68, 67, 67, 66, 65, 64, 64, 63, 63, 63, 62, 62,
- 62, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 70, 71, 71, 72, 73, 71,
- 70, 69, 68, 67, 66, 65, 64, 64, 63, 63, 62, 62, 62, 61, 61, 61, 61, 60,
- 60, 60, 60, 60, 59, 59, 59, 59, 69, 69, 70, 71, 71, 70, 69, 68, 67, 66,
- 65, 65, 64, 63, 63, 62, 62, 62, 61, 61, 61, 61, 60, 60, 60, 60, 60, 59,
- 59, 59, 59, 59, 68, 68, 69, 70, 70, 69, 68, 67, 66, 66, 65, 64, 63, 63,
- 63, 62, 62, 61, 61, 61, 61, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59,
- 67, 67, 68, 69, 69, 68, 67, 67, 66, 65, 64, 64, 63, 63, 62, 62, 61, 61,
- 61, 61, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 66, 66, 67, 67,
- 68, 67, 67, 66, 65, 65, 64, 63, 63, 62, 62, 61, 61, 61, 61, 60, 60, 60,
- 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 65, 65, 66, 66, 67, 66, 66, 65,
- 65, 64, 63, 63, 62, 62, 62, 61, 61, 61, 60, 60, 60, 60, 59, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 64, 65, 65, 66, 66, 66, 65, 65, 64, 64, 63, 63,
- 62, 62, 61, 61, 61, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 58, 58,
- 58, 58, 63, 64, 64, 65, 65, 65, 65, 64, 64, 63, 63, 62, 62, 61, 61, 61,
- 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 63, 63,
- 64, 64, 65, 64, 64, 63, 63, 63, 62, 62, 61, 61, 61, 60, 60, 60, 60, 59,
- 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 62, 63, 63, 63, 64, 64,
- 63, 63, 63, 62, 62, 61, 61, 61, 61, 60, 60, 60, 60, 59, 59, 59, 59, 59,
- 59, 58, 58, 58, 58, 58, 58, 58, 62, 62, 63, 63, 63, 63, 63, 62, 62, 62,
- 62, 61, 61, 61, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58,
- 58, 58, 58, 58, 61, 62, 62, 62, 63, 63, 62, 62, 62, 61, 61, 61, 61, 60,
- 60, 60, 60, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 61, 61, 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 60, 60, 60, 60, 59, 59,
- 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 60, 61, 61, 61,
- 62, 62, 61, 61, 61, 61, 61, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 60, 61, 61, 61, 62, 62, 61, 61,
- 61, 61, 61, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 60, 61, 61, 61, 62, 62, 61, 61, 61, 61, 61, 60,
- 60, 60, 60, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 60, 61, 61, 61, 62, 62, 61, 61, 61, 61, 61, 60, 60, 60, 60, 59,
- 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 56, 54, 52, 56, 53, 52, 51, 54, 52, 50, 49, 52, 51, 49, 48,
- /* Size 8 */
- 64, 69, 57, 56, 55, 54, 53, 52, 69, 61, 57, 58, 58, 57, 55, 53, 57, 57,
- 55, 55, 55, 55, 54, 53, 56, 58, 55, 54, 53, 53, 52, 51, 55, 58, 55, 53,
- 52, 51, 51, 50, 54, 57, 55, 53, 51, 51, 50, 50, 53, 55, 54, 52, 51, 50,
- 49, 49, 52, 53, 53, 51, 50, 50, 49, 49,
- /* Size 16 */
- 64, 67, 69, 63, 57, 57, 56, 56, 55, 55, 54, 53, 53, 52, 52, 52, 67, 66,
- 65, 61, 57, 57, 57, 57, 57, 56, 55, 55, 54, 53, 52, 52, 69, 65, 61, 59,
- 57, 58, 58, 58, 58, 57, 57, 56, 55, 54, 53, 53, 63, 61, 59, 57, 56, 56,
- 57, 57, 57, 56, 56, 55, 54, 54, 53, 53, 57, 57, 57, 56, 55, 55, 55, 55,
- 55, 55, 55, 54, 54, 53, 53, 53, 57, 57, 58, 56, 55, 55, 54, 54, 54, 54,
- 54, 53, 53, 52, 52, 52, 56, 57, 58, 57, 55, 54, 54, 53, 53, 53, 53, 52,
- 52, 52, 51, 51, 56, 57, 58, 57, 55, 54, 53, 53, 53, 52, 52, 52, 52, 51,
- 51, 51, 55, 57, 58, 57, 55, 54, 53, 53, 52, 52, 51, 51, 51, 51, 50, 50,
- 55, 56, 57, 56, 55, 54, 53, 52, 52, 51, 51, 51, 51, 50, 50, 50, 54, 55,
- 57, 56, 55, 54, 53, 52, 51, 51, 51, 50, 50, 50, 50, 50, 53, 55, 56, 55,
- 54, 53, 52, 52, 51, 51, 50, 50, 50, 50, 49, 49, 53, 54, 55, 54, 54, 53,
- 52, 52, 51, 51, 50, 50, 49, 49, 49, 49, 52, 53, 54, 54, 53, 52, 52, 51,
- 51, 50, 50, 50, 49, 49, 49, 49, 52, 52, 53, 53, 53, 52, 51, 51, 50, 50,
- 50, 49, 49, 49, 49, 49, 52, 52, 53, 53, 53, 52, 51, 51, 50, 50, 50, 49,
- 49, 49, 49, 49,
- /* Size 32 */
- 64, 65, 67, 68, 69, 66, 63, 60, 57, 57, 57, 57, 56, 56, 56, 56, 55, 55,
- 55, 54, 54, 54, 53, 53, 53, 52, 52, 52, 52, 52, 52, 52, 65, 66, 66, 67,
- 67, 65, 62, 60, 57, 57, 57, 57, 57, 57, 56, 56, 56, 56, 55, 55, 55, 54,
- 54, 54, 53, 53, 53, 52, 52, 52, 52, 52, 67, 66, 66, 65, 65, 63, 61, 59,
- 57, 57, 57, 57, 57, 57, 57, 57, 57, 56, 56, 56, 55, 55, 55, 54, 54, 53,
- 53, 53, 52, 52, 52, 52, 68, 67, 65, 64, 63, 61, 60, 58, 57, 57, 57, 58,
- 58, 58, 58, 57, 57, 57, 57, 56, 56, 56, 55, 55, 54, 54, 54, 53, 53, 53,
- 53, 53, 69, 67, 65, 63, 61, 60, 59, 58, 57, 57, 58, 58, 58, 58, 58, 58,
- 58, 58, 57, 57, 57, 56, 56, 55, 55, 55, 54, 54, 53, 53, 53, 53, 66, 65,
- 63, 61, 60, 59, 58, 57, 56, 57, 57, 57, 58, 58, 57, 57, 57, 57, 57, 56,
- 56, 56, 55, 55, 55, 54, 54, 54, 53, 53, 53, 53, 63, 62, 61, 60, 59, 58,
- 57, 57, 56, 56, 56, 57, 57, 57, 57, 57, 57, 56, 56, 56, 56, 55, 55, 55,
- 54, 54, 54, 53, 53, 53, 53, 53, 60, 60, 59, 58, 58, 57, 57, 56, 55, 55,
- 56, 56, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 54, 54, 54, 53, 53,
- 53, 53, 53, 53, 57, 57, 57, 57, 57, 56, 56, 55, 55, 55, 55, 55, 55, 55,
- 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 53, 53, 53, 53, 53, 53, 53,
- 57, 57, 57, 57, 57, 57, 56, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
- 54, 54, 54, 54, 54, 53, 53, 53, 53, 53, 52, 52, 52, 52, 57, 57, 57, 57,
- 58, 57, 56, 56, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 54, 53,
- 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 57, 57, 57, 58, 58, 57, 57, 56,
- 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 53, 53, 53, 53, 53, 53, 53, 52,
- 52, 52, 52, 52, 52, 52, 56, 57, 57, 58, 58, 58, 57, 56, 55, 55, 54, 54,
- 54, 54, 53, 53, 53, 53, 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 51, 51,
- 51, 51, 56, 57, 57, 58, 58, 58, 57, 56, 55, 55, 54, 54, 54, 53, 53, 53,
- 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 52, 51, 51, 51, 51, 51, 56, 56,
- 57, 58, 58, 57, 57, 56, 55, 55, 54, 54, 53, 53, 53, 53, 53, 52, 52, 52,
- 52, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 56, 56, 57, 57, 58, 57,
- 57, 56, 55, 55, 54, 54, 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 51, 51,
- 51, 51, 51, 51, 51, 51, 51, 51, 55, 56, 57, 57, 58, 57, 57, 56, 55, 55,
- 54, 54, 53, 53, 53, 52, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 51,
- 50, 50, 50, 50, 55, 56, 56, 57, 58, 57, 56, 56, 55, 55, 54, 54, 53, 53,
- 52, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50,
- 55, 55, 56, 57, 57, 57, 56, 55, 55, 54, 54, 53, 53, 53, 52, 52, 52, 52,
- 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 54, 55, 56, 56,
- 57, 56, 56, 55, 55, 54, 54, 53, 53, 53, 52, 52, 52, 51, 51, 51, 51, 51,
- 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 54, 55, 55, 56, 57, 56, 56, 55,
- 55, 54, 54, 53, 53, 52, 52, 52, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 54, 54, 55, 56, 56, 56, 55, 55, 54, 54, 53, 53,
- 53, 52, 52, 52, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 53, 54, 55, 55, 56, 55, 55, 55, 54, 54, 53, 53, 52, 52, 52, 51,
- 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 53, 54,
- 54, 55, 55, 55, 55, 54, 54, 53, 53, 53, 52, 52, 52, 51, 51, 51, 51, 50,
- 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 53, 53, 54, 54, 55, 55,
- 54, 54, 54, 53, 53, 53, 52, 52, 52, 51, 51, 51, 51, 50, 50, 50, 50, 50,
- 49, 49, 49, 49, 49, 49, 49, 49, 52, 53, 53, 54, 55, 54, 54, 54, 53, 53,
- 53, 52, 52, 52, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49,
- 49, 49, 49, 49, 52, 53, 53, 54, 54, 54, 54, 53, 53, 53, 52, 52, 52, 52,
- 51, 51, 51, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49,
- 52, 52, 53, 53, 54, 54, 53, 53, 53, 53, 52, 52, 52, 51, 51, 51, 51, 50,
- 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 52, 52, 52, 53,
- 53, 53, 53, 53, 53, 52, 52, 52, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50,
- 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 52, 52, 52, 53, 53, 53, 53, 53,
- 53, 52, 52, 52, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49,
- 49, 49, 49, 49, 49, 49, 52, 52, 52, 53, 53, 53, 53, 53, 53, 52, 52, 52,
- 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49,
- 49, 49, 52, 52, 52, 53, 53, 53, 53, 53, 53, 52, 52, 52, 51, 51, 51, 51,
- 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49 },
- { /* Intra matrices */
- /* Size 4 */
- 79, 68, 67, 63, 68, 65, 64, 62, 67, 64, 61, 60, 63, 62, 60, 58,
- /* Size 8 */
- 77, 84, 68, 67, 66, 64, 63, 61, 84, 73, 68, 70, 69, 67, 65, 64, 68, 68,
- 65, 66, 66, 65, 64, 62, 67, 70, 66, 64, 63, 63, 62, 61, 66, 69, 66, 63,
- 62, 61, 60, 60, 64, 67, 65, 63, 61, 60, 59, 59, 63, 65, 64, 62, 60, 59,
- 59, 58, 61, 64, 62, 61, 60, 59, 58, 58,
- /* Size 16 */
- 77, 81, 84, 76, 69, 68, 68, 67, 67, 66, 65, 64, 63, 62, 62, 62, 81, 80,
- 79, 74, 69, 69, 69, 69, 68, 67, 66, 65, 64, 64, 63, 63, 84, 79, 74, 71,
- 68, 69, 70, 70, 70, 69, 68, 67, 66, 65, 64, 64, 76, 74, 71, 69, 67, 68,
- 68, 68, 68, 67, 67, 66, 65, 64, 63, 63, 69, 69, 68, 67, 66, 66, 66, 66,
- 66, 66, 66, 65, 64, 64, 63, 63, 68, 69, 69, 68, 66, 66, 65, 65, 65, 65,
- 64, 64, 63, 63, 62, 62, 68, 69, 70, 68, 66, 65, 64, 64, 64, 63, 63, 63,
- 62, 62, 61, 61, 67, 69, 70, 68, 66, 65, 64, 64, 63, 63, 62, 62, 62, 61,
- 61, 61, 67, 68, 70, 68, 66, 65, 64, 63, 62, 62, 61, 61, 61, 61, 60, 60,
- 66, 67, 69, 67, 66, 65, 63, 63, 62, 61, 61, 61, 60, 60, 60, 60, 65, 66,
- 68, 67, 66, 64, 63, 62, 61, 61, 60, 60, 60, 59, 59, 59, 64, 65, 67, 66,
- 65, 64, 63, 62, 61, 61, 60, 60, 59, 59, 59, 59, 63, 64, 66, 65, 64, 63,
- 62, 62, 61, 60, 60, 59, 59, 59, 58, 58, 62, 64, 65, 64, 64, 63, 62, 61,
- 61, 60, 59, 59, 59, 58, 58, 58, 62, 63, 64, 63, 63, 62, 61, 61, 60, 60,
- 59, 59, 58, 58, 58, 58, 62, 63, 64, 63, 63, 62, 61, 61, 60, 60, 59, 59,
- 58, 58, 58, 58,
- /* Size 32 */
- 78, 79, 81, 83, 84, 81, 77, 73, 69, 69, 68, 68, 68, 68, 67, 67, 67, 66,
- 66, 65, 65, 65, 64, 64, 63, 63, 63, 62, 62, 62, 62, 62, 79, 80, 81, 81,
- 82, 79, 75, 72, 69, 69, 69, 69, 69, 68, 68, 68, 68, 67, 67, 66, 66, 65,
- 65, 64, 64, 64, 63, 63, 62, 62, 62, 62, 81, 81, 80, 80, 79, 77, 74, 71,
- 69, 69, 69, 69, 69, 69, 69, 69, 68, 68, 67, 67, 67, 66, 66, 65, 65, 64,
- 64, 63, 63, 63, 63, 63, 83, 81, 80, 78, 76, 75, 73, 71, 69, 69, 69, 70,
- 70, 70, 70, 69, 69, 69, 68, 68, 67, 67, 66, 66, 65, 65, 65, 64, 64, 64,
- 64, 64, 84, 82, 79, 76, 74, 73, 71, 70, 69, 69, 70, 70, 71, 70, 70, 70,
- 70, 70, 69, 69, 68, 68, 67, 67, 66, 66, 65, 65, 64, 64, 64, 64, 81, 79,
- 77, 75, 73, 71, 70, 69, 68, 68, 69, 69, 70, 69, 69, 69, 69, 69, 68, 68,
- 68, 67, 67, 66, 66, 65, 65, 64, 64, 64, 64, 64, 77, 75, 74, 73, 71, 70,
- 69, 68, 67, 68, 68, 68, 69, 68, 68, 68, 68, 68, 68, 67, 67, 67, 66, 66,
- 65, 65, 64, 64, 64, 64, 64, 64, 73, 72, 71, 71, 70, 69, 68, 67, 67, 67,
- 67, 67, 68, 67, 67, 67, 67, 67, 67, 67, 66, 66, 66, 65, 65, 65, 64, 64,
- 63, 63, 63, 63, 69, 69, 69, 69, 69, 68, 67, 67, 66, 66, 66, 66, 66, 67,
- 67, 67, 67, 66, 66, 66, 66, 65, 65, 65, 64, 64, 64, 63, 63, 63, 63, 63,
- 69, 69, 69, 69, 69, 68, 68, 67, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 65, 65, 65, 65, 64, 64, 64, 63, 63, 63, 63, 63, 63, 68, 69, 69, 69,
- 70, 69, 68, 67, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 64,
- 64, 64, 64, 63, 63, 63, 62, 62, 62, 62, 68, 69, 69, 70, 70, 69, 68, 67,
- 66, 66, 66, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63,
- 63, 62, 62, 62, 62, 62, 68, 69, 69, 70, 71, 70, 69, 68, 66, 66, 66, 65,
- 65, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62,
- 62, 62, 68, 68, 69, 70, 70, 69, 68, 67, 67, 66, 65, 65, 64, 64, 64, 64,
- 64, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 61, 61, 67, 68,
- 69, 70, 70, 69, 68, 67, 67, 66, 65, 65, 64, 64, 64, 63, 63, 63, 63, 63,
- 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 67, 68, 69, 69, 70, 69,
- 68, 67, 67, 66, 65, 65, 64, 64, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62,
- 61, 61, 61, 61, 61, 61, 61, 61, 67, 68, 68, 69, 70, 69, 68, 67, 67, 66,
- 65, 65, 64, 64, 63, 63, 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61,
- 60, 60, 60, 60, 66, 67, 68, 69, 70, 69, 68, 67, 66, 66, 65, 64, 64, 63,
- 63, 63, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60,
- 66, 67, 67, 68, 69, 68, 68, 67, 66, 66, 65, 64, 64, 63, 63, 62, 62, 62,
- 62, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 65, 66, 67, 68,
- 69, 68, 67, 67, 66, 65, 65, 64, 63, 63, 63, 62, 62, 62, 61, 61, 61, 61,
- 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 65, 66, 67, 67, 68, 68, 67, 66,
- 66, 65, 65, 64, 63, 63, 62, 62, 62, 61, 61, 61, 61, 60, 60, 60, 60, 60,
- 60, 60, 59, 59, 59, 59, 65, 65, 66, 67, 68, 67, 67, 66, 65, 65, 64, 64,
- 63, 63, 62, 62, 62, 61, 61, 61, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59,
- 59, 59, 64, 65, 66, 66, 67, 67, 66, 66, 65, 65, 64, 63, 63, 63, 62, 62,
- 61, 61, 61, 61, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 64, 64,
- 65, 66, 67, 66, 66, 65, 65, 64, 64, 63, 63, 62, 62, 62, 61, 61, 61, 60,
- 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 63, 64, 65, 65, 66, 66,
- 65, 65, 64, 64, 64, 63, 63, 62, 62, 61, 61, 61, 60, 60, 60, 60, 60, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 63, 64, 64, 65, 66, 65, 65, 65, 64, 64,
- 63, 63, 62, 62, 62, 61, 61, 61, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 59, 63, 63, 64, 65, 65, 65, 64, 64, 64, 63, 63, 63, 62, 62,
- 61, 61, 61, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58,
- 62, 63, 63, 64, 65, 64, 64, 64, 63, 63, 63, 62, 62, 62, 61, 61, 61, 60,
- 60, 60, 60, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 62, 62, 63, 64,
- 64, 64, 64, 63, 63, 63, 62, 62, 62, 61, 61, 61, 60, 60, 60, 60, 59, 59,
- 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 62, 62, 63, 64, 64, 64, 64, 63,
- 63, 63, 62, 62, 62, 61, 61, 61, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59,
- 58, 58, 58, 58, 58, 58, 62, 62, 63, 64, 64, 64, 64, 63, 63, 63, 62, 62,
- 62, 61, 61, 61, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58,
- 58, 58, 62, 62, 63, 64, 64, 64, 64, 63, 63, 63, 62, 62, 62, 61, 61, 61,
- 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 63, 57, 54, 63, 58, 55, 54, 57, 55, 53, 53, 54, 54, 53, 52,
- /* Size 8 */
- 64, 68, 67, 63, 60, 58, 56, 55, 68, 66, 67, 64, 61, 59, 57, 56, 67, 67,
- 62, 61, 59, 58, 57, 56, 63, 64, 61, 58, 57, 56, 56, 55, 60, 61, 59, 57,
- 56, 56, 55, 55, 58, 59, 58, 56, 56, 55, 55, 54, 56, 57, 57, 56, 55, 55,
- 54, 54, 55, 56, 56, 55, 55, 54, 54, 54,
- /* Size 16 */
- 64, 66, 68, 68, 67, 65, 63, 62, 60, 59, 58, 57, 56, 56, 55, 55, 66, 67,
- 67, 67, 67, 65, 64, 62, 61, 60, 58, 58, 57, 56, 56, 56, 68, 67, 66, 66,
- 67, 66, 64, 63, 61, 60, 59, 58, 57, 57, 56, 56, 68, 67, 66, 65, 65, 63,
- 62, 61, 60, 59, 58, 58, 57, 56, 56, 56, 67, 67, 67, 65, 62, 61, 61, 60,
- 59, 58, 58, 57, 57, 56, 56, 56, 65, 65, 66, 63, 61, 60, 59, 59, 58, 58,
- 57, 57, 56, 56, 56, 56, 63, 64, 64, 62, 61, 59, 58, 58, 57, 57, 56, 56,
- 56, 56, 55, 55, 62, 62, 63, 61, 60, 59, 58, 57, 57, 56, 56, 56, 55, 55,
- 55, 55, 60, 61, 61, 60, 59, 58, 57, 57, 56, 56, 56, 55, 55, 55, 55, 55,
- 59, 60, 60, 59, 58, 58, 57, 56, 56, 56, 55, 55, 55, 55, 55, 55, 58, 58,
- 59, 58, 58, 57, 56, 56, 56, 55, 55, 55, 55, 55, 54, 54, 57, 58, 58, 58,
- 57, 57, 56, 56, 55, 55, 55, 55, 55, 54, 54, 54, 56, 57, 57, 57, 57, 56,
- 56, 55, 55, 55, 55, 55, 54, 54, 54, 54, 56, 56, 57, 56, 56, 56, 56, 55,
- 55, 55, 55, 54, 54, 54, 54, 54, 55, 56, 56, 56, 56, 56, 55, 55, 55, 55,
- 54, 54, 54, 54, 54, 54, 55, 56, 56, 56, 56, 56, 55, 55, 55, 55, 54, 54,
- 54, 54, 54, 54,
- /* Size 32 */
- 64, 65, 66, 67, 68, 68, 68, 67, 67, 66, 65, 64, 63, 62, 62, 61, 60, 59,
- 59, 58, 58, 57, 57, 57, 56, 56, 56, 56, 55, 55, 55, 55, 65, 66, 66, 67,
- 68, 68, 67, 67, 67, 66, 65, 64, 63, 63, 62, 61, 60, 60, 59, 59, 58, 58,
- 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 66, 66, 67, 67, 67, 67, 67, 67,
- 67, 66, 65, 65, 64, 63, 62, 61, 61, 60, 60, 59, 58, 58, 58, 57, 57, 57,
- 56, 56, 56, 56, 56, 56, 67, 67, 67, 67, 67, 67, 67, 67, 67, 66, 66, 65,
- 64, 63, 63, 62, 61, 60, 60, 59, 59, 58, 58, 58, 57, 57, 57, 56, 56, 56,
- 56, 56, 68, 68, 67, 67, 66, 66, 66, 67, 67, 66, 66, 65, 64, 64, 63, 62,
- 61, 61, 60, 60, 59, 59, 58, 58, 57, 57, 57, 56, 56, 56, 56, 56, 68, 68,
- 67, 67, 66, 66, 66, 66, 66, 65, 65, 64, 63, 63, 62, 62, 61, 60, 60, 59,
- 59, 58, 58, 58, 57, 57, 57, 56, 56, 56, 56, 56, 68, 67, 67, 67, 66, 66,
- 65, 65, 65, 64, 63, 63, 62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 58, 57,
- 57, 57, 56, 56, 56, 56, 56, 56, 67, 67, 67, 67, 67, 66, 65, 64, 63, 63,
- 62, 62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 58, 57, 57, 57, 57, 56, 56,
- 56, 56, 56, 56, 67, 67, 67, 67, 67, 66, 65, 63, 62, 62, 61, 61, 61, 60,
- 60, 59, 59, 59, 58, 58, 58, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56,
- 66, 66, 66, 66, 66, 65, 64, 63, 62, 61, 61, 60, 60, 60, 59, 59, 59, 58,
- 58, 58, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 56, 65, 65, 65, 66,
- 66, 65, 63, 62, 61, 61, 60, 60, 59, 59, 59, 59, 58, 58, 58, 57, 57, 57,
- 57, 56, 56, 56, 56, 56, 56, 56, 56, 56, 64, 64, 65, 65, 65, 64, 63, 62,
- 61, 60, 60, 59, 59, 59, 58, 58, 58, 58, 57, 57, 57, 57, 56, 56, 56, 56,
- 56, 56, 55, 55, 55, 55, 63, 63, 64, 64, 64, 63, 62, 62, 61, 60, 59, 59,
- 58, 58, 58, 58, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 55, 55, 55,
- 55, 55, 62, 63, 63, 63, 64, 63, 62, 61, 60, 60, 59, 59, 58, 58, 58, 57,
- 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 62, 62,
- 62, 63, 63, 62, 61, 61, 60, 59, 59, 58, 58, 58, 57, 57, 57, 57, 56, 56,
- 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 61, 61, 61, 62, 62, 62,
- 61, 60, 59, 59, 59, 58, 58, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 55,
- 55, 55, 55, 55, 55, 55, 55, 55, 60, 60, 61, 61, 61, 61, 60, 60, 59, 59,
- 58, 58, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55,
- 55, 55, 55, 55, 59, 60, 60, 60, 61, 60, 60, 59, 59, 58, 58, 58, 57, 57,
- 57, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
- 59, 59, 60, 60, 60, 60, 59, 59, 58, 58, 58, 57, 57, 57, 56, 56, 56, 56,
- 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 58, 59, 59, 59,
- 60, 59, 59, 58, 58, 58, 57, 57, 57, 56, 56, 56, 56, 56, 56, 55, 55, 55,
- 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 58, 58, 58, 59, 59, 59, 58, 58,
- 58, 57, 57, 57, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55,
- 55, 55, 54, 54, 54, 54, 57, 58, 58, 58, 59, 58, 58, 58, 57, 57, 57, 57,
- 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 54, 54, 54,
- 54, 54, 57, 57, 58, 58, 58, 58, 58, 57, 57, 57, 57, 56, 56, 56, 56, 56,
- 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 57, 57,
- 57, 58, 58, 58, 57, 57, 57, 57, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55,
- 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 56, 57, 57, 57, 57, 57,
- 57, 57, 57, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 55, 54,
- 54, 54, 54, 54, 54, 54, 54, 54, 56, 56, 57, 57, 57, 57, 57, 57, 56, 56,
- 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54,
- 54, 54, 54, 54, 56, 56, 56, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 55,
- 55, 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
- 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55,
- 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 56, 56, 56,
- 56, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 55, 54, 54,
- 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 56, 56, 56, 56, 56, 56, 56,
- 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54,
- 54, 54, 54, 54, 54, 54, 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 55,
- 55, 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
- 54, 54, 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55,
- 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54 },
- { /* Intra matrices */
- /* Size 4 */
- 74, 72, 66, 62, 72, 67, 63, 61, 66, 63, 61, 60, 62, 61, 60, 59,
- /* Size 8 */
- 71, 76, 75, 70, 66, 64, 62, 61, 76, 73, 74, 71, 68, 65, 63, 62, 75, 74,
- 69, 67, 65, 64, 62, 61, 70, 71, 67, 64, 63, 62, 61, 61, 66, 68, 65, 63,
- 62, 61, 61, 60, 64, 65, 64, 62, 61, 60, 60, 60, 62, 63, 62, 61, 61, 60,
- 60, 59, 61, 62, 61, 61, 60, 60, 59, 59,
- /* Size 16 */
- 71, 74, 77, 76, 75, 73, 70, 68, 67, 65, 64, 63, 62, 62, 61, 61, 74, 75,
- 75, 75, 75, 73, 71, 69, 67, 66, 65, 64, 63, 62, 62, 62, 77, 75, 74, 74,
- 75, 73, 72, 70, 68, 67, 66, 65, 64, 63, 62, 62, 76, 75, 74, 73, 72, 71,
- 70, 68, 67, 66, 65, 64, 63, 63, 62, 62, 75, 75, 75, 72, 69, 68, 67, 66,
- 66, 65, 64, 63, 63, 62, 62, 62, 73, 73, 73, 71, 68, 67, 66, 65, 65, 64,
- 63, 63, 62, 62, 61, 61, 70, 71, 72, 70, 67, 66, 65, 64, 63, 63, 63, 62,
- 62, 61, 61, 61, 68, 69, 70, 68, 66, 65, 64, 64, 63, 62, 62, 62, 61, 61,
- 61, 61, 67, 67, 68, 67, 66, 65, 63, 63, 62, 62, 62, 61, 61, 61, 61, 61,
- 65, 66, 67, 66, 65, 64, 63, 62, 62, 62, 61, 61, 61, 61, 60, 60, 64, 65,
- 66, 65, 64, 63, 63, 62, 62, 61, 61, 61, 60, 60, 60, 60, 63, 64, 65, 64,
- 63, 63, 62, 62, 61, 61, 61, 60, 60, 60, 60, 60, 62, 63, 64, 63, 63, 62,
- 62, 61, 61, 61, 60, 60, 60, 60, 60, 60, 62, 62, 63, 63, 62, 62, 61, 61,
- 61, 61, 60, 60, 60, 60, 60, 60, 61, 62, 62, 62, 62, 61, 61, 61, 61, 60,
- 60, 60, 60, 60, 60, 60, 61, 62, 62, 62, 62, 61, 61, 61, 61, 60, 60, 60,
- 60, 60, 60, 60,
- /* Size 32 */
- 72, 73, 74, 76, 77, 76, 76, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66,
- 66, 65, 64, 64, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 73, 74, 75, 75,
- 76, 76, 76, 75, 75, 74, 73, 72, 71, 70, 69, 68, 67, 67, 66, 65, 65, 64,
- 64, 63, 63, 63, 62, 62, 62, 62, 62, 62, 74, 75, 75, 75, 76, 75, 75, 75,
- 75, 74, 73, 72, 71, 70, 70, 69, 68, 67, 66, 66, 65, 65, 64, 64, 63, 63,
- 63, 62, 62, 62, 62, 62, 76, 75, 75, 75, 75, 75, 75, 75, 75, 74, 73, 73,
- 72, 71, 70, 69, 68, 67, 67, 66, 65, 65, 64, 64, 63, 63, 63, 62, 62, 62,
- 62, 62, 77, 76, 76, 75, 74, 74, 75, 75, 75, 74, 74, 73, 72, 71, 70, 69,
- 69, 68, 67, 66, 66, 65, 65, 64, 64, 63, 63, 63, 62, 62, 62, 62, 76, 76,
- 75, 75, 74, 74, 74, 74, 74, 73, 72, 72, 71, 70, 69, 69, 68, 67, 67, 66,
- 65, 65, 64, 64, 64, 63, 63, 63, 62, 62, 62, 62, 76, 76, 75, 75, 75, 74,
- 73, 73, 72, 72, 71, 70, 70, 69, 69, 68, 67, 67, 66, 66, 65, 65, 64, 64,
- 63, 63, 63, 62, 62, 62, 62, 62, 76, 75, 75, 75, 75, 74, 73, 72, 71, 70,
- 70, 69, 69, 68, 68, 67, 66, 66, 66, 65, 65, 64, 64, 63, 63, 63, 63, 62,
- 62, 62, 62, 62, 75, 75, 75, 75, 75, 74, 72, 71, 69, 69, 68, 68, 67, 67,
- 67, 66, 66, 65, 65, 65, 64, 64, 64, 63, 63, 63, 62, 62, 62, 62, 62, 62,
- 74, 74, 74, 74, 74, 73, 72, 70, 69, 68, 68, 67, 67, 66, 66, 66, 65, 65,
- 65, 64, 64, 64, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 73, 73, 73, 73,
- 74, 72, 71, 70, 68, 68, 67, 67, 66, 66, 65, 65, 65, 64, 64, 64, 63, 63,
- 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 72, 72, 72, 73, 73, 72, 70, 69,
- 68, 67, 67, 66, 66, 65, 65, 65, 64, 64, 64, 63, 63, 63, 63, 62, 62, 62,
- 62, 62, 61, 61, 61, 61, 71, 71, 71, 72, 72, 71, 70, 69, 67, 67, 66, 66,
- 65, 65, 64, 64, 64, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 61,
- 61, 61, 70, 70, 70, 71, 71, 70, 69, 68, 67, 66, 66, 65, 65, 64, 64, 64,
- 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 69, 69,
- 70, 70, 70, 69, 69, 68, 67, 66, 65, 65, 64, 64, 64, 63, 63, 63, 63, 62,
- 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 68, 68, 69, 69, 69, 69,
- 68, 67, 66, 66, 65, 65, 64, 64, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62,
- 61, 61, 61, 61, 61, 61, 61, 61, 67, 67, 68, 68, 69, 68, 67, 66, 66, 65,
- 65, 64, 64, 63, 63, 63, 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61,
- 61, 61, 61, 61, 66, 67, 67, 67, 68, 67, 67, 66, 65, 65, 64, 64, 63, 63,
- 63, 63, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
- 66, 66, 66, 67, 67, 67, 66, 66, 65, 65, 64, 64, 63, 63, 63, 62, 62, 62,
- 62, 62, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 65, 65, 66, 66,
- 66, 66, 66, 65, 65, 64, 64, 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 61,
- 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 64, 65, 65, 65, 66, 65, 65, 65,
- 64, 64, 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 61,
- 60, 60, 60, 60, 60, 60, 64, 64, 65, 65, 65, 65, 65, 64, 64, 64, 63, 63,
- 63, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60,
- 60, 60, 63, 64, 64, 64, 65, 64, 64, 64, 64, 63, 63, 63, 62, 62, 62, 62,
- 61, 61, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 63, 63,
- 64, 64, 64, 64, 64, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 61, 61,
- 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 63, 63, 63, 63, 64, 64,
- 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 60, 60,
- 60, 60, 60, 60, 60, 60, 60, 60, 62, 63, 63, 63, 63, 63, 63, 63, 63, 62,
- 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60,
- 60, 60, 60, 60, 62, 62, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61,
- 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
- 62, 62, 62, 62, 63, 63, 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61,
- 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 62, 62, 62, 62,
- 62, 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 61, 60, 60, 60,
- 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 62, 62, 62, 62, 62, 62, 62, 62,
- 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60,
- 60, 60, 60, 60, 60, 60, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 61,
- 61, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
- 60, 60, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61,
- 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 58, 57, 55, 58, 56, 56, 55, 57, 56, 54, 53, 55, 55, 53, 53,
- /* Size 8 */
- 64, 68, 59, 59, 58, 57, 56, 55, 68, 62, 59, 60, 60, 59, 58, 57, 59, 59,
- 58, 58, 58, 57, 57, 56, 59, 60, 58, 57, 56, 56, 56, 55, 58, 60, 58, 56,
- 56, 55, 55, 55, 57, 59, 57, 56, 55, 55, 54, 54, 56, 58, 57, 56, 55, 54,
- 54, 54, 55, 57, 56, 55, 55, 54, 54, 53,
- /* Size 16 */
- 64, 66, 68, 63, 59, 59, 59, 58, 58, 58, 57, 57, 56, 56, 55, 55, 66, 65,
- 65, 62, 59, 59, 59, 59, 59, 58, 58, 57, 57, 56, 56, 56, 68, 65, 62, 60,
- 59, 60, 60, 60, 60, 59, 59, 58, 58, 57, 57, 57, 63, 62, 60, 59, 58, 59,
- 59, 59, 59, 58, 58, 58, 57, 57, 56, 56, 59, 59, 59, 58, 58, 58, 58, 58,
- 58, 58, 57, 57, 57, 56, 56, 56, 59, 59, 60, 59, 58, 58, 57, 57, 57, 57,
- 57, 57, 56, 56, 56, 56, 59, 59, 60, 59, 58, 57, 57, 57, 56, 56, 56, 56,
- 56, 55, 55, 55, 58, 59, 60, 59, 58, 57, 57, 56, 56, 56, 56, 55, 55, 55,
- 55, 55, 58, 59, 60, 59, 58, 57, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55,
- 58, 58, 59, 58, 58, 57, 56, 56, 55, 55, 55, 55, 55, 54, 54, 54, 57, 58,
- 59, 58, 57, 57, 56, 56, 55, 55, 55, 54, 54, 54, 54, 54, 57, 57, 58, 58,
- 57, 57, 56, 55, 55, 55, 54, 54, 54, 54, 54, 54, 56, 57, 58, 57, 57, 56,
- 56, 55, 55, 55, 54, 54, 54, 54, 54, 54, 56, 56, 57, 57, 56, 56, 55, 55,
- 55, 54, 54, 54, 54, 54, 53, 53, 55, 56, 57, 56, 56, 56, 55, 55, 55, 54,
- 54, 54, 54, 53, 53, 53, 55, 56, 57, 56, 56, 56, 55, 55, 55, 54, 54, 54,
- 54, 53, 53, 53,
- /* Size 32 */
- 64, 65, 66, 67, 68, 66, 63, 61, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58,
- 58, 57, 57, 57, 57, 56, 56, 56, 56, 55, 55, 55, 55, 55, 65, 65, 66, 66,
- 66, 64, 63, 61, 59, 59, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 57, 57,
- 57, 57, 56, 56, 56, 56, 56, 56, 56, 56, 66, 66, 65, 65, 65, 63, 62, 61,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 57, 57, 57, 57,
- 56, 56, 56, 56, 56, 56, 67, 66, 65, 64, 63, 62, 61, 60, 59, 59, 59, 60,
- 60, 60, 60, 59, 59, 59, 59, 59, 58, 58, 58, 58, 57, 57, 57, 57, 56, 56,
- 56, 56, 68, 66, 65, 63, 62, 61, 60, 60, 59, 59, 60, 60, 60, 60, 60, 60,
- 60, 60, 59, 59, 59, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 57, 66, 64,
- 63, 62, 61, 61, 60, 59, 59, 59, 59, 59, 60, 59, 59, 59, 59, 59, 59, 59,
- 58, 58, 58, 58, 57, 57, 57, 57, 56, 56, 56, 56, 63, 63, 62, 61, 60, 60,
- 59, 59, 58, 58, 59, 59, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 57,
- 57, 57, 57, 57, 56, 56, 56, 56, 61, 61, 61, 60, 60, 59, 59, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 57, 57, 57, 57, 57, 56,
- 56, 56, 56, 56, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56,
- 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 57,
- 57, 57, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 56, 59, 59, 59, 59,
- 60, 59, 59, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
- 57, 56, 56, 56, 56, 56, 56, 56, 56, 56, 59, 59, 59, 60, 60, 59, 59, 58,
- 58, 58, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56,
- 56, 56, 55, 55, 55, 55, 59, 59, 59, 60, 60, 60, 59, 58, 58, 58, 57, 57,
- 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55,
- 55, 55, 58, 59, 59, 60, 60, 59, 59, 58, 58, 58, 57, 57, 57, 57, 56, 56,
- 56, 56, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 58, 59,
- 59, 60, 60, 59, 59, 58, 58, 58, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56,
- 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 58, 59, 59, 59, 60, 59,
- 59, 58, 58, 58, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55,
- 55, 55, 55, 55, 55, 55, 55, 55, 58, 58, 59, 59, 60, 59, 59, 58, 58, 58,
- 57, 57, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
- 55, 55, 55, 55, 58, 58, 59, 59, 60, 59, 59, 58, 58, 57, 57, 57, 56, 56,
- 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54,
- 58, 58, 58, 59, 59, 59, 58, 58, 58, 57, 57, 57, 56, 56, 56, 56, 55, 55,
- 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 57, 58, 58, 59,
- 59, 59, 58, 58, 58, 57, 57, 57, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55,
- 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 57, 57, 58, 58, 59, 58, 58, 58,
- 57, 57, 57, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54,
- 54, 54, 54, 54, 54, 54, 57, 57, 58, 58, 58, 58, 58, 58, 57, 57, 57, 56,
- 56, 56, 56, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 54,
- 54, 54, 57, 57, 57, 58, 58, 58, 58, 57, 57, 57, 57, 56, 56, 56, 55, 55,
- 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 56, 57,
- 57, 58, 58, 58, 57, 57, 57, 57, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55,
- 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 56, 56, 57, 57, 58, 57,
- 57, 57, 57, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54,
- 54, 54, 54, 54, 54, 54, 54, 54, 56, 56, 57, 57, 57, 57, 57, 57, 57, 56,
- 56, 56, 56, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
- 53, 53, 53, 53, 56, 56, 56, 57, 57, 57, 57, 57, 56, 56, 56, 56, 55, 55,
- 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 54, 53, 53, 53, 53, 53,
- 55, 56, 56, 57, 57, 57, 57, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 54,
- 54, 54, 54, 54, 54, 54, 54, 54, 53, 53, 53, 53, 53, 53, 55, 56, 56, 56,
- 57, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54,
- 54, 54, 54, 53, 53, 53, 53, 53, 53, 53, 55, 56, 56, 56, 57, 56, 56, 56,
- 56, 56, 56, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 53,
- 53, 53, 53, 53, 53, 53, 55, 56, 56, 56, 57, 56, 56, 56, 56, 56, 56, 55,
- 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 53, 53, 53, 53, 53,
- 53, 53, 55, 56, 56, 56, 57, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55,
- 55, 54, 54, 54, 54, 54, 54, 54, 54, 53, 53, 53, 53, 53, 53, 53 },
- { /* Intra matrices */
- /* Size 4 */
- 74, 67, 66, 63, 67, 65, 64, 63, 66, 64, 62, 61, 63, 63, 61, 60,
- /* Size 8 */
- 72, 77, 67, 66, 65, 64, 63, 62, 77, 70, 66, 68, 67, 66, 65, 64, 67, 66,
- 65, 65, 65, 65, 64, 63, 66, 68, 65, 64, 63, 63, 63, 62, 65, 67, 65, 63,
- 62, 62, 62, 61, 64, 66, 65, 63, 62, 61, 61, 60, 63, 65, 64, 63, 62, 61,
- 60, 60, 62, 64, 63, 62, 61, 60, 60, 60,
- /* Size 16 */
- 73, 75, 77, 72, 67, 67, 66, 66, 66, 65, 64, 64, 63, 63, 62, 62, 75, 74,
- 74, 70, 67, 67, 67, 67, 67, 66, 65, 65, 64, 64, 63, 63, 77, 74, 70, 69,
- 67, 67, 68, 68, 68, 67, 67, 66, 65, 65, 64, 64, 72, 70, 69, 67, 66, 66,
- 67, 67, 67, 66, 66, 65, 65, 64, 64, 64, 67, 67, 67, 66, 65, 65, 65, 65,
- 65, 65, 65, 64, 64, 64, 63, 63, 67, 67, 67, 66, 65, 65, 65, 65, 65, 64,
- 64, 64, 63, 63, 63, 63, 66, 67, 68, 67, 65, 65, 64, 64, 64, 64, 63, 63,
- 63, 63, 62, 62, 66, 67, 68, 67, 65, 65, 64, 64, 63, 63, 63, 63, 62, 62,
- 62, 62, 66, 67, 68, 67, 65, 65, 64, 63, 63, 62, 62, 62, 62, 62, 61, 61,
- 65, 66, 67, 66, 65, 64, 64, 63, 62, 62, 62, 62, 61, 61, 61, 61, 64, 65,
- 67, 66, 65, 64, 63, 63, 62, 62, 62, 61, 61, 61, 61, 61, 64, 65, 66, 65,
- 64, 64, 63, 63, 62, 62, 61, 61, 61, 61, 60, 60, 63, 64, 65, 65, 64, 63,
- 63, 62, 62, 61, 61, 61, 61, 60, 60, 60, 63, 64, 65, 64, 64, 63, 63, 62,
- 62, 61, 61, 61, 60, 60, 60, 60, 62, 63, 64, 64, 63, 63, 62, 62, 61, 61,
- 61, 60, 60, 60, 60, 60, 62, 63, 64, 64, 63, 63, 62, 62, 61, 61, 61, 60,
- 60, 60, 60, 60,
- /* Size 32 */
- 73, 74, 75, 76, 77, 75, 72, 70, 67, 67, 67, 67, 66, 66, 66, 66, 66, 65,
- 65, 65, 65, 64, 64, 64, 63, 63, 63, 63, 62, 62, 62, 62, 74, 74, 75, 75,
- 76, 73, 71, 69, 67, 67, 67, 67, 67, 67, 67, 66, 66, 66, 66, 65, 65, 65,
- 65, 64, 64, 64, 63, 63, 63, 63, 63, 63, 75, 75, 74, 74, 74, 72, 70, 69,
- 67, 67, 67, 67, 67, 67, 67, 67, 67, 66, 66, 66, 66, 65, 65, 65, 64, 64,
- 64, 64, 63, 63, 63, 63, 76, 75, 74, 73, 72, 71, 70, 68, 67, 67, 67, 68,
- 68, 68, 68, 67, 67, 67, 67, 66, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64,
- 64, 64, 77, 76, 74, 72, 70, 70, 69, 68, 67, 67, 68, 68, 68, 68, 68, 68,
- 68, 68, 67, 67, 67, 66, 66, 66, 65, 65, 65, 64, 64, 64, 64, 64, 75, 73,
- 72, 71, 70, 69, 68, 67, 67, 67, 67, 67, 68, 67, 67, 67, 67, 67, 67, 67,
- 66, 66, 66, 65, 65, 65, 64, 64, 64, 64, 64, 64, 72, 71, 70, 70, 69, 68,
- 67, 67, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 66, 66, 66, 66, 65, 65,
- 65, 65, 64, 64, 64, 64, 64, 64, 70, 69, 69, 68, 68, 67, 67, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64,
- 64, 64, 64, 64, 67, 67, 67, 67, 67, 67, 66, 66, 65, 65, 65, 65, 66, 66,
- 66, 66, 66, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63,
- 67, 67, 67, 67, 67, 67, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 67, 67, 67, 67,
- 68, 67, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64,
- 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 67, 67, 67, 68, 68, 67, 67, 66,
- 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63,
- 63, 63, 63, 63, 63, 63, 66, 67, 67, 68, 68, 68, 67, 66, 66, 65, 65, 65,
- 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62,
- 62, 62, 66, 67, 67, 68, 68, 67, 67, 66, 66, 65, 65, 65, 64, 64, 64, 64,
- 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 66, 67,
- 67, 68, 68, 67, 67, 66, 66, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63,
- 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 66, 66, 67, 67, 68, 67,
- 67, 66, 66, 65, 65, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 62, 62,
- 62, 62, 62, 62, 62, 62, 62, 62, 66, 66, 67, 67, 68, 67, 67, 66, 66, 65,
- 65, 64, 64, 64, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62,
- 62, 62, 62, 62, 65, 66, 66, 67, 68, 67, 67, 66, 65, 65, 65, 64, 64, 64,
- 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61,
- 65, 66, 66, 67, 67, 67, 66, 66, 65, 65, 64, 64, 64, 63, 63, 63, 63, 62,
- 62, 62, 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 65, 65, 66, 66,
- 67, 67, 66, 66, 65, 65, 64, 64, 64, 63, 63, 63, 63, 62, 62, 62, 62, 62,
- 62, 62, 61, 61, 61, 61, 61, 61, 61, 61, 65, 65, 66, 66, 67, 66, 66, 65,
- 65, 65, 64, 64, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 61, 61, 61, 61,
- 61, 61, 61, 61, 61, 61, 64, 65, 65, 66, 66, 66, 66, 65, 65, 64, 64, 64,
- 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 61, 61,
- 61, 61, 64, 65, 65, 65, 66, 66, 65, 65, 65, 64, 64, 64, 63, 63, 63, 62,
- 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 64, 64,
- 65, 65, 66, 65, 65, 65, 64, 64, 64, 63, 63, 63, 63, 62, 62, 62, 62, 62,
- 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 63, 64, 64, 65, 65, 65,
- 65, 64, 64, 64, 64, 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61,
- 61, 61, 61, 60, 60, 60, 60, 60, 63, 64, 64, 65, 65, 65, 65, 64, 64, 64,
- 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 60, 60,
- 60, 60, 60, 60, 63, 63, 64, 64, 65, 64, 64, 64, 64, 64, 63, 63, 63, 62,
- 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60,
- 63, 63, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 62, 62, 62, 62, 61,
- 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 62, 63, 63, 64,
- 64, 64, 64, 64, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61,
- 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 62, 63, 63, 64, 64, 64, 64, 64,
- 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 60, 60,
- 60, 60, 60, 60, 60, 60, 62, 63, 63, 64, 64, 64, 64, 64, 63, 63, 63, 63,
- 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60,
- 60, 60, 62, 63, 63, 64, 64, 64, 64, 64, 63, 63, 63, 63, 62, 62, 62, 62,
- 62, 61, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 63, 60, 59, 63, 61, 59, 59, 60, 59, 58, 58, 59, 59, 58, 58,
- /* Size 8 */
- 64, 66, 66, 64, 62, 61, 60, 60, 66, 65, 65, 64, 63, 61, 61, 60, 66, 65,
- 63, 62, 61, 61, 60, 60, 64, 64, 62, 61, 61, 60, 60, 59, 62, 63, 61, 61,
- 60, 60, 59, 59, 61, 61, 61, 60, 60, 59, 59, 59, 60, 61, 60, 60, 59, 59,
- 59, 59, 60, 60, 60, 59, 59, 59, 59, 59,
- /* Size 16 */
- 64, 65, 66, 66, 66, 65, 64, 63, 62, 61, 61, 60, 60, 60, 60, 60, 65, 65,
- 66, 66, 66, 65, 64, 63, 62, 62, 61, 61, 60, 60, 60, 60, 66, 66, 65, 65,
- 65, 65, 64, 63, 63, 62, 61, 61, 61, 60, 60, 60, 66, 66, 65, 65, 64, 64,
- 63, 63, 62, 62, 61, 61, 60, 60, 60, 60, 66, 66, 65, 64, 63, 63, 62, 62,
- 61, 61, 61, 60, 60, 60, 60, 60, 65, 65, 65, 64, 63, 62, 62, 61, 61, 61,
- 60, 60, 60, 60, 60, 60, 64, 64, 64, 63, 62, 62, 61, 61, 61, 60, 60, 60,
- 60, 60, 59, 59, 63, 63, 63, 63, 62, 61, 61, 61, 60, 60, 60, 60, 60, 59,
- 59, 59, 62, 62, 63, 62, 61, 61, 61, 60, 60, 60, 60, 60, 59, 59, 59, 59,
- 61, 62, 62, 62, 61, 61, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 61, 61,
- 61, 61, 61, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 60, 61, 61, 61,
- 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 60, 60, 61, 60, 60, 60,
- 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 59,
- /* Size 32 */
- 64, 65, 65, 66, 66, 66, 66, 66, 66, 65, 65, 64, 64, 63, 63, 62, 62, 62,
- 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 65, 65, 65, 66,
- 66, 66, 66, 66, 66, 65, 65, 64, 64, 63, 63, 62, 62, 62, 62, 61, 61, 61,
- 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 65, 65, 65, 66, 66, 66, 66, 66,
- 66, 65, 65, 64, 64, 63, 63, 63, 62, 62, 62, 61, 61, 61, 61, 61, 60, 60,
- 60, 60, 60, 60, 60, 60, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 64,
- 64, 64, 63, 63, 62, 62, 62, 62, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60,
- 60, 60, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 63, 63,
- 63, 62, 62, 62, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 66, 66,
- 66, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 63, 63, 63, 62, 62, 62, 62,
- 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 66, 66, 66, 65, 65, 65,
- 65, 65, 64, 64, 64, 63, 63, 63, 63, 62, 62, 62, 62, 61, 61, 61, 61, 61,
- 60, 60, 60, 60, 60, 60, 60, 60, 66, 66, 66, 65, 65, 65, 65, 64, 64, 63,
- 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60,
- 60, 60, 60, 60, 66, 66, 66, 65, 65, 65, 64, 64, 63, 63, 63, 62, 62, 62,
- 62, 62, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
- 65, 65, 65, 65, 65, 65, 64, 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 61,
- 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 65, 65, 65, 65,
- 65, 64, 64, 63, 63, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 60, 60,
- 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 64, 64, 64, 64, 65, 64, 63, 63,
- 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60,
- 60, 60, 60, 60, 60, 60, 64, 64, 64, 64, 64, 64, 63, 63, 62, 62, 62, 61,
- 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 59, 59,
- 59, 59, 63, 63, 63, 64, 64, 63, 63, 62, 62, 62, 61, 61, 61, 61, 61, 61,
- 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 63, 63,
- 63, 63, 63, 63, 63, 62, 62, 62, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60,
- 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 62, 62, 63, 63, 63, 63,
- 62, 62, 62, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
- 60, 59, 59, 59, 59, 59, 59, 59, 62, 62, 62, 62, 63, 62, 62, 62, 61, 61,
- 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59,
- 59, 59, 59, 59, 62, 62, 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 60, 60,
- 60, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
- 61, 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60,
- 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 61, 61, 61, 62,
- 62, 62, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 59, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 61, 61, 61, 61, 61, 61, 61, 61,
- 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 61, 61, 61, 61, 61, 61, 61, 61, 61, 60, 60, 60,
- 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
- 59, 59, 60, 61, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60,
- 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 60, 60,
- 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 61, 60,
- 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
- 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
- 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60,
- 60, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 60,
- 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
- 59, 59, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59 },
- { /* Intra matrices */
- /* Size 4 */
- 69, 68, 65, 63, 68, 65, 64, 63, 65, 64, 62, 62, 63, 63, 62, 62,
- /* Size 8 */
- 67, 70, 69, 67, 65, 64, 63, 62, 70, 69, 69, 68, 66, 64, 63, 63, 69, 69,
- 66, 65, 64, 64, 63, 63, 67, 68, 65, 64, 63, 63, 63, 62, 65, 66, 64, 63,
- 63, 62, 62, 62, 64, 64, 64, 63, 62, 62, 62, 62, 63, 63, 63, 63, 62, 62,
- 62, 62, 62, 63, 63, 62, 62, 62, 62, 62,
- /* Size 16 */
- 68, 69, 70, 70, 69, 68, 67, 66, 65, 65, 64, 64, 63, 63, 63, 63, 69, 69,
- 69, 69, 69, 68, 67, 66, 66, 65, 64, 64, 63, 63, 63, 63, 70, 69, 69, 69,
- 69, 68, 68, 67, 66, 65, 65, 64, 64, 63, 63, 63, 70, 69, 69, 68, 68, 67,
- 67, 66, 65, 65, 64, 64, 63, 63, 63, 63, 69, 69, 69, 68, 66, 66, 65, 65,
- 65, 64, 64, 64, 63, 63, 63, 63, 68, 68, 68, 67, 66, 65, 65, 65, 64, 64,
- 64, 63, 63, 63, 63, 63, 67, 67, 68, 67, 65, 65, 64, 64, 64, 63, 63, 63,
- 63, 63, 62, 62, 66, 66, 67, 66, 65, 65, 64, 64, 63, 63, 63, 63, 63, 62,
- 62, 62, 65, 66, 66, 65, 65, 64, 64, 63, 63, 63, 63, 63, 62, 62, 62, 62,
- 65, 65, 65, 65, 64, 64, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 64, 64,
- 65, 64, 64, 64, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 64, 64, 64, 64,
- 64, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 63, 63, 64, 63, 63, 63,
- 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 62,
- 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62,
- 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62,
- 62, 62, 62, 62,
- /* Size 32 */
- 68, 68, 69, 70, 70, 70, 70, 70, 69, 69, 68, 68, 67, 67, 66, 66, 65, 65,
- 65, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 68, 69, 69, 69,
- 70, 70, 70, 69, 69, 69, 68, 68, 67, 67, 66, 66, 65, 65, 65, 65, 64, 64,
- 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 69, 69, 69, 69, 70, 69, 69, 69,
- 69, 69, 68, 68, 67, 67, 67, 66, 66, 65, 65, 65, 64, 64, 64, 64, 63, 63,
- 63, 63, 63, 63, 63, 63, 70, 69, 69, 69, 69, 69, 69, 69, 69, 69, 68, 68,
- 68, 67, 67, 66, 66, 66, 65, 65, 65, 64, 64, 64, 64, 63, 63, 63, 63, 63,
- 63, 63, 70, 70, 70, 69, 69, 69, 69, 69, 69, 69, 69, 68, 68, 67, 67, 67,
- 66, 66, 65, 65, 65, 65, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 70, 70,
- 69, 69, 69, 69, 69, 69, 69, 68, 68, 68, 67, 67, 67, 66, 66, 65, 65, 65,
- 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 70, 70, 69, 69, 69, 69,
- 68, 68, 68, 68, 67, 67, 67, 66, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64,
- 64, 63, 63, 63, 63, 63, 63, 63, 70, 69, 69, 69, 69, 69, 68, 68, 67, 67,
- 67, 66, 66, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63,
- 63, 63, 63, 63, 69, 69, 69, 69, 69, 69, 68, 67, 67, 66, 66, 66, 66, 65,
- 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63,
- 69, 69, 69, 69, 69, 68, 68, 67, 66, 66, 66, 66, 65, 65, 65, 65, 65, 64,
- 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 68, 68, 68, 68,
- 69, 68, 67, 67, 66, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64,
- 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 68, 68, 68, 68, 68, 68, 67, 66,
- 66, 66, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63,
- 63, 63, 63, 63, 63, 63, 67, 67, 67, 68, 68, 67, 67, 66, 66, 65, 65, 65,
- 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
- 63, 63, 67, 67, 67, 67, 67, 67, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64,
- 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 66, 66,
- 67, 67, 67, 67, 66, 66, 65, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63,
- 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 66, 66, 66, 66, 67, 66,
- 66, 65, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63,
- 63, 63, 62, 62, 62, 62, 62, 62, 65, 65, 66, 66, 66, 66, 65, 65, 65, 65,
- 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62,
- 62, 62, 62, 62, 65, 65, 65, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64, 63,
- 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62,
- 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63,
- 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 64, 65, 65, 65,
- 65, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62,
- 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 64, 64, 64, 65, 65, 65, 64, 64,
- 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62,
- 62, 62, 62, 62, 62, 62, 64, 64, 64, 64, 65, 64, 64, 64, 64, 64, 64, 63,
- 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
- 62, 62, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63,
- 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 64,
- 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62,
- 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 64, 64, 64,
- 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62,
- 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 64, 64, 63, 63, 63, 63,
- 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
- 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
- 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
- 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62,
- 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63,
- 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62,
- 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63,
- 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
- 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
- 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
- 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62,
- 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
- 64, 61, 60, 59, 61, 60, 60, 59, 60, 60, 59, 58, 59, 59, 58, 58,
- /* Size 8 */
- 64, 66, 61, 61, 61, 60, 60, 59, 66, 63, 61, 62, 62, 61, 61, 60, 61, 61,
- 61, 61, 61, 61, 60, 60, 61, 62, 61, 60, 60, 60, 60, 59, 61, 62, 61, 60,
- 60, 59, 59, 59, 60, 61, 61, 60, 59, 59, 59, 59, 60, 61, 60, 60, 59, 59,
- 59, 59, 59, 60, 60, 59, 59, 59, 59, 58,
- /* Size 16 */
- 64, 65, 66, 64, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 59, 59, 65, 65,
- 64, 63, 61, 61, 62, 61, 61, 61, 61, 61, 60, 60, 60, 60, 66, 64, 63, 62,
- 61, 62, 62, 62, 62, 62, 61, 61, 61, 60, 60, 60, 64, 63, 62, 62, 61, 61,
- 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 61, 61, 61, 61, 61, 61, 61, 61,
- 61, 61, 61, 60, 60, 60, 60, 60, 61, 61, 62, 61, 61, 61, 60, 60, 60, 60,
- 60, 60, 60, 60, 60, 60, 61, 62, 62, 61, 61, 60, 60, 60, 60, 60, 60, 60,
- 60, 60, 59, 59, 61, 61, 62, 61, 61, 60, 60, 60, 60, 60, 60, 60, 59, 59,
- 59, 59, 61, 61, 62, 61, 61, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59,
- 61, 61, 62, 61, 61, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 60, 61,
- 61, 61, 61, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 60, 61, 61, 61,
- 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 60, 60, 61, 60, 60, 60,
- 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 59,
- 59, 59, 59, 59, 59, 59, 58, 58, 59, 60, 60, 60, 60, 60, 59, 59, 59, 59,
- 59, 59, 59, 58, 58, 58, 59, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59,
- 59, 58, 58, 58,
- /* Size 32 */
- 64, 64, 65, 65, 66, 65, 64, 63, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
- 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 64, 65, 65, 65,
- 65, 64, 63, 62, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 60,
- 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 65, 65, 65, 65, 64, 64, 63, 62,
- 61, 61, 61, 62, 62, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 60, 60, 60,
- 60, 60, 60, 60, 60, 60, 65, 65, 65, 64, 64, 63, 63, 62, 61, 61, 62, 62,
- 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60,
- 60, 60, 66, 65, 64, 64, 63, 63, 62, 62, 61, 62, 62, 62, 62, 62, 62, 62,
- 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 65, 64,
- 64, 63, 63, 62, 62, 62, 61, 61, 61, 62, 62, 62, 62, 62, 62, 61, 61, 61,
- 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 64, 63, 63, 63, 62, 62,
- 62, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
- 60, 60, 60, 60, 60, 60, 60, 60, 63, 62, 62, 62, 62, 62, 61, 61, 61, 61,
- 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60,
- 60, 60, 60, 60, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
- 61, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
- 61, 61, 61, 61, 62, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
- 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 61, 61, 61, 62,
- 62, 61, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
- 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 61, 61, 62, 62, 62, 62, 61, 61,
- 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
- 60, 60, 59, 59, 59, 59, 61, 61, 62, 62, 62, 62, 61, 61, 61, 61, 60, 60,
- 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59,
- 59, 59, 61, 61, 61, 62, 62, 62, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60,
- 60, 60, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 61, 61,
- 61, 62, 62, 62, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
- 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 61, 61, 61, 62, 62, 62,
- 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 61, 61, 61, 62, 62, 62, 61, 61, 61, 61,
- 60, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 59, 61, 61, 61, 61, 62, 61, 61, 61, 61, 61, 60, 60, 60, 60,
- 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
- 61, 61, 61, 61, 62, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 59, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 60, 61, 61, 61,
- 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 60, 61, 61, 61, 61, 61, 61, 61,
- 61, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 60, 60, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60,
- 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
- 59, 59, 60, 60, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 60, 60,
- 60, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 61, 61,
- 60, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 61, 60, 60, 60, 60, 60,
- 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
- 58, 58, 58, 58, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58,
- 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 59, 60, 60, 60,
- 60, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 59, 60, 60, 60, 60, 60, 60, 60,
- 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 58,
- 58, 58, 58, 58, 58, 58, 59, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58,
- 58, 58, 59, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58 },
- { /* Intra matrices */
- /* Size 4 */
- 69, 65, 65, 64, 65, 64, 64, 63, 65, 64, 63, 62, 64, 63, 62, 62,
- /* Size 8 */
- 68, 70, 65, 65, 65, 64, 63, 63, 70, 67, 65, 66, 66, 65, 64, 64, 65, 65,
- 64, 64, 65, 64, 64, 63, 65, 66, 64, 64, 64, 63, 63, 63, 65, 66, 65, 64,
- 63, 63, 63, 63, 64, 65, 64, 63, 63, 63, 62, 62, 63, 64, 64, 63, 63, 62,
- 62, 62, 63, 64, 63, 63, 63, 62, 62, 62,
- /* Size 16 */
- 68, 69, 70, 68, 65, 65, 65, 65, 65, 64, 64, 64, 64, 63, 63, 63, 69, 69,
- 69, 67, 65, 65, 66, 65, 65, 65, 65, 64, 64, 64, 64, 64, 70, 69, 67, 66,
- 65, 66, 66, 66, 66, 65, 65, 65, 65, 64, 64, 64, 68, 67, 66, 66, 65, 65,
- 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 65, 65, 65, 65, 64, 65, 65, 65,
- 65, 65, 64, 64, 64, 64, 64, 64, 65, 65, 66, 65, 65, 64, 64, 64, 64, 64,
- 64, 64, 64, 63, 63, 63, 65, 66, 66, 65, 65, 64, 64, 64, 64, 64, 64, 63,
- 63, 63, 63, 63, 65, 65, 66, 65, 65, 64, 64, 64, 64, 63, 63, 63, 63, 63,
- 63, 63, 65, 65, 66, 65, 65, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63,
- 64, 65, 65, 65, 65, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 65,
- 65, 65, 64, 64, 64, 63, 63, 63, 63, 63, 63, 62, 62, 62, 64, 64, 65, 65,
- 64, 64, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 64, 64, 65, 64, 64, 64,
- 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 63, 64, 64, 64, 64, 63, 63, 63,
- 63, 63, 62, 62, 62, 62, 62, 62, 63, 64, 64, 64, 64, 63, 63, 63, 63, 63,
- 62, 62, 62, 62, 62, 62, 63, 64, 64, 64, 64, 63, 63, 63, 63, 63, 62, 62,
- 62, 62, 62, 62,
- /* Size 32 */
- 68, 69, 69, 70, 71, 69, 68, 67, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 69, 69, 69, 69,
- 70, 69, 68, 67, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64,
- 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 69, 69, 69, 69, 69, 68, 67, 66,
- 65, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 70, 69, 69, 68, 68, 67, 67, 66, 65, 66, 66, 66,
- 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64,
- 64, 64, 71, 70, 69, 68, 67, 67, 66, 66, 65, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 69, 69,
- 68, 67, 67, 66, 66, 66, 65, 65, 65, 66, 66, 66, 66, 66, 66, 65, 65, 65,
- 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 68, 68, 67, 67, 66, 66,
- 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 67, 67, 66, 66, 66, 66, 65, 65, 65, 65,
+ /* Size 32x32 */
+ 64, 66, 66, 67, 65, 61, 58, 56, 51, 49, 42, 42, 42, 42, 42, 41, 41, 39,
+ 39, 38, 38, 36, 36, 34, 33, 32, 32, 32, 31, 30, 30, 29, 66, 65, 65, 66,
+ 63, 59, 55, 53, 49, 48, 43, 43, 44, 44, 44, 43, 42, 41, 41, 39, 39, 38,
+ 37, 36, 35, 34, 34, 33, 33, 32, 32, 31, 66, 65, 65, 65, 63, 59, 55, 53,
+ 49, 48, 43, 43, 44, 44, 44, 43, 43, 42, 41, 40, 40, 38, 38, 36, 36, 34,
+ 34, 34, 33, 32, 32, 31, 67, 66, 65, 64, 62, 58, 54, 51, 49, 48, 44, 44,
+ 45, 45, 46, 45, 44, 43, 43, 41, 41, 39, 39, 38, 37, 36, 35, 35, 34, 34,
+ 33, 33, 65, 63, 63, 62, 59, 55, 52, 49, 48, 47, 44, 44, 45, 45, 46, 45,
+ 44, 43, 43, 41, 41, 40, 39, 38, 37, 36, 36, 35, 34, 34, 33, 33, 61, 59,
+ 59, 58, 55, 53, 49, 47, 46, 46, 43, 44, 44, 45, 45, 45, 44, 43, 43, 42,
+ 41, 40, 40, 38, 38, 36, 36, 36, 35, 34, 34, 34, 58, 55, 55, 54, 52, 49,
+ 47, 45, 45, 44, 43, 43, 44, 45, 45, 45, 44, 44, 44, 42, 42, 41, 40, 39,
+ 38, 37, 37, 36, 36, 35, 34, 33, 56, 53, 53, 51, 49, 47, 45, 43, 43, 43,
+ 43, 43, 44, 45, 45, 45, 45, 44, 44, 43, 42, 41, 41, 39, 39, 38, 37, 37,
+ 36, 36, 35, 35, 51, 49, 49, 49, 48, 46, 45, 43, 43, 42, 41, 41, 42, 42,
+ 42, 42, 42, 41, 41, 40, 40, 39, 39, 38, 37, 36, 36, 35, 35, 34, 34, 35,
+ 49, 48, 48, 48, 47, 46, 44, 43, 42, 42, 41, 41, 41, 41, 42, 41, 41, 41,
+ 41, 39, 39, 38, 38, 37, 37, 36, 35, 35, 34, 34, 33, 32, 42, 43, 43, 44,
+ 44, 43, 43, 43, 41, 41, 39, 39, 39, 38, 38, 38, 38, 38, 38, 37, 37, 36,
+ 36, 35, 34, 34, 34, 33, 33, 33, 33, 33, 42, 43, 43, 44, 44, 44, 43, 43,
+ 41, 41, 39, 39, 38, 38, 38, 38, 38, 38, 38, 37, 37, 36, 36, 35, 34, 34,
+ 33, 33, 33, 32, 32, 31, 42, 44, 44, 45, 45, 44, 44, 44, 42, 41, 39, 38,
+ 38, 38, 37, 37, 36, 36, 36, 35, 35, 34, 34, 33, 33, 32, 32, 32, 31, 31,
+ 31, 32, 42, 44, 44, 45, 45, 45, 45, 45, 42, 41, 38, 38, 38, 37, 36, 36,
+ 36, 35, 35, 34, 34, 34, 33, 33, 32, 32, 31, 31, 31, 31, 31, 29, 42, 44,
+ 44, 46, 46, 45, 45, 45, 42, 42, 38, 38, 37, 36, 35, 35, 34, 34, 33, 33,
+ 33, 32, 32, 31, 31, 30, 30, 30, 30, 29, 29, 30, 41, 43, 43, 45, 45, 45,
+ 45, 45, 42, 41, 38, 38, 37, 36, 35, 34, 34, 33, 33, 32, 32, 31, 31, 31,
+ 30, 30, 29, 29, 29, 29, 29, 28, 41, 42, 43, 44, 44, 44, 44, 45, 42, 41,
+ 38, 38, 36, 36, 34, 34, 33, 33, 32, 32, 32, 31, 30, 30, 29, 29, 29, 29,
+ 28, 28, 28, 29, 39, 41, 42, 43, 43, 43, 44, 44, 41, 41, 38, 38, 36, 35,
+ 34, 33, 33, 32, 31, 30, 30, 29, 29, 29, 28, 28, 28, 27, 27, 27, 28, 26,
+ 39, 41, 41, 43, 43, 43, 44, 44, 41, 41, 38, 38, 36, 35, 33, 33, 32, 31,
+ 31, 30, 30, 29, 29, 28, 28, 27, 27, 27, 27, 26, 26, 27, 38, 39, 40, 41,
+ 41, 42, 42, 43, 40, 39, 37, 37, 35, 34, 33, 32, 32, 30, 30, 29, 29, 28,
+ 28, 27, 27, 26, 26, 26, 26, 26, 26, 25, 38, 39, 40, 41, 41, 41, 42, 42,
+ 40, 39, 37, 37, 35, 34, 33, 32, 32, 30, 30, 29, 29, 28, 28, 27, 27, 26,
+ 26, 26, 26, 25, 25, 26, 36, 38, 38, 39, 40, 40, 41, 41, 39, 38, 36, 36,
+ 34, 34, 32, 31, 31, 29, 29, 28, 28, 27, 27, 26, 26, 25, 25, 25, 24, 25,
+ 25, 24, 36, 37, 38, 39, 39, 40, 40, 41, 39, 38, 36, 36, 34, 33, 32, 31,
+ 30, 29, 29, 28, 28, 27, 26, 26, 25, 25, 25, 25, 24, 24, 23, 25, 34, 36,
+ 36, 38, 38, 38, 39, 39, 38, 37, 35, 35, 33, 33, 31, 31, 30, 29, 28, 27,
+ 27, 26, 26, 25, 25, 24, 24, 24, 23, 23, 24, 22, 33, 35, 36, 37, 37, 38,
+ 38, 39, 37, 37, 34, 34, 33, 32, 31, 30, 29, 28, 28, 27, 27, 26, 25, 25,
+ 24, 24, 23, 23, 23, 23, 22, 24, 32, 34, 34, 36, 36, 36, 37, 38, 36, 36,
+ 34, 34, 32, 32, 30, 30, 29, 28, 27, 26, 26, 25, 25, 24, 24, 23, 23, 23,
+ 22, 22, 23, 22, 32, 34, 34, 35, 36, 36, 37, 37, 36, 35, 34, 33, 32, 31,
+ 30, 29, 29, 28, 27, 26, 26, 25, 25, 24, 23, 23, 23, 23, 22, 22, 21, 23,
+ 32, 33, 34, 35, 35, 36, 36, 37, 35, 35, 33, 33, 32, 31, 30, 29, 29, 27,
+ 27, 26, 26, 25, 25, 24, 23, 23, 23, 22, 22, 22, 22, 20, 31, 33, 33, 34,
+ 34, 35, 36, 36, 35, 34, 33, 33, 31, 31, 30, 29, 28, 27, 27, 26, 26, 24,
+ 24, 23, 23, 22, 22, 22, 22, 22, 21, 22, 30, 32, 32, 34, 34, 34, 35, 36,
+ 34, 34, 33, 32, 31, 31, 29, 29, 28, 27, 26, 26, 25, 25, 24, 23, 23, 22,
+ 22, 22, 22, 21, 21, 21, 30, 32, 32, 33, 33, 34, 34, 35, 34, 33, 33, 32,
+ 31, 31, 29, 29, 28, 28, 26, 26, 25, 25, 23, 24, 22, 23, 21, 22, 21, 21,
+ 21, 21, 29, 31, 31, 33, 33, 34, 33, 35, 35, 32, 33, 31, 32, 29, 30, 28,
+ 29, 26, 27, 25, 26, 24, 25, 22, 24, 22, 23, 20, 22, 21, 21, 20,
+ /* Size 4x8 */
+ 65, 44, 41, 34, 57, 44, 43, 36, 48, 41, 41, 35, 45, 39, 35, 31, 43, 38,
+ 31, 28, 39, 36, 29, 25, 36, 34, 27, 23, 33, 32, 26, 22,
+ /* Size 8x4 */
+ 65, 57, 48, 45, 43, 39, 36, 33, 44, 44, 41, 39, 38, 36, 34, 32, 41, 43,
+ 41, 35, 31, 29, 27, 26, 34, 36, 35, 31, 28, 25, 23, 22,
+ /* Size 8x16 */
+ 64, 64, 51, 42, 40, 36, 32, 30, 66, 62, 49, 44, 42, 38, 34, 32, 65, 59,
+ 48, 45, 43, 40, 36, 34, 58, 52, 45, 44, 44, 41, 37, 35, 50, 48, 43, 42,
+ 41, 39, 36, 34, 42, 44, 41, 38, 38, 36, 34, 33, 42, 45, 42, 38, 36, 34,
+ 32, 31, 42, 45, 42, 36, 34, 32, 30, 29, 41, 44, 41, 36, 33, 31, 29, 28,
+ 39, 43, 41, 35, 31, 29, 27, 26, 38, 41, 40, 34, 31, 28, 26, 25, 36, 39,
+ 39, 34, 29, 27, 25, 24, 34, 37, 37, 32, 28, 26, 24, 23, 32, 35, 35, 32,
+ 28, 25, 23, 22, 31, 34, 34, 31, 27, 24, 22, 22, 30, 33, 34, 31, 27, 25,
+ 22, 21,
+ /* Size 16x8 */
+ 64, 66, 65, 58, 50, 42, 42, 42, 41, 39, 38, 36, 34, 32, 31, 30, 64, 62,
+ 59, 52, 48, 44, 45, 45, 44, 43, 41, 39, 37, 35, 34, 33, 51, 49, 48, 45,
+ 43, 41, 42, 42, 41, 41, 40, 39, 37, 35, 34, 34, 42, 44, 45, 44, 42, 38,
+ 38, 36, 36, 35, 34, 34, 32, 32, 31, 31, 40, 42, 43, 44, 41, 38, 36, 34,
+ 33, 31, 31, 29, 28, 28, 27, 27, 36, 38, 40, 41, 39, 36, 34, 32, 31, 29,
+ 28, 27, 26, 25, 24, 25, 32, 34, 36, 37, 36, 34, 32, 30, 29, 27, 26, 25,
+ 24, 23, 22, 22, 30, 32, 34, 35, 34, 33, 31, 29, 28, 26, 25, 24, 23, 22,
+ 22, 21,
+ /* Size 16x32 */
+ 64, 66, 64, 55, 51, 43, 42, 42, 40, 39, 36, 35, 32, 32, 30, 29, 65, 65,
+ 62, 53, 49, 44, 44, 44, 41, 41, 38, 37, 34, 34, 32, 31, 66, 65, 62, 53,
+ 49, 44, 44, 44, 42, 41, 38, 38, 34, 34, 32, 31, 67, 64, 61, 51, 49, 45,
+ 45, 45, 43, 43, 39, 39, 36, 35, 34, 33, 65, 61, 59, 50, 48, 44, 45, 45,
+ 43, 43, 40, 39, 36, 36, 34, 33, 61, 57, 55, 48, 46, 44, 44, 45, 43, 43,
+ 40, 39, 37, 36, 34, 34, 58, 53, 52, 45, 45, 43, 44, 45, 44, 43, 41, 40,
+ 37, 37, 35, 34, 55, 51, 49, 44, 43, 43, 44, 45, 44, 44, 41, 41, 38, 37,
+ 36, 35, 50, 48, 48, 43, 43, 41, 42, 42, 41, 41, 39, 39, 36, 36, 34, 35,
+ 49, 48, 47, 43, 42, 41, 41, 41, 41, 41, 38, 38, 36, 35, 34, 32, 42, 44,
+ 44, 43, 41, 39, 38, 38, 38, 38, 36, 36, 34, 34, 33, 33, 42, 44, 44, 43,
+ 41, 39, 38, 38, 38, 37, 36, 36, 34, 33, 33, 31, 42, 45, 45, 44, 42, 39,
+ 38, 37, 36, 36, 34, 34, 32, 32, 31, 32, 42, 45, 45, 44, 42, 39, 37, 36,
+ 35, 35, 34, 33, 32, 31, 31, 29, 42, 45, 45, 45, 42, 38, 36, 35, 34, 33,
+ 32, 32, 30, 30, 29, 30, 41, 45, 45, 45, 42, 38, 36, 35, 33, 33, 31, 31,
+ 30, 29, 29, 28, 41, 44, 44, 44, 41, 38, 36, 34, 33, 32, 31, 30, 29, 29,
+ 28, 29, 40, 43, 43, 44, 41, 38, 35, 34, 32, 31, 29, 29, 28, 28, 27, 26,
+ 39, 43, 43, 43, 41, 38, 35, 34, 31, 31, 29, 29, 27, 27, 26, 27, 38, 41,
+ 41, 42, 40, 37, 34, 33, 31, 30, 28, 28, 26, 26, 26, 25, 38, 41, 41, 42,
+ 40, 37, 34, 33, 31, 30, 28, 28, 26, 26, 25, 26, 36, 39, 39, 41, 39, 36,
+ 34, 32, 30, 29, 27, 27, 25, 25, 25, 24, 36, 39, 39, 40, 39, 36, 34, 32,
+ 29, 29, 27, 26, 25, 25, 24, 25, 34, 38, 38, 39, 37, 35, 33, 31, 29, 28,
+ 26, 26, 24, 24, 23, 23, 34, 37, 37, 38, 37, 34, 32, 31, 28, 28, 26, 25,
+ 24, 23, 23, 24, 32, 36, 36, 37, 36, 34, 32, 30, 28, 27, 25, 25, 23, 23,
+ 22, 22, 32, 35, 35, 37, 35, 34, 32, 30, 28, 27, 25, 25, 23, 23, 22, 23,
+ 32, 35, 35, 37, 35, 33, 31, 30, 28, 27, 25, 25, 23, 23, 22, 20, 31, 34,
+ 34, 36, 34, 33, 31, 30, 27, 27, 24, 24, 22, 22, 22, 22, 30, 33, 34, 35,
+ 34, 32, 31, 29, 27, 26, 25, 24, 22, 22, 21, 21, 30, 33, 33, 35, 34, 32,
+ 31, 29, 27, 26, 25, 24, 22, 22, 21, 21, 29, 33, 32, 34, 34, 31, 32, 28,
+ 29, 25, 26, 22, 24, 20, 22, 20,
+ /* Size 32x16 */
+ 64, 65, 66, 67, 65, 61, 58, 55, 50, 49, 42, 42, 42, 42, 42, 41, 41, 40,
+ 39, 38, 38, 36, 36, 34, 34, 32, 32, 32, 31, 30, 30, 29, 66, 65, 65, 64,
+ 61, 57, 53, 51, 48, 48, 44, 44, 45, 45, 45, 45, 44, 43, 43, 41, 41, 39,
+ 39, 38, 37, 36, 35, 35, 34, 33, 33, 33, 64, 62, 62, 61, 59, 55, 52, 49,
+ 48, 47, 44, 44, 45, 45, 45, 45, 44, 43, 43, 41, 41, 39, 39, 38, 37, 36,
+ 35, 35, 34, 34, 33, 32, 55, 53, 53, 51, 50, 48, 45, 44, 43, 43, 43, 43,
+ 44, 44, 45, 45, 44, 44, 43, 42, 42, 41, 40, 39, 38, 37, 37, 37, 36, 35,
+ 35, 34, 51, 49, 49, 49, 48, 46, 45, 43, 43, 42, 41, 41, 42, 42, 42, 42,
+ 41, 41, 41, 40, 40, 39, 39, 37, 37, 36, 35, 35, 34, 34, 34, 34, 43, 44,
+ 44, 45, 44, 44, 43, 43, 41, 41, 39, 39, 39, 39, 38, 38, 38, 38, 38, 37,
+ 37, 36, 36, 35, 34, 34, 34, 33, 33, 32, 32, 31, 42, 44, 44, 45, 45, 44,
+ 44, 44, 42, 41, 38, 38, 38, 37, 36, 36, 36, 35, 35, 34, 34, 34, 34, 33,
+ 32, 32, 32, 31, 31, 31, 31, 32, 42, 44, 44, 45, 45, 45, 45, 45, 42, 41,
+ 38, 38, 37, 36, 35, 35, 34, 34, 34, 33, 33, 32, 32, 31, 31, 30, 30, 30,
+ 30, 29, 29, 28, 40, 41, 42, 43, 43, 43, 44, 44, 41, 41, 38, 38, 36, 35,
+ 34, 33, 33, 32, 31, 31, 31, 30, 29, 29, 28, 28, 28, 28, 27, 27, 27, 29,
+ 39, 41, 41, 43, 43, 43, 43, 44, 41, 41, 38, 37, 36, 35, 33, 33, 32, 31,
+ 31, 30, 30, 29, 29, 28, 28, 27, 27, 27, 27, 26, 26, 25, 36, 38, 38, 39,
+ 40, 40, 41, 41, 39, 38, 36, 36, 34, 34, 32, 31, 31, 29, 29, 28, 28, 27,
+ 27, 26, 26, 25, 25, 25, 24, 25, 25, 26, 35, 37, 38, 39, 39, 39, 40, 41,
+ 39, 38, 36, 36, 34, 33, 32, 31, 30, 29, 29, 28, 28, 27, 26, 26, 25, 25,
+ 25, 25, 24, 24, 24, 22, 32, 34, 34, 36, 36, 37, 37, 38, 36, 36, 34, 34,
+ 32, 32, 30, 30, 29, 28, 27, 26, 26, 25, 25, 24, 24, 23, 23, 23, 22, 22,
+ 22, 24, 32, 34, 34, 35, 36, 36, 37, 37, 36, 35, 34, 33, 32, 31, 30, 29,
+ 29, 28, 27, 26, 26, 25, 25, 24, 23, 23, 23, 23, 22, 22, 22, 20, 30, 32,
+ 32, 34, 34, 34, 35, 36, 34, 34, 33, 33, 31, 31, 29, 29, 28, 27, 26, 26,
+ 25, 25, 24, 23, 23, 22, 22, 22, 22, 21, 21, 22, 29, 31, 31, 33, 33, 34,
+ 34, 35, 35, 32, 33, 31, 32, 29, 30, 28, 29, 26, 27, 25, 26, 24, 25, 23,
+ 24, 22, 23, 20, 22, 21, 21, 20,
+ /* Size 4x16 */
+ 66, 43, 39, 32, 65, 44, 41, 34, 61, 44, 43, 36, 53, 43, 43, 37, 48, 41,
+ 41, 36, 44, 39, 38, 34, 45, 39, 36, 32, 45, 38, 33, 30, 44, 38, 32, 29,
+ 43, 38, 31, 27, 41, 37, 30, 26, 39, 36, 29, 25, 37, 34, 28, 23, 35, 34,
+ 27, 23, 34, 33, 27, 22, 33, 32, 26, 22,
+ /* Size 16x4 */
+ 66, 65, 61, 53, 48, 44, 45, 45, 44, 43, 41, 39, 37, 35, 34, 33, 43, 44,
+ 44, 43, 41, 39, 39, 38, 38, 38, 37, 36, 34, 34, 33, 32, 39, 41, 43, 43,
+ 41, 38, 36, 33, 32, 31, 30, 29, 28, 27, 27, 26, 32, 34, 36, 37, 36, 34,
+ 32, 30, 29, 27, 26, 25, 23, 23, 22, 22,
+ /* Size 8x32 */
+ 64, 64, 51, 42, 40, 36, 32, 30, 65, 62, 49, 44, 41, 38, 34, 32, 66, 62,
+ 49, 44, 42, 38, 34, 32, 67, 61, 49, 45, 43, 39, 36, 34, 65, 59, 48, 45,
+ 43, 40, 36, 34, 61, 55, 46, 44, 43, 40, 37, 34, 58, 52, 45, 44, 44, 41,
+ 37, 35, 55, 49, 43, 44, 44, 41, 38, 36, 50, 48, 43, 42, 41, 39, 36, 34,
+ 49, 47, 42, 41, 41, 38, 36, 34, 42, 44, 41, 38, 38, 36, 34, 33, 42, 44,
+ 41, 38, 38, 36, 34, 33, 42, 45, 42, 38, 36, 34, 32, 31, 42, 45, 42, 37,
+ 35, 34, 32, 31, 42, 45, 42, 36, 34, 32, 30, 29, 41, 45, 42, 36, 33, 31,
+ 30, 29, 41, 44, 41, 36, 33, 31, 29, 28, 40, 43, 41, 35, 32, 29, 28, 27,
+ 39, 43, 41, 35, 31, 29, 27, 26, 38, 41, 40, 34, 31, 28, 26, 26, 38, 41,
+ 40, 34, 31, 28, 26, 25, 36, 39, 39, 34, 30, 27, 25, 25, 36, 39, 39, 34,
+ 29, 27, 25, 24, 34, 38, 37, 33, 29, 26, 24, 23, 34, 37, 37, 32, 28, 26,
+ 24, 23, 32, 36, 36, 32, 28, 25, 23, 22, 32, 35, 35, 32, 28, 25, 23, 22,
+ 32, 35, 35, 31, 28, 25, 23, 22, 31, 34, 34, 31, 27, 24, 22, 22, 30, 34,
+ 34, 31, 27, 25, 22, 21, 30, 33, 34, 31, 27, 25, 22, 21, 29, 32, 34, 32,
+ 29, 26, 24, 22,
+ /* Size 32x8 */
+ 64, 65, 66, 67, 65, 61, 58, 55, 50, 49, 42, 42, 42, 42, 42, 41, 41, 40,
+ 39, 38, 38, 36, 36, 34, 34, 32, 32, 32, 31, 30, 30, 29, 64, 62, 62, 61,
+ 59, 55, 52, 49, 48, 47, 44, 44, 45, 45, 45, 45, 44, 43, 43, 41, 41, 39,
+ 39, 38, 37, 36, 35, 35, 34, 34, 33, 32, 51, 49, 49, 49, 48, 46, 45, 43,
+ 43, 42, 41, 41, 42, 42, 42, 42, 41, 41, 41, 40, 40, 39, 39, 37, 37, 36,
+ 35, 35, 34, 34, 34, 34, 42, 44, 44, 45, 45, 44, 44, 44, 42, 41, 38, 38,
+ 38, 37, 36, 36, 36, 35, 35, 34, 34, 34, 34, 33, 32, 32, 32, 31, 31, 31,
+ 31, 32, 40, 41, 42, 43, 43, 43, 44, 44, 41, 41, 38, 38, 36, 35, 34, 33,
+ 33, 32, 31, 31, 31, 30, 29, 29, 28, 28, 28, 28, 27, 27, 27, 29, 36, 38,
+ 38, 39, 40, 40, 41, 41, 39, 38, 36, 36, 34, 34, 32, 31, 31, 29, 29, 28,
+ 28, 27, 27, 26, 26, 25, 25, 25, 24, 25, 25, 26, 32, 34, 34, 36, 36, 37,
+ 37, 38, 36, 36, 34, 34, 32, 32, 30, 30, 29, 28, 27, 26, 26, 25, 25, 24,
+ 24, 23, 23, 23, 22, 22, 22, 24, 30, 32, 32, 34, 34, 34, 35, 36, 34, 34,
+ 33, 33, 31, 31, 29, 29, 28, 27, 26, 26, 25, 25, 24, 23, 23, 22, 22, 22,
+ 22, 21, 21, 22 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 58, 35, 35, 20,
+#endif
+ /* Size 4x4 */
+ 63, 59, 41, 28, 59, 42, 34, 26, 41, 34, 25, 20, 28, 26, 20, 15,
+ /* Size 8x8 */
+ 64, 64, 60, 53, 44, 36, 30, 26, 64, 61, 58, 53, 45, 38, 32, 28, 60, 58,
+ 52, 46, 40, 35, 30, 27, 53, 53, 46, 38, 34, 30, 26, 24, 44, 45, 40, 34,
+ 29, 25, 23, 21, 36, 38, 35, 30, 25, 22, 20, 18, 30, 32, 30, 26, 23, 20,
+ 17, 16, 26, 28, 27, 24, 21, 18, 16, 15,
+ /* Size 16x16 */
+ 64, 65, 65, 65, 64, 60, 57, 52, 47, 42, 38, 35, 31, 29, 26, 25, 65, 64,
+ 64, 64, 63, 60, 59, 53, 48, 44, 40, 36, 33, 30, 27, 26, 65, 64, 63, 63,
+ 63, 61, 59, 55, 50, 46, 41, 38, 34, 32, 28, 27, 65, 64, 63, 61, 60, 58,
+ 56, 53, 49, 45, 41, 38, 35, 32, 29, 28, 64, 63, 63, 60, 58, 55, 53, 51,
+ 48, 45, 41, 38, 35, 33, 29, 28, 60, 60, 61, 58, 55, 52, 48, 46, 43, 40,
+ 38, 35, 33, 30, 28, 27, 57, 59, 59, 56, 53, 48, 42, 41, 38, 36, 34, 32,
+ 30, 28, 26, 25, 52, 53, 55, 53, 51, 46, 41, 38, 35, 34, 32, 30, 28, 26,
+ 24, 24, 47, 48, 50, 49, 48, 43, 38, 35, 32, 31, 29, 27, 26, 24, 23, 22,
+ 42, 44, 46, 45, 45, 40, 36, 34, 31, 29, 27, 25, 24, 23, 21, 21, 38, 40,
+ 41, 41, 41, 38, 34, 32, 29, 27, 25, 24, 22, 21, 20, 19, 35, 36, 38, 38,
+ 38, 35, 32, 30, 27, 25, 24, 22, 21, 20, 19, 18, 31, 33, 34, 35, 35, 33,
+ 30, 28, 26, 24, 22, 21, 20, 18, 17, 17, 29, 30, 32, 32, 33, 30, 28, 26,
+ 24, 23, 21, 20, 18, 17, 16, 16, 26, 27, 28, 29, 29, 28, 26, 24, 23, 21,
+ 20, 19, 17, 16, 15, 15, 25, 26, 27, 28, 28, 27, 25, 24, 22, 21, 19, 18,
+ 17, 16, 15, 15,
+ /* Size 32x32 */
+ 64, 65, 65, 65, 65, 65, 65, 64, 64, 60, 60, 57, 57, 52, 52, 47, 47, 42,
+ 42, 38, 38, 35, 35, 31, 31, 29, 29, 26, 26, 25, 25, 23, 65, 64, 64, 64,
+ 64, 64, 64, 63, 63, 60, 60, 59, 59, 53, 53, 48, 48, 44, 44, 40, 40, 36,
+ 36, 33, 33, 30, 30, 27, 27, 26, 26, 25, 65, 64, 64, 64, 64, 64, 64, 63,
+ 63, 60, 60, 59, 59, 53, 53, 48, 48, 44, 44, 40, 40, 36, 36, 33, 33, 30,
+ 30, 27, 27, 26, 26, 25, 65, 64, 64, 63, 63, 63, 63, 63, 63, 61, 61, 59,
+ 59, 55, 55, 50, 50, 46, 46, 41, 41, 38, 38, 34, 34, 32, 32, 28, 28, 27,
+ 27, 26, 65, 64, 64, 63, 63, 63, 63, 63, 63, 61, 61, 59, 59, 55, 55, 50,
+ 50, 46, 46, 41, 41, 38, 38, 34, 34, 32, 32, 28, 28, 27, 27, 26, 65, 64,
+ 64, 63, 63, 61, 61, 60, 60, 58, 58, 56, 56, 53, 53, 49, 49, 45, 45, 41,
+ 41, 38, 38, 35, 35, 32, 32, 29, 29, 28, 28, 26, 65, 64, 64, 63, 63, 61,
+ 61, 60, 60, 58, 58, 56, 56, 53, 53, 49, 49, 45, 45, 41, 41, 38, 38, 35,
+ 35, 32, 32, 29, 29, 28, 28, 26, 64, 63, 63, 63, 63, 60, 60, 58, 58, 55,
+ 55, 53, 53, 51, 51, 48, 48, 45, 45, 41, 41, 38, 38, 35, 35, 33, 33, 29,
+ 29, 28, 28, 27, 64, 63, 63, 63, 63, 60, 60, 58, 58, 55, 55, 53, 53, 51,
+ 51, 48, 48, 45, 45, 41, 41, 38, 38, 35, 35, 33, 33, 29, 29, 28, 28, 27,
+ 60, 60, 60, 61, 61, 58, 58, 55, 55, 52, 52, 48, 48, 46, 46, 43, 43, 40,
+ 40, 38, 38, 35, 35, 33, 33, 30, 30, 28, 28, 27, 27, 26, 60, 60, 60, 61,
+ 61, 58, 58, 55, 55, 52, 52, 48, 48, 46, 46, 43, 43, 40, 40, 38, 38, 35,
+ 35, 33, 33, 30, 30, 28, 28, 27, 27, 26, 57, 59, 59, 59, 59, 56, 56, 53,
+ 53, 48, 48, 42, 42, 41, 41, 38, 38, 36, 36, 34, 34, 32, 32, 30, 30, 28,
+ 28, 26, 26, 25, 25, 24, 57, 59, 59, 59, 59, 56, 56, 53, 53, 48, 48, 42,
+ 42, 41, 41, 38, 38, 36, 36, 34, 34, 32, 32, 30, 30, 28, 28, 26, 26, 25,
+ 25, 24, 52, 53, 53, 55, 55, 53, 53, 51, 51, 46, 46, 41, 41, 38, 38, 35,
+ 35, 34, 34, 32, 32, 30, 30, 28, 28, 26, 26, 24, 24, 24, 24, 23, 52, 53,
+ 53, 55, 55, 53, 53, 51, 51, 46, 46, 41, 41, 38, 38, 35, 35, 34, 34, 32,
+ 32, 30, 30, 28, 28, 26, 26, 24, 24, 24, 24, 23, 47, 48, 48, 50, 50, 49,
+ 49, 48, 48, 43, 43, 38, 38, 35, 35, 32, 32, 31, 31, 29, 29, 27, 27, 26,
+ 26, 24, 24, 23, 23, 22, 22, 21, 47, 48, 48, 50, 50, 49, 49, 48, 48, 43,
+ 43, 38, 38, 35, 35, 32, 32, 31, 31, 29, 29, 27, 27, 26, 26, 24, 24, 23,
+ 23, 22, 22, 21, 42, 44, 44, 46, 46, 45, 45, 45, 45, 40, 40, 36, 36, 34,
+ 34, 31, 31, 29, 29, 27, 27, 25, 25, 24, 24, 23, 23, 21, 21, 21, 21, 20,
+ 42, 44, 44, 46, 46, 45, 45, 45, 45, 40, 40, 36, 36, 34, 34, 31, 31, 29,
+ 29, 27, 27, 25, 25, 24, 24, 23, 23, 21, 21, 21, 21, 20, 38, 40, 40, 41,
+ 41, 41, 41, 41, 41, 38, 38, 34, 34, 32, 32, 29, 29, 27, 27, 25, 25, 24,
+ 24, 22, 22, 21, 21, 20, 20, 19, 19, 19, 38, 40, 40, 41, 41, 41, 41, 41,
+ 41, 38, 38, 34, 34, 32, 32, 29, 29, 27, 27, 25, 25, 24, 24, 22, 22, 21,
+ 21, 20, 20, 19, 19, 19, 35, 36, 36, 38, 38, 38, 38, 38, 38, 35, 35, 32,
+ 32, 30, 30, 27, 27, 25, 25, 24, 24, 22, 22, 21, 21, 20, 20, 19, 19, 18,
+ 18, 18, 35, 36, 36, 38, 38, 38, 38, 38, 38, 35, 35, 32, 32, 30, 30, 27,
+ 27, 25, 25, 24, 24, 22, 22, 21, 21, 20, 20, 19, 19, 18, 18, 18, 31, 33,
+ 33, 34, 34, 35, 35, 35, 35, 33, 33, 30, 30, 28, 28, 26, 26, 24, 24, 22,
+ 22, 21, 21, 20, 20, 18, 18, 17, 17, 17, 17, 16, 31, 33, 33, 34, 34, 35,
+ 35, 35, 35, 33, 33, 30, 30, 28, 28, 26, 26, 24, 24, 22, 22, 21, 21, 20,
+ 20, 18, 18, 17, 17, 17, 17, 16, 29, 30, 30, 32, 32, 32, 32, 33, 33, 30,
+ 30, 28, 28, 26, 26, 24, 24, 23, 23, 21, 21, 20, 20, 18, 18, 17, 17, 16,
+ 16, 16, 16, 16, 29, 30, 30, 32, 32, 32, 32, 33, 33, 30, 30, 28, 28, 26,
+ 26, 24, 24, 23, 23, 21, 21, 20, 20, 18, 18, 17, 17, 16, 16, 16, 16, 16,
+ 26, 27, 27, 28, 28, 29, 29, 29, 29, 28, 28, 26, 26, 24, 24, 23, 23, 21,
+ 21, 20, 20, 19, 19, 17, 17, 16, 16, 15, 15, 15, 15, 14, 26, 27, 27, 28,
+ 28, 29, 29, 29, 29, 28, 28, 26, 26, 24, 24, 23, 23, 21, 21, 20, 20, 19,
+ 19, 17, 17, 16, 16, 15, 15, 15, 15, 14, 25, 26, 26, 27, 27, 28, 28, 28,
+ 28, 27, 27, 25, 25, 24, 24, 22, 22, 21, 21, 19, 19, 18, 18, 17, 17, 16,
+ 16, 15, 15, 15, 15, 14, 25, 26, 26, 27, 27, 28, 28, 28, 28, 27, 27, 25,
+ 25, 24, 24, 22, 22, 21, 21, 19, 19, 18, 18, 17, 17, 16, 16, 15, 15, 15,
+ 15, 14, 23, 25, 25, 26, 26, 26, 26, 27, 27, 26, 26, 24, 24, 23, 23, 21,
+ 21, 20, 20, 19, 19, 18, 18, 16, 16, 16, 16, 14, 14, 14, 14, 14,
+ /* Size 4x8 */
+ 64, 58, 40, 27, 63, 56, 41, 29, 60, 48, 38, 28, 55, 41, 32, 24, 46, 36,
+ 27, 21, 38, 32, 24, 19, 31, 28, 21, 16, 27, 25, 19, 15,
+ /* Size 8x4 */
+ 64, 63, 60, 55, 46, 38, 31, 27, 58, 56, 48, 41, 36, 32, 28, 25, 40, 41,
+ 38, 32, 27, 24, 21, 19, 27, 29, 28, 24, 21, 19, 16, 15,
+ /* Size 8x16 */
+ 64, 65, 64, 57, 47, 38, 31, 26, 65, 64, 63, 58, 48, 40, 33, 27, 65, 63,
+ 62, 59, 50, 41, 34, 28, 64, 63, 60, 56, 49, 41, 35, 29, 64, 62, 58, 53,
+ 48, 41, 35, 30, 60, 60, 55, 48, 43, 38, 33, 28, 57, 59, 53, 43, 38, 34,
+ 30, 26, 52, 55, 51, 41, 35, 32, 28, 24, 47, 50, 48, 38, 33, 29, 26, 23,
+ 43, 46, 44, 36, 31, 27, 24, 21, 38, 41, 41, 34, 29, 25, 22, 20, 35, 38,
+ 38, 32, 27, 24, 21, 19, 32, 34, 35, 30, 26, 22, 20, 17, 29, 31, 32, 28,
+ 24, 21, 18, 16, 26, 28, 29, 26, 23, 20, 17, 15, 25, 27, 28, 25, 22, 19,
+ 17, 15,
+ /* Size 16x8 */
+ 64, 65, 65, 64, 64, 60, 57, 52, 47, 43, 38, 35, 32, 29, 26, 25, 65, 64,
+ 63, 63, 62, 60, 59, 55, 50, 46, 41, 38, 34, 31, 28, 27, 64, 63, 62, 60,
+ 58, 55, 53, 51, 48, 44, 41, 38, 35, 32, 29, 28, 57, 58, 59, 56, 53, 48,
+ 43, 41, 38, 36, 34, 32, 30, 28, 26, 25, 47, 48, 50, 49, 48, 43, 38, 35,
+ 33, 31, 29, 27, 26, 24, 23, 22, 38, 40, 41, 41, 41, 38, 34, 32, 29, 27,
+ 25, 24, 22, 21, 20, 19, 31, 33, 34, 35, 35, 33, 30, 28, 26, 24, 22, 21,
+ 20, 18, 17, 17, 26, 27, 28, 29, 30, 28, 26, 24, 23, 21, 20, 19, 17, 16,
+ 15, 15,
+ /* Size 16x32 */
+ 64, 65, 65, 64, 64, 57, 57, 47, 47, 38, 38, 31, 31, 26, 26, 24, 65, 64,
+ 64, 63, 63, 58, 58, 48, 48, 40, 40, 33, 33, 27, 27, 25, 65, 64, 64, 63,
+ 63, 58, 58, 48, 48, 40, 40, 33, 33, 27, 27, 25, 65, 63, 63, 62, 62, 59,
+ 59, 50, 50, 41, 41, 34, 34, 28, 28, 26, 65, 63, 63, 62, 62, 59, 59, 50,
+ 50, 41, 41, 34, 34, 28, 28, 26, 64, 63, 63, 60, 60, 56, 56, 49, 49, 41,
+ 41, 35, 35, 29, 29, 27, 64, 63, 63, 60, 60, 56, 56, 49, 49, 41, 41, 35,
+ 35, 29, 29, 27, 64, 62, 62, 58, 58, 53, 53, 48, 48, 41, 41, 35, 35, 30,
+ 30, 27, 64, 62, 62, 58, 58, 53, 53, 48, 48, 41, 41, 35, 35, 30, 30, 27,
+ 60, 60, 60, 55, 55, 48, 48, 43, 43, 38, 38, 33, 33, 28, 28, 26, 60, 60,
+ 60, 55, 55, 48, 48, 43, 43, 38, 38, 33, 33, 28, 28, 26, 57, 59, 59, 53,
+ 53, 43, 43, 38, 38, 34, 34, 30, 30, 26, 26, 24, 57, 59, 59, 53, 53, 43,
+ 43, 38, 38, 34, 34, 30, 30, 26, 26, 24, 52, 55, 55, 51, 51, 41, 41, 35,
+ 35, 32, 32, 28, 28, 24, 24, 23, 52, 55, 55, 51, 51, 41, 41, 35, 35, 32,
+ 32, 28, 28, 24, 24, 23, 47, 50, 50, 48, 48, 38, 38, 33, 33, 29, 29, 26,
+ 26, 23, 23, 21, 47, 50, 50, 48, 48, 38, 38, 33, 33, 29, 29, 26, 26, 23,
+ 23, 21, 43, 46, 46, 44, 44, 36, 36, 31, 31, 27, 27, 24, 24, 21, 21, 20,
+ 43, 46, 46, 44, 44, 36, 36, 31, 31, 27, 27, 24, 24, 21, 21, 20, 38, 41,
+ 41, 41, 41, 34, 34, 29, 29, 25, 25, 22, 22, 20, 20, 19, 38, 41, 41, 41,
+ 41, 34, 34, 29, 29, 25, 25, 22, 22, 20, 20, 19, 35, 38, 38, 38, 38, 32,
+ 32, 27, 27, 24, 24, 21, 21, 19, 19, 18, 35, 38, 38, 38, 38, 32, 32, 27,
+ 27, 24, 24, 21, 21, 19, 19, 18, 32, 34, 34, 35, 35, 30, 30, 26, 26, 22,
+ 22, 20, 20, 17, 17, 16, 32, 34, 34, 35, 35, 30, 30, 26, 26, 22, 22, 20,
+ 20, 17, 17, 16, 29, 31, 31, 32, 32, 28, 28, 24, 24, 21, 21, 18, 18, 16,
+ 16, 16, 29, 31, 31, 32, 32, 28, 28, 24, 24, 21, 21, 18, 18, 16, 16, 16,
+ 26, 28, 28, 29, 29, 26, 26, 23, 23, 20, 20, 17, 17, 15, 15, 15, 26, 28,
+ 28, 29, 29, 26, 26, 23, 23, 20, 20, 17, 17, 15, 15, 15, 25, 27, 27, 28,
+ 28, 25, 25, 22, 22, 19, 19, 17, 17, 15, 15, 14, 25, 27, 27, 28, 28, 25,
+ 25, 22, 22, 19, 19, 17, 17, 15, 15, 14, 24, 26, 26, 27, 27, 24, 24, 21,
+ 21, 19, 19, 16, 16, 15, 15, 14,
+ /* Size 32x16 */
+ 64, 65, 65, 65, 65, 64, 64, 64, 64, 60, 60, 57, 57, 52, 52, 47, 47, 43,
+ 43, 38, 38, 35, 35, 32, 32, 29, 29, 26, 26, 25, 25, 24, 65, 64, 64, 63,
+ 63, 63, 63, 62, 62, 60, 60, 59, 59, 55, 55, 50, 50, 46, 46, 41, 41, 38,
+ 38, 34, 34, 31, 31, 28, 28, 27, 27, 26, 65, 64, 64, 63, 63, 63, 63, 62,
+ 62, 60, 60, 59, 59, 55, 55, 50, 50, 46, 46, 41, 41, 38, 38, 34, 34, 31,
+ 31, 28, 28, 27, 27, 26, 64, 63, 63, 62, 62, 60, 60, 58, 58, 55, 55, 53,
+ 53, 51, 51, 48, 48, 44, 44, 41, 41, 38, 38, 35, 35, 32, 32, 29, 29, 28,
+ 28, 27, 64, 63, 63, 62, 62, 60, 60, 58, 58, 55, 55, 53, 53, 51, 51, 48,
+ 48, 44, 44, 41, 41, 38, 38, 35, 35, 32, 32, 29, 29, 28, 28, 27, 57, 58,
+ 58, 59, 59, 56, 56, 53, 53, 48, 48, 43, 43, 41, 41, 38, 38, 36, 36, 34,
+ 34, 32, 32, 30, 30, 28, 28, 26, 26, 25, 25, 24, 57, 58, 58, 59, 59, 56,
+ 56, 53, 53, 48, 48, 43, 43, 41, 41, 38, 38, 36, 36, 34, 34, 32, 32, 30,
+ 30, 28, 28, 26, 26, 25, 25, 24, 47, 48, 48, 50, 50, 49, 49, 48, 48, 43,
+ 43, 38, 38, 35, 35, 33, 33, 31, 31, 29, 29, 27, 27, 26, 26, 24, 24, 23,
+ 23, 22, 22, 21, 47, 48, 48, 50, 50, 49, 49, 48, 48, 43, 43, 38, 38, 35,
+ 35, 33, 33, 31, 31, 29, 29, 27, 27, 26, 26, 24, 24, 23, 23, 22, 22, 21,
+ 38, 40, 40, 41, 41, 41, 41, 41, 41, 38, 38, 34, 34, 32, 32, 29, 29, 27,
+ 27, 25, 25, 24, 24, 22, 22, 21, 21, 20, 20, 19, 19, 19, 38, 40, 40, 41,
+ 41, 41, 41, 41, 41, 38, 38, 34, 34, 32, 32, 29, 29, 27, 27, 25, 25, 24,
+ 24, 22, 22, 21, 21, 20, 20, 19, 19, 19, 31, 33, 33, 34, 34, 35, 35, 35,
+ 35, 33, 33, 30, 30, 28, 28, 26, 26, 24, 24, 22, 22, 21, 21, 20, 20, 18,
+ 18, 17, 17, 17, 17, 16, 31, 33, 33, 34, 34, 35, 35, 35, 35, 33, 33, 30,
+ 30, 28, 28, 26, 26, 24, 24, 22, 22, 21, 21, 20, 20, 18, 18, 17, 17, 17,
+ 17, 16, 26, 27, 27, 28, 28, 29, 29, 30, 30, 28, 28, 26, 26, 24, 24, 23,
+ 23, 21, 21, 20, 20, 19, 19, 17, 17, 16, 16, 15, 15, 15, 15, 15, 26, 27,
+ 27, 28, 28, 29, 29, 30, 30, 28, 28, 26, 26, 24, 24, 23, 23, 21, 21, 20,
+ 20, 19, 19, 17, 17, 16, 16, 15, 15, 15, 15, 15, 24, 25, 25, 26, 26, 27,
+ 27, 27, 27, 26, 26, 24, 24, 23, 23, 21, 21, 20, 20, 19, 19, 18, 18, 16,
+ 16, 16, 16, 15, 15, 14, 14, 14,
+ /* Size 4x16 */
+ 65, 57, 38, 26, 64, 58, 40, 27, 63, 59, 41, 28, 63, 56, 41, 29, 62, 53,
+ 41, 30, 60, 48, 38, 28, 59, 43, 34, 26, 55, 41, 32, 24, 50, 38, 29, 23,
+ 46, 36, 27, 21, 41, 34, 25, 20, 38, 32, 24, 19, 34, 30, 22, 17, 31, 28,
+ 21, 16, 28, 26, 20, 15, 27, 25, 19, 15,
+ /* Size 16x4 */
+ 65, 64, 63, 63, 62, 60, 59, 55, 50, 46, 41, 38, 34, 31, 28, 27, 57, 58,
+ 59, 56, 53, 48, 43, 41, 38, 36, 34, 32, 30, 28, 26, 25, 38, 40, 41, 41,
+ 41, 38, 34, 32, 29, 27, 25, 24, 22, 21, 20, 19, 26, 27, 28, 29, 30, 28,
+ 26, 24, 23, 21, 20, 19, 17, 16, 15, 15,
+ /* Size 8x32 */
+ 64, 65, 64, 57, 47, 38, 31, 26, 65, 64, 63, 58, 48, 40, 33, 27, 65, 64,
+ 63, 58, 48, 40, 33, 27, 65, 63, 62, 59, 50, 41, 34, 28, 65, 63, 62, 59,
+ 50, 41, 34, 28, 64, 63, 60, 56, 49, 41, 35, 29, 64, 63, 60, 56, 49, 41,
+ 35, 29, 64, 62, 58, 53, 48, 41, 35, 30, 64, 62, 58, 53, 48, 41, 35, 30,
+ 60, 60, 55, 48, 43, 38, 33, 28, 60, 60, 55, 48, 43, 38, 33, 28, 57, 59,
+ 53, 43, 38, 34, 30, 26, 57, 59, 53, 43, 38, 34, 30, 26, 52, 55, 51, 41,
+ 35, 32, 28, 24, 52, 55, 51, 41, 35, 32, 28, 24, 47, 50, 48, 38, 33, 29,
+ 26, 23, 47, 50, 48, 38, 33, 29, 26, 23, 43, 46, 44, 36, 31, 27, 24, 21,
+ 43, 46, 44, 36, 31, 27, 24, 21, 38, 41, 41, 34, 29, 25, 22, 20, 38, 41,
+ 41, 34, 29, 25, 22, 20, 35, 38, 38, 32, 27, 24, 21, 19, 35, 38, 38, 32,
+ 27, 24, 21, 19, 32, 34, 35, 30, 26, 22, 20, 17, 32, 34, 35, 30, 26, 22,
+ 20, 17, 29, 31, 32, 28, 24, 21, 18, 16, 29, 31, 32, 28, 24, 21, 18, 16,
+ 26, 28, 29, 26, 23, 20, 17, 15, 26, 28, 29, 26, 23, 20, 17, 15, 25, 27,
+ 28, 25, 22, 19, 17, 15, 25, 27, 28, 25, 22, 19, 17, 15, 24, 26, 27, 24,
+ 21, 19, 16, 15,
+ /* Size 32x8 */
+ 64, 65, 65, 65, 65, 64, 64, 64, 64, 60, 60, 57, 57, 52, 52, 47, 47, 43,
+ 43, 38, 38, 35, 35, 32, 32, 29, 29, 26, 26, 25, 25, 24, 65, 64, 64, 63,
+ 63, 63, 63, 62, 62, 60, 60, 59, 59, 55, 55, 50, 50, 46, 46, 41, 41, 38,
+ 38, 34, 34, 31, 31, 28, 28, 27, 27, 26, 64, 63, 63, 62, 62, 60, 60, 58,
+ 58, 55, 55, 53, 53, 51, 51, 48, 48, 44, 44, 41, 41, 38, 38, 35, 35, 32,
+ 32, 29, 29, 28, 28, 27, 57, 58, 58, 59, 59, 56, 56, 53, 53, 48, 48, 43,
+ 43, 41, 41, 38, 38, 36, 36, 34, 34, 32, 32, 30, 30, 28, 28, 26, 26, 25,
+ 25, 24, 47, 48, 48, 50, 50, 49, 49, 48, 48, 43, 43, 38, 38, 35, 35, 33,
+ 33, 31, 31, 29, 29, 27, 27, 26, 26, 24, 24, 23, 23, 22, 22, 21, 38, 40,
+ 40, 41, 41, 41, 41, 41, 41, 38, 38, 34, 34, 32, 32, 29, 29, 27, 27, 25,
+ 25, 24, 24, 22, 22, 21, 21, 20, 20, 19, 19, 19, 31, 33, 33, 34, 34, 35,
+ 35, 35, 35, 33, 33, 30, 30, 28, 28, 26, 26, 24, 24, 22, 22, 21, 21, 20,
+ 20, 18, 18, 17, 17, 17, 17, 16, 26, 27, 27, 28, 28, 29, 29, 30, 30, 28,
+ 28, 26, 26, 24, 24, 23, 23, 21, 21, 20, 20, 19, 19, 17, 17, 16, 16, 15,
+ 15, 15, 15, 15 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 43, 41, 41, 27,
+#endif
+ /* Size 4x4 */
+ 64, 44, 43, 36, 44, 39, 38, 34, 43, 38, 31, 27, 36, 34, 27, 23,
+ /* Size 8x8 */
+ 65, 59, 48, 44, 42, 39, 36, 33, 59, 53, 46, 44, 44, 41, 38, 36, 48, 46,
+ 42, 41, 41, 39, 37, 35, 44, 44, 41, 38, 36, 35, 33, 32, 42, 44, 41, 36,
+ 33, 32, 30, 29, 39, 41, 39, 35, 32, 29, 27, 26, 36, 38, 37, 33, 30, 27,
+ 25, 24, 33, 36, 35, 32, 29, 26, 24, 22,
+ /* Size 16x16 */
+ 64, 66, 67, 61, 56, 49, 42, 42, 42, 41, 39, 38, 36, 34, 32, 32, 66, 65,
+ 66, 59, 53, 48, 43, 44, 44, 42, 41, 39, 38, 36, 34, 33, 67, 66, 64, 58,
+ 51, 48, 44, 45, 46, 44, 43, 41, 39, 38, 36, 35, 61, 59, 58, 53, 47, 46,
+ 43, 44, 45, 44, 43, 41, 40, 38, 36, 36, 56, 53, 51, 47, 43, 43, 43, 44,
+ 45, 45, 44, 42, 41, 39, 38, 37, 49, 48, 48, 46, 43, 42, 41, 41, 42, 41,
+ 41, 39, 38, 37, 36, 35, 42, 43, 44, 43, 43, 41, 39, 39, 38, 38, 38, 37,
+ 36, 35, 34, 33, 42, 44, 45, 44, 44, 41, 39, 38, 37, 36, 36, 35, 34, 33,
+ 32, 32, 42, 44, 46, 45, 45, 42, 38, 37, 35, 34, 33, 33, 32, 31, 30, 30,
+ 41, 42, 44, 44, 45, 41, 38, 36, 34, 33, 32, 32, 31, 30, 29, 29, 39, 41,
+ 43, 43, 44, 41, 38, 36, 33, 32, 31, 30, 29, 28, 27, 27, 38, 39, 41, 41,
+ 42, 39, 37, 35, 33, 32, 30, 29, 28, 27, 26, 26, 36, 38, 39, 40, 41, 38,
+ 36, 34, 32, 31, 29, 28, 27, 26, 25, 25, 34, 36, 38, 38, 39, 37, 35, 33,
+ 31, 30, 28, 27, 26, 25, 24, 24, 32, 34, 36, 36, 38, 36, 34, 32, 30, 29,
+ 27, 26, 25, 24, 23, 23, 32, 33, 35, 36, 37, 35, 33, 32, 30, 29, 27, 26,
+ 25, 24, 23, 22,
+ /* Size 32x32 */
+ 64, 66, 66, 67, 67, 61, 61, 56, 56, 49, 49, 42, 42, 42, 42, 42, 42, 41,
+ 41, 39, 39, 38, 38, 36, 36, 34, 34, 32, 32, 32, 32, 31, 66, 65, 65, 66,
+ 66, 59, 59, 53, 53, 48, 48, 43, 43, 44, 44, 44, 44, 42, 42, 41, 41, 39,
+ 39, 38, 38, 36, 36, 34, 34, 33, 33, 32, 66, 65, 65, 66, 66, 59, 59, 53,
+ 53, 48, 48, 43, 43, 44, 44, 44, 44, 42, 42, 41, 41, 39, 39, 38, 38, 36,
+ 36, 34, 34, 33, 33, 32, 67, 66, 66, 64, 64, 58, 58, 51, 51, 48, 48, 44,
+ 44, 45, 45, 46, 46, 44, 44, 43, 43, 41, 41, 39, 39, 38, 38, 36, 36, 35,
+ 35, 34, 67, 66, 66, 64, 64, 58, 58, 51, 51, 48, 48, 44, 44, 45, 45, 46,
+ 46, 44, 44, 43, 43, 41, 41, 39, 39, 38, 38, 36, 36, 35, 35, 34, 61, 59,
+ 59, 58, 58, 53, 53, 47, 47, 46, 46, 43, 43, 44, 44, 45, 45, 44, 44, 43,
+ 43, 41, 41, 40, 40, 38, 38, 36, 36, 36, 36, 35, 61, 59, 59, 58, 58, 53,
+ 53, 47, 47, 46, 46, 43, 43, 44, 44, 45, 45, 44, 44, 43, 43, 41, 41, 40,
+ 40, 38, 38, 36, 36, 36, 36, 35, 56, 53, 53, 51, 51, 47, 47, 43, 43, 43,
+ 43, 43, 43, 44, 44, 45, 45, 45, 45, 44, 44, 42, 42, 41, 41, 39, 39, 38,
+ 38, 37, 37, 36, 56, 53, 53, 51, 51, 47, 47, 43, 43, 43, 43, 43, 43, 44,
+ 44, 45, 45, 45, 45, 44, 44, 42, 42, 41, 41, 39, 39, 38, 38, 37, 37, 36,
+ 49, 48, 48, 48, 48, 46, 46, 43, 43, 42, 42, 41, 41, 41, 41, 42, 42, 41,
+ 41, 41, 41, 39, 39, 38, 38, 37, 37, 36, 36, 35, 35, 34, 49, 48, 48, 48,
+ 48, 46, 46, 43, 43, 42, 42, 41, 41, 41, 41, 42, 42, 41, 41, 41, 41, 39,
+ 39, 38, 38, 37, 37, 36, 36, 35, 35, 34, 42, 43, 43, 44, 44, 43, 43, 43,
+ 43, 41, 41, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 37, 37, 36, 36, 35,
+ 35, 34, 34, 33, 33, 33, 42, 43, 43, 44, 44, 43, 43, 43, 43, 41, 41, 39,
+ 39, 39, 39, 38, 38, 38, 38, 38, 38, 37, 37, 36, 36, 35, 35, 34, 34, 33,
+ 33, 33, 42, 44, 44, 45, 45, 44, 44, 44, 44, 41, 41, 39, 39, 38, 38, 37,
+ 37, 36, 36, 36, 36, 35, 35, 34, 34, 33, 33, 32, 32, 32, 32, 31, 42, 44,
+ 44, 45, 45, 44, 44, 44, 44, 41, 41, 39, 39, 38, 38, 37, 37, 36, 36, 36,
+ 36, 35, 35, 34, 34, 33, 33, 32, 32, 32, 32, 31, 42, 44, 44, 46, 46, 45,
+ 45, 45, 45, 42, 42, 38, 38, 37, 37, 35, 35, 34, 34, 33, 33, 33, 33, 32,
+ 32, 31, 31, 30, 30, 30, 30, 30, 42, 44, 44, 46, 46, 45, 45, 45, 45, 42,
+ 42, 38, 38, 37, 37, 35, 35, 34, 34, 33, 33, 33, 33, 32, 32, 31, 31, 30,
+ 30, 30, 30, 30, 41, 42, 42, 44, 44, 44, 44, 45, 45, 41, 41, 38, 38, 36,
+ 36, 34, 34, 33, 33, 32, 32, 32, 32, 31, 31, 30, 30, 29, 29, 29, 29, 28,
+ 41, 42, 42, 44, 44, 44, 44, 45, 45, 41, 41, 38, 38, 36, 36, 34, 34, 33,
+ 33, 32, 32, 32, 32, 31, 31, 30, 30, 29, 29, 29, 29, 28, 39, 41, 41, 43,
+ 43, 43, 43, 44, 44, 41, 41, 38, 38, 36, 36, 33, 33, 32, 32, 31, 31, 30,
+ 30, 29, 29, 28, 28, 27, 27, 27, 27, 27, 39, 41, 41, 43, 43, 43, 43, 44,
+ 44, 41, 41, 38, 38, 36, 36, 33, 33, 32, 32, 31, 31, 30, 30, 29, 29, 28,
+ 28, 27, 27, 27, 27, 27, 38, 39, 39, 41, 41, 41, 41, 42, 42, 39, 39, 37,
+ 37, 35, 35, 33, 33, 32, 32, 30, 30, 29, 29, 28, 28, 27, 27, 26, 26, 26,
+ 26, 25, 38, 39, 39, 41, 41, 41, 41, 42, 42, 39, 39, 37, 37, 35, 35, 33,
+ 33, 32, 32, 30, 30, 29, 29, 28, 28, 27, 27, 26, 26, 26, 26, 25, 36, 38,
+ 38, 39, 39, 40, 40, 41, 41, 38, 38, 36, 36, 34, 34, 32, 32, 31, 31, 29,
+ 29, 28, 28, 27, 27, 26, 26, 25, 25, 25, 25, 24, 36, 38, 38, 39, 39, 40,
+ 40, 41, 41, 38, 38, 36, 36, 34, 34, 32, 32, 31, 31, 29, 29, 28, 28, 27,
+ 27, 26, 26, 25, 25, 25, 25, 24, 34, 36, 36, 38, 38, 38, 38, 39, 39, 37,
+ 37, 35, 35, 33, 33, 31, 31, 30, 30, 28, 28, 27, 27, 26, 26, 25, 25, 24,
+ 24, 24, 24, 23, 34, 36, 36, 38, 38, 38, 38, 39, 39, 37, 37, 35, 35, 33,
+ 33, 31, 31, 30, 30, 28, 28, 27, 27, 26, 26, 25, 25, 24, 24, 24, 24, 23,
+ 32, 34, 34, 36, 36, 36, 36, 38, 38, 36, 36, 34, 34, 32, 32, 30, 30, 29,
+ 29, 27, 27, 26, 26, 25, 25, 24, 24, 23, 23, 23, 23, 22, 32, 34, 34, 36,
+ 36, 36, 36, 38, 38, 36, 36, 34, 34, 32, 32, 30, 30, 29, 29, 27, 27, 26,
+ 26, 25, 25, 24, 24, 23, 23, 23, 23, 22, 32, 33, 33, 35, 35, 36, 36, 37,
+ 37, 35, 35, 33, 33, 32, 32, 30, 30, 29, 29, 27, 27, 26, 26, 25, 25, 24,
+ 24, 23, 23, 22, 22, 22, 32, 33, 33, 35, 35, 36, 36, 37, 37, 35, 35, 33,
+ 33, 32, 32, 30, 30, 29, 29, 27, 27, 26, 26, 25, 25, 24, 24, 23, 23, 22,
+ 22, 22, 31, 32, 32, 34, 34, 35, 35, 36, 36, 34, 34, 33, 33, 31, 31, 30,
+ 30, 28, 28, 27, 27, 25, 25, 24, 24, 23, 23, 22, 22, 22, 22, 21,
+ /* Size 4x8 */
+ 65, 44, 41, 34, 57, 44, 43, 37, 48, 41, 41, 36, 45, 39, 36, 32, 44, 38,
+ 32, 29, 41, 37, 30, 26, 38, 35, 28, 24, 35, 33, 27, 23,
+ /* Size 8x4 */
+ 65, 57, 48, 45, 44, 41, 38, 35, 44, 44, 41, 39, 38, 37, 35, 33, 41, 43,
+ 41, 36, 32, 30, 28, 27, 34, 37, 36, 32, 29, 26, 24, 23,
+ /* Size 8x16 */
+ 64, 66, 55, 43, 42, 39, 36, 32, 65, 65, 53, 44, 44, 41, 38, 34, 67, 64,
+ 51, 45, 45, 43, 39, 36, 61, 57, 48, 44, 45, 43, 40, 37, 55, 51, 44, 43,
+ 45, 44, 41, 38, 49, 48, 43, 41, 41, 41, 38, 36, 42, 44, 43, 39, 38, 38,
+ 36, 34, 42, 45, 44, 39, 37, 36, 34, 32, 42, 45, 45, 38, 35, 33, 32, 30,
+ 41, 44, 44, 38, 34, 32, 31, 29, 39, 43, 43, 38, 34, 31, 29, 27, 38, 41,
+ 42, 37, 33, 30, 28, 26, 36, 39, 41, 36, 32, 29, 27, 25, 34, 38, 39, 35,
+ 31, 28, 26, 24, 32, 36, 37, 34, 30, 27, 25, 23, 32, 35, 37, 33, 30, 27,
+ 25, 23,
+ /* Size 16x8 */
+ 64, 65, 67, 61, 55, 49, 42, 42, 42, 41, 39, 38, 36, 34, 32, 32, 66, 65,
+ 64, 57, 51, 48, 44, 45, 45, 44, 43, 41, 39, 38, 36, 35, 55, 53, 51, 48,
+ 44, 43, 43, 44, 45, 44, 43, 42, 41, 39, 37, 37, 43, 44, 45, 44, 43, 41,
+ 39, 39, 38, 38, 38, 37, 36, 35, 34, 33, 42, 44, 45, 45, 45, 41, 38, 37,
+ 35, 34, 34, 33, 32, 31, 30, 30, 39, 41, 43, 43, 44, 41, 38, 36, 33, 32,
+ 31, 30, 29, 28, 27, 27, 36, 38, 39, 40, 41, 38, 36, 34, 32, 31, 29, 28,
+ 27, 26, 25, 25, 32, 34, 36, 37, 38, 36, 34, 32, 30, 29, 27, 26, 25, 24,
+ 23, 23,
+ /* Size 16x32 */
+ 64, 66, 66, 55, 55, 43, 43, 42, 42, 39, 39, 36, 36, 32, 32, 31, 65, 65,
+ 65, 53, 53, 44, 44, 44, 44, 41, 41, 38, 38, 34, 34, 33, 65, 65, 65, 53,
+ 53, 44, 44, 44, 44, 41, 41, 38, 38, 34, 34, 33, 67, 64, 64, 51, 51, 45,
+ 45, 45, 45, 43, 43, 39, 39, 36, 36, 34, 67, 64, 64, 51, 51, 45, 45, 45,
+ 45, 43, 43, 39, 39, 36, 36, 34, 61, 57, 57, 48, 48, 44, 44, 45, 45, 43,
+ 43, 40, 40, 37, 37, 35, 61, 57, 57, 48, 48, 44, 44, 45, 45, 43, 43, 40,
+ 40, 37, 37, 35, 55, 51, 51, 44, 44, 43, 43, 45, 45, 44, 44, 41, 41, 38,
+ 38, 36, 55, 51, 51, 44, 44, 43, 43, 45, 45, 44, 44, 41, 41, 38, 38, 36,
+ 49, 48, 48, 43, 43, 41, 41, 41, 41, 41, 41, 38, 38, 36, 36, 34, 49, 48,
+ 48, 43, 43, 41, 41, 41, 41, 41, 41, 38, 38, 36, 36, 34, 42, 44, 44, 43,
+ 43, 39, 39, 38, 38, 38, 38, 36, 36, 34, 34, 33, 42, 44, 44, 43, 43, 39,
+ 39, 38, 38, 38, 38, 36, 36, 34, 34, 33, 42, 45, 45, 44, 44, 39, 39, 37,
+ 37, 36, 36, 34, 34, 32, 32, 31, 42, 45, 45, 44, 44, 39, 39, 37, 37, 36,
+ 36, 34, 34, 32, 32, 31, 42, 45, 45, 45, 45, 38, 38, 35, 35, 33, 33, 32,
+ 32, 30, 30, 29, 42, 45, 45, 45, 45, 38, 38, 35, 35, 33, 33, 32, 32, 30,
+ 30, 29, 41, 44, 44, 44, 44, 38, 38, 34, 34, 32, 32, 31, 31, 29, 29, 28,
+ 41, 44, 44, 44, 44, 38, 38, 34, 34, 32, 32, 31, 31, 29, 29, 28, 39, 43,
+ 43, 43, 43, 38, 38, 34, 34, 31, 31, 29, 29, 27, 27, 27, 39, 43, 43, 43,
+ 43, 38, 38, 34, 34, 31, 31, 29, 29, 27, 27, 27, 38, 41, 41, 42, 42, 37,
+ 37, 33, 33, 30, 30, 28, 28, 26, 26, 25, 38, 41, 41, 42, 42, 37, 37, 33,
+ 33, 30, 30, 28, 28, 26, 26, 25, 36, 39, 39, 41, 41, 36, 36, 32, 32, 29,
+ 29, 27, 27, 25, 25, 24, 36, 39, 39, 41, 41, 36, 36, 32, 32, 29, 29, 27,
+ 27, 25, 25, 24, 34, 38, 38, 39, 39, 35, 35, 31, 31, 28, 28, 26, 26, 24,
+ 24, 23, 34, 38, 38, 39, 39, 35, 35, 31, 31, 28, 28, 26, 26, 24, 24, 23,
+ 32, 36, 36, 37, 37, 34, 34, 30, 30, 27, 27, 25, 25, 23, 23, 22, 32, 36,
+ 36, 37, 37, 34, 34, 30, 30, 27, 27, 25, 25, 23, 23, 22, 32, 35, 35, 37,
+ 37, 33, 33, 30, 30, 27, 27, 25, 25, 23, 23, 22, 32, 35, 35, 37, 37, 33,
+ 33, 30, 30, 27, 27, 25, 25, 23, 23, 22, 31, 34, 34, 36, 36, 33, 33, 29,
+ 29, 27, 27, 24, 24, 22, 22, 21,
+ /* Size 32x16 */
+ 64, 65, 65, 67, 67, 61, 61, 55, 55, 49, 49, 42, 42, 42, 42, 42, 42, 41,
+ 41, 39, 39, 38, 38, 36, 36, 34, 34, 32, 32, 32, 32, 31, 66, 65, 65, 64,
+ 64, 57, 57, 51, 51, 48, 48, 44, 44, 45, 45, 45, 45, 44, 44, 43, 43, 41,
+ 41, 39, 39, 38, 38, 36, 36, 35, 35, 34, 66, 65, 65, 64, 64, 57, 57, 51,
+ 51, 48, 48, 44, 44, 45, 45, 45, 45, 44, 44, 43, 43, 41, 41, 39, 39, 38,
+ 38, 36, 36, 35, 35, 34, 55, 53, 53, 51, 51, 48, 48, 44, 44, 43, 43, 43,
+ 43, 44, 44, 45, 45, 44, 44, 43, 43, 42, 42, 41, 41, 39, 39, 37, 37, 37,
+ 37, 36, 55, 53, 53, 51, 51, 48, 48, 44, 44, 43, 43, 43, 43, 44, 44, 45,
+ 45, 44, 44, 43, 43, 42, 42, 41, 41, 39, 39, 37, 37, 37, 37, 36, 43, 44,
+ 44, 45, 45, 44, 44, 43, 43, 41, 41, 39, 39, 39, 39, 38, 38, 38, 38, 38,
+ 38, 37, 37, 36, 36, 35, 35, 34, 34, 33, 33, 33, 43, 44, 44, 45, 45, 44,
+ 44, 43, 43, 41, 41, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 37, 37, 36,
+ 36, 35, 35, 34, 34, 33, 33, 33, 42, 44, 44, 45, 45, 45, 45, 45, 45, 41,
+ 41, 38, 38, 37, 37, 35, 35, 34, 34, 34, 34, 33, 33, 32, 32, 31, 31, 30,
+ 30, 30, 30, 29, 42, 44, 44, 45, 45, 45, 45, 45, 45, 41, 41, 38, 38, 37,
+ 37, 35, 35, 34, 34, 34, 34, 33, 33, 32, 32, 31, 31, 30, 30, 30, 30, 29,
+ 39, 41, 41, 43, 43, 43, 43, 44, 44, 41, 41, 38, 38, 36, 36, 33, 33, 32,
+ 32, 31, 31, 30, 30, 29, 29, 28, 28, 27, 27, 27, 27, 27, 39, 41, 41, 43,
+ 43, 43, 43, 44, 44, 41, 41, 38, 38, 36, 36, 33, 33, 32, 32, 31, 31, 30,
+ 30, 29, 29, 28, 28, 27, 27, 27, 27, 27, 36, 38, 38, 39, 39, 40, 40, 41,
+ 41, 38, 38, 36, 36, 34, 34, 32, 32, 31, 31, 29, 29, 28, 28, 27, 27, 26,
+ 26, 25, 25, 25, 25, 24, 36, 38, 38, 39, 39, 40, 40, 41, 41, 38, 38, 36,
+ 36, 34, 34, 32, 32, 31, 31, 29, 29, 28, 28, 27, 27, 26, 26, 25, 25, 25,
+ 25, 24, 32, 34, 34, 36, 36, 37, 37, 38, 38, 36, 36, 34, 34, 32, 32, 30,
+ 30, 29, 29, 27, 27, 26, 26, 25, 25, 24, 24, 23, 23, 23, 23, 22, 32, 34,
+ 34, 36, 36, 37, 37, 38, 38, 36, 36, 34, 34, 32, 32, 30, 30, 29, 29, 27,
+ 27, 26, 26, 25, 25, 24, 24, 23, 23, 23, 23, 22, 31, 33, 33, 34, 34, 35,
+ 35, 36, 36, 34, 34, 33, 33, 31, 31, 29, 29, 28, 28, 27, 27, 25, 25, 24,
+ 24, 23, 23, 22, 22, 22, 22, 21,
+ /* Size 4x16 */
+ 66, 43, 39, 32, 65, 44, 41, 34, 64, 45, 43, 36, 57, 44, 43, 37, 51, 43,
+ 44, 38, 48, 41, 41, 36, 44, 39, 38, 34, 45, 39, 36, 32, 45, 38, 33, 30,
+ 44, 38, 32, 29, 43, 38, 31, 27, 41, 37, 30, 26, 39, 36, 29, 25, 38, 35,
+ 28, 24, 36, 34, 27, 23, 35, 33, 27, 23,
+ /* Size 16x4 */
+ 66, 65, 64, 57, 51, 48, 44, 45, 45, 44, 43, 41, 39, 38, 36, 35, 43, 44,
+ 45, 44, 43, 41, 39, 39, 38, 38, 38, 37, 36, 35, 34, 33, 39, 41, 43, 43,
+ 44, 41, 38, 36, 33, 32, 31, 30, 29, 28, 27, 27, 32, 34, 36, 37, 38, 36,
+ 34, 32, 30, 29, 27, 26, 25, 24, 23, 23,
+ /* Size 8x32 */
+ 64, 66, 55, 43, 42, 39, 36, 32, 65, 65, 53, 44, 44, 41, 38, 34, 65, 65,
+ 53, 44, 44, 41, 38, 34, 67, 64, 51, 45, 45, 43, 39, 36, 67, 64, 51, 45,
+ 45, 43, 39, 36, 61, 57, 48, 44, 45, 43, 40, 37, 61, 57, 48, 44, 45, 43,
+ 40, 37, 55, 51, 44, 43, 45, 44, 41, 38, 55, 51, 44, 43, 45, 44, 41, 38,
+ 49, 48, 43, 41, 41, 41, 38, 36, 49, 48, 43, 41, 41, 41, 38, 36, 42, 44,
+ 43, 39, 38, 38, 36, 34, 42, 44, 43, 39, 38, 38, 36, 34, 42, 45, 44, 39,
+ 37, 36, 34, 32, 42, 45, 44, 39, 37, 36, 34, 32, 42, 45, 45, 38, 35, 33,
+ 32, 30, 42, 45, 45, 38, 35, 33, 32, 30, 41, 44, 44, 38, 34, 32, 31, 29,
+ 41, 44, 44, 38, 34, 32, 31, 29, 39, 43, 43, 38, 34, 31, 29, 27, 39, 43,
+ 43, 38, 34, 31, 29, 27, 38, 41, 42, 37, 33, 30, 28, 26, 38, 41, 42, 37,
+ 33, 30, 28, 26, 36, 39, 41, 36, 32, 29, 27, 25, 36, 39, 41, 36, 32, 29,
+ 27, 25, 34, 38, 39, 35, 31, 28, 26, 24, 34, 38, 39, 35, 31, 28, 26, 24,
+ 32, 36, 37, 34, 30, 27, 25, 23, 32, 36, 37, 34, 30, 27, 25, 23, 32, 35,
+ 37, 33, 30, 27, 25, 23, 32, 35, 37, 33, 30, 27, 25, 23, 31, 34, 36, 33,
+ 29, 27, 24, 22,
+ /* Size 32x8 */
+ 64, 65, 65, 67, 67, 61, 61, 55, 55, 49, 49, 42, 42, 42, 42, 42, 42, 41,
+ 41, 39, 39, 38, 38, 36, 36, 34, 34, 32, 32, 32, 32, 31, 66, 65, 65, 64,
+ 64, 57, 57, 51, 51, 48, 48, 44, 44, 45, 45, 45, 45, 44, 44, 43, 43, 41,
+ 41, 39, 39, 38, 38, 36, 36, 35, 35, 34, 55, 53, 53, 51, 51, 48, 48, 44,
+ 44, 43, 43, 43, 43, 44, 44, 45, 45, 44, 44, 43, 43, 42, 42, 41, 41, 39,
+ 39, 37, 37, 37, 37, 36, 43, 44, 44, 45, 45, 44, 44, 43, 43, 41, 41, 39,
+ 39, 39, 39, 38, 38, 38, 38, 38, 38, 37, 37, 36, 36, 35, 35, 34, 34, 33,
+ 33, 33, 42, 44, 44, 45, 45, 45, 45, 45, 45, 41, 41, 38, 38, 37, 37, 35,
+ 35, 34, 34, 34, 34, 33, 33, 32, 32, 31, 31, 30, 30, 30, 30, 29, 39, 41,
+ 41, 43, 43, 43, 43, 44, 44, 41, 41, 38, 38, 36, 36, 33, 33, 32, 32, 31,
+ 31, 30, 30, 29, 29, 28, 28, 27, 27, 27, 27, 27, 36, 38, 38, 39, 39, 40,
+ 40, 41, 41, 38, 38, 36, 36, 34, 34, 32, 32, 31, 31, 29, 29, 28, 28, 27,
+ 27, 26, 26, 25, 25, 25, 25, 24, 32, 34, 34, 36, 36, 37, 37, 38, 38, 36,
+ 36, 34, 34, 32, 32, 30, 30, 29, 29, 27, 27, 26, 26, 25, 25, 24, 24, 23,
+ 23, 23, 23, 22 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 60, 39, 39, 23,
+#endif
+ /* Size 4x4 */
+ 64, 61, 46, 33, 61, 52, 40, 32, 46, 40, 29, 24, 33, 32, 24, 19,
+ /* Size 8x8 */
+ 65, 64, 63, 58, 48, 40, 34, 30, 64, 63, 61, 58, 49, 42, 36, 31, 63, 61,
+ 58, 53, 48, 41, 37, 32, 58, 58, 53, 42, 38, 34, 31, 28, 48, 49, 48, 38,
+ 32, 29, 26, 24, 40, 42, 41, 34, 29, 25, 23, 21, 34, 36, 37, 31, 26, 23,
+ 21, 19, 30, 31, 32, 28, 24, 21, 19, 17,
+ /* Size 16x16 */
+ 64, 65, 65, 65, 64, 60, 58, 54, 50, 46, 42, 38, 35, 31, 29, 26, 65, 64,
+ 64, 64, 63, 60, 59, 55, 51, 48, 44, 40, 36, 33, 30, 27, 65, 64, 63, 63,
+ 63, 61, 60, 57, 53, 49, 46, 41, 38, 34, 32, 28, 65, 64, 63, 61, 60, 58,
+ 57, 54, 51, 48, 45, 41, 38, 35, 32, 29, 64, 63, 63, 60, 58, 55, 54, 52,
+ 49, 47, 45, 41, 38, 35, 33, 29, 60, 60, 61, 58, 55, 52, 49, 47, 45, 42,
+ 40, 38, 35, 33, 30, 28, 58, 59, 60, 57, 54, 49, 45, 42, 41, 39, 37, 35,
+ 33, 31, 28, 26, 54, 55, 57, 54, 52, 47, 42, 40, 38, 36, 34, 33, 31, 29,
+ 27, 25, 50, 51, 53, 51, 49, 45, 41, 38, 36, 34, 32, 30, 29, 27, 25, 24,
+ 46, 48, 49, 48, 47, 42, 39, 36, 34, 32, 30, 28, 27, 25, 24, 22, 42, 44,
+ 46, 45, 45, 40, 37, 34, 32, 30, 29, 27, 25, 24, 23, 21, 38, 40, 41, 41,
+ 41, 38, 35, 33, 30, 28, 27, 25, 24, 22, 21, 20, 35, 36, 38, 38, 38, 35,
+ 33, 31, 29, 27, 25, 24, 22, 21, 20, 19, 31, 33, 34, 35, 35, 33, 31, 29,
+ 27, 25, 24, 22, 21, 20, 18, 17, 29, 30, 32, 32, 33, 30, 28, 27, 25, 24,
+ 23, 21, 20, 18, 17, 16, 26, 27, 28, 29, 29, 28, 26, 25, 24, 22, 21, 20,
+ 19, 17, 16, 15,
+ /* Size 32x32 */
+ 64, 65, 65, 65, 65, 65, 65, 64, 64, 64, 60, 60, 58, 57, 54, 52, 50, 47,
+ 46, 42, 42, 38, 38, 36, 35, 33, 31, 31, 29, 28, 26, 26, 65, 65, 64, 64,
+ 64, 64, 64, 64, 63, 63, 60, 60, 59, 58, 55, 53, 51, 48, 47, 44, 44, 40,
+ 39, 37, 36, 34, 33, 32, 30, 30, 27, 27, 65, 64, 64, 64, 64, 64, 64, 64,
+ 63, 63, 60, 60, 59, 59, 55, 53, 51, 48, 48, 44, 44, 40, 40, 37, 36, 35,
+ 33, 32, 30, 30, 27, 27, 65, 64, 64, 64, 64, 63, 63, 63, 63, 63, 61, 61,
+ 59, 59, 56, 54, 53, 49, 49, 46, 46, 41, 41, 39, 38, 36, 34, 33, 31, 31,
+ 28, 28, 65, 64, 64, 64, 63, 63, 63, 63, 63, 62, 61, 61, 60, 59, 57, 55,
+ 53, 50, 49, 46, 46, 42, 41, 39, 38, 36, 34, 34, 32, 31, 28, 28, 65, 64,
+ 64, 63, 63, 63, 62, 62, 61, 61, 59, 59, 59, 58, 55, 53, 52, 49, 49, 46,
+ 46, 42, 41, 39, 38, 36, 34, 34, 32, 31, 28, 28, 65, 64, 64, 63, 63, 62,
+ 61, 61, 60, 60, 58, 58, 57, 56, 54, 53, 51, 49, 48, 45, 45, 41, 41, 39,
+ 38, 36, 35, 34, 32, 32, 29, 29, 64, 64, 64, 63, 63, 62, 61, 60, 59, 59,
+ 58, 58, 56, 55, 53, 52, 51, 49, 48, 45, 45, 41, 41, 39, 38, 36, 35, 34,
+ 32, 32, 29, 29, 64, 63, 63, 63, 63, 61, 60, 59, 58, 58, 55, 55, 54, 53,
+ 52, 51, 49, 48, 47, 45, 45, 42, 41, 39, 38, 37, 35, 34, 33, 32, 29, 29,
+ 64, 63, 63, 63, 62, 61, 60, 59, 58, 58, 55, 55, 53, 53, 51, 50, 49, 48,
+ 47, 44, 44, 41, 41, 39, 38, 37, 35, 34, 32, 32, 29, 29, 60, 60, 60, 61,
+ 61, 59, 58, 58, 55, 55, 52, 52, 49, 48, 47, 46, 45, 43, 42, 40, 40, 38,
+ 38, 36, 35, 34, 33, 32, 30, 30, 28, 28, 60, 60, 60, 61, 61, 59, 58, 58,
+ 55, 55, 52, 52, 49, 48, 47, 46, 45, 43, 42, 40, 40, 38, 38, 36, 35, 34,
+ 33, 32, 30, 30, 28, 28, 58, 59, 59, 59, 60, 59, 57, 56, 54, 53, 49, 49,
+ 45, 44, 42, 41, 41, 39, 39, 37, 37, 35, 35, 33, 33, 32, 31, 30, 28, 28,
+ 26, 26, 57, 58, 59, 59, 59, 58, 56, 55, 53, 53, 48, 48, 44, 42, 41, 41,
+ 39, 38, 38, 36, 36, 34, 34, 33, 32, 31, 30, 29, 28, 28, 26, 26, 54, 55,
+ 55, 56, 57, 55, 54, 53, 52, 51, 47, 47, 42, 41, 40, 39, 38, 37, 36, 34,
+ 34, 33, 33, 31, 31, 30, 29, 28, 27, 27, 25, 25, 52, 53, 53, 54, 55, 53,
+ 53, 52, 51, 50, 46, 46, 41, 41, 39, 38, 37, 35, 35, 34, 34, 32, 32, 30,
+ 30, 29, 28, 27, 26, 26, 24, 24, 50, 51, 51, 53, 53, 52, 51, 51, 49, 49,
+ 45, 45, 41, 39, 38, 37, 36, 34, 34, 32, 32, 31, 30, 29, 29, 28, 27, 27,
+ 25, 25, 24, 24, 47, 48, 48, 49, 50, 49, 49, 49, 48, 48, 43, 43, 39, 38,
+ 37, 35, 34, 32, 32, 31, 31, 29, 29, 28, 27, 26, 26, 25, 24, 24, 23, 23,
+ 46, 47, 48, 49, 49, 49, 48, 48, 47, 47, 42, 42, 39, 38, 36, 35, 34, 32,
+ 32, 30, 30, 28, 28, 27, 27, 26, 25, 25, 24, 24, 22, 22, 42, 44, 44, 46,
+ 46, 46, 45, 45, 45, 44, 40, 40, 37, 36, 34, 34, 32, 31, 30, 29, 29, 27,
+ 27, 26, 25, 25, 24, 24, 23, 23, 21, 21, 42, 44, 44, 46, 46, 46, 45, 45,
+ 45, 44, 40, 40, 37, 36, 34, 34, 32, 31, 30, 29, 29, 27, 27, 26, 25, 25,
+ 24, 24, 23, 23, 21, 21, 38, 40, 40, 41, 42, 42, 41, 41, 42, 41, 38, 38,
+ 35, 34, 33, 32, 31, 29, 28, 27, 27, 25, 25, 24, 24, 23, 22, 22, 21, 21,
+ 20, 20, 38, 39, 40, 41, 41, 41, 41, 41, 41, 41, 38, 38, 35, 34, 33, 32,
+ 30, 29, 28, 27, 27, 25, 25, 24, 24, 23, 22, 22, 21, 21, 20, 20, 36, 37,
+ 37, 39, 39, 39, 39, 39, 39, 39, 36, 36, 33, 33, 31, 30, 29, 28, 27, 26,
+ 26, 24, 24, 23, 23, 22, 21, 21, 20, 20, 19, 19, 35, 36, 36, 38, 38, 38,
+ 38, 38, 38, 38, 35, 35, 33, 32, 31, 30, 29, 27, 27, 25, 25, 24, 24, 23,
+ 22, 22, 21, 21, 20, 20, 19, 19, 33, 34, 35, 36, 36, 36, 36, 36, 37, 37,
+ 34, 34, 32, 31, 30, 29, 28, 26, 26, 25, 25, 23, 23, 22, 22, 21, 20, 20,
+ 19, 19, 18, 18, 31, 33, 33, 34, 34, 34, 35, 35, 35, 35, 33, 33, 31, 30,
+ 29, 28, 27, 26, 25, 24, 24, 22, 22, 21, 21, 20, 20, 19, 18, 18, 17, 17,
+ 31, 32, 32, 33, 34, 34, 34, 34, 34, 34, 32, 32, 30, 29, 28, 27, 27, 25,
+ 25, 24, 24, 22, 22, 21, 21, 20, 19, 19, 18, 18, 17, 17, 29, 30, 30, 31,
+ 32, 32, 32, 32, 33, 32, 30, 30, 28, 28, 27, 26, 25, 24, 24, 23, 23, 21,
+ 21, 20, 20, 19, 18, 18, 17, 17, 16, 16, 28, 30, 30, 31, 31, 31, 32, 32,
+ 32, 32, 30, 30, 28, 28, 27, 26, 25, 24, 24, 23, 23, 21, 21, 20, 20, 19,
+ 18, 18, 17, 17, 16, 16, 26, 27, 27, 28, 28, 28, 29, 29, 29, 29, 28, 28,
+ 26, 26, 25, 24, 24, 23, 22, 21, 21, 20, 20, 19, 19, 18, 17, 17, 16, 16,
+ 15, 15, 26, 27, 27, 28, 28, 28, 29, 29, 29, 29, 28, 28, 26, 26, 25, 24,
+ 24, 23, 22, 21, 21, 20, 20, 19, 19, 18, 17, 17, 16, 16, 15, 15,
+ /* Size 4x8 */
+ 64, 60, 47, 33, 63, 59, 49, 34, 62, 55, 47, 35, 59, 48, 38, 30, 49, 43,
+ 32, 26, 41, 38, 29, 22, 36, 34, 26, 20, 31, 30, 24, 18,
+ /* Size 8x4 */
+ 64, 63, 62, 59, 49, 41, 36, 31, 60, 59, 55, 48, 43, 38, 34, 30, 47, 49,
+ 47, 38, 32, 29, 26, 24, 33, 34, 35, 30, 26, 22, 20, 18,
+ /* Size 8x16 */
+ 64, 65, 64, 57, 47, 38, 33, 28, 65, 64, 63, 58, 48, 40, 34, 29, 65, 63,
+ 62, 59, 50, 41, 36, 31, 64, 63, 60, 56, 49, 41, 36, 31, 64, 62, 58, 53,
+ 48, 41, 37, 32, 60, 60, 55, 48, 43, 38, 34, 30, 58, 59, 54, 44, 39, 35,
+ 32, 28, 54, 56, 51, 41, 37, 33, 29, 27, 50, 53, 49, 40, 34, 30, 28, 25,
+ 46, 49, 47, 38, 32, 28, 26, 24, 43, 46, 44, 36, 31, 27, 25, 22, 38, 41,
+ 41, 34, 29, 25, 23, 21, 35, 38, 38, 32, 27, 24, 21, 20, 32, 34, 35, 30,
+ 26, 22, 20, 18, 29, 31, 32, 28, 24, 21, 19, 17, 26, 28, 29, 26, 23, 20,
+ 18, 16,
+ /* Size 16x8 */
+ 64, 65, 65, 64, 64, 60, 58, 54, 50, 46, 43, 38, 35, 32, 29, 26, 65, 64,
+ 63, 63, 62, 60, 59, 56, 53, 49, 46, 41, 38, 34, 31, 28, 64, 63, 62, 60,
+ 58, 55, 54, 51, 49, 47, 44, 41, 38, 35, 32, 29, 57, 58, 59, 56, 53, 48,
+ 44, 41, 40, 38, 36, 34, 32, 30, 28, 26, 47, 48, 50, 49, 48, 43, 39, 37,
+ 34, 32, 31, 29, 27, 26, 24, 23, 38, 40, 41, 41, 41, 38, 35, 33, 30, 28,
+ 27, 25, 24, 22, 21, 20, 33, 34, 36, 36, 37, 34, 32, 29, 28, 26, 25, 23,
+ 21, 20, 19, 18, 28, 29, 31, 31, 32, 30, 28, 27, 25, 24, 22, 21, 20, 18,
+ 17, 16,
+ /* Size 16x32 */
+ 64, 65, 65, 64, 64, 60, 57, 54, 47, 46, 38, 38, 33, 31, 28, 26, 65, 64,
+ 64, 63, 63, 60, 58, 55, 48, 47, 40, 40, 34, 33, 29, 27, 65, 64, 64, 63,
+ 63, 60, 58, 55, 48, 48, 40, 40, 34, 33, 29, 27, 65, 64, 64, 63, 63, 61,
+ 59, 56, 49, 49, 41, 41, 35, 34, 31, 28, 65, 63, 63, 63, 62, 61, 59, 56,
+ 50, 49, 41, 41, 36, 34, 31, 28, 65, 63, 63, 62, 61, 59, 58, 55, 49, 49,
+ 41, 41, 36, 34, 31, 29, 64, 63, 63, 61, 60, 58, 56, 54, 49, 48, 41, 41,
+ 36, 35, 31, 29, 64, 63, 63, 60, 59, 58, 55, 53, 48, 48, 41, 41, 36, 35,
+ 32, 29, 64, 63, 62, 59, 58, 55, 53, 52, 48, 47, 41, 41, 37, 35, 32, 30,
+ 64, 62, 62, 59, 58, 55, 53, 51, 48, 47, 41, 41, 36, 35, 32, 29, 60, 60,
+ 60, 57, 55, 52, 48, 47, 43, 42, 38, 38, 34, 33, 30, 28, 60, 60, 60, 57,
+ 55, 52, 48, 47, 43, 42, 38, 38, 34, 33, 30, 28, 58, 59, 59, 55, 54, 49,
+ 44, 42, 39, 39, 35, 35, 32, 31, 28, 26, 57, 59, 59, 55, 53, 48, 43, 41,
+ 38, 38, 34, 34, 31, 30, 28, 26, 54, 56, 56, 53, 51, 47, 41, 40, 37, 36,
+ 33, 33, 29, 29, 27, 25, 52, 54, 55, 51, 51, 46, 41, 39, 35, 35, 32, 32,
+ 29, 28, 26, 24, 50, 53, 53, 50, 49, 45, 40, 38, 34, 34, 30, 30, 28, 27,
+ 25, 24, 47, 49, 50, 48, 48, 43, 38, 37, 33, 32, 29, 29, 26, 26, 24, 23,
+ 46, 49, 49, 48, 47, 42, 38, 36, 32, 32, 28, 28, 26, 25, 24, 23, 43, 46,
+ 46, 45, 44, 40, 36, 34, 31, 30, 27, 27, 25, 24, 22, 21, 43, 46, 46, 45,
+ 44, 40, 36, 34, 31, 30, 27, 27, 25, 24, 22, 21, 39, 41, 42, 41, 41, 38,
+ 34, 33, 29, 29, 25, 25, 23, 22, 21, 20, 38, 41, 41, 41, 41, 38, 34, 33,
+ 29, 28, 25, 25, 23, 22, 21, 20, 36, 39, 39, 39, 39, 36, 33, 31, 28, 27,
+ 24, 24, 22, 21, 20, 19, 35, 38, 38, 38, 38, 35, 32, 31, 27, 27, 24, 24,
+ 21, 21, 20, 19, 33, 36, 36, 36, 37, 34, 31, 30, 26, 26, 23, 23, 21, 20,
+ 19, 18, 32, 34, 34, 35, 35, 33, 30, 29, 26, 25, 22, 22, 20, 20, 18, 17,
+ 31, 33, 33, 34, 34, 32, 29, 28, 25, 25, 22, 22, 20, 19, 18, 17, 29, 31,
+ 31, 32, 32, 30, 28, 27, 24, 24, 21, 21, 19, 18, 17, 16, 28, 31, 31, 32,
+ 32, 30, 28, 27, 24, 24, 21, 21, 19, 18, 17, 16, 26, 28, 28, 29, 29, 28,
+ 26, 25, 23, 22, 20, 20, 18, 17, 16, 15, 26, 28, 28, 29, 29, 28, 26, 25,
+ 23, 22, 20, 20, 18, 17, 16, 15,
+ /* Size 32x16 */
+ 64, 65, 65, 65, 65, 65, 64, 64, 64, 64, 60, 60, 58, 57, 54, 52, 50, 47,
+ 46, 43, 43, 39, 38, 36, 35, 33, 32, 31, 29, 28, 26, 26, 65, 64, 64, 64,
+ 63, 63, 63, 63, 63, 62, 60, 60, 59, 59, 56, 54, 53, 49, 49, 46, 46, 41,
+ 41, 39, 38, 36, 34, 33, 31, 31, 28, 28, 65, 64, 64, 64, 63, 63, 63, 63,
+ 62, 62, 60, 60, 59, 59, 56, 55, 53, 50, 49, 46, 46, 42, 41, 39, 38, 36,
+ 34, 33, 31, 31, 28, 28, 64, 63, 63, 63, 63, 62, 61, 60, 59, 59, 57, 57,
+ 55, 55, 53, 51, 50, 48, 48, 45, 45, 41, 41, 39, 38, 36, 35, 34, 32, 32,
+ 29, 29, 64, 63, 63, 63, 62, 61, 60, 59, 58, 58, 55, 55, 54, 53, 51, 51,
+ 49, 48, 47, 44, 44, 41, 41, 39, 38, 37, 35, 34, 32, 32, 29, 29, 60, 60,
+ 60, 61, 61, 59, 58, 58, 55, 55, 52, 52, 49, 48, 47, 46, 45, 43, 42, 40,
+ 40, 38, 38, 36, 35, 34, 33, 32, 30, 30, 28, 28, 57, 58, 58, 59, 59, 58,
+ 56, 55, 53, 53, 48, 48, 44, 43, 41, 41, 40, 38, 38, 36, 36, 34, 34, 33,
+ 32, 31, 30, 29, 28, 28, 26, 26, 54, 55, 55, 56, 56, 55, 54, 53, 52, 51,
+ 47, 47, 42, 41, 40, 39, 38, 37, 36, 34, 34, 33, 33, 31, 31, 30, 29, 28,
+ 27, 27, 25, 25, 47, 48, 48, 49, 50, 49, 49, 48, 48, 48, 43, 43, 39, 38,
+ 37, 35, 34, 33, 32, 31, 31, 29, 29, 28, 27, 26, 26, 25, 24, 24, 23, 23,
+ 46, 47, 48, 49, 49, 49, 48, 48, 47, 47, 42, 42, 39, 38, 36, 35, 34, 32,
+ 32, 30, 30, 29, 28, 27, 27, 26, 25, 25, 24, 24, 22, 22, 38, 40, 40, 41,
+ 41, 41, 41, 41, 41, 41, 38, 38, 35, 34, 33, 32, 30, 29, 28, 27, 27, 25,
+ 25, 24, 24, 23, 22, 22, 21, 21, 20, 20, 38, 40, 40, 41, 41, 41, 41, 41,
+ 41, 41, 38, 38, 35, 34, 33, 32, 30, 29, 28, 27, 27, 25, 25, 24, 24, 23,
+ 22, 22, 21, 21, 20, 20, 33, 34, 34, 35, 36, 36, 36, 36, 37, 36, 34, 34,
+ 32, 31, 29, 29, 28, 26, 26, 25, 25, 23, 23, 22, 21, 21, 20, 20, 19, 19,
+ 18, 18, 31, 33, 33, 34, 34, 34, 35, 35, 35, 35, 33, 33, 31, 30, 29, 28,
+ 27, 26, 25, 24, 24, 22, 22, 21, 21, 20, 20, 19, 18, 18, 17, 17, 28, 29,
+ 29, 31, 31, 31, 31, 32, 32, 32, 30, 30, 28, 28, 27, 26, 25, 24, 24, 22,
+ 22, 21, 21, 20, 20, 19, 18, 18, 17, 17, 16, 16, 26, 27, 27, 28, 28, 29,
+ 29, 29, 30, 29, 28, 28, 26, 26, 25, 24, 24, 23, 23, 21, 21, 20, 20, 19,
+ 19, 18, 17, 17, 16, 16, 15, 15,
+ /* Size 4x16 */
+ 65, 60, 46, 31, 64, 60, 48, 33, 63, 61, 49, 34, 63, 58, 48, 35, 63, 55,
+ 47, 35, 60, 52, 42, 33, 59, 49, 39, 31, 56, 47, 36, 29, 53, 45, 34, 27,
+ 49, 42, 32, 25, 46, 40, 30, 24, 41, 38, 28, 22, 38, 35, 27, 21, 34, 33,
+ 25, 20, 31, 30, 24, 18, 28, 28, 22, 17,
+ /* Size 16x4 */
+ 65, 64, 63, 63, 63, 60, 59, 56, 53, 49, 46, 41, 38, 34, 31, 28, 60, 60,
+ 61, 58, 55, 52, 49, 47, 45, 42, 40, 38, 35, 33, 30, 28, 46, 48, 49, 48,
+ 47, 42, 39, 36, 34, 32, 30, 28, 27, 25, 24, 22, 31, 33, 34, 35, 35, 33,
+ 31, 29, 27, 25, 24, 22, 21, 20, 18, 17,
+ /* Size 8x32 */
+ 64, 65, 64, 57, 47, 38, 33, 28, 65, 64, 63, 58, 48, 40, 34, 29, 65, 64,
+ 63, 58, 48, 40, 34, 29, 65, 64, 63, 59, 49, 41, 35, 31, 65, 63, 62, 59,
+ 50, 41, 36, 31, 65, 63, 61, 58, 49, 41, 36, 31, 64, 63, 60, 56, 49, 41,
+ 36, 31, 64, 63, 59, 55, 48, 41, 36, 32, 64, 62, 58, 53, 48, 41, 37, 32,
+ 64, 62, 58, 53, 48, 41, 36, 32, 60, 60, 55, 48, 43, 38, 34, 30, 60, 60,
+ 55, 48, 43, 38, 34, 30, 58, 59, 54, 44, 39, 35, 32, 28, 57, 59, 53, 43,
+ 38, 34, 31, 28, 54, 56, 51, 41, 37, 33, 29, 27, 52, 55, 51, 41, 35, 32,
+ 29, 26, 50, 53, 49, 40, 34, 30, 28, 25, 47, 50, 48, 38, 33, 29, 26, 24,
+ 46, 49, 47, 38, 32, 28, 26, 24, 43, 46, 44, 36, 31, 27, 25, 22, 43, 46,
+ 44, 36, 31, 27, 25, 22, 39, 42, 41, 34, 29, 25, 23, 21, 38, 41, 41, 34,
+ 29, 25, 23, 21, 36, 39, 39, 33, 28, 24, 22, 20, 35, 38, 38, 32, 27, 24,
+ 21, 20, 33, 36, 37, 31, 26, 23, 21, 19, 32, 34, 35, 30, 26, 22, 20, 18,
+ 31, 33, 34, 29, 25, 22, 20, 18, 29, 31, 32, 28, 24, 21, 19, 17, 28, 31,
+ 32, 28, 24, 21, 19, 17, 26, 28, 29, 26, 23, 20, 18, 16, 26, 28, 29, 26,
+ 23, 20, 18, 16,
+ /* Size 32x8 */
+ 64, 65, 65, 65, 65, 65, 64, 64, 64, 64, 60, 60, 58, 57, 54, 52, 50, 47,
+ 46, 43, 43, 39, 38, 36, 35, 33, 32, 31, 29, 28, 26, 26, 65, 64, 64, 64,
+ 63, 63, 63, 63, 62, 62, 60, 60, 59, 59, 56, 55, 53, 50, 49, 46, 46, 42,
+ 41, 39, 38, 36, 34, 33, 31, 31, 28, 28, 64, 63, 63, 63, 62, 61, 60, 59,
+ 58, 58, 55, 55, 54, 53, 51, 51, 49, 48, 47, 44, 44, 41, 41, 39, 38, 37,
+ 35, 34, 32, 32, 29, 29, 57, 58, 58, 59, 59, 58, 56, 55, 53, 53, 48, 48,
+ 44, 43, 41, 41, 40, 38, 38, 36, 36, 34, 34, 33, 32, 31, 30, 29, 28, 28,
+ 26, 26, 47, 48, 48, 49, 50, 49, 49, 48, 48, 48, 43, 43, 39, 38, 37, 35,
+ 34, 33, 32, 31, 31, 29, 29, 28, 27, 26, 26, 25, 24, 24, 23, 23, 38, 40,
+ 40, 41, 41, 41, 41, 41, 41, 41, 38, 38, 35, 34, 33, 32, 30, 29, 28, 27,
+ 27, 25, 25, 24, 24, 23, 22, 22, 21, 21, 20, 20, 33, 34, 34, 35, 36, 36,
+ 36, 36, 37, 36, 34, 34, 32, 31, 29, 29, 28, 26, 26, 25, 25, 23, 23, 22,
+ 21, 21, 20, 20, 19, 19, 18, 18, 28, 29, 29, 31, 31, 31, 31, 32, 32, 32,
+ 30, 30, 28, 28, 27, 26, 25, 24, 24, 22, 22, 21, 21, 20, 20, 19, 18, 18,
+ 17, 17, 16, 16 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 49, 42, 42, 29,
+#endif
+ /* Size 4x4 */
+ 65, 48, 44, 38, 48, 42, 41, 38, 44, 41, 33, 30, 38, 38, 30, 26,
+ /* Size 8x8 */
+ 65, 63, 53, 43, 44, 41, 38, 36, 63, 58, 49, 44, 46, 43, 41, 38, 53, 49,
+ 43, 43, 45, 44, 41, 39, 43, 44, 43, 39, 38, 38, 37, 35, 44, 46, 45, 38,
+ 35, 34, 33, 31, 41, 43, 44, 38, 34, 31, 30, 28, 38, 41, 41, 37, 33, 30,
+ 28, 26, 36, 38, 39, 35, 31, 28, 26, 25,
+ /* Size 16x16 */
+ 64, 66, 67, 61, 56, 49, 43, 42, 42, 41, 41, 39, 38, 36, 34, 32, 66, 65,
+ 66, 59, 53, 48, 44, 43, 44, 44, 42, 41, 39, 38, 36, 34, 67, 66, 64, 58,
+ 51, 48, 45, 45, 45, 45, 44, 43, 41, 39, 38, 36, 61, 59, 58, 53, 47, 46,
+ 44, 44, 45, 45, 44, 43, 41, 40, 38, 36, 56, 53, 51, 47, 43, 43, 43, 44,
+ 45, 45, 45, 44, 42, 41, 39, 38, 49, 48, 48, 46, 43, 42, 41, 41, 41, 41,
+ 41, 41, 39, 38, 37, 36, 43, 44, 45, 44, 43, 41, 39, 39, 39, 39, 39, 38,
+ 37, 37, 35, 34, 42, 43, 45, 44, 44, 41, 39, 38, 38, 37, 37, 37, 36, 35,
+ 34, 33, 42, 44, 45, 45, 45, 41, 39, 38, 37, 36, 35, 35, 34, 33, 33, 32,
+ 41, 44, 45, 45, 45, 41, 39, 37, 36, 35, 34, 33, 33, 32, 31, 30, 41, 42,
+ 44, 44, 45, 41, 39, 37, 35, 34, 33, 32, 32, 31, 30, 29, 39, 41, 43, 43,
+ 44, 41, 38, 37, 35, 33, 32, 31, 30, 29, 28, 27, 38, 39, 41, 41, 42, 39,
+ 37, 36, 34, 33, 32, 30, 29, 28, 27, 26, 36, 38, 39, 40, 41, 38, 37, 35,
+ 33, 32, 31, 29, 28, 27, 26, 25, 34, 36, 38, 38, 39, 37, 35, 34, 33, 31,
+ 30, 28, 27, 26, 25, 24, 32, 34, 36, 36, 38, 36, 34, 33, 32, 30, 29, 27,
+ 26, 25, 24, 23,
+ /* Size 32x32 */
+ 64, 66, 66, 67, 67, 64, 61, 59, 56, 55, 49, 49, 43, 42, 42, 42, 42, 42,
+ 41, 41, 41, 39, 39, 38, 38, 37, 36, 35, 34, 34, 32, 32, 66, 65, 65, 66,
+ 66, 63, 59, 58, 53, 53, 49, 49, 44, 43, 43, 44, 44, 44, 43, 42, 42, 41,
+ 41, 40, 39, 38, 38, 37, 36, 36, 34, 34, 66, 65, 65, 65, 66, 62, 59, 58,
+ 53, 53, 48, 48, 44, 43, 43, 44, 44, 44, 44, 42, 42, 41, 41, 40, 39, 39,
+ 38, 37, 36, 36, 34, 34, 67, 66, 65, 65, 65, 61, 59, 56, 52, 51, 48, 48,
+ 45, 44, 44, 45, 45, 45, 45, 44, 44, 43, 42, 41, 41, 40, 39, 38, 37, 37,
+ 35, 35, 67, 66, 66, 65, 64, 61, 58, 56, 51, 51, 48, 48, 45, 44, 45, 45,
+ 45, 46, 45, 44, 44, 43, 43, 42, 41, 40, 39, 39, 38, 38, 36, 36, 64, 63,
+ 62, 61, 61, 58, 55, 53, 49, 49, 47, 47, 45, 44, 44, 45, 45, 46, 45, 44,
+ 44, 43, 43, 42, 41, 41, 40, 39, 38, 38, 36, 36, 61, 59, 59, 59, 58, 55,
+ 53, 51, 47, 47, 46, 46, 44, 43, 44, 44, 45, 45, 45, 44, 44, 43, 43, 42,
+ 41, 41, 40, 39, 38, 38, 36, 36, 59, 58, 58, 56, 56, 53, 51, 49, 46, 46,
+ 45, 45, 44, 43, 44, 44, 45, 45, 45, 44, 44, 44, 43, 42, 42, 41, 40, 40,
+ 39, 38, 37, 37, 56, 53, 53, 52, 51, 49, 47, 46, 43, 43, 43, 43, 43, 43,
+ 44, 44, 45, 45, 45, 45, 45, 44, 44, 43, 42, 42, 41, 41, 39, 39, 38, 38,
+ 55, 53, 53, 51, 51, 49, 47, 46, 43, 43, 43, 43, 43, 43, 43, 44, 44, 45,
+ 45, 44, 44, 44, 44, 43, 42, 41, 41, 40, 39, 39, 37, 37, 49, 49, 48, 48,
+ 48, 47, 46, 45, 43, 43, 42, 42, 41, 41, 41, 41, 41, 42, 41, 41, 41, 41,
+ 41, 40, 39, 39, 38, 38, 37, 37, 36, 36, 49, 49, 48, 48, 48, 47, 46, 45,
+ 43, 43, 42, 42, 41, 41, 41, 41, 41, 42, 41, 41, 41, 41, 41, 40, 39, 39,
+ 38, 38, 37, 37, 36, 36, 43, 44, 44, 45, 45, 45, 44, 44, 43, 43, 41, 41,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 38, 38, 38, 37, 37, 37, 36, 35, 35,
+ 34, 34, 42, 43, 43, 44, 44, 44, 43, 43, 43, 43, 41, 41, 39, 39, 39, 39,
+ 38, 38, 38, 38, 38, 38, 38, 37, 37, 37, 36, 36, 35, 35, 34, 34, 42, 43,
+ 43, 44, 45, 44, 44, 44, 44, 43, 41, 41, 39, 39, 38, 38, 38, 37, 37, 37,
+ 37, 37, 37, 36, 36, 35, 35, 35, 34, 34, 33, 33, 42, 44, 44, 45, 45, 45,
+ 44, 44, 44, 44, 41, 41, 39, 39, 38, 38, 37, 37, 37, 36, 36, 36, 36, 35,
+ 35, 34, 34, 34, 33, 33, 32, 32, 42, 44, 44, 45, 45, 45, 45, 45, 45, 44,
+ 41, 41, 39, 38, 38, 37, 37, 36, 36, 35, 35, 35, 35, 34, 34, 34, 33, 33,
+ 33, 32, 32, 32, 42, 44, 44, 45, 46, 46, 45, 45, 45, 45, 42, 42, 39, 38,
+ 37, 37, 36, 35, 35, 34, 34, 34, 33, 33, 33, 33, 32, 32, 31, 31, 30, 30,
+ 41, 43, 44, 45, 45, 45, 45, 45, 45, 45, 41, 41, 39, 38, 37, 37, 36, 35,
+ 35, 34, 34, 33, 33, 33, 33, 32, 32, 32, 31, 31, 30, 30, 41, 42, 42, 44,
+ 44, 44, 44, 44, 45, 44, 41, 41, 39, 38, 37, 36, 35, 34, 34, 33, 33, 32,
+ 32, 32, 32, 31, 31, 30, 30, 30, 29, 29, 41, 42, 42, 44, 44, 44, 44, 44,
+ 45, 44, 41, 41, 39, 38, 37, 36, 35, 34, 34, 33, 33, 32, 32, 32, 32, 31,
+ 31, 30, 30, 30, 29, 29, 39, 41, 41, 43, 43, 43, 43, 44, 44, 44, 41, 41,
+ 38, 38, 37, 36, 35, 34, 33, 32, 32, 31, 31, 30, 30, 30, 29, 29, 28, 28,
+ 27, 27, 39, 41, 41, 42, 43, 43, 43, 43, 44, 44, 41, 41, 38, 38, 37, 36,
+ 35, 33, 33, 32, 32, 31, 31, 30, 30, 29, 29, 29, 28, 28, 27, 27, 38, 40,
+ 40, 41, 42, 42, 42, 42, 43, 43, 40, 40, 38, 37, 36, 35, 34, 33, 33, 32,
+ 32, 30, 30, 29, 29, 29, 28, 28, 27, 27, 27, 27, 38, 39, 39, 41, 41, 41,
+ 41, 42, 42, 42, 39, 39, 37, 37, 36, 35, 34, 33, 33, 32, 32, 30, 30, 29,
+ 29, 28, 28, 28, 27, 27, 26, 26, 37, 38, 39, 40, 40, 41, 41, 41, 42, 41,
+ 39, 39, 37, 37, 35, 34, 34, 33, 32, 31, 31, 30, 29, 29, 28, 28, 27, 27,
+ 27, 26, 26, 26, 36, 38, 38, 39, 39, 40, 40, 40, 41, 41, 38, 38, 37, 36,
+ 35, 34, 33, 32, 32, 31, 31, 29, 29, 28, 28, 27, 27, 26, 26, 26, 25, 25,
+ 35, 37, 37, 38, 39, 39, 39, 40, 41, 40, 38, 38, 36, 36, 35, 34, 33, 32,
+ 32, 30, 30, 29, 29, 28, 28, 27, 26, 26, 26, 26, 25, 25, 34, 36, 36, 37,
+ 38, 38, 38, 39, 39, 39, 37, 37, 35, 35, 34, 33, 33, 31, 31, 30, 30, 28,
+ 28, 27, 27, 27, 26, 26, 25, 25, 24, 24, 34, 36, 36, 37, 38, 38, 38, 38,
+ 39, 39, 37, 37, 35, 35, 34, 33, 32, 31, 31, 30, 30, 28, 28, 27, 27, 26,
+ 26, 26, 25, 25, 24, 24, 32, 34, 34, 35, 36, 36, 36, 37, 38, 37, 36, 36,
+ 34, 34, 33, 32, 32, 30, 30, 29, 29, 27, 27, 27, 26, 26, 25, 25, 24, 24,
+ 23, 23, 32, 34, 34, 35, 36, 36, 36, 37, 38, 37, 36, 36, 34, 34, 33, 32,
+ 32, 30, 30, 29, 29, 27, 27, 27, 26, 26, 25, 25, 24, 24, 23, 23,
+ /* Size 4x8 */
+ 65, 48, 43, 38, 61, 47, 45, 40, 51, 43, 45, 41, 44, 41, 38, 36, 45, 41,
+ 35, 32, 43, 41, 33, 29, 40, 39, 32, 27, 37, 37, 31, 26,
+ /* Size 8x4 */
+ 65, 61, 51, 44, 45, 43, 40, 37, 48, 47, 43, 41, 41, 41, 39, 37, 43, 45,
+ 45, 38, 35, 33, 32, 31, 38, 40, 41, 36, 32, 29, 27, 26,
+ /* Size 8x16 */
+ 64, 66, 55, 43, 42, 39, 37, 34, 65, 65, 53, 44, 44, 41, 38, 36, 67, 64,
+ 51, 45, 45, 43, 40, 37, 61, 57, 48, 44, 45, 43, 41, 38, 55, 51, 44, 43,
+ 45, 44, 41, 39, 49, 48, 43, 41, 41, 41, 39, 37, 43, 45, 43, 39, 39, 38,
+ 37, 35, 42, 45, 43, 39, 37, 36, 35, 34, 42, 45, 44, 39, 36, 35, 34, 32,
+ 42, 45, 45, 38, 35, 33, 32, 31, 41, 44, 44, 38, 34, 32, 31, 29, 39, 43,
+ 43, 38, 34, 31, 29, 28, 38, 41, 42, 37, 33, 30, 28, 27, 36, 39, 41, 36,
+ 32, 29, 27, 26, 34, 38, 39, 35, 31, 28, 26, 25, 32, 36, 37, 34, 30, 27,
+ 25, 24,
+ /* Size 16x8 */
+ 64, 65, 67, 61, 55, 49, 43, 42, 42, 42, 41, 39, 38, 36, 34, 32, 66, 65,
+ 64, 57, 51, 48, 45, 45, 45, 45, 44, 43, 41, 39, 38, 36, 55, 53, 51, 48,
+ 44, 43, 43, 43, 44, 45, 44, 43, 42, 41, 39, 37, 43, 44, 45, 44, 43, 41,
+ 39, 39, 39, 38, 38, 38, 37, 36, 35, 34, 42, 44, 45, 45, 45, 41, 39, 37,
+ 36, 35, 34, 34, 33, 32, 31, 30, 39, 41, 43, 43, 44, 41, 38, 36, 35, 33,
+ 32, 31, 30, 29, 28, 27, 37, 38, 40, 41, 41, 39, 37, 35, 34, 32, 31, 29,
+ 28, 27, 26, 25, 34, 36, 37, 38, 39, 37, 35, 34, 32, 31, 29, 28, 27, 26,
+ 25, 24,
+ /* Size 16x32 */
+ 64, 66, 66, 59, 55, 49, 43, 42, 42, 41, 39, 39, 37, 36, 34, 32, 65, 65,
+ 65, 57, 53, 48, 44, 43, 43, 43, 41, 41, 38, 38, 35, 34, 65, 65, 65, 57,
+ 53, 48, 44, 44, 44, 43, 41, 41, 38, 38, 36, 34, 67, 64, 64, 55, 52, 48,
+ 44, 45, 45, 45, 42, 42, 39, 39, 37, 35, 67, 64, 64, 55, 51, 48, 45, 45,
+ 45, 45, 43, 43, 40, 39, 37, 36, 64, 61, 60, 53, 49, 47, 44, 45, 45, 45,
+ 43, 43, 40, 40, 38, 36, 61, 58, 57, 51, 48, 46, 44, 44, 45, 45, 43, 43,
+ 41, 40, 38, 37, 59, 55, 55, 49, 46, 45, 44, 44, 45, 45, 43, 43, 41, 40,
+ 38, 37, 55, 51, 51, 46, 44, 43, 43, 44, 45, 45, 44, 44, 41, 41, 39, 38,
+ 55, 51, 51, 46, 44, 43, 43, 43, 45, 45, 43, 43, 41, 41, 39, 37, 49, 48,
+ 48, 45, 43, 42, 41, 41, 41, 41, 41, 41, 39, 38, 37, 36, 49, 48, 48, 45,
+ 43, 42, 41, 41, 41, 41, 41, 41, 39, 38, 37, 36, 43, 45, 45, 43, 43, 41,
+ 39, 39, 39, 39, 38, 38, 37, 37, 35, 34, 42, 44, 44, 43, 43, 41, 39, 39,
+ 38, 38, 38, 38, 36, 36, 35, 34, 42, 44, 45, 44, 43, 41, 39, 38, 37, 37,
+ 36, 36, 35, 35, 34, 33, 42, 45, 45, 44, 44, 41, 39, 38, 37, 37, 36, 36,
+ 34, 34, 33, 32, 42, 45, 45, 45, 44, 41, 39, 38, 36, 36, 35, 35, 34, 33,
+ 32, 32, 42, 45, 45, 45, 45, 41, 38, 37, 35, 35, 33, 33, 32, 32, 31, 30,
+ 42, 45, 45, 45, 45, 41, 38, 37, 35, 35, 33, 33, 32, 32, 31, 30, 41, 44,
+ 44, 44, 44, 41, 38, 37, 34, 34, 32, 32, 31, 31, 29, 29, 41, 44, 44, 44,
+ 44, 41, 38, 37, 34, 34, 32, 32, 31, 31, 29, 29, 39, 43, 43, 43, 44, 41,
+ 38, 37, 34, 33, 31, 31, 29, 29, 28, 27, 39, 42, 43, 43, 43, 41, 38, 37,
+ 34, 33, 31, 31, 29, 29, 28, 27, 38, 41, 41, 42, 42, 40, 37, 36, 33, 33,
+ 30, 30, 29, 28, 27, 27, 38, 41, 41, 42, 42, 39, 37, 36, 33, 33, 30, 30,
+ 28, 28, 27, 26, 37, 40, 40, 41, 41, 39, 37, 35, 33, 32, 29, 29, 28, 27,
+ 26, 26, 36, 39, 39, 40, 41, 38, 36, 35, 32, 32, 29, 29, 27, 27, 26, 25,
+ 35, 38, 39, 40, 40, 38, 36, 35, 32, 32, 29, 29, 27, 26, 25, 25, 34, 37,
+ 38, 39, 39, 37, 35, 34, 31, 31, 28, 28, 26, 26, 25, 24, 34, 37, 37, 38,
+ 39, 37, 35, 34, 31, 31, 28, 28, 26, 26, 25, 24, 32, 35, 36, 37, 37, 35,
+ 34, 33, 30, 30, 27, 27, 25, 25, 24, 23, 32, 35, 36, 37, 37, 35, 34, 33,
+ 30, 30, 27, 27, 25, 25, 24, 23,
+ /* Size 32x16 */
+ 64, 65, 65, 67, 67, 64, 61, 59, 55, 55, 49, 49, 43, 42, 42, 42, 42, 42,
+ 42, 41, 41, 39, 39, 38, 38, 37, 36, 35, 34, 34, 32, 32, 66, 65, 65, 64,
+ 64, 61, 58, 55, 51, 51, 48, 48, 45, 44, 44, 45, 45, 45, 45, 44, 44, 43,
+ 42, 41, 41, 40, 39, 38, 37, 37, 35, 35, 66, 65, 65, 64, 64, 60, 57, 55,
+ 51, 51, 48, 48, 45, 44, 45, 45, 45, 45, 45, 44, 44, 43, 43, 41, 41, 40,
+ 39, 39, 38, 37, 36, 36, 59, 57, 57, 55, 55, 53, 51, 49, 46, 46, 45, 45,
+ 43, 43, 44, 44, 45, 45, 45, 44, 44, 43, 43, 42, 42, 41, 40, 40, 39, 38,
+ 37, 37, 55, 53, 53, 52, 51, 49, 48, 46, 44, 44, 43, 43, 43, 43, 43, 44,
+ 44, 45, 45, 44, 44, 44, 43, 42, 42, 41, 41, 40, 39, 39, 37, 37, 49, 48,
+ 48, 48, 48, 47, 46, 45, 43, 43, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41,
+ 41, 41, 41, 40, 39, 39, 38, 38, 37, 37, 35, 35, 43, 44, 44, 44, 45, 44,
+ 44, 44, 43, 43, 41, 41, 39, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 37,
+ 37, 37, 36, 36, 35, 35, 34, 34, 42, 43, 44, 45, 45, 45, 44, 44, 44, 43,
+ 41, 41, 39, 39, 38, 38, 38, 37, 37, 37, 37, 37, 37, 36, 36, 35, 35, 35,
+ 34, 34, 33, 33, 42, 43, 44, 45, 45, 45, 45, 45, 45, 45, 41, 41, 39, 38,
+ 37, 37, 36, 35, 35, 34, 34, 34, 34, 33, 33, 33, 32, 32, 31, 31, 30, 30,
+ 41, 43, 43, 45, 45, 45, 45, 45, 45, 45, 41, 41, 39, 38, 37, 37, 36, 35,
+ 35, 34, 34, 33, 33, 33, 33, 32, 32, 32, 31, 31, 30, 30, 39, 41, 41, 42,
+ 43, 43, 43, 43, 44, 43, 41, 41, 38, 38, 36, 36, 35, 33, 33, 32, 32, 31,
+ 31, 30, 30, 29, 29, 29, 28, 28, 27, 27, 39, 41, 41, 42, 43, 43, 43, 43,
+ 44, 43, 41, 41, 38, 38, 36, 36, 35, 33, 33, 32, 32, 31, 31, 30, 30, 29,
+ 29, 29, 28, 28, 27, 27, 37, 38, 38, 39, 40, 40, 41, 41, 41, 41, 39, 39,
+ 37, 36, 35, 34, 34, 32, 32, 31, 31, 29, 29, 29, 28, 28, 27, 27, 26, 26,
+ 25, 25, 36, 38, 38, 39, 39, 40, 40, 40, 41, 41, 38, 38, 37, 36, 35, 34,
+ 33, 32, 32, 31, 31, 29, 29, 28, 28, 27, 27, 26, 26, 26, 25, 25, 34, 35,
+ 36, 37, 37, 38, 38, 38, 39, 39, 37, 37, 35, 35, 34, 33, 32, 31, 31, 29,
+ 29, 28, 28, 27, 27, 26, 26, 25, 25, 25, 24, 24, 32, 34, 34, 35, 36, 36,
+ 37, 37, 38, 37, 36, 36, 34, 34, 33, 32, 32, 30, 30, 29, 29, 27, 27, 27,
+ 26, 26, 25, 25, 24, 24, 23, 23,
+ /* Size 4x16 */
+ 66, 49, 41, 36, 65, 48, 43, 38, 64, 48, 45, 39, 58, 46, 45, 40, 51, 43,
+ 45, 41, 48, 42, 41, 38, 45, 41, 39, 37, 44, 41, 37, 35, 45, 41, 36, 33,
+ 45, 41, 35, 32, 44, 41, 34, 31, 42, 41, 33, 29, 41, 39, 33, 28, 39, 38,
+ 32, 27, 37, 37, 31, 26, 35, 35, 30, 25,
+ /* Size 16x4 */
+ 66, 65, 64, 58, 51, 48, 45, 44, 45, 45, 44, 42, 41, 39, 37, 35, 49, 48,
+ 48, 46, 43, 42, 41, 41, 41, 41, 41, 41, 39, 38, 37, 35, 41, 43, 45, 45,
+ 45, 41, 39, 37, 36, 35, 34, 33, 33, 32, 31, 30, 36, 38, 39, 40, 41, 38,
+ 37, 35, 33, 32, 31, 29, 28, 27, 26, 25,
+ /* Size 8x32 */
+ 64, 66, 55, 43, 42, 39, 37, 34, 65, 65, 53, 44, 43, 41, 38, 35, 65, 65,
+ 53, 44, 44, 41, 38, 36, 67, 64, 52, 44, 45, 42, 39, 37, 67, 64, 51, 45,
+ 45, 43, 40, 37, 64, 60, 49, 44, 45, 43, 40, 38, 61, 57, 48, 44, 45, 43,
+ 41, 38, 59, 55, 46, 44, 45, 43, 41, 38, 55, 51, 44, 43, 45, 44, 41, 39,
+ 55, 51, 44, 43, 45, 43, 41, 39, 49, 48, 43, 41, 41, 41, 39, 37, 49, 48,
+ 43, 41, 41, 41, 39, 37, 43, 45, 43, 39, 39, 38, 37, 35, 42, 44, 43, 39,
+ 38, 38, 36, 35, 42, 45, 43, 39, 37, 36, 35, 34, 42, 45, 44, 39, 37, 36,
+ 34, 33, 42, 45, 44, 39, 36, 35, 34, 32, 42, 45, 45, 38, 35, 33, 32, 31,
+ 42, 45, 45, 38, 35, 33, 32, 31, 41, 44, 44, 38, 34, 32, 31, 29, 41, 44,
+ 44, 38, 34, 32, 31, 29, 39, 43, 44, 38, 34, 31, 29, 28, 39, 43, 43, 38,
+ 34, 31, 29, 28, 38, 41, 42, 37, 33, 30, 29, 27, 38, 41, 42, 37, 33, 30,
+ 28, 27, 37, 40, 41, 37, 33, 29, 28, 26, 36, 39, 41, 36, 32, 29, 27, 26,
+ 35, 39, 40, 36, 32, 29, 27, 25, 34, 38, 39, 35, 31, 28, 26, 25, 34, 37,
+ 39, 35, 31, 28, 26, 25, 32, 36, 37, 34, 30, 27, 25, 24, 32, 36, 37, 34,
+ 30, 27, 25, 24,
+ /* Size 32x8 */
+ 64, 65, 65, 67, 67, 64, 61, 59, 55, 55, 49, 49, 43, 42, 42, 42, 42, 42,
+ 42, 41, 41, 39, 39, 38, 38, 37, 36, 35, 34, 34, 32, 32, 66, 65, 65, 64,
+ 64, 60, 57, 55, 51, 51, 48, 48, 45, 44, 45, 45, 45, 45, 45, 44, 44, 43,
+ 43, 41, 41, 40, 39, 39, 38, 37, 36, 36, 55, 53, 53, 52, 51, 49, 48, 46,
+ 44, 44, 43, 43, 43, 43, 43, 44, 44, 45, 45, 44, 44, 44, 43, 42, 42, 41,
+ 41, 40, 39, 39, 37, 37, 43, 44, 44, 44, 45, 44, 44, 44, 43, 43, 41, 41,
+ 39, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 37, 37, 37, 36, 36, 35, 35,
+ 34, 34, 42, 43, 44, 45, 45, 45, 45, 45, 45, 45, 41, 41, 39, 38, 37, 37,
+ 36, 35, 35, 34, 34, 34, 34, 33, 33, 33, 32, 32, 31, 31, 30, 30, 39, 41,
+ 41, 42, 43, 43, 43, 43, 44, 43, 41, 41, 38, 38, 36, 36, 35, 33, 33, 32,
+ 32, 31, 31, 30, 30, 29, 29, 29, 28, 28, 27, 27, 37, 38, 38, 39, 40, 40,
+ 41, 41, 41, 41, 39, 39, 37, 36, 35, 34, 34, 32, 32, 31, 31, 29, 29, 29,
+ 28, 28, 27, 27, 26, 26, 25, 25, 34, 35, 36, 37, 37, 38, 38, 38, 39, 39,
+ 37, 37, 35, 35, 34, 33, 32, 31, 31, 29, 29, 28, 28, 27, 27, 26, 26, 25,
+ 25, 25, 24, 24 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 61, 44, 44, 27,
+#endif
+ /* Size 4x4 */
+ 64, 61, 49, 37, 61, 53, 44, 36, 49, 44, 32, 27, 37, 36, 27, 22,
+ /* Size 8x8 */
+ 65, 64, 64, 59, 53, 45, 39, 33, 64, 63, 63, 60, 55, 47, 41, 34, 64, 63,
+ 58, 55, 51, 46, 41, 35, 59, 60, 55, 48, 44, 39, 36, 32, 53, 55, 51, 44,
+ 38, 34, 32, 28, 45, 47, 46, 39, 34, 29, 27, 24, 39, 41, 41, 36, 32, 27,
+ 25, 22, 33, 34, 35, 32, 28, 24, 22, 20,
+ /* Size 16x16 */
+ 64, 65, 65, 65, 64, 64, 60, 57, 53, 50, 47, 42, 38, 35, 33, 31, 65, 64,
+ 64, 64, 64, 63, 60, 59, 54, 51, 48, 44, 40, 37, 35, 33, 65, 64, 63, 63,
+ 63, 63, 61, 59, 55, 53, 50, 46, 41, 39, 37, 34, 65, 64, 63, 62, 61, 61,
+ 59, 57, 54, 51, 49, 45, 41, 39, 37, 34, 64, 64, 63, 61, 60, 59, 57, 55,
+ 53, 51, 48, 45, 41, 39, 37, 35, 64, 63, 63, 61, 59, 58, 55, 53, 51, 49,
+ 48, 45, 41, 39, 37, 35, 60, 60, 61, 59, 57, 55, 52, 48, 46, 45, 43, 40,
+ 38, 36, 34, 33, 57, 59, 59, 57, 55, 53, 48, 42, 41, 39, 38, 36, 34, 33,
+ 31, 30, 53, 54, 55, 54, 53, 51, 46, 41, 39, 38, 36, 34, 32, 31, 29, 28,
+ 50, 51, 53, 51, 51, 49, 45, 39, 38, 36, 34, 32, 30, 29, 28, 27, 47, 48,
+ 50, 49, 48, 48, 43, 38, 36, 34, 32, 31, 29, 27, 27, 26, 42, 44, 46, 45,
+ 45, 45, 40, 36, 34, 32, 31, 29, 27, 26, 25, 24, 38, 40, 41, 41, 41, 41,
+ 38, 34, 32, 30, 29, 27, 25, 24, 23, 22, 35, 37, 39, 39, 39, 39, 36, 33,
+ 31, 29, 27, 26, 24, 23, 22, 21, 33, 35, 37, 37, 37, 37, 34, 31, 29, 28,
+ 27, 25, 23, 22, 21, 20, 31, 33, 34, 34, 35, 35, 33, 30, 28, 27, 26, 24,
+ 22, 21, 20, 20,
+ /* Size 32x32 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 61, 60, 59, 57, 57, 53, 52,
+ 50, 47, 47, 43, 42, 41, 38, 38, 35, 35, 33, 31, 31, 29, 65, 65, 65, 64,
+ 64, 64, 64, 64, 64, 64, 64, 61, 60, 59, 58, 58, 54, 53, 51, 48, 48, 45,
+ 44, 42, 39, 39, 37, 36, 35, 33, 33, 30, 65, 65, 64, 64, 64, 64, 64, 64,
+ 64, 63, 63, 61, 60, 59, 59, 59, 54, 53, 51, 48, 48, 45, 44, 42, 40, 40,
+ 37, 36, 35, 33, 33, 31, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 61,
+ 60, 60, 59, 59, 55, 54, 52, 49, 49, 46, 45, 43, 41, 41, 38, 37, 36, 34,
+ 34, 31, 65, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 61, 61, 60, 59, 59,
+ 55, 55, 53, 50, 50, 47, 46, 44, 41, 41, 39, 38, 37, 34, 34, 32, 65, 64,
+ 64, 64, 63, 63, 63, 63, 63, 63, 63, 61, 61, 60, 59, 59, 55, 55, 53, 50,
+ 50, 47, 46, 44, 41, 41, 39, 38, 37, 34, 34, 32, 65, 64, 64, 63, 63, 63,
+ 62, 62, 61, 61, 61, 59, 59, 58, 57, 57, 54, 53, 51, 49, 49, 46, 45, 44,
+ 41, 41, 39, 38, 37, 34, 34, 32, 65, 64, 64, 63, 63, 63, 62, 61, 61, 60,
+ 60, 59, 58, 57, 56, 56, 53, 53, 51, 49, 49, 46, 45, 44, 41, 41, 39, 38,
+ 37, 35, 35, 32, 64, 64, 64, 63, 63, 63, 61, 61, 60, 59, 59, 58, 57, 56,
+ 55, 55, 53, 52, 51, 48, 48, 46, 45, 44, 41, 41, 39, 38, 37, 35, 35, 33,
+ 64, 64, 63, 63, 63, 63, 61, 60, 59, 58, 58, 56, 55, 55, 53, 53, 51, 51,
+ 49, 48, 48, 46, 45, 44, 41, 41, 39, 38, 37, 35, 35, 33, 64, 64, 63, 63,
+ 63, 63, 61, 60, 59, 58, 58, 56, 55, 55, 53, 53, 51, 51, 49, 48, 48, 46,
+ 45, 44, 41, 41, 39, 38, 37, 35, 35, 33, 61, 61, 61, 61, 61, 61, 59, 59,
+ 58, 56, 56, 53, 53, 51, 49, 49, 47, 47, 46, 44, 44, 42, 41, 40, 38, 38,
+ 36, 36, 35, 33, 33, 31, 60, 60, 60, 60, 61, 61, 59, 58, 57, 55, 55, 53,
+ 52, 50, 48, 48, 46, 46, 45, 43, 43, 41, 40, 39, 38, 38, 36, 35, 34, 33,
+ 33, 31, 59, 59, 59, 60, 60, 60, 58, 57, 56, 55, 55, 51, 50, 48, 46, 46,
+ 44, 44, 42, 41, 41, 39, 39, 38, 36, 36, 34, 34, 33, 32, 32, 30, 57, 58,
+ 59, 59, 59, 59, 57, 56, 55, 53, 53, 49, 48, 46, 42, 42, 41, 41, 39, 38,
+ 38, 37, 36, 35, 34, 34, 33, 32, 31, 30, 30, 28, 57, 58, 59, 59, 59, 59,
+ 57, 56, 55, 53, 53, 49, 48, 46, 42, 42, 41, 41, 39, 38, 38, 37, 36, 35,
+ 34, 34, 33, 32, 31, 30, 30, 28, 53, 54, 54, 55, 55, 55, 54, 53, 53, 51,
+ 51, 47, 46, 44, 41, 41, 39, 39, 38, 36, 36, 34, 34, 33, 32, 32, 31, 30,
+ 29, 28, 28, 27, 52, 53, 53, 54, 55, 55, 53, 53, 52, 51, 51, 47, 46, 44,
+ 41, 41, 39, 38, 37, 35, 35, 34, 34, 33, 32, 32, 30, 30, 29, 28, 28, 27,
+ 50, 51, 51, 52, 53, 53, 51, 51, 51, 49, 49, 46, 45, 42, 39, 39, 38, 37,
+ 36, 34, 34, 33, 32, 32, 30, 30, 29, 29, 28, 27, 27, 26, 47, 48, 48, 49,
+ 50, 50, 49, 49, 48, 48, 48, 44, 43, 41, 38, 38, 36, 35, 34, 32, 32, 31,
+ 31, 30, 29, 29, 27, 27, 27, 26, 26, 25, 47, 48, 48, 49, 50, 50, 49, 49,
+ 48, 48, 48, 44, 43, 41, 38, 38, 36, 35, 34, 32, 32, 31, 31, 30, 29, 29,
+ 27, 27, 27, 26, 26, 25, 43, 45, 45, 46, 47, 47, 46, 46, 46, 46, 46, 42,
+ 41, 39, 37, 37, 34, 34, 33, 31, 31, 29, 29, 28, 27, 27, 26, 26, 25, 24,
+ 24, 23, 42, 44, 44, 45, 46, 46, 45, 45, 45, 45, 45, 41, 40, 39, 36, 36,
+ 34, 34, 32, 31, 31, 29, 29, 28, 27, 27, 26, 25, 25, 24, 24, 23, 41, 42,
+ 42, 43, 44, 44, 44, 44, 44, 44, 44, 40, 39, 38, 35, 35, 33, 33, 32, 30,
+ 30, 28, 28, 27, 26, 26, 25, 25, 24, 23, 23, 22, 38, 39, 40, 41, 41, 41,
+ 41, 41, 41, 41, 41, 38, 38, 36, 34, 34, 32, 32, 30, 29, 29, 27, 27, 26,
+ 25, 25, 24, 24, 23, 22, 22, 21, 38, 39, 40, 41, 41, 41, 41, 41, 41, 41,
+ 41, 38, 38, 36, 34, 34, 32, 32, 30, 29, 29, 27, 27, 26, 25, 25, 24, 24,
+ 23, 22, 22, 21, 35, 37, 37, 38, 39, 39, 39, 39, 39, 39, 39, 36, 36, 34,
+ 33, 33, 31, 30, 29, 27, 27, 26, 26, 25, 24, 24, 23, 23, 22, 21, 21, 20,
+ 35, 36, 36, 37, 38, 38, 38, 38, 38, 38, 38, 36, 35, 34, 32, 32, 30, 30,
+ 29, 27, 27, 26, 25, 25, 24, 24, 23, 22, 22, 21, 21, 20, 33, 35, 35, 36,
+ 37, 37, 37, 37, 37, 37, 37, 35, 34, 33, 31, 31, 29, 29, 28, 27, 27, 25,
+ 25, 24, 23, 23, 22, 22, 21, 20, 20, 19, 31, 33, 33, 34, 34, 34, 34, 35,
+ 35, 35, 35, 33, 33, 32, 30, 30, 28, 28, 27, 26, 26, 24, 24, 23, 22, 22,
+ 21, 21, 20, 20, 20, 19, 31, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 33,
+ 33, 32, 30, 30, 28, 28, 27, 26, 26, 24, 24, 23, 22, 22, 21, 21, 20, 20,
+ 20, 19, 29, 30, 31, 31, 32, 32, 32, 32, 33, 33, 33, 31, 31, 30, 28, 28,
+ 27, 27, 26, 25, 25, 23, 23, 22, 21, 21, 20, 20, 19, 19, 19, 18,
+ /* Size 4x8 */
+ 64, 63, 48, 37, 64, 62, 50, 39, 63, 58, 48, 39, 59, 55, 41, 34, 54, 51,
+ 35, 30, 46, 45, 31, 26, 41, 41, 29, 24, 34, 35, 26, 21,
+ /* Size 8x4 */
+ 64, 64, 63, 59, 54, 46, 41, 34, 63, 62, 58, 55, 51, 45, 41, 35, 48, 50,
+ 48, 41, 35, 31, 29, 26, 37, 39, 39, 34, 30, 26, 24, 21,
+ /* Size 8x16 */
+ 64, 65, 64, 59, 53, 47, 38, 31, 65, 64, 63, 59, 54, 48, 40, 33, 65, 63,
+ 62, 60, 55, 50, 41, 34, 65, 63, 60, 58, 53, 49, 41, 35, 64, 63, 59, 56,
+ 53, 48, 41, 35, 64, 62, 58, 55, 51, 48, 41, 35, 60, 60, 55, 49, 46, 43,
+ 38, 33, 57, 59, 53, 45, 41, 38, 34, 30, 53, 55, 51, 43, 39, 36, 32, 28,
+ 50, 53, 49, 41, 38, 34, 30, 27, 47, 50, 48, 40, 36, 33, 29, 26, 43, 46,
+ 44, 38, 34, 31, 27, 24, 38, 41, 41, 36, 32, 29, 25, 22, 36, 39, 39, 34,
+ 31, 27, 24, 21, 34, 36, 37, 33, 29, 27, 23, 20, 32, 34, 35, 31, 28, 26,
+ 22, 20,
+ /* Size 16x8 */
+ 64, 65, 65, 65, 64, 64, 60, 57, 53, 50, 47, 43, 38, 36, 34, 32, 65, 64,
+ 63, 63, 63, 62, 60, 59, 55, 53, 50, 46, 41, 39, 36, 34, 64, 63, 62, 60,
+ 59, 58, 55, 53, 51, 49, 48, 44, 41, 39, 37, 35, 59, 59, 60, 58, 56, 55,
+ 49, 45, 43, 41, 40, 38, 36, 34, 33, 31, 53, 54, 55, 53, 53, 51, 46, 41,
+ 39, 38, 36, 34, 32, 31, 29, 28, 47, 48, 50, 49, 48, 48, 43, 38, 36, 34,
+ 33, 31, 29, 27, 27, 26, 38, 40, 41, 41, 41, 41, 38, 34, 32, 30, 29, 27,
+ 25, 24, 23, 22, 31, 33, 34, 35, 35, 35, 33, 30, 28, 27, 26, 24, 22, 21,
+ 20, 20,
+ /* Size 16x32 */
+ 64, 65, 65, 65, 64, 64, 59, 57, 53, 47, 47, 40, 38, 35, 31, 31, 65, 64,
+ 64, 64, 63, 63, 59, 58, 54, 48, 48, 41, 39, 37, 33, 33, 65, 64, 64, 64,
+ 63, 63, 59, 58, 54, 48, 48, 41, 40, 37, 33, 33, 65, 64, 64, 63, 63, 63,
+ 59, 59, 55, 49, 49, 42, 41, 38, 34, 34, 65, 64, 63, 63, 62, 62, 60, 59,
+ 55, 50, 50, 43, 41, 39, 34, 34, 65, 64, 63, 63, 62, 62, 60, 59, 55, 50,
+ 50, 43, 41, 39, 34, 34, 65, 63, 63, 62, 60, 60, 58, 57, 53, 49, 49, 43,
+ 41, 39, 35, 35, 64, 63, 63, 62, 60, 60, 57, 56, 53, 49, 49, 43, 41, 39,
+ 35, 35, 64, 63, 63, 61, 59, 59, 56, 55, 53, 48, 48, 43, 41, 39, 35, 35,
+ 64, 63, 62, 60, 58, 58, 55, 53, 51, 48, 48, 43, 41, 39, 35, 35, 64, 63,
+ 62, 60, 58, 58, 55, 53, 51, 48, 48, 43, 41, 39, 35, 35, 61, 61, 61, 59,
+ 56, 56, 51, 49, 47, 44, 44, 39, 38, 36, 33, 33, 60, 60, 60, 59, 55, 55,
+ 49, 48, 46, 43, 43, 39, 38, 36, 33, 33, 59, 59, 60, 58, 55, 55, 48, 46,
+ 44, 41, 41, 37, 36, 34, 32, 32, 57, 59, 59, 57, 53, 53, 45, 43, 41, 38,
+ 38, 35, 34, 33, 30, 30, 57, 59, 59, 57, 53, 53, 45, 43, 41, 38, 38, 35,
+ 34, 33, 30, 30, 53, 55, 55, 53, 51, 51, 43, 41, 39, 36, 36, 33, 32, 31,
+ 28, 28, 52, 54, 55, 53, 51, 51, 43, 41, 39, 35, 35, 32, 32, 30, 28, 28,
+ 50, 52, 53, 51, 49, 49, 41, 40, 38, 34, 34, 31, 30, 29, 27, 27, 47, 49,
+ 50, 49, 48, 48, 40, 38, 36, 33, 33, 29, 29, 27, 26, 26, 47, 49, 50, 49,
+ 48, 48, 40, 38, 36, 33, 33, 29, 29, 27, 26, 26, 44, 46, 47, 46, 45, 45,
+ 38, 37, 34, 31, 31, 28, 27, 26, 24, 24, 43, 45, 46, 45, 44, 44, 38, 36,
+ 34, 31, 31, 28, 27, 26, 24, 24, 41, 43, 44, 44, 43, 43, 37, 35, 33, 30,
+ 30, 27, 26, 25, 23, 23, 38, 41, 41, 41, 41, 41, 36, 34, 32, 29, 29, 26,
+ 25, 24, 22, 22, 38, 41, 41, 41, 41, 41, 36, 34, 32, 29, 29, 26, 25, 24,
+ 22, 22, 36, 38, 39, 39, 39, 39, 34, 33, 31, 27, 27, 25, 24, 23, 21, 21,
+ 35, 37, 38, 38, 38, 38, 33, 32, 30, 27, 27, 24, 24, 23, 21, 21, 34, 36,
+ 36, 37, 37, 37, 33, 31, 29, 27, 27, 24, 23, 22, 20, 20, 32, 34, 34, 34,
+ 35, 35, 31, 30, 28, 26, 26, 23, 22, 21, 20, 20, 32, 34, 34, 34, 35, 35,
+ 31, 30, 28, 26, 26, 23, 22, 21, 20, 20, 29, 32, 32, 32, 33, 33, 29, 28,
+ 27, 25, 25, 22, 21, 20, 19, 19,
+ /* Size 32x16 */
+ 64, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 61, 60, 59, 57, 57, 53, 52,
+ 50, 47, 47, 44, 43, 41, 38, 38, 36, 35, 34, 32, 32, 29, 65, 64, 64, 64,
+ 64, 64, 63, 63, 63, 63, 63, 61, 60, 59, 59, 59, 55, 54, 52, 49, 49, 46,
+ 45, 43, 41, 41, 38, 37, 36, 34, 34, 32, 65, 64, 64, 64, 63, 63, 63, 63,
+ 63, 62, 62, 61, 60, 60, 59, 59, 55, 55, 53, 50, 50, 47, 46, 44, 41, 41,
+ 39, 38, 36, 34, 34, 32, 65, 64, 64, 63, 63, 63, 62, 62, 61, 60, 60, 59,
+ 59, 58, 57, 57, 53, 53, 51, 49, 49, 46, 45, 44, 41, 41, 39, 38, 37, 34,
+ 34, 32, 64, 63, 63, 63, 62, 62, 60, 60, 59, 58, 58, 56, 55, 55, 53, 53,
+ 51, 51, 49, 48, 48, 45, 44, 43, 41, 41, 39, 38, 37, 35, 35, 33, 64, 63,
+ 63, 63, 62, 62, 60, 60, 59, 58, 58, 56, 55, 55, 53, 53, 51, 51, 49, 48,
+ 48, 45, 44, 43, 41, 41, 39, 38, 37, 35, 35, 33, 59, 59, 59, 59, 60, 60,
+ 58, 57, 56, 55, 55, 51, 49, 48, 45, 45, 43, 43, 41, 40, 40, 38, 38, 37,
+ 36, 36, 34, 33, 33, 31, 31, 29, 57, 58, 58, 59, 59, 59, 57, 56, 55, 53,
+ 53, 49, 48, 46, 43, 43, 41, 41, 40, 38, 38, 37, 36, 35, 34, 34, 33, 32,
+ 31, 30, 30, 28, 53, 54, 54, 55, 55, 55, 53, 53, 53, 51, 51, 47, 46, 44,
+ 41, 41, 39, 39, 38, 36, 36, 34, 34, 33, 32, 32, 31, 30, 29, 28, 28, 27,
+ 47, 48, 48, 49, 50, 50, 49, 49, 48, 48, 48, 44, 43, 41, 38, 38, 36, 35,
+ 34, 33, 33, 31, 31, 30, 29, 29, 27, 27, 27, 26, 26, 25, 47, 48, 48, 49,
+ 50, 50, 49, 49, 48, 48, 48, 44, 43, 41, 38, 38, 36, 35, 34, 33, 33, 31,
+ 31, 30, 29, 29, 27, 27, 27, 26, 26, 25, 40, 41, 41, 42, 43, 43, 43, 43,
+ 43, 43, 43, 39, 39, 37, 35, 35, 33, 32, 31, 29, 29, 28, 28, 27, 26, 26,
+ 25, 24, 24, 23, 23, 22, 38, 39, 40, 41, 41, 41, 41, 41, 41, 41, 41, 38,
+ 38, 36, 34, 34, 32, 32, 30, 29, 29, 27, 27, 26, 25, 25, 24, 24, 23, 22,
+ 22, 21, 35, 37, 37, 38, 39, 39, 39, 39, 39, 39, 39, 36, 36, 34, 33, 33,
+ 31, 30, 29, 27, 27, 26, 26, 25, 24, 24, 23, 23, 22, 21, 21, 20, 31, 33,
+ 33, 34, 34, 34, 35, 35, 35, 35, 35, 33, 33, 32, 30, 30, 28, 28, 27, 26,
+ 26, 24, 24, 23, 22, 22, 21, 21, 20, 20, 20, 19, 31, 33, 33, 34, 34, 34,
+ 35, 35, 35, 35, 35, 33, 33, 32, 30, 30, 28, 28, 27, 26, 26, 24, 24, 23,
+ 22, 22, 21, 21, 20, 20, 20, 19,
+ /* Size 4x16 */
+ 65, 64, 47, 35, 64, 63, 48, 37, 64, 62, 50, 39, 63, 60, 49, 39, 63, 59,
+ 48, 39, 63, 58, 48, 39, 60, 55, 43, 36, 59, 53, 38, 33, 55, 51, 36, 31,
+ 52, 49, 34, 29, 49, 48, 33, 27, 45, 44, 31, 26, 41, 41, 29, 24, 38, 39,
+ 27, 23, 36, 37, 27, 22, 34, 35, 26, 21,
+ /* Size 16x4 */
+ 65, 64, 64, 63, 63, 63, 60, 59, 55, 52, 49, 45, 41, 38, 36, 34, 64, 63,
+ 62, 60, 59, 58, 55, 53, 51, 49, 48, 44, 41, 39, 37, 35, 47, 48, 50, 49,
+ 48, 48, 43, 38, 36, 34, 33, 31, 29, 27, 27, 26, 35, 37, 39, 39, 39, 39,
+ 36, 33, 31, 29, 27, 26, 24, 23, 22, 21,
+ /* Size 8x32 */
+ 64, 65, 64, 59, 53, 47, 38, 31, 65, 64, 63, 59, 54, 48, 39, 33, 65, 64,
+ 63, 59, 54, 48, 40, 33, 65, 64, 63, 59, 55, 49, 41, 34, 65, 63, 62, 60,
+ 55, 50, 41, 34, 65, 63, 62, 60, 55, 50, 41, 34, 65, 63, 60, 58, 53, 49,
+ 41, 35, 64, 63, 60, 57, 53, 49, 41, 35, 64, 63, 59, 56, 53, 48, 41, 35,
+ 64, 62, 58, 55, 51, 48, 41, 35, 64, 62, 58, 55, 51, 48, 41, 35, 61, 61,
+ 56, 51, 47, 44, 38, 33, 60, 60, 55, 49, 46, 43, 38, 33, 59, 60, 55, 48,
+ 44, 41, 36, 32, 57, 59, 53, 45, 41, 38, 34, 30, 57, 59, 53, 45, 41, 38,
+ 34, 30, 53, 55, 51, 43, 39, 36, 32, 28, 52, 55, 51, 43, 39, 35, 32, 28,
+ 50, 53, 49, 41, 38, 34, 30, 27, 47, 50, 48, 40, 36, 33, 29, 26, 47, 50,
+ 48, 40, 36, 33, 29, 26, 44, 47, 45, 38, 34, 31, 27, 24, 43, 46, 44, 38,
+ 34, 31, 27, 24, 41, 44, 43, 37, 33, 30, 26, 23, 38, 41, 41, 36, 32, 29,
+ 25, 22, 38, 41, 41, 36, 32, 29, 25, 22, 36, 39, 39, 34, 31, 27, 24, 21,
+ 35, 38, 38, 33, 30, 27, 24, 21, 34, 36, 37, 33, 29, 27, 23, 20, 32, 34,
+ 35, 31, 28, 26, 22, 20, 32, 34, 35, 31, 28, 26, 22, 20, 29, 32, 33, 29,
+ 27, 25, 21, 19,
+ /* Size 32x8 */
+ 64, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 61, 60, 59, 57, 57, 53, 52,
+ 50, 47, 47, 44, 43, 41, 38, 38, 36, 35, 34, 32, 32, 29, 65, 64, 64, 64,
+ 63, 63, 63, 63, 63, 62, 62, 61, 60, 60, 59, 59, 55, 55, 53, 50, 50, 47,
+ 46, 44, 41, 41, 39, 38, 36, 34, 34, 32, 64, 63, 63, 63, 62, 62, 60, 60,
+ 59, 58, 58, 56, 55, 55, 53, 53, 51, 51, 49, 48, 48, 45, 44, 43, 41, 41,
+ 39, 38, 37, 35, 35, 33, 59, 59, 59, 59, 60, 60, 58, 57, 56, 55, 55, 51,
+ 49, 48, 45, 45, 43, 43, 41, 40, 40, 38, 38, 37, 36, 36, 34, 33, 33, 31,
+ 31, 29, 53, 54, 54, 55, 55, 55, 53, 53, 53, 51, 51, 47, 46, 44, 41, 41,
+ 39, 39, 38, 36, 36, 34, 34, 33, 32, 32, 31, 30, 29, 28, 28, 27, 47, 48,
+ 48, 49, 50, 50, 49, 49, 48, 48, 48, 44, 43, 41, 38, 38, 36, 35, 34, 33,
+ 33, 31, 31, 30, 29, 29, 27, 27, 27, 26, 26, 25, 38, 39, 40, 41, 41, 41,
+ 41, 41, 41, 41, 41, 38, 38, 36, 34, 34, 32, 32, 30, 29, 29, 27, 27, 26,
+ 25, 25, 24, 24, 23, 22, 22, 21, 31, 33, 33, 34, 34, 34, 35, 35, 35, 35,
+ 35, 33, 33, 32, 30, 30, 28, 28, 27, 26, 26, 24, 24, 23, 22, 22, 21, 21,
+ 20, 20, 20, 19 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 53, 44, 44, 32,
+#endif
+ /* Size 4x4 */
+ 65, 49, 45, 40, 49, 43, 42, 40, 45, 42, 35, 33, 40, 40, 33, 29,
+ /* Size 8x8 */
+ 65, 66, 54, 46, 43, 42, 41, 37, 66, 64, 51, 47, 45, 45, 43, 39, 54, 51,
+ 43, 43, 44, 45, 44, 41, 46, 47, 43, 41, 40, 40, 39, 38, 43, 45, 44, 40,
+ 38, 36, 36, 34, 42, 45, 45, 40, 36, 34, 33, 31, 41, 43, 44, 39, 36, 33,
+ 31, 29, 37, 39, 41, 38, 34, 31, 29, 27,
+ /* Size 16x16 */
+ 64, 66, 67, 62, 59, 56, 49, 42, 42, 42, 42, 41, 39, 38, 37, 36, 66, 65,
+ 66, 60, 57, 53, 48, 43, 44, 44, 44, 42, 41, 40, 39, 38, 67, 66, 64, 59,
+ 55, 51, 48, 44, 45, 45, 46, 44, 43, 41, 41, 39, 62, 60, 59, 55, 51, 48,
+ 46, 44, 44, 45, 45, 44, 43, 42, 41, 40, 59, 57, 55, 51, 48, 46, 45, 43,
+ 44, 45, 45, 44, 44, 42, 41, 41, 56, 53, 51, 48, 46, 43, 43, 43, 44, 45,
+ 45, 45, 44, 43, 42, 41, 49, 48, 48, 46, 45, 43, 42, 41, 41, 41, 42, 41,
+ 41, 40, 39, 38, 42, 43, 44, 44, 43, 43, 41, 39, 39, 38, 38, 38, 38, 37,
+ 37, 36, 42, 44, 45, 44, 44, 44, 41, 39, 38, 38, 37, 37, 36, 35, 35, 35,
+ 42, 44, 45, 45, 45, 45, 41, 38, 38, 37, 36, 35, 35, 34, 34, 33, 42, 44,
+ 46, 45, 45, 45, 42, 38, 37, 36, 35, 34, 33, 33, 33, 32, 41, 42, 44, 44,
+ 44, 45, 41, 38, 37, 35, 34, 33, 32, 32, 31, 31, 39, 41, 43, 43, 44, 44,
+ 41, 38, 36, 35, 33, 32, 31, 30, 29, 29, 38, 40, 41, 42, 42, 43, 40, 37,
+ 35, 34, 33, 32, 30, 29, 29, 28, 37, 39, 41, 41, 41, 42, 39, 37, 35, 34,
+ 33, 31, 29, 29, 28, 27, 36, 38, 39, 40, 41, 41, 38, 36, 35, 33, 32, 31,
+ 29, 28, 27, 27,
+ /* Size 32x32 */
+ 64, 65, 66, 66, 67, 67, 62, 61, 59, 56, 56, 51, 49, 46, 42, 42, 42, 42,
+ 42, 42, 42, 41, 41, 40, 39, 39, 38, 38, 37, 36, 36, 34, 65, 65, 65, 66,
+ 66, 66, 61, 59, 57, 54, 54, 49, 49, 46, 43, 43, 43, 43, 43, 43, 43, 42,
+ 42, 41, 41, 41, 39, 39, 38, 37, 37, 36, 66, 65, 65, 65, 66, 66, 60, 59,
+ 57, 53, 53, 49, 48, 46, 43, 43, 44, 44, 44, 44, 44, 43, 42, 42, 41, 41,
+ 40, 39, 39, 38, 38, 36, 66, 66, 65, 65, 65, 65, 60, 59, 56, 53, 53, 49,
+ 48, 47, 44, 44, 44, 44, 44, 45, 45, 43, 43, 43, 42, 42, 41, 40, 39, 38,
+ 38, 37, 67, 66, 66, 65, 64, 64, 59, 58, 55, 51, 51, 49, 48, 47, 44, 44,
+ 45, 45, 45, 46, 46, 45, 44, 44, 43, 43, 41, 41, 41, 39, 39, 38, 67, 66,
+ 66, 65, 64, 64, 59, 58, 55, 51, 51, 49, 48, 47, 44, 44, 45, 45, 45, 46,
+ 46, 45, 44, 44, 43, 43, 41, 41, 41, 39, 39, 38, 62, 61, 60, 60, 59, 59,
+ 55, 53, 51, 48, 48, 47, 46, 45, 44, 44, 44, 45, 45, 45, 45, 44, 44, 44,
+ 43, 43, 42, 41, 41, 40, 40, 39, 61, 59, 59, 59, 58, 58, 53, 53, 51, 47,
+ 47, 46, 46, 45, 43, 43, 44, 44, 45, 45, 45, 44, 44, 44, 43, 43, 42, 41,
+ 41, 40, 40, 39, 59, 57, 57, 56, 55, 55, 51, 51, 48, 46, 46, 45, 45, 44,
+ 43, 43, 44, 44, 45, 45, 45, 45, 44, 44, 44, 44, 42, 42, 41, 41, 41, 39,
+ 56, 54, 53, 53, 51, 51, 48, 47, 46, 43, 43, 43, 43, 43, 43, 43, 44, 44,
+ 45, 45, 45, 45, 45, 44, 44, 44, 43, 42, 42, 41, 41, 40, 56, 54, 53, 53,
+ 51, 51, 48, 47, 46, 43, 43, 43, 43, 43, 43, 43, 44, 44, 45, 45, 45, 45,
+ 45, 44, 44, 44, 43, 42, 42, 41, 41, 40, 51, 49, 49, 49, 49, 49, 47, 46,
+ 45, 43, 43, 43, 42, 42, 41, 41, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41,
+ 40, 40, 40, 39, 39, 38, 49, 49, 48, 48, 48, 48, 46, 46, 45, 43, 43, 42,
+ 42, 41, 41, 41, 41, 41, 41, 42, 42, 41, 41, 41, 41, 41, 40, 39, 39, 38,
+ 38, 37, 46, 46, 46, 47, 47, 47, 45, 45, 44, 43, 43, 42, 41, 41, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 39, 39, 39, 38, 38, 38, 38, 37, 42, 43,
+ 43, 44, 44, 44, 44, 43, 43, 43, 43, 41, 41, 40, 39, 39, 39, 39, 38, 38,
+ 38, 38, 38, 38, 38, 38, 37, 37, 37, 36, 36, 35, 42, 43, 43, 44, 44, 44,
+ 44, 43, 43, 43, 43, 41, 41, 40, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38,
+ 38, 38, 37, 37, 37, 36, 36, 35, 42, 43, 44, 44, 45, 45, 44, 44, 44, 44,
+ 44, 42, 41, 40, 39, 39, 38, 38, 38, 37, 37, 37, 37, 36, 36, 36, 35, 35,
+ 35, 35, 35, 34, 42, 43, 44, 44, 45, 45, 45, 44, 44, 44, 44, 42, 41, 40,
+ 39, 39, 38, 38, 37, 37, 37, 36, 36, 36, 36, 36, 35, 35, 35, 34, 34, 33,
+ 42, 43, 44, 44, 45, 45, 45, 45, 45, 45, 45, 42, 41, 40, 38, 38, 38, 37,
+ 37, 36, 36, 36, 35, 35, 35, 35, 34, 34, 34, 33, 33, 33, 42, 43, 44, 45,
+ 46, 46, 45, 45, 45, 45, 45, 42, 42, 40, 38, 38, 37, 37, 36, 35, 35, 34,
+ 34, 34, 33, 33, 33, 33, 33, 32, 32, 32, 42, 43, 44, 45, 46, 46, 45, 45,
+ 45, 45, 45, 42, 42, 40, 38, 38, 37, 37, 36, 35, 35, 34, 34, 34, 33, 33,
+ 33, 33, 33, 32, 32, 32, 41, 42, 43, 43, 45, 45, 44, 44, 45, 45, 45, 42,
+ 41, 40, 38, 38, 37, 36, 36, 34, 34, 34, 34, 33, 33, 33, 32, 32, 31, 31,
+ 31, 30, 41, 42, 42, 43, 44, 44, 44, 44, 44, 45, 45, 42, 41, 40, 38, 38,
+ 37, 36, 35, 34, 34, 34, 33, 33, 32, 32, 32, 32, 31, 31, 31, 30, 40, 41,
+ 42, 43, 44, 44, 44, 44, 44, 44, 44, 41, 41, 40, 38, 38, 36, 36, 35, 34,
+ 34, 33, 33, 32, 32, 32, 31, 31, 31, 30, 30, 29, 39, 41, 41, 42, 43, 43,
+ 43, 43, 44, 44, 44, 41, 41, 39, 38, 38, 36, 36, 35, 33, 33, 33, 32, 32,
+ 31, 31, 30, 30, 29, 29, 29, 28, 39, 41, 41, 42, 43, 43, 43, 43, 44, 44,
+ 44, 41, 41, 39, 38, 38, 36, 36, 35, 33, 33, 33, 32, 32, 31, 31, 30, 30,
+ 29, 29, 29, 28, 38, 39, 40, 41, 41, 41, 42, 42, 42, 43, 43, 40, 40, 39,
+ 37, 37, 35, 35, 34, 33, 33, 32, 32, 31, 30, 30, 29, 29, 29, 28, 28, 27,
+ 38, 39, 39, 40, 41, 41, 41, 41, 42, 42, 42, 40, 39, 38, 37, 37, 35, 35,
+ 34, 33, 33, 32, 32, 31, 30, 30, 29, 29, 28, 28, 28, 27, 37, 38, 39, 39,
+ 41, 41, 41, 41, 41, 42, 42, 40, 39, 38, 37, 37, 35, 35, 34, 33, 33, 31,
+ 31, 31, 29, 29, 29, 28, 28, 27, 27, 27, 36, 37, 38, 38, 39, 39, 40, 40,
+ 41, 41, 41, 39, 38, 38, 36, 36, 35, 34, 33, 32, 32, 31, 31, 30, 29, 29,
+ 28, 28, 27, 27, 27, 26, 36, 37, 38, 38, 39, 39, 40, 40, 41, 41, 41, 39,
+ 38, 38, 36, 36, 35, 34, 33, 32, 32, 31, 31, 30, 29, 29, 28, 28, 27, 27,
+ 27, 26, 34, 36, 36, 37, 38, 38, 39, 39, 39, 40, 40, 38, 37, 37, 35, 35,
+ 34, 33, 33, 32, 32, 30, 30, 29, 28, 28, 27, 27, 27, 26, 26, 25,
+ /* Size 4x8 */
+ 65, 54, 43, 39, 64, 51, 45, 41, 52, 44, 45, 43, 46, 43, 40, 39, 44, 44,
+ 37, 35, 44, 44, 34, 32, 42, 43, 34, 30, 39, 41, 32, 28,
+ /* Size 8x4 */
+ 65, 64, 52, 46, 44, 44, 42, 39, 54, 51, 44, 43, 44, 44, 43, 41, 43, 45,
+ 45, 40, 37, 34, 34, 32, 39, 41, 43, 39, 35, 32, 30, 28,
+ /* Size 8x16 */
+ 64, 66, 55, 45, 42, 42, 39, 36, 65, 65, 53, 46, 44, 44, 41, 38, 67, 64,
+ 51, 46, 45, 45, 43, 39, 62, 59, 48, 45, 44, 45, 43, 40, 59, 55, 46, 44,
+ 44, 45, 43, 40, 55, 51, 44, 43, 44, 45, 44, 41, 49, 48, 43, 41, 41, 41,
+ 41, 38, 42, 44, 43, 39, 39, 38, 38, 36, 42, 45, 44, 40, 38, 37, 36, 34,
+ 42, 45, 44, 40, 38, 36, 35, 33, 42, 45, 45, 40, 37, 35, 33, 32, 41, 44,
+ 44, 39, 37, 34, 32, 31, 39, 43, 43, 39, 36, 34, 31, 29, 38, 41, 42, 38,
+ 35, 33, 30, 28, 37, 40, 41, 38, 35, 33, 29, 27, 36, 39, 41, 37, 34, 32,
+ 29, 27,
+ /* Size 16x8 */
+ 64, 65, 67, 62, 59, 55, 49, 42, 42, 42, 42, 41, 39, 38, 37, 36, 66, 65,
+ 64, 59, 55, 51, 48, 44, 45, 45, 45, 44, 43, 41, 40, 39, 55, 53, 51, 48,
+ 46, 44, 43, 43, 44, 44, 45, 44, 43, 42, 41, 41, 45, 46, 46, 45, 44, 43,
+ 41, 39, 40, 40, 40, 39, 39, 38, 38, 37, 42, 44, 45, 44, 44, 44, 41, 39,
+ 38, 38, 37, 37, 36, 35, 35, 34, 42, 44, 45, 45, 45, 45, 41, 38, 37, 36,
+ 35, 34, 34, 33, 33, 32, 39, 41, 43, 43, 43, 44, 41, 38, 36, 35, 33, 32,
+ 31, 30, 29, 29, 36, 38, 39, 40, 40, 41, 38, 36, 34, 33, 32, 31, 29, 28,
+ 27, 27,
+ /* Size 16x32 */
+ 64, 66, 66, 62, 55, 55, 45, 43, 42, 42, 42, 40, 39, 38, 36, 36, 65, 65,
+ 65, 60, 54, 54, 46, 43, 43, 43, 43, 41, 41, 39, 37, 37, 65, 65, 65, 60,
+ 53, 53, 46, 44, 44, 44, 44, 41, 41, 40, 38, 38, 66, 65, 64, 59, 53, 53,
+ 46, 44, 44, 44, 44, 42, 42, 40, 38, 38, 67, 64, 64, 59, 51, 51, 46, 45,
+ 45, 45, 45, 43, 43, 41, 39, 39, 67, 64, 64, 59, 51, 51, 46, 45, 45, 45,
+ 45, 43, 43, 41, 39, 39, 62, 59, 59, 55, 48, 48, 45, 44, 44, 45, 45, 43,
+ 43, 42, 40, 40, 61, 58, 57, 53, 48, 48, 45, 44, 44, 45, 45, 43, 43, 42,
+ 40, 40, 59, 55, 55, 51, 46, 46, 44, 43, 44, 45, 45, 44, 43, 42, 40, 40,
+ 55, 52, 51, 48, 44, 44, 43, 43, 44, 45, 45, 44, 44, 43, 41, 41, 55, 52,
+ 51, 48, 44, 44, 43, 43, 44, 45, 45, 44, 44, 43, 41, 41, 50, 49, 48, 47,
+ 43, 43, 42, 41, 42, 42, 42, 41, 41, 40, 39, 39, 49, 48, 48, 46, 43, 43,
+ 41, 41, 41, 41, 41, 41, 41, 40, 38, 38, 46, 46, 46, 45, 43, 43, 41, 40,
+ 40, 40, 40, 39, 39, 39, 38, 38, 42, 44, 44, 44, 43, 43, 39, 39, 39, 38,
+ 38, 38, 38, 37, 36, 36, 42, 44, 44, 44, 43, 43, 39, 39, 39, 38, 38, 38,
+ 38, 37, 36, 36, 42, 44, 45, 44, 44, 44, 40, 39, 38, 37, 37, 36, 36, 35,
+ 34, 34, 42, 44, 45, 44, 44, 44, 40, 39, 38, 37, 37, 36, 36, 35, 34, 34,
+ 42, 45, 45, 45, 44, 44, 40, 39, 38, 36, 36, 35, 35, 34, 33, 33, 42, 45,
+ 45, 45, 45, 45, 40, 38, 37, 35, 35, 34, 33, 33, 32, 32, 42, 45, 45, 45,
+ 45, 45, 40, 38, 37, 35, 35, 34, 33, 33, 32, 32, 41, 44, 44, 44, 44, 44,
+ 39, 38, 37, 34, 34, 33, 32, 32, 31, 31, 41, 43, 44, 44, 44, 44, 39, 38,
+ 37, 34, 34, 33, 32, 32, 31, 31, 40, 43, 44, 44, 44, 44, 39, 38, 36, 34,
+ 34, 32, 32, 31, 30, 30, 39, 42, 43, 43, 43, 43, 39, 38, 36, 34, 34, 31,
+ 31, 30, 29, 29, 39, 42, 43, 43, 43, 43, 39, 38, 36, 34, 34, 31, 31, 30,
+ 29, 29, 38, 41, 41, 42, 42, 42, 38, 37, 35, 33, 33, 31, 30, 29, 28, 28,
+ 38, 40, 41, 41, 42, 42, 38, 37, 35, 33, 33, 31, 30, 29, 28, 28, 37, 40,
+ 40, 41, 41, 41, 38, 37, 35, 33, 33, 30, 29, 29, 27, 27, 36, 39, 39, 40,
+ 41, 41, 37, 36, 34, 32, 32, 30, 29, 28, 27, 27, 36, 39, 39, 40, 41, 41,
+ 37, 36, 34, 32, 32, 30, 29, 28, 27, 27, 35, 37, 38, 38, 39, 39, 36, 35,
+ 34, 32, 32, 29, 28, 27, 26, 26,
+ /* Size 32x16 */
+ 64, 65, 65, 66, 67, 67, 62, 61, 59, 55, 55, 50, 49, 46, 42, 42, 42, 42,
+ 42, 42, 42, 41, 41, 40, 39, 39, 38, 38, 37, 36, 36, 35, 66, 65, 65, 65,
+ 64, 64, 59, 58, 55, 52, 52, 49, 48, 46, 44, 44, 44, 44, 45, 45, 45, 44,
+ 43, 43, 42, 42, 41, 40, 40, 39, 39, 37, 66, 65, 65, 64, 64, 64, 59, 57,
+ 55, 51, 51, 48, 48, 46, 44, 44, 45, 45, 45, 45, 45, 44, 44, 44, 43, 43,
+ 41, 41, 40, 39, 39, 38, 62, 60, 60, 59, 59, 59, 55, 53, 51, 48, 48, 47,
+ 46, 45, 44, 44, 44, 44, 45, 45, 45, 44, 44, 44, 43, 43, 42, 41, 41, 40,
+ 40, 38, 55, 54, 53, 53, 51, 51, 48, 48, 46, 44, 44, 43, 43, 43, 43, 43,
+ 44, 44, 44, 45, 45, 44, 44, 44, 43, 43, 42, 42, 41, 41, 41, 39, 55, 54,
+ 53, 53, 51, 51, 48, 48, 46, 44, 44, 43, 43, 43, 43, 43, 44, 44, 44, 45,
+ 45, 44, 44, 44, 43, 43, 42, 42, 41, 41, 41, 39, 45, 46, 46, 46, 46, 46,
+ 45, 45, 44, 43, 43, 42, 41, 41, 39, 39, 40, 40, 40, 40, 40, 39, 39, 39,
+ 39, 39, 38, 38, 38, 37, 37, 36, 43, 43, 44, 44, 45, 45, 44, 44, 43, 43,
+ 43, 41, 41, 40, 39, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 38, 37, 37,
+ 37, 36, 36, 35, 42, 43, 44, 44, 45, 45, 44, 44, 44, 44, 44, 42, 41, 40,
+ 39, 39, 38, 38, 38, 37, 37, 37, 37, 36, 36, 36, 35, 35, 35, 34, 34, 34,
+ 42, 43, 44, 44, 45, 45, 45, 45, 45, 45, 45, 42, 41, 40, 38, 38, 37, 37,
+ 36, 35, 35, 34, 34, 34, 34, 34, 33, 33, 33, 32, 32, 32, 42, 43, 44, 44,
+ 45, 45, 45, 45, 45, 45, 45, 42, 41, 40, 38, 38, 37, 37, 36, 35, 35, 34,
+ 34, 34, 34, 34, 33, 33, 33, 32, 32, 32, 40, 41, 41, 42, 43, 43, 43, 43,
+ 44, 44, 44, 41, 41, 39, 38, 38, 36, 36, 35, 34, 34, 33, 33, 32, 31, 31,
+ 31, 31, 30, 30, 30, 29, 39, 41, 41, 42, 43, 43, 43, 43, 43, 44, 44, 41,
+ 41, 39, 38, 38, 36, 36, 35, 33, 33, 32, 32, 32, 31, 31, 30, 30, 29, 29,
+ 29, 28, 38, 39, 40, 40, 41, 41, 42, 42, 42, 43, 43, 40, 40, 39, 37, 37,
+ 35, 35, 34, 33, 33, 32, 32, 31, 30, 30, 29, 29, 29, 28, 28, 27, 36, 37,
+ 38, 38, 39, 39, 40, 40, 40, 41, 41, 39, 38, 38, 36, 36, 34, 34, 33, 32,
+ 32, 31, 31, 30, 29, 29, 28, 28, 27, 27, 27, 26, 36, 37, 38, 38, 39, 39,
+ 40, 40, 40, 41, 41, 39, 38, 38, 36, 36, 34, 34, 33, 32, 32, 31, 31, 30,
+ 29, 29, 28, 28, 27, 27, 27, 26,
+ /* Size 4x16 */
+ 66, 55, 42, 38, 65, 53, 44, 40, 64, 51, 45, 41, 59, 48, 45, 42, 55, 46,
+ 45, 42, 52, 44, 45, 43, 48, 43, 41, 40, 44, 43, 38, 37, 44, 44, 37, 35,
+ 45, 44, 36, 34, 45, 45, 35, 33, 43, 44, 34, 32, 42, 43, 34, 30, 41, 42,
+ 33, 29, 40, 41, 33, 29, 39, 41, 32, 28,
+ /* Size 16x4 */
+ 66, 65, 64, 59, 55, 52, 48, 44, 44, 45, 45, 43, 42, 41, 40, 39, 55, 53,
+ 51, 48, 46, 44, 43, 43, 44, 44, 45, 44, 43, 42, 41, 41, 42, 44, 45, 45,
+ 45, 45, 41, 38, 37, 36, 35, 34, 34, 33, 33, 32, 38, 40, 41, 42, 42, 43,
+ 40, 37, 35, 34, 33, 32, 30, 29, 29, 28,
+ /* Size 8x32 */
+ 64, 66, 55, 45, 42, 42, 39, 36, 65, 65, 54, 46, 43, 43, 41, 37, 65, 65,
+ 53, 46, 44, 44, 41, 38, 66, 64, 53, 46, 44, 44, 42, 38, 67, 64, 51, 46,
+ 45, 45, 43, 39, 67, 64, 51, 46, 45, 45, 43, 39, 62, 59, 48, 45, 44, 45,
+ 43, 40, 61, 57, 48, 45, 44, 45, 43, 40, 59, 55, 46, 44, 44, 45, 43, 40,
+ 55, 51, 44, 43, 44, 45, 44, 41, 55, 51, 44, 43, 44, 45, 44, 41, 50, 48,
+ 43, 42, 42, 42, 41, 39, 49, 48, 43, 41, 41, 41, 41, 38, 46, 46, 43, 41,
+ 40, 40, 39, 38, 42, 44, 43, 39, 39, 38, 38, 36, 42, 44, 43, 39, 39, 38,
+ 38, 36, 42, 45, 44, 40, 38, 37, 36, 34, 42, 45, 44, 40, 38, 37, 36, 34,
+ 42, 45, 44, 40, 38, 36, 35, 33, 42, 45, 45, 40, 37, 35, 33, 32, 42, 45,
+ 45, 40, 37, 35, 33, 32, 41, 44, 44, 39, 37, 34, 32, 31, 41, 44, 44, 39,
+ 37, 34, 32, 31, 40, 44, 44, 39, 36, 34, 32, 30, 39, 43, 43, 39, 36, 34,
+ 31, 29, 39, 43, 43, 39, 36, 34, 31, 29, 38, 41, 42, 38, 35, 33, 30, 28,
+ 38, 41, 42, 38, 35, 33, 30, 28, 37, 40, 41, 38, 35, 33, 29, 27, 36, 39,
+ 41, 37, 34, 32, 29, 27, 36, 39, 41, 37, 34, 32, 29, 27, 35, 38, 39, 36,
+ 34, 32, 28, 26,
+ /* Size 32x8 */
+ 64, 65, 65, 66, 67, 67, 62, 61, 59, 55, 55, 50, 49, 46, 42, 42, 42, 42,
+ 42, 42, 42, 41, 41, 40, 39, 39, 38, 38, 37, 36, 36, 35, 66, 65, 65, 64,
+ 64, 64, 59, 57, 55, 51, 51, 48, 48, 46, 44, 44, 45, 45, 45, 45, 45, 44,
+ 44, 44, 43, 43, 41, 41, 40, 39, 39, 38, 55, 54, 53, 53, 51, 51, 48, 48,
+ 46, 44, 44, 43, 43, 43, 43, 43, 44, 44, 44, 45, 45, 44, 44, 44, 43, 43,
+ 42, 42, 41, 41, 41, 39, 45, 46, 46, 46, 46, 46, 45, 45, 44, 43, 43, 42,
+ 41, 41, 39, 39, 40, 40, 40, 40, 40, 39, 39, 39, 39, 39, 38, 38, 38, 37,
+ 37, 36, 42, 43, 44, 44, 45, 45, 44, 44, 44, 44, 44, 42, 41, 40, 39, 39,
+ 38, 38, 38, 37, 37, 37, 37, 36, 36, 36, 35, 35, 35, 34, 34, 34, 42, 43,
+ 44, 44, 45, 45, 45, 45, 45, 45, 45, 42, 41, 40, 38, 38, 37, 37, 36, 35,
+ 35, 34, 34, 34, 34, 34, 33, 33, 33, 32, 32, 32, 39, 41, 41, 42, 43, 43,
+ 43, 43, 43, 44, 44, 41, 41, 39, 38, 38, 36, 36, 35, 33, 33, 32, 32, 32,
+ 31, 31, 30, 30, 29, 29, 29, 28, 36, 37, 38, 38, 39, 39, 40, 40, 40, 41,
+ 41, 39, 38, 38, 36, 36, 34, 34, 33, 32, 32, 31, 31, 30, 29, 29, 28, 28,
+ 27, 27, 27, 26 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 62, 48, 48, 32,
+#endif
+ /* Size 4x4 */
+ 64, 63, 53, 40, 63, 58, 51, 42, 53, 51, 38, 32, 40, 42, 32, 25,
+ /* Size 8x8 */
+ 65, 64, 64, 60, 58, 49, 44, 38, 64, 63, 63, 61, 59, 51, 46, 41, 64, 63,
+ 60, 58, 55, 49, 45, 40, 60, 61, 58, 52, 48, 44, 40, 37, 58, 59, 55, 48,
+ 42, 39, 36, 34, 49, 51, 49, 44, 39, 34, 32, 29, 44, 46, 45, 40, 36, 32,
+ 29, 26, 38, 41, 40, 37, 34, 29, 26, 24,
+ /* Size 16x16 */
+ 64, 65, 65, 65, 65, 64, 63, 60, 57, 54, 52, 47, 43, 41, 38, 35, 65, 64,
+ 64, 64, 64, 63, 62, 60, 59, 55, 53, 48, 45, 43, 40, 36, 65, 64, 64, 63,
+ 63, 63, 62, 61, 59, 56, 55, 50, 47, 45, 41, 38, 65, 64, 63, 63, 63, 62,
+ 61, 60, 59, 56, 54, 50, 47, 45, 41, 38, 65, 64, 63, 63, 61, 60, 59, 58,
+ 56, 54, 53, 49, 46, 44, 41, 38, 64, 63, 63, 62, 60, 58, 57, 55, 53, 52,
+ 51, 48, 46, 44, 41, 38, 63, 62, 62, 61, 59, 57, 56, 54, 51, 50, 49, 46,
+ 44, 42, 40, 37, 60, 60, 61, 60, 58, 55, 54, 52, 48, 47, 46, 43, 41, 40,
+ 38, 35, 57, 59, 59, 59, 56, 53, 51, 48, 42, 41, 41, 38, 37, 36, 34, 32,
+ 54, 55, 56, 56, 54, 52, 50, 47, 41, 40, 39, 37, 35, 34, 33, 31, 52, 53,
+ 55, 54, 53, 51, 49, 46, 41, 39, 38, 35, 34, 33, 32, 30, 47, 48, 50, 50,
+ 49, 48, 46, 43, 38, 37, 35, 32, 31, 30, 29, 27, 43, 45, 47, 47, 46, 46,
+ 44, 41, 37, 35, 34, 31, 29, 29, 27, 26, 41, 43, 45, 45, 44, 44, 42, 40,
+ 36, 34, 33, 30, 29, 28, 26, 25, 38, 40, 41, 41, 41, 41, 40, 38, 34, 33,
+ 32, 29, 27, 26, 25, 24, 35, 36, 38, 38, 38, 38, 37, 35, 32, 31, 30, 27,
+ 26, 25, 24, 22,
+ /* Size 32x32 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 63, 60, 60, 59, 57, 57,
+ 54, 52, 52, 48, 47, 46, 43, 42, 41, 38, 38, 37, 35, 35, 65, 65, 65, 65,
+ 64, 64, 64, 64, 64, 64, 64, 64, 62, 60, 60, 59, 58, 58, 55, 53, 53, 49,
+ 48, 47, 45, 44, 43, 40, 39, 38, 36, 36, 65, 65, 64, 64, 64, 64, 64, 64,
+ 64, 64, 63, 63, 62, 60, 60, 59, 59, 59, 55, 53, 53, 50, 48, 48, 45, 44,
+ 43, 40, 40, 39, 36, 36, 65, 65, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63,
+ 62, 60, 60, 59, 59, 59, 55, 53, 53, 50, 49, 48, 45, 44, 44, 40, 40, 39,
+ 37, 37, 65, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 62, 61, 61, 60,
+ 59, 59, 56, 55, 55, 51, 50, 49, 47, 46, 45, 41, 41, 40, 38, 38, 65, 64,
+ 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 62, 61, 61, 60, 59, 59, 57, 55,
+ 55, 51, 50, 50, 47, 46, 45, 42, 41, 41, 38, 38, 65, 64, 64, 64, 63, 63,
+ 63, 63, 63, 62, 62, 62, 61, 60, 60, 59, 59, 59, 56, 54, 54, 51, 50, 49,
+ 47, 46, 45, 42, 41, 41, 38, 38, 65, 64, 64, 64, 63, 63, 63, 62, 62, 61,
+ 60, 60, 59, 59, 59, 58, 56, 56, 54, 53, 53, 50, 49, 48, 46, 45, 44, 41,
+ 41, 40, 38, 38, 65, 64, 64, 64, 63, 63, 63, 62, 61, 61, 60, 60, 59, 58,
+ 58, 57, 56, 56, 54, 53, 53, 50, 49, 48, 46, 45, 44, 41, 41, 40, 38, 38,
+ 64, 64, 64, 63, 63, 63, 62, 61, 61, 60, 59, 59, 59, 58, 58, 56, 55, 55,
+ 53, 52, 52, 49, 49, 48, 46, 45, 44, 41, 41, 40, 38, 38, 64, 64, 63, 63,
+ 63, 63, 62, 60, 60, 59, 58, 58, 57, 55, 55, 55, 53, 53, 52, 51, 51, 49,
+ 48, 48, 46, 45, 44, 42, 41, 41, 38, 38, 64, 64, 63, 63, 63, 63, 62, 60,
+ 60, 59, 58, 58, 57, 55, 55, 55, 53, 53, 52, 51, 51, 49, 48, 48, 46, 45,
+ 44, 42, 41, 41, 38, 38, 63, 62, 62, 62, 62, 62, 61, 59, 59, 59, 57, 57,
+ 56, 54, 54, 53, 51, 51, 50, 49, 49, 47, 46, 46, 44, 43, 42, 40, 40, 39,
+ 37, 37, 60, 60, 60, 60, 61, 61, 60, 59, 58, 58, 55, 55, 54, 52, 52, 50,
+ 48, 48, 47, 46, 46, 44, 43, 43, 41, 40, 40, 38, 38, 37, 35, 35, 60, 60,
+ 60, 60, 61, 61, 60, 59, 58, 58, 55, 55, 54, 52, 52, 50, 48, 48, 47, 46,
+ 46, 44, 43, 43, 41, 40, 40, 38, 38, 37, 35, 35, 59, 59, 59, 59, 60, 60,
+ 59, 58, 57, 56, 55, 55, 53, 50, 50, 48, 45, 45, 44, 43, 43, 41, 41, 40,
+ 39, 38, 38, 36, 36, 35, 34, 34, 57, 58, 59, 59, 59, 59, 59, 56, 56, 55,
+ 53, 53, 51, 48, 48, 45, 42, 42, 41, 41, 41, 39, 38, 38, 37, 36, 36, 34,
+ 34, 34, 32, 32, 57, 58, 59, 59, 59, 59, 59, 56, 56, 55, 53, 53, 51, 48,
+ 48, 45, 42, 42, 41, 41, 41, 39, 38, 38, 37, 36, 36, 34, 34, 34, 32, 32,
+ 54, 55, 55, 55, 56, 57, 56, 54, 54, 53, 52, 52, 50, 47, 47, 44, 41, 41,
+ 40, 39, 39, 37, 37, 36, 35, 34, 34, 33, 33, 32, 31, 31, 52, 53, 53, 53,
+ 55, 55, 54, 53, 53, 52, 51, 51, 49, 46, 46, 43, 41, 41, 39, 38, 38, 36,
+ 35, 35, 34, 34, 33, 32, 32, 31, 30, 30, 52, 53, 53, 53, 55, 55, 54, 53,
+ 53, 52, 51, 51, 49, 46, 46, 43, 41, 41, 39, 38, 38, 36, 35, 35, 34, 34,
+ 33, 32, 32, 31, 30, 30, 48, 49, 50, 50, 51, 51, 51, 50, 50, 49, 49, 49,
+ 47, 44, 44, 41, 39, 39, 37, 36, 36, 34, 33, 33, 32, 32, 31, 30, 29, 29,
+ 28, 28, 47, 48, 48, 49, 50, 50, 50, 49, 49, 49, 48, 48, 46, 43, 43, 41,
+ 38, 38, 37, 35, 35, 33, 32, 32, 31, 31, 30, 29, 29, 28, 27, 27, 46, 47,
+ 48, 48, 49, 50, 49, 48, 48, 48, 48, 48, 46, 43, 43, 40, 38, 38, 36, 35,
+ 35, 33, 32, 32, 31, 30, 30, 29, 28, 28, 27, 27, 43, 45, 45, 45, 47, 47,
+ 47, 46, 46, 46, 46, 46, 44, 41, 41, 39, 37, 37, 35, 34, 34, 32, 31, 31,
+ 29, 29, 29, 27, 27, 27, 26, 26, 42, 44, 44, 44, 46, 46, 46, 45, 45, 45,
+ 45, 45, 43, 40, 40, 38, 36, 36, 34, 34, 34, 32, 31, 30, 29, 29, 28, 27,
+ 27, 26, 25, 25, 41, 43, 43, 44, 45, 45, 45, 44, 44, 44, 44, 44, 42, 40,
+ 40, 38, 36, 36, 34, 33, 33, 31, 30, 30, 29, 28, 28, 27, 26, 26, 25, 25,
+ 38, 40, 40, 40, 41, 42, 42, 41, 41, 41, 42, 42, 40, 38, 38, 36, 34, 34,
+ 33, 32, 32, 30, 29, 29, 27, 27, 27, 25, 25, 25, 24, 24, 38, 39, 40, 40,
+ 41, 41, 41, 41, 41, 41, 41, 41, 40, 38, 38, 36, 34, 34, 33, 32, 32, 29,
+ 29, 28, 27, 27, 26, 25, 25, 25, 24, 24, 37, 38, 39, 39, 40, 41, 41, 40,
+ 40, 40, 41, 41, 39, 37, 37, 35, 34, 34, 32, 31, 31, 29, 28, 28, 27, 26,
+ 26, 25, 25, 24, 23, 23, 35, 36, 36, 37, 38, 38, 38, 38, 38, 38, 38, 38,
+ 37, 35, 35, 34, 32, 32, 31, 30, 30, 28, 27, 27, 26, 25, 25, 24, 24, 23,
+ 22, 22, 35, 36, 36, 37, 38, 38, 38, 38, 38, 38, 38, 38, 37, 35, 35, 34,
+ 32, 32, 31, 30, 30, 28, 27, 27, 26, 25, 25, 24, 24, 23, 22, 22,
+ /* Size 4x8 */
+ 64, 63, 55, 39, 64, 62, 56, 41, 63, 59, 53, 41, 60, 55, 47, 38, 59, 53,
+ 41, 34, 51, 48, 37, 29, 45, 44, 34, 27, 39, 40, 32, 25,
+ /* Size 8x4 */
+ 64, 64, 63, 60, 59, 51, 45, 39, 63, 62, 59, 55, 53, 48, 44, 40, 55, 56,
+ 53, 47, 41, 37, 34, 32, 39, 41, 41, 38, 34, 29, 27, 25,
+ /* Size 8x16 */
+ 64, 65, 64, 63, 57, 47, 43, 38, 65, 64, 63, 62, 58, 48, 45, 40, 65, 63,
+ 63, 62, 59, 50, 47, 41, 65, 63, 62, 61, 59, 50, 47, 41, 64, 63, 60, 59,
+ 56, 49, 46, 41, 64, 62, 59, 57, 53, 48, 46, 41, 63, 62, 58, 56, 51, 46,
+ 44, 40, 60, 60, 57, 54, 48, 43, 41, 38, 57, 59, 55, 51, 43, 38, 37, 34,
+ 54, 56, 53, 49, 41, 37, 35, 33, 52, 55, 51, 48, 41, 35, 34, 32, 47, 50,
+ 48, 46, 38, 33, 31, 29, 44, 47, 45, 43, 37, 31, 29, 27, 42, 45, 44, 42,
+ 36, 30, 29, 26, 38, 41, 41, 40, 34, 29, 27, 25, 35, 38, 38, 37, 32, 27,
+ 26, 24,
+ /* Size 16x8 */
+ 64, 65, 65, 65, 64, 64, 63, 60, 57, 54, 52, 47, 44, 42, 38, 35, 65, 64,
+ 63, 63, 63, 62, 62, 60, 59, 56, 55, 50, 47, 45, 41, 38, 64, 63, 63, 62,
+ 60, 59, 58, 57, 55, 53, 51, 48, 45, 44, 41, 38, 63, 62, 62, 61, 59, 57,
+ 56, 54, 51, 49, 48, 46, 43, 42, 40, 37, 57, 58, 59, 59, 56, 53, 51, 48,
+ 43, 41, 41, 38, 37, 36, 34, 32, 47, 48, 50, 50, 49, 48, 46, 43, 38, 37,
+ 35, 33, 31, 30, 29, 27, 43, 45, 47, 47, 46, 46, 44, 41, 37, 35, 34, 31,
+ 29, 29, 27, 26, 38, 40, 41, 41, 41, 41, 40, 38, 34, 33, 32, 29, 27, 26,
+ 25, 24,
+ /* Size 16x32 */
+ 64, 65, 65, 65, 64, 64, 63, 58, 57, 54, 47, 47, 43, 38, 38, 35, 65, 64,
+ 64, 64, 64, 63, 62, 59, 58, 55, 48, 48, 45, 39, 39, 36, 65, 64, 64, 64,
+ 63, 63, 62, 59, 58, 55, 48, 48, 45, 40, 40, 36, 65, 64, 64, 64, 63, 63,
+ 62, 59, 58, 55, 49, 49, 45, 40, 40, 37, 65, 64, 63, 63, 63, 63, 62, 59,
+ 59, 56, 50, 50, 47, 41, 41, 38, 65, 64, 63, 63, 63, 62, 62, 59, 59, 56,
+ 50, 50, 47, 41, 41, 38, 65, 64, 63, 63, 62, 62, 61, 59, 59, 56, 50, 50,
+ 47, 41, 41, 38, 64, 63, 63, 63, 61, 60, 59, 57, 56, 54, 49, 49, 46, 41,
+ 41, 38, 64, 63, 63, 62, 60, 60, 59, 56, 56, 54, 49, 49, 46, 41, 41, 38,
+ 64, 63, 63, 62, 60, 59, 59, 55, 55, 53, 48, 48, 46, 41, 41, 38, 64, 63,
+ 62, 62, 59, 58, 57, 54, 53, 52, 48, 48, 46, 41, 41, 38, 64, 63, 62, 62,
+ 59, 58, 57, 54, 53, 52, 48, 48, 46, 41, 41, 38, 63, 62, 62, 61, 58, 57,
+ 56, 52, 51, 49, 46, 46, 44, 40, 40, 37, 60, 60, 60, 60, 57, 55, 54, 49,
+ 48, 47, 43, 43, 41, 38, 38, 35, 60, 60, 60, 60, 57, 55, 54, 49, 48, 47,
+ 43, 43, 41, 38, 38, 35, 59, 59, 59, 59, 55, 55, 53, 46, 46, 44, 41, 41,
+ 39, 36, 36, 34, 57, 59, 59, 59, 55, 53, 51, 44, 43, 41, 38, 38, 37, 34,
+ 34, 32, 57, 59, 59, 59, 55, 53, 51, 44, 43, 41, 38, 38, 37, 34, 34, 32,
+ 54, 55, 56, 55, 53, 51, 49, 42, 41, 40, 37, 37, 35, 33, 33, 31, 52, 54,
+ 55, 54, 51, 51, 48, 42, 41, 39, 35, 35, 34, 32, 32, 30, 52, 54, 55, 54,
+ 51, 51, 48, 42, 41, 39, 35, 35, 34, 32, 32, 30, 48, 51, 51, 51, 49, 48,
+ 47, 40, 39, 37, 33, 33, 32, 29, 29, 28, 47, 49, 50, 49, 48, 48, 46, 39,
+ 38, 37, 33, 33, 31, 29, 29, 27, 47, 48, 49, 49, 48, 47, 46, 39, 38, 36,
+ 32, 32, 31, 28, 28, 27, 44, 46, 47, 46, 45, 45, 43, 38, 37, 35, 31, 31,
+ 29, 27, 27, 26, 43, 45, 46, 46, 45, 44, 43, 37, 36, 34, 31, 31, 29, 27,
+ 27, 25, 42, 44, 45, 45, 44, 44, 42, 37, 36, 34, 30, 30, 29, 26, 26, 25,
+ 39, 41, 42, 42, 41, 41, 40, 35, 34, 33, 29, 29, 27, 25, 25, 24, 38, 40,
+ 41, 41, 41, 41, 40, 35, 34, 33, 29, 29, 27, 25, 25, 24, 37, 39, 40, 40,
+ 40, 40, 39, 34, 34, 32, 28, 28, 27, 25, 25, 23, 35, 37, 38, 38, 38, 38,
+ 37, 33, 32, 31, 27, 27, 26, 24, 24, 22, 35, 37, 38, 38, 38, 38, 37, 33,
+ 32, 31, 27, 27, 26, 24, 24, 22,
+ /* Size 32x16 */
+ 64, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 63, 60, 60, 59, 57, 57,
+ 54, 52, 52, 48, 47, 47, 44, 43, 42, 39, 38, 37, 35, 35, 65, 64, 64, 64,
+ 64, 64, 64, 63, 63, 63, 63, 63, 62, 60, 60, 59, 59, 59, 55, 54, 54, 51,
+ 49, 48, 46, 45, 44, 41, 40, 39, 37, 37, 65, 64, 64, 64, 63, 63, 63, 63,
+ 63, 63, 62, 62, 62, 60, 60, 59, 59, 59, 56, 55, 55, 51, 50, 49, 47, 46,
+ 45, 42, 41, 40, 38, 38, 65, 64, 64, 64, 63, 63, 63, 63, 62, 62, 62, 62,
+ 61, 60, 60, 59, 59, 59, 55, 54, 54, 51, 49, 49, 46, 46, 45, 42, 41, 40,
+ 38, 38, 64, 64, 63, 63, 63, 63, 62, 61, 60, 60, 59, 59, 58, 57, 57, 55,
+ 55, 55, 53, 51, 51, 49, 48, 48, 45, 45, 44, 41, 41, 40, 38, 38, 64, 63,
+ 63, 63, 63, 62, 62, 60, 60, 59, 58, 58, 57, 55, 55, 55, 53, 53, 51, 51,
+ 51, 48, 48, 47, 45, 44, 44, 41, 41, 40, 38, 38, 63, 62, 62, 62, 62, 62,
+ 61, 59, 59, 59, 57, 57, 56, 54, 54, 53, 51, 51, 49, 48, 48, 47, 46, 46,
+ 43, 43, 42, 40, 40, 39, 37, 37, 58, 59, 59, 59, 59, 59, 59, 57, 56, 55,
+ 54, 54, 52, 49, 49, 46, 44, 44, 42, 42, 42, 40, 39, 39, 38, 37, 37, 35,
+ 35, 34, 33, 33, 57, 58, 58, 58, 59, 59, 59, 56, 56, 55, 53, 53, 51, 48,
+ 48, 46, 43, 43, 41, 41, 41, 39, 38, 38, 37, 36, 36, 34, 34, 34, 32, 32,
+ 54, 55, 55, 55, 56, 56, 56, 54, 54, 53, 52, 52, 49, 47, 47, 44, 41, 41,
+ 40, 39, 39, 37, 37, 36, 35, 34, 34, 33, 33, 32, 31, 31, 47, 48, 48, 49,
+ 50, 50, 50, 49, 49, 48, 48, 48, 46, 43, 43, 41, 38, 38, 37, 35, 35, 33,
+ 33, 32, 31, 31, 30, 29, 29, 28, 27, 27, 47, 48, 48, 49, 50, 50, 50, 49,
+ 49, 48, 48, 48, 46, 43, 43, 41, 38, 38, 37, 35, 35, 33, 33, 32, 31, 31,
+ 30, 29, 29, 28, 27, 27, 43, 45, 45, 45, 47, 47, 47, 46, 46, 46, 46, 46,
+ 44, 41, 41, 39, 37, 37, 35, 34, 34, 32, 31, 31, 29, 29, 29, 27, 27, 27,
+ 26, 26, 38, 39, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 40, 38, 38, 36,
+ 34, 34, 33, 32, 32, 29, 29, 28, 27, 27, 26, 25, 25, 25, 24, 24, 38, 39,
+ 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 40, 38, 38, 36, 34, 34, 33, 32,
+ 32, 29, 29, 28, 27, 27, 26, 25, 25, 25, 24, 24, 35, 36, 36, 37, 38, 38,
+ 38, 38, 38, 38, 38, 38, 37, 35, 35, 34, 32, 32, 31, 30, 30, 28, 27, 27,
+ 26, 25, 25, 24, 24, 23, 22, 22,
+ /* Size 4x16 */
+ 65, 64, 54, 38, 64, 63, 55, 40, 64, 63, 56, 41, 64, 62, 56, 41, 63, 60,
+ 54, 41, 63, 58, 52, 41, 62, 57, 49, 40, 60, 55, 47, 38, 59, 53, 41, 34,
+ 55, 51, 40, 33, 54, 51, 39, 32, 49, 48, 37, 29, 46, 45, 35, 27, 44, 44,
+ 34, 26, 40, 41, 33, 25, 37, 38, 31, 24,
+ /* Size 16x4 */
+ 65, 64, 64, 64, 63, 63, 62, 60, 59, 55, 54, 49, 46, 44, 40, 37, 64, 63,
+ 63, 62, 60, 58, 57, 55, 53, 51, 51, 48, 45, 44, 41, 38, 54, 55, 56, 56,
+ 54, 52, 49, 47, 41, 40, 39, 37, 35, 34, 33, 31, 38, 40, 41, 41, 41, 41,
+ 40, 38, 34, 33, 32, 29, 27, 26, 25, 24,
+ /* Size 8x32 */
+ 64, 65, 64, 63, 57, 47, 43, 38, 65, 64, 64, 62, 58, 48, 45, 39, 65, 64,
+ 63, 62, 58, 48, 45, 40, 65, 64, 63, 62, 58, 49, 45, 40, 65, 63, 63, 62,
+ 59, 50, 47, 41, 65, 63, 63, 62, 59, 50, 47, 41, 65, 63, 62, 61, 59, 50,
+ 47, 41, 64, 63, 61, 59, 56, 49, 46, 41, 64, 63, 60, 59, 56, 49, 46, 41,
+ 64, 63, 60, 59, 55, 48, 46, 41, 64, 62, 59, 57, 53, 48, 46, 41, 64, 62,
+ 59, 57, 53, 48, 46, 41, 63, 62, 58, 56, 51, 46, 44, 40, 60, 60, 57, 54,
+ 48, 43, 41, 38, 60, 60, 57, 54, 48, 43, 41, 38, 59, 59, 55, 53, 46, 41,
+ 39, 36, 57, 59, 55, 51, 43, 38, 37, 34, 57, 59, 55, 51, 43, 38, 37, 34,
+ 54, 56, 53, 49, 41, 37, 35, 33, 52, 55, 51, 48, 41, 35, 34, 32, 52, 55,
+ 51, 48, 41, 35, 34, 32, 48, 51, 49, 47, 39, 33, 32, 29, 47, 50, 48, 46,
+ 38, 33, 31, 29, 47, 49, 48, 46, 38, 32, 31, 28, 44, 47, 45, 43, 37, 31,
+ 29, 27, 43, 46, 45, 43, 36, 31, 29, 27, 42, 45, 44, 42, 36, 30, 29, 26,
+ 39, 42, 41, 40, 34, 29, 27, 25, 38, 41, 41, 40, 34, 29, 27, 25, 37, 40,
+ 40, 39, 34, 28, 27, 25, 35, 38, 38, 37, 32, 27, 26, 24, 35, 38, 38, 37,
+ 32, 27, 26, 24,
+ /* Size 32x8 */
+ 64, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 63, 60, 60, 59, 57, 57,
+ 54, 52, 52, 48, 47, 47, 44, 43, 42, 39, 38, 37, 35, 35, 65, 64, 64, 64,
+ 63, 63, 63, 63, 63, 63, 62, 62, 62, 60, 60, 59, 59, 59, 56, 55, 55, 51,
+ 50, 49, 47, 46, 45, 42, 41, 40, 38, 38, 64, 64, 63, 63, 63, 63, 62, 61,
+ 60, 60, 59, 59, 58, 57, 57, 55, 55, 55, 53, 51, 51, 49, 48, 48, 45, 45,
+ 44, 41, 41, 40, 38, 38, 63, 62, 62, 62, 62, 62, 61, 59, 59, 59, 57, 57,
+ 56, 54, 54, 53, 51, 51, 49, 48, 48, 47, 46, 46, 43, 43, 42, 40, 40, 39,
+ 37, 37, 57, 58, 58, 58, 59, 59, 59, 56, 56, 55, 53, 53, 51, 48, 48, 46,
+ 43, 43, 41, 41, 41, 39, 38, 38, 37, 36, 36, 34, 34, 34, 32, 32, 47, 48,
+ 48, 49, 50, 50, 50, 49, 49, 48, 48, 48, 46, 43, 43, 41, 38, 38, 37, 35,
+ 35, 33, 33, 32, 31, 31, 30, 29, 29, 28, 27, 27, 43, 45, 45, 45, 47, 47,
+ 47, 46, 46, 46, 46, 46, 44, 41, 41, 39, 37, 37, 35, 34, 34, 32, 31, 31,
+ 29, 29, 29, 27, 27, 27, 26, 26, 38, 39, 40, 40, 41, 41, 41, 41, 41, 41,
+ 41, 41, 40, 38, 38, 36, 34, 34, 33, 32, 32, 29, 29, 28, 27, 27, 26, 25,
+ 25, 25, 24, 24 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 53, 45, 45, 35,
+#endif
+ /* Size 4x4 */
+ 65, 53, 44, 41, 53, 43, 44, 44, 44, 44, 38, 36, 41, 44, 36, 31,
+ /* Size 8x8 */
+ 65, 66, 58, 49, 43, 43, 42, 40, 66, 64, 56, 48, 44, 46, 44, 42, 58, 56,
+ 49, 45, 43, 45, 44, 43, 49, 48, 45, 42, 41, 41, 41, 40, 43, 44, 43, 41,
+ 39, 38, 38, 38, 43, 46, 45, 41, 38, 36, 35, 34, 42, 44, 44, 41, 38, 35,
+ 33, 32, 40, 42, 43, 40, 38, 34, 32, 30,
+ /* Size 16x16 */
+ 64, 66, 67, 66, 61, 56, 53, 49, 42, 42, 42, 42, 41, 40, 39, 38, 66, 65,
+ 65, 64, 59, 53, 51, 48, 43, 43, 44, 44, 43, 42, 41, 39, 67, 65, 65, 63,
+ 58, 52, 50, 48, 44, 45, 45, 45, 44, 44, 43, 41, 66, 64, 63, 62, 57, 51,
+ 49, 48, 44, 45, 45, 46, 45, 44, 43, 41, 61, 59, 58, 57, 53, 47, 47, 46,
+ 43, 44, 44, 45, 44, 44, 43, 41, 56, 53, 52, 51, 47, 43, 43, 43, 43, 44,
+ 44, 45, 45, 44, 44, 42, 53, 51, 50, 49, 47, 43, 43, 43, 42, 43, 43, 44,
+ 43, 43, 43, 41, 49, 48, 48, 48, 46, 43, 43, 42, 41, 41, 41, 42, 41, 41,
+ 41, 39, 42, 43, 44, 44, 43, 43, 42, 41, 39, 39, 39, 38, 38, 38, 38, 37,
+ 42, 43, 45, 45, 44, 44, 43, 41, 39, 38, 38, 37, 37, 37, 37, 36, 42, 44,
+ 45, 45, 44, 44, 43, 41, 39, 38, 38, 37, 36, 36, 36, 35, 42, 44, 45, 46,
+ 45, 45, 44, 42, 38, 37, 37, 35, 34, 34, 33, 33, 41, 43, 44, 45, 44, 45,
+ 43, 41, 38, 37, 36, 34, 34, 33, 33, 32, 40, 42, 44, 44, 44, 44, 43, 41,
+ 38, 37, 36, 34, 33, 33, 32, 31, 39, 41, 43, 43, 43, 44, 43, 41, 38, 37,
+ 36, 33, 33, 32, 31, 30, 38, 39, 41, 41, 41, 42, 41, 39, 37, 36, 35, 33,
+ 32, 31, 30, 29,
+ /* Size 32x32 */
+ 64, 65, 66, 66, 67, 67, 66, 62, 61, 59, 56, 56, 53, 49, 49, 46, 42, 42,
+ 42, 42, 42, 42, 42, 42, 41, 41, 40, 39, 39, 39, 38, 38, 65, 65, 65, 65,
+ 66, 66, 65, 60, 59, 58, 54, 54, 52, 49, 49, 46, 43, 43, 43, 43, 43, 43,
+ 43, 43, 42, 42, 41, 41, 41, 40, 39, 39, 66, 65, 65, 65, 65, 66, 64, 59,
+ 59, 58, 53, 53, 51, 48, 48, 46, 43, 43, 43, 44, 44, 44, 44, 44, 43, 42,
+ 42, 41, 41, 41, 39, 39, 66, 65, 65, 65, 65, 65, 64, 59, 59, 57, 53, 53,
+ 51, 48, 48, 46, 43, 43, 44, 44, 44, 44, 44, 44, 43, 43, 42, 41, 41, 41,
+ 39, 39, 67, 66, 65, 65, 65, 65, 63, 59, 58, 56, 52, 52, 50, 48, 48, 46,
+ 44, 44, 45, 45, 45, 45, 45, 45, 44, 44, 44, 43, 43, 42, 41, 41, 67, 66,
+ 66, 65, 65, 64, 63, 59, 58, 56, 51, 51, 50, 48, 48, 46, 44, 44, 45, 45,
+ 45, 46, 46, 46, 45, 44, 44, 43, 43, 42, 41, 41, 66, 65, 64, 64, 63, 63,
+ 62, 58, 57, 55, 51, 51, 49, 48, 48, 46, 44, 44, 45, 45, 45, 45, 46, 46,
+ 45, 44, 44, 43, 43, 43, 41, 41, 62, 60, 59, 59, 59, 59, 58, 53, 53, 51,
+ 48, 48, 47, 46, 46, 45, 44, 44, 44, 45, 45, 45, 45, 45, 44, 44, 44, 43,
+ 43, 43, 41, 41, 61, 59, 59, 59, 58, 58, 57, 53, 53, 51, 47, 47, 47, 46,
+ 46, 45, 43, 43, 44, 44, 44, 45, 45, 45, 44, 44, 44, 43, 43, 43, 41, 41,
+ 59, 58, 58, 57, 56, 56, 55, 51, 51, 49, 46, 46, 46, 45, 45, 44, 43, 43,
+ 44, 44, 44, 45, 45, 45, 44, 44, 44, 44, 43, 43, 42, 42, 56, 54, 53, 53,
+ 52, 51, 51, 48, 47, 46, 43, 43, 43, 43, 43, 43, 43, 43, 44, 44, 44, 45,
+ 45, 45, 45, 45, 44, 44, 44, 44, 42, 42, 56, 54, 53, 53, 52, 51, 51, 48,
+ 47, 46, 43, 43, 43, 43, 43, 43, 43, 43, 44, 44, 44, 45, 45, 45, 45, 45,
+ 44, 44, 44, 44, 42, 42, 53, 52, 51, 51, 50, 50, 49, 47, 47, 46, 43, 43,
+ 43, 43, 43, 42, 42, 42, 43, 43, 43, 44, 44, 44, 43, 43, 43, 43, 43, 42,
+ 41, 41, 49, 49, 48, 48, 48, 48, 48, 46, 46, 45, 43, 43, 43, 42, 42, 41,
+ 41, 41, 41, 41, 41, 41, 42, 41, 41, 41, 41, 41, 41, 40, 39, 39, 49, 49,
+ 48, 48, 48, 48, 48, 46, 46, 45, 43, 43, 43, 42, 42, 41, 41, 41, 41, 41,
+ 41, 41, 42, 41, 41, 41, 41, 41, 41, 40, 39, 39, 46, 46, 46, 46, 46, 46,
+ 46, 45, 45, 44, 43, 43, 42, 41, 41, 41, 40, 40, 40, 40, 40, 40, 40, 40,
+ 39, 39, 39, 39, 39, 39, 38, 38, 42, 43, 43, 43, 44, 44, 44, 44, 43, 43,
+ 43, 43, 42, 41, 41, 40, 39, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 37, 37, 42, 43, 43, 43, 44, 44, 44, 44, 43, 43, 43, 43, 42, 41,
+ 41, 40, 39, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 38, 38, 38, 37, 37,
+ 42, 43, 43, 44, 45, 45, 45, 44, 44, 44, 44, 44, 43, 41, 41, 40, 39, 39,
+ 38, 38, 38, 38, 37, 37, 37, 37, 37, 37, 37, 36, 36, 36, 42, 43, 44, 44,
+ 45, 45, 45, 45, 44, 44, 44, 44, 43, 41, 41, 40, 39, 39, 38, 38, 38, 37,
+ 37, 37, 36, 36, 36, 36, 36, 35, 35, 35, 42, 43, 44, 44, 45, 45, 45, 45,
+ 44, 44, 44, 44, 43, 41, 41, 40, 39, 39, 38, 38, 38, 37, 37, 37, 36, 36,
+ 36, 36, 36, 35, 35, 35, 42, 43, 44, 44, 45, 46, 45, 45, 45, 45, 45, 45,
+ 44, 41, 41, 40, 38, 38, 38, 37, 37, 36, 36, 35, 35, 35, 35, 34, 34, 34,
+ 33, 33, 42, 43, 44, 44, 45, 46, 46, 45, 45, 45, 45, 45, 44, 42, 42, 40,
+ 38, 38, 37, 37, 37, 36, 35, 35, 34, 34, 34, 34, 33, 33, 33, 33, 42, 43,
+ 44, 44, 45, 46, 46, 45, 45, 45, 45, 45, 44, 41, 41, 40, 38, 38, 37, 37,
+ 37, 35, 35, 35, 34, 34, 34, 33, 33, 33, 33, 33, 41, 42, 43, 43, 44, 45,
+ 45, 44, 44, 44, 45, 45, 43, 41, 41, 39, 38, 38, 37, 36, 36, 35, 34, 34,
+ 34, 34, 33, 33, 33, 32, 32, 32, 41, 42, 42, 43, 44, 44, 44, 44, 44, 44,
+ 45, 45, 43, 41, 41, 39, 38, 38, 37, 36, 36, 35, 34, 34, 34, 33, 33, 32,
+ 32, 32, 32, 32, 40, 41, 42, 42, 44, 44, 44, 44, 44, 44, 44, 44, 43, 41,
+ 41, 39, 38, 38, 37, 36, 36, 35, 34, 34, 33, 33, 33, 32, 32, 32, 31, 31,
+ 39, 41, 41, 41, 43, 43, 43, 43, 43, 44, 44, 44, 43, 41, 41, 39, 38, 38,
+ 37, 36, 36, 34, 34, 33, 33, 32, 32, 31, 31, 31, 30, 30, 39, 41, 41, 41,
+ 43, 43, 43, 43, 43, 43, 44, 44, 43, 41, 41, 39, 38, 38, 37, 36, 36, 34,
+ 33, 33, 33, 32, 32, 31, 31, 31, 30, 30, 39, 40, 41, 41, 42, 42, 43, 43,
+ 43, 43, 44, 44, 42, 40, 40, 39, 38, 38, 36, 35, 35, 34, 33, 33, 32, 32,
+ 32, 31, 31, 30, 30, 30, 38, 39, 39, 39, 41, 41, 41, 41, 41, 42, 42, 42,
+ 41, 39, 39, 38, 37, 37, 36, 35, 35, 33, 33, 33, 32, 32, 31, 30, 30, 30,
+ 29, 29, 38, 39, 39, 39, 41, 41, 41, 41, 41, 42, 42, 42, 41, 39, 39, 38,
+ 37, 37, 36, 35, 35, 33, 33, 33, 32, 32, 31, 30, 30, 30, 29, 29,
+ /* Size 4x8 */
+ 65, 54, 43, 41, 65, 51, 45, 43, 56, 46, 44, 43, 48, 43, 41, 41, 43, 43,
+ 39, 38, 44, 45, 38, 34, 43, 44, 37, 32, 41, 43, 36, 31,
+ /* Size 8x4 */
+ 65, 65, 56, 48, 43, 44, 43, 41, 54, 51, 46, 43, 43, 45, 44, 43, 43, 45,
+ 44, 41, 39, 38, 37, 36, 41, 43, 43, 41, 38, 34, 32, 31,
+ /* Size 8x16 */
+ 64, 66, 58, 53, 43, 42, 41, 39, 65, 65, 55, 51, 44, 44, 42, 41, 67, 64,
+ 54, 51, 45, 45, 44, 42, 66, 62, 53, 49, 45, 45, 44, 43, 61, 57, 49, 47,
+ 44, 45, 44, 43, 55, 51, 45, 43, 43, 45, 45, 44, 53, 50, 45, 43, 42, 44,
+ 43, 42, 49, 48, 44, 43, 41, 41, 41, 41, 42, 44, 43, 42, 39, 38, 38, 38,
+ 42, 45, 44, 42, 39, 37, 37, 36, 42, 45, 44, 43, 39, 37, 36, 36, 42, 45,
+ 45, 44, 38, 35, 34, 33, 41, 44, 44, 43, 38, 34, 34, 32, 40, 44, 44, 43,
+ 38, 34, 33, 32, 39, 43, 43, 42, 38, 34, 32, 31, 38, 41, 42, 41, 37, 33,
+ 32, 30,
+ /* Size 16x8 */
+ 64, 65, 67, 66, 61, 55, 53, 49, 42, 42, 42, 42, 41, 40, 39, 38, 66, 65,
+ 64, 62, 57, 51, 50, 48, 44, 45, 45, 45, 44, 44, 43, 41, 58, 55, 54, 53,
+ 49, 45, 45, 44, 43, 44, 44, 45, 44, 44, 43, 42, 53, 51, 51, 49, 47, 43,
+ 43, 43, 42, 42, 43, 44, 43, 43, 42, 41, 43, 44, 45, 45, 44, 43, 42, 41,
+ 39, 39, 39, 38, 38, 38, 38, 37, 42, 44, 45, 45, 45, 45, 44, 41, 38, 37,
+ 37, 35, 34, 34, 34, 33, 41, 42, 44, 44, 44, 45, 43, 41, 38, 37, 36, 34,
+ 34, 33, 32, 32, 39, 41, 42, 43, 43, 44, 42, 41, 38, 36, 36, 33, 32, 32,
+ 31, 30,
+ /* Size 16x32 */
+ 64, 66, 66, 65, 58, 55, 53, 44, 43, 42, 42, 42, 41, 39, 39, 38, 65, 65,
+ 65, 64, 56, 54, 52, 44, 43, 43, 43, 43, 42, 41, 41, 39, 65, 65, 65, 64,
+ 55, 53, 51, 45, 44, 44, 44, 44, 42, 41, 41, 39, 66, 65, 65, 64, 55, 53,
+ 51, 45, 44, 44, 44, 44, 43, 41, 41, 39, 67, 65, 64, 63, 54, 52, 51, 45,
+ 45, 45, 45, 45, 44, 42, 42, 41, 67, 65, 64, 62, 54, 51, 50, 45, 45, 45,
+ 45, 45, 44, 43, 43, 41, 66, 63, 62, 61, 53, 51, 49, 45, 45, 45, 45, 45,
+ 44, 43, 43, 41, 61, 59, 58, 57, 50, 48, 47, 44, 44, 44, 45, 45, 44, 43,
+ 43, 41, 61, 59, 57, 56, 49, 48, 47, 44, 44, 44, 45, 45, 44, 43, 43, 41,
+ 59, 56, 55, 55, 48, 46, 46, 44, 44, 44, 45, 45, 44, 43, 43, 42, 55, 53,
+ 51, 50, 45, 44, 43, 43, 43, 44, 45, 45, 45, 44, 44, 42, 55, 53, 51, 50,
+ 45, 44, 43, 43, 43, 44, 45, 45, 45, 44, 44, 42, 53, 51, 50, 49, 45, 43,
+ 43, 42, 42, 43, 44, 44, 43, 42, 42, 41, 49, 48, 48, 47, 44, 43, 43, 41,
+ 41, 41, 41, 41, 41, 41, 41, 39, 49, 48, 48, 47, 44, 43, 43, 41, 41, 41,
+ 41, 41, 41, 41, 41, 39, 46, 46, 46, 46, 44, 43, 42, 40, 40, 40, 40, 40,
+ 39, 39, 39, 38, 42, 43, 44, 44, 43, 43, 42, 39, 39, 39, 38, 38, 38, 38,
+ 38, 37, 42, 43, 44, 44, 43, 43, 42, 39, 39, 39, 38, 38, 38, 38, 38, 37,
+ 42, 44, 45, 44, 44, 43, 42, 39, 39, 38, 37, 37, 37, 36, 36, 36, 42, 44,
+ 45, 45, 44, 44, 43, 39, 39, 38, 37, 37, 36, 36, 36, 35, 42, 44, 45, 45,
+ 44, 44, 43, 39, 39, 38, 37, 37, 36, 36, 36, 35, 42, 44, 45, 45, 45, 45,
+ 43, 39, 38, 38, 36, 36, 35, 34, 34, 33, 42, 44, 45, 45, 45, 45, 44, 39,
+ 38, 37, 35, 35, 34, 33, 33, 33, 42, 44, 45, 45, 45, 45, 44, 39, 38, 37,
+ 35, 35, 34, 33, 33, 33, 41, 43, 44, 44, 44, 44, 43, 39, 38, 37, 34, 34,
+ 34, 32, 32, 32, 41, 43, 44, 44, 44, 44, 43, 39, 38, 37, 34, 34, 33, 32,
+ 32, 31, 40, 43, 44, 44, 44, 44, 43, 39, 38, 37, 34, 34, 33, 32, 32, 31,
+ 39, 42, 43, 43, 43, 44, 42, 38, 38, 37, 34, 34, 33, 31, 31, 30, 39, 42,
+ 43, 43, 43, 43, 42, 38, 38, 37, 34, 34, 32, 31, 31, 30, 39, 41, 42, 42,
+ 43, 43, 42, 38, 38, 36, 33, 33, 32, 31, 31, 29, 38, 40, 41, 41, 42, 42,
+ 41, 37, 37, 36, 33, 33, 32, 30, 30, 29, 38, 40, 41, 41, 42, 42, 41, 37,
+ 37, 36, 33, 33, 32, 30, 30, 29,
+ /* Size 32x16 */
+ 64, 65, 65, 66, 67, 67, 66, 61, 61, 59, 55, 55, 53, 49, 49, 46, 42, 42,
+ 42, 42, 42, 42, 42, 42, 41, 41, 40, 39, 39, 39, 38, 38, 66, 65, 65, 65,
+ 65, 65, 63, 59, 59, 56, 53, 53, 51, 48, 48, 46, 43, 43, 44, 44, 44, 44,
+ 44, 44, 43, 43, 43, 42, 42, 41, 40, 40, 66, 65, 65, 65, 64, 64, 62, 58,
+ 57, 55, 51, 51, 50, 48, 48, 46, 44, 44, 45, 45, 45, 45, 45, 45, 44, 44,
+ 44, 43, 43, 42, 41, 41, 65, 64, 64, 64, 63, 62, 61, 57, 56, 55, 50, 50,
+ 49, 47, 47, 46, 44, 44, 44, 45, 45, 45, 45, 45, 44, 44, 44, 43, 43, 42,
+ 41, 41, 58, 56, 55, 55, 54, 54, 53, 50, 49, 48, 45, 45, 45, 44, 44, 44,
+ 43, 43, 44, 44, 44, 45, 45, 45, 44, 44, 44, 43, 43, 43, 42, 42, 55, 54,
+ 53, 53, 52, 51, 51, 48, 48, 46, 44, 44, 43, 43, 43, 43, 43, 43, 43, 44,
+ 44, 45, 45, 45, 44, 44, 44, 44, 43, 43, 42, 42, 53, 52, 51, 51, 51, 50,
+ 49, 47, 47, 46, 43, 43, 43, 43, 43, 42, 42, 42, 42, 43, 43, 43, 44, 44,
+ 43, 43, 43, 42, 42, 42, 41, 41, 44, 44, 45, 45, 45, 45, 45, 44, 44, 44,
+ 43, 43, 42, 41, 41, 40, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 38,
+ 38, 38, 37, 37, 43, 43, 44, 44, 45, 45, 45, 44, 44, 44, 43, 43, 42, 41,
+ 41, 40, 39, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 38, 38, 38, 37, 37,
+ 42, 43, 44, 44, 45, 45, 45, 44, 44, 44, 44, 44, 43, 41, 41, 40, 39, 39,
+ 38, 38, 38, 38, 37, 37, 37, 37, 37, 37, 37, 36, 36, 36, 42, 43, 44, 44,
+ 45, 45, 45, 45, 45, 45, 45, 45, 44, 41, 41, 40, 38, 38, 37, 37, 37, 36,
+ 35, 35, 34, 34, 34, 34, 34, 33, 33, 33, 42, 43, 44, 44, 45, 45, 45, 45,
+ 45, 45, 45, 45, 44, 41, 41, 40, 38, 38, 37, 37, 37, 36, 35, 35, 34, 34,
+ 34, 34, 34, 33, 33, 33, 41, 42, 42, 43, 44, 44, 44, 44, 44, 44, 45, 45,
+ 43, 41, 41, 39, 38, 38, 37, 36, 36, 35, 34, 34, 34, 33, 33, 33, 32, 32,
+ 32, 32, 39, 41, 41, 41, 42, 43, 43, 43, 43, 43, 44, 44, 42, 41, 41, 39,
+ 38, 38, 36, 36, 36, 34, 33, 33, 32, 32, 32, 31, 31, 31, 30, 30, 39, 41,
+ 41, 41, 42, 43, 43, 43, 43, 43, 44, 44, 42, 41, 41, 39, 38, 38, 36, 36,
+ 36, 34, 33, 33, 32, 32, 32, 31, 31, 31, 30, 30, 38, 39, 39, 39, 41, 41,
+ 41, 41, 41, 42, 42, 42, 41, 39, 39, 38, 37, 37, 36, 35, 35, 33, 33, 33,
+ 32, 31, 31, 30, 30, 29, 29, 29,
+ /* Size 4x16 */
+ 66, 55, 42, 39, 65, 53, 44, 41, 65, 52, 45, 42, 63, 51, 45, 43, 59, 48,
+ 44, 43, 53, 44, 44, 44, 51, 43, 43, 42, 48, 43, 41, 41, 43, 43, 39, 38,
+ 44, 43, 38, 36, 44, 44, 38, 36, 44, 45, 37, 33, 43, 44, 37, 32, 43, 44,
+ 37, 32, 42, 43, 37, 31, 40, 42, 36, 30,
+ /* Size 16x4 */
+ 66, 65, 65, 63, 59, 53, 51, 48, 43, 44, 44, 44, 43, 43, 42, 40, 55, 53,
+ 52, 51, 48, 44, 43, 43, 43, 43, 44, 45, 44, 44, 43, 42, 42, 44, 45, 45,
+ 44, 44, 43, 41, 39, 38, 38, 37, 37, 37, 37, 36, 39, 41, 42, 43, 43, 44,
+ 42, 41, 38, 36, 36, 33, 32, 32, 31, 30,
+ /* Size 8x32 */
+ 64, 66, 58, 53, 43, 42, 41, 39, 65, 65, 56, 52, 43, 43, 42, 41, 65, 65,
+ 55, 51, 44, 44, 42, 41, 66, 65, 55, 51, 44, 44, 43, 41, 67, 64, 54, 51,
+ 45, 45, 44, 42, 67, 64, 54, 50, 45, 45, 44, 43, 66, 62, 53, 49, 45, 45,
+ 44, 43, 61, 58, 50, 47, 44, 45, 44, 43, 61, 57, 49, 47, 44, 45, 44, 43,
+ 59, 55, 48, 46, 44, 45, 44, 43, 55, 51, 45, 43, 43, 45, 45, 44, 55, 51,
+ 45, 43, 43, 45, 45, 44, 53, 50, 45, 43, 42, 44, 43, 42, 49, 48, 44, 43,
+ 41, 41, 41, 41, 49, 48, 44, 43, 41, 41, 41, 41, 46, 46, 44, 42, 40, 40,
+ 39, 39, 42, 44, 43, 42, 39, 38, 38, 38, 42, 44, 43, 42, 39, 38, 38, 38,
+ 42, 45, 44, 42, 39, 37, 37, 36, 42, 45, 44, 43, 39, 37, 36, 36, 42, 45,
+ 44, 43, 39, 37, 36, 36, 42, 45, 45, 43, 38, 36, 35, 34, 42, 45, 45, 44,
+ 38, 35, 34, 33, 42, 45, 45, 44, 38, 35, 34, 33, 41, 44, 44, 43, 38, 34,
+ 34, 32, 41, 44, 44, 43, 38, 34, 33, 32, 40, 44, 44, 43, 38, 34, 33, 32,
+ 39, 43, 43, 42, 38, 34, 33, 31, 39, 43, 43, 42, 38, 34, 32, 31, 39, 42,
+ 43, 42, 38, 33, 32, 31, 38, 41, 42, 41, 37, 33, 32, 30, 38, 41, 42, 41,
+ 37, 33, 32, 30,
+ /* Size 32x8 */
+ 64, 65, 65, 66, 67, 67, 66, 61, 61, 59, 55, 55, 53, 49, 49, 46, 42, 42,
+ 42, 42, 42, 42, 42, 42, 41, 41, 40, 39, 39, 39, 38, 38, 66, 65, 65, 65,
+ 64, 64, 62, 58, 57, 55, 51, 51, 50, 48, 48, 46, 44, 44, 45, 45, 45, 45,
+ 45, 45, 44, 44, 44, 43, 43, 42, 41, 41, 58, 56, 55, 55, 54, 54, 53, 50,
+ 49, 48, 45, 45, 45, 44, 44, 44, 43, 43, 44, 44, 44, 45, 45, 45, 44, 44,
+ 44, 43, 43, 43, 42, 42, 53, 52, 51, 51, 51, 50, 49, 47, 47, 46, 43, 43,
+ 43, 43, 43, 42, 42, 42, 42, 43, 43, 43, 44, 44, 43, 43, 43, 42, 42, 42,
+ 41, 41, 43, 43, 44, 44, 45, 45, 45, 44, 44, 44, 43, 43, 42, 41, 41, 40,
+ 39, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 38, 38, 38, 37, 37, 42, 43,
+ 44, 44, 45, 45, 45, 45, 45, 45, 45, 45, 44, 41, 41, 40, 38, 38, 37, 37,
+ 37, 36, 35, 35, 34, 34, 34, 34, 34, 33, 33, 33, 41, 42, 42, 43, 44, 44,
+ 44, 44, 44, 44, 45, 45, 43, 41, 41, 39, 38, 38, 37, 36, 36, 35, 34, 34,
+ 34, 33, 33, 33, 32, 32, 32, 32, 39, 41, 41, 41, 42, 43, 43, 43, 43, 43,
+ 44, 44, 42, 41, 41, 39, 38, 38, 36, 36, 36, 34, 33, 33, 32, 32, 32, 31,
+ 31, 31, 30, 30 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 63, 54, 54, 38,
+#endif
+ /* Size 4x4 */
+ 64, 63, 59, 48, 63, 59, 55, 48, 59, 55, 42, 38, 48, 48, 38, 32,
+ /* Size 8x8 */
+ 65, 65, 64, 64, 60, 55, 48, 44, 65, 63, 63, 63, 60, 57, 50, 46, 64, 63,
+ 61, 60, 58, 54, 49, 45, 64, 63, 60, 58, 55, 52, 48, 45, 60, 60, 58, 55,
+ 50, 46, 42, 39, 55, 57, 54, 52, 46, 40, 37, 34, 48, 50, 49, 48, 42, 37,
+ 32, 31, 44, 46, 45, 45, 39, 34, 31, 29,
+ /* Size 16x16 */
+ 64, 65, 65, 65, 65, 65, 64, 63, 60, 58, 57, 52, 50, 47, 43, 42, 65, 64,
+ 64, 64, 64, 64, 63, 62, 60, 59, 59, 53, 51, 48, 45, 44, 65, 64, 64, 64,
+ 63, 63, 63, 62, 60, 59, 59, 54, 52, 49, 46, 45, 65, 64, 64, 63, 63, 63,
+ 63, 62, 61, 60, 59, 55, 53, 50, 47, 46, 65, 64, 63, 63, 62, 62, 61, 60,
+ 59, 57, 57, 53, 51, 49, 46, 45, 65, 64, 63, 63, 62, 61, 60, 59, 58, 57,
+ 56, 53, 51, 49, 46, 45, 64, 63, 63, 63, 61, 60, 58, 57, 55, 54, 53, 51,
+ 49, 48, 46, 45, 63, 62, 62, 62, 60, 59, 57, 56, 54, 52, 51, 49, 48, 46,
+ 44, 43, 60, 60, 60, 61, 59, 58, 55, 54, 52, 49, 48, 46, 45, 43, 41, 40,
+ 58, 59, 59, 60, 57, 57, 54, 52, 49, 45, 44, 41, 41, 39, 37, 37, 57, 59,
+ 59, 59, 57, 56, 53, 51, 48, 44, 42, 41, 39, 38, 37, 36, 52, 53, 54, 55,
+ 53, 53, 51, 49, 46, 41, 41, 38, 37, 35, 34, 34, 50, 51, 52, 53, 51, 51,
+ 49, 48, 45, 41, 39, 37, 36, 34, 33, 32, 47, 48, 49, 50, 49, 49, 48, 46,
+ 43, 39, 38, 35, 34, 32, 31, 31, 43, 45, 46, 47, 46, 46, 46, 44, 41, 37,
+ 37, 34, 33, 31, 29, 29, 42, 44, 45, 46, 45, 45, 45, 43, 40, 37, 36, 34,
+ 32, 31, 29, 29,
+ /* Size 32x32 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 63, 60, 60, 60,
+ 58, 57, 57, 54, 52, 52, 50, 47, 47, 46, 43, 42, 42, 40, 65, 65, 65, 65,
+ 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 62, 60, 60, 60, 59, 58, 58, 55,
+ 53, 53, 51, 48, 48, 47, 44, 44, 44, 41, 65, 65, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 63, 63, 63, 62, 60, 60, 60, 59, 59, 59, 55, 53, 53, 51, 48,
+ 48, 48, 45, 44, 44, 41, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63,
+ 63, 63, 62, 60, 60, 60, 59, 59, 59, 55, 53, 53, 51, 48, 48, 48, 45, 44,
+ 44, 41, 65, 65, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 62, 60,
+ 60, 60, 59, 59, 59, 56, 54, 54, 52, 49, 49, 48, 46, 45, 45, 42, 65, 65,
+ 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 61, 61, 60, 60, 59,
+ 59, 57, 55, 55, 53, 50, 50, 49, 47, 46, 46, 43, 65, 65, 64, 64, 64, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 62, 61, 61, 60, 60, 59, 59, 57, 55, 55,
+ 53, 50, 50, 49, 47, 46, 46, 43, 65, 64, 64, 64, 64, 63, 63, 63, 63, 63,
+ 63, 62, 62, 62, 61, 60, 60, 60, 59, 59, 59, 56, 54, 54, 53, 50, 50, 49,
+ 47, 46, 46, 43, 65, 64, 64, 64, 63, 63, 63, 63, 62, 62, 62, 61, 61, 61,
+ 60, 59, 59, 59, 57, 57, 57, 55, 53, 53, 51, 49, 49, 48, 46, 45, 45, 43,
+ 65, 64, 64, 64, 63, 63, 63, 63, 62, 61, 61, 61, 60, 60, 59, 58, 58, 58,
+ 57, 56, 56, 54, 53, 53, 51, 49, 49, 48, 46, 45, 45, 43, 65, 64, 64, 64,
+ 63, 63, 63, 63, 62, 61, 61, 61, 60, 60, 59, 58, 58, 58, 57, 56, 56, 54,
+ 53, 53, 51, 49, 49, 48, 46, 45, 45, 43, 64, 64, 63, 63, 63, 63, 63, 62,
+ 61, 61, 61, 59, 59, 59, 58, 57, 57, 56, 55, 55, 55, 53, 51, 51, 50, 48,
+ 48, 48, 46, 45, 45, 43, 64, 64, 63, 63, 63, 63, 63, 62, 61, 60, 60, 59,
+ 58, 58, 57, 55, 55, 55, 54, 53, 53, 52, 51, 51, 49, 48, 48, 47, 46, 45,
+ 45, 43, 64, 64, 63, 63, 63, 63, 63, 62, 61, 60, 60, 59, 58, 58, 57, 55,
+ 55, 55, 54, 53, 53, 52, 51, 51, 49, 48, 48, 47, 46, 45, 45, 43, 63, 62,
+ 62, 62, 62, 62, 62, 61, 60, 59, 59, 58, 57, 57, 56, 54, 54, 54, 52, 51,
+ 51, 50, 49, 49, 48, 46, 46, 46, 44, 43, 43, 41, 60, 60, 60, 60, 60, 61,
+ 61, 60, 59, 58, 58, 57, 55, 55, 54, 52, 52, 51, 49, 48, 48, 47, 46, 46,
+ 45, 43, 43, 42, 41, 40, 40, 39, 60, 60, 60, 60, 60, 61, 61, 60, 59, 58,
+ 58, 57, 55, 55, 54, 52, 52, 51, 49, 48, 48, 47, 46, 46, 45, 43, 43, 42,
+ 41, 40, 40, 39, 60, 60, 60, 60, 60, 60, 60, 60, 59, 58, 58, 56, 55, 55,
+ 54, 51, 51, 50, 48, 47, 47, 46, 45, 45, 44, 42, 42, 41, 40, 39, 39, 38,
+ 58, 59, 59, 59, 59, 60, 60, 59, 57, 57, 57, 55, 54, 54, 52, 49, 49, 48,
+ 45, 44, 44, 42, 41, 41, 41, 39, 39, 39, 37, 37, 37, 36, 57, 58, 59, 59,
+ 59, 59, 59, 59, 57, 56, 56, 55, 53, 53, 51, 48, 48, 47, 44, 42, 42, 41,
+ 41, 41, 39, 38, 38, 38, 37, 36, 36, 35, 57, 58, 59, 59, 59, 59, 59, 59,
+ 57, 56, 56, 55, 53, 53, 51, 48, 48, 47, 44, 42, 42, 41, 41, 41, 39, 38,
+ 38, 38, 37, 36, 36, 35, 54, 55, 55, 55, 56, 57, 57, 56, 55, 54, 54, 53,
+ 52, 52, 50, 47, 47, 46, 42, 41, 41, 40, 39, 39, 38, 37, 37, 36, 35, 34,
+ 34, 33, 52, 53, 53, 53, 54, 55, 55, 54, 53, 53, 53, 51, 51, 51, 49, 46,
+ 46, 45, 41, 41, 41, 39, 38, 38, 37, 35, 35, 35, 34, 34, 34, 32, 52, 53,
+ 53, 53, 54, 55, 55, 54, 53, 53, 53, 51, 51, 51, 49, 46, 46, 45, 41, 41,
+ 41, 39, 38, 38, 37, 35, 35, 35, 34, 34, 34, 32, 50, 51, 51, 51, 52, 53,
+ 53, 53, 51, 51, 51, 50, 49, 49, 48, 45, 45, 44, 41, 39, 39, 38, 37, 37,
+ 36, 34, 34, 34, 33, 32, 32, 31, 47, 48, 48, 48, 49, 50, 50, 50, 49, 49,
+ 49, 48, 48, 48, 46, 43, 43, 42, 39, 38, 38, 37, 35, 35, 34, 32, 32, 32,
+ 31, 31, 31, 29, 47, 48, 48, 48, 49, 50, 50, 50, 49, 49, 49, 48, 48, 48,
+ 46, 43, 43, 42, 39, 38, 38, 37, 35, 35, 34, 32, 32, 32, 31, 31, 31, 29,
+ 46, 47, 48, 48, 48, 49, 49, 49, 48, 48, 48, 48, 47, 47, 46, 42, 42, 41,
+ 39, 38, 38, 36, 35, 35, 34, 32, 32, 32, 31, 30, 30, 29, 43, 44, 45, 45,
+ 46, 47, 47, 47, 46, 46, 46, 46, 46, 46, 44, 41, 41, 40, 37, 37, 37, 35,
+ 34, 34, 33, 31, 31, 31, 29, 29, 29, 28, 42, 44, 44, 44, 45, 46, 46, 46,
+ 45, 45, 45, 45, 45, 45, 43, 40, 40, 39, 37, 36, 36, 34, 34, 34, 32, 31,
+ 31, 30, 29, 29, 29, 28, 42, 44, 44, 44, 45, 46, 46, 46, 45, 45, 45, 45,
+ 45, 45, 43, 40, 40, 39, 37, 36, 36, 34, 34, 34, 32, 31, 31, 30, 29, 29,
+ 29, 28, 40, 41, 41, 41, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 41, 39,
+ 39, 38, 36, 35, 35, 33, 32, 32, 31, 29, 29, 29, 28, 28, 28, 26,
+ /* Size 4x8 */
+ 65, 63, 58, 48, 64, 62, 59, 50, 63, 60, 56, 49, 63, 58, 53, 48, 60, 55,
+ 47, 42, 55, 51, 41, 37, 49, 48, 38, 33, 45, 44, 36, 31,
+ /* Size 8x4 */
+ 65, 64, 63, 63, 60, 55, 49, 45, 63, 62, 60, 58, 55, 51, 48, 44, 58, 59,
+ 56, 53, 47, 41, 38, 36, 48, 50, 49, 48, 42, 37, 33, 31,
+ /* Size 8x16 */
+ 64, 65, 65, 64, 59, 57, 47, 43, 65, 64, 64, 63, 59, 58, 48, 45, 65, 64,
+ 63, 63, 59, 59, 49, 46, 65, 63, 63, 62, 60, 59, 50, 47, 65, 63, 62, 60,
+ 58, 57, 49, 46, 64, 63, 62, 60, 57, 56, 49, 46, 64, 62, 60, 58, 55, 53,
+ 48, 46, 63, 62, 59, 57, 53, 51, 46, 44, 60, 60, 59, 55, 49, 48, 43, 41,
+ 58, 59, 57, 54, 46, 44, 39, 37, 57, 59, 57, 53, 45, 43, 38, 37, 52, 55,
+ 53, 51, 43, 41, 35, 34, 50, 53, 51, 49, 41, 40, 34, 33, 47, 50, 49, 48,
+ 40, 38, 33, 31, 44, 47, 46, 45, 38, 37, 31, 29, 43, 46, 45, 44, 38, 36,
+ 31, 29,
+ /* Size 16x8 */
+ 64, 65, 65, 65, 65, 64, 64, 63, 60, 58, 57, 52, 50, 47, 44, 43, 65, 64,
+ 64, 63, 63, 63, 62, 62, 60, 59, 59, 55, 53, 50, 47, 46, 65, 64, 63, 63,
+ 62, 62, 60, 59, 59, 57, 57, 53, 51, 49, 46, 45, 64, 63, 63, 62, 60, 60,
+ 58, 57, 55, 54, 53, 51, 49, 48, 45, 44, 59, 59, 59, 60, 58, 57, 55, 53,
+ 49, 46, 45, 43, 41, 40, 38, 38, 57, 58, 59, 59, 57, 56, 53, 51, 48, 44,
+ 43, 41, 40, 38, 37, 36, 47, 48, 49, 50, 49, 49, 48, 46, 43, 39, 38, 35,
+ 34, 33, 31, 31, 43, 45, 46, 47, 46, 46, 46, 44, 41, 37, 37, 34, 33, 31,
+ 29, 29,
+ /* Size 16x32 */
+ 64, 65, 65, 65, 65, 64, 64, 63, 59, 57, 57, 51, 47, 47, 43, 38, 65, 65,
+ 64, 64, 64, 63, 63, 62, 59, 58, 58, 52, 48, 48, 44, 39, 65, 64, 64, 64,
+ 64, 63, 63, 62, 59, 58, 58, 52, 48, 48, 45, 40, 65, 64, 64, 64, 64, 63,
+ 63, 62, 59, 58, 58, 52, 48, 48, 45, 40, 65, 64, 64, 64, 63, 63, 63, 62,
+ 59, 59, 59, 53, 49, 49, 46, 41, 65, 64, 63, 63, 63, 62, 62, 62, 60, 59,
+ 59, 54, 50, 50, 47, 41, 65, 64, 63, 63, 63, 62, 62, 62, 60, 59, 59, 54,
+ 50, 50, 47, 41, 65, 64, 63, 63, 63, 62, 62, 61, 59, 59, 59, 53, 50, 50,
+ 47, 41, 65, 64, 63, 63, 62, 60, 60, 59, 58, 57, 57, 52, 49, 49, 46, 41,
+ 64, 63, 63, 63, 62, 60, 60, 59, 57, 56, 56, 52, 49, 49, 46, 41, 64, 63,
+ 63, 63, 62, 60, 60, 59, 57, 56, 56, 52, 49, 49, 46, 41, 64, 63, 63, 63,
+ 61, 59, 59, 58, 55, 55, 55, 51, 48, 48, 46, 41, 64, 63, 62, 62, 60, 58,
+ 58, 57, 55, 53, 53, 50, 48, 48, 46, 41, 64, 63, 62, 62, 60, 58, 58, 57,
+ 55, 53, 53, 50, 48, 48, 46, 41, 63, 62, 62, 62, 59, 57, 57, 56, 53, 51,
+ 51, 48, 46, 46, 44, 40, 60, 60, 60, 60, 59, 55, 55, 54, 49, 48, 48, 45,
+ 43, 43, 41, 38, 60, 60, 60, 60, 59, 55, 55, 54, 49, 48, 48, 45, 43, 43,
+ 41, 38, 60, 60, 60, 60, 59, 55, 55, 53, 49, 47, 47, 44, 42, 42, 40, 37,
+ 58, 59, 59, 59, 57, 54, 54, 52, 46, 44, 44, 41, 39, 39, 37, 35, 57, 59,
+ 59, 59, 57, 53, 53, 51, 45, 43, 43, 40, 38, 38, 37, 34, 57, 59, 59, 59,
+ 57, 53, 53, 51, 45, 43, 43, 40, 38, 38, 37, 34, 54, 55, 56, 56, 55, 51,
+ 51, 49, 44, 41, 41, 38, 37, 37, 35, 33, 52, 53, 55, 55, 53, 51, 51, 48,
+ 43, 41, 41, 38, 35, 35, 34, 32, 52, 53, 55, 55, 53, 51, 51, 48, 43, 41,
+ 41, 38, 35, 35, 34, 32, 50, 51, 53, 53, 51, 49, 49, 47, 41, 40, 40, 36,
+ 34, 34, 33, 30, 47, 49, 50, 50, 49, 48, 48, 46, 40, 38, 38, 35, 33, 33,
+ 31, 29, 47, 49, 50, 50, 49, 48, 48, 46, 40, 38, 38, 35, 33, 33, 31, 29,
+ 46, 48, 49, 49, 48, 47, 47, 45, 40, 38, 38, 34, 32, 32, 31, 28, 44, 45,
+ 47, 47, 46, 45, 45, 43, 38, 37, 37, 33, 31, 31, 29, 27, 43, 45, 46, 46,
+ 45, 44, 44, 43, 38, 36, 36, 33, 31, 31, 29, 27, 43, 45, 46, 46, 45, 44,
+ 44, 43, 38, 36, 36, 33, 31, 31, 29, 27, 40, 42, 43, 43, 43, 42, 42, 41,
+ 37, 35, 35, 32, 29, 29, 28, 26,
+ /* Size 32x16 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 63, 60, 60, 60,
+ 58, 57, 57, 54, 52, 52, 50, 47, 47, 46, 44, 43, 43, 40, 65, 65, 64, 64,
+ 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 62, 60, 60, 60, 59, 59, 59, 55,
+ 53, 53, 51, 49, 49, 48, 45, 45, 45, 42, 65, 64, 64, 64, 64, 63, 63, 63,
+ 63, 63, 63, 63, 62, 62, 62, 60, 60, 60, 59, 59, 59, 56, 55, 55, 53, 50,
+ 50, 49, 47, 46, 46, 43, 65, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63,
+ 62, 62, 62, 60, 60, 60, 59, 59, 59, 56, 55, 55, 53, 50, 50, 49, 47, 46,
+ 46, 43, 65, 64, 64, 64, 63, 63, 63, 63, 62, 62, 62, 61, 60, 60, 59, 59,
+ 59, 59, 57, 57, 57, 55, 53, 53, 51, 49, 49, 48, 46, 45, 45, 43, 64, 63,
+ 63, 63, 63, 62, 62, 62, 60, 60, 60, 59, 58, 58, 57, 55, 55, 55, 54, 53,
+ 53, 51, 51, 51, 49, 48, 48, 47, 45, 44, 44, 42, 64, 63, 63, 63, 63, 62,
+ 62, 62, 60, 60, 60, 59, 58, 58, 57, 55, 55, 55, 54, 53, 53, 51, 51, 51,
+ 49, 48, 48, 47, 45, 44, 44, 42, 63, 62, 62, 62, 62, 62, 62, 61, 59, 59,
+ 59, 58, 57, 57, 56, 54, 54, 53, 52, 51, 51, 49, 48, 48, 47, 46, 46, 45,
+ 43, 43, 43, 41, 59, 59, 59, 59, 59, 60, 60, 59, 58, 57, 57, 55, 55, 55,
+ 53, 49, 49, 49, 46, 45, 45, 44, 43, 43, 41, 40, 40, 40, 38, 38, 38, 37,
+ 57, 58, 58, 58, 59, 59, 59, 59, 57, 56, 56, 55, 53, 53, 51, 48, 48, 47,
+ 44, 43, 43, 41, 41, 41, 40, 38, 38, 38, 37, 36, 36, 35, 57, 58, 58, 58,
+ 59, 59, 59, 59, 57, 56, 56, 55, 53, 53, 51, 48, 48, 47, 44, 43, 43, 41,
+ 41, 41, 40, 38, 38, 38, 37, 36, 36, 35, 51, 52, 52, 52, 53, 54, 54, 53,
+ 52, 52, 52, 51, 50, 50, 48, 45, 45, 44, 41, 40, 40, 38, 38, 38, 36, 35,
+ 35, 34, 33, 33, 33, 32, 47, 48, 48, 48, 49, 50, 50, 50, 49, 49, 49, 48,
+ 48, 48, 46, 43, 43, 42, 39, 38, 38, 37, 35, 35, 34, 33, 33, 32, 31, 31,
+ 31, 29, 47, 48, 48, 48, 49, 50, 50, 50, 49, 49, 49, 48, 48, 48, 46, 43,
+ 43, 42, 39, 38, 38, 37, 35, 35, 34, 33, 33, 32, 31, 31, 31, 29, 43, 44,
+ 45, 45, 46, 47, 47, 47, 46, 46, 46, 46, 46, 46, 44, 41, 41, 40, 37, 37,
+ 37, 35, 34, 34, 33, 31, 31, 31, 29, 29, 29, 28, 38, 39, 40, 40, 41, 41,
+ 41, 41, 41, 41, 41, 41, 41, 41, 40, 38, 38, 37, 35, 34, 34, 33, 32, 32,
+ 30, 29, 29, 28, 27, 27, 27, 26,
+ /* Size 4x16 */
+ 65, 64, 57, 47, 64, 63, 58, 48, 64, 63, 59, 49, 64, 62, 59, 50, 64, 60,
+ 57, 49, 63, 60, 56, 49, 63, 58, 53, 48, 62, 57, 51, 46, 60, 55, 48, 43,
+ 59, 54, 44, 39, 59, 53, 43, 38, 53, 51, 41, 35, 51, 49, 40, 34, 49, 48,
+ 38, 33, 45, 45, 37, 31, 45, 44, 36, 31,
+ /* Size 16x4 */
+ 65, 64, 64, 64, 64, 63, 63, 62, 60, 59, 59, 53, 51, 49, 45, 45, 64, 63,
+ 63, 62, 60, 60, 58, 57, 55, 54, 53, 51, 49, 48, 45, 44, 57, 58, 59, 59,
+ 57, 56, 53, 51, 48, 44, 43, 41, 40, 38, 37, 36, 47, 48, 49, 50, 49, 49,
+ 48, 46, 43, 39, 38, 35, 34, 33, 31, 31,
+ /* Size 8x32 */
+ 64, 65, 65, 64, 59, 57, 47, 43, 65, 64, 64, 63, 59, 58, 48, 44, 65, 64,
+ 64, 63, 59, 58, 48, 45, 65, 64, 64, 63, 59, 58, 48, 45, 65, 64, 63, 63,
+ 59, 59, 49, 46, 65, 63, 63, 62, 60, 59, 50, 47, 65, 63, 63, 62, 60, 59,
+ 50, 47, 65, 63, 63, 62, 59, 59, 50, 47, 65, 63, 62, 60, 58, 57, 49, 46,
+ 64, 63, 62, 60, 57, 56, 49, 46, 64, 63, 62, 60, 57, 56, 49, 46, 64, 63,
+ 61, 59, 55, 55, 48, 46, 64, 62, 60, 58, 55, 53, 48, 46, 64, 62, 60, 58,
+ 55, 53, 48, 46, 63, 62, 59, 57, 53, 51, 46, 44, 60, 60, 59, 55, 49, 48,
+ 43, 41, 60, 60, 59, 55, 49, 48, 43, 41, 60, 60, 59, 55, 49, 47, 42, 40,
+ 58, 59, 57, 54, 46, 44, 39, 37, 57, 59, 57, 53, 45, 43, 38, 37, 57, 59,
+ 57, 53, 45, 43, 38, 37, 54, 56, 55, 51, 44, 41, 37, 35, 52, 55, 53, 51,
+ 43, 41, 35, 34, 52, 55, 53, 51, 43, 41, 35, 34, 50, 53, 51, 49, 41, 40,
+ 34, 33, 47, 50, 49, 48, 40, 38, 33, 31, 47, 50, 49, 48, 40, 38, 33, 31,
+ 46, 49, 48, 47, 40, 38, 32, 31, 44, 47, 46, 45, 38, 37, 31, 29, 43, 46,
+ 45, 44, 38, 36, 31, 29, 43, 46, 45, 44, 38, 36, 31, 29, 40, 43, 43, 42,
+ 37, 35, 29, 28,
+ /* Size 32x8 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 63, 60, 60, 60,
+ 58, 57, 57, 54, 52, 52, 50, 47, 47, 46, 44, 43, 43, 40, 65, 64, 64, 64,
+ 64, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 60, 60, 60, 59, 59, 59, 56,
+ 55, 55, 53, 50, 50, 49, 47, 46, 46, 43, 65, 64, 64, 64, 63, 63, 63, 63,
+ 62, 62, 62, 61, 60, 60, 59, 59, 59, 59, 57, 57, 57, 55, 53, 53, 51, 49,
+ 49, 48, 46, 45, 45, 43, 64, 63, 63, 63, 63, 62, 62, 62, 60, 60, 60, 59,
+ 58, 58, 57, 55, 55, 55, 54, 53, 53, 51, 51, 51, 49, 48, 48, 47, 45, 44,
+ 44, 42, 59, 59, 59, 59, 59, 60, 60, 59, 58, 57, 57, 55, 55, 55, 53, 49,
+ 49, 49, 46, 45, 45, 44, 43, 43, 41, 40, 40, 40, 38, 38, 38, 37, 57, 58,
+ 58, 58, 59, 59, 59, 59, 57, 56, 56, 55, 53, 53, 51, 48, 48, 47, 44, 43,
+ 43, 41, 41, 41, 40, 38, 38, 38, 37, 36, 36, 35, 47, 48, 48, 48, 49, 50,
+ 50, 50, 49, 49, 49, 48, 48, 48, 46, 43, 43, 42, 39, 38, 38, 37, 35, 35,
+ 34, 33, 33, 32, 31, 31, 31, 29, 43, 44, 45, 45, 46, 47, 47, 47, 46, 46,
+ 46, 46, 46, 46, 44, 41, 41, 40, 37, 37, 37, 35, 34, 34, 33, 31, 31, 31,
+ 29, 29, 29, 28 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 62, 45, 45, 38,
+#endif
+ /* Size 4x4 */
+ 65, 55, 43, 44, 55, 47, 43, 45, 43, 43, 39, 38, 44, 45, 38, 35,
+ /* Size 8x8 */
+ 65, 66, 60, 55, 48, 43, 43, 41, 66, 64, 58, 51, 47, 45, 46, 44, 60, 58,
+ 53, 47, 45, 44, 45, 44, 55, 51, 47, 43, 43, 44, 45, 45, 48, 47, 45, 43,
+ 41, 41, 41, 41, 43, 45, 44, 44, 41, 38, 37, 37, 43, 46, 45, 45, 41, 37,
+ 35, 34, 41, 44, 44, 45, 41, 37, 34, 33,
+ /* Size 16x16 */
+ 64, 66, 66, 67, 62, 61, 56, 53, 49, 43, 42, 42, 42, 42, 41, 41, 66, 65,
+ 65, 66, 60, 59, 53, 51, 48, 44, 43, 44, 44, 44, 43, 42, 66, 65, 65, 65,
+ 60, 59, 53, 51, 48, 45, 44, 44, 44, 45, 43, 43, 67, 66, 65, 64, 59, 58,
+ 51, 50, 48, 45, 44, 45, 45, 46, 45, 44, 62, 60, 60, 59, 55, 53, 48, 47,
+ 46, 44, 44, 45, 45, 45, 44, 44, 61, 59, 59, 58, 53, 53, 47, 47, 46, 44,
+ 43, 44, 45, 45, 44, 44, 56, 53, 53, 51, 48, 47, 43, 43, 43, 43, 43, 44,
+ 45, 45, 45, 45, 53, 51, 51, 50, 47, 47, 43, 43, 43, 42, 42, 43, 43, 44,
+ 43, 43, 49, 48, 48, 48, 46, 46, 43, 43, 42, 41, 41, 41, 41, 42, 41, 41,
+ 43, 44, 45, 45, 44, 44, 43, 42, 41, 39, 39, 39, 39, 39, 39, 39, 42, 43,
+ 44, 44, 44, 43, 43, 42, 41, 39, 39, 39, 38, 38, 38, 38, 42, 44, 44, 45,
+ 45, 44, 44, 43, 41, 39, 39, 38, 37, 37, 36, 36, 42, 44, 44, 45, 45, 45,
+ 45, 43, 41, 39, 38, 37, 37, 36, 36, 35, 42, 44, 45, 46, 45, 45, 45, 44,
+ 42, 39, 38, 37, 36, 35, 34, 34, 41, 43, 43, 45, 44, 44, 45, 43, 41, 39,
+ 38, 36, 36, 34, 34, 34, 41, 42, 43, 44, 44, 44, 45, 43, 41, 39, 38, 36,
+ 35, 34, 34, 33,
+ /* Size 32x32 */
+ 64, 65, 66, 66, 66, 67, 67, 66, 62, 61, 61, 58, 56, 56, 53, 49, 49, 48,
+ 43, 42, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 41, 40, 65, 65, 65, 65,
+ 66, 66, 66, 65, 61, 60, 60, 57, 55, 55, 52, 49, 49, 48, 44, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 42, 41, 41, 41, 66, 65, 65, 65, 65, 66, 66, 64,
+ 60, 59, 59, 55, 53, 53, 51, 48, 48, 47, 44, 43, 43, 43, 44, 44, 44, 44,
+ 44, 44, 43, 42, 42, 41, 66, 65, 65, 65, 65, 66, 66, 64, 60, 59, 59, 55,
+ 53, 53, 51, 48, 48, 47, 44, 43, 43, 43, 44, 44, 44, 44, 44, 44, 43, 42,
+ 42, 41, 66, 66, 65, 65, 65, 65, 65, 64, 60, 59, 59, 55, 53, 53, 51, 48,
+ 48, 47, 45, 44, 44, 44, 44, 44, 44, 45, 45, 44, 43, 43, 43, 42, 67, 66,
+ 66, 66, 65, 64, 64, 63, 59, 58, 58, 54, 51, 51, 50, 48, 48, 47, 45, 44,
+ 44, 45, 45, 45, 45, 46, 46, 45, 45, 44, 44, 44, 67, 66, 66, 66, 65, 64,
+ 64, 63, 59, 58, 58, 54, 51, 51, 50, 48, 48, 47, 45, 44, 44, 45, 45, 45,
+ 45, 46, 46, 45, 45, 44, 44, 44, 66, 65, 64, 64, 64, 63, 63, 62, 58, 57,
+ 57, 53, 51, 51, 49, 48, 48, 47, 45, 44, 44, 45, 45, 45, 45, 46, 46, 45,
+ 45, 44, 44, 44, 62, 61, 60, 60, 60, 59, 59, 58, 55, 53, 53, 50, 48, 48,
+ 47, 46, 46, 46, 44, 44, 44, 44, 45, 45, 45, 45, 45, 45, 44, 44, 44, 44,
+ 61, 60, 59, 59, 59, 58, 58, 57, 53, 53, 53, 49, 47, 47, 47, 46, 46, 45,
+ 44, 43, 43, 44, 44, 44, 45, 45, 45, 45, 44, 44, 44, 44, 61, 60, 59, 59,
+ 59, 58, 58, 57, 53, 53, 53, 49, 47, 47, 47, 46, 46, 45, 44, 43, 43, 44,
+ 44, 44, 45, 45, 45, 45, 44, 44, 44, 44, 58, 57, 55, 55, 55, 54, 54, 53,
+ 50, 49, 49, 47, 45, 45, 45, 44, 44, 44, 43, 43, 43, 44, 44, 44, 45, 45,
+ 45, 45, 45, 44, 44, 44, 56, 55, 53, 53, 53, 51, 51, 51, 48, 47, 47, 45,
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 44, 44, 44, 45, 45, 45, 45, 45, 45,
+ 45, 44, 56, 55, 53, 53, 53, 51, 51, 51, 48, 47, 47, 45, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 44, 44, 44, 45, 45, 45, 45, 45, 45, 45, 44, 53, 52,
+ 51, 51, 51, 50, 50, 49, 47, 47, 47, 45, 43, 43, 43, 43, 43, 43, 42, 42,
+ 42, 43, 43, 43, 43, 44, 44, 44, 43, 43, 43, 43, 49, 49, 48, 48, 48, 48,
+ 48, 48, 46, 46, 46, 44, 43, 43, 43, 42, 42, 42, 41, 41, 41, 41, 41, 41,
+ 41, 42, 42, 41, 41, 41, 41, 41, 49, 49, 48, 48, 48, 48, 48, 48, 46, 46,
+ 46, 44, 43, 43, 43, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 42, 42, 41,
+ 41, 41, 41, 41, 48, 48, 47, 47, 47, 47, 47, 47, 46, 45, 45, 44, 43, 43,
+ 43, 42, 42, 41, 41, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 40,
+ 43, 44, 44, 44, 45, 45, 45, 45, 44, 44, 44, 43, 43, 43, 42, 41, 41, 41,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 38, 42, 43, 43, 43,
+ 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 42, 41, 41, 40, 39, 39, 39, 39,
+ 39, 39, 38, 38, 38, 38, 38, 38, 38, 38, 42, 43, 43, 43, 44, 44, 44, 44,
+ 44, 43, 43, 43, 43, 43, 42, 41, 41, 40, 39, 39, 39, 39, 39, 39, 38, 38,
+ 38, 38, 38, 38, 38, 38, 42, 43, 43, 43, 44, 45, 45, 45, 44, 44, 44, 44,
+ 44, 44, 43, 41, 41, 41, 39, 39, 39, 38, 38, 38, 38, 37, 37, 37, 37, 37,
+ 37, 37, 42, 43, 44, 44, 44, 45, 45, 45, 45, 44, 44, 44, 44, 44, 43, 41,
+ 41, 41, 39, 39, 39, 38, 38, 38, 37, 37, 37, 37, 36, 36, 36, 36, 42, 43,
+ 44, 44, 44, 45, 45, 45, 45, 44, 44, 44, 44, 44, 43, 41, 41, 41, 39, 39,
+ 39, 38, 38, 38, 37, 37, 37, 37, 36, 36, 36, 36, 42, 43, 44, 44, 44, 45,
+ 45, 45, 45, 45, 45, 45, 45, 45, 43, 41, 41, 41, 39, 38, 38, 38, 37, 37,
+ 37, 36, 36, 36, 36, 35, 35, 35, 42, 43, 44, 44, 45, 46, 46, 46, 45, 45,
+ 45, 45, 45, 45, 44, 42, 42, 41, 39, 38, 38, 37, 37, 37, 36, 35, 35, 35,
+ 34, 34, 34, 34, 42, 43, 44, 44, 45, 46, 46, 46, 45, 45, 45, 45, 45, 45,
+ 44, 42, 42, 41, 39, 38, 38, 37, 37, 37, 36, 35, 35, 35, 34, 34, 34, 34,
+ 41, 43, 44, 44, 44, 45, 45, 45, 45, 45, 45, 45, 45, 45, 44, 41, 41, 41,
+ 39, 38, 38, 37, 37, 37, 36, 35, 35, 35, 34, 34, 34, 34, 41, 42, 43, 43,
+ 43, 45, 45, 45, 44, 44, 44, 45, 45, 45, 43, 41, 41, 41, 39, 38, 38, 37,
+ 36, 36, 36, 34, 34, 34, 34, 34, 34, 33, 41, 41, 42, 42, 43, 44, 44, 44,
+ 44, 44, 44, 44, 45, 45, 43, 41, 41, 41, 39, 38, 38, 37, 36, 36, 35, 34,
+ 34, 34, 34, 33, 33, 33, 41, 41, 42, 42, 43, 44, 44, 44, 44, 44, 44, 44,
+ 45, 45, 43, 41, 41, 41, 39, 38, 38, 37, 36, 36, 35, 34, 34, 34, 34, 33,
+ 33, 33, 40, 41, 41, 41, 42, 44, 44, 44, 44, 44, 44, 44, 44, 44, 43, 41,
+ 41, 40, 38, 38, 38, 37, 36, 36, 35, 34, 34, 34, 33, 33, 33, 32,
+ /* Size 4x8 */
+ 65, 54, 43, 43, 65, 51, 45, 45, 59, 48, 44, 45, 53, 44, 43, 45, 47, 43,
+ 41, 41, 44, 43, 39, 37, 44, 45, 38, 35, 43, 44, 38, 34,
+ /* Size 8x4 */
+ 65, 65, 59, 53, 47, 44, 44, 43, 54, 51, 48, 44, 43, 43, 45, 44, 43, 45,
+ 44, 43, 41, 39, 38, 38, 43, 45, 45, 45, 41, 37, 35, 34,
+ /* Size 8x16 */
+ 64, 66, 62, 55, 45, 43, 42, 41, 65, 65, 60, 53, 46, 44, 44, 42, 66, 64,
+ 59, 53, 46, 44, 44, 43, 67, 64, 59, 51, 46, 45, 45, 44, 62, 59, 55, 48,
+ 45, 44, 45, 44, 61, 57, 53, 48, 45, 44, 45, 44, 55, 51, 48, 44, 43, 43,
+ 45, 45, 53, 50, 47, 43, 42, 42, 44, 43, 49, 48, 46, 43, 41, 41, 41, 41,
+ 43, 45, 44, 43, 40, 39, 39, 39, 42, 44, 44, 43, 39, 39, 38, 38, 42, 45,
+ 44, 44, 40, 39, 37, 36, 42, 45, 45, 44, 40, 39, 36, 36, 42, 45, 45, 45,
+ 40, 38, 35, 34, 41, 44, 44, 44, 39, 38, 34, 34, 41, 44, 44, 44, 39, 38,
+ 34, 33,
+ /* Size 16x8 */
+ 64, 65, 66, 67, 62, 61, 55, 53, 49, 43, 42, 42, 42, 42, 41, 41, 66, 65,
+ 64, 64, 59, 57, 51, 50, 48, 45, 44, 45, 45, 45, 44, 44, 62, 60, 59, 59,
+ 55, 53, 48, 47, 46, 44, 44, 44, 45, 45, 44, 44, 55, 53, 53, 51, 48, 48,
+ 44, 43, 43, 43, 43, 44, 44, 45, 44, 44, 45, 46, 46, 46, 45, 45, 43, 42,
+ 41, 40, 39, 40, 40, 40, 39, 39, 43, 44, 44, 45, 44, 44, 43, 42, 41, 39,
+ 39, 39, 39, 38, 38, 38, 42, 44, 44, 45, 45, 45, 45, 44, 41, 39, 38, 37,
+ 36, 35, 34, 34, 41, 42, 43, 44, 44, 44, 45, 43, 41, 39, 38, 36, 36, 34,
+ 34, 33,
+ /* Size 16x32 */
+ 64, 66, 66, 66, 62, 55, 55, 53, 45, 43, 43, 42, 42, 42, 41, 39, 65, 65,
+ 65, 65, 61, 54, 54, 52, 46, 43, 43, 43, 43, 43, 42, 40, 65, 65, 65, 65,
+ 60, 53, 53, 51, 46, 44, 44, 44, 44, 44, 42, 41, 65, 65, 65, 65, 60, 53,
+ 53, 51, 46, 44, 44, 44, 44, 44, 42, 41, 66, 65, 64, 64, 59, 53, 53, 51,
+ 46, 44, 44, 44, 44, 44, 43, 42, 67, 65, 64, 64, 59, 51, 51, 50, 46, 45,
+ 45, 45, 45, 45, 44, 43, 67, 65, 64, 64, 59, 51, 51, 50, 46, 45, 45, 45,
+ 45, 45, 44, 43, 66, 64, 62, 62, 58, 51, 51, 49, 46, 45, 45, 45, 45, 45,
+ 44, 43, 62, 60, 59, 59, 55, 48, 48, 48, 45, 44, 44, 45, 45, 45, 44, 43,
+ 61, 59, 57, 57, 53, 48, 48, 47, 45, 44, 44, 44, 45, 45, 44, 43, 61, 59,
+ 57, 57, 53, 48, 48, 47, 45, 44, 44, 44, 45, 45, 44, 43, 58, 55, 53, 53,
+ 50, 45, 45, 45, 44, 43, 43, 44, 45, 45, 44, 43, 55, 53, 51, 51, 48, 44,
+ 44, 43, 43, 43, 43, 44, 45, 45, 45, 44, 55, 53, 51, 51, 48, 44, 44, 43,
+ 43, 43, 43, 44, 45, 45, 45, 44, 53, 51, 50, 50, 47, 43, 43, 43, 42, 42,
+ 42, 43, 44, 44, 43, 42, 49, 48, 48, 48, 46, 43, 43, 43, 41, 41, 41, 41,
+ 41, 41, 41, 41, 49, 48, 48, 48, 46, 43, 43, 43, 41, 41, 41, 41, 41, 41,
+ 41, 41, 48, 47, 47, 47, 46, 43, 43, 43, 41, 41, 41, 41, 41, 41, 41, 40,
+ 43, 44, 45, 45, 44, 43, 43, 42, 40, 39, 39, 39, 39, 39, 39, 38, 42, 43,
+ 44, 44, 44, 43, 43, 42, 39, 39, 39, 38, 38, 38, 38, 38, 42, 43, 44, 44,
+ 44, 43, 43, 42, 39, 39, 39, 38, 38, 38, 38, 38, 42, 44, 45, 45, 44, 43,
+ 43, 42, 39, 39, 39, 38, 37, 37, 37, 36, 42, 44, 45, 45, 44, 44, 44, 43,
+ 40, 39, 39, 38, 37, 37, 36, 36, 42, 44, 45, 45, 44, 44, 44, 43, 40, 39,
+ 39, 38, 37, 37, 36, 36, 42, 44, 45, 45, 45, 44, 44, 43, 40, 39, 39, 37,
+ 36, 36, 36, 35, 42, 44, 45, 45, 45, 45, 45, 44, 40, 38, 38, 36, 35, 35,
+ 34, 33, 42, 44, 45, 45, 45, 45, 45, 44, 40, 38, 38, 36, 35, 35, 34, 33,
+ 42, 44, 45, 45, 45, 45, 45, 43, 39, 38, 38, 36, 35, 35, 34, 33, 41, 43,
+ 44, 44, 44, 44, 44, 43, 39, 38, 38, 36, 34, 34, 34, 32, 41, 43, 44, 44,
+ 44, 44, 44, 43, 39, 38, 38, 36, 34, 34, 33, 32, 41, 43, 44, 44, 44, 44,
+ 44, 43, 39, 38, 38, 36, 34, 34, 33, 32, 40, 42, 43, 43, 43, 44, 44, 42,
+ 39, 38, 38, 35, 34, 34, 33, 31,
+ /* Size 32x16 */
+ 64, 65, 65, 65, 66, 67, 67, 66, 62, 61, 61, 58, 55, 55, 53, 49, 49, 48,
+ 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 40, 66, 65, 65, 65,
+ 65, 65, 65, 64, 60, 59, 59, 55, 53, 53, 51, 48, 48, 47, 44, 43, 43, 44,
+ 44, 44, 44, 44, 44, 44, 43, 43, 43, 42, 66, 65, 65, 65, 64, 64, 64, 62,
+ 59, 57, 57, 53, 51, 51, 50, 48, 48, 47, 45, 44, 44, 45, 45, 45, 45, 45,
+ 45, 45, 44, 44, 44, 43, 66, 65, 65, 65, 64, 64, 64, 62, 59, 57, 57, 53,
+ 51, 51, 50, 48, 48, 47, 45, 44, 44, 45, 45, 45, 45, 45, 45, 45, 44, 44,
+ 44, 43, 62, 61, 60, 60, 59, 59, 59, 58, 55, 53, 53, 50, 48, 48, 47, 46,
+ 46, 46, 44, 44, 44, 44, 44, 44, 45, 45, 45, 45, 44, 44, 44, 43, 55, 54,
+ 53, 53, 53, 51, 51, 51, 48, 48, 48, 45, 44, 44, 43, 43, 43, 43, 43, 43,
+ 43, 43, 44, 44, 44, 45, 45, 45, 44, 44, 44, 44, 55, 54, 53, 53, 53, 51,
+ 51, 51, 48, 48, 48, 45, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 44, 44,
+ 44, 45, 45, 45, 44, 44, 44, 44, 53, 52, 51, 51, 51, 50, 50, 49, 48, 47,
+ 47, 45, 43, 43, 43, 43, 43, 43, 42, 42, 42, 42, 43, 43, 43, 44, 44, 43,
+ 43, 43, 43, 42, 45, 46, 46, 46, 46, 46, 46, 46, 45, 45, 45, 44, 43, 43,
+ 42, 41, 41, 41, 40, 39, 39, 39, 40, 40, 40, 40, 40, 39, 39, 39, 39, 39,
+ 43, 43, 44, 44, 44, 45, 45, 45, 44, 44, 44, 43, 43, 43, 42, 41, 41, 41,
+ 39, 39, 39, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 38, 43, 43, 44, 44,
+ 44, 45, 45, 45, 44, 44, 44, 43, 43, 43, 42, 41, 41, 41, 39, 39, 39, 39,
+ 39, 39, 39, 38, 38, 38, 38, 38, 38, 38, 42, 43, 44, 44, 44, 45, 45, 45,
+ 45, 44, 44, 44, 44, 44, 43, 41, 41, 41, 39, 38, 38, 38, 38, 38, 37, 36,
+ 36, 36, 36, 36, 36, 35, 42, 43, 44, 44, 44, 45, 45, 45, 45, 45, 45, 45,
+ 45, 45, 44, 41, 41, 41, 39, 38, 38, 37, 37, 37, 36, 35, 35, 35, 34, 34,
+ 34, 34, 42, 43, 44, 44, 44, 45, 45, 45, 45, 45, 45, 45, 45, 45, 44, 41,
+ 41, 41, 39, 38, 38, 37, 37, 37, 36, 35, 35, 35, 34, 34, 34, 34, 41, 42,
+ 42, 42, 43, 44, 44, 44, 44, 44, 44, 44, 45, 45, 43, 41, 41, 41, 39, 38,
+ 38, 37, 36, 36, 36, 34, 34, 34, 34, 33, 33, 33, 39, 40, 41, 41, 42, 43,
+ 43, 43, 43, 43, 43, 43, 44, 44, 42, 41, 41, 40, 38, 38, 38, 36, 36, 36,
+ 35, 33, 33, 33, 32, 32, 32, 31,
+ /* Size 4x16 */
+ 66, 55, 43, 42, 65, 53, 44, 44, 65, 53, 44, 44, 65, 51, 45, 45, 60, 48,
+ 44, 45, 59, 48, 44, 45, 53, 44, 43, 45, 51, 43, 42, 44, 48, 43, 41, 41,
+ 44, 43, 39, 39, 43, 43, 39, 38, 44, 44, 39, 37, 44, 44, 39, 36, 44, 45,
+ 38, 35, 43, 44, 38, 34, 43, 44, 38, 34,
+ /* Size 16x4 */
+ 66, 65, 65, 65, 60, 59, 53, 51, 48, 44, 43, 44, 44, 44, 43, 43, 55, 53,
+ 53, 51, 48, 48, 44, 43, 43, 43, 43, 44, 44, 45, 44, 44, 43, 44, 44, 45,
+ 44, 44, 43, 42, 41, 39, 39, 39, 39, 38, 38, 38, 42, 44, 44, 45, 45, 45,
+ 45, 44, 41, 39, 38, 37, 36, 35, 34, 34,
+ /* Size 8x32 */
+ 64, 66, 62, 55, 45, 43, 42, 41, 65, 65, 61, 54, 46, 43, 43, 42, 65, 65,
+ 60, 53, 46, 44, 44, 42, 65, 65, 60, 53, 46, 44, 44, 42, 66, 64, 59, 53,
+ 46, 44, 44, 43, 67, 64, 59, 51, 46, 45, 45, 44, 67, 64, 59, 51, 46, 45,
+ 45, 44, 66, 62, 58, 51, 46, 45, 45, 44, 62, 59, 55, 48, 45, 44, 45, 44,
+ 61, 57, 53, 48, 45, 44, 45, 44, 61, 57, 53, 48, 45, 44, 45, 44, 58, 53,
+ 50, 45, 44, 43, 45, 44, 55, 51, 48, 44, 43, 43, 45, 45, 55, 51, 48, 44,
+ 43, 43, 45, 45, 53, 50, 47, 43, 42, 42, 44, 43, 49, 48, 46, 43, 41, 41,
+ 41, 41, 49, 48, 46, 43, 41, 41, 41, 41, 48, 47, 46, 43, 41, 41, 41, 41,
+ 43, 45, 44, 43, 40, 39, 39, 39, 42, 44, 44, 43, 39, 39, 38, 38, 42, 44,
+ 44, 43, 39, 39, 38, 38, 42, 45, 44, 43, 39, 39, 37, 37, 42, 45, 44, 44,
+ 40, 39, 37, 36, 42, 45, 44, 44, 40, 39, 37, 36, 42, 45, 45, 44, 40, 39,
+ 36, 36, 42, 45, 45, 45, 40, 38, 35, 34, 42, 45, 45, 45, 40, 38, 35, 34,
+ 42, 45, 45, 45, 39, 38, 35, 34, 41, 44, 44, 44, 39, 38, 34, 34, 41, 44,
+ 44, 44, 39, 38, 34, 33, 41, 44, 44, 44, 39, 38, 34, 33, 40, 43, 43, 44,
+ 39, 38, 34, 33,
+ /* Size 32x8 */
+ 64, 65, 65, 65, 66, 67, 67, 66, 62, 61, 61, 58, 55, 55, 53, 49, 49, 48,
+ 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 40, 66, 65, 65, 65,
+ 64, 64, 64, 62, 59, 57, 57, 53, 51, 51, 50, 48, 48, 47, 45, 44, 44, 45,
+ 45, 45, 45, 45, 45, 45, 44, 44, 44, 43, 62, 61, 60, 60, 59, 59, 59, 58,
+ 55, 53, 53, 50, 48, 48, 47, 46, 46, 46, 44, 44, 44, 44, 44, 44, 45, 45,
+ 45, 45, 44, 44, 44, 43, 55, 54, 53, 53, 53, 51, 51, 51, 48, 48, 48, 45,
+ 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 44, 44, 44, 45, 45, 45, 44, 44,
+ 44, 44, 45, 46, 46, 46, 46, 46, 46, 46, 45, 45, 45, 44, 43, 43, 42, 41,
+ 41, 41, 40, 39, 39, 39, 40, 40, 40, 40, 40, 39, 39, 39, 39, 39, 43, 43,
+ 44, 44, 44, 45, 45, 45, 44, 44, 44, 43, 43, 43, 42, 41, 41, 41, 39, 39,
+ 39, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 38, 42, 43, 44, 44, 44, 45,
+ 45, 45, 45, 45, 45, 45, 45, 45, 44, 41, 41, 41, 39, 38, 38, 37, 37, 37,
+ 36, 35, 35, 35, 34, 34, 34, 34, 41, 42, 42, 42, 43, 44, 44, 44, 44, 44,
+ 44, 44, 45, 45, 43, 41, 41, 41, 39, 38, 38, 37, 36, 36, 36, 34, 34, 34,
+ 34, 33, 33, 33 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 63, 59, 59, 42,
+#endif
+ /* Size 4x4 */
+ 64, 64, 60, 53, 64, 61, 58, 53, 60, 58, 52, 46, 53, 53, 46, 38,
+ /* Size 8x8 */
+ 65, 65, 64, 64, 62, 59, 55, 50, 65, 64, 63, 63, 62, 59, 56, 52, 64, 63,
+ 63, 62, 60, 59, 55, 51, 64, 63, 62, 60, 58, 56, 53, 50, 62, 62, 60, 58,
+ 55, 53, 49, 47, 59, 59, 59, 56, 53, 48, 44, 42, 55, 56, 55, 53, 49, 44,
+ 40, 38, 50, 52, 51, 50, 47, 42, 38, 35,
+ /* Size 16x16 */
+ 64, 65, 65, 65, 65, 65, 65, 64, 64, 60, 60, 57, 57, 52, 52, 47, 65, 64,
+ 64, 64, 64, 64, 64, 63, 63, 60, 60, 59, 59, 53, 53, 48, 65, 64, 64, 64,
+ 64, 64, 64, 63, 63, 60, 60, 59, 59, 53, 53, 48, 65, 64, 64, 63, 63, 63,
+ 63, 63, 63, 61, 61, 59, 59, 55, 55, 50, 65, 64, 64, 63, 63, 63, 63, 63,
+ 63, 61, 61, 59, 59, 55, 55, 50, 65, 64, 64, 63, 63, 61, 61, 60, 60, 58,
+ 58, 56, 56, 53, 53, 49, 65, 64, 64, 63, 63, 61, 61, 60, 60, 58, 58, 56,
+ 56, 53, 53, 49, 64, 63, 63, 63, 63, 60, 60, 58, 58, 55, 55, 53, 53, 51,
+ 51, 48, 64, 63, 63, 63, 63, 60, 60, 58, 58, 55, 55, 53, 53, 51, 51, 48,
+ 60, 60, 60, 61, 61, 58, 58, 55, 55, 52, 52, 48, 48, 46, 46, 43, 60, 60,
+ 60, 61, 61, 58, 58, 55, 55, 52, 52, 48, 48, 46, 46, 43, 57, 59, 59, 59,
+ 59, 56, 56, 53, 53, 48, 48, 42, 42, 41, 41, 38, 57, 59, 59, 59, 59, 56,
+ 56, 53, 53, 48, 48, 42, 42, 41, 41, 38, 52, 53, 53, 55, 55, 53, 53, 51,
+ 51, 46, 46, 41, 41, 38, 38, 35, 52, 53, 53, 55, 55, 53, 53, 51, 51, 46,
+ 46, 41, 41, 38, 38, 35, 47, 48, 48, 50, 50, 49, 49, 48, 48, 43, 43, 38,
+ 38, 35, 35, 32,
+ /* Size 32x32 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 62,
+ 60, 60, 60, 59, 57, 57, 57, 55, 52, 52, 52, 49, 47, 47, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 62, 60, 60, 60, 59,
+ 58, 58, 58, 55, 53, 53, 53, 50, 48, 48, 65, 65, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 63, 63, 63, 63, 62, 60, 60, 60, 59, 59, 59, 59, 55,
+ 53, 53, 53, 51, 48, 48, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 63, 63, 63, 63, 62, 60, 60, 60, 59, 59, 59, 59, 55, 53, 53, 53, 51,
+ 48, 48, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63,
+ 63, 62, 60, 60, 60, 59, 59, 59, 59, 55, 53, 53, 53, 51, 48, 48, 65, 65,
+ 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 62, 60, 60,
+ 60, 59, 59, 59, 59, 56, 54, 54, 54, 52, 49, 49, 65, 65, 64, 64, 64, 64,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 61, 61, 61, 60, 59, 59,
+ 59, 57, 55, 55, 55, 53, 50, 50, 65, 65, 64, 64, 64, 64, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 62, 61, 61, 61, 60, 59, 59, 59, 57, 55, 55,
+ 55, 53, 50, 50, 65, 65, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 62, 61, 61, 61, 60, 59, 59, 59, 57, 55, 55, 55, 53, 50, 50,
+ 65, 64, 64, 64, 64, 63, 63, 63, 63, 63, 62, 62, 62, 62, 61, 61, 61, 60,
+ 59, 59, 59, 59, 58, 58, 58, 55, 53, 53, 53, 51, 49, 49, 65, 64, 64, 64,
+ 64, 63, 63, 63, 63, 62, 61, 61, 61, 61, 60, 60, 60, 59, 58, 58, 58, 57,
+ 56, 56, 56, 54, 53, 53, 53, 51, 49, 49, 65, 64, 64, 64, 64, 63, 63, 63,
+ 63, 62, 61, 61, 61, 61, 60, 60, 60, 59, 58, 58, 58, 57, 56, 56, 56, 54,
+ 53, 53, 53, 51, 49, 49, 65, 64, 64, 64, 64, 63, 63, 63, 63, 62, 61, 61,
+ 61, 61, 60, 60, 60, 59, 58, 58, 58, 57, 56, 56, 56, 54, 53, 53, 53, 51,
+ 49, 49, 64, 64, 63, 63, 63, 63, 63, 63, 63, 62, 61, 61, 61, 60, 59, 59,
+ 59, 58, 57, 57, 57, 56, 55, 55, 55, 53, 51, 51, 51, 50, 48, 48, 64, 64,
+ 63, 63, 63, 63, 63, 63, 63, 61, 60, 60, 60, 59, 58, 58, 58, 57, 55, 55,
+ 55, 55, 53, 53, 53, 52, 51, 51, 51, 49, 48, 48, 64, 64, 63, 63, 63, 63,
+ 63, 63, 63, 61, 60, 60, 60, 59, 58, 58, 58, 57, 55, 55, 55, 55, 53, 53,
+ 53, 52, 51, 51, 51, 49, 48, 48, 64, 64, 63, 63, 63, 63, 63, 63, 63, 61,
+ 60, 60, 60, 59, 58, 58, 58, 57, 55, 55, 55, 55, 53, 53, 53, 52, 51, 51,
+ 51, 49, 48, 48, 62, 62, 62, 62, 62, 62, 62, 62, 62, 60, 59, 59, 59, 58,
+ 57, 57, 57, 55, 54, 54, 54, 53, 51, 51, 51, 49, 48, 48, 48, 47, 46, 46,
+ 60, 60, 60, 60, 60, 60, 61, 61, 61, 59, 58, 58, 58, 57, 55, 55, 55, 54,
+ 52, 52, 52, 50, 48, 48, 48, 47, 46, 46, 46, 44, 43, 43, 60, 60, 60, 60,
+ 60, 60, 61, 61, 61, 59, 58, 58, 58, 57, 55, 55, 55, 54, 52, 52, 52, 50,
+ 48, 48, 48, 47, 46, 46, 46, 44, 43, 43, 60, 60, 60, 60, 60, 60, 61, 61,
+ 61, 59, 58, 58, 58, 57, 55, 55, 55, 54, 52, 52, 52, 50, 48, 48, 48, 47,
+ 46, 46, 46, 44, 43, 43, 59, 59, 59, 59, 59, 59, 60, 60, 60, 59, 57, 57,
+ 57, 56, 55, 55, 55, 53, 50, 50, 50, 48, 45, 45, 45, 44, 43, 43, 43, 42,
+ 41, 41, 57, 58, 59, 59, 59, 59, 59, 59, 59, 58, 56, 56, 56, 55, 53, 53,
+ 53, 51, 48, 48, 48, 45, 42, 42, 42, 41, 41, 41, 41, 39, 38, 38, 57, 58,
+ 59, 59, 59, 59, 59, 59, 59, 58, 56, 56, 56, 55, 53, 53, 53, 51, 48, 48,
+ 48, 45, 42, 42, 42, 41, 41, 41, 41, 39, 38, 38, 57, 58, 59, 59, 59, 59,
+ 59, 59, 59, 58, 56, 56, 56, 55, 53, 53, 53, 51, 48, 48, 48, 45, 42, 42,
+ 42, 41, 41, 41, 41, 39, 38, 38, 55, 55, 55, 55, 55, 56, 57, 57, 57, 55,
+ 54, 54, 54, 53, 52, 52, 52, 49, 47, 47, 47, 44, 41, 41, 41, 40, 39, 39,
+ 39, 38, 37, 37, 52, 53, 53, 53, 53, 54, 55, 55, 55, 53, 53, 53, 53, 51,
+ 51, 51, 51, 48, 46, 46, 46, 43, 41, 41, 41, 39, 38, 38, 38, 37, 35, 35,
+ 52, 53, 53, 53, 53, 54, 55, 55, 55, 53, 53, 53, 53, 51, 51, 51, 51, 48,
+ 46, 46, 46, 43, 41, 41, 41, 39, 38, 38, 38, 37, 35, 35, 52, 53, 53, 53,
+ 53, 54, 55, 55, 55, 53, 53, 53, 53, 51, 51, 51, 51, 48, 46, 46, 46, 43,
+ 41, 41, 41, 39, 38, 38, 38, 37, 35, 35, 49, 50, 51, 51, 51, 52, 53, 53,
+ 53, 51, 51, 51, 51, 50, 49, 49, 49, 47, 44, 44, 44, 42, 39, 39, 39, 38,
+ 37, 37, 37, 35, 34, 34, 47, 48, 48, 48, 48, 49, 50, 50, 50, 49, 49, 49,
+ 49, 48, 48, 48, 48, 46, 43, 43, 43, 41, 38, 38, 38, 37, 35, 35, 35, 34,
+ 32, 32, 47, 48, 48, 48, 48, 49, 50, 50, 50, 49, 49, 49, 49, 48, 48, 48,
+ 48, 46, 43, 43, 43, 41, 38, 38, 38, 37, 35, 35, 35, 34, 32, 32,
+ /* Size 4x8 */
+ 65, 64, 60, 53, 64, 63, 60, 54, 64, 62, 59, 53, 63, 61, 57, 51, 62, 59,
+ 54, 48, 59, 57, 50, 43, 55, 54, 47, 39, 51, 51, 44, 37,
+ /* Size 8x4 */
+ 65, 64, 64, 63, 62, 59, 55, 51, 64, 63, 62, 61, 59, 57, 54, 51, 60, 60,
+ 59, 57, 54, 50, 47, 44, 53, 54, 53, 51, 48, 43, 39, 37,
+ /* Size 8x16 */
+ 64, 65, 65, 64, 64, 57, 57, 47, 65, 64, 64, 63, 63, 58, 58, 48, 65, 64,
+ 64, 63, 63, 58, 58, 48, 65, 63, 63, 62, 62, 59, 59, 50, 65, 63, 63, 62,
+ 62, 59, 59, 50, 64, 63, 63, 60, 60, 56, 56, 49, 64, 63, 63, 60, 60, 56,
+ 56, 49, 64, 62, 62, 58, 58, 53, 53, 48, 64, 62, 62, 58, 58, 53, 53, 48,
+ 60, 60, 60, 55, 55, 48, 48, 43, 60, 60, 60, 55, 55, 48, 48, 43, 57, 59,
+ 59, 53, 53, 43, 43, 38, 57, 59, 59, 53, 53, 43, 43, 38, 52, 55, 55, 51,
+ 51, 41, 41, 35, 52, 55, 55, 51, 51, 41, 41, 35, 47, 50, 50, 48, 48, 38,
+ 38, 33,
+ /* Size 16x8 */
+ 64, 65, 65, 65, 65, 64, 64, 64, 64, 60, 60, 57, 57, 52, 52, 47, 65, 64,
+ 64, 63, 63, 63, 63, 62, 62, 60, 60, 59, 59, 55, 55, 50, 65, 64, 64, 63,
+ 63, 63, 63, 62, 62, 60, 60, 59, 59, 55, 55, 50, 64, 63, 63, 62, 62, 60,
+ 60, 58, 58, 55, 55, 53, 53, 51, 51, 48, 64, 63, 63, 62, 62, 60, 60, 58,
+ 58, 55, 55, 53, 53, 51, 51, 48, 57, 58, 58, 59, 59, 56, 56, 53, 53, 48,
+ 48, 43, 43, 41, 41, 38, 57, 58, 58, 59, 59, 56, 56, 53, 53, 48, 48, 43,
+ 43, 41, 41, 38, 47, 48, 48, 50, 50, 49, 49, 48, 48, 43, 43, 38, 38, 35,
+ 35, 33,
+ /* Size 16x32 */
+ 64, 65, 65, 65, 65, 64, 64, 64, 64, 60, 57, 57, 57, 52, 47, 47, 65, 65,
+ 65, 65, 65, 64, 64, 64, 64, 60, 58, 58, 58, 53, 48, 48, 65, 64, 64, 64,
+ 64, 64, 63, 63, 63, 60, 58, 58, 58, 53, 48, 48, 65, 64, 64, 64, 64, 64,
+ 63, 63, 63, 60, 58, 58, 58, 53, 48, 48, 65, 64, 64, 64, 64, 64, 63, 63,
+ 63, 60, 58, 58, 58, 53, 48, 48, 65, 64, 64, 64, 64, 63, 63, 63, 63, 60,
+ 59, 59, 59, 54, 49, 49, 65, 64, 63, 63, 63, 63, 62, 62, 62, 61, 59, 59,
+ 59, 55, 50, 50, 65, 64, 63, 63, 63, 63, 62, 62, 62, 61, 59, 59, 59, 55,
+ 50, 50, 65, 64, 63, 63, 63, 63, 62, 62, 62, 61, 59, 59, 59, 55, 50, 50,
+ 65, 64, 63, 63, 63, 62, 61, 61, 61, 59, 58, 58, 58, 53, 49, 49, 64, 64,
+ 63, 63, 63, 61, 60, 60, 60, 58, 56, 56, 56, 53, 49, 49, 64, 64, 63, 63,
+ 63, 61, 60, 60, 60, 58, 56, 56, 56, 53, 49, 49, 64, 64, 63, 63, 63, 61,
+ 60, 60, 60, 58, 56, 56, 56, 53, 49, 49, 64, 63, 63, 63, 63, 61, 59, 59,
+ 59, 57, 55, 55, 55, 51, 48, 48, 64, 63, 62, 62, 62, 60, 58, 58, 58, 55,
+ 53, 53, 53, 51, 48, 48, 64, 63, 62, 62, 62, 60, 58, 58, 58, 55, 53, 53,
+ 53, 51, 48, 48, 64, 63, 62, 62, 62, 60, 58, 58, 58, 55, 53, 53, 53, 51,
+ 48, 48, 62, 62, 61, 61, 61, 59, 57, 57, 57, 54, 51, 51, 51, 48, 46, 46,
+ 60, 60, 60, 60, 60, 58, 55, 55, 55, 52, 48, 48, 48, 46, 43, 43, 60, 60,
+ 60, 60, 60, 58, 55, 55, 55, 52, 48, 48, 48, 46, 43, 43, 60, 60, 60, 60,
+ 60, 58, 55, 55, 55, 52, 48, 48, 48, 46, 43, 43, 59, 59, 59, 59, 59, 57,
+ 55, 55, 55, 50, 46, 46, 46, 43, 41, 41, 57, 59, 59, 59, 59, 56, 53, 53,
+ 53, 48, 43, 43, 43, 40, 38, 38, 57, 59, 59, 59, 59, 56, 53, 53, 53, 48,
+ 43, 43, 43, 40, 38, 38, 57, 59, 59, 59, 59, 56, 53, 53, 53, 48, 43, 43,
+ 43, 40, 38, 38, 55, 55, 57, 57, 57, 54, 52, 52, 52, 47, 42, 42, 42, 39,
+ 37, 37, 52, 53, 55, 55, 55, 53, 51, 51, 51, 46, 41, 41, 41, 38, 35, 35,
+ 52, 53, 55, 55, 55, 53, 51, 51, 51, 46, 41, 41, 41, 38, 35, 35, 52, 53,
+ 55, 55, 55, 53, 51, 51, 51, 46, 41, 41, 41, 38, 35, 35, 49, 51, 52, 52,
+ 52, 51, 49, 49, 49, 44, 39, 39, 39, 37, 34, 34, 47, 48, 50, 50, 50, 49,
+ 48, 48, 48, 43, 38, 38, 38, 35, 33, 33, 47, 48, 50, 50, 50, 49, 48, 48,
+ 48, 43, 38, 38, 38, 35, 33, 33,
+ /* Size 32x16 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 62,
+ 60, 60, 60, 59, 57, 57, 57, 55, 52, 52, 52, 49, 47, 47, 65, 65, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 62, 60, 60, 60, 59,
+ 59, 59, 59, 55, 53, 53, 53, 51, 48, 48, 65, 65, 64, 64, 64, 64, 63, 63,
+ 63, 63, 63, 63, 63, 63, 62, 62, 62, 61, 60, 60, 60, 59, 59, 59, 59, 57,
+ 55, 55, 55, 52, 50, 50, 65, 65, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63,
+ 63, 63, 62, 62, 62, 61, 60, 60, 60, 59, 59, 59, 59, 57, 55, 55, 55, 52,
+ 50, 50, 65, 65, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62,
+ 62, 61, 60, 60, 60, 59, 59, 59, 59, 57, 55, 55, 55, 52, 50, 50, 64, 64,
+ 64, 64, 64, 63, 63, 63, 63, 62, 61, 61, 61, 61, 60, 60, 60, 59, 58, 58,
+ 58, 57, 56, 56, 56, 54, 53, 53, 53, 51, 49, 49, 64, 64, 63, 63, 63, 63,
+ 62, 62, 62, 61, 60, 60, 60, 59, 58, 58, 58, 57, 55, 55, 55, 55, 53, 53,
+ 53, 52, 51, 51, 51, 49, 48, 48, 64, 64, 63, 63, 63, 63, 62, 62, 62, 61,
+ 60, 60, 60, 59, 58, 58, 58, 57, 55, 55, 55, 55, 53, 53, 53, 52, 51, 51,
+ 51, 49, 48, 48, 64, 64, 63, 63, 63, 63, 62, 62, 62, 61, 60, 60, 60, 59,
+ 58, 58, 58, 57, 55, 55, 55, 55, 53, 53, 53, 52, 51, 51, 51, 49, 48, 48,
+ 60, 60, 60, 60, 60, 60, 61, 61, 61, 59, 58, 58, 58, 57, 55, 55, 55, 54,
+ 52, 52, 52, 50, 48, 48, 48, 47, 46, 46, 46, 44, 43, 43, 57, 58, 58, 58,
+ 58, 59, 59, 59, 59, 58, 56, 56, 56, 55, 53, 53, 53, 51, 48, 48, 48, 46,
+ 43, 43, 43, 42, 41, 41, 41, 39, 38, 38, 57, 58, 58, 58, 58, 59, 59, 59,
+ 59, 58, 56, 56, 56, 55, 53, 53, 53, 51, 48, 48, 48, 46, 43, 43, 43, 42,
+ 41, 41, 41, 39, 38, 38, 57, 58, 58, 58, 58, 59, 59, 59, 59, 58, 56, 56,
+ 56, 55, 53, 53, 53, 51, 48, 48, 48, 46, 43, 43, 43, 42, 41, 41, 41, 39,
+ 38, 38, 52, 53, 53, 53, 53, 54, 55, 55, 55, 53, 53, 53, 53, 51, 51, 51,
+ 51, 48, 46, 46, 46, 43, 40, 40, 40, 39, 38, 38, 38, 37, 35, 35, 47, 48,
+ 48, 48, 48, 49, 50, 50, 50, 49, 49, 49, 49, 48, 48, 48, 48, 46, 43, 43,
+ 43, 41, 38, 38, 38, 37, 35, 35, 35, 34, 33, 33, 47, 48, 48, 48, 48, 49,
+ 50, 50, 50, 49, 49, 49, 49, 48, 48, 48, 48, 46, 43, 43, 43, 41, 38, 38,
+ 38, 37, 35, 35, 35, 34, 33, 33,
+ /* Size 4x16 */
+ 65, 64, 60, 52, 64, 64, 60, 53, 64, 64, 60, 53, 64, 63, 61, 55, 64, 63,
+ 61, 55, 64, 61, 58, 53, 64, 61, 58, 53, 63, 60, 55, 51, 63, 60, 55, 51,
+ 60, 58, 52, 46, 60, 58, 52, 46, 59, 56, 48, 40, 59, 56, 48, 40, 53, 53,
+ 46, 38, 53, 53, 46, 38, 48, 49, 43, 35,
+ /* Size 16x4 */
+ 65, 64, 64, 64, 64, 64, 64, 63, 63, 60, 60, 59, 59, 53, 53, 48, 64, 64,
+ 64, 63, 63, 61, 61, 60, 60, 58, 58, 56, 56, 53, 53, 49, 60, 60, 60, 61,
+ 61, 58, 58, 55, 55, 52, 52, 48, 48, 46, 46, 43, 52, 53, 53, 55, 55, 53,
+ 53, 51, 51, 46, 46, 40, 40, 38, 38, 35,
+ /* Size 8x32 */
+ 64, 65, 65, 64, 64, 57, 57, 47, 65, 65, 65, 64, 64, 58, 58, 48, 65, 64,
+ 64, 63, 63, 58, 58, 48, 65, 64, 64, 63, 63, 58, 58, 48, 65, 64, 64, 63,
+ 63, 58, 58, 48, 65, 64, 64, 63, 63, 59, 59, 49, 65, 63, 63, 62, 62, 59,
+ 59, 50, 65, 63, 63, 62, 62, 59, 59, 50, 65, 63, 63, 62, 62, 59, 59, 50,
+ 65, 63, 63, 61, 61, 58, 58, 49, 64, 63, 63, 60, 60, 56, 56, 49, 64, 63,
+ 63, 60, 60, 56, 56, 49, 64, 63, 63, 60, 60, 56, 56, 49, 64, 63, 63, 59,
+ 59, 55, 55, 48, 64, 62, 62, 58, 58, 53, 53, 48, 64, 62, 62, 58, 58, 53,
+ 53, 48, 64, 62, 62, 58, 58, 53, 53, 48, 62, 61, 61, 57, 57, 51, 51, 46,
+ 60, 60, 60, 55, 55, 48, 48, 43, 60, 60, 60, 55, 55, 48, 48, 43, 60, 60,
+ 60, 55, 55, 48, 48, 43, 59, 59, 59, 55, 55, 46, 46, 41, 57, 59, 59, 53,
+ 53, 43, 43, 38, 57, 59, 59, 53, 53, 43, 43, 38, 57, 59, 59, 53, 53, 43,
+ 43, 38, 55, 57, 57, 52, 52, 42, 42, 37, 52, 55, 55, 51, 51, 41, 41, 35,
+ 52, 55, 55, 51, 51, 41, 41, 35, 52, 55, 55, 51, 51, 41, 41, 35, 49, 52,
+ 52, 49, 49, 39, 39, 34, 47, 50, 50, 48, 48, 38, 38, 33, 47, 50, 50, 48,
+ 48, 38, 38, 33,
+ /* Size 32x8 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 62,
+ 60, 60, 60, 59, 57, 57, 57, 55, 52, 52, 52, 49, 47, 47, 65, 65, 64, 64,
+ 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 61, 60, 60, 60, 59,
+ 59, 59, 59, 57, 55, 55, 55, 52, 50, 50, 65, 65, 64, 64, 64, 64, 63, 63,
+ 63, 63, 63, 63, 63, 63, 62, 62, 62, 61, 60, 60, 60, 59, 59, 59, 59, 57,
+ 55, 55, 55, 52, 50, 50, 64, 64, 63, 63, 63, 63, 62, 62, 62, 61, 60, 60,
+ 60, 59, 58, 58, 58, 57, 55, 55, 55, 55, 53, 53, 53, 52, 51, 51, 51, 49,
+ 48, 48, 64, 64, 63, 63, 63, 63, 62, 62, 62, 61, 60, 60, 60, 59, 58, 58,
+ 58, 57, 55, 55, 55, 55, 53, 53, 53, 52, 51, 51, 51, 49, 48, 48, 57, 58,
+ 58, 58, 58, 59, 59, 59, 59, 58, 56, 56, 56, 55, 53, 53, 53, 51, 48, 48,
+ 48, 46, 43, 43, 43, 42, 41, 41, 41, 39, 38, 38, 57, 58, 58, 58, 58, 59,
+ 59, 59, 59, 58, 56, 56, 56, 55, 53, 53, 53, 51, 48, 48, 48, 46, 43, 43,
+ 43, 42, 41, 41, 41, 39, 38, 38, 47, 48, 48, 48, 48, 49, 50, 50, 50, 49,
+ 49, 49, 49, 48, 48, 48, 48, 46, 43, 43, 43, 41, 38, 38, 38, 37, 35, 35,
+ 35, 34, 33, 33 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 64, 44, 44, 39,
+#endif
+ /* Size 4x4 */
+ 65, 59, 48, 44, 59, 53, 46, 44, 48, 46, 42, 41, 44, 44, 41, 38,
+ /* Size 8x8 */
+ 65, 66, 63, 58, 52, 46, 43, 43, 66, 65, 62, 55, 50, 46, 44, 45, 63, 62,
+ 58, 52, 48, 46, 44, 45, 58, 55, 52, 48, 45, 44, 44, 45, 52, 50, 48, 45,
+ 43, 42, 42, 43, 46, 46, 46, 44, 42, 41, 40, 40, 43, 44, 44, 44, 42, 40,
+ 38, 38, 43, 45, 45, 45, 43, 40, 38, 37,
+ /* Size 16x16 */
+ 64, 66, 66, 67, 67, 61, 61, 56, 56, 49, 49, 42, 42, 42, 42, 42, 66, 65,
+ 65, 66, 66, 59, 59, 53, 53, 48, 48, 43, 43, 44, 44, 44, 66, 65, 65, 66,
+ 66, 59, 59, 53, 53, 48, 48, 43, 43, 44, 44, 44, 67, 66, 66, 64, 64, 58,
+ 58, 51, 51, 48, 48, 44, 44, 45, 45, 46, 67, 66, 66, 64, 64, 58, 58, 51,
+ 51, 48, 48, 44, 44, 45, 45, 46, 61, 59, 59, 58, 58, 53, 53, 47, 47, 46,
+ 46, 43, 43, 44, 44, 45, 61, 59, 59, 58, 58, 53, 53, 47, 47, 46, 46, 43,
+ 43, 44, 44, 45, 56, 53, 53, 51, 51, 47, 47, 43, 43, 43, 43, 43, 43, 44,
+ 44, 45, 56, 53, 53, 51, 51, 47, 47, 43, 43, 43, 43, 43, 43, 44, 44, 45,
+ 49, 48, 48, 48, 48, 46, 46, 43, 43, 42, 42, 41, 41, 41, 41, 42, 49, 48,
+ 48, 48, 48, 46, 46, 43, 43, 42, 42, 41, 41, 41, 41, 42, 42, 43, 43, 44,
+ 44, 43, 43, 43, 43, 41, 41, 39, 39, 39, 39, 38, 42, 43, 43, 44, 44, 43,
+ 43, 43, 43, 41, 41, 39, 39, 39, 39, 38, 42, 44, 44, 45, 45, 44, 44, 44,
+ 44, 41, 41, 39, 39, 38, 38, 37, 42, 44, 44, 45, 45, 44, 44, 44, 44, 41,
+ 41, 39, 39, 38, 38, 37, 42, 44, 44, 46, 46, 45, 45, 45, 45, 42, 42, 38,
+ 38, 37, 37, 35,
+ /* Size 32x32 */
+ 64, 65, 66, 66, 66, 66, 67, 67, 67, 64, 61, 61, 61, 59, 56, 56, 56, 53,
+ 49, 49, 49, 46, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 65, 65, 65, 65,
+ 65, 66, 66, 66, 66, 63, 60, 60, 60, 58, 55, 55, 55, 52, 49, 49, 49, 46,
+ 42, 42, 42, 43, 43, 43, 43, 43, 43, 43, 66, 65, 65, 65, 65, 65, 66, 66,
+ 66, 62, 59, 59, 59, 56, 53, 53, 53, 51, 48, 48, 48, 46, 43, 43, 43, 43,
+ 44, 44, 44, 44, 44, 44, 66, 65, 65, 65, 65, 65, 66, 66, 66, 62, 59, 59,
+ 59, 56, 53, 53, 53, 51, 48, 48, 48, 46, 43, 43, 43, 43, 44, 44, 44, 44,
+ 44, 44, 66, 65, 65, 65, 65, 65, 66, 66, 66, 62, 59, 59, 59, 56, 53, 53,
+ 53, 51, 48, 48, 48, 46, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 66, 66,
+ 65, 65, 65, 65, 65, 65, 65, 62, 59, 59, 59, 55, 53, 53, 53, 50, 48, 48,
+ 48, 46, 44, 44, 44, 44, 44, 44, 44, 45, 45, 45, 67, 66, 66, 66, 66, 65,
+ 64, 64, 64, 61, 58, 58, 58, 55, 51, 51, 51, 49, 48, 48, 48, 46, 44, 44,
+ 44, 45, 45, 45, 45, 45, 46, 46, 67, 66, 66, 66, 66, 65, 64, 64, 64, 61,
+ 58, 58, 58, 55, 51, 51, 51, 49, 48, 48, 48, 46, 44, 44, 44, 45, 45, 45,
+ 45, 45, 46, 46, 67, 66, 66, 66, 66, 65, 64, 64, 64, 61, 58, 58, 58, 55,
+ 51, 51, 51, 49, 48, 48, 48, 46, 44, 44, 44, 45, 45, 45, 45, 45, 46, 46,
+ 64, 63, 62, 62, 62, 62, 61, 61, 61, 58, 55, 55, 55, 52, 49, 49, 49, 48,
+ 47, 47, 47, 46, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 61, 60, 59, 59,
+ 59, 59, 58, 58, 58, 55, 53, 53, 53, 50, 47, 47, 47, 47, 46, 46, 46, 45,
+ 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 61, 60, 59, 59, 59, 59, 58, 58,
+ 58, 55, 53, 53, 53, 50, 47, 47, 47, 47, 46, 46, 46, 45, 43, 43, 43, 44,
+ 44, 44, 44, 45, 45, 45, 61, 60, 59, 59, 59, 59, 58, 58, 58, 55, 53, 53,
+ 53, 50, 47, 47, 47, 47, 46, 46, 46, 45, 43, 43, 43, 44, 44, 44, 44, 45,
+ 45, 45, 59, 58, 56, 56, 56, 55, 55, 55, 55, 52, 50, 50, 50, 48, 45, 45,
+ 45, 45, 45, 45, 45, 44, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 56, 55,
+ 53, 53, 53, 53, 51, 51, 51, 49, 47, 47, 47, 45, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 56, 55, 53, 53, 53, 53,
+ 51, 51, 51, 49, 47, 47, 47, 45, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 44, 44, 44, 44, 45, 45, 45, 56, 55, 53, 53, 53, 53, 51, 51, 51, 49,
+ 47, 47, 47, 45, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 44, 44, 44,
+ 44, 45, 45, 45, 53, 52, 51, 51, 51, 50, 49, 49, 49, 48, 47, 47, 47, 45,
+ 43, 43, 43, 43, 43, 43, 43, 42, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44,
+ 49, 49, 48, 48, 48, 48, 48, 48, 48, 47, 46, 46, 46, 45, 43, 43, 43, 43,
+ 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 42, 42, 49, 49, 48, 48,
+ 48, 48, 48, 48, 48, 47, 46, 46, 46, 45, 43, 43, 43, 43, 42, 42, 42, 41,
+ 41, 41, 41, 41, 41, 41, 41, 41, 42, 42, 49, 49, 48, 48, 48, 48, 48, 48,
+ 48, 47, 46, 46, 46, 45, 43, 43, 43, 43, 42, 42, 42, 41, 41, 41, 41, 41,
+ 41, 41, 41, 41, 42, 42, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 45, 45,
+ 45, 44, 43, 43, 43, 42, 41, 41, 41, 41, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 42, 42, 43, 43, 43, 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43,
+ 43, 42, 41, 41, 41, 40, 39, 39, 39, 39, 39, 39, 39, 38, 38, 38, 42, 42,
+ 43, 43, 43, 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 42, 41, 41,
+ 41, 40, 39, 39, 39, 39, 39, 39, 39, 38, 38, 38, 42, 42, 43, 43, 43, 44,
+ 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 42, 41, 41, 41, 40, 39, 39,
+ 39, 39, 39, 39, 39, 38, 38, 38, 42, 43, 43, 43, 43, 44, 45, 45, 45, 44,
+ 44, 44, 44, 44, 44, 44, 44, 42, 41, 41, 41, 40, 39, 39, 39, 38, 38, 38,
+ 38, 38, 38, 38, 42, 43, 44, 44, 44, 44, 45, 45, 45, 45, 44, 44, 44, 44,
+ 44, 44, 44, 43, 41, 41, 41, 40, 39, 39, 39, 38, 38, 38, 38, 37, 37, 37,
+ 42, 43, 44, 44, 44, 44, 45, 45, 45, 45, 44, 44, 44, 44, 44, 44, 44, 43,
+ 41, 41, 41, 40, 39, 39, 39, 38, 38, 38, 38, 37, 37, 37, 42, 43, 44, 44,
+ 44, 44, 45, 45, 45, 45, 44, 44, 44, 44, 44, 44, 44, 43, 41, 41, 41, 40,
+ 39, 39, 39, 38, 38, 38, 38, 37, 37, 37, 42, 43, 44, 44, 44, 45, 45, 45,
+ 45, 45, 45, 45, 45, 45, 45, 45, 45, 43, 41, 41, 41, 40, 38, 38, 38, 38,
+ 37, 37, 37, 37, 36, 36, 42, 43, 44, 44, 44, 45, 46, 46, 46, 46, 45, 45,
+ 45, 45, 45, 45, 45, 44, 42, 42, 42, 40, 38, 38, 38, 38, 37, 37, 37, 36,
+ 35, 35, 42, 43, 44, 44, 44, 45, 46, 46, 46, 46, 45, 45, 45, 45, 45, 45,
+ 45, 44, 42, 42, 42, 40, 38, 38, 38, 38, 37, 37, 37, 36, 35, 35,
+ /* Size 4x8 */
+ 65, 60, 49, 43, 65, 59, 48, 44, 62, 55, 47, 45, 56, 50, 45, 44, 51, 47,
+ 43, 43, 46, 45, 41, 40, 43, 44, 41, 38, 44, 45, 41, 37,
+ /* Size 8x4 */
+ 65, 65, 62, 56, 51, 46, 43, 44, 60, 59, 55, 50, 47, 45, 44, 45, 49, 48,
+ 47, 45, 43, 41, 41, 41, 43, 44, 45, 44, 43, 40, 38, 37,
+ /* Size 8x16 */
+ 64, 66, 66, 55, 55, 43, 43, 42, 65, 65, 65, 53, 53, 44, 44, 44, 65, 65,
+ 65, 53, 53, 44, 44, 44, 67, 64, 64, 51, 51, 45, 45, 45, 67, 64, 64, 51,
+ 51, 45, 45, 45, 61, 57, 57, 48, 48, 44, 44, 45, 61, 57, 57, 48, 48, 44,
+ 44, 45, 55, 51, 51, 44, 44, 43, 43, 45, 55, 51, 51, 44, 44, 43, 43, 45,
+ 49, 48, 48, 43, 43, 41, 41, 41, 49, 48, 48, 43, 43, 41, 41, 41, 42, 44,
+ 44, 43, 43, 39, 39, 38, 42, 44, 44, 43, 43, 39, 39, 38, 42, 45, 45, 44,
+ 44, 39, 39, 37, 42, 45, 45, 44, 44, 39, 39, 37, 42, 45, 45, 45, 45, 38,
+ 38, 35,
+ /* Size 16x8 */
+ 64, 65, 65, 67, 67, 61, 61, 55, 55, 49, 49, 42, 42, 42, 42, 42, 66, 65,
+ 65, 64, 64, 57, 57, 51, 51, 48, 48, 44, 44, 45, 45, 45, 66, 65, 65, 64,
+ 64, 57, 57, 51, 51, 48, 48, 44, 44, 45, 45, 45, 55, 53, 53, 51, 51, 48,
+ 48, 44, 44, 43, 43, 43, 43, 44, 44, 45, 55, 53, 53, 51, 51, 48, 48, 44,
+ 44, 43, 43, 43, 43, 44, 44, 45, 43, 44, 44, 45, 45, 44, 44, 43, 43, 41,
+ 41, 39, 39, 39, 39, 38, 43, 44, 44, 45, 45, 44, 44, 43, 43, 41, 41, 39,
+ 39, 39, 39, 38, 42, 44, 44, 45, 45, 45, 45, 45, 45, 41, 41, 38, 38, 37,
+ 37, 35,
+ /* Size 16x32 */
+ 64, 65, 66, 66, 66, 61, 55, 55, 55, 49, 43, 43, 43, 42, 42, 42, 65, 65,
+ 66, 66, 66, 60, 55, 55, 55, 49, 43, 43, 43, 43, 43, 43, 65, 65, 65, 65,
+ 65, 59, 53, 53, 53, 48, 44, 44, 44, 44, 44, 44, 65, 65, 65, 65, 65, 59,
+ 53, 53, 53, 48, 44, 44, 44, 44, 44, 44, 65, 65, 65, 65, 65, 59, 53, 53,
+ 53, 48, 44, 44, 44, 44, 44, 44, 66, 65, 64, 64, 64, 59, 53, 53, 53, 48,
+ 44, 44, 44, 44, 45, 45, 67, 65, 64, 64, 64, 58, 51, 51, 51, 48, 45, 45,
+ 45, 45, 45, 45, 67, 65, 64, 64, 64, 58, 51, 51, 51, 48, 45, 45, 45, 45,
+ 45, 45, 67, 65, 64, 64, 64, 58, 51, 51, 51, 48, 45, 45, 45, 45, 45, 45,
+ 64, 62, 60, 60, 60, 55, 49, 49, 49, 47, 44, 44, 44, 45, 45, 45, 61, 59,
+ 57, 57, 57, 53, 48, 48, 48, 46, 44, 44, 44, 44, 45, 45, 61, 59, 57, 57,
+ 57, 53, 48, 48, 48, 46, 44, 44, 44, 44, 45, 45, 61, 59, 57, 57, 57, 53,
+ 48, 48, 48, 46, 44, 44, 44, 44, 45, 45, 58, 56, 54, 54, 54, 50, 46, 46,
+ 46, 45, 43, 43, 43, 44, 45, 45, 55, 53, 51, 51, 51, 47, 44, 44, 44, 43,
+ 43, 43, 43, 44, 45, 45, 55, 53, 51, 51, 51, 47, 44, 44, 44, 43, 43, 43,
+ 43, 44, 45, 45, 55, 53, 51, 51, 51, 47, 44, 44, 44, 43, 43, 43, 43, 44,
+ 45, 45, 52, 51, 49, 49, 49, 47, 43, 43, 43, 43, 42, 42, 42, 43, 43, 43,
+ 49, 48, 48, 48, 48, 46, 43, 43, 43, 42, 41, 41, 41, 41, 41, 41, 49, 48,
+ 48, 48, 48, 46, 43, 43, 43, 42, 41, 41, 41, 41, 41, 41, 49, 48, 48, 48,
+ 48, 46, 43, 43, 43, 42, 41, 41, 41, 41, 41, 41, 46, 46, 46, 46, 46, 45,
+ 43, 43, 43, 41, 40, 40, 40, 40, 40, 40, 42, 43, 44, 44, 44, 43, 43, 43,
+ 43, 41, 39, 39, 39, 38, 38, 38, 42, 43, 44, 44, 44, 43, 43, 43, 43, 41,
+ 39, 39, 39, 38, 38, 38, 42, 43, 44, 44, 44, 43, 43, 43, 43, 41, 39, 39,
+ 39, 38, 38, 38, 42, 43, 44, 44, 44, 44, 43, 43, 43, 41, 39, 39, 39, 38,
+ 38, 38, 42, 44, 45, 45, 45, 44, 44, 44, 44, 41, 39, 39, 39, 38, 37, 37,
+ 42, 44, 45, 45, 45, 44, 44, 44, 44, 41, 39, 39, 39, 38, 37, 37, 42, 44,
+ 45, 45, 45, 44, 44, 44, 44, 41, 39, 39, 39, 38, 37, 37, 42, 44, 45, 45,
+ 45, 45, 44, 44, 44, 41, 39, 39, 39, 37, 36, 36, 42, 44, 45, 45, 45, 45,
+ 45, 45, 45, 41, 38, 38, 38, 37, 35, 35, 42, 44, 45, 45, 45, 45, 45, 45,
+ 45, 41, 38, 38, 38, 37, 35, 35,
+ /* Size 32x16 */
+ 64, 65, 65, 65, 65, 66, 67, 67, 67, 64, 61, 61, 61, 58, 55, 55, 55, 52,
+ 49, 49, 49, 46, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 62, 59, 59, 59, 56, 53, 53, 53, 51, 48, 48, 48, 46,
+ 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 66, 66, 65, 65, 65, 64, 64, 64,
+ 64, 60, 57, 57, 57, 54, 51, 51, 51, 49, 48, 48, 48, 46, 44, 44, 44, 44,
+ 45, 45, 45, 45, 45, 45, 66, 66, 65, 65, 65, 64, 64, 64, 64, 60, 57, 57,
+ 57, 54, 51, 51, 51, 49, 48, 48, 48, 46, 44, 44, 44, 44, 45, 45, 45, 45,
+ 45, 45, 66, 66, 65, 65, 65, 64, 64, 64, 64, 60, 57, 57, 57, 54, 51, 51,
+ 51, 49, 48, 48, 48, 46, 44, 44, 44, 44, 45, 45, 45, 45, 45, 45, 61, 60,
+ 59, 59, 59, 59, 58, 58, 58, 55, 53, 53, 53, 50, 47, 47, 47, 47, 46, 46,
+ 46, 45, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 55, 55, 53, 53, 53, 53,
+ 51, 51, 51, 49, 48, 48, 48, 46, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 44, 44, 44, 44, 45, 45, 55, 55, 53, 53, 53, 53, 51, 51, 51, 49,
+ 48, 48, 48, 46, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 44, 44,
+ 44, 44, 45, 45, 55, 55, 53, 53, 53, 53, 51, 51, 51, 49, 48, 48, 48, 46,
+ 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 44, 44, 44, 44, 45, 45,
+ 49, 49, 48, 48, 48, 48, 48, 48, 48, 47, 46, 46, 46, 45, 43, 43, 43, 43,
+ 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 43, 43, 44, 44,
+ 44, 44, 45, 45, 45, 44, 44, 44, 44, 43, 43, 43, 43, 42, 41, 41, 41, 40,
+ 39, 39, 39, 39, 39, 39, 39, 39, 38, 38, 43, 43, 44, 44, 44, 44, 45, 45,
+ 45, 44, 44, 44, 44, 43, 43, 43, 43, 42, 41, 41, 41, 40, 39, 39, 39, 39,
+ 39, 39, 39, 39, 38, 38, 43, 43, 44, 44, 44, 44, 45, 45, 45, 44, 44, 44,
+ 44, 43, 43, 43, 43, 42, 41, 41, 41, 40, 39, 39, 39, 39, 39, 39, 39, 39,
+ 38, 38, 42, 43, 44, 44, 44, 44, 45, 45, 45, 45, 44, 44, 44, 44, 44, 44,
+ 44, 43, 41, 41, 41, 40, 38, 38, 38, 38, 38, 38, 38, 37, 37, 37, 42, 43,
+ 44, 44, 44, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 43, 41, 41,
+ 41, 40, 38, 38, 38, 38, 37, 37, 37, 36, 35, 35, 42, 43, 44, 44, 44, 45,
+ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 43, 41, 41, 41, 40, 38, 38,
+ 38, 38, 37, 37, 37, 36, 35, 35,
+ /* Size 4x16 */
+ 65, 61, 49, 42, 65, 59, 48, 44, 65, 59, 48, 44, 65, 58, 48, 45, 65, 58,
+ 48, 45, 59, 53, 46, 44, 59, 53, 46, 44, 53, 47, 43, 44, 53, 47, 43, 44,
+ 48, 46, 42, 41, 48, 46, 42, 41, 43, 43, 41, 38, 43, 43, 41, 38, 44, 44,
+ 41, 38, 44, 44, 41, 38, 44, 45, 41, 37,
+ /* Size 16x4 */
+ 65, 65, 65, 65, 65, 59, 59, 53, 53, 48, 48, 43, 43, 44, 44, 44, 61, 59,
+ 59, 58, 58, 53, 53, 47, 47, 46, 46, 43, 43, 44, 44, 45, 49, 48, 48, 48,
+ 48, 46, 46, 43, 43, 42, 42, 41, 41, 41, 41, 41, 42, 44, 44, 45, 45, 44,
+ 44, 44, 44, 41, 41, 38, 38, 38, 38, 37,
+ /* Size 8x32 */
+ 64, 66, 66, 55, 55, 43, 43, 42, 65, 66, 66, 55, 55, 43, 43, 43, 65, 65,
+ 65, 53, 53, 44, 44, 44, 65, 65, 65, 53, 53, 44, 44, 44, 65, 65, 65, 53,
+ 53, 44, 44, 44, 66, 64, 64, 53, 53, 44, 44, 45, 67, 64, 64, 51, 51, 45,
+ 45, 45, 67, 64, 64, 51, 51, 45, 45, 45, 67, 64, 64, 51, 51, 45, 45, 45,
+ 64, 60, 60, 49, 49, 44, 44, 45, 61, 57, 57, 48, 48, 44, 44, 45, 61, 57,
+ 57, 48, 48, 44, 44, 45, 61, 57, 57, 48, 48, 44, 44, 45, 58, 54, 54, 46,
+ 46, 43, 43, 45, 55, 51, 51, 44, 44, 43, 43, 45, 55, 51, 51, 44, 44, 43,
+ 43, 45, 55, 51, 51, 44, 44, 43, 43, 45, 52, 49, 49, 43, 43, 42, 42, 43,
+ 49, 48, 48, 43, 43, 41, 41, 41, 49, 48, 48, 43, 43, 41, 41, 41, 49, 48,
+ 48, 43, 43, 41, 41, 41, 46, 46, 46, 43, 43, 40, 40, 40, 42, 44, 44, 43,
+ 43, 39, 39, 38, 42, 44, 44, 43, 43, 39, 39, 38, 42, 44, 44, 43, 43, 39,
+ 39, 38, 42, 44, 44, 43, 43, 39, 39, 38, 42, 45, 45, 44, 44, 39, 39, 37,
+ 42, 45, 45, 44, 44, 39, 39, 37, 42, 45, 45, 44, 44, 39, 39, 37, 42, 45,
+ 45, 44, 44, 39, 39, 36, 42, 45, 45, 45, 45, 38, 38, 35, 42, 45, 45, 45,
+ 45, 38, 38, 35,
+ /* Size 32x8 */
+ 64, 65, 65, 65, 65, 66, 67, 67, 67, 64, 61, 61, 61, 58, 55, 55, 55, 52,
+ 49, 49, 49, 46, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 66, 66, 65, 65,
+ 65, 64, 64, 64, 64, 60, 57, 57, 57, 54, 51, 51, 51, 49, 48, 48, 48, 46,
+ 44, 44, 44, 44, 45, 45, 45, 45, 45, 45, 66, 66, 65, 65, 65, 64, 64, 64,
+ 64, 60, 57, 57, 57, 54, 51, 51, 51, 49, 48, 48, 48, 46, 44, 44, 44, 44,
+ 45, 45, 45, 45, 45, 45, 55, 55, 53, 53, 53, 53, 51, 51, 51, 49, 48, 48,
+ 48, 46, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 44, 44, 44, 44,
+ 45, 45, 55, 55, 53, 53, 53, 53, 51, 51, 51, 49, 48, 48, 48, 46, 44, 44,
+ 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 44, 44, 44, 44, 45, 45, 43, 43,
+ 44, 44, 44, 44, 45, 45, 45, 44, 44, 44, 44, 43, 43, 43, 43, 42, 41, 41,
+ 41, 40, 39, 39, 39, 39, 39, 39, 39, 39, 38, 38, 43, 43, 44, 44, 44, 44,
+ 45, 45, 45, 44, 44, 44, 44, 43, 43, 43, 43, 42, 41, 41, 41, 40, 39, 39,
+ 39, 39, 39, 39, 39, 39, 38, 38, 42, 43, 44, 44, 44, 45, 45, 45, 45, 45,
+ 45, 45, 45, 45, 45, 45, 45, 43, 41, 41, 41, 40, 38, 38, 38, 38, 37, 37,
+ 37, 36, 35, 35 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 64, 61, 61, 52,
+#endif
+ /* Size 4x4 */
+ 64, 64, 63, 59, 64, 63, 62, 59, 63, 62, 58, 54, 59, 59, 54, 45,
+ /* Size 8x8 */
+ 65, 65, 65, 64, 64, 63, 60, 58, 65, 64, 64, 64, 63, 62, 60, 59, 65, 64,
+ 63, 63, 63, 62, 61, 59, 64, 64, 63, 61, 60, 59, 58, 56, 64, 63, 63, 60,
+ 59, 58, 56, 54, 63, 62, 62, 59, 58, 56, 54, 51, 60, 60, 61, 58, 56, 54,
+ 52, 48, 58, 59, 59, 56, 54, 51, 48, 42,
+ /* Size 16x16 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 61, 60, 59, 57, 57, 65, 65,
+ 65, 64, 64, 64, 64, 64, 64, 64, 64, 61, 60, 59, 58, 58, 65, 65, 64, 64,
+ 64, 64, 64, 64, 64, 63, 63, 61, 60, 59, 59, 59, 65, 64, 64, 64, 64, 64,
+ 63, 63, 63, 63, 63, 61, 60, 60, 59, 59, 65, 64, 64, 64, 63, 63, 63, 63,
+ 63, 63, 63, 61, 61, 60, 59, 59, 65, 64, 64, 64, 63, 63, 63, 63, 63, 63,
+ 63, 61, 61, 60, 59, 59, 65, 64, 64, 63, 63, 63, 62, 62, 61, 61, 61, 59,
+ 59, 58, 57, 57, 65, 64, 64, 63, 63, 63, 62, 61, 61, 60, 60, 59, 58, 57,
+ 56, 56, 64, 64, 64, 63, 63, 63, 61, 61, 60, 59, 59, 58, 57, 56, 55, 55,
+ 64, 64, 63, 63, 63, 63, 61, 60, 59, 58, 58, 56, 55, 55, 53, 53, 64, 64,
+ 63, 63, 63, 63, 61, 60, 59, 58, 58, 56, 55, 55, 53, 53, 61, 61, 61, 61,
+ 61, 61, 59, 59, 58, 56, 56, 53, 53, 51, 49, 49, 60, 60, 60, 60, 61, 61,
+ 59, 58, 57, 55, 55, 53, 52, 50, 48, 48, 59, 59, 59, 60, 60, 60, 58, 57,
+ 56, 55, 55, 51, 50, 48, 46, 46, 57, 58, 59, 59, 59, 59, 57, 56, 55, 53,
+ 53, 49, 48, 46, 42, 42, 57, 58, 59, 59, 59, 59, 57, 56, 55, 53, 53, 49,
+ 48, 46, 42, 42,
+ /* Size 32x32 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64,
+ 64, 64, 64, 63, 61, 60, 60, 60, 59, 58, 57, 57, 57, 55, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63,
+ 61, 60, 60, 60, 59, 59, 58, 58, 58, 55, 65, 65, 65, 65, 65, 65, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 61, 60, 60, 60,
+ 59, 59, 58, 58, 58, 56, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 63, 63, 63, 63, 62, 61, 60, 60, 60, 59, 59, 59, 59,
+ 59, 56, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 63, 63, 63, 63, 62, 61, 60, 60, 60, 59, 59, 59, 59, 59, 56, 65, 65,
+ 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63,
+ 63, 62, 61, 60, 60, 60, 59, 59, 59, 59, 59, 56, 65, 65, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 61, 60,
+ 60, 60, 60, 59, 59, 59, 59, 57, 65, 65, 64, 64, 64, 64, 64, 64, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 61, 61, 61, 61, 60, 59,
+ 59, 59, 59, 58, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 62, 61, 61, 61, 61, 60, 60, 59, 59, 59, 58,
+ 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 62, 61, 61, 61, 61, 60, 60, 59, 59, 59, 58, 65, 65, 64, 64,
+ 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62,
+ 61, 61, 61, 61, 60, 60, 59, 59, 59, 58, 65, 65, 64, 64, 64, 64, 64, 63,
+ 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 61, 60, 59, 59, 59,
+ 59, 59, 59, 59, 59, 56, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 62,
+ 62, 62, 62, 62, 61, 61, 61, 61, 61, 60, 59, 59, 59, 59, 58, 57, 57, 57,
+ 57, 55, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 62, 62, 61, 61, 61,
+ 61, 60, 60, 60, 60, 59, 59, 58, 58, 58, 57, 57, 56, 56, 56, 55, 65, 64,
+ 64, 64, 64, 64, 63, 63, 63, 63, 63, 62, 62, 61, 61, 61, 61, 60, 60, 60,
+ 60, 59, 59, 58, 58, 58, 57, 57, 56, 56, 56, 55, 65, 64, 64, 64, 64, 64,
+ 63, 63, 63, 63, 63, 62, 62, 61, 61, 61, 61, 60, 60, 60, 60, 59, 59, 58,
+ 58, 58, 57, 57, 56, 56, 56, 55, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63,
+ 63, 62, 61, 61, 61, 61, 60, 59, 59, 59, 59, 59, 58, 57, 57, 57, 56, 55,
+ 55, 55, 55, 54, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 62, 61, 60,
+ 60, 60, 59, 59, 59, 59, 59, 58, 57, 56, 56, 56, 55, 55, 54, 54, 54, 53,
+ 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 62, 61, 60, 60, 60, 59, 59,
+ 58, 58, 58, 57, 56, 55, 55, 55, 55, 54, 53, 53, 53, 53, 64, 64, 64, 63,
+ 63, 63, 63, 63, 63, 63, 63, 62, 61, 60, 60, 60, 59, 59, 58, 58, 58, 57,
+ 56, 55, 55, 55, 55, 54, 53, 53, 53, 53, 64, 64, 64, 63, 63, 63, 63, 63,
+ 63, 63, 63, 62, 61, 60, 60, 60, 59, 59, 58, 58, 58, 57, 56, 55, 55, 55,
+ 55, 54, 53, 53, 53, 53, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 61,
+ 60, 59, 59, 59, 59, 58, 57, 57, 57, 56, 55, 54, 54, 54, 53, 52, 51, 51,
+ 51, 50, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 60, 59, 59, 59, 59,
+ 58, 57, 56, 56, 56, 55, 53, 53, 53, 53, 51, 50, 49, 49, 49, 48, 60, 60,
+ 60, 60, 60, 60, 60, 61, 61, 61, 61, 59, 59, 58, 58, 58, 57, 56, 55, 55,
+ 55, 54, 53, 52, 52, 52, 50, 49, 48, 48, 48, 47, 60, 60, 60, 60, 60, 60,
+ 60, 61, 61, 61, 61, 59, 59, 58, 58, 58, 57, 56, 55, 55, 55, 54, 53, 52,
+ 52, 52, 50, 49, 48, 48, 48, 47, 60, 60, 60, 60, 60, 60, 60, 61, 61, 61,
+ 61, 59, 59, 58, 58, 58, 57, 56, 55, 55, 55, 54, 53, 52, 52, 52, 50, 49,
+ 48, 48, 48, 47, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 59, 58, 57,
+ 57, 57, 56, 55, 55, 55, 55, 53, 51, 50, 50, 50, 48, 47, 46, 46, 46, 45,
+ 58, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 59, 57, 57, 57, 57, 55, 55,
+ 54, 54, 54, 52, 50, 49, 49, 49, 47, 45, 44, 44, 44, 43, 57, 58, 58, 59,
+ 59, 59, 59, 59, 59, 59, 59, 59, 57, 56, 56, 56, 55, 54, 53, 53, 53, 51,
+ 49, 48, 48, 48, 46, 44, 42, 42, 42, 41, 57, 58, 58, 59, 59, 59, 59, 59,
+ 59, 59, 59, 59, 57, 56, 56, 56, 55, 54, 53, 53, 53, 51, 49, 48, 48, 48,
+ 46, 44, 42, 42, 42, 41, 57, 58, 58, 59, 59, 59, 59, 59, 59, 59, 59, 59,
+ 57, 56, 56, 56, 55, 54, 53, 53, 53, 51, 49, 48, 48, 48, 46, 44, 42, 42,
+ 42, 41, 55, 55, 56, 56, 56, 56, 57, 58, 58, 58, 58, 56, 55, 55, 55, 55,
+ 54, 53, 53, 53, 53, 50, 48, 47, 47, 47, 45, 43, 41, 41, 41, 41,
+ /* Size 4x8 */
+ 65, 65, 64, 58, 64, 64, 63, 58, 64, 63, 62, 59, 64, 63, 60, 56, 64, 62,
+ 59, 54, 62, 62, 57, 51, 60, 60, 55, 48, 58, 59, 53, 43,
+ /* Size 8x4 */
+ 65, 64, 64, 64, 64, 62, 60, 58, 65, 64, 63, 63, 62, 62, 60, 59, 64, 63,
+ 62, 60, 59, 57, 55, 53, 58, 58, 59, 56, 54, 51, 48, 43,
+ /* Size 8x16 */
+ 64, 65, 65, 65, 64, 64, 59, 57, 65, 64, 64, 64, 63, 63, 59, 58, 65, 64,
+ 64, 64, 63, 63, 59, 58, 65, 64, 64, 63, 63, 63, 59, 59, 65, 64, 63, 63,
+ 62, 62, 60, 59, 65, 64, 63, 63, 62, 62, 60, 59, 65, 63, 63, 62, 60, 60,
+ 58, 57, 64, 63, 63, 62, 60, 60, 57, 56, 64, 63, 63, 61, 59, 59, 56, 55,
+ 64, 63, 62, 60, 58, 58, 55, 53, 64, 63, 62, 60, 58, 58, 55, 53, 61, 61,
+ 61, 59, 56, 56, 51, 49, 60, 60, 60, 59, 55, 55, 49, 48, 59, 59, 60, 58,
+ 55, 55, 48, 46, 57, 59, 59, 57, 53, 53, 45, 43, 57, 59, 59, 57, 53, 53,
+ 45, 43,
+ /* Size 16x8 */
+ 64, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 61, 60, 59, 57, 57, 65, 64,
+ 64, 64, 64, 64, 63, 63, 63, 63, 63, 61, 60, 59, 59, 59, 65, 64, 64, 64,
+ 63, 63, 63, 63, 63, 62, 62, 61, 60, 60, 59, 59, 65, 64, 64, 63, 63, 63,
+ 62, 62, 61, 60, 60, 59, 59, 58, 57, 57, 64, 63, 63, 63, 62, 62, 60, 60,
+ 59, 58, 58, 56, 55, 55, 53, 53, 64, 63, 63, 63, 62, 62, 60, 60, 59, 58,
+ 58, 56, 55, 55, 53, 53, 59, 59, 59, 59, 60, 60, 58, 57, 56, 55, 55, 51,
+ 49, 48, 45, 45, 57, 58, 58, 59, 59, 59, 57, 56, 55, 53, 53, 49, 48, 46,
+ 43, 43,
+ /* Size 16x32 */
+ 64, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 61, 59, 57, 57, 57, 65, 65,
+ 65, 65, 65, 65, 64, 64, 64, 64, 64, 61, 59, 58, 58, 58, 65, 65, 64, 64,
+ 64, 64, 64, 63, 63, 63, 63, 61, 59, 58, 58, 58, 65, 64, 64, 64, 64, 64,
+ 64, 63, 63, 63, 63, 61, 59, 58, 58, 58, 65, 64, 64, 64, 64, 64, 64, 63,
+ 63, 63, 63, 61, 59, 58, 58, 58, 65, 64, 64, 64, 64, 64, 64, 63, 63, 63,
+ 63, 61, 59, 58, 58, 58, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 61,
+ 59, 59, 59, 59, 65, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 61, 59, 59,
+ 59, 59, 65, 64, 64, 63, 63, 63, 63, 63, 62, 62, 62, 61, 60, 59, 59, 59,
+ 65, 64, 64, 63, 63, 63, 63, 63, 62, 62, 62, 61, 60, 59, 59, 59, 65, 64,
+ 64, 63, 63, 63, 63, 63, 62, 62, 62, 61, 60, 59, 59, 59, 65, 64, 63, 63,
+ 63, 63, 62, 62, 61, 61, 61, 60, 59, 58, 58, 58, 65, 64, 63, 63, 63, 63,
+ 62, 61, 60, 60, 60, 59, 58, 57, 57, 57, 64, 64, 63, 63, 63, 63, 62, 60,
+ 60, 60, 60, 59, 57, 56, 56, 56, 64, 64, 63, 63, 63, 63, 62, 60, 60, 60,
+ 60, 59, 57, 56, 56, 56, 64, 64, 63, 63, 63, 63, 62, 60, 60, 60, 60, 59,
+ 57, 56, 56, 56, 64, 64, 63, 63, 63, 63, 61, 60, 59, 59, 59, 58, 56, 55,
+ 55, 55, 64, 64, 63, 62, 62, 62, 61, 59, 59, 59, 59, 57, 55, 54, 54, 54,
+ 64, 64, 63, 62, 62, 62, 60, 59, 58, 58, 58, 56, 55, 53, 53, 53, 64, 64,
+ 63, 62, 62, 62, 60, 59, 58, 58, 58, 56, 55, 53, 53, 53, 64, 64, 63, 62,
+ 62, 62, 60, 59, 58, 58, 58, 56, 55, 53, 53, 53, 63, 62, 62, 62, 62, 62,
+ 59, 58, 57, 57, 57, 55, 53, 51, 51, 51, 61, 61, 61, 61, 61, 61, 59, 57,
+ 56, 56, 56, 53, 51, 49, 49, 49, 60, 60, 60, 60, 60, 60, 59, 57, 55, 55,
+ 55, 53, 49, 48, 48, 48, 60, 60, 60, 60, 60, 60, 59, 57, 55, 55, 55, 53,
+ 49, 48, 48, 48, 60, 60, 60, 60, 60, 60, 59, 57, 55, 55, 55, 53, 49, 48,
+ 48, 48, 59, 59, 59, 60, 60, 60, 58, 55, 55, 55, 55, 51, 48, 46, 46, 46,
+ 58, 59, 59, 59, 59, 59, 57, 55, 54, 54, 54, 50, 46, 44, 44, 44, 57, 58,
+ 59, 59, 59, 59, 57, 55, 53, 53, 53, 49, 45, 43, 43, 43, 57, 58, 59, 59,
+ 59, 59, 57, 55, 53, 53, 53, 49, 45, 43, 43, 43, 57, 58, 59, 59, 59, 59,
+ 57, 55, 53, 53, 53, 49, 45, 43, 43, 43, 55, 56, 57, 57, 57, 57, 55, 53,
+ 52, 52, 52, 48, 44, 42, 42, 42,
+ /* Size 32x16 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64,
+ 64, 64, 64, 63, 61, 60, 60, 60, 59, 58, 57, 57, 57, 55, 65, 65, 65, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62,
+ 61, 60, 60, 60, 59, 59, 58, 58, 58, 56, 65, 65, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 61, 60, 60, 60,
+ 59, 59, 59, 59, 59, 57, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 60, 60, 60, 60, 59, 59, 59,
+ 59, 57, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 62, 62, 62, 62, 62, 61, 60, 60, 60, 60, 59, 59, 59, 59, 57, 65, 65,
+ 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62,
+ 62, 62, 61, 60, 60, 60, 60, 59, 59, 59, 59, 57, 65, 64, 64, 64, 64, 64,
+ 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 60, 60, 60, 59, 59, 59,
+ 59, 59, 58, 57, 57, 57, 57, 55, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 62, 61, 60, 60, 60, 60, 59, 59, 59, 59, 58, 57, 57, 57, 57, 55, 55,
+ 55, 55, 55, 53, 64, 64, 63, 63, 63, 63, 63, 63, 62, 62, 62, 61, 60, 60,
+ 60, 60, 59, 59, 58, 58, 58, 57, 56, 55, 55, 55, 55, 54, 53, 53, 53, 52,
+ 64, 64, 63, 63, 63, 63, 63, 63, 62, 62, 62, 61, 60, 60, 60, 60, 59, 59,
+ 58, 58, 58, 57, 56, 55, 55, 55, 55, 54, 53, 53, 53, 52, 64, 64, 63, 63,
+ 63, 63, 63, 63, 62, 62, 62, 61, 60, 60, 60, 60, 59, 59, 58, 58, 58, 57,
+ 56, 55, 55, 55, 55, 54, 53, 53, 53, 52, 61, 61, 61, 61, 61, 61, 61, 61,
+ 61, 61, 61, 60, 59, 59, 59, 59, 58, 57, 56, 56, 56, 55, 53, 53, 53, 53,
+ 51, 50, 49, 49, 49, 48, 59, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 59,
+ 58, 57, 57, 57, 56, 55, 55, 55, 55, 53, 51, 49, 49, 49, 48, 46, 45, 45,
+ 45, 44, 57, 58, 58, 58, 58, 58, 59, 59, 59, 59, 59, 58, 57, 56, 56, 56,
+ 55, 54, 53, 53, 53, 51, 49, 48, 48, 48, 46, 44, 43, 43, 43, 42, 57, 58,
+ 58, 58, 58, 58, 59, 59, 59, 59, 59, 58, 57, 56, 56, 56, 55, 54, 53, 53,
+ 53, 51, 49, 48, 48, 48, 46, 44, 43, 43, 43, 42, 57, 58, 58, 58, 58, 58,
+ 59, 59, 59, 59, 59, 58, 57, 56, 56, 56, 55, 54, 53, 53, 53, 51, 49, 48,
+ 48, 48, 46, 44, 43, 43, 43, 42,
+ /* Size 4x16 */
+ 65, 65, 64, 57, 65, 64, 63, 58, 64, 64, 63, 58, 64, 64, 63, 59, 64, 63,
+ 62, 59, 64, 63, 62, 59, 64, 63, 60, 57, 64, 63, 60, 56, 64, 63, 59, 55,
+ 64, 62, 58, 53, 64, 62, 58, 53, 61, 61, 56, 49, 60, 60, 55, 48, 59, 60,
+ 55, 46, 58, 59, 53, 43, 58, 59, 53, 43,
+ /* Size 16x4 */
+ 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 61, 60, 59, 58, 58, 65, 64,
+ 64, 64, 63, 63, 63, 63, 63, 62, 62, 61, 60, 60, 59, 59, 64, 63, 63, 63,
+ 62, 62, 60, 60, 59, 58, 58, 56, 55, 55, 53, 53, 57, 58, 58, 59, 59, 59,
+ 57, 56, 55, 53, 53, 49, 48, 46, 43, 43,
+ /* Size 8x32 */
+ 64, 65, 65, 65, 64, 64, 59, 57, 65, 65, 65, 64, 64, 64, 59, 58, 65, 64,
+ 64, 64, 63, 63, 59, 58, 65, 64, 64, 64, 63, 63, 59, 58, 65, 64, 64, 64,
+ 63, 63, 59, 58, 65, 64, 64, 64, 63, 63, 59, 58, 65, 64, 64, 63, 63, 63,
+ 59, 59, 65, 64, 63, 63, 63, 63, 59, 59, 65, 64, 63, 63, 62, 62, 60, 59,
+ 65, 64, 63, 63, 62, 62, 60, 59, 65, 64, 63, 63, 62, 62, 60, 59, 65, 63,
+ 63, 62, 61, 61, 59, 58, 65, 63, 63, 62, 60, 60, 58, 57, 64, 63, 63, 62,
+ 60, 60, 57, 56, 64, 63, 63, 62, 60, 60, 57, 56, 64, 63, 63, 62, 60, 60,
+ 57, 56, 64, 63, 63, 61, 59, 59, 56, 55, 64, 63, 62, 61, 59, 59, 55, 54,
+ 64, 63, 62, 60, 58, 58, 55, 53, 64, 63, 62, 60, 58, 58, 55, 53, 64, 63,
+ 62, 60, 58, 58, 55, 53, 63, 62, 62, 59, 57, 57, 53, 51, 61, 61, 61, 59,
+ 56, 56, 51, 49, 60, 60, 60, 59, 55, 55, 49, 48, 60, 60, 60, 59, 55, 55,
+ 49, 48, 60, 60, 60, 59, 55, 55, 49, 48, 59, 59, 60, 58, 55, 55, 48, 46,
+ 58, 59, 59, 57, 54, 54, 46, 44, 57, 59, 59, 57, 53, 53, 45, 43, 57, 59,
+ 59, 57, 53, 53, 45, 43, 57, 59, 59, 57, 53, 53, 45, 43, 55, 57, 57, 55,
+ 52, 52, 44, 42,
+ /* Size 32x8 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64,
+ 64, 64, 64, 63, 61, 60, 60, 60, 59, 58, 57, 57, 57, 55, 65, 65, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62,
+ 61, 60, 60, 60, 59, 59, 59, 59, 59, 57, 65, 65, 64, 64, 64, 64, 64, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 60, 60, 60,
+ 60, 59, 59, 59, 59, 57, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 62,
+ 62, 62, 62, 62, 61, 61, 60, 60, 60, 59, 59, 59, 59, 59, 58, 57, 57, 57,
+ 57, 55, 64, 64, 63, 63, 63, 63, 63, 63, 62, 62, 62, 61, 60, 60, 60, 60,
+ 59, 59, 58, 58, 58, 57, 56, 55, 55, 55, 55, 54, 53, 53, 53, 52, 64, 64,
+ 63, 63, 63, 63, 63, 63, 62, 62, 62, 61, 60, 60, 60, 60, 59, 59, 58, 58,
+ 58, 57, 56, 55, 55, 55, 55, 54, 53, 53, 53, 52, 59, 59, 59, 59, 59, 59,
+ 59, 59, 60, 60, 60, 59, 58, 57, 57, 57, 56, 55, 55, 55, 55, 53, 51, 49,
+ 49, 49, 48, 46, 45, 45, 45, 44, 57, 58, 58, 58, 58, 58, 59, 59, 59, 59,
+ 59, 58, 57, 56, 56, 56, 55, 54, 53, 53, 53, 51, 49, 48, 48, 48, 46, 44,
+ 43, 43, 43, 42 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 65, 48, 48, 42,
+#endif
+ /* Size 4x4 */
+ 65, 63, 53, 44, 63, 59, 49, 45, 53, 49, 43, 43, 44, 45, 43, 39,
+ /* Size 8x8 */
+ 65, 65, 67, 60, 56, 53, 49, 42, 65, 65, 66, 59, 55, 51, 48, 43, 67, 66,
+ 64, 58, 53, 50, 48, 44, 60, 59, 58, 53, 48, 47, 46, 43, 56, 55, 53, 48,
+ 45, 44, 44, 43, 53, 51, 50, 47, 44, 43, 43, 42, 49, 48, 48, 46, 44, 43,
+ 42, 41, 42, 43, 44, 43, 43, 42, 41, 39,
+ /* Size 16x16 */
+ 64, 65, 66, 66, 67, 67, 62, 61, 59, 56, 56, 51, 49, 46, 42, 42, 65, 65,
+ 65, 66, 66, 66, 61, 59, 57, 54, 54, 49, 49, 46, 43, 43, 66, 65, 65, 65,
+ 66, 66, 60, 59, 57, 53, 53, 49, 48, 46, 43, 43, 66, 66, 65, 65, 65, 65,
+ 60, 59, 56, 53, 53, 49, 48, 47, 44, 44, 67, 66, 66, 65, 64, 64, 59, 58,
+ 55, 51, 51, 49, 48, 47, 44, 44, 67, 66, 66, 65, 64, 64, 59, 58, 55, 51,
+ 51, 49, 48, 47, 44, 44, 62, 61, 60, 60, 59, 59, 55, 53, 51, 48, 48, 47,
+ 46, 45, 44, 44, 61, 59, 59, 59, 58, 58, 53, 53, 51, 47, 47, 46, 46, 45,
+ 43, 43, 59, 57, 57, 56, 55, 55, 51, 51, 48, 46, 46, 45, 45, 44, 43, 43,
+ 56, 54, 53, 53, 51, 51, 48, 47, 46, 43, 43, 43, 43, 43, 43, 43, 56, 54,
+ 53, 53, 51, 51, 48, 47, 46, 43, 43, 43, 43, 43, 43, 43, 51, 49, 49, 49,
+ 49, 49, 47, 46, 45, 43, 43, 43, 42, 42, 41, 41, 49, 49, 48, 48, 48, 48,
+ 46, 46, 45, 43, 43, 42, 42, 41, 41, 41, 46, 46, 46, 47, 47, 47, 45, 45,
+ 44, 43, 43, 42, 41, 41, 40, 40, 42, 43, 43, 44, 44, 44, 44, 43, 43, 43,
+ 43, 41, 41, 40, 39, 39, 42, 43, 43, 44, 44, 44, 44, 43, 43, 43, 43, 41,
+ 41, 40, 39, 39,
+ /* Size 32x32 */
+ 64, 65, 65, 66, 66, 66, 66, 67, 67, 67, 67, 65, 62, 61, 61, 61, 59, 57,
+ 56, 56, 56, 53, 51, 49, 49, 49, 46, 43, 42, 42, 42, 42, 65, 65, 65, 65,
+ 65, 65, 66, 66, 67, 67, 67, 64, 62, 60, 60, 60, 59, 56, 55, 55, 55, 53,
+ 50, 49, 49, 49, 46, 44, 42, 42, 42, 42, 65, 65, 65, 65, 65, 65, 66, 66,
+ 66, 66, 66, 63, 61, 59, 59, 59, 57, 55, 54, 54, 54, 52, 49, 49, 49, 49,
+ 46, 44, 43, 43, 43, 43, 66, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 63,
+ 60, 59, 59, 59, 57, 55, 53, 53, 53, 51, 49, 48, 48, 48, 46, 44, 43, 43,
+ 43, 43, 66, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 63, 60, 59, 59, 59,
+ 57, 55, 53, 53, 53, 51, 49, 48, 48, 48, 46, 44, 43, 43, 43, 43, 66, 65,
+ 65, 65, 65, 65, 65, 65, 66, 66, 66, 63, 60, 59, 59, 59, 57, 55, 53, 53,
+ 53, 51, 49, 48, 48, 48, 46, 44, 43, 43, 43, 43, 66, 66, 66, 65, 65, 65,
+ 65, 65, 65, 65, 65, 62, 60, 59, 59, 59, 56, 54, 53, 53, 53, 51, 49, 48,
+ 48, 48, 47, 45, 44, 44, 44, 44, 67, 66, 66, 65, 65, 65, 65, 65, 65, 65,
+ 65, 62, 59, 58, 58, 58, 55, 53, 52, 52, 52, 50, 49, 48, 48, 48, 47, 45,
+ 44, 44, 44, 44, 67, 67, 66, 66, 66, 66, 65, 65, 64, 64, 64, 62, 59, 58,
+ 58, 58, 55, 53, 51, 51, 51, 50, 49, 48, 48, 48, 47, 45, 44, 44, 44, 45,
+ 67, 67, 66, 66, 66, 66, 65, 65, 64, 64, 64, 62, 59, 58, 58, 58, 55, 53,
+ 51, 51, 51, 50, 49, 48, 48, 48, 47, 45, 44, 44, 44, 45, 67, 67, 66, 66,
+ 66, 66, 65, 65, 64, 64, 64, 62, 59, 58, 58, 58, 55, 53, 51, 51, 51, 50,
+ 49, 48, 48, 48, 47, 45, 44, 44, 44, 45, 65, 64, 63, 63, 63, 63, 62, 62,
+ 62, 62, 62, 59, 57, 55, 55, 55, 53, 51, 49, 49, 49, 49, 48, 47, 47, 47,
+ 46, 45, 44, 44, 44, 44, 62, 62, 61, 60, 60, 60, 60, 59, 59, 59, 59, 57,
+ 55, 53, 53, 53, 51, 49, 48, 48, 48, 47, 47, 46, 46, 46, 45, 44, 44, 44,
+ 44, 44, 61, 60, 59, 59, 59, 59, 59, 58, 58, 58, 58, 55, 53, 53, 53, 53,
+ 51, 48, 47, 47, 47, 47, 46, 46, 46, 46, 45, 44, 43, 43, 43, 44, 61, 60,
+ 59, 59, 59, 59, 59, 58, 58, 58, 58, 55, 53, 53, 53, 53, 51, 48, 47, 47,
+ 47, 47, 46, 46, 46, 46, 45, 44, 43, 43, 43, 44, 61, 60, 59, 59, 59, 59,
+ 59, 58, 58, 58, 58, 55, 53, 53, 53, 53, 51, 48, 47, 47, 47, 47, 46, 46,
+ 46, 46, 45, 44, 43, 43, 43, 44, 59, 59, 57, 57, 57, 57, 56, 55, 55, 55,
+ 55, 53, 51, 51, 51, 51, 48, 47, 46, 46, 46, 45, 45, 45, 45, 45, 44, 44,
+ 43, 43, 43, 44, 57, 56, 55, 55, 55, 55, 54, 53, 53, 53, 53, 51, 49, 48,
+ 48, 48, 47, 45, 44, 44, 44, 44, 44, 44, 44, 44, 44, 43, 43, 43, 43, 44,
+ 56, 55, 54, 53, 53, 53, 53, 52, 51, 51, 51, 49, 48, 47, 47, 47, 46, 44,
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 56, 55, 54, 53,
+ 53, 53, 53, 52, 51, 51, 51, 49, 48, 47, 47, 47, 46, 44, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 56, 55, 54, 53, 53, 53, 53, 52,
+ 51, 51, 51, 49, 48, 47, 47, 47, 46, 44, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 53, 53, 52, 51, 51, 51, 51, 50, 50, 50, 50, 49,
+ 47, 47, 47, 47, 45, 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 42, 42, 42,
+ 42, 42, 51, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 48, 47, 46, 46, 46,
+ 45, 44, 43, 43, 43, 43, 43, 42, 42, 42, 42, 41, 41, 41, 41, 41, 49, 49,
+ 49, 48, 48, 48, 48, 48, 48, 48, 48, 47, 46, 46, 46, 46, 45, 44, 43, 43,
+ 43, 43, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 49, 49, 49, 48, 48, 48,
+ 48, 48, 48, 48, 48, 47, 46, 46, 46, 46, 45, 44, 43, 43, 43, 43, 42, 42,
+ 42, 42, 41, 41, 41, 41, 41, 41, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48,
+ 48, 47, 46, 46, 46, 46, 45, 44, 43, 43, 43, 43, 42, 42, 42, 42, 41, 41,
+ 41, 41, 41, 41, 46, 46, 46, 46, 46, 46, 47, 47, 47, 47, 47, 46, 45, 45,
+ 45, 45, 44, 44, 43, 43, 43, 43, 42, 41, 41, 41, 41, 40, 40, 40, 40, 40,
+ 43, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 45, 44, 44, 44, 44, 44, 43,
+ 43, 43, 43, 42, 41, 41, 41, 41, 40, 39, 39, 39, 39, 39, 42, 42, 43, 43,
+ 43, 43, 44, 44, 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 42,
+ 41, 41, 41, 41, 40, 39, 39, 39, 39, 39, 42, 42, 43, 43, 43, 43, 44, 44,
+ 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 42, 41, 41, 41, 41,
+ 40, 39, 39, 39, 39, 39, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44,
+ 44, 43, 43, 43, 43, 43, 43, 43, 43, 42, 41, 41, 41, 41, 40, 39, 39, 39,
+ 39, 39, 42, 42, 43, 43, 43, 43, 44, 44, 45, 45, 45, 44, 44, 44, 44, 44,
+ 44, 44, 43, 43, 43, 42, 41, 41, 41, 41, 40, 39, 39, 39, 39, 38,
+ /* Size 4x8 */
+ 65, 66, 55, 43, 65, 65, 53, 44, 66, 64, 51, 45, 59, 57, 48, 44, 55, 52,
+ 44, 43, 52, 50, 43, 42, 48, 48, 43, 41, 43, 44, 43, 39,
+ /* Size 8x4 */
+ 65, 65, 66, 59, 55, 52, 48, 43, 66, 65, 64, 57, 52, 50, 48, 44, 55, 53,
+ 51, 48, 44, 43, 43, 43, 43, 44, 45, 44, 43, 42, 41, 39,
+ /* Size 8x16 */
+ 64, 66, 66, 62, 55, 55, 45, 43, 65, 65, 65, 60, 54, 54, 46, 43, 65, 65,
+ 65, 60, 53, 53, 46, 44, 66, 65, 64, 59, 53, 53, 46, 44, 67, 64, 64, 59,
+ 51, 51, 46, 45, 67, 64, 64, 59, 51, 51, 46, 45, 62, 59, 59, 55, 48, 48,
+ 45, 44, 61, 58, 57, 53, 48, 48, 45, 44, 59, 55, 55, 51, 46, 46, 44, 43,
+ 55, 52, 51, 48, 44, 44, 43, 43, 55, 52, 51, 48, 44, 44, 43, 43, 50, 49,
+ 48, 47, 43, 43, 42, 41, 49, 48, 48, 46, 43, 43, 41, 41, 46, 46, 46, 45,
+ 43, 43, 41, 40, 42, 44, 44, 44, 43, 43, 39, 39, 42, 44, 44, 44, 43, 43,
+ 39, 39,
+ /* Size 16x8 */
+ 64, 65, 65, 66, 67, 67, 62, 61, 59, 55, 55, 50, 49, 46, 42, 42, 66, 65,
+ 65, 65, 64, 64, 59, 58, 55, 52, 52, 49, 48, 46, 44, 44, 66, 65, 65, 64,
+ 64, 64, 59, 57, 55, 51, 51, 48, 48, 46, 44, 44, 62, 60, 60, 59, 59, 59,
+ 55, 53, 51, 48, 48, 47, 46, 45, 44, 44, 55, 54, 53, 53, 51, 51, 48, 48,
+ 46, 44, 44, 43, 43, 43, 43, 43, 55, 54, 53, 53, 51, 51, 48, 48, 46, 44,
+ 44, 43, 43, 43, 43, 43, 45, 46, 46, 46, 46, 46, 45, 45, 44, 43, 43, 42,
+ 41, 41, 39, 39, 43, 43, 44, 44, 45, 45, 44, 44, 43, 43, 43, 41, 41, 40,
+ 39, 39,
+ /* Size 16x32 */
+ 64, 65, 66, 66, 66, 66, 62, 58, 55, 55, 55, 51, 45, 43, 43, 43, 65, 65,
+ 66, 66, 66, 66, 61, 57, 55, 55, 55, 50, 45, 43, 43, 43, 65, 65, 65, 65,
+ 65, 65, 60, 56, 54, 54, 54, 49, 46, 43, 43, 43, 65, 65, 65, 65, 65, 65,
+ 60, 55, 53, 53, 53, 49, 46, 44, 44, 44, 65, 65, 65, 65, 65, 65, 60, 55,
+ 53, 53, 53, 49, 46, 44, 44, 44, 65, 65, 65, 65, 65, 65, 60, 55, 53, 53,
+ 53, 49, 46, 44, 44, 44, 66, 65, 65, 64, 64, 64, 59, 55, 53, 53, 53, 49,
+ 46, 44, 44, 44, 67, 66, 65, 64, 64, 64, 59, 54, 52, 52, 52, 49, 46, 45,
+ 45, 45, 67, 66, 64, 64, 64, 64, 59, 54, 51, 51, 51, 49, 46, 45, 45, 45,
+ 67, 66, 64, 64, 64, 64, 59, 54, 51, 51, 51, 49, 46, 45, 45, 45, 67, 66,
+ 64, 64, 64, 64, 59, 54, 51, 51, 51, 49, 46, 45, 45, 45, 65, 63, 62, 61,
+ 61, 61, 57, 52, 50, 50, 50, 48, 46, 44, 44, 44, 62, 60, 59, 59, 59, 59,
+ 55, 51, 48, 48, 48, 47, 45, 44, 44, 44, 61, 59, 58, 57, 57, 57, 53, 49,
+ 48, 48, 48, 46, 45, 44, 44, 44, 61, 59, 58, 57, 57, 57, 53, 49, 48, 48,
+ 48, 46, 45, 44, 44, 44, 61, 59, 58, 57, 57, 57, 53, 49, 48, 48, 48, 46,
+ 45, 44, 44, 44, 59, 57, 55, 55, 55, 55, 51, 48, 46, 46, 46, 45, 44, 43,
+ 43, 43, 56, 55, 53, 52, 52, 52, 49, 46, 44, 44, 44, 44, 43, 43, 43, 43,
+ 55, 54, 52, 51, 51, 51, 48, 45, 44, 44, 44, 43, 43, 43, 43, 43, 55, 54,
+ 52, 51, 51, 51, 48, 45, 44, 44, 44, 43, 43, 43, 43, 43, 55, 54, 52, 51,
+ 51, 51, 48, 45, 44, 44, 44, 43, 43, 43, 43, 43, 53, 52, 51, 50, 50, 50,
+ 47, 45, 43, 43, 43, 43, 42, 42, 42, 42, 50, 49, 49, 48, 48, 48, 47, 45,
+ 43, 43, 43, 43, 42, 41, 41, 41, 49, 48, 48, 48, 48, 48, 46, 44, 43, 43,
+ 43, 42, 41, 41, 41, 41, 49, 48, 48, 48, 48, 48, 46, 44, 43, 43, 43, 42,
+ 41, 41, 41, 41, 49, 48, 48, 48, 48, 48, 46, 44, 43, 43, 43, 42, 41, 41,
+ 41, 41, 46, 46, 46, 46, 46, 46, 45, 44, 43, 43, 43, 42, 41, 40, 40, 40,
+ 43, 44, 45, 45, 45, 45, 44, 43, 43, 43, 43, 41, 40, 39, 39, 39, 42, 43,
+ 44, 44, 44, 44, 44, 43, 43, 43, 43, 41, 39, 39, 39, 39, 42, 43, 44, 44,
+ 44, 44, 44, 43, 43, 43, 43, 41, 39, 39, 39, 39, 42, 43, 44, 44, 44, 44,
+ 44, 43, 43, 43, 43, 41, 39, 39, 39, 39, 42, 43, 44, 44, 44, 44, 44, 43,
+ 43, 43, 43, 41, 39, 39, 39, 39,
+ /* Size 32x16 */
+ 64, 65, 65, 65, 65, 65, 66, 67, 67, 67, 67, 65, 62, 61, 61, 61, 59, 56,
+ 55, 55, 55, 53, 50, 49, 49, 49, 46, 43, 42, 42, 42, 42, 65, 65, 65, 65,
+ 65, 65, 65, 66, 66, 66, 66, 63, 60, 59, 59, 59, 57, 55, 54, 54, 54, 52,
+ 49, 48, 48, 48, 46, 44, 43, 43, 43, 43, 66, 66, 65, 65, 65, 65, 65, 65,
+ 64, 64, 64, 62, 59, 58, 58, 58, 55, 53, 52, 52, 52, 51, 49, 48, 48, 48,
+ 46, 45, 44, 44, 44, 44, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64, 64, 61,
+ 59, 57, 57, 57, 55, 52, 51, 51, 51, 50, 48, 48, 48, 48, 46, 45, 44, 44,
+ 44, 44, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64, 64, 61, 59, 57, 57, 57,
+ 55, 52, 51, 51, 51, 50, 48, 48, 48, 48, 46, 45, 44, 44, 44, 44, 66, 66,
+ 65, 65, 65, 65, 64, 64, 64, 64, 64, 61, 59, 57, 57, 57, 55, 52, 51, 51,
+ 51, 50, 48, 48, 48, 48, 46, 45, 44, 44, 44, 44, 62, 61, 60, 60, 60, 60,
+ 59, 59, 59, 59, 59, 57, 55, 53, 53, 53, 51, 49, 48, 48, 48, 47, 47, 46,
+ 46, 46, 45, 44, 44, 44, 44, 44, 58, 57, 56, 55, 55, 55, 55, 54, 54, 54,
+ 54, 52, 51, 49, 49, 49, 48, 46, 45, 45, 45, 45, 45, 44, 44, 44, 44, 43,
+ 43, 43, 43, 43, 55, 55, 54, 53, 53, 53, 53, 52, 51, 51, 51, 50, 48, 48,
+ 48, 48, 46, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 55, 55, 54, 53, 53, 53, 53, 52, 51, 51, 51, 50, 48, 48, 48, 48, 46, 44,
+ 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 55, 55, 54, 53,
+ 53, 53, 53, 52, 51, 51, 51, 50, 48, 48, 48, 48, 46, 44, 44, 44, 44, 43,
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 51, 50, 49, 49, 49, 49, 49, 49,
+ 49, 49, 49, 48, 47, 46, 46, 46, 45, 44, 43, 43, 43, 43, 43, 42, 42, 42,
+ 42, 41, 41, 41, 41, 41, 45, 45, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
+ 45, 45, 45, 45, 44, 43, 43, 43, 43, 42, 42, 41, 41, 41, 41, 40, 39, 39,
+ 39, 39, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 45, 44, 44, 44, 44, 44,
+ 43, 43, 43, 43, 43, 42, 41, 41, 41, 41, 40, 39, 39, 39, 39, 39, 43, 43,
+ 43, 44, 44, 44, 44, 45, 45, 45, 45, 44, 44, 44, 44, 44, 43, 43, 43, 43,
+ 43, 42, 41, 41, 41, 41, 40, 39, 39, 39, 39, 39, 43, 43, 43, 44, 44, 44,
+ 44, 45, 45, 45, 45, 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 42, 41, 41,
+ 41, 41, 40, 39, 39, 39, 39, 39,
+ /* Size 4x16 */
+ 65, 66, 55, 43, 65, 65, 54, 43, 65, 65, 53, 44, 65, 64, 53, 44, 66, 64,
+ 51, 45, 66, 64, 51, 45, 60, 59, 48, 44, 59, 57, 48, 44, 57, 55, 46, 43,
+ 54, 51, 44, 43, 54, 51, 44, 43, 49, 48, 43, 41, 48, 48, 43, 41, 46, 46,
+ 43, 40, 43, 44, 43, 39, 43, 44, 43, 39,
+ /* Size 16x4 */
+ 65, 65, 65, 65, 66, 66, 60, 59, 57, 54, 54, 49, 48, 46, 43, 43, 66, 65,
+ 65, 64, 64, 64, 59, 57, 55, 51, 51, 48, 48, 46, 44, 44, 55, 54, 53, 53,
+ 51, 51, 48, 48, 46, 44, 44, 43, 43, 43, 43, 43, 43, 43, 44, 44, 45, 45,
+ 44, 44, 43, 43, 43, 41, 41, 40, 39, 39,
+ /* Size 8x32 */
+ 64, 66, 66, 62, 55, 55, 45, 43, 65, 66, 66, 61, 55, 55, 45, 43, 65, 65,
+ 65, 60, 54, 54, 46, 43, 65, 65, 65, 60, 53, 53, 46, 44, 65, 65, 65, 60,
+ 53, 53, 46, 44, 65, 65, 65, 60, 53, 53, 46, 44, 66, 65, 64, 59, 53, 53,
+ 46, 44, 67, 65, 64, 59, 52, 52, 46, 45, 67, 64, 64, 59, 51, 51, 46, 45,
+ 67, 64, 64, 59, 51, 51, 46, 45, 67, 64, 64, 59, 51, 51, 46, 45, 65, 62,
+ 61, 57, 50, 50, 46, 44, 62, 59, 59, 55, 48, 48, 45, 44, 61, 58, 57, 53,
+ 48, 48, 45, 44, 61, 58, 57, 53, 48, 48, 45, 44, 61, 58, 57, 53, 48, 48,
+ 45, 44, 59, 55, 55, 51, 46, 46, 44, 43, 56, 53, 52, 49, 44, 44, 43, 43,
+ 55, 52, 51, 48, 44, 44, 43, 43, 55, 52, 51, 48, 44, 44, 43, 43, 55, 52,
+ 51, 48, 44, 44, 43, 43, 53, 51, 50, 47, 43, 43, 42, 42, 50, 49, 48, 47,
+ 43, 43, 42, 41, 49, 48, 48, 46, 43, 43, 41, 41, 49, 48, 48, 46, 43, 43,
+ 41, 41, 49, 48, 48, 46, 43, 43, 41, 41, 46, 46, 46, 45, 43, 43, 41, 40,
+ 43, 45, 45, 44, 43, 43, 40, 39, 42, 44, 44, 44, 43, 43, 39, 39, 42, 44,
+ 44, 44, 43, 43, 39, 39, 42, 44, 44, 44, 43, 43, 39, 39, 42, 44, 44, 44,
+ 43, 43, 39, 39,
+ /* Size 32x8 */
+ 64, 65, 65, 65, 65, 65, 66, 67, 67, 67, 67, 65, 62, 61, 61, 61, 59, 56,
+ 55, 55, 55, 53, 50, 49, 49, 49, 46, 43, 42, 42, 42, 42, 66, 66, 65, 65,
+ 65, 65, 65, 65, 64, 64, 64, 62, 59, 58, 58, 58, 55, 53, 52, 52, 52, 51,
+ 49, 48, 48, 48, 46, 45, 44, 44, 44, 44, 66, 66, 65, 65, 65, 65, 64, 64,
+ 64, 64, 64, 61, 59, 57, 57, 57, 55, 52, 51, 51, 51, 50, 48, 48, 48, 48,
+ 46, 45, 44, 44, 44, 44, 62, 61, 60, 60, 60, 60, 59, 59, 59, 59, 59, 57,
+ 55, 53, 53, 53, 51, 49, 48, 48, 48, 47, 47, 46, 46, 46, 45, 44, 44, 44,
+ 44, 44, 55, 55, 54, 53, 53, 53, 53, 52, 51, 51, 51, 50, 48, 48, 48, 48,
+ 46, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 55, 55,
+ 54, 53, 53, 53, 53, 52, 51, 51, 51, 50, 48, 48, 48, 48, 46, 44, 44, 44,
+ 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 45, 45, 46, 46, 46, 46,
+ 46, 46, 46, 46, 46, 46, 45, 45, 45, 45, 44, 43, 43, 43, 43, 42, 42, 41,
+ 41, 41, 41, 40, 39, 39, 39, 39, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45,
+ 45, 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 42, 41, 41, 41, 41, 40, 39,
+ 39, 39, 39, 39 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 64, 63, 63, 59,
+#endif
+ /* Size 4x4 */
+ 65, 64, 64, 63, 64, 63, 63, 62, 64, 63, 61, 60, 63, 62, 60, 58,
+ /* Size 8x8 */
+ 65, 65, 65, 65, 64, 64, 64, 61, 65, 64, 64, 64, 64, 64, 63, 61, 65, 64,
+ 64, 64, 63, 63, 63, 61, 65, 64, 64, 63, 63, 63, 63, 61, 64, 64, 63, 63,
+ 61, 61, 60, 59, 64, 64, 63, 63, 61, 60, 59, 58, 64, 63, 63, 63, 60, 59,
+ 58, 56, 61, 61, 61, 61, 59, 58, 56, 54,
+ /* Size 16x16 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 63, 60, 65, 65,
+ 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 62, 60, 65, 65, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 62, 60, 65, 65, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 63, 63, 63, 62, 60, 65, 65, 64, 64, 64, 64, 64, 64,
+ 63, 63, 63, 63, 63, 63, 62, 60, 65, 65, 64, 64, 64, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 62, 61, 65, 65, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 62, 61, 65, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 62, 62, 62,
+ 61, 60, 65, 64, 64, 64, 63, 63, 63, 63, 62, 62, 62, 61, 61, 61, 60, 59,
+ 65, 64, 64, 64, 63, 63, 63, 63, 62, 61, 61, 61, 60, 60, 59, 58, 65, 64,
+ 64, 64, 63, 63, 63, 63, 62, 61, 61, 61, 60, 60, 59, 58, 64, 64, 63, 63,
+ 63, 63, 63, 62, 61, 61, 61, 59, 59, 59, 58, 57, 64, 64, 63, 63, 63, 63,
+ 63, 62, 61, 60, 60, 59, 58, 58, 57, 55, 64, 64, 63, 63, 63, 63, 63, 62,
+ 61, 60, 60, 59, 58, 58, 57, 55, 63, 62, 62, 62, 62, 62, 62, 61, 60, 59,
+ 59, 58, 57, 57, 56, 54, 60, 60, 60, 60, 60, 61, 61, 60, 59, 58, 58, 57,
+ 55, 55, 54, 52,
+ /* Size 32x32 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 63, 62, 60, 60, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 64, 64, 64, 64, 64, 64, 63, 61, 60, 60, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 65, 65, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 66, 66,
- 66, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 65, 65, 66, 66, 66, 66, 65, 65,
- 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 63, 63, 63, 63, 63, 63, 65, 65, 66, 66, 66, 66, 65, 65, 65, 65, 64, 64,
+ 64, 63, 62, 61, 60, 60, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 62, 61,
+ 60, 60, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 62, 61, 60, 60, 65, 65,
+ 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 63, 63, 63, 63, 63, 63, 62, 61, 60, 60, 65, 65, 65, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63,
+ 63, 63, 63, 63, 62, 61, 60, 60, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63,
+ 62, 61, 60, 60, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 61, 60, 60,
+ 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 61, 61, 61, 65, 65, 65, 64,
+ 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 62, 62, 61, 61, 61, 65, 65, 65, 64, 64, 64, 64, 64,
+ 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 62, 62, 61, 61, 61, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 61,
+ 61, 61, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 61, 61, 61, 65, 65,
+ 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 62, 62, 62, 62, 62, 62, 62, 61, 61, 60, 60, 65, 65, 64, 64, 64, 64,
+ 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 61,
+ 61, 61, 61, 61, 60, 60, 59, 59, 65, 64, 64, 64, 64, 64, 64, 64, 63, 63,
+ 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 60,
+ 60, 59, 59, 59, 65, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63,
+ 63, 62, 62, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 59, 59, 58, 58,
+ 65, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 62, 62, 61,
+ 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 59, 59, 58, 58, 65, 64, 64, 64,
+ 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 62, 62, 61, 61, 61, 61, 61,
+ 61, 60, 60, 60, 60, 60, 59, 59, 58, 58, 65, 64, 64, 64, 64, 64, 64, 64,
+ 63, 63, 63, 63, 63, 63, 63, 62, 62, 61, 61, 61, 61, 61, 61, 60, 60, 60,
+ 60, 60, 59, 59, 58, 58, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63,
+ 63, 63, 62, 62, 61, 61, 61, 61, 61, 60, 60, 59, 59, 59, 59, 59, 59, 58,
+ 58, 58, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62,
+ 61, 61, 61, 61, 61, 60, 59, 59, 59, 59, 59, 59, 58, 58, 57, 57, 64, 64,
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 61, 61, 60, 60, 60,
+ 60, 59, 59, 59, 59, 59, 59, 58, 58, 57, 56, 56, 64, 64, 64, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 62, 61, 61, 60, 60, 60, 60, 59, 59, 59,
+ 58, 58, 58, 58, 57, 56, 55, 55, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 62, 61, 61, 60, 60, 60, 60, 59, 59, 59, 58, 58, 58, 58,
+ 57, 56, 55, 55, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 62, 61, 61, 60, 60, 60, 60, 59, 59, 59, 58, 58, 58, 58, 57, 56, 55, 55,
+ 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 60, 60,
+ 60, 60, 60, 59, 59, 58, 58, 58, 58, 58, 57, 56, 55, 55, 63, 63, 62, 62,
+ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 61, 60, 60, 59, 59, 59, 59, 59,
+ 58, 58, 57, 57, 57, 57, 56, 55, 54, 54, 62, 61, 61, 61, 61, 61, 61, 61,
+ 61, 61, 61, 61, 61, 61, 61, 60, 59, 59, 59, 59, 59, 58, 58, 57, 56, 56,
+ 56, 56, 55, 54, 53, 53, 60, 60, 60, 60, 60, 60, 60, 60, 60, 61, 61, 61,
+ 61, 61, 60, 59, 59, 58, 58, 58, 58, 58, 57, 56, 55, 55, 55, 55, 54, 53,
+ 52, 52, 60, 60, 60, 60, 60, 60, 60, 60, 60, 61, 61, 61, 61, 61, 60, 59,
+ 59, 58, 58, 58, 58, 58, 57, 56, 55, 55, 55, 55, 54, 53, 52, 52,
+ /* Size 4x8 */
+ 65, 65, 64, 64, 65, 64, 63, 63, 64, 64, 63, 63, 64, 63, 63, 62, 64, 63,
+ 61, 60, 64, 63, 60, 59, 64, 62, 59, 58, 61, 61, 58, 56,
+ /* Size 8x4 */
+ 65, 65, 64, 64, 64, 64, 64, 61, 65, 64, 64, 63, 63, 63, 62, 61, 64, 63,
+ 63, 63, 61, 60, 59, 58, 64, 63, 63, 62, 60, 59, 58, 56,
+ /* Size 8x16 */
+ 64, 65, 65, 65, 65, 64, 64, 63, 65, 65, 64, 64, 64, 63, 63, 62, 65, 64,
+ 64, 64, 64, 63, 63, 62, 65, 64, 64, 64, 64, 63, 63, 62, 65, 64, 64, 64,
+ 63, 63, 63, 62, 65, 64, 63, 63, 63, 62, 62, 62, 65, 64, 63, 63, 63, 62,
+ 62, 62, 65, 64, 63, 63, 63, 62, 62, 61, 65, 64, 63, 63, 62, 60, 60, 59,
+ 64, 63, 63, 63, 62, 60, 60, 59, 64, 63, 63, 63, 62, 60, 60, 59, 64, 63,
+ 63, 63, 61, 59, 59, 58, 64, 63, 62, 62, 60, 58, 58, 57, 64, 63, 62, 62,
+ 60, 58, 58, 57, 63, 62, 62, 62, 59, 57, 57, 56, 60, 60, 60, 60, 59, 55,
+ 55, 54,
+ /* Size 16x8 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 63, 60, 65, 65,
+ 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 62, 60, 65, 64, 64, 64,
+ 64, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 60, 65, 64, 64, 64, 64, 63,
+ 63, 63, 63, 63, 63, 63, 62, 62, 62, 60, 65, 64, 64, 64, 63, 63, 63, 63,
+ 62, 62, 62, 61, 60, 60, 59, 59, 64, 63, 63, 63, 63, 62, 62, 62, 60, 60,
+ 60, 59, 58, 58, 57, 55, 64, 63, 63, 63, 63, 62, 62, 62, 60, 60, 60, 59,
+ 58, 58, 57, 55, 63, 62, 62, 62, 62, 62, 62, 61, 59, 59, 59, 58, 57, 57,
+ 56, 54,
+ /* Size 16x32 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 63, 60, 65, 65,
+ 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 62, 60, 65, 65, 65, 64,
+ 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 62, 60, 65, 65, 64, 64, 64, 64,
+ 64, 64, 64, 63, 63, 63, 63, 63, 62, 60, 65, 65, 64, 64, 64, 64, 64, 64,
+ 64, 63, 63, 63, 63, 63, 62, 60, 65, 65, 64, 64, 64, 64, 64, 64, 64, 63,
+ 63, 63, 63, 63, 62, 60, 65, 65, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63,
+ 63, 63, 62, 60, 65, 65, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63,
+ 62, 60, 65, 65, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 62, 60,
+ 65, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 62, 61, 65, 64,
+ 64, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 65, 64, 64, 63,
+ 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 65, 64, 64, 63, 63, 63,
+ 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 65, 64, 64, 63, 63, 63, 63, 63,
+ 63, 63, 62, 62, 62, 62, 62, 61, 65, 64, 64, 63, 63, 63, 63, 63, 63, 62,
+ 62, 62, 62, 62, 61, 60, 65, 64, 64, 63, 63, 63, 63, 63, 62, 62, 61, 61,
+ 61, 61, 60, 59, 65, 64, 64, 63, 63, 63, 63, 63, 62, 61, 60, 60, 60, 60,
+ 59, 59, 64, 64, 63, 63, 63, 63, 63, 62, 62, 61, 60, 60, 60, 60, 59, 58,
+ 64, 64, 63, 63, 63, 63, 63, 62, 62, 61, 60, 60, 60, 60, 59, 58, 64, 64,
+ 63, 63, 63, 63, 63, 62, 62, 61, 60, 60, 60, 60, 59, 58, 64, 64, 63, 63,
+ 63, 63, 63, 62, 62, 61, 60, 60, 60, 60, 59, 58, 64, 64, 63, 63, 63, 63,
+ 63, 62, 61, 60, 59, 59, 59, 59, 59, 58, 64, 64, 63, 63, 63, 63, 63, 62,
+ 61, 60, 59, 59, 59, 59, 58, 57, 64, 64, 63, 63, 62, 62, 62, 62, 61, 59,
+ 59, 59, 59, 59, 57, 56, 64, 64, 63, 63, 62, 62, 62, 62, 60, 59, 58, 58,
+ 58, 58, 57, 55, 64, 64, 63, 63, 62, 62, 62, 62, 60, 59, 58, 58, 58, 58,
+ 57, 55, 64, 64, 63, 63, 62, 62, 62, 62, 60, 59, 58, 58, 58, 58, 57, 55,
+ 64, 63, 63, 62, 62, 62, 62, 62, 60, 59, 58, 58, 58, 58, 57, 55, 63, 62,
+ 62, 62, 62, 62, 62, 61, 59, 59, 57, 57, 57, 57, 56, 54, 61, 61, 61, 61,
+ 61, 61, 61, 60, 59, 58, 56, 56, 56, 56, 55, 53, 60, 60, 60, 60, 60, 60,
+ 60, 60, 59, 57, 55, 55, 55, 55, 54, 52, 60, 60, 60, 60, 60, 60, 60, 60,
+ 59, 57, 55, 55, 55, 55, 54, 52,
+ /* Size 32x16 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 61, 60, 60, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 63, 62, 61, 60, 60, 65, 65, 65, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 62, 61, 60, 60, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 61,
+ 60, 60, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 61, 60, 60, 65, 65,
+ 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 62, 62, 62, 62, 62, 62, 61, 60, 60, 65, 65, 64, 64, 64, 64,
+ 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62,
+ 62, 62, 62, 62, 62, 61, 60, 60, 65, 65, 64, 64, 64, 64, 64, 64, 64, 63,
+ 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
+ 61, 60, 60, 60, 65, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63,
+ 63, 62, 62, 62, 62, 62, 62, 61, 61, 61, 60, 60, 60, 60, 59, 59, 59, 59,
+ 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 61, 61,
+ 61, 61, 61, 60, 60, 59, 59, 59, 59, 59, 59, 58, 57, 57, 64, 64, 63, 63,
+ 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 60, 60, 60, 60, 60, 59,
+ 59, 59, 58, 58, 58, 58, 57, 56, 55, 55, 64, 64, 63, 63, 63, 63, 63, 63,
+ 63, 63, 62, 62, 62, 62, 62, 61, 60, 60, 60, 60, 60, 59, 59, 59, 58, 58,
+ 58, 58, 57, 56, 55, 55, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62,
+ 62, 62, 62, 61, 60, 60, 60, 60, 60, 59, 59, 59, 58, 58, 58, 58, 57, 56,
+ 55, 55, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61,
+ 60, 60, 60, 60, 60, 59, 59, 59, 58, 58, 58, 58, 57, 56, 55, 55, 63, 62,
+ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 61, 60, 59, 59, 59, 59,
+ 59, 59, 58, 57, 57, 57, 57, 57, 56, 55, 54, 54, 60, 60, 60, 60, 60, 60,
+ 60, 60, 60, 61, 61, 61, 61, 61, 60, 59, 59, 58, 58, 58, 58, 58, 57, 56,
+ 55, 55, 55, 55, 54, 53, 52, 52,
+ /* Size 4x16 */
+ 65, 65, 64, 64, 65, 64, 64, 63, 65, 64, 63, 63, 65, 64, 63, 63, 65, 64,
+ 63, 63, 64, 63, 63, 62, 64, 63, 63, 62, 64, 63, 62, 62, 64, 63, 61, 60,
+ 64, 63, 61, 60, 64, 63, 61, 60, 64, 63, 60, 59, 64, 62, 59, 58, 64, 62,
+ 59, 58, 62, 62, 59, 57, 60, 60, 57, 55,
+ /* Size 16x4 */
+ 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 60, 65, 64,
+ 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 60, 64, 64, 63, 63,
+ 63, 63, 63, 62, 61, 61, 61, 60, 59, 59, 59, 57, 64, 63, 63, 63, 63, 62,
+ 62, 62, 60, 60, 60, 59, 58, 58, 57, 55,
+ /* Size 8x32 */
+ 64, 65, 65, 65, 65, 64, 64, 63, 65, 65, 65, 65, 64, 64, 64, 62, 65, 65,
+ 64, 64, 64, 63, 63, 62, 65, 64, 64, 64, 64, 63, 63, 62, 65, 64, 64, 64,
+ 64, 63, 63, 62, 65, 64, 64, 64, 64, 63, 63, 62, 65, 64, 64, 64, 64, 63,
+ 63, 62, 65, 64, 64, 64, 64, 63, 63, 62, 65, 64, 64, 64, 63, 63, 63, 62,
+ 65, 64, 64, 64, 63, 63, 63, 62, 65, 64, 63, 63, 63, 62, 62, 62, 65, 64,
+ 63, 63, 63, 62, 62, 62, 65, 64, 63, 63, 63, 62, 62, 62, 65, 64, 63, 63,
+ 63, 62, 62, 62, 65, 64, 63, 63, 63, 62, 62, 61, 65, 64, 63, 63, 62, 61,
+ 61, 60, 65, 64, 63, 63, 62, 60, 60, 59, 64, 63, 63, 63, 62, 60, 60, 59,
+ 64, 63, 63, 63, 62, 60, 60, 59, 64, 63, 63, 63, 62, 60, 60, 59, 64, 63,
+ 63, 63, 62, 60, 60, 59, 64, 63, 63, 63, 61, 59, 59, 59, 64, 63, 63, 63,
+ 61, 59, 59, 58, 64, 63, 62, 62, 61, 59, 59, 57, 64, 63, 62, 62, 60, 58,
+ 58, 57, 64, 63, 62, 62, 60, 58, 58, 57, 64, 63, 62, 62, 60, 58, 58, 57,
+ 64, 63, 62, 62, 60, 58, 58, 57, 63, 62, 62, 62, 59, 57, 57, 56, 61, 61,
+ 61, 61, 59, 56, 56, 55, 60, 60, 60, 60, 59, 55, 55, 54, 60, 60, 60, 60,
+ 59, 55, 55, 54,
+ /* Size 32x8 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 61, 60, 60, 65, 65, 65, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 62, 61, 60, 60, 65, 65, 64, 64, 64, 64, 64, 64,
+ 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62,
+ 62, 62, 62, 61, 60, 60, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 61,
+ 60, 60, 65, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 62,
+ 62, 62, 62, 62, 62, 61, 61, 61, 60, 60, 60, 60, 59, 59, 59, 59, 64, 64,
+ 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 60, 60, 60, 60,
+ 60, 59, 59, 59, 58, 58, 58, 58, 57, 56, 55, 55, 64, 64, 63, 63, 63, 63,
+ 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 60, 60, 60, 60, 60, 59, 59, 59,
+ 58, 58, 58, 58, 57, 56, 55, 55, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62,
+ 62, 62, 62, 62, 61, 60, 59, 59, 59, 59, 59, 59, 58, 57, 57, 57, 57, 57,
+ 56, 55, 54, 54 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 65, 54, 54, 44,
+#endif
+ /* Size 4x4 */
+ 65, 66, 59, 53, 66, 64, 58, 51, 59, 58, 53, 47, 53, 51, 47, 43,
+ /* Size 8x8 */
+ 65, 66, 66, 67, 60, 59, 55, 51, 66, 65, 65, 66, 59, 58, 53, 50, 66, 65,
+ 65, 65, 59, 56, 52, 49, 67, 66, 65, 64, 58, 56, 51, 49, 60, 59, 59, 58,
+ 53, 51, 47, 46, 59, 58, 56, 56, 51, 49, 46, 45, 55, 53, 52, 51, 47, 46,
+ 43, 43, 51, 50, 49, 49, 46, 45, 43, 43,
+ /* Size 16x16 */
+ 64, 65, 66, 66, 66, 67, 67, 66, 62, 61, 61, 58, 56, 56, 53, 49, 65, 65,
+ 65, 65, 66, 66, 66, 65, 61, 60, 60, 57, 55, 55, 52, 49, 66, 65, 65, 65,
+ 65, 66, 66, 64, 60, 59, 59, 55, 53, 53, 51, 48, 66, 65, 65, 65, 65, 66,
+ 66, 64, 60, 59, 59, 55, 53, 53, 51, 48, 66, 66, 65, 65, 65, 65, 65, 64,
+ 60, 59, 59, 55, 53, 53, 51, 48, 67, 66, 66, 66, 65, 64, 64, 63, 59, 58,
+ 58, 54, 51, 51, 50, 48, 67, 66, 66, 66, 65, 64, 64, 63, 59, 58, 58, 54,
+ 51, 51, 50, 48, 66, 65, 64, 64, 64, 63, 63, 62, 58, 57, 57, 53, 51, 51,
+ 49, 48, 62, 61, 60, 60, 60, 59, 59, 58, 55, 53, 53, 50, 48, 48, 47, 46,
+ 61, 60, 59, 59, 59, 58, 58, 57, 53, 53, 53, 49, 47, 47, 47, 46, 61, 60,
+ 59, 59, 59, 58, 58, 57, 53, 53, 53, 49, 47, 47, 47, 46, 58, 57, 55, 55,
+ 55, 54, 54, 53, 50, 49, 49, 47, 45, 45, 45, 44, 56, 55, 53, 53, 53, 51,
+ 51, 51, 48, 47, 47, 45, 43, 43, 43, 43, 56, 55, 53, 53, 53, 51, 51, 51,
+ 48, 47, 47, 45, 43, 43, 43, 43, 53, 52, 51, 51, 51, 50, 50, 49, 47, 47,
+ 47, 45, 43, 43, 43, 43, 49, 49, 48, 48, 48, 48, 48, 48, 46, 46, 46, 44,
+ 43, 43, 43, 42,
+ /* Size 32x32 */
+ 64, 65, 65, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 66, 64, 62, 61,
+ 61, 61, 61, 59, 58, 56, 56, 56, 56, 55, 53, 51, 49, 49, 65, 65, 65, 65,
+ 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 66, 64, 62, 60, 60, 60, 60, 59,
+ 57, 55, 55, 55, 55, 55, 53, 51, 49, 49, 65, 65, 65, 65, 65, 65, 65, 65,
+ 66, 66, 66, 66, 66, 66, 65, 63, 61, 60, 60, 60, 60, 59, 57, 55, 55, 55,
+ 55, 54, 52, 51, 49, 49, 66, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66,
+ 66, 66, 64, 63, 60, 59, 59, 59, 59, 58, 56, 54, 53, 53, 53, 53, 51, 50,
+ 49, 49, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 64, 62,
+ 60, 59, 59, 59, 59, 58, 55, 54, 53, 53, 53, 53, 51, 50, 48, 48, 66, 66,
+ 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 64, 62, 60, 59, 59, 59,
+ 59, 58, 55, 54, 53, 53, 53, 53, 51, 50, 48, 48, 66, 66, 65, 65, 65, 65,
+ 65, 65, 65, 65, 66, 66, 66, 66, 64, 62, 60, 59, 59, 59, 59, 58, 55, 54,
+ 53, 53, 53, 53, 51, 50, 48, 48, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 64, 62, 60, 59, 59, 59, 59, 57, 55, 54, 53, 53, 53, 53,
+ 51, 50, 48, 48, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 64, 62, 60, 59, 59, 59, 59, 57, 55, 53, 53, 53, 53, 52, 51, 49, 48, 48,
+ 67, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 63, 61, 59, 59,
+ 59, 59, 59, 56, 55, 53, 52, 52, 52, 51, 51, 49, 48, 48, 67, 67, 66, 66,
+ 66, 66, 66, 65, 65, 65, 64, 64, 64, 64, 63, 61, 59, 58, 58, 58, 58, 56,
+ 54, 52, 51, 51, 51, 51, 50, 49, 48, 48, 67, 67, 66, 66, 66, 66, 66, 65,
+ 65, 65, 64, 64, 64, 64, 63, 61, 59, 58, 58, 58, 58, 56, 54, 52, 51, 51,
+ 51, 51, 50, 49, 48, 48, 67, 67, 66, 66, 66, 66, 66, 65, 65, 65, 64, 64,
+ 64, 64, 63, 61, 59, 58, 58, 58, 58, 56, 54, 52, 51, 51, 51, 51, 50, 49,
+ 48, 48, 67, 67, 66, 66, 66, 66, 66, 65, 65, 65, 64, 64, 64, 64, 63, 61,
+ 59, 58, 58, 58, 58, 56, 54, 52, 51, 51, 51, 51, 50, 49, 48, 48, 66, 66,
+ 65, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 62, 60, 58, 57, 57, 57,
+ 57, 55, 53, 51, 51, 51, 51, 50, 49, 48, 48, 48, 64, 64, 63, 63, 62, 62,
+ 62, 62, 62, 61, 61, 61, 61, 61, 60, 58, 56, 55, 55, 55, 55, 53, 52, 50,
+ 49, 49, 49, 49, 48, 48, 47, 47, 62, 62, 61, 60, 60, 60, 60, 60, 60, 59,
+ 59, 59, 59, 59, 58, 56, 55, 53, 53, 53, 53, 52, 50, 49, 48, 48, 48, 48,
+ 47, 47, 46, 46, 61, 60, 60, 59, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58,
+ 57, 55, 53, 53, 53, 53, 53, 51, 49, 48, 47, 47, 47, 47, 47, 46, 46, 46,
+ 61, 60, 60, 59, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 57, 55, 53, 53,
+ 53, 53, 53, 51, 49, 48, 47, 47, 47, 47, 47, 46, 46, 46, 61, 60, 60, 59,
+ 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 57, 55, 53, 53, 53, 53, 53, 51,
+ 49, 48, 47, 47, 47, 47, 47, 46, 46, 46, 61, 60, 60, 59, 59, 59, 59, 59,
+ 59, 59, 58, 58, 58, 58, 57, 55, 53, 53, 53, 53, 53, 51, 49, 48, 47, 47,
+ 47, 47, 47, 46, 46, 46, 59, 59, 59, 58, 58, 58, 58, 57, 57, 56, 56, 56,
+ 56, 56, 55, 53, 52, 51, 51, 51, 51, 49, 48, 47, 46, 46, 46, 46, 46, 45,
+ 45, 45, 58, 57, 57, 56, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 53, 52,
+ 50, 49, 49, 49, 49, 48, 47, 45, 45, 45, 45, 45, 45, 45, 44, 44, 56, 55,
+ 55, 54, 54, 54, 54, 54, 53, 53, 52, 52, 52, 52, 51, 50, 49, 48, 48, 48,
+ 48, 47, 45, 44, 44, 44, 44, 44, 44, 44, 44, 44, 56, 55, 55, 53, 53, 53,
+ 53, 53, 53, 52, 51, 51, 51, 51, 51, 49, 48, 47, 47, 47, 47, 46, 45, 44,
+ 43, 43, 43, 43, 43, 43, 43, 43, 56, 55, 55, 53, 53, 53, 53, 53, 53, 52,
+ 51, 51, 51, 51, 51, 49, 48, 47, 47, 47, 47, 46, 45, 44, 43, 43, 43, 43,
+ 43, 43, 43, 43, 56, 55, 55, 53, 53, 53, 53, 53, 53, 52, 51, 51, 51, 51,
+ 51, 49, 48, 47, 47, 47, 47, 46, 45, 44, 43, 43, 43, 43, 43, 43, 43, 43,
+ 55, 55, 54, 53, 53, 53, 53, 53, 52, 51, 51, 51, 51, 51, 50, 49, 48, 47,
+ 47, 47, 47, 46, 45, 44, 43, 43, 43, 43, 43, 43, 43, 43, 53, 53, 52, 51,
+ 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 49, 48, 47, 47, 47, 47, 47, 46,
+ 45, 44, 43, 43, 43, 43, 43, 43, 43, 43, 51, 51, 51, 50, 50, 50, 50, 50,
+ 49, 49, 49, 49, 49, 49, 48, 48, 47, 46, 46, 46, 46, 45, 45, 44, 43, 43,
+ 43, 43, 43, 43, 43, 43, 49, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48, 48,
+ 48, 48, 48, 47, 46, 46, 46, 46, 46, 45, 44, 44, 43, 43, 43, 43, 43, 43,
+ 42, 42, 49, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 47,
+ 46, 46, 46, 46, 46, 45, 44, 44, 43, 43, 43, 43, 43, 43, 42, 42,
+ /* Size 4x8 */
+ 65, 66, 59, 55, 65, 65, 57, 53, 66, 64, 55, 52, 66, 64, 55, 51, 59, 57,
+ 51, 48, 58, 55, 49, 46, 54, 51, 46, 44, 50, 49, 45, 43,
+ /* Size 8x4 */
+ 65, 65, 66, 66, 59, 58, 54, 50, 66, 65, 64, 64, 57, 55, 51, 49, 59, 57,
+ 55, 55, 51, 49, 46, 45, 55, 53, 52, 51, 48, 46, 44, 43,
+ /* Size 8x16 */
+ 64, 66, 66, 66, 62, 55, 55, 53, 65, 65, 65, 65, 61, 54, 54, 52, 65, 65,
+ 65, 65, 60, 53, 53, 51, 65, 65, 65, 65, 60, 53, 53, 51, 66, 65, 64, 64,
+ 59, 53, 53, 51, 67, 65, 64, 64, 59, 51, 51, 50, 67, 65, 64, 64, 59, 51,
+ 51, 50, 66, 64, 62, 62, 58, 51, 51, 49, 62, 60, 59, 59, 55, 48, 48, 48,
+ 61, 59, 57, 57, 53, 48, 48, 47, 61, 59, 57, 57, 53, 48, 48, 47, 58, 55,
+ 53, 53, 50, 45, 45, 45, 55, 53, 51, 51, 48, 44, 44, 43, 55, 53, 51, 51,
+ 48, 44, 44, 43, 53, 51, 50, 50, 47, 43, 43, 43, 49, 48, 48, 48, 46, 43,
+ 43, 43,
+ /* Size 16x8 */
+ 64, 65, 65, 65, 66, 67, 67, 66, 62, 61, 61, 58, 55, 55, 53, 49, 66, 65,
+ 65, 65, 65, 65, 65, 64, 60, 59, 59, 55, 53, 53, 51, 48, 66, 65, 65, 65,
+ 64, 64, 64, 62, 59, 57, 57, 53, 51, 51, 50, 48, 66, 65, 65, 65, 64, 64,
+ 64, 62, 59, 57, 57, 53, 51, 51, 50, 48, 62, 61, 60, 60, 59, 59, 59, 58,
+ 55, 53, 53, 50, 48, 48, 47, 46, 55, 54, 53, 53, 53, 51, 51, 51, 48, 48,
+ 48, 45, 44, 44, 43, 43, 55, 54, 53, 53, 53, 51, 51, 51, 48, 48, 48, 45,
+ 44, 44, 43, 43, 53, 52, 51, 51, 51, 50, 50, 49, 48, 47, 47, 45, 43, 43,
+ 43, 43,
+ /* Size 16x32 */
+ 64, 65, 66, 66, 66, 66, 66, 65, 62, 59, 55, 55, 55, 55, 53, 49, 65, 65,
+ 65, 66, 66, 66, 66, 65, 61, 59, 55, 55, 55, 55, 53, 49, 65, 65, 65, 65,
+ 65, 65, 65, 64, 61, 58, 54, 54, 54, 54, 52, 49, 65, 65, 65, 65, 65, 65,
+ 65, 64, 60, 57, 53, 53, 53, 53, 51, 48, 65, 65, 65, 65, 65, 65, 65, 64,
+ 60, 57, 53, 53, 53, 53, 51, 48, 65, 65, 65, 65, 65, 65, 65, 64, 60, 57,
+ 53, 53, 53, 53, 51, 48, 65, 65, 65, 65, 65, 65, 65, 64, 60, 57, 53, 53,
+ 53, 53, 51, 48, 66, 65, 65, 65, 65, 65, 65, 64, 60, 57, 53, 53, 53, 53,
+ 51, 48, 66, 66, 65, 65, 64, 64, 64, 63, 59, 56, 53, 53, 53, 53, 51, 48,
+ 67, 66, 65, 64, 64, 64, 64, 63, 59, 55, 52, 52, 52, 52, 51, 48, 67, 66,
+ 65, 64, 64, 64, 64, 62, 59, 55, 51, 51, 51, 51, 50, 48, 67, 66, 65, 64,
+ 64, 64, 64, 62, 59, 55, 51, 51, 51, 51, 50, 48, 67, 66, 65, 64, 64, 64,
+ 64, 62, 59, 55, 51, 51, 51, 51, 50, 48, 67, 66, 65, 64, 64, 64, 64, 62,
+ 59, 55, 51, 51, 51, 51, 50, 48, 66, 65, 64, 63, 62, 62, 62, 61, 58, 54,
+ 51, 51, 51, 51, 49, 48, 64, 63, 62, 61, 60, 60, 60, 59, 56, 53, 49, 49,
+ 49, 49, 48, 47, 62, 61, 60, 59, 59, 59, 59, 58, 55, 51, 48, 48, 48, 48,
+ 48, 46, 61, 59, 59, 58, 57, 57, 57, 56, 53, 51, 48, 48, 48, 48, 47, 46,
+ 61, 59, 59, 58, 57, 57, 57, 56, 53, 51, 48, 48, 48, 48, 47, 46, 61, 59,
+ 59, 58, 57, 57, 57, 56, 53, 51, 48, 48, 48, 48, 47, 46, 61, 59, 59, 58,
+ 57, 57, 57, 56, 53, 51, 48, 48, 48, 48, 47, 46, 59, 58, 57, 55, 55, 55,
+ 55, 55, 52, 49, 46, 46, 46, 46, 46, 45, 58, 56, 55, 54, 53, 53, 53, 53,
+ 50, 48, 45, 45, 45, 45, 45, 44, 56, 55, 53, 52, 52, 52, 52, 51, 48, 46,
+ 44, 44, 44, 44, 44, 44, 55, 54, 53, 51, 51, 51, 51, 50, 48, 46, 44, 44,
+ 44, 44, 43, 43, 55, 54, 53, 51, 51, 51, 51, 50, 48, 46, 44, 44, 44, 44,
+ 43, 43, 55, 54, 53, 51, 51, 51, 51, 50, 48, 46, 44, 44, 44, 44, 43, 43,
+ 55, 53, 53, 51, 51, 51, 51, 50, 48, 46, 44, 44, 44, 44, 43, 43, 53, 52,
+ 51, 50, 50, 50, 50, 49, 47, 45, 43, 43, 43, 43, 43, 43, 51, 50, 49, 49,
+ 49, 49, 49, 48, 47, 45, 43, 43, 43, 43, 43, 42, 49, 49, 48, 48, 48, 48,
+ 48, 47, 46, 45, 43, 43, 43, 43, 43, 42, 49, 49, 48, 48, 48, 48, 48, 47,
+ 46, 45, 43, 43, 43, 43, 43, 42,
+ /* Size 32x16 */
+ 64, 65, 65, 65, 65, 65, 65, 66, 66, 67, 67, 67, 67, 67, 66, 64, 62, 61,
+ 61, 61, 61, 59, 58, 56, 55, 55, 55, 55, 53, 51, 49, 49, 65, 65, 65, 65,
+ 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 65, 63, 61, 59, 59, 59, 59, 58,
+ 56, 55, 54, 54, 54, 53, 52, 50, 49, 49, 66, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 64, 62, 60, 59, 59, 59, 59, 57, 55, 53, 53, 53,
+ 53, 53, 51, 49, 48, 48, 66, 66, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64,
+ 64, 64, 63, 61, 59, 58, 58, 58, 58, 55, 54, 52, 51, 51, 51, 51, 50, 49,
+ 48, 48, 66, 66, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 62, 60,
+ 59, 57, 57, 57, 57, 55, 53, 52, 51, 51, 51, 51, 50, 49, 48, 48, 66, 66,
+ 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 62, 60, 59, 57, 57, 57,
+ 57, 55, 53, 52, 51, 51, 51, 51, 50, 49, 48, 48, 66, 66, 65, 65, 65, 65,
+ 65, 65, 64, 64, 64, 64, 64, 64, 62, 60, 59, 57, 57, 57, 57, 55, 53, 52,
+ 51, 51, 51, 51, 50, 49, 48, 48, 65, 65, 64, 64, 64, 64, 64, 64, 63, 63,
+ 62, 62, 62, 62, 61, 59, 58, 56, 56, 56, 56, 55, 53, 51, 50, 50, 50, 50,
+ 49, 48, 47, 47, 62, 61, 61, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59,
+ 58, 56, 55, 53, 53, 53, 53, 52, 50, 48, 48, 48, 48, 48, 47, 47, 46, 46,
+ 59, 59, 58, 57, 57, 57, 57, 57, 56, 55, 55, 55, 55, 55, 54, 53, 51, 51,
+ 51, 51, 51, 49, 48, 46, 46, 46, 46, 46, 45, 45, 45, 45, 55, 55, 54, 53,
+ 53, 53, 53, 53, 53, 52, 51, 51, 51, 51, 51, 49, 48, 48, 48, 48, 48, 46,
+ 45, 44, 44, 44, 44, 44, 43, 43, 43, 43, 55, 55, 54, 53, 53, 53, 53, 53,
+ 53, 52, 51, 51, 51, 51, 51, 49, 48, 48, 48, 48, 48, 46, 45, 44, 44, 44,
+ 44, 44, 43, 43, 43, 43, 55, 55, 54, 53, 53, 53, 53, 53, 53, 52, 51, 51,
+ 51, 51, 51, 49, 48, 48, 48, 48, 48, 46, 45, 44, 44, 44, 44, 44, 43, 43,
+ 43, 43, 55, 55, 54, 53, 53, 53, 53, 53, 53, 52, 51, 51, 51, 51, 51, 49,
+ 48, 48, 48, 48, 48, 46, 45, 44, 44, 44, 44, 44, 43, 43, 43, 43, 53, 53,
+ 52, 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 49, 48, 48, 47, 47, 47,
+ 47, 46, 45, 44, 43, 43, 43, 43, 43, 43, 43, 43, 49, 49, 49, 48, 48, 48,
+ 48, 48, 48, 48, 48, 48, 48, 48, 48, 47, 46, 46, 46, 46, 46, 45, 44, 44,
+ 43, 43, 43, 43, 43, 42, 42, 42,
+ /* Size 4x16 */
+ 65, 66, 59, 55, 65, 65, 58, 54, 65, 65, 57, 53, 65, 65, 57, 53, 66, 64,
+ 56, 53, 66, 64, 55, 51, 66, 64, 55, 51, 65, 62, 54, 51, 61, 59, 51, 48,
+ 59, 57, 51, 48, 59, 57, 51, 48, 56, 53, 48, 45, 54, 51, 46, 44, 54, 51,
+ 46, 44, 52, 50, 45, 43, 49, 48, 45, 43,
+ /* Size 16x4 */
+ 65, 65, 65, 65, 66, 66, 66, 65, 61, 59, 59, 56, 54, 54, 52, 49, 66, 65,
+ 65, 65, 64, 64, 64, 62, 59, 57, 57, 53, 51, 51, 50, 48, 59, 58, 57, 57,
+ 56, 55, 55, 54, 51, 51, 51, 48, 46, 46, 45, 45, 55, 54, 53, 53, 53, 51,
+ 51, 51, 48, 48, 48, 45, 44, 44, 43, 43,
+ /* Size 8x32 */
+ 64, 66, 66, 66, 62, 55, 55, 53, 65, 65, 66, 66, 61, 55, 55, 53, 65, 65,
+ 65, 65, 61, 54, 54, 52, 65, 65, 65, 65, 60, 53, 53, 51, 65, 65, 65, 65,
+ 60, 53, 53, 51, 65, 65, 65, 65, 60, 53, 53, 51, 65, 65, 65, 65, 60, 53,
+ 53, 51, 66, 65, 65, 65, 60, 53, 53, 51, 66, 65, 64, 64, 59, 53, 53, 51,
+ 67, 65, 64, 64, 59, 52, 52, 51, 67, 65, 64, 64, 59, 51, 51, 50, 67, 65,
+ 64, 64, 59, 51, 51, 50, 67, 65, 64, 64, 59, 51, 51, 50, 67, 65, 64, 64,
+ 59, 51, 51, 50, 66, 64, 62, 62, 58, 51, 51, 49, 64, 62, 60, 60, 56, 49,
+ 49, 48, 62, 60, 59, 59, 55, 48, 48, 48, 61, 59, 57, 57, 53, 48, 48, 47,
+ 61, 59, 57, 57, 53, 48, 48, 47, 61, 59, 57, 57, 53, 48, 48, 47, 61, 59,
+ 57, 57, 53, 48, 48, 47, 59, 57, 55, 55, 52, 46, 46, 46, 58, 55, 53, 53,
+ 50, 45, 45, 45, 56, 53, 52, 52, 48, 44, 44, 44, 55, 53, 51, 51, 48, 44,
+ 44, 43, 55, 53, 51, 51, 48, 44, 44, 43, 55, 53, 51, 51, 48, 44, 44, 43,
+ 55, 53, 51, 51, 48, 44, 44, 43, 53, 51, 50, 50, 47, 43, 43, 43, 51, 49,
+ 49, 49, 47, 43, 43, 43, 49, 48, 48, 48, 46, 43, 43, 43, 49, 48, 48, 48,
+ 46, 43, 43, 43,
+ /* Size 32x8 */
+ 64, 65, 65, 65, 65, 65, 65, 66, 66, 67, 67, 67, 67, 67, 66, 64, 62, 61,
+ 61, 61, 61, 59, 58, 56, 55, 55, 55, 55, 53, 51, 49, 49, 66, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 62, 60, 59, 59, 59, 59, 57,
+ 55, 53, 53, 53, 53, 53, 51, 49, 48, 48, 66, 66, 65, 65, 65, 65, 65, 65,
+ 64, 64, 64, 64, 64, 64, 62, 60, 59, 57, 57, 57, 57, 55, 53, 52, 51, 51,
+ 51, 51, 50, 49, 48, 48, 66, 66, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64,
+ 64, 64, 62, 60, 59, 57, 57, 57, 57, 55, 53, 52, 51, 51, 51, 51, 50, 49,
+ 48, 48, 62, 61, 61, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 58, 56,
+ 55, 53, 53, 53, 53, 52, 50, 48, 48, 48, 48, 48, 47, 47, 46, 46, 55, 55,
+ 54, 53, 53, 53, 53, 53, 53, 52, 51, 51, 51, 51, 51, 49, 48, 48, 48, 48,
+ 48, 46, 45, 44, 44, 44, 44, 44, 43, 43, 43, 43, 55, 55, 54, 53, 53, 53,
+ 53, 53, 53, 52, 51, 51, 51, 51, 51, 49, 48, 48, 48, 48, 48, 46, 45, 44,
+ 44, 44, 44, 44, 43, 43, 43, 43, 53, 53, 52, 51, 51, 51, 51, 51, 51, 51,
+ 50, 50, 50, 50, 49, 48, 48, 47, 47, 47, 47, 46, 45, 44, 43, 43, 43, 43,
+ 43, 43, 43, 43 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 64, 64, 64, 62,
+#endif
+ /* Size 4x4 */
+ 65, 65, 65, 64, 65, 64, 64, 63, 65, 64, 63, 63, 64, 63, 63, 61,
+ /* Size 8x8 */
+ 65, 65, 65, 65, 65, 65, 64, 64, 65, 64, 64, 64, 64, 64, 64, 64, 65, 64,
+ 64, 64, 64, 64, 64, 64, 65, 64, 64, 64, 64, 64, 63, 63, 65, 64, 64, 64,
+ 63, 63, 63, 63, 65, 64, 64, 64, 63, 63, 63, 63, 64, 64, 64, 63, 63, 63,
+ 61, 61, 64, 64, 64, 63, 63, 63, 61, 61,
+ /* Size 16x16 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 65, 65, 65, 65,
+ 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 63, 63, 63, 63, 65, 65, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63,
+ 63, 63, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 65, 65,
+ 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 65, 65, 64, 64,
+ 64, 64, 64, 63, 63, 63, 63, 63, 62, 62, 62, 62, 65, 64, 64, 64, 64, 64,
+ 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 65, 64, 64, 64, 64, 64, 63, 63,
+ 63, 63, 63, 62, 62, 61, 61, 61, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63,
+ 63, 62, 62, 61, 61, 61, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 62,
+ 62, 61, 61, 61,
+ /* Size 32x32 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
+ 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65,
+ 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63,
+ 63, 63, 63, 63, 63, 63, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63,
- 63, 63, 65, 65, 66, 66, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64,
+ 63, 63, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 65, 65,
- 65, 66, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63,
- 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 65, 65, 65, 66, 66, 66,
- 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63,
- 63, 63, 63, 63, 63, 63, 63, 63, 65, 65, 65, 66, 66, 66, 65, 65, 65, 65,
- 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
- 63, 63, 63, 63, 65, 65, 65, 65, 66, 65, 65, 65, 65, 64, 64, 64, 64, 64,
- 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
- 65, 65, 65, 65, 66, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 63, 63, 63,
- 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 65, 65, 65,
- 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63,
- 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 64, 64, 65, 65, 65, 65, 65, 65,
+ 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 65, 65, 65, 65, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 65, 65, 65, 65,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 65, 65, 65, 65, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
- 63, 62, 62, 62, 62, 62, 64, 64, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64,
- 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62,
- 62, 62, 64, 64, 64, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 63, 63, 63,
- 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 64, 64,
- 64, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63,
- 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 64, 64, 64, 64, 65, 64,
+ 63, 63, 63, 63, 63, 63, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 62, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 65, 65,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 65, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62,
- 62, 62, 62, 62, 62, 62, 62, 62, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62,
- 62, 62, 62, 62, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63,
- 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
- 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63,
- 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 64, 64,
- 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62,
- 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 64, 64, 64, 64, 64, 64,
- 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62,
- 62, 62, 62, 62, 62, 62, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63,
- 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
- 62, 62, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63,
- 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62 } } },
- { { /* Luma matrices */
- { /* Inter matrices */
- /* Size 4 */
+ 62, 62, 62, 62, 62, 62, 62, 61, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 61, 61, 61,
+ 61, 61, 61, 61, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61,
+ 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 65, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 65, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 61,
+ 61, 61, 61, 61, 61, 61, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 61, 61, 61, 61, 61,
+ 61, 61, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 61,
+ /* Size 4x8 */
+ 65, 65, 65, 64, 65, 64, 64, 63, 65, 64, 64, 63, 65, 64, 64, 63, 65, 63,
+ 63, 63, 65, 63, 63, 62, 64, 63, 63, 61, 64, 63, 63, 61,
+ /* Size 8x4 */
+ 65, 65, 65, 65, 65, 65, 64, 64, 65, 64, 64, 64, 63, 63, 63, 63, 65, 64,
+ 64, 64, 63, 63, 63, 63, 64, 63, 63, 63, 63, 62, 61, 61,
+ /* Size 8x16 */
+ 64, 65, 65, 65, 65, 65, 65, 64, 65, 65, 65, 65, 65, 65, 64, 64, 65, 65,
+ 64, 64, 64, 64, 64, 63, 65, 64, 64, 64, 64, 64, 64, 63, 65, 64, 64, 64,
+ 64, 64, 64, 63, 65, 64, 64, 64, 64, 64, 64, 63, 65, 64, 64, 64, 64, 64,
+ 63, 63, 65, 64, 64, 63, 63, 63, 63, 63, 65, 64, 64, 63, 63, 63, 63, 63,
+ 65, 64, 64, 63, 63, 63, 63, 63, 65, 64, 64, 63, 63, 63, 63, 63, 65, 64,
+ 63, 63, 63, 63, 62, 62, 65, 64, 63, 63, 63, 63, 62, 61, 64, 64, 63, 63,
+ 63, 63, 62, 60, 64, 64, 63, 63, 63, 63, 62, 60, 64, 64, 63, 63, 63, 63,
+ 62, 60,
+ /* Size 16x8 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 65, 65,
+ 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 65, 65, 64, 64, 64, 64,
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 65, 65, 64, 64, 64, 64, 64, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 62,
+ 62, 62, 62, 62, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 61, 60,
+ 60, 60,
+ /* Size 16x32 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 65, 65, 65, 65, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 65, 65, 65, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 63, 63, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 63, 63, 63, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 63, 63, 63, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63,
+ 63, 63, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63,
+ 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 65, 65,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 65, 65, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 65, 65, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 65, 65, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 63, 63, 63, 63, 63, 65, 65, 64, 64, 64, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 65, 65, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 62, 65, 65, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 62, 65, 65, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62,
+ 65, 65, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 65, 65,
+ 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 65, 65, 64, 64,
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 65, 65, 64, 64, 64, 63,
+ 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 65, 64, 64, 64, 63, 63, 63, 63,
+ 63, 63, 63, 63, 62, 62, 62, 61, 65, 64, 64, 64, 63, 63, 63, 63, 63, 63,
+ 63, 63, 62, 62, 61, 61, 65, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 62,
+ 62, 61, 61, 60, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 61,
+ 60, 60, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 61, 60, 60,
+ 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 61, 60, 60, 64, 64,
+ 64, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 61, 60, 60, 64, 64, 64, 63,
+ 63, 63, 63, 63, 63, 63, 63, 62, 62, 61, 60, 60, 64, 64, 64, 63, 63, 63,
+ 63, 63, 63, 63, 63, 62, 62, 61, 60, 60, 64, 64, 64, 63, 63, 63, 63, 63,
+ 63, 63, 63, 62, 61, 61, 60, 59,
+ /* Size 32x16 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63,
+ 63, 63, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 65, 65,
+ 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 65, 65, 65, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 65, 65, 65, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 65, 65, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62,
+ 62, 62, 62, 62, 62, 62, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62,
+ 62, 61, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 61, 64, 64,
+ 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 62, 62, 61, 61, 60, 60, 60, 60, 60, 60, 60, 64, 64, 64, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 61, 61,
+ 60, 60, 60, 60, 60, 60, 60, 59,
+ /* Size 4x16 */
+ 65, 65, 65, 64, 65, 65, 65, 64, 65, 64, 64, 64, 65, 64, 64, 63, 65, 64,
+ 64, 63, 65, 64, 64, 63, 65, 64, 64, 63, 65, 63, 63, 63, 65, 63, 63, 63,
+ 65, 63, 63, 63, 65, 63, 63, 63, 64, 63, 63, 62, 64, 63, 63, 61, 64, 63,
+ 63, 61, 64, 63, 63, 61, 64, 63, 63, 61,
+ /* Size 16x4 */
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 65, 65,
+ 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 65, 65, 64, 64,
+ 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 63, 63, 63,
+ 63, 63, 63, 63, 63, 62, 61, 61, 61, 61,
+ /* Size 8x32 */
+ 64, 65, 65, 65, 65, 65, 65, 64, 65, 65, 65, 65, 65, 65, 64, 64, 65, 65,
+ 65, 65, 65, 65, 64, 64, 65, 65, 64, 64, 64, 64, 64, 64, 65, 65, 64, 64,
+ 64, 64, 64, 63, 65, 64, 64, 64, 64, 64, 64, 63, 65, 64, 64, 64, 64, 64,
+ 64, 63, 65, 64, 64, 64, 64, 64, 64, 63, 65, 64, 64, 64, 64, 64, 64, 63,
+ 65, 64, 64, 64, 64, 64, 64, 63, 65, 64, 64, 64, 64, 64, 64, 63, 65, 64,
+ 64, 64, 64, 64, 64, 63, 65, 64, 64, 64, 64, 64, 63, 63, 65, 64, 64, 64,
+ 64, 64, 63, 63, 65, 64, 64, 63, 63, 63, 63, 63, 65, 64, 64, 63, 63, 63,
+ 63, 63, 65, 64, 64, 63, 63, 63, 63, 63, 65, 64, 64, 63, 63, 63, 63, 63,
+ 65, 64, 64, 63, 63, 63, 63, 63, 65, 64, 64, 63, 63, 63, 63, 63, 65, 64,
+ 64, 63, 63, 63, 63, 63, 65, 64, 64, 63, 63, 63, 63, 62, 65, 64, 63, 63,
+ 63, 63, 62, 62, 65, 64, 63, 63, 63, 63, 62, 61, 65, 64, 63, 63, 63, 63,
+ 62, 61, 64, 64, 63, 63, 63, 63, 62, 60, 64, 64, 63, 63, 63, 63, 62, 60,
+ 64, 64, 63, 63, 63, 63, 62, 60, 64, 64, 63, 63, 63, 63, 62, 60, 64, 64,
+ 63, 63, 63, 63, 62, 60, 64, 64, 63, 63, 63, 63, 62, 60, 64, 64, 63, 63,
+ 63, 63, 61, 60,
+ /* Size 32x8 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65,
+ 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 65, 65,
+ 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 65, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62,
+ 62, 62, 62, 62, 62, 62, 62, 61, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 61, 61, 60, 60, 60,
+ 60, 60, 60, 60 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 65, 62, 62, 57,
+#endif
+ /* Size 4x4 */
+ 65, 66, 66, 60, 66, 65, 65, 59, 66, 65, 64, 58, 60, 59, 58, 53,
+ /* Size 8x8 */
+ 65, 66, 66, 66, 67, 66, 61, 61, 66, 65, 65, 65, 66, 64, 59, 59, 66, 65,
+ 65, 65, 66, 64, 59, 59, 66, 65, 65, 65, 65, 64, 59, 59, 67, 66, 66, 65,
+ 64, 63, 58, 58, 66, 64, 64, 64, 63, 62, 57, 57, 61, 59, 59, 59, 58, 57,
+ 53, 53, 61, 59, 59, 59, 58, 57, 53, 53,
+ /* Size 16x16 */
+ 64, 65, 65, 66, 66, 66, 66, 67, 67, 67, 67, 65, 62, 61, 61, 61, 65, 65,
+ 65, 65, 65, 65, 66, 66, 67, 67, 67, 64, 62, 60, 60, 60, 65, 65, 65, 65,
+ 65, 65, 66, 66, 66, 66, 66, 63, 61, 59, 59, 59, 66, 65, 65, 65, 65, 65,
+ 65, 65, 66, 66, 66, 63, 60, 59, 59, 59, 66, 65, 65, 65, 65, 65, 65, 65,
+ 66, 66, 66, 63, 60, 59, 59, 59, 66, 65, 65, 65, 65, 65, 65, 65, 66, 66,
+ 66, 63, 60, 59, 59, 59, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 62,
+ 60, 59, 59, 59, 67, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 62, 59, 58,
+ 58, 58, 67, 67, 66, 66, 66, 66, 65, 65, 64, 64, 64, 62, 59, 58, 58, 58,
+ 67, 67, 66, 66, 66, 66, 65, 65, 64, 64, 64, 62, 59, 58, 58, 58, 67, 67,
+ 66, 66, 66, 66, 65, 65, 64, 64, 64, 62, 59, 58, 58, 58, 65, 64, 63, 63,
+ 63, 63, 62, 62, 62, 62, 62, 59, 57, 55, 55, 55, 62, 62, 61, 60, 60, 60,
+ 60, 59, 59, 59, 59, 57, 55, 53, 53, 53, 61, 60, 59, 59, 59, 59, 59, 58,
+ 58, 58, 58, 55, 53, 53, 53, 53, 61, 60, 59, 59, 59, 59, 59, 58, 58, 58,
+ 58, 55, 53, 53, 53, 53, 61, 60, 59, 59, 59, 59, 59, 58, 58, 58, 58, 55,
+ 53, 53, 53, 53,
+ /* Size 32x32 */
+ 64, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67,
+ 67, 67, 67, 66, 65, 64, 62, 61, 61, 61, 61, 61, 61, 60, 65, 65, 65, 65,
+ 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 66,
+ 65, 63, 62, 61, 61, 61, 61, 61, 61, 59, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 65, 64, 63, 62, 60,
+ 60, 60, 60, 60, 60, 59, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 64, 62, 61, 60, 60, 60, 60, 60,
+ 60, 59, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 65, 63, 62, 61, 59, 59, 59, 59, 59, 59, 59, 66, 66,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66,
+ 66, 64, 63, 62, 60, 59, 59, 59, 59, 59, 59, 58, 66, 66, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 64, 63, 62,
+ 60, 59, 59, 59, 59, 59, 59, 58, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 64, 63, 62, 60, 59, 59, 59,
+ 59, 59, 59, 58, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 66, 66, 66, 66, 66, 66, 64, 63, 62, 60, 59, 59, 59, 59, 59, 59, 58,
+ 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66,
+ 66, 66, 66, 64, 63, 62, 60, 59, 59, 59, 59, 59, 59, 58, 66, 66, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 64,
+ 63, 62, 60, 59, 59, 59, 59, 59, 59, 58, 66, 66, 66, 66, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 63, 61, 60, 59,
+ 59, 59, 59, 59, 59, 58, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 62, 61, 60, 59, 59, 59, 59, 59,
+ 59, 58, 67, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 64, 62, 61, 59, 59, 59, 59, 59, 59, 59, 57, 67, 67,
+ 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 63, 62, 60, 59, 58, 58, 58, 58, 58, 58, 57, 67, 67, 67, 66, 66, 66,
+ 66, 66, 66, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 63, 62, 60,
+ 59, 58, 58, 58, 58, 58, 58, 56, 67, 67, 67, 66, 66, 66, 66, 66, 66, 66,
+ 66, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 63, 62, 60, 59, 58, 58, 58,
+ 58, 58, 58, 56, 67, 67, 67, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65,
+ 65, 64, 64, 64, 64, 64, 64, 63, 62, 60, 59, 58, 58, 58, 58, 58, 58, 56,
+ 67, 67, 67, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 64, 64, 64,
+ 64, 64, 64, 63, 62, 60, 59, 58, 58, 58, 58, 58, 58, 56, 67, 67, 67, 66,
+ 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 63,
+ 62, 60, 59, 58, 58, 58, 58, 58, 58, 56, 67, 67, 67, 66, 66, 66, 66, 66,
+ 66, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 63, 62, 60, 59, 58,
+ 58, 58, 58, 58, 58, 56, 66, 66, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 63, 63, 63, 63, 63, 63, 63, 62, 60, 59, 58, 57, 57, 57, 57, 57,
+ 57, 55, 65, 65, 64, 64, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62,
+ 62, 62, 62, 62, 62, 60, 59, 58, 57, 55, 55, 55, 55, 55, 55, 55, 64, 63,
+ 63, 62, 62, 62, 62, 62, 62, 62, 62, 61, 61, 61, 60, 60, 60, 60, 60, 60,
+ 60, 59, 58, 57, 55, 55, 55, 55, 55, 55, 55, 53, 62, 62, 62, 61, 61, 60,
+ 60, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 58, 57, 55,
+ 55, 53, 53, 53, 53, 53, 53, 53, 61, 61, 60, 60, 59, 59, 59, 59, 59, 59,
+ 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 57, 55, 55, 53, 53, 53, 53,
+ 53, 53, 53, 51, 61, 61, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
+ 58, 58, 58, 58, 58, 58, 58, 57, 55, 55, 53, 53, 53, 53, 53, 53, 53, 51,
+ 61, 61, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58,
+ 58, 58, 58, 57, 55, 55, 53, 53, 53, 53, 53, 53, 53, 51, 61, 61, 60, 60,
+ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 57,
+ 55, 55, 53, 53, 53, 53, 53, 53, 53, 51, 61, 61, 60, 60, 59, 59, 59, 59,
+ 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 57, 55, 55, 53, 53,
+ 53, 53, 53, 53, 53, 51, 61, 61, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59,
+ 59, 59, 58, 58, 58, 58, 58, 58, 58, 57, 55, 55, 53, 53, 53, 53, 53, 53,
+ 53, 51, 60, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 58, 57, 57, 56,
+ 56, 56, 56, 56, 56, 55, 55, 53, 53, 51, 51, 51, 51, 51, 51, 51,
+ /* Size 4x8 */
+ 65, 66, 66, 59, 65, 65, 65, 58, 65, 65, 65, 58, 66, 64, 64, 57, 66, 64,
+ 64, 56, 65, 62, 62, 55, 60, 57, 57, 51, 60, 57, 57, 51,
+ /* Size 8x4 */
+ 65, 65, 65, 66, 66, 65, 60, 60, 66, 65, 65, 64, 64, 62, 57, 57, 66, 65,
+ 65, 64, 64, 62, 57, 57, 59, 58, 58, 57, 56, 55, 51, 51,
+ /* Size 8x16 */
+ 64, 65, 66, 66, 66, 66, 62, 58, 65, 65, 66, 66, 66, 66, 61, 57, 65, 65,
+ 65, 65, 65, 65, 60, 56, 65, 65, 65, 65, 65, 65, 60, 55, 65, 65, 65, 65,
+ 65, 65, 60, 55, 65, 65, 65, 65, 65, 65, 60, 55, 66, 65, 65, 64, 64, 64,
+ 59, 55, 67, 66, 65, 64, 64, 64, 59, 54, 67, 66, 64, 64, 64, 64, 59, 54,
+ 67, 66, 64, 64, 64, 64, 59, 54, 67, 66, 64, 64, 64, 64, 59, 54, 65, 63,
+ 62, 61, 61, 61, 57, 52, 62, 60, 59, 59, 59, 59, 55, 51, 61, 59, 58, 57,
+ 57, 57, 53, 49, 61, 59, 58, 57, 57, 57, 53, 49, 61, 59, 58, 57, 57, 57,
+ 53, 49,
+ /* Size 16x8 */
+ 64, 65, 65, 65, 65, 65, 66, 67, 67, 67, 67, 65, 62, 61, 61, 61, 65, 65,
+ 65, 65, 65, 65, 65, 66, 66, 66, 66, 63, 60, 59, 59, 59, 66, 66, 65, 65,
+ 65, 65, 65, 65, 64, 64, 64, 62, 59, 58, 58, 58, 66, 66, 65, 65, 65, 65,
+ 64, 64, 64, 64, 64, 61, 59, 57, 57, 57, 66, 66, 65, 65, 65, 65, 64, 64,
+ 64, 64, 64, 61, 59, 57, 57, 57, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64,
+ 64, 61, 59, 57, 57, 57, 62, 61, 60, 60, 60, 60, 59, 59, 59, 59, 59, 57,
+ 55, 53, 53, 53, 58, 57, 56, 55, 55, 55, 55, 54, 54, 54, 54, 52, 51, 49,
+ 49, 49,
+ /* Size 16x32 */
+ 64, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 64, 62, 60, 58, 55, 65, 65,
+ 65, 66, 66, 66, 66, 66, 66, 66, 66, 64, 62, 59, 58, 55, 65, 65, 65, 65,
+ 66, 66, 66, 66, 66, 66, 66, 64, 61, 59, 57, 55, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 63, 61, 59, 56, 54, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 63, 60, 59, 56, 54, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 62, 60, 58, 55, 53, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 62,
+ 60, 58, 55, 53, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 62, 60, 58,
+ 55, 53, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 62, 60, 58, 55, 53,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 62, 60, 58, 55, 53, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 62, 60, 58, 55, 53, 66, 66, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 62, 60, 58, 55, 53, 66, 66, 65, 65, 65, 64,
+ 64, 64, 64, 64, 64, 62, 59, 57, 55, 53, 66, 66, 66, 65, 65, 64, 64, 64,
+ 64, 64, 64, 62, 59, 57, 55, 52, 67, 66, 66, 65, 65, 64, 64, 64, 64, 64,
+ 64, 61, 59, 57, 54, 52, 67, 66, 66, 65, 64, 64, 64, 64, 64, 64, 64, 61,
+ 59, 56, 54, 51, 67, 66, 66, 65, 64, 64, 64, 64, 64, 64, 64, 61, 59, 56,
+ 54, 51, 67, 66, 66, 65, 64, 64, 64, 64, 64, 64, 64, 61, 59, 56, 54, 51,
+ 67, 66, 66, 65, 64, 64, 64, 64, 64, 64, 64, 61, 59, 56, 54, 51, 67, 66,
+ 66, 65, 64, 64, 64, 64, 64, 64, 64, 61, 59, 56, 54, 51, 67, 66, 66, 65,
+ 64, 64, 64, 64, 64, 64, 64, 61, 59, 56, 54, 51, 66, 65, 65, 64, 63, 62,
+ 62, 62, 62, 62, 62, 60, 58, 55, 53, 51, 65, 64, 63, 62, 62, 61, 61, 61,
+ 61, 61, 61, 59, 57, 55, 52, 50, 63, 63, 62, 61, 60, 60, 60, 60, 60, 60,
+ 60, 58, 55, 53, 51, 49, 62, 61, 60, 60, 59, 59, 59, 59, 59, 59, 59, 56,
+ 55, 53, 51, 48, 61, 60, 59, 59, 58, 57, 57, 57, 57, 57, 57, 55, 53, 51,
+ 49, 48, 61, 60, 59, 59, 58, 57, 57, 57, 57, 57, 57, 55, 53, 51, 49, 48,
+ 61, 60, 59, 59, 58, 57, 57, 57, 57, 57, 57, 55, 53, 51, 49, 48, 61, 60,
+ 59, 59, 58, 57, 57, 57, 57, 57, 57, 55, 53, 51, 49, 48, 61, 60, 59, 59,
+ 58, 57, 57, 57, 57, 57, 57, 55, 53, 51, 49, 48, 61, 60, 59, 59, 58, 57,
+ 57, 57, 57, 57, 57, 55, 53, 51, 49, 48, 59, 59, 59, 58, 57, 56, 56, 56,
+ 56, 56, 56, 54, 53, 51, 49, 47,
+ /* Size 32x16 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 67, 67, 67, 67,
+ 67, 67, 67, 66, 65, 63, 62, 61, 61, 61, 61, 61, 61, 59, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 65,
+ 64, 63, 61, 60, 60, 60, 60, 60, 60, 59, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 65, 63, 62, 60, 59,
+ 59, 59, 59, 59, 59, 59, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 62, 61, 60, 59, 59, 59, 59, 59,
+ 59, 58, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64,
+ 64, 64, 64, 64, 64, 63, 62, 60, 59, 58, 58, 58, 58, 58, 58, 57, 66, 66,
+ 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 62, 61, 60, 59, 57, 57, 57, 57, 57, 57, 56, 66, 66, 66, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 61, 60,
+ 59, 57, 57, 57, 57, 57, 57, 56, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 61, 60, 59, 57, 57, 57,
+ 57, 57, 57, 56, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 62, 61, 60, 59, 57, 57, 57, 57, 57, 57, 56,
+ 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 62, 61, 60, 59, 57, 57, 57, 57, 57, 57, 56, 66, 66, 66, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62,
+ 61, 60, 59, 57, 57, 57, 57, 57, 57, 56, 64, 64, 64, 63, 63, 62, 62, 62,
+ 62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 60, 59, 58, 56, 55,
+ 55, 55, 55, 55, 55, 54, 62, 62, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60,
+ 59, 59, 59, 59, 59, 59, 59, 59, 59, 58, 57, 55, 55, 53, 53, 53, 53, 53,
+ 53, 53, 60, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 57, 57, 57, 56,
+ 56, 56, 56, 56, 56, 55, 55, 53, 53, 51, 51, 51, 51, 51, 51, 51, 58, 58,
+ 57, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54,
+ 54, 53, 52, 51, 51, 49, 49, 49, 49, 49, 49, 49, 55, 55, 55, 54, 54, 53,
+ 53, 53, 53, 53, 53, 53, 53, 52, 52, 51, 51, 51, 51, 51, 51, 51, 50, 49,
+ 48, 48, 48, 48, 48, 48, 48, 47,
+ /* Size 4x16 */
+ 65, 66, 66, 60, 65, 66, 66, 59, 65, 65, 65, 59, 65, 65, 65, 58, 65, 65,
+ 65, 58, 65, 65, 65, 58, 66, 64, 64, 57, 66, 64, 64, 57, 66, 64, 64, 56,
+ 66, 64, 64, 56, 66, 64, 64, 56, 64, 61, 61, 55, 61, 59, 59, 53, 60, 57,
+ 57, 51, 60, 57, 57, 51, 60, 57, 57, 51,
+ /* Size 16x4 */
+ 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 64, 61, 60, 60, 60, 66, 66,
+ 65, 65, 65, 65, 64, 64, 64, 64, 64, 61, 59, 57, 57, 57, 66, 66, 65, 65,
+ 65, 65, 64, 64, 64, 64, 64, 61, 59, 57, 57, 57, 60, 59, 59, 58, 58, 58,
+ 57, 57, 56, 56, 56, 55, 53, 51, 51, 51,
+ /* Size 8x32 */
+ 64, 65, 66, 66, 66, 66, 62, 58, 65, 65, 66, 66, 66, 66, 62, 58, 65, 65,
+ 66, 66, 66, 66, 61, 57, 65, 65, 65, 65, 65, 65, 61, 56, 65, 65, 65, 65,
+ 65, 65, 60, 56, 65, 65, 65, 65, 65, 65, 60, 55, 65, 65, 65, 65, 65, 65,
+ 60, 55, 65, 65, 65, 65, 65, 65, 60, 55, 65, 65, 65, 65, 65, 65, 60, 55,
+ 65, 65, 65, 65, 65, 65, 60, 55, 65, 65, 65, 65, 65, 65, 60, 55, 66, 65,
+ 65, 65, 65, 65, 60, 55, 66, 65, 65, 64, 64, 64, 59, 55, 66, 66, 65, 64,
+ 64, 64, 59, 55, 67, 66, 65, 64, 64, 64, 59, 54, 67, 66, 64, 64, 64, 64,
+ 59, 54, 67, 66, 64, 64, 64, 64, 59, 54, 67, 66, 64, 64, 64, 64, 59, 54,
+ 67, 66, 64, 64, 64, 64, 59, 54, 67, 66, 64, 64, 64, 64, 59, 54, 67, 66,
+ 64, 64, 64, 64, 59, 54, 66, 65, 63, 62, 62, 62, 58, 53, 65, 63, 62, 61,
+ 61, 61, 57, 52, 63, 62, 60, 60, 60, 60, 55, 51, 62, 60, 59, 59, 59, 59,
+ 55, 51, 61, 59, 58, 57, 57, 57, 53, 49, 61, 59, 58, 57, 57, 57, 53, 49,
+ 61, 59, 58, 57, 57, 57, 53, 49, 61, 59, 58, 57, 57, 57, 53, 49, 61, 59,
+ 58, 57, 57, 57, 53, 49, 61, 59, 58, 57, 57, 57, 53, 49, 59, 59, 57, 56,
+ 56, 56, 53, 49,
+ /* Size 32x8 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 67, 67, 67, 67,
+ 67, 67, 67, 66, 65, 63, 62, 61, 61, 61, 61, 61, 61, 59, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 65,
+ 63, 62, 60, 59, 59, 59, 59, 59, 59, 59, 66, 66, 66, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 63, 62, 60, 59, 58,
+ 58, 58, 58, 58, 58, 57, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 61, 60, 59, 57, 57, 57, 57, 57,
+ 57, 56, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 62, 61, 60, 59, 57, 57, 57, 57, 57, 57, 56, 66, 66,
+ 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 62, 61, 60, 59, 57, 57, 57, 57, 57, 57, 56, 62, 62, 61, 61, 60, 60,
+ 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 59, 59, 58, 57, 55,
+ 55, 53, 53, 53, 53, 53, 53, 53, 58, 58, 57, 56, 56, 55, 55, 55, 55, 55,
+ 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 53, 52, 51, 51, 49, 49, 49,
+ 49, 49, 49, 49 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 65, 65, 65, 64,
+#endif
+ /* Size 4x4 */
+ 65, 65, 65, 65, 65, 64, 64, 64, 65, 64, 64, 64, 65, 64, 64, 64,
+ /* Size 8x8 */
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 64, 64, 64, 64, 64, 65, 65, 64, 64, 64, 64, 64, 64, 65, 65, 64, 64,
+ 64, 64, 64, 64, 65, 65, 64, 64, 64, 64, 64, 64, 65, 65, 64, 64, 64, 64,
+ 64, 64, 65, 65, 64, 64, 64, 64, 64, 63,
+ /* Size 16x16 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
+ 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 63, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 63, 63,
+ /* Size 32x32 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64,
+ 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
+ 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
+ 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65,
+ 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 65, 65, 65, 65, 65, 65, 65, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 63, 63, 63, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63,
+ 63, 63, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63,
+ /* Size 4x8 */
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 65, 64, 64, 64, 65, 64,
+ 64, 64, 65, 64, 64, 64, 65, 64, 64, 64, 65, 64, 64, 63,
+ /* Size 8x4 */
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 65, 65,
+ 64, 64, 64, 64, 64, 64, 65, 65, 64, 64, 64, 64, 64, 63,
+ /* Size 8x16 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 65, 65, 65, 64,
+ 64, 64, 64, 64, 65, 65, 64, 64, 64, 64, 64, 64, 65, 65, 64, 64, 64, 64,
+ 64, 64, 65, 65, 64, 64, 64, 64, 64, 64, 65, 65, 64, 64, 64, 64, 64, 64,
+ 65, 65, 64, 64, 64, 64, 64, 64, 65, 65, 64, 64, 64, 64, 64, 64, 65, 65,
+ 64, 64, 64, 64, 64, 64, 65, 65, 64, 64, 64, 64, 64, 64, 65, 65, 64, 64,
+ 64, 64, 64, 64, 65, 65, 64, 64, 64, 63, 63, 63, 65, 65, 64, 64, 64, 63,
+ 63, 63,
+ /* Size 16x8 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 63, 63, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 63, 63, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 63, 63,
+ /* Size 16x32 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64,
+ 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
+ 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
+ 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
+ 65, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 65, 65, 65, 64,
+ 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 63, 65, 65, 65, 64, 64, 64,
+ 64, 64, 64, 63, 63, 63, 63, 63, 63, 63, 65, 65, 65, 64, 64, 64, 64, 64,
+ 64, 63, 63, 63, 63, 63, 63, 63,
+ /* Size 32x16 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64,
+ 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
+ 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
+ 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 65, 65, 65, 65,
+ 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 65, 65, 65, 65, 65, 65, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 63, 63, 63, 63, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63,
+ 63, 63, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 65, 65,
+ 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 65, 65, 65, 65, 65, 65,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 63, 63, 63, 63,
+ /* Size 4x16 */
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 65, 64,
+ 64, 64, 65, 64, 64, 64, 65, 64, 64, 64, 65, 64, 64, 64, 65, 64, 64, 64,
+ 65, 64, 64, 64, 65, 64, 64, 64, 65, 64, 64, 64, 65, 64, 64, 64, 65, 64,
+ 64, 64, 65, 64, 64, 63, 65, 64, 63, 63,
+ /* Size 16x4 */
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 65, 65, 65, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 63, 63,
+ /* Size 8x32 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64,
+ 64, 64, 65, 65, 65, 64, 64, 64, 64, 64, 65, 65, 65, 64, 64, 64, 64, 64,
+ 65, 65, 64, 64, 64, 64, 64, 64, 65, 65, 64, 64, 64, 64, 64, 64, 65, 65,
+ 64, 64, 64, 64, 64, 64, 65, 65, 64, 64, 64, 64, 64, 64, 65, 65, 64, 64,
+ 64, 64, 64, 64, 65, 65, 64, 64, 64, 64, 64, 64, 65, 65, 64, 64, 64, 64,
+ 64, 64, 65, 65, 64, 64, 64, 64, 64, 64, 65, 65, 64, 64, 64, 64, 64, 64,
+ 65, 65, 64, 64, 64, 64, 64, 64, 65, 65, 64, 64, 64, 64, 64, 64, 65, 65,
+ 64, 64, 64, 64, 64, 64, 65, 65, 64, 64, 64, 64, 64, 64, 65, 65, 64, 64,
+ 64, 64, 64, 64, 65, 65, 64, 64, 64, 64, 64, 64, 65, 65, 64, 64, 64, 64,
+ 64, 64, 65, 65, 64, 64, 64, 64, 64, 64, 65, 65, 64, 64, 64, 64, 64, 64,
+ 65, 65, 64, 64, 64, 64, 64, 64, 65, 65, 64, 64, 64, 63, 63, 63, 65, 65,
+ 64, 64, 64, 63, 63, 63, 65, 65, 64, 64, 64, 63, 63, 63, 65, 65, 64, 64,
+ 64, 63, 63, 63,
+ /* Size 32x8 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
+ 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 65, 65, 65, 65, 65, 65,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 63, 63, 63, 63, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 63, 63, 63, 63 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 65, 66, 66, 65,
+#endif
+ /* Size 4x4 */
+ 65, 66, 66, 66, 66, 65, 65, 65, 66, 65, 65, 65, 66, 65, 65, 65,
+ /* Size 8x8 */
+ 65, 65, 65, 66, 66, 66, 66, 67, 65, 65, 65, 65, 65, 66, 66, 66, 65, 65,
+ 65, 65, 65, 65, 66, 66, 66, 65, 65, 65, 65, 65, 65, 66, 66, 65, 65, 65,
+ 65, 65, 65, 66, 66, 66, 65, 65, 65, 65, 65, 65, 66, 66, 66, 65, 65, 65,
+ 65, 65, 67, 66, 66, 66, 66, 65, 65, 65,
+ /* Size 16x16 */
+ 64, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 67, 67, 67, 65, 65,
+ 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 67, 67, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 67, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66,
+ 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 67, 66, 66, 66, 66, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 67, 67, 66, 66, 66, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 67, 67, 67, 66, 66, 66, 66, 66, 66, 66, 66, 65,
+ 65, 65, 65, 64,
+ /* Size 32x32 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 67, 67,
+ 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 67, 67, 67, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66,
+ 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66,
+ 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66,
+ 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66,
+ 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 67, 67, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 67, 67, 67, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 67, 67, 67, 67,
+ 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 67, 67, 67, 67, 67, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 67, 67, 67, 67, 67, 66, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 64, 64, 67, 67, 67, 67, 67, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64,
+ /* Size 4x8 */
+ 65, 65, 66, 66, 65, 65, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 66, 65, 65, 65, 66, 65, 64, 64, 67, 65, 64, 64,
+ /* Size 8x4 */
+ 65, 65, 65, 65, 65, 66, 66, 67, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66,
+ 65, 65, 65, 65, 64, 64, 66, 66, 65, 65, 65, 65, 64, 64,
+ /* Size 8x16 */
+ 64, 65, 65, 66, 66, 66, 66, 66, 65, 65, 65, 66, 66, 66, 66, 66, 65, 65,
+ 65, 65, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66,
+ 65, 65, 65, 65, 65, 65, 66, 66, 65, 65, 65, 64, 64, 64, 66, 66, 66, 65,
+ 65, 64, 64, 64, 67, 66, 66, 65, 65, 64, 64, 64, 67, 66, 66, 65, 64, 64,
+ 64, 64,
+ /* Size 16x8 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 67, 67, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 64, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 64, 64, 64, 64, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 64, 64, 64, 64, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64,
+ 64, 64,
+ /* Size 16x32 */
+ 64, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65,
+ 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65,
+ 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65,
+ 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66,
+ 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65,
+ 64, 64, 64, 64, 64, 64, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 64, 64,
+ 64, 64, 64, 64, 66, 66, 66, 66, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64,
+ 64, 64, 66, 66, 66, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64,
+ 67, 66, 66, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 67, 66,
+ 66, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 67, 67, 66, 66,
+ 66, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 67, 67, 66, 66, 66, 65,
+ 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 67, 67, 66, 66, 66, 65, 65, 65,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 32x16 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66,
+ 66, 66, 66, 66, 66, 66, 66, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66,
+ 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64,
+ 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 66, 66, 66, 66,
+ 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 66, 66, 66, 66, 66, 66, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 66, 66,
+ 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 66, 66, 66, 66, 66, 66,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 4x16 */
+ 65, 65, 66, 66, 65, 65, 66, 66, 65, 65, 66, 66, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 66, 65, 65, 65, 66, 65, 65, 64, 66, 65,
+ 64, 64, 66, 65, 64, 64, 67, 65, 64, 64,
+ /* Size 16x4 */
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 67, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 66, 66, 66, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 64, 64, 64, 64,
+ /* Size 8x32 */
+ 64, 65, 65, 66, 66, 66, 66, 66, 65, 65, 65, 66, 66, 66, 66, 66, 65, 65,
+ 65, 66, 66, 66, 66, 66, 65, 65, 65, 65, 66, 66, 66, 66, 65, 65, 65, 65,
+ 66, 66, 66, 66, 65, 65, 65, 65, 65, 66, 66, 66, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 66, 65, 65, 65, 65, 65, 65, 65, 66, 66, 65, 65,
+ 65, 65, 65, 65, 66, 66, 65, 65, 65, 64, 64, 64, 66, 66, 65, 65, 65, 64,
+ 64, 64, 66, 66, 65, 65, 65, 64, 64, 64, 66, 66, 66, 65, 65, 64, 64, 64,
+ 67, 66, 66, 65, 65, 64, 64, 64, 67, 66, 66, 65, 65, 64, 64, 64, 67, 66,
+ 66, 65, 64, 64, 64, 64, 67, 66, 66, 65, 64, 64, 64, 64, 67, 66, 66, 65,
+ 64, 64, 64, 64,
+ /* Size 32x8 */
+ 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 66, 66,
+ 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 66, 66, 66, 66, 66, 66,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64 },
+ },
+ {
+ { /* Luma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 64, 64, 64, 64,
+#endif
+ /* Size 4x4 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- /* Size 8 */
+ /* Size 8x8 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- /* Size 16 */
+ /* Size 16x16 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -11000,7 +14314,7 @@ static uint16_t wt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64,
- /* Size 32 */
+ /* Size 32x32 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -11057,16 +14371,44 @@ static uint16_t wt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 },
- { /* Intra matrices */
- /* Size 4 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- /* Size 8 */
+ /* Size 4x8 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 8x4 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 8x16 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64,
+ /* Size 16x8 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64,
+ /* Size 16x32 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- /* Size 16 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -11081,10 +14423,10 @@ static uint16_t wt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64,
- /* Size 32 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 32x16 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -11113,9 +14455,20 @@ static uint16_t wt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 4x16 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 16x4 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 8x32 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -11128,6 +14481,11 @@ static uint16_t wt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64,
+ /* Size 32x8 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -11139,17 +14497,20 @@ static uint16_t wt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 } },
- { /* Chroma matrices */
- { /* Inter matrices */
- /* Size 4 */
+ 64, 64, 64, 64 },
+ { /* Chroma */
+#if CONFIG_CB4X4
+ /* Size 2x2 */
+ 64, 64, 64, 64,
+#endif
+ /* Size 4x4 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- /* Size 8 */
+ /* Size 8x8 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- /* Size 16 */
+ /* Size 16x16 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -11165,7 +14526,7 @@ static uint16_t wt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64,
- /* Size 32 */
+ /* Size 32x32 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -11222,22 +14583,23 @@ static uint16_t wt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 },
- { /* Intra matrices */
- /* Size 4 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- /* Size 8 */
+ /* Size 4x8 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 8x4 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 8x16 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- /* Size 16 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64,
+ /* Size 16x8 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -11245,9 +14607,15 @@ static uint16_t wt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64,
+ /* Size 16x32 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64,
- /* Size 32 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -11269,6 +14637,8 @@ static uint16_t wt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 32x16 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
@@ -11297,16 +14667,51 @@ static uint16_t wt_matrix_ref[NUM_QM_LEVELS][2][2][4 * 4 + 8 * 8 + 16 * 16 +
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 4x16 */
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 16x4 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ /* Size 8x32 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 } } }
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64,
+ /* Size 32x8 */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64 },
+ },
};
-
#endif
#if CONFIG_PVQ || CONFIG_DAALA_DIST
diff --git a/third_party/aom/av1/common/quant_common.h b/third_party/aom/av1/common/quant_common.h
index 3f442427d..f28ffe7ac 100644
--- a/third_party/aom/av1/common/quant_common.h
+++ b/third_party/aom/av1/common/quant_common.h
@@ -29,11 +29,11 @@ extern "C" {
// 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)
+/* Range of QMS is between first and last value, with offset applied to inter
+ * blocks*/
+#define DEFAULT_QM_FIRST 5
+#define DEFAULT_QM_LAST 9
+#define DEFAULT_QM_INTER_OFFSET 0
#endif
struct AV1Common;
@@ -54,9 +54,9 @@ static INLINE int aom_get_qmlevel(int qindex, int first, int last) {
}
void aom_qm_init(struct AV1Common *cm);
qm_val_t *aom_iqmatrix(struct AV1Common *cm, int qindex, int comp,
- int log2sizem2, int is_intra);
+ TX_SIZE tx_size, int is_intra);
qm_val_t *aom_qmatrix(struct AV1Common *cm, int qindex, int comp,
- int log2sizem2, int is_intra);
+ TX_SIZE tx_size, int is_intra);
#endif
#if CONFIG_NEW_QUANT
diff --git a/third_party/aom/av1/common/reconinter.c b/third_party/aom/av1/common/reconinter.c
index ed7065757..fa37a992f 100644
--- a/third_party/aom/av1/common/reconinter.c
+++ b/third_party/aom/av1/common/reconinter.c
@@ -371,12 +371,12 @@ void build_compound_seg_mask(uint8_t *mask, SEG_MASK_TYPE mask_type,
const uint8_t *src1, int src1_stride,
BLOCK_SIZE sb_type, int h, int w) {
switch (mask_type) {
- case DIFFWTD_42:
- diffwtd_mask(mask, 0, 42, src0, src0_stride, src1, src1_stride, sb_type,
+ case DIFFWTD_38:
+ diffwtd_mask(mask, 0, 38, src0, src0_stride, src1, src1_stride, sb_type,
h, w);
break;
- case DIFFWTD_42_INV:
- diffwtd_mask(mask, 1, 42, src0, src0_stride, src1, src1_stride, sb_type,
+ case DIFFWTD_38_INV:
+ diffwtd_mask(mask, 1, 38, src0, src0_stride, src1, src1_stride, sb_type,
h, w);
break;
default: assert(0);
@@ -407,12 +407,12 @@ void build_compound_seg_mask_highbd(uint8_t *mask, SEG_MASK_TYPE mask_type,
const uint8_t *src1, int src1_stride,
BLOCK_SIZE sb_type, int h, int w, int bd) {
switch (mask_type) {
- case DIFFWTD_42:
+ case DIFFWTD_38:
diffwtd_mask_highbd(mask, 0, 42, CONVERT_TO_SHORTPTR(src0), src0_stride,
CONVERT_TO_SHORTPTR(src1), src1_stride, sb_type, h, w,
bd);
break;
- case DIFFWTD_42_INV:
+ case DIFFWTD_38_INV:
diffwtd_mask_highbd(mask, 1, 42, CONVERT_TO_SHORTPTR(src0), src0_stride,
CONVERT_TO_SHORTPTR(src1), src1_stride, sb_type, h, w,
bd);
@@ -459,7 +459,7 @@ static void shift_copy(const uint8_t *src, uint8_t *dst, int shift, int width) {
}
}
#else
-static const double smoother_param[NSMOOTHERS] = { 2.83 };
+static const double smoother_param[NSMOOTHERS] = { 3.0 };
#endif // MASK_MASTER_SIZE == 64
static void init_wedge_master_masks() {
@@ -468,21 +468,22 @@ static void init_wedge_master_masks() {
const int h = MASK_MASTER_SIZE;
const int stride = MASK_MASTER_STRIDE;
for (s = 0; s < NSMOOTHERS; s++) {
+// Note: index [0] stores the masters, and [1] its complement.
#if MASK_MASTER_SIZE == 64
// Generate prototype by shifting the masters
int shift = h / 4;
for (i = 0; i < h; i += 2) {
shift_copy(wedge_master_oblique_even[s],
- &wedge_mask_obl[s][1][WEDGE_OBLIQUE63][i * stride], shift,
+ &wedge_mask_obl[s][0][WEDGE_OBLIQUE63][i * stride], shift,
MASK_MASTER_SIZE);
shift--;
shift_copy(wedge_master_oblique_odd[s],
- &wedge_mask_obl[s][1][WEDGE_OBLIQUE63][(i + 1) * stride],
+ &wedge_mask_obl[s][0][WEDGE_OBLIQUE63][(i + 1) * stride],
shift, MASK_MASTER_SIZE);
- memcpy(&wedge_mask_obl[s][1][WEDGE_VERTICAL][i * stride],
+ memcpy(&wedge_mask_obl[s][0][WEDGE_VERTICAL][i * stride],
wedge_master_vertical[s],
MASK_MASTER_SIZE * sizeof(wedge_master_vertical[s][0]));
- memcpy(&wedge_mask_obl[s][1][WEDGE_VERTICAL][(i + 1) * stride],
+ memcpy(&wedge_mask_obl[s][0][WEDGE_VERTICAL][(i + 1) * stride],
wedge_master_vertical[s],
MASK_MASTER_SIZE * sizeof(wedge_master_vertical[s][0]));
}
@@ -495,29 +496,29 @@ static void init_wedge_master_masks() {
int y = (2 * i + 1 - h);
double d = (a[0] * x + a[1] * y) / asqrt;
const int msk = (int)rint((1.0 + tanh(d / smoother_param[s])) * 32);
- wedge_mask_obl[s][1][WEDGE_OBLIQUE63][i * stride + j] = msk;
+ wedge_mask_obl[s][0][WEDGE_OBLIQUE63][i * stride + j] = msk;
const int mskx = (int)rint((1.0 + tanh(x / smoother_param[s])) * 32);
- wedge_mask_obl[s][1][WEDGE_VERTICAL][i * stride + j] = mskx;
+ wedge_mask_obl[s][0][WEDGE_VERTICAL][i * stride + j] = mskx;
}
}
#endif // MASK_MASTER_SIZE == 64
for (i = 0; i < h; ++i) {
for (j = 0; j < w; ++j) {
- const int msk = wedge_mask_obl[s][1][WEDGE_OBLIQUE63][i * stride + j];
- wedge_mask_obl[s][1][WEDGE_OBLIQUE27][j * stride + i] = msk;
- wedge_mask_obl[s][1][WEDGE_OBLIQUE117][i * stride + w - 1 - j] =
- wedge_mask_obl[s][1][WEDGE_OBLIQUE153][(w - 1 - j) * stride + i] =
- (1 << WEDGE_WEIGHT_BITS) - msk;
- wedge_mask_obl[s][0][WEDGE_OBLIQUE63][i * stride + j] =
- wedge_mask_obl[s][0][WEDGE_OBLIQUE27][j * stride + i] =
- (1 << WEDGE_WEIGHT_BITS) - msk;
+ const int msk = wedge_mask_obl[s][0][WEDGE_OBLIQUE63][i * stride + j];
+ wedge_mask_obl[s][0][WEDGE_OBLIQUE27][j * stride + i] = msk;
wedge_mask_obl[s][0][WEDGE_OBLIQUE117][i * stride + w - 1 - j] =
wedge_mask_obl[s][0][WEDGE_OBLIQUE153][(w - 1 - j) * stride + i] =
+ (1 << WEDGE_WEIGHT_BITS) - msk;
+ wedge_mask_obl[s][1][WEDGE_OBLIQUE63][i * stride + j] =
+ wedge_mask_obl[s][1][WEDGE_OBLIQUE27][j * stride + i] =
+ (1 << WEDGE_WEIGHT_BITS) - msk;
+ wedge_mask_obl[s][1][WEDGE_OBLIQUE117][i * stride + w - 1 - j] =
+ wedge_mask_obl[s][1][WEDGE_OBLIQUE153][(w - 1 - j) * stride + i] =
msk;
- const int mskx = wedge_mask_obl[s][1][WEDGE_VERTICAL][i * stride + j];
- wedge_mask_obl[s][1][WEDGE_HORIZONTAL][j * stride + i] = mskx;
- wedge_mask_obl[s][0][WEDGE_VERTICAL][i * stride + j] =
- wedge_mask_obl[s][0][WEDGE_HORIZONTAL][j * stride + i] =
+ const int mskx = wedge_mask_obl[s][0][WEDGE_VERTICAL][i * stride + j];
+ wedge_mask_obl[s][0][WEDGE_HORIZONTAL][j * stride + i] = mskx;
+ wedge_mask_obl[s][1][WEDGE_VERTICAL][i * stride + j] =
+ wedge_mask_obl[s][1][WEDGE_HORIZONTAL][j * stride + i] =
(1 << WEDGE_WEIGHT_BITS) - mskx;
}
}
@@ -539,12 +540,23 @@ static void init_wedge_signs() {
int i, w;
if (wbits == 0) continue;
for (w = 0; w < wtypes; ++w) {
+ // Get the mask master, i.e. index [0]
const uint8_t *mask = get_wedge_mask_inplace(w, 0, sb_type);
- int sum = 0;
- for (i = 0; i < bw; ++i) sum += mask[i];
- for (i = 0; i < bh; ++i) sum += mask[i * MASK_MASTER_STRIDE];
- sum = (sum + (bw + bh) / 2) / (bw + bh);
- wedge_params.signflip[w] = (sum < 32);
+ int avg = 0;
+ for (i = 0; i < bw; ++i) avg += mask[i];
+ for (i = 1; i < bh; ++i) avg += mask[i * MASK_MASTER_STRIDE];
+ avg = (avg + (bw + bh - 1) / 2) / (bw + bh - 1);
+ // Default sign of this wedge is 1 if the average < 32, 0 otherwise.
+ // If default sign is 1:
+ // If sign requested is 0, we need to flip the sign and return
+ // the complement i.e. index [1] instead. If sign requested is 1
+ // we need to flip the sign and return index [0] instead.
+ // If default sign is 0:
+ // If sign requested is 0, we need to return index [0] the master
+ // if sign requested is 1, we need to return the complement index [1]
+ // instead.
+ wedge_params.signflip[w] = (avg < 32);
+ // printf("%d[%d] = %d\n", sb_type, w, wedge_params.signflip[w]);
}
}
}
@@ -880,7 +892,7 @@ typedef struct SubpelParams {
int subpel_y;
} SubpelParams;
-void build_inter_predictors(MACROBLOCKD *xd, int plane,
+void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, int plane,
#if CONFIG_MOTION_VAR
int mi_col_offset, int mi_row_offset,
#endif // CONFIG_MOTION_VAR
@@ -893,28 +905,17 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
struct macroblockd_plane *const pd = &xd->plane[plane];
#if CONFIG_MOTION_VAR
const MODE_INFO *mi = xd->mi[mi_col_offset + xd->mi_stride * mi_row_offset];
-#if !CONFIG_CB4X4 || CONFIG_SUB8X8_MC
- const int build_for_obmc = !(mi_col_offset == 0 && mi_row_offset == 0);
-#endif // !CONFIG_CB4X4 || CONFIG_SUB8X8_MC
#else
const MODE_INFO *mi = xd->mi[0];
#endif // CONFIG_MOTION_VAR
- const int is_compound = has_second_ref(&mi->mbmi);
+ int is_compound = has_second_ref(&mi->mbmi);
int ref;
#if CONFIG_INTRABC
const int is_intrabc = is_intrabc_block(&mi->mbmi);
- struct scale_factors sf_identity;
-#if CONFIG_HIGHBITDEPTH
- av1_setup_scale_factors_for_frame(
- &sf_identity, 64, 64, 64, 64,
- xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH);
-#else
- av1_setup_scale_factors_for_frame(&sf_identity, 64, 64, 64, 64);
-#endif // CONFIG_HIGHBITDEPTH
assert(IMPLIES(is_intrabc, !is_compound));
#endif // CONFIG_INTRABC
#if CONFIG_GLOBAL_MOTION
- int is_global[2];
+ int is_global[2] = { 0, 0 };
for (ref = 0; ref < 1 + is_compound; ++ref) {
WarpedMotionParams *const wm = &xd->global_motion[mi->mbmi.ref_frame[ref]];
is_global[ref] = is_global_mv_block(mi, block, wm->wmtype);
@@ -923,47 +924,87 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
#if CONFIG_CB4X4
(void)block;
+ (void)cm;
#endif
-#if CONFIG_SUB8X8_MC
+#if CONFIG_MOTION_VAR && (CONFIG_CHROMA_SUB8X8 || !CONFIG_CB4X4)
+ const int build_for_obmc = !(mi_col_offset == 0 && mi_row_offset == 0);
+#endif // CONFIG_MOTION_VAR && (CONFIG_CHROMA_SUB8X8 || !CONFIG_CB4X4)
+
+#if CONFIG_CHROMA_SUB8X8
+ const BLOCK_SIZE bsize = mi->mbmi.sb_type;
+ const int ss_x = pd->subsampling_x;
+ const int ss_y = pd->subsampling_y;
+ int sub8x8_inter = bsize < BLOCK_8X8 && (ss_x || ss_y);
+ const int row_start = (block_size_high[bsize] == 4) && ss_y ? -1 : 0;
+ const int col_start = (block_size_wide[bsize] == 4) && ss_x ? -1 : 0;
+
#if CONFIG_MOTION_VAR
- if (mi->mbmi.sb_type < BLOCK_8X8 && plane > 0 && !build_for_obmc) {
+ if (!build_for_obmc && sub8x8_inter) {
#else
- if (mi->mbmi.sb_type < BLOCK_8X8 && plane > 0) {
+ if (sub8x8_inter) {
#endif // CONFIG_MOTION_VAR
- // block size in log2
- const int b4_wl = b_width_log2_lookup[mi->mbmi.sb_type];
- const int b4_hl = b_height_log2_lookup[mi->mbmi.sb_type];
- const int b8_sl = b_width_log2_lookup[BLOCK_8X8];
+ for (int row = row_start; row <= 0 && sub8x8_inter; ++row)
+ for (int col = col_start; col <= 0; ++col)
+ if (!is_inter_block(&xd->mi[row * xd->mi_stride + col]->mbmi))
+ sub8x8_inter = 0;
+ }
+#if CONFIG_MOTION_VAR
+ if (!build_for_obmc && sub8x8_inter) {
+#else
+ if (sub8x8_inter) {
+#endif // CONFIG_MOTION_VAR
// block size
- const int b4_w = 1 << b4_wl;
- const int b4_h = 1 << b4_hl;
- const int b8_s = 1 << b8_sl;
+ const int b4_w = block_size_wide[bsize] >> ss_x;
+ const int b4_h = block_size_high[bsize] >> ss_y;
+ const BLOCK_SIZE plane_bsize = scale_chroma_bsize(bsize, ss_x, ss_y);
+ const int b8_w = block_size_wide[plane_bsize] >> ss_x;
+ const int b8_h = block_size_high[plane_bsize] >> ss_y;
int idx, idy;
const int x_base = x;
const int y_base = y;
- // processing unit size
- const int x_step = w >> (b8_sl - b4_wl);
- const int y_step = h >> (b8_sl - b4_hl);
+ const struct buf_2d orig_pred_buf[2] = { pd->pre[0], pd->pre[1] };
+
+ int row = row_start;
+ for (idy = 0; idy < b8_h; idy += b4_h) {
+ int col = col_start;
+ for (idx = 0; idx < b8_w; idx += b4_w) {
+ MB_MODE_INFO *this_mbmi = &xd->mi[row * xd->mi_stride + col]->mbmi;
+ is_compound = has_second_ref(this_mbmi);
- for (idy = 0; idy < b8_s; idy += b4_h) {
- for (idx = 0; idx < b8_s; idx += b4_w) {
- const int chr_idx = (idy * 2) + idx;
for (ref = 0; ref < 1 + is_compound; ++ref) {
struct buf_2d *const dst_buf = &pd->dst;
+
+ const RefBuffer *ref_buf =
+ &cm->frame_refs[this_mbmi->ref_frame[ref] - LAST_FRAME];
+
+ const int c_offset = (mi_x + MI_SIZE * col_start) >> ss_x;
+ const int r_offset = (mi_y + MI_SIZE * row_start) >> ss_y;
+ pd->pre[ref].buf0 =
+ (plane == 1) ? ref_buf->buf->u_buffer : ref_buf->buf->v_buffer;
+ pd->pre[ref].buf =
+ pd->pre[ref].buf0 + scaled_buffer_offset(c_offset, r_offset,
+ ref_buf->buf->uv_stride,
+ &ref_buf->sf);
+ pd->pre[ref].width = ref_buf->buf->uv_crop_width;
+ pd->pre[ref].height = ref_buf->buf->uv_crop_height;
+ pd->pre[ref].stride = ref_buf->buf->uv_stride;
+
#if CONFIG_INTRABC
const struct scale_factors *const sf =
- is_intrabc ? &sf_identity : &xd->block_refs[ref]->sf;
+ is_intrabc ? &xd->sf_identity : &xd->block_refs[ref]->sf;
struct buf_2d *const pre_buf = is_intrabc ? dst_buf : &pd->pre[ref];
#else
const struct scale_factors *const sf = &xd->block_refs[ref]->sf;
struct buf_2d *const pre_buf = &pd->pre[ref];
#endif // CONFIG_INTRABC
uint8_t *dst = dst_buf->buf;
- const MV mv = mi->bmi[chr_idx].as_mv[ref].as_mv;
+
+ const MV mv = this_mbmi->mv[ref].as_mv;
+
const MV mv_q4 = clamp_mv_to_umv_border_sb(
xd, &mv, bw, bh, pd->subsampling_x, pd->subsampling_y);
uint8_t *pre;
@@ -977,12 +1018,13 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
warp_types.global_warp_allowed = is_global[ref];
#endif // CONFIG_GLOBAL_MOTION
#if CONFIG_WARPED_MOTION
- warp_types.local_warp_allowed = mi->mbmi.motion_mode == WARPED_CAUSAL;
+ warp_types.local_warp_allowed =
+ this_mbmi->motion_mode == WARPED_CAUSAL;
#endif // CONFIG_WARPED_MOTION
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
- x = x_base + idx * x_step;
- y = y_base + idy * y_step;
+ x = x_base + idx;
+ y = y_base + idy;
dst += dst_buf->stride * y + x;
@@ -1022,7 +1064,7 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
#endif // CONFIG_EXT_INTER
av1_make_inter_predictor(
pre, pre_buf->stride, dst, dst_buf->stride, subpel_x, subpel_y,
- sf, x_step, y_step, &conv_params, mi->mbmi.interp_filter,
+ sf, b4_w, b4_h, &conv_params, this_mbmi->interp_filter,
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
&warp_types, (mi_x >> pd->subsampling_x) + x,
(mi_y >> pd->subsampling_y) + y, plane, ref,
@@ -1032,11 +1074,17 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
#endif
xs, ys, xd);
}
+ ++col;
}
+ ++row;
}
+
+ for (ref = 0; ref < 2; ++ref) pd->pre[ref] = orig_pred_buf[ref];
return;
}
-#endif
+#else
+ (void)cm;
+#endif // CONFIG_CHROMA_SUB8X8
{
struct buf_2d *const dst_buf = &pd->dst;
@@ -1052,7 +1100,7 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
for (ref = 0; ref < 1 + is_compound; ++ref) {
#if CONFIG_INTRABC
const struct scale_factors *const sf =
- is_intrabc ? &sf_identity : &xd->block_refs[ref]->sf;
+ is_intrabc ? &xd->sf_identity : &xd->block_refs[ref]->sf;
struct buf_2d *const pre_buf = is_intrabc ? dst_buf : &pd->pre[ref];
#else
const struct scale_factors *const sf = &xd->block_refs[ref]->sf;
@@ -1110,7 +1158,7 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
for (ref = 0; ref < 1 + is_compound; ++ref) {
#if CONFIG_INTRABC
const struct scale_factors *const sf =
- is_intrabc ? &sf_identity : &xd->block_refs[ref]->sf;
+ is_intrabc ? &xd->sf_identity : &xd->block_refs[ref]->sf;
struct buf_2d *const pre_buf = is_intrabc ? dst_buf : &pd->pre[ref];
#else
const struct scale_factors *const sf = &xd->block_refs[ref]->sf;
@@ -1159,19 +1207,28 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
}
#if CONFIG_CONVOLVE_ROUND
-// TODO(angiebird): This part needs optimization
+ // TODO(angiebird): This part needs optimization
+ if (conv_params.do_post_rounding) {
#if CONFIG_HIGHBITDEPTH
- if (!(xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH))
+ if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
+ av1_highbd_convolve_rounding(tmp_dst, MAX_SB_SIZE, dst, dst_buf->stride,
+ w, h, FILTER_BITS * 2 + is_compound -
+ conv_params.round_0 -
+ conv_params.round_1,
+ xd->bd);
+ else
#endif // CONFIG_HIGHBITDEPTH
- av1_convolve_rounding(tmp_dst, MAX_SB_SIZE, dst, dst_buf->stride, w, h,
- FILTER_BITS * 2 + is_compound -
- conv_params.round_0 - conv_params.round_1);
+ av1_convolve_rounding(tmp_dst, MAX_SB_SIZE, dst, dst_buf->stride, w, h,
+ FILTER_BITS * 2 + is_compound -
+ conv_params.round_0 - conv_params.round_1);
+ }
#endif // CONFIG_CONVOLVE_ROUND
}
}
-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_predictor_sub8x8(const AV1_COMMON *cm, MACROBLOCKD *xd,
+ int plane, int i, int ir, int ic,
+ int mi_row, int mi_col) {
struct macroblockd_plane *const pd = &xd->plane[plane];
MODE_INFO *const mi = xd->mi[0];
const BLOCK_SIZE plane_bsize = get_plane_block_size(mi->mbmi.sb_type, pd);
@@ -1180,6 +1237,8 @@ void av1_build_inter_predictor_sub8x8(MACROBLOCKD *xd, int plane, int i, int ir,
uint8_t *const dst = &pd->dst.buf[(ir * pd->dst.stride + ic) << 2];
int ref;
const int is_compound = has_second_ref(&mi->mbmi);
+ (void)cm;
+
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
WarpTypesAllowed warp_types;
const int p_col = ((mi_col * MI_SIZE) >> pd->subsampling_x) + 4 * ic;
@@ -1229,7 +1288,8 @@ void av1_build_inter_predictor_sub8x8(MACROBLOCKD *xd, int plane, int i, int ir,
}
}
-static void build_inter_predictors_for_planes(MACROBLOCKD *xd, BLOCK_SIZE bsize,
+static void build_inter_predictors_for_planes(const AV1_COMMON *cm,
+ MACROBLOCKD *xd, BLOCK_SIZE bsize,
int mi_row, int mi_col,
int plane_from, int plane_to) {
int plane;
@@ -1265,7 +1325,7 @@ static void build_inter_predictors_for_planes(MACROBLOCKD *xd, BLOCK_SIZE bsize,
assert(pw * num_4x4_w == bw && ph * num_4x4_h == bh);
for (y = 0; y < num_4x4_h; ++y)
for (x = 0; x < num_4x4_w; ++x)
- build_inter_predictors(xd, plane,
+ build_inter_predictors(cm, xd, plane,
#if CONFIG_MOTION_VAR
0, 0,
#endif // CONFIG_MOTION_VAR
@@ -1275,7 +1335,7 @@ static void build_inter_predictors_for_planes(MACROBLOCKD *xd, BLOCK_SIZE bsize,
#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER
mi_x, mi_y);
} else {
- build_inter_predictors(xd, plane,
+ build_inter_predictors(cm, xd, plane,
#if CONFIG_MOTION_VAR
0, 0,
#endif // CONFIG_MOTION_VAR
@@ -1288,10 +1348,11 @@ static void build_inter_predictors_for_planes(MACROBLOCKD *xd, BLOCK_SIZE bsize,
}
}
-void av1_build_inter_predictors_sby(MACROBLOCKD *xd, int mi_row, int mi_col,
- BUFFER_SET *ctx, BLOCK_SIZE bsize) {
- build_inter_predictors_for_planes(xd, bsize, mi_row, mi_col, 0, 0);
-#if CONFIG_EXT_INTER
+void av1_build_inter_predictors_sby(const AV1_COMMON *cm, MACROBLOCKD *xd,
+ int mi_row, int mi_col, BUFFER_SET *ctx,
+ BLOCK_SIZE bsize) {
+ build_inter_predictors_for_planes(cm, xd, bsize, mi_row, mi_col, 0, 0);
+#if CONFIG_EXT_INTER && CONFIG_INTERINTRA
if (is_interintra_pred(&xd->mi[0]->mbmi)) {
BUFFER_SET default_ctx = { { xd->plane[0].dst.buf, NULL, NULL },
{ xd->plane[0].dst.stride, 0, 0 } };
@@ -1301,14 +1362,15 @@ void av1_build_inter_predictors_sby(MACROBLOCKD *xd, int mi_row, int mi_col,
}
#else
(void)ctx;
-#endif // CONFIG_EXT_INTER
+#endif // CONFIG_EXT_INTER && CONFIG_INTERINTRA
}
-void av1_build_inter_predictors_sbuv(MACROBLOCKD *xd, int mi_row, int mi_col,
- BUFFER_SET *ctx, BLOCK_SIZE bsize) {
- build_inter_predictors_for_planes(xd, bsize, mi_row, mi_col, 1,
+void av1_build_inter_predictors_sbuv(const AV1_COMMON *cm, MACROBLOCKD *xd,
+ int mi_row, int mi_col, BUFFER_SET *ctx,
+ BLOCK_SIZE bsize) {
+ build_inter_predictors_for_planes(cm, xd, bsize, mi_row, mi_col, 1,
MAX_MB_PLANE - 1);
-#if CONFIG_EXT_INTER
+#if CONFIG_EXT_INTER && CONFIG_INTERINTRA
if (is_interintra_pred(&xd->mi[0]->mbmi)) {
BUFFER_SET default_ctx = {
{ NULL, xd->plane[1].dst.buf, xd->plane[2].dst.buf },
@@ -1321,15 +1383,16 @@ void av1_build_inter_predictors_sbuv(MACROBLOCKD *xd, int mi_row, int mi_col,
}
#else
(void)ctx;
-#endif // CONFIG_EXT_INTER
+#endif // CONFIG_EXT_INTER && CONFIG_INTERINTRA
}
// TODO(afergs): Check if ctx can be made constant
-void av1_build_inter_predictors_sb(MACROBLOCKD *xd, int mi_row, int mi_col,
- BUFFER_SET *ctx, BLOCK_SIZE bsize) {
- build_inter_predictors_for_planes(xd, bsize, mi_row, mi_col, 0,
+void av1_build_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd,
+ int mi_row, int mi_col, BUFFER_SET *ctx,
+ BLOCK_SIZE bsize) {
+ build_inter_predictors_for_planes(cm, xd, bsize, mi_row, mi_col, 0,
MAX_MB_PLANE - 1);
-#if CONFIG_EXT_INTER
+#if CONFIG_EXT_INTER && CONFIG_INTERINTRA
if (is_interintra_pred(&xd->mi[0]->mbmi)) {
BUFFER_SET default_ctx = {
{ xd->plane[0].dst.buf, xd->plane[1].dst.buf, xd->plane[2].dst.buf },
@@ -1344,7 +1407,7 @@ void av1_build_inter_predictors_sb(MACROBLOCKD *xd, int mi_row, int mi_col,
}
#else
(void)ctx;
-#endif // CONFIG_EXT_INTER
+#endif // CONFIG_EXT_INTER && CONFIG_INTERINTRA
}
void av1_setup_dst_planes(struct macroblockd_plane planes[MAX_MB_PLANE],
@@ -1522,7 +1585,8 @@ void av1_build_masked_inter_predictor_complex(
} while (--h_remain);
}
-void av1_build_inter_predictors_sb_sub8x8_extend(MACROBLOCKD *xd,
+void av1_build_inter_predictors_sb_sub8x8_extend(const AV1_COMMON *cm,
+ MACROBLOCKD *xd,
#if CONFIG_EXT_INTER
int mi_row_ori, int mi_col_ori,
#endif // CONFIG_EXT_INTER
@@ -1553,7 +1617,7 @@ void av1_build_inter_predictors_sb_sub8x8_extend(MACROBLOCKD *xd,
const int bw = 4 * num_4x4_w;
const int bh = 4 * num_4x4_h;
- build_inter_predictors(xd, plane,
+ build_inter_predictors(cm, xd, plane,
#if CONFIG_MOTION_VAR
0, 0,
#endif // CONFIG_MOTION_VAR
@@ -1577,7 +1641,7 @@ void av1_build_inter_predictors_sb_sub8x8_extend(MACROBLOCKD *xd,
#endif // CONFIG_EXT_INTER
}
-void av1_build_inter_predictors_sb_extend(MACROBLOCKD *xd,
+void av1_build_inter_predictors_sb_extend(const AV1_COMMON *cm, MACROBLOCKD *xd,
#if CONFIG_EXT_INTER
int mi_row_ori, int mi_col_ori,
#endif // CONFIG_EXT_INTER
@@ -1596,7 +1660,7 @@ void av1_build_inter_predictors_sb_extend(MACROBLOCKD *xd,
const int bw = block_size_wide[plane_bsize];
const int bh = block_size_high[plane_bsize];
- build_inter_predictors(xd, plane,
+ build_inter_predictors(cm, xd, plane,
#if CONFIG_MOTION_VAR
0, 0,
#endif // CONFIG_MOTION_VAR
@@ -1697,10 +1761,13 @@ const uint8_t *av1_get_obmc_mask_flipped(int length) {
void av1_count_overlappable_neighbors(const AV1_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col) {
int i, mi_step;
+ MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
xd->mi[0]->mbmi.overlappable_neighbors[0] = 0;
xd->mi[0]->mbmi.overlappable_neighbors[1] = 0;
+ if (!is_motion_variation_allowed_bsize(mbmi->sb_type)) return;
+
if (xd->up_available) {
const int ilimit = AOMMIN(xd->n8_w, cm->mi_cols - mi_col);
for (i = 0; i < ilimit; i += mi_step) {
@@ -1709,8 +1776,15 @@ void av1_count_overlappable_neighbors(const AV1_COMMON *cm, MACROBLOCKD *xd,
MODE_INFO *above_mi =
xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride];
MB_MODE_INFO *above_mbmi = &above_mi->mbmi;
-
- mi_step = AOMMIN(xd->n8_w, mi_size_wide[above_mbmi->sb_type]);
+#if CONFIG_CHROMA_SUB8X8
+ if (above_mbmi->sb_type < BLOCK_8X8) {
+ ++mi_col_offset;
+ above_mbmi =
+ &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
+ }
+#endif
+ BLOCK_SIZE above_bsize = AOMMAX(above_mbmi->sb_type, BLOCK_8X8);
+ mi_step = AOMMIN(xd->n8_w, mi_size_wide[above_bsize]);
if (is_neighbor_overlappable(above_mbmi))
xd->mi[0]->mbmi.overlappable_neighbors[0]++;
@@ -1726,7 +1800,15 @@ void av1_count_overlappable_neighbors(const AV1_COMMON *cm, MACROBLOCKD *xd,
xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride];
MB_MODE_INFO *left_mbmi = &left_mi->mbmi;
- mi_step = AOMMIN(xd->n8_h, mi_size_high[left_mbmi->sb_type]);
+#if CONFIG_CHROMA_SUB8X8
+ if (left_mbmi->sb_type < BLOCK_8X8) {
+ ++mi_row_offset;
+ left_mbmi =
+ &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
+ }
+#endif
+ BLOCK_SIZE left_bsize = AOMMAX(left_mbmi->sb_type, BLOCK_8X8);
+ mi_step = AOMMIN(xd->n8_h, mi_size_high[left_bsize]);
if (is_neighbor_overlappable(left_mbmi))
xd->mi[0]->mbmi.overlappable_neighbors[1]++;
@@ -1757,7 +1839,7 @@ int skip_u4x4_pred_in_obmc(BLOCK_SIZE bsize, const struct macroblockd_plane *pd,
#else
case BLOCK_4X4:
case BLOCK_8X4:
- case BLOCK_4X8: return dir == 1; break;
+ case BLOCK_4X8: return dir == 0; break;
#endif
default: return 0;
}
@@ -1791,10 +1873,18 @@ void av1_build_obmc_inter_prediction(const AV1_COMMON *cm, MACROBLOCKD *xd,
i = 0;
do { // for each mi in the above row
- const int mi_col_offset = i;
- const MB_MODE_INFO *const above_mbmi =
+ int mi_col_offset = i;
+ MB_MODE_INFO *above_mbmi =
&xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
- const BLOCK_SIZE a_bsize = above_mbmi->sb_type;
+#if CONFIG_CHROMA_SUB8X8
+ if (above_mbmi->sb_type < BLOCK_8X8) {
+ ++mi_col_offset;
+ above_mbmi =
+ &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
+ }
+#endif
+
+ const BLOCK_SIZE a_bsize = AOMMAX(BLOCK_8X8, above_mbmi->sb_type);
const int mi_step = AOMMIN(xd->n8_w, mi_size_wide[a_bsize]);
if (is_neighbor_overlappable(above_mbmi)) {
@@ -1840,10 +1930,18 @@ void av1_build_obmc_inter_prediction(const AV1_COMMON *cm, MACROBLOCKD *xd,
i = 0;
do { // for each mi in the left column
- const int mi_row_offset = i;
- const MB_MODE_INFO *const left_mbmi =
+ int mi_row_offset = i;
+ MB_MODE_INFO *left_mbmi =
&xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
- const BLOCK_SIZE l_bsize = left_mbmi->sb_type;
+#if CONFIG_CHROMA_SUB8X8
+ if (left_mbmi->sb_type < BLOCK_8X8) {
+ ++mi_row_offset;
+ left_mbmi =
+ &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
+ }
+#endif
+
+ const BLOCK_SIZE l_bsize = AOMMAX(BLOCK_8X8, left_mbmi->sb_type);
const int mi_step = AOMMIN(xd->n8_h, mi_size_high[l_bsize]);
if (is_neighbor_overlappable(left_mbmi)) {
@@ -1916,7 +2014,15 @@ void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
int mi_x, mi_y, bw, bh;
MODE_INFO *above_mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride];
MB_MODE_INFO *above_mbmi = &above_mi->mbmi;
- const BLOCK_SIZE a_bsize = above_mbmi->sb_type;
+
+#if CONFIG_CHROMA_SUB8X8
+ if (above_mbmi->sb_type < BLOCK_8X8) {
+ ++mi_col_offset;
+ above_mbmi = &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
+ }
+#endif
+
+ const BLOCK_SIZE a_bsize = AOMMAX(BLOCK_8X8, above_mbmi->sb_type);
MB_MODE_INFO backup_mbmi;
mi_step = AOMMIN(xd->n8_w, mi_size_wide[a_bsize]);
@@ -1931,8 +2037,8 @@ void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
for (j = 0; j < MAX_MB_PLANE; ++j) {
struct macroblockd_plane *const pd = &xd->plane[j];
- setup_pred_plane(&pd->dst, AOMMAX(a_bsize, BLOCK_8X8), tmp_buf[j],
- tmp_width[j], tmp_height[j], tmp_stride[j], 0, i, NULL,
+ setup_pred_plane(&pd->dst, a_bsize, tmp_buf[j], tmp_width[j],
+ tmp_height[j], tmp_stride[j], 0, i, NULL,
pd->subsampling_x, pd->subsampling_y);
}
for (ref = 0; ref < 1 + has_second_ref(above_mbmi); ++ref) {
@@ -1960,8 +2066,8 @@ void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
4);
if (skip_u4x4_pred_in_obmc(bsize, pd, 0)) continue;
- build_inter_predictors(xd, j, mi_col_offset, mi_row_offset, 0, bw, bh, 0,
- 0, bw, bh,
+ build_inter_predictors(cm, xd, j, mi_col_offset, mi_row_offset, 0, bw, bh,
+ 0, 0, bw, bh,
#if CONFIG_SUPERTX && CONFIG_EXT_INTER
0, 0,
#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER
@@ -1997,7 +2103,15 @@ void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
int mi_x, mi_y, bw, bh;
MODE_INFO *left_mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride];
MB_MODE_INFO *left_mbmi = &left_mi->mbmi;
- const BLOCK_SIZE l_bsize = left_mbmi->sb_type;
+
+#if CONFIG_CHROMA_SUB8X8
+ if (left_mbmi->sb_type < BLOCK_8X8) {
+ ++mi_row_offset;
+ left_mbmi = &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
+ }
+#endif
+
+ const BLOCK_SIZE l_bsize = AOMMAX(left_mbmi->sb_type, BLOCK_8X8);
MB_MODE_INFO backup_mbmi;
mi_step = AOMMIN(xd->n8_h, mi_size_high[l_bsize]);
@@ -2012,8 +2126,8 @@ void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
for (j = 0; j < MAX_MB_PLANE; ++j) {
struct macroblockd_plane *const pd = &xd->plane[j];
- setup_pred_plane(&pd->dst, AOMMAX(l_bsize, BLOCK_8X8), tmp_buf[j],
- tmp_width[j], tmp_height[j], tmp_stride[j], i, 0, NULL,
+ setup_pred_plane(&pd->dst, l_bsize, tmp_buf[j], tmp_width[j],
+ tmp_height[j], tmp_stride[j], i, 0, NULL,
pd->subsampling_x, pd->subsampling_y);
}
for (ref = 0; ref < 1 + has_second_ref(left_mbmi); ++ref) {
@@ -2041,8 +2155,8 @@ void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
bh = (mi_step << MI_SIZE_LOG2) >> pd->subsampling_y;
if (skip_u4x4_pred_in_obmc(bsize, pd, 1)) continue;
- build_inter_predictors(xd, j, mi_col_offset, mi_row_offset, 0, bw, bh, 0,
- 0, bw, bh,
+ build_inter_predictors(cm, xd, j, mi_col_offset, mi_row_offset, 0, bw, bh,
+ 0, 0, bw, bh,
#if CONFIG_SUPERTX && CONFIG_EXT_INTER
0, 0,
#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER
@@ -2185,7 +2299,7 @@ void av1_build_prediction_by_bottom_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
continue;
build_inter_predictors(
- xd, j, mi_col_offset, mi_row_offset, y * 2 + x, bw, bh,
+ cm, xd, j, mi_col_offset, mi_row_offset, y * 2 + x, bw, bh,
(4 * x) >> pd->subsampling_x,
xd->n8_h == 1 ? (4 >> pd->subsampling_y) : 0, pw, bh,
#if CONFIG_SUPERTX && CONFIG_EXT_INTER
@@ -2194,13 +2308,13 @@ void av1_build_prediction_by_bottom_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
mi_x, mi_y);
}
} else {
- build_inter_predictors(xd, j, mi_col_offset, mi_row_offset, 0, bw, bh,
- 0, xd->n8_h == 1 ? (4 >> pd->subsampling_y) : 0,
- bw, bh,
+ build_inter_predictors(
+ cm, xd, j, mi_col_offset, mi_row_offset, 0, bw, bh, 0,
+ xd->n8_h == 1 ? (4 >> pd->subsampling_y) : 0, bw, bh,
#if CONFIG_SUPERTX && CONFIG_EXT_INTER
- 0, 0,
+ 0, 0,
#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER
- mi_x, mi_y);
+ mi_x, mi_y);
}
}
#if CONFIG_EXT_INTER
@@ -2292,7 +2406,7 @@ void av1_build_prediction_by_right_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
if ((bp == PARTITION_VERT || bp == PARTITION_SPLIT) && x != 0)
continue;
- build_inter_predictors(xd, j, mi_col_offset, mi_row_offset,
+ build_inter_predictors(cm, xd, j, mi_col_offset, mi_row_offset,
y * 2 + x, bw, bh,
xd->n8_w == 1 ? 4 >> pd->subsampling_x : 0,
(4 * y) >> pd->subsampling_y, bw, ph,
@@ -2302,9 +2416,9 @@ void av1_build_prediction_by_right_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
mi_x, mi_y);
}
} else {
- build_inter_predictors(xd, j, mi_col_offset, mi_row_offset, 0, bw, bh,
- xd->n8_w == 1 ? 4 >> pd->subsampling_x : 0, 0,
- bw, bh,
+ build_inter_predictors(cm, xd, j, mi_col_offset, mi_row_offset, 0, bw,
+ bh, xd->n8_w == 1 ? 4 >> pd->subsampling_x : 0,
+ 0, bw, bh,
#if CONFIG_SUPERTX && CONFIG_EXT_INTER
0, 0,
#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER
@@ -2489,15 +2603,16 @@ void av1_build_ncobmc_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd,
#if CONFIG_EXT_INTER
/* clang-format off */
+#if CONFIG_INTERINTRA
#if CONFIG_EXT_PARTITION
static const int ii_weights1d[MAX_SB_SIZE] = {
- 26, 25, 24, 24, 23, 23, 22, 22, 21, 21, 20, 20, 19, 19, 18, 18, 17, 17, 17,
- 16, 16, 16, 15, 15, 15, 15, 14, 14, 14, 13, 13, 13, 13, 13, 12, 12, 12, 12,
- 12, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 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
+ 60, 58, 56, 54, 52, 50, 48, 47, 45, 44, 42, 41, 39, 38, 37, 35, 34, 33, 32,
+ 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 22, 21, 20, 19, 19, 18, 18, 17, 16,
+ 16, 15, 15, 14, 14, 13, 13, 12, 12, 12, 11, 11, 10, 10, 10, 9, 9, 9, 8,
+ 8, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 4, 4,
+ 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
};
static int ii_size_scales[BLOCK_SIZES] = {
#if CONFIG_CB4X4
@@ -2508,10 +2623,10 @@ static int ii_size_scales[BLOCK_SIZES] = {
};
#else
static const int ii_weights1d[MAX_SB_SIZE] = {
- 26, 25, 24, 24, 23, 23, 22, 22, 21, 21, 20, 20, 19, 19, 18, 18,
- 17, 17, 17, 16, 16, 16, 15, 15, 15, 15, 14, 14, 14, 13, 13, 13,
- 13, 13, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9
+ 60, 56, 52, 48, 45, 42, 39, 37, 34, 32, 30, 28, 26, 24, 22, 21,
+ 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 10, 9, 8, 8, 7, 7,
+ 6, 6, 6, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2,
+ 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
};
static int ii_size_scales[BLOCK_SIZES] = {
#if CONFIG_CB4X4
@@ -2570,35 +2685,8 @@ static void combine_interintra(INTERINTRA_MODE mode, int use_wedge_interintra,
}
break;
- case II_D63_PRED:
- case II_D117_PRED:
- for (i = 0; i < bh; ++i) {
- for (j = 0; j < bw; ++j) {
- int scale = (ii_weights1d[i * size_scale] * 3 +
- ii_weights1d[j * size_scale]) >>
- 2;
- comppred[i * compstride + j] =
- AOM_BLEND_A64(scale, intrapred[i * intrastride + j],
- interpred[i * interstride + j]);
- }
- }
- break;
-
- case II_D207_PRED:
- case II_D153_PRED:
- for (i = 0; i < bh; ++i) {
- for (j = 0; j < bw; ++j) {
- int scale = (ii_weights1d[j * size_scale] * 3 +
- ii_weights1d[i * size_scale]) >>
- 2;
- comppred[i * compstride + j] =
- AOM_BLEND_A64(scale, intrapred[i * intrastride + j],
- interpred[i * interstride + j]);
- }
- }
- break;
-
- case II_D135_PRED:
+#if CONFIG_ALT_INTRA
+ case II_SMOOTH_PRED:
for (i = 0; i < bh; ++i) {
for (j = 0; j < bw; ++j) {
int scale = ii_weights1d[(i < j ? i : j) * size_scale];
@@ -2608,21 +2696,11 @@ static void combine_interintra(INTERINTRA_MODE mode, int use_wedge_interintra,
}
}
break;
+#endif
- case II_D45_PRED:
- for (i = 0; i < bh; ++i) {
- for (j = 0; j < bw; ++j) {
- int scale =
- (ii_weights1d[i * size_scale] + ii_weights1d[j * size_scale]) >>
- 1;
- comppred[i * compstride + j] =
- AOM_BLEND_A64(scale, intrapred[i * intrastride + j],
- interpred[i * interstride + j]);
- }
- }
- break;
-
+#if !CONFIG_ALT_INTRA
case II_TM_PRED:
+#endif
case II_DC_PRED:
default:
for (i = 0; i < bh; ++i) {
@@ -2686,35 +2764,8 @@ static void combine_interintra_highbd(
}
break;
- case II_D63_PRED:
- case II_D117_PRED:
- for (i = 0; i < bh; ++i) {
- for (j = 0; j < bw; ++j) {
- int scale = (ii_weights1d[i * size_scale] * 3 +
- ii_weights1d[j * size_scale]) >>
- 2;
- comppred[i * compstride + j] =
- AOM_BLEND_A64(scale, intrapred[i * intrastride + j],
- interpred[i * interstride + j]);
- }
- }
- break;
-
- case II_D207_PRED:
- case II_D153_PRED:
- for (i = 0; i < bh; ++i) {
- for (j = 0; j < bw; ++j) {
- int scale = (ii_weights1d[j * size_scale] * 3 +
- ii_weights1d[i * size_scale]) >>
- 2;
- comppred[i * compstride + j] =
- AOM_BLEND_A64(scale, intrapred[i * intrastride + j],
- interpred[i * interstride + j]);
- }
- }
- break;
-
- case II_D135_PRED:
+#if CONFIG_ALT_INTRA
+ case II_SMOOTH_PRED:
for (i = 0; i < bh; ++i) {
for (j = 0; j < bw; ++j) {
int scale = ii_weights1d[(i < j ? i : j) * size_scale];
@@ -2724,21 +2775,11 @@ static void combine_interintra_highbd(
}
}
break;
+#endif
- case II_D45_PRED:
- for (i = 0; i < bh; ++i) {
- for (j = 0; j < bw; ++j) {
- int scale =
- (ii_weights1d[i * size_scale] + ii_weights1d[j * size_scale]) >>
- 1;
- comppred[i * compstride + j] =
- AOM_BLEND_A64(scale, intrapred[i * intrastride + j],
- interpred[i * interstride + j]);
- }
- }
- break;
-
+#if !CONFIG_ALT_INTRA
case II_TM_PRED:
+#endif
case II_DC_PRED:
default:
for (i = 0; i < bh; ++i) {
@@ -2850,6 +2891,7 @@ void av1_build_interintra_predictors(MACROBLOCKD *xd, uint8_t *ypred,
av1_build_interintra_predictors_sbuv(xd, upred, vpred, ustride, vstride, ctx,
bsize);
}
+#endif // CONFIG_INTERINTRA
// Builds the inter-predictor for the single ref case
// for use in the encoder to search the wedges efficiently.
@@ -2939,13 +2981,13 @@ void av1_build_inter_predictors_for_planes_single_buf(
for (plane = plane_from; plane <= plane_to; ++plane) {
const BLOCK_SIZE plane_bsize =
get_plane_block_size(bsize, &xd->plane[plane]);
- const int num_4x4_w = num_4x4_blocks_wide_lookup[plane_bsize];
- const int num_4x4_h = num_4x4_blocks_high_lookup[plane_bsize];
const int bw = block_size_wide[plane_bsize];
const int bh = block_size_high[plane_bsize];
if (xd->mi[0]->mbmi.sb_type < BLOCK_8X8 && !CONFIG_CB4X4) {
int x, y;
+ const int num_4x4_w = num_4x4_blocks_wide_lookup[plane_bsize];
+ const int num_4x4_h = num_4x4_blocks_high_lookup[plane_bsize];
assert(bsize == BLOCK_8X8);
for (y = 0; y < num_4x4_h; ++y)
for (x = 0; x < num_4x4_w; ++x)
@@ -3052,11 +3094,11 @@ void av1_build_wedge_inter_predictor_from_buf(
for (plane = plane_from; plane <= plane_to; ++plane) {
const BLOCK_SIZE plane_bsize =
get_plane_block_size(bsize, &xd->plane[plane]);
- const int num_4x4_w = num_4x4_blocks_wide_lookup[plane_bsize];
- const int num_4x4_h = num_4x4_blocks_high_lookup[plane_bsize];
if (xd->mi[0]->mbmi.sb_type < BLOCK_8X8 && !CONFIG_CB4X4) {
int x, y;
+ const int num_4x4_w = num_4x4_blocks_wide_lookup[plane_bsize];
+ const int num_4x4_h = num_4x4_blocks_high_lookup[plane_bsize];
assert(bsize == BLOCK_8X8);
for (y = 0; y < num_4x4_h; ++y)
for (x = 0; x < num_4x4_w; ++x)
diff --git a/third_party/aom/av1/common/reconinter.h b/third_party/aom/av1/common/reconinter.h
index 10933a751..887651f14 100644
--- a/third_party/aom/av1/common/reconinter.h
+++ b/third_party/aom/av1/common/reconinter.h
@@ -32,11 +32,12 @@
extern "C" {
#endif
+static INLINE int has_scale(int xs, int ys) { return xs != 16 || ys != 16; }
+
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,
+ uint8_t *dst, int dst_stride, int subpel_x,
+ int subpel_y, const struct scale_factors *sf,
+ int w, int h, ConvolveParams *conv_params,
#if CONFIG_DUAL_FILTER
const InterpFilter *interp_filter,
#else
@@ -44,63 +45,53 @@ static INLINE void inter_predictor(const uint8_t *src, int src_stride,
#endif
int xs, int ys) {
#if CONFIG_DUAL_FILTER
- InterpFilter filter_x = av1_get_plane_interp_filter(
+ const 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(
+ const InterpFilter filter_y = av1_get_plane_interp_filter(
interp_filter[0 + 2 * conv_params->ref], conv_params->plane);
- InterpFilterParams interp_filter_params_x =
+ const InterpFilterParams interp_filter_params_x =
av1_get_interp_filter_params(filter_x);
- InterpFilterParams interp_filter_params_y =
+ const InterpFilterParams interp_filter_params_y =
av1_get_interp_filter_params(filter_y);
#else
- InterpFilterParams interp_filter_params =
+ const InterpFilterParams interp_filter_params_x =
av1_get_interp_filter_params(interp_filter);
+ const InterpFilterParams interp_filter_params_y = interp_filter_params_x;
#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 (has_scale(xs, ys)) {
+ av1_convolve_c(src, src_stride, dst, dst_stride, w, h, interp_filter,
+ subpel_x, xs, subpel_y, ys, conv_params);
+ } else if (conv_params->round == CONVOLVE_OPT_NO_ROUND) {
#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,
+ av1_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h,
#if CONFIG_DUAL_FILTER
- interp_filter,
+ interp_filter,
+#else // CONFIG_DUAL_FILTER
+ &interp_filter,
+#endif // CONFIG_DUAL_FILTER
+ subpel_x, xs, subpel_y, ys, conv_params);
+ conv_params->do_post_rounding = 1;
#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,
+ assert(0);
+#endif // CONFIG_CONVOLVE_ROUND
+ } else {
+ assert(conv_params->round == CONVOLVE_OPT_ROUND);
+ if (w <= 2 || h <= 2) {
+ av1_convolve_c(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);
- }
+ } else if (interp_filter_params_x.taps == SUBPEL_TAPS &&
+ interp_filter_params_y.taps == SUBPEL_TAPS) {
+ 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);
+ 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 {
+ av1_convolve(src, src_stride, dst, dst_stride, w, h, interp_filter,
+ subpel_x, xs, subpel_y, ys, conv_params);
}
}
}
@@ -111,46 +102,59 @@ static INLINE void highbd_inter_predictor(const uint8_t *src, int src_stride,
const int subpel_x,
const int subpel_y,
const struct scale_factors *sf, int w,
- int h, int ref,
+ int h, ConvolveParams *conv_params,
#if CONFIG_DUAL_FILTER
const InterpFilter *interp_filter,
#else
const InterpFilter interp_filter,
#endif
int xs, int ys, int bd) {
+ const int ref = conv_params->ref;
+ // 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
+ const int avg = ref > 0;
#if CONFIG_DUAL_FILTER
- InterpFilterParams interp_filter_params_x =
+ const InterpFilterParams interp_filter_params_x =
av1_get_interp_filter_params(interp_filter[1 + 2 * ref]);
- InterpFilterParams interp_filter_params_y =
+ const InterpFilterParams interp_filter_params_y =
av1_get_interp_filter_params(interp_filter[0 + 2 * ref]);
#else
- InterpFilterParams interp_filter_params =
+ const InterpFilterParams interp_filter_params_x =
av1_get_interp_filter_params(interp_filter);
+ const InterpFilterParams interp_filter_params_y = interp_filter_params_x;
#endif
+ if (has_scale(xs, ys)) {
+ av1_highbd_convolve(src, src_stride, dst, dst_stride, w, h, interp_filter,
+ subpel_x, xs, subpel_y, ys, avg, bd);
+ } else if (conv_params->round == CONVOLVE_OPT_NO_ROUND) {
+#if CONFIG_CONVOLVE_ROUND
+ av1_highbd_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h,
#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);
+ interp_filter,
+#else // CONFIG_DUAL_FILTER
+ &interp_filter,
#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);
+ subpel_x, xs, subpel_y, ys, conv_params, bd);
+ conv_params->do_post_rounding = 1;
+#else
+ assert(0);
+#endif // CONFIG_CONVOLVE_ROUND
} 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);
+ 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);
+ 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 {
+ av1_highbd_convolve(src, src_stride, dst, dst_stride, w, h, interp_filter,
+ subpel_x, xs, subpel_y, ys, avg, bd);
+ }
}
}
#endif // CONFIG_HIGHBITDEPTH
@@ -254,7 +258,7 @@ void build_compound_seg_mask_highbd(uint8_t *mask, SEG_MASK_TYPE mask_type,
#endif // CONFIG_COMPOUND_SEGMENT
#endif // CONFIG_EXT_INTER
-void build_inter_predictors(MACROBLOCKD *xd, int plane,
+void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, int plane,
#if CONFIG_MOTION_VAR
int mi_col_offset, int mi_row_offset,
#endif // CONFIG_MOTION_VAR
@@ -415,20 +419,26 @@ static INLINE void av1_make_inter_predictor(
if (do_warp) {
const struct macroblockd_plane *const pd = &xd->plane[plane];
const struct buf_2d *const pre_buf = &pd->pre[ref];
+#if CONFIG_EXT_INTER
+ int compute_avg =
+ ref && mi->mbmi.interinter_compound_type == COMPOUND_AVERAGE;
+#else
+ int compute_avg = ref;
+#endif // CONFIG_EXT_INTER
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);
+ pd->subsampling_x, pd->subsampling_y, xs, ys, compute_avg);
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,
+ sf, w, h, conv_params, interp_filter, xs, ys,
xd->bd);
return;
}
@@ -526,27 +536,32 @@ static INLINE MV average_split_mvs(const struct macroblockd_plane *pd,
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_predictor_sub8x8(const AV1_COMMON *cm, 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_sby(const AV1_COMMON *cm, 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_sbuv(const AV1_COMMON *cm, 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);
+void av1_build_inter_predictors_sb(const AV1_COMMON *cm, 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,
+void av1_build_inter_predictors_sb_sub8x8_extend(const AV1_COMMON *cm,
+ 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,
+void av1_build_inter_predictors_sb_extend(const AV1_COMMON *cm, MACROBLOCKD *xd,
#if CONFIG_EXT_INTER
int mi_row_ori, int mi_col_ori,
#endif // CONFIG_EXT_INTER
@@ -783,7 +798,7 @@ const uint8_t *av1_get_compound_type_mask_inverse(
const uint8_t *av1_get_compound_type_mask(
const INTERINTER_COMPOUND_DATA *const comp_data, BLOCK_SIZE sb_type);
-
+#if CONFIG_INTERINTRA
void av1_build_interintra_predictors(MACROBLOCKD *xd, uint8_t *ypred,
uint8_t *upred, uint8_t *vpred,
int ystride, int ustride, int vstride,
@@ -807,7 +822,7 @@ void av1_build_intra_predictors_for_interintra(MACROBLOCKD *xd,
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);
-
+#endif // CONFIG_INTERINTRA
// 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,
diff --git a/third_party/aom/av1/common/reconintra.c b/third_party/aom/av1/common/reconintra.c
index 6e0ff52ce..55459f428 100644
--- a/third_party/aom/av1/common/reconintra.c
+++ b/third_party/aom/av1/common/reconintra.c
@@ -47,7 +47,11 @@ static const uint8_t extend_modes[INTRA_MODES] = {
NEED_LEFT | NEED_BOTTOMLEFT, // D207
NEED_ABOVE | NEED_ABOVERIGHT, // D63
#if CONFIG_ALT_INTRA
- NEED_LEFT | NEED_ABOVE, // SMOOTH
+ NEED_LEFT | NEED_ABOVE, // SMOOTH
+#if CONFIG_SMOOTH_HV
+ NEED_LEFT | NEED_ABOVE, // SMOOTH_V
+ NEED_LEFT | NEED_ABOVE, // SMOOTH_H
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
NEED_LEFT | NEED_ABOVE | NEED_ABOVELEFT, // TM
};
@@ -443,8 +447,10 @@ static int has_top_right(BLOCK_SIZE bsize, int mi_row, int mi_col,
const int plane_bw_unit = AOMMAX(bw_unit >> ss_x, 1);
const int top_right_count_unit = tx_size_wide_unit[txsz];
+#if !CONFIG_CB4X4
// Special handling for block sizes 4x8 and 4x4.
if (ss_x == 0 && bw_unit < 2 && col_off == 0) return 1;
+#endif
if (row_off > 0) { // Just need to check if enough pixels on the right.
return col_off + top_right_count_unit < plane_bw_unit;
@@ -514,9 +520,13 @@ static int has_bottom_left(BLOCK_SIZE bsize, int mi_row, int mi_col,
// and/or bottom-left superblocks. But only the left superblock is
// available, so check if all required pixels fall in that superblock.
if (blk_col_in_sb == 0) {
- const int blk_start_row_off = blk_row_in_sb << (bh_in_mi_log2 + !ss_y);
+ const int blk_start_row_off = blk_row_in_sb
+ << (bh_in_mi_log2 + MI_SIZE_LOG2 -
+ tx_size_wide_log2[0]) >>
+ ss_y;
const int row_off_in_sb = blk_start_row_off + row_off;
- const int sb_height_unit = MAX_MIB_SIZE << !ss_y;
+ const int sb_height_unit =
+ MAX_MIB_SIZE << (MI_SIZE_LOG2 - tx_size_wide_log2[0]) >> ss_y;
return row_off_in_sb + bottom_left_count_unit < sb_height_unit;
}
@@ -554,6 +564,9 @@ static intra_high_pred_fn dc_pred_high[2][2][TX_SIZES];
#endif // CONFIG_HIGHBITDEPTH
static void av1_init_intra_predictors_internal(void) {
+#if CONFIG_EXT_INTRA
+ assert(NELEMENTS(mode_to_angle_map) == INTRA_MODES);
+#endif // CONFIG_EXT_INTRA
#if CONFIG_TX64X64
#define INIT_NO_4X4(p, type) \
p[TX_8X8] = aom_##type##_predictor_8x8; \
@@ -567,7 +580,7 @@ static void av1_init_intra_predictors_internal(void) {
p[TX_32X32] = aom_##type##_predictor_32x32
#endif // CONFIG_TX64X64
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
#define INIT_ALL_SIZES(p, type) \
p[TX_2X2] = aom_##type##_predictor_2x2; \
p[TX_4X4] = aom_##type##_predictor_4x4; \
@@ -590,6 +603,10 @@ static void av1_init_intra_predictors_internal(void) {
#if CONFIG_ALT_INTRA
INIT_ALL_SIZES(pred[TM_PRED], paeth);
INIT_ALL_SIZES(pred[SMOOTH_PRED], smooth);
+#if CONFIG_SMOOTH_HV
+ INIT_ALL_SIZES(pred[SMOOTH_V_PRED], smooth_v);
+ INIT_ALL_SIZES(pred[SMOOTH_H_PRED], smooth_h);
+#endif // CONFIG_SMOOTH_HV
#else
INIT_ALL_SIZES(pred[TM_PRED], tm);
#endif // CONFIG_ALT_INTRA
@@ -612,6 +629,10 @@ static void av1_init_intra_predictors_internal(void) {
#if CONFIG_ALT_INTRA
INIT_ALL_SIZES(pred_high[TM_PRED], highbd_paeth);
INIT_ALL_SIZES(pred_high[SMOOTH_PRED], highbd_smooth);
+#if CONFIG_SMOOTH_HV
+ INIT_ALL_SIZES(pred_high[SMOOTH_V_PRED], highbd_smooth_v);
+ INIT_ALL_SIZES(pred_high[SMOOTH_H_PRED], highbd_smooth_h);
+#endif // CONFIG_SMOOTH_HV
#else
INIT_ALL_SIZES(pred_high[TM_PRED], highbd_tm);
#endif // CONFIG_ALT_INTRA
@@ -786,6 +807,7 @@ static void dr_prediction_z2(uint8_t *dst, ptrdiff_t stride, int bs,
#endif // CONFIG_INTRA_INTERP
} else {
base2 = y >> 8;
+ assert(base2 >= -1);
shift2 = y & 0xFF;
#if CONFIG_INTRA_INTERP
val = intra_subpel_interp(base2, shift2, left, -1, bs - 1, filter_type);
@@ -1191,8 +1213,8 @@ static void highbd_dr_predictor(uint16_t *dst, ptrdiff_t stride, int bs,
#if CONFIG_FILTER_INTRA
#if USE_3TAP_INTRA_FILTER
-int av1_filter_intra_taps_3[TX_SIZES][INTRA_MODES][3] = {
-#if CONFIG_CB4X4
+static int filter_intra_taps_3[TX_SIZES][FILTER_INTRA_MODES][3] = {
+#if CONFIG_CHROMA_2X2
{
{ 697, 836, -509 },
{ 993, 513, -482 },
@@ -1203,7 +1225,7 @@ int av1_filter_intra_taps_3[TX_SIZES][INTRA_MODES][3] = {
{ 358, 687, -21 },
{ 411, 1083, -470 },
{ 912, 814, -702 },
- { 883, 902, 761 },
+ { 883, 902, -761 },
},
#endif
{
@@ -1216,7 +1238,7 @@ int av1_filter_intra_taps_3[TX_SIZES][INTRA_MODES][3] = {
{ 358, 687, -21 },
{ 411, 1083, -470 },
{ 912, 814, -702 },
- { 883, 902, 761 },
+ { 883, 902, -761 },
},
{
{ 659, 816, -451 },
@@ -1270,8 +1292,8 @@ int av1_filter_intra_taps_3[TX_SIZES][INTRA_MODES][3] = {
#endif // CONFIG_TX64X64
};
#else
-int av1_filter_intra_taps_4[TX_SIZES][INTRA_MODES][4] = {
-#if CONFIG_CB4X4
+static int filter_intra_taps_4[TX_SIZES][FILTER_INTRA_MODES][4] = {
+#if CONFIG_CHROMA_2X2
{
{ 735, 881, -537, -54 },
{ 1005, 519, -488, -11 },
@@ -1375,9 +1397,9 @@ static void filter_intra_predictors_3tap(uint8_t *dst, ptrdiff_t stride, int bs,
int buffer[33][33];
#endif // CONFIG_TX64X64
const TX_SIZE tx_size = get_txsize_from_blocklen(bs);
- const int c0 = av1_filter_intra_taps_3[tx_size][mode][0];
- const int c1 = av1_filter_intra_taps_3[tx_size][mode][1];
- const int c2 = av1_filter_intra_taps_3[tx_size][mode][2];
+ const int c0 = filter_intra_taps_3[tx_size][mode][0];
+ const int c1 = filter_intra_taps_3[tx_size][mode][1];
+ const int c2 = filter_intra_taps_3[tx_size][mode][2];
k = 0;
mean = 0;
@@ -1397,13 +1419,11 @@ static void filter_intra_predictors_3tap(uint8_t *dst, ptrdiff_t stride, int bs,
ipred = c0 * buffer[r - 1][c] + c1 * buffer[r][c - 1] +
c2 * buffer[r - 1][c - 1];
buffer[r][c] = ROUND_POWER_OF_TWO_SIGNED(ipred, FILTER_INTRA_PREC_BITS);
+ buffer[r][c] = clip_pixel(buffer[r][c] + mean) - mean;
}
for (r = 0; r < bs; ++r) {
- for (c = 0; c < bs; ++c) {
- ipred = buffer[r + 1][c + 1] + mean;
- dst[c] = clip_pixel(ipred);
- }
+ for (c = 0; c < bs; ++c) dst[c] = clip_pixel(buffer[r + 1][c + 1] + mean);
dst += stride;
}
}
@@ -1419,10 +1439,10 @@ static void filter_intra_predictors_4tap(uint8_t *dst, ptrdiff_t stride, int bs,
int buffer[33][65];
#endif // CONFIG_TX64X64
const TX_SIZE tx_size = get_txsize_from_blocklen(bs);
- const int c0 = av1_filter_intra_taps_4[tx_size][mode][0];
- const int c1 = av1_filter_intra_taps_4[tx_size][mode][1];
- const int c2 = av1_filter_intra_taps_4[tx_size][mode][2];
- const int c3 = av1_filter_intra_taps_4[tx_size][mode][3];
+ const int c0 = filter_intra_taps_4[tx_size][mode][0];
+ const int c1 = filter_intra_taps_4[tx_size][mode][1];
+ const int c2 = filter_intra_taps_4[tx_size][mode][2];
+ const int c3 = filter_intra_taps_4[tx_size][mode][3];
k = 0;
mean = 0;
@@ -1442,13 +1462,11 @@ static void filter_intra_predictors_4tap(uint8_t *dst, ptrdiff_t stride, int bs,
ipred = c0 * buffer[r - 1][c] + c1 * buffer[r][c - 1] +
c2 * buffer[r - 1][c - 1] + c3 * buffer[r - 1][c + 1];
buffer[r][c] = ROUND_POWER_OF_TWO_SIGNED(ipred, FILTER_INTRA_PREC_BITS);
+ buffer[r][c] = clip_pixel(buffer[r][c] + mean) - mean;
}
for (r = 0; r < bs; ++r) {
- for (c = 0; c < bs; ++c) {
- ipred = buffer[r + 1][c + 1] + mean;
- dst[c] = clip_pixel(ipred);
- }
+ for (c = 0; c < bs; ++c) dst[c] = clip_pixel(buffer[r + 1][c + 1] + mean);
dst += stride;
}
}
@@ -1457,90 +1475,90 @@ static void filter_intra_predictors_4tap(uint8_t *dst, ptrdiff_t stride, int bs,
void av1_dc_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
const uint8_t *above, const uint8_t *left) {
#if USE_3TAP_INTRA_FILTER
- filter_intra_predictors_3tap(dst, stride, bs, above, left, DC_PRED);
+ filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_DC_PRED);
#else
- filter_intra_predictors_4tap(dst, stride, bs, above, left, DC_PRED);
+ filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_DC_PRED);
#endif
}
void av1_v_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
const uint8_t *above, const uint8_t *left) {
#if USE_3TAP_INTRA_FILTER
- filter_intra_predictors_3tap(dst, stride, bs, above, left, V_PRED);
+ filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_V_PRED);
#else
- filter_intra_predictors_4tap(dst, stride, bs, above, left, V_PRED);
+ filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_V_PRED);
#endif
}
void av1_h_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
const uint8_t *above, const uint8_t *left) {
#if USE_3TAP_INTRA_FILTER
- filter_intra_predictors_3tap(dst, stride, bs, above, left, H_PRED);
+ filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_H_PRED);
#else
- filter_intra_predictors_4tap(dst, stride, bs, above, left, H_PRED);
+ filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_H_PRED);
#endif
}
void av1_d45_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
const uint8_t *above, const uint8_t *left) {
#if USE_3TAP_INTRA_FILTER
- filter_intra_predictors_3tap(dst, stride, bs, above, left, D45_PRED);
+ filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_D45_PRED);
#else
- filter_intra_predictors_4tap(dst, stride, bs, above, left, D45_PRED);
+ filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_D45_PRED);
#endif
}
void av1_d135_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
const uint8_t *above, const uint8_t *left) {
#if USE_3TAP_INTRA_FILTER
- filter_intra_predictors_3tap(dst, stride, bs, above, left, D135_PRED);
+ filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_D135_PRED);
#else
- filter_intra_predictors_4tap(dst, stride, bs, above, left, D135_PRED);
+ filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_D135_PRED);
#endif
}
void av1_d117_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
const uint8_t *above, const uint8_t *left) {
#if USE_3TAP_INTRA_FILTER
- filter_intra_predictors_3tap(dst, stride, bs, above, left, D117_PRED);
+ filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_D117_PRED);
#else
- filter_intra_predictors_4tap(dst, stride, bs, above, left, D117_PRED);
+ filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_D117_PRED);
#endif
}
void av1_d153_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
const uint8_t *above, const uint8_t *left) {
#if USE_3TAP_INTRA_FILTER
- filter_intra_predictors_3tap(dst, stride, bs, above, left, D153_PRED);
+ filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_D153_PRED);
#else
- filter_intra_predictors_4tap(dst, stride, bs, above, left, D153_PRED);
+ filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_D153_PRED);
#endif
}
void av1_d207_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
const uint8_t *above, const uint8_t *left) {
#if USE_3TAP_INTRA_FILTER
- filter_intra_predictors_3tap(dst, stride, bs, above, left, D207_PRED);
+ filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_D207_PRED);
#else
- filter_intra_predictors_4tap(dst, stride, bs, above, left, D207_PRED);
+ filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_D207_PRED);
#endif
}
void av1_d63_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
const uint8_t *above, const uint8_t *left) {
#if USE_3TAP_INTRA_FILTER
- filter_intra_predictors_3tap(dst, stride, bs, above, left, D63_PRED);
+ filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_D63_PRED);
#else
- filter_intra_predictors_4tap(dst, stride, bs, above, left, D63_PRED);
+ filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_D63_PRED);
#endif
}
void av1_tm_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
const uint8_t *above, const uint8_t *left) {
#if USE_3TAP_INTRA_FILTER
- filter_intra_predictors_3tap(dst, stride, bs, above, left, TM_PRED);
+ filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_TM_PRED);
#else
- filter_intra_predictors_4tap(dst, stride, bs, above, left, TM_PRED);
+ filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_TM_PRED);
#endif
}
@@ -1595,9 +1613,9 @@ static void highbd_filter_intra_predictors_3tap(uint16_t *dst, ptrdiff_t stride,
int preds[33][33];
#endif // CONFIG_TX64X64
const TX_SIZE tx_size = get_txsize_from_blocklen(bs);
- const int c0 = av1_filter_intra_taps_3[tx_size][mode][0];
- const int c1 = av1_filter_intra_taps_3[tx_size][mode][1];
- const int c2 = av1_filter_intra_taps_3[tx_size][mode][2];
+ const int c0 = filter_intra_taps_3[tx_size][mode][0];
+ const int c1 = filter_intra_taps_3[tx_size][mode][1];
+ const int c2 = filter_intra_taps_3[tx_size][mode][2];
k = 0;
mean = 0;
@@ -1617,13 +1635,12 @@ static void highbd_filter_intra_predictors_3tap(uint16_t *dst, ptrdiff_t stride,
ipred = c0 * preds[r - 1][c] + c1 * preds[r][c - 1] +
c2 * preds[r - 1][c - 1];
preds[r][c] = ROUND_POWER_OF_TWO_SIGNED(ipred, FILTER_INTRA_PREC_BITS);
+ preds[r][c] = clip_pixel_highbd(preds[r][c] + mean, bd) - mean;
}
for (r = 0; r < bs; ++r) {
- for (c = 0; c < bs; ++c) {
- ipred = preds[r + 1][c + 1] + mean;
- dst[c] = clip_pixel_highbd(ipred, bd);
- }
+ for (c = 0; c < bs; ++c)
+ dst[c] = clip_pixel_highbd(preds[r + 1][c + 1] + mean, bd);
dst += stride;
}
}
@@ -1640,10 +1657,10 @@ static void highbd_filter_intra_predictors_4tap(uint16_t *dst, ptrdiff_t stride,
int preds[33][65];
#endif // CONFIG_TX64X64
const TX_SIZE tx_size = get_txsize_from_blocklen(bs);
- const int c0 = av1_filter_intra_taps_4[tx_size][mode][0];
- const int c1 = av1_filter_intra_taps_4[tx_size][mode][1];
- const int c2 = av1_filter_intra_taps_4[tx_size][mode][2];
- const int c3 = av1_filter_intra_taps_4[tx_size][mode][3];
+ const int c0 = filter_intra_taps_4[tx_size][mode][0];
+ const int c1 = filter_intra_taps_4[tx_size][mode][1];
+ const int c2 = filter_intra_taps_4[tx_size][mode][2];
+ const int c3 = filter_intra_taps_4[tx_size][mode][3];
k = 0;
mean = 0;
@@ -1663,13 +1680,12 @@ static void highbd_filter_intra_predictors_4tap(uint16_t *dst, ptrdiff_t stride,
ipred = c0 * preds[r - 1][c] + c1 * preds[r][c - 1] +
c2 * preds[r - 1][c - 1] + c3 * preds[r - 1][c + 1];
preds[r][c] = ROUND_POWER_OF_TWO_SIGNED(ipred, FILTER_INTRA_PREC_BITS);
+ preds[r][c] = clip_pixel_highbd(preds[r][c] + mean, bd) - mean;
}
for (r = 0; r < bs; ++r) {
- for (c = 0; c < bs; ++c) {
- ipred = preds[r + 1][c + 1] + mean;
- dst[c] = clip_pixel_highbd(ipred, bd);
- }
+ for (c = 0; c < bs; ++c)
+ dst[c] = clip_pixel_highbd(preds[r + 1][c + 1] + mean, bd);
dst += stride;
}
}
@@ -1679,11 +1695,11 @@ void av1_highbd_dc_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
const uint16_t *above,
const uint16_t *left, int bd) {
#if USE_3TAP_INTRA_FILTER
- highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left, DC_PRED,
- bd);
+ highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
+ FILTER_DC_PRED, bd);
#else
- highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left, DC_PRED,
- bd);
+ highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
+ FILTER_DC_PRED, bd);
#endif
}
@@ -1691,9 +1707,11 @@ void av1_highbd_v_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
const uint16_t *above,
const uint16_t *left, int bd) {
#if USE_3TAP_INTRA_FILTER
- highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left, V_PRED, bd);
+ highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
+ FILTER_V_PRED, bd);
#else
- highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left, V_PRED, bd);
+ highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
+ FILTER_V_PRED, bd);
#endif
}
@@ -1701,9 +1719,11 @@ void av1_highbd_h_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
const uint16_t *above,
const uint16_t *left, int bd) {
#if USE_3TAP_INTRA_FILTER
- highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left, H_PRED, bd);
+ highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
+ FILTER_H_PRED, bd);
#else
- highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left, H_PRED, bd);
+ highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
+ FILTER_H_PRED, bd);
#endif
}
@@ -1711,11 +1731,11 @@ void av1_highbd_d45_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
const uint16_t *above,
const uint16_t *left, int bd) {
#if USE_3TAP_INTRA_FILTER
- highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left, D45_PRED,
- bd);
+ highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
+ FILTER_D45_PRED, bd);
#else
- highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left, D45_PRED,
- bd);
+ highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
+ FILTER_D45_PRED, bd);
#endif
}
@@ -1723,11 +1743,11 @@ void av1_highbd_d135_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
const uint16_t *above,
const uint16_t *left, int bd) {
#if USE_3TAP_INTRA_FILTER
- highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left, D135_PRED,
- bd);
+ highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
+ FILTER_D135_PRED, bd);
#else
- highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left, D135_PRED,
- bd);
+ highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
+ FILTER_D135_PRED, bd);
#endif
}
@@ -1735,11 +1755,11 @@ void av1_highbd_d117_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
const uint16_t *above,
const uint16_t *left, int bd) {
#if USE_3TAP_INTRA_FILTER
- highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left, D117_PRED,
- bd);
+ highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
+ FILTER_D117_PRED, bd);
#else
- highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left, D117_PRED,
- bd);
+ highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
+ FILTER_D117_PRED, bd);
#endif
}
@@ -1747,11 +1767,11 @@ void av1_highbd_d153_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
const uint16_t *above,
const uint16_t *left, int bd) {
#if USE_3TAP_INTRA_FILTER
- highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left, D153_PRED,
- bd);
+ highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
+ FILTER_D153_PRED, bd);
#else
- highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left, D153_PRED,
- bd);
+ highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
+ FILTER_D153_PRED, bd);
#endif
}
@@ -1759,11 +1779,11 @@ void av1_highbd_d207_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
const uint16_t *above,
const uint16_t *left, int bd) {
#if USE_3TAP_INTRA_FILTER
- highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left, D207_PRED,
- bd);
+ highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
+ FILTER_D207_PRED, bd);
#else
- highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left, D207_PRED,
- bd);
+ highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
+ FILTER_D207_PRED, bd);
#endif
}
@@ -1771,11 +1791,11 @@ void av1_highbd_d63_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
const uint16_t *above,
const uint16_t *left, int bd) {
#if USE_3TAP_INTRA_FILTER
- highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left, D63_PRED,
- bd);
+ highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
+ FILTER_D63_PRED, bd);
#else
- highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left, D63_PRED,
- bd);
+ highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
+ FILTER_D63_PRED, bd);
#endif
}
@@ -1783,11 +1803,11 @@ void av1_highbd_tm_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
const uint16_t *above,
const uint16_t *left, int bd) {
#if USE_3TAP_INTRA_FILTER
- highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left, TM_PRED,
- bd);
+ highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
+ FILTER_TM_PRED, bd);
#else
- highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left, TM_PRED,
- bd);
+ highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
+ FILTER_TM_PRED, bd);
#endif
}
@@ -1832,6 +1852,87 @@ static void highbd_filter_intra_predictors(FILTER_INTRA_MODE mode,
#endif // CONFIG_HIGHBITDEPTH
#endif // CONFIG_FILTER_INTRA
+#if CONFIG_INTRA_EDGE
+static int intra_edge_filter_strength(int bsz, int delta) {
+ const int d = abs(delta);
+ int strength = 0;
+
+ if (bsz == 8) {
+ if (d < 8) {
+ strength = 0;
+ } else if (d < 32) {
+ strength = 1;
+ } else if (d < 90) {
+ strength = 3;
+ }
+ } else if (bsz == 16) {
+ if (d < 4) {
+ strength = 0;
+ } else if (d < 16) {
+ strength = 1;
+ } else if (d < 90) {
+ strength = 3;
+ }
+ } else if (bsz == 32) {
+ if (d < 16) {
+ strength = 2;
+ } else if (d < 90) {
+ strength = 3;
+ }
+ }
+
+ return strength;
+}
+
+static void filter_intra_edge(uint8_t *p, int sz, int strength) {
+ if (!strength) return;
+
+ const int kernel[3][5] = {
+ { 0, 4, 8, 4, 0 }, { 0, 5, 6, 5, 0 }, { 2, 4, 4, 4, 2 }
+ };
+ const int filt = strength - 1;
+ uint8_t edge[129];
+
+ memcpy(edge, p, sz * sizeof(*p));
+ for (int i = 1; i < sz - 1; i++) {
+ int s = 0;
+ for (int j = 0; j < 5; j++) {
+ int k = i - 2 + j;
+ k = (k < 0) ? 0 : k;
+ k = (k > sz - 1) ? sz - 1 : k;
+ s += edge[k] * kernel[filt][j];
+ }
+ s = (s + 8) >> 4;
+ p[i] = s;
+ }
+}
+
+#if CONFIG_HIGHBITDEPTH
+static void filter_intra_edge_high(uint16_t *p, int sz, int strength) {
+ if (!strength) return;
+
+ const int kernel[3][5] = {
+ { 0, 4, 8, 4, 0 }, { 0, 5, 6, 5, 0 }, { 2, 4, 4, 4, 2 }
+ };
+ const int filt = strength - 1;
+ uint16_t edge[129];
+
+ memcpy(edge, p, sz * sizeof(*p));
+ for (int i = 1; i < sz - 1; i++) {
+ int s = 0;
+ for (int j = 0; j < 5; j++) {
+ int k = i - 2 + j;
+ k = (k < 0) ? 0 : k;
+ k = (k > sz - 1) ? sz - 1 : k;
+ s += edge[k] * kernel[filt][j];
+ }
+ s = (s + 8) >> 4;
+ p[i] = s;
+ }
+}
+#endif // CONFIG_INTRA_EDGE
+#endif // CONFIG_HIGHBITDEPTH
+
#if CONFIG_HIGHBITDEPTH
static void build_intra_predictors_high(
const MACROBLOCKD *xd, const uint8_t *ref8, int ref_stride, uint8_t *dst8,
@@ -1842,9 +1943,8 @@ static void build_intra_predictors_high(
uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
DECLARE_ALIGNED(16, uint16_t, left_data[MAX_TX_SIZE * 2 + 16]);
DECLARE_ALIGNED(16, uint16_t, above_data[MAX_TX_SIZE * 2 + 16]);
- uint16_t *above_row = above_data + 16;
- uint16_t *left_col = left_data + 16;
- const uint16_t *const_above_row = above_row;
+ uint16_t *const above_row = above_data + 16;
+ uint16_t *const left_col = left_data + 16;
const int bs = tx_size_wide[tx_size];
int need_left = extend_modes[mode] & NEED_LEFT;
int need_above = extend_modes[mode] & NEED_ABOVE;
@@ -1894,7 +1994,16 @@ static void build_intra_predictors_high(
assert(n_bottomleft_px >= 0);
if ((!need_above && n_left_px == 0) || (!need_left && n_top_px == 0)) {
+#if CONFIG_INTRA_EDGE
+ int val;
+ if (need_left) {
+ val = (n_top_px > 0) ? above_ref[0] : base + 1;
+ } else {
+ val = (n_left_px > 0) ? ref[-1] : base - 1;
+ }
+#else
const int val = need_left ? base + 1 : base - 1;
+#endif
for (i = 0; i < bs; ++i) {
aom_memset16(dst, val, bs);
dst += dst_stride;
@@ -1927,7 +2036,15 @@ static void build_intra_predictors_high(
if (i < (bs << need_bottom))
aom_memset16(&left_col[i], left_col[i - 1], (bs << need_bottom) - i);
} else {
- aom_memset16(left_col, base + 1, bs << need_bottom);
+#if CONFIG_INTRA_EDGE
+ if (n_top_px > 0) {
+ aom_memset16(left_col, above_ref[0], bs << need_bottom);
+ } else {
+#endif
+ aom_memset16(left_col, base + 1, bs << need_bottom);
+#if CONFIG_INTRA_EDGE
+ }
+#endif
}
}
@@ -1957,20 +2074,58 @@ static void build_intra_predictors_high(
if (i < (bs << need_right))
aom_memset16(&above_row[i], above_row[i - 1], (bs << need_right) - i);
} else {
- aom_memset16(above_row, base - 1, bs << need_right);
+#if CONFIG_INTRA_EDGE
+ if (n_left_px > 0) {
+ aom_memset16(above_row, ref[-1], bs << need_right);
+ } else {
+#endif
+ aom_memset16(above_row, base - 1, bs << need_right);
+#if CONFIG_INTRA_EDGE
+ }
+#endif
}
}
if (need_above_left) {
+#if CONFIG_INTRA_EDGE
+ if (n_top_px > 0 && n_left_px > 0) {
+ above_row[-1] = above_ref[-1];
+ } else if (n_top_px > 0) {
+ above_row[-1] = above_ref[0];
+ } else if (n_left_px > 0) {
+ above_row[-1] = ref[-1];
+ } else {
+ above_row[-1] = base;
+ }
+#else
above_row[-1] =
n_top_px > 0 ? (n_left_px > 0 ? above_ref[-1] : base + 1) : base - 1;
+#endif
left_col[-1] = above_row[-1];
}
+#if CONFIG_EXT_INTRA && CONFIG_INTRA_EDGE
+ if (is_dr_mode && p_angle != 90 && p_angle != 180) {
+ const int ab_le = need_above_left ? 1 : 0;
+ if (need_above && n_top_px > 0) {
+ const int strength = intra_edge_filter_strength(bs, p_angle - 90);
+ const int need_right = p_angle < 90;
+ const int n_px = n_top_px + ab_le + (need_right ? n_topright_px : 0);
+ filter_intra_edge_high(above_row - ab_le, n_px, strength);
+ }
+ if (need_left && n_left_px > 0) {
+ const int strength = intra_edge_filter_strength(bs, p_angle - 180);
+ const int need_bottom = p_angle > 180;
+ const int n_px = n_left_px + ab_le + (need_bottom ? n_bottomleft_px : 0);
+ filter_intra_edge_high(left_col - ab_le, n_px, strength);
+ }
+ }
+#endif
+
#if CONFIG_FILTER_INTRA
if (filter_intra_mode_info->use_filter_intra_mode[plane != 0]) {
highbd_filter_intra_predictors(filter_intra_mode, dst, dst_stride, bs,
- const_above_row, left_col, xd->bd);
+ above_row, left_col, xd->bd);
return;
}
#endif // CONFIG_FILTER_INTRA
@@ -1982,7 +2137,7 @@ static void build_intra_predictors_high(
if (plane == 0 && av1_is_intra_filter_switchable(p_angle))
filter = xd->mi[0]->mbmi.intra_filter;
#endif // CONFIG_INTRA_INTERP
- highbd_dr_predictor(dst, dst_stride, bs, const_above_row, left_col,
+ highbd_dr_predictor(dst, dst_stride, bs, above_row, left_col,
#if CONFIG_INTRA_INTERP
filter,
#endif // CONFIG_INTRA_INTERP
@@ -1994,10 +2149,9 @@ static void build_intra_predictors_high(
// predict
if (mode == DC_PRED) {
dc_pred_high[n_left_px > 0][n_top_px > 0][tx_size](
- dst, dst_stride, const_above_row, left_col, xd->bd);
+ dst, dst_stride, above_row, left_col, xd->bd);
} else {
- pred_high[mode][tx_size](dst, dst_stride, const_above_row, left_col,
- xd->bd);
+ pred_high[mode][tx_size](dst, dst_stride, above_row, left_col, xd->bd);
}
}
#endif // CONFIG_HIGHBITDEPTH
@@ -2012,9 +2166,8 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
const uint8_t *above_ref = ref - ref_stride;
DECLARE_ALIGNED(16, uint8_t, left_data[MAX_TX_SIZE * 2 + 16]);
DECLARE_ALIGNED(16, uint8_t, above_data[MAX_TX_SIZE * 2 + 16]);
- uint8_t *above_row = above_data + 16;
- uint8_t *left_col = left_data + 16;
- const uint8_t *const_above_row = above_row;
+ uint8_t *const above_row = above_data + 16;
+ uint8_t *const left_col = left_data + 16;
const int bs = tx_size_wide[tx_size];
int need_left = extend_modes[mode] & NEED_LEFT;
int need_above = extend_modes[mode] & NEED_ABOVE;
@@ -2065,7 +2218,16 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
assert(n_bottomleft_px >= 0);
if ((!need_above && n_left_px == 0) || (!need_left && n_top_px == 0)) {
+#if CONFIG_INTRA_EDGE
+ int val;
+ if (need_left) {
+ val = (n_top_px > 0) ? above_ref[0] : 129;
+ } else {
+ val = (n_left_px > 0) ? ref[-1] : 127;
+ }
+#else
const int val = need_left ? 129 : 127;
+#endif
for (i = 0; i < bs; ++i) {
memset(dst, val, bs);
dst += dst_stride;
@@ -2098,7 +2260,15 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
if (i < (bs << need_bottom))
memset(&left_col[i], left_col[i - 1], (bs << need_bottom) - i);
} else {
- memset(left_col, 129, bs << need_bottom);
+#if CONFIG_INTRA_EDGE
+ if (n_top_px > 0) {
+ memset(left_col, above_ref[0], bs << need_bottom);
+ } else {
+#endif
+ memset(left_col, 129, bs << need_bottom);
+#if CONFIG_INTRA_EDGE
+ }
+#endif
}
}
@@ -2127,19 +2297,57 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
if (i < (bs << need_right))
memset(&above_row[i], above_row[i - 1], (bs << need_right) - i);
} else {
- memset(above_row, 127, bs << need_right);
+#if CONFIG_INTRA_EDGE
+ if (n_left_px > 0) {
+ memset(above_row, ref[-1], bs << need_right);
+ } else {
+#endif
+ memset(above_row, 127, bs << need_right);
+#if CONFIG_INTRA_EDGE
+ }
+#endif
}
}
if (need_above_left) {
+#if CONFIG_INTRA_EDGE
+ if (n_top_px > 0 && n_left_px > 0) {
+ above_row[-1] = above_ref[-1];
+ } else if (n_top_px > 0) {
+ above_row[-1] = above_ref[0];
+ } else if (n_left_px > 0) {
+ above_row[-1] = ref[-1];
+ } else {
+ above_row[-1] = 128;
+ }
+#else
above_row[-1] = n_top_px > 0 ? (n_left_px > 0 ? above_ref[-1] : 129) : 127;
+#endif
left_col[-1] = above_row[-1];
}
+#if CONFIG_EXT_INTRA && CONFIG_INTRA_EDGE
+ if (is_dr_mode && p_angle != 90 && p_angle != 180) {
+ const int ab_le = need_above_left ? 1 : 0;
+ if (need_above && n_top_px > 0) {
+ const int strength = intra_edge_filter_strength(bs, p_angle - 90);
+ const int need_right = p_angle < 90;
+ const int n_px = n_top_px + ab_le + (need_right ? n_topright_px : 0);
+ filter_intra_edge(above_row - ab_le, n_px, strength);
+ }
+ if (need_left && n_left_px > 0) {
+ const int strength = intra_edge_filter_strength(bs, p_angle - 180);
+ const int need_bottom = p_angle > 180;
+ const int n_px = n_left_px + ab_le + (need_bottom ? n_bottomleft_px : 0);
+ filter_intra_edge(left_col - ab_le, n_px, strength);
+ }
+ }
+#endif
+
#if CONFIG_FILTER_INTRA
if (filter_intra_mode_info->use_filter_intra_mode[plane != 0]) {
- filter_intra_predictors(filter_intra_mode, dst, dst_stride, bs,
- const_above_row, left_col);
+ filter_intra_predictors(filter_intra_mode, dst, dst_stride, bs, above_row,
+ left_col);
return;
}
#endif // CONFIG_FILTER_INTRA
@@ -2150,7 +2358,7 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
if (plane == 0 && av1_is_intra_filter_switchable(p_angle))
filter = xd->mi[0]->mbmi.intra_filter;
#endif // CONFIG_INTRA_INTERP
- dr_predictor(dst, dst_stride, tx_size, const_above_row, left_col,
+ dr_predictor(dst, dst_stride, tx_size, above_row, left_col,
#if CONFIG_INTRA_INTERP
filter,
#endif // CONFIG_INTRA_INTERP
@@ -2165,14 +2373,14 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
// CFL predict its own DC_PRED for Chromatic planes
if (plane == AOM_PLANE_Y) {
#endif
- dc_pred[n_left_px > 0][n_top_px > 0][tx_size](dst, dst_stride,
- const_above_row, left_col);
+ dc_pred[n_left_px > 0][n_top_px > 0][tx_size](dst, dst_stride, above_row,
+ left_col);
#if CONFIG_CFL
}
#endif
} else {
- pred[mode][tx_size](dst, dst_stride, const_above_row, left_col);
+ pred[mode][tx_size](dst, dst_stride, above_row, left_col);
}
}
@@ -2216,9 +2424,9 @@ static void predict_square_intra_block(const MACROBLOCKD *xd, int wpx, int hpx,
// the frame bottom edge
const int yd = (xd->mb_to_bottom_edge >> (3 + pd->subsampling_y)) +
(hpx - y - txhpx) - yd_chr_offset;
- const int right_available =
- (mi_col + ((col_off + txw) >> (1 - pd->subsampling_x))) <
- xd->tile.mi_col_end;
+ const int right_available = mi_col + ((col_off + txw) << pd->subsampling_x >>
+ (MI_SIZE_LOG2 - tx_size_wide_log2[0])) <
+ xd->tile.mi_col_end;
const int bottom_available = (yd > 0);
#if CONFIG_EXT_PARTITION_TYPES
const PARTITION_TYPE partition = xd->mi[0]->mbmi.partition;
@@ -2246,30 +2454,27 @@ static void predict_square_intra_block(const MACROBLOCKD *xd, int wpx, int hpx,
const int stride = wpx;
int r, c;
const uint8_t *const map = xd->plane[plane != 0].color_index_map;
-#if CONFIG_HIGHBITDEPTH
uint16_t *palette = xd->mi[0]->mbmi.palette_mode_info.palette_colors +
plane * PALETTE_MAX_SIZE;
-#else
- uint8_t *palette = xd->mi[0]->mbmi.palette_mode_info.palette_colors +
- plane * PALETTE_MAX_SIZE;
-#endif // CONFIG_HIGHBITDEPTH
#if CONFIG_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
uint16_t *dst16 = CONVERT_TO_SHORTPTR(dst);
- for (r = 0; r < bs; ++r)
- for (c = 0; c < bs; ++c)
+ for (r = 0; r < bs; ++r) {
+ for (c = 0; c < bs; ++c) {
dst16[r * dst_stride + c] = palette[map[(r + y) * stride + c + x]];
+ }
+ }
} else {
- for (r = 0; r < bs; ++r)
- for (c = 0; c < bs; ++c)
+#endif // CONFIG_HIGHBITDEPTH
+ for (r = 0; r < bs; ++r) {
+ for (c = 0; c < bs; ++c) {
dst[r * dst_stride + c] =
- (uint8_t)(palette[map[(r + y) * stride + c + x]]);
+ (uint8_t)palette[map[(r + y) * stride + c + x]];
+ }
+ }
+#if CONFIG_HIGHBITDEPTH
}
-#else
- for (r = 0; r < bs; ++r)
- for (c = 0; c < bs; ++c)
- dst[r * dst_stride + c] = palette[map[(r + y) * stride + c + x]];
#endif // CONFIG_HIGHBITDEPTH
return;
}
@@ -2316,8 +2521,12 @@ void av1_predict_intra_block_facade(MACROBLOCKD *xd, int plane, int block_idx,
// is signaled.
cfl_dc_pred(xd, get_plane_block_size(block_idx, pd), tx_size);
}
- cfl_predict_block(xd->cfl, dst, pd->dst.stride, blk_row, blk_col, tx_size,
- xd->cfl->dc_pred[plane - 1]);
+
+ cfl_predict_block(
+ xd->cfl, dst, pd->dst.stride, blk_row, blk_col, tx_size,
+ xd->cfl->dc_pred[plane - 1],
+ cfl_idx_to_alpha(mbmi->cfl_alpha_idx, mbmi->cfl_alpha_signs[plane - 1],
+ plane - 1));
}
#endif
}
diff --git a/third_party/aom/av1/common/reconintra.h b/third_party/aom/av1/common/reconintra.h
index 7ee0c495e..fbcb7f9b4 100644
--- a/third_party/aom/av1/common/reconintra.h
+++ b/third_party/aom/av1/common/reconintra.h
@@ -19,6 +19,20 @@
extern "C" {
#endif
+#if CONFIG_DPCM_INTRA
+static INLINE int av1_use_dpcm_intra(int plane, PREDICTION_MODE mode,
+ TX_TYPE tx_type,
+ const MB_MODE_INFO *const mbmi) {
+ (void)mbmi;
+ (void)plane;
+#if CONFIG_EXT_INTRA
+ if (mbmi->sb_type >= BLOCK_8X8 && mbmi->angle_delta[plane != 0]) return 0;
+#endif // CONFIG_EXT_INTRA
+ return (mode == V_PRED && (tx_type == IDTX || tx_type == H_DCT)) ||
+ (mode == H_PRED && (tx_type == IDTX || tx_type == V_DCT));
+}
+#endif // CONFIG_DPCM_INTRA
+
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);
@@ -27,30 +41,36 @@ void av1_predict_intra_block(const MACROBLOCKD *xd, int bw, int bh,
const uint8_t *ref, int ref_stride, uint8_t *dst,
int dst_stride, int aoff, int loff, int plane);
-#if CONFIG_EXT_INTER
+#if CONFIG_EXT_INTER && CONFIG_INTERINTRA
// 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
+ DC_PRED, V_PRED, H_PRED,
+#if CONFIG_ALT_INTRA
+ SMOOTH_PRED
+#else
+ TM_PRED
+#endif
};
// 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,
+ II_DC_PRED, II_V_PRED, II_H_PRED, II_V_PRED,
+#if CONFIG_ALT_INTRA
+ II_SMOOTH_PRED,
+#else
+ II_TM_PRED,
+#endif
+ II_V_PRED, II_H_PRED, II_H_PRED, II_V_PRED,
#if CONFIG_ALT_INTRA
- II_DC_PRED, // Note: Filler value, as there's no II_SMOOTH_PRED.
-#endif // CONFIG_ALT_INTRA
+ II_SMOOTH_PRED, II_SMOOTH_PRED
+#else
II_TM_PRED
-};
-#endif // CONFIG_EXT_INTER
-#ifdef __cplusplus
-} // extern "C"
#endif
+};
+#endif // CONFIG_EXT_INTER && CONFIG_INTERINTRA
#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
@@ -59,9 +79,15 @@ static INLINE int av1_is_directional_mode(PREDICTION_MODE mode,
return mode != DC_PRED && mode != TM_PRED &&
#if CONFIG_ALT_INTRA
mode != SMOOTH_PRED &&
+#if CONFIG_SMOOTH_HV
+ mode != SMOOTH_V_PRED && mode != SMOOTH_H_PRED &&
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
bsize >= BLOCK_8X8;
}
#endif // CONFIG_EXT_INTRA
+#ifdef __cplusplus
+} // extern "C"
+#endif
#endif // AV1_COMMON_RECONINTRA_H_
diff --git a/third_party/aom/av1/common/resize.c b/third_party/aom/av1/common/resize.c
index 8c0d3aa09..f6fdec769 100644
--- a/third_party/aom/av1/common/resize.c
+++ b/third_party/aom/av1/common/resize.c
@@ -21,20 +21,23 @@
#include "aom_dsp/aom_dsp_common.h"
#endif // CONFIG_HIGHBITDEPTH
#include "aom_ports/mem.h"
+#include "aom_scale/aom_scale.h"
#include "av1/common/common.h"
#include "av1/common/resize.h"
+#include "./aom_scale_rtcd.h"
+
#define FILTER_BITS 7
#define INTERP_TAPS 8
-#define SUBPEL_BITS 5
-#define SUBPEL_MASK ((1 << SUBPEL_BITS) - 1)
+#define SUBPEL_BITS_RS 5
+#define SUBPEL_MASK_RS ((1 << SUBPEL_BITS_RS) - 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)] = {
+static const interp_kernel filteredinterp_filters500[(1 << SUBPEL_BITS_RS)] = {
{ -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 },
@@ -54,7 +57,7 @@ static const interp_kernel filteredinterp_filters500[(1 << SUBPEL_BITS)] = {
};
// Filters for interpolation (0.625-band) - note this also filters integer pels.
-static const interp_kernel filteredinterp_filters625[(1 << SUBPEL_BITS)] = {
+static const interp_kernel filteredinterp_filters625[(1 << SUBPEL_BITS_RS)] = {
{ -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 },
@@ -74,7 +77,7 @@ static const interp_kernel filteredinterp_filters625[(1 << SUBPEL_BITS)] = {
};
// Filters for interpolation (0.75-band) - note this also filters integer pels.
-static const interp_kernel filteredinterp_filters750[(1 << SUBPEL_BITS)] = {
+static const interp_kernel filteredinterp_filters750[(1 << SUBPEL_BITS_RS)] = {
{ 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 },
@@ -94,7 +97,7 @@ static const interp_kernel filteredinterp_filters750[(1 << SUBPEL_BITS)] = {
};
// Filters for interpolation (0.875-band) - note this also filters integer pels.
-static const interp_kernel filteredinterp_filters875[(1 << SUBPEL_BITS)] = {
+static const interp_kernel filteredinterp_filters875[(1 << SUBPEL_BITS_RS)] = {
{ 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 },
@@ -114,7 +117,7 @@ static const interp_kernel filteredinterp_filters875[(1 << SUBPEL_BITS)] = {
};
// Filters for interpolation (full-band) - no filtering for integer pixels
-static const interp_kernel filteredinterp_filters1000[(1 << SUBPEL_BITS)] = {
+static const interp_kernel filteredinterp_filters1000[(1 << SUBPEL_BITS_RS)] = {
{ 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 },
@@ -187,13 +190,13 @@ static void interpolate(const uint8_t *const input, int inlength,
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;
+ sub_pel =
+ (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS_RS)) & SUBPEL_MASK_RS;
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))];
+ sum += filter[k] * input[AOMMAX(AOMMIN(pk, inlength - 1), 0)];
}
*optr++ = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
}
@@ -202,20 +205,20 @@ static void interpolate(const uint8_t *const input, int inlength,
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;
+ sub_pel =
+ (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS_RS)) & SUBPEL_MASK_RS;
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)];
+ sum += filter[k] * input[AOMMAX(int_pel - INTERP_TAPS / 2 + 1 + k, 0)];
*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;
+ sub_pel =
+ (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS_RS)) & SUBPEL_MASK_RS;
filter = interp_filters[sub_pel];
sum = 0;
for (k = 0; k < INTERP_TAPS; ++k)
@@ -226,18 +229,19 @@ static void interpolate(const uint8_t *const input, int inlength,
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;
+ sub_pel =
+ (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS_RS)) & SUBPEL_MASK_RS;
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)];
+ sum += filter[k] *
+ input[AOMMIN(int_pel - INTERP_TAPS / 2 + 1 + k, inlength - 1)];
*optr++ = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
}
}
}
+#ifndef __clang_analyzer__
static void down2_symeven(const uint8_t *const input, int length,
uint8_t *output) {
// Actual filter len = 2 * filter_len_half.
@@ -254,9 +258,9 @@ static void down2_symeven(const uint8_t *const input, int 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 +=
+ (input[AOMMAX(i - j, 0)] + input[AOMMIN(i + 1 + j, length - 1)]) *
+ filter[j];
}
sum >>= FILTER_BITS;
*optr++ = clip_pixel(sum);
@@ -266,7 +270,7 @@ static void down2_symeven(const uint8_t *const input, int length,
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 += (input[AOMMAX(i - j, 0)] + input[i + 1 + j]) * filter[j];
}
sum >>= FILTER_BITS;
*optr++ = clip_pixel(sum);
@@ -284,15 +288,15 @@ static void down2_symeven(const uint8_t *const input, int length,
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 +=
+ (input[i - j] + input[AOMMIN(i + 1 + j, length - 1)]) * filter[j];
}
sum >>= FILTER_BITS;
*optr++ = clip_pixel(sum);
}
}
}
+#endif
static void down2_symodd(const uint8_t *const input, int length,
uint8_t *output) {
@@ -367,22 +371,19 @@ static int get_down2_steps(int in_length, int out_length) {
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);
+ const int 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) {
+ uint8_t *otmp2 = otmp + get_down2_length(length, 1);
+ for (int 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)
@@ -426,8 +427,7 @@ void av1_resize_plane(const uint8_t *const input, int height, int width,
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 *tmpbuf = (uint8_t *)malloc(sizeof(uint8_t) * AOMMAX(width, height));
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)
@@ -489,13 +489,13 @@ static void highbd_interpolate(const uint16_t *const input, int inlength,
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;
+ sub_pel =
+ (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS_RS)) & SUBPEL_MASK_RS;
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))];
+ sum += filter[k] * input[AOMMAX(AOMMIN(pk, inlength - 1), 0)];
}
*optr++ = clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd);
}
@@ -504,20 +504,20 @@ static void highbd_interpolate(const uint16_t *const input, int inlength,
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;
+ sub_pel =
+ (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS_RS)) & SUBPEL_MASK_RS;
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)];
+ sum += filter[k] * input[AOMMAX(int_pel - INTERP_TAPS / 2 + 1 + k, 0)];
*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;
+ sub_pel =
+ (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS_RS)) & SUBPEL_MASK_RS;
filter = interp_filters[sub_pel];
sum = 0;
for (k = 0; k < INTERP_TAPS; ++k)
@@ -528,18 +528,18 @@ static void highbd_interpolate(const uint16_t *const input, int inlength,
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;
+ sub_pel =
+ (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS_RS)) & SUBPEL_MASK_RS;
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)];
+ sum += filter[k] *
+ input[AOMMIN(int_pel - INTERP_TAPS / 2 + 1 + k, inlength - 1)];
*optr++ = clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd);
}
}
}
-
+#ifndef __clang_analyzer__
static void highbd_down2_symeven(const uint16_t *const input, int length,
uint16_t *output, int bd) {
// Actual filter len = 2 * filter_len_half.
@@ -556,9 +556,9 @@ static void highbd_down2_symeven(const uint16_t *const input, int 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 +=
+ (input[AOMMAX(0, i - j)] + input[AOMMIN(i + 1 + j, length - 1)]) *
+ filter[j];
}
sum >>= FILTER_BITS;
*optr++ = clip_pixel_highbd(sum, bd);
@@ -568,7 +568,7 @@ static void highbd_down2_symeven(const uint16_t *const input, int length,
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 += (input[AOMMAX(0, i - j)] + input[i + 1 + j]) * filter[j];
}
sum >>= FILTER_BITS;
*optr++ = clip_pixel_highbd(sum, bd);
@@ -586,9 +586,8 @@ static void highbd_down2_symeven(const uint16_t *const input, int length,
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 +=
+ (input[i - j] + input[AOMMIN(i + 1 + j, length - 1)]) * filter[j];
}
sum >>= FILTER_BITS;
*optr++ = clip_pixel_highbd(sum, bd);
@@ -612,8 +611,7 @@ static void highbd_down2_symodd(const uint16_t *const input, int 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)]) *
+ sum += (input[AOMMAX(i - j, 0)] + input[AOMMIN(i + j, length - 1)]) *
filter[j];
}
sum >>= FILTER_BITS;
@@ -624,7 +622,7 @@ static void highbd_down2_symodd(const uint16_t *const input, int length,
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 += (input[AOMMAX(i - j, 0)] + input[i + j]) * filter[j];
}
sum >>= FILTER_BITS;
*optr++ = clip_pixel_highbd(sum, bd);
@@ -642,34 +640,31 @@ static void highbd_down2_symodd(const uint16_t *const input, int length,
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 += (input[i - j] + input[AOMMIN(i + j, length - 1)]) * filter[j];
}
sum >>= FILTER_BITS;
*optr++ = clip_pixel_highbd(sum, bd);
}
}
}
+#endif
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);
+ const int 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) {
+ uint16_t *otmp2 = otmp + get_down2_length(length, 1);
+ for (int 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)
@@ -716,7 +711,7 @@ void av1_highbd_resize_plane(const uint8_t *const input, int height, int width,
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 *)malloc(sizeof(uint16_t) * AOMMAX(width, height));
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)
@@ -819,3 +814,69 @@ void av1_highbd_resize_frame444(const uint8_t *const y, int y_stride,
ouv_stride, bd);
}
#endif // CONFIG_HIGHBITDEPTH
+
+#if CONFIG_HIGHBITDEPTH
+static void resize_and_extend_frame(const YV12_BUFFER_CONFIG *src,
+ YV12_BUFFER_CONFIG *dst, int bd) {
+#else
+static void resize_and_extend_frame(const YV12_BUFFER_CONFIG *src,
+ YV12_BUFFER_CONFIG *dst) {
+#endif // CONFIG_HIGHBITDEPTH
+ // TODO(dkovalev): replace YV12_BUFFER_CONFIG with aom_image_t
+ int i;
+ const uint8_t *const srcs[3] = { src->y_buffer, src->u_buffer,
+ src->v_buffer };
+ const int src_strides[3] = { src->y_stride, src->uv_stride, src->uv_stride };
+ const int src_widths[3] = { src->y_crop_width, src->uv_crop_width,
+ src->uv_crop_width };
+ const int src_heights[3] = { src->y_crop_height, src->uv_crop_height,
+ src->uv_crop_height };
+ uint8_t *const dsts[3] = { dst->y_buffer, dst->u_buffer, dst->v_buffer };
+ const int dst_strides[3] = { dst->y_stride, dst->uv_stride, dst->uv_stride };
+ const int dst_widths[3] = { dst->y_crop_width, dst->uv_crop_width,
+ dst->uv_crop_width };
+ const int dst_heights[3] = { dst->y_crop_height, dst->uv_crop_height,
+ dst->uv_crop_height };
+
+ for (i = 0; i < MAX_MB_PLANE; ++i) {
+#if CONFIG_HIGHBITDEPTH
+ if (src->flags & YV12_FLAG_HIGHBITDEPTH)
+ av1_highbd_resize_plane(srcs[i], src_heights[i], src_widths[i],
+ src_strides[i], dsts[i], dst_heights[i],
+ dst_widths[i], dst_strides[i], bd);
+ else
+#endif // CONFIG_HIGHBITDEPTH
+ av1_resize_plane(srcs[i], src_heights[i], src_widths[i], src_strides[i],
+ dsts[i], dst_heights[i], dst_widths[i], dst_strides[i]);
+ }
+ aom_extend_frame_borders(dst);
+}
+
+YV12_BUFFER_CONFIG *av1_scale_if_required_fast(AV1_COMMON *cm,
+ YV12_BUFFER_CONFIG *unscaled,
+ YV12_BUFFER_CONFIG *scaled) {
+ if (cm->mi_cols * MI_SIZE != unscaled->y_width ||
+ cm->mi_rows * MI_SIZE != unscaled->y_height) {
+ // For 2x2 scaling down.
+ aom_scale_frame(unscaled, scaled, unscaled->y_buffer, 9, 2, 1, 2, 1, 0);
+ aom_extend_frame_borders(scaled);
+ return scaled;
+ } else {
+ return unscaled;
+ }
+}
+
+YV12_BUFFER_CONFIG *av1_scale_if_required(AV1_COMMON *cm,
+ YV12_BUFFER_CONFIG *unscaled,
+ YV12_BUFFER_CONFIG *scaled) {
+ if (cm->width != unscaled->y_width || cm->height != unscaled->y_height) {
+#if CONFIG_HIGHBITDEPTH
+ resize_and_extend_frame(unscaled, scaled, (int)cm->bit_depth);
+#else
+ resize_and_extend_frame(unscaled, scaled);
+#endif // CONFIG_HIGHBITDEPTH
+ return scaled;
+ } else {
+ return unscaled;
+ }
+}
diff --git a/third_party/aom/av1/common/resize.h b/third_party/aom/av1/common/resize.h
index 959cda969..9bdba3309 100644
--- a/third_party/aom/av1/common/resize.h
+++ b/third_party/aom/av1/common/resize.h
@@ -14,6 +14,7 @@
#include <stdio.h>
#include "aom/aom_integer.h"
+#include "av1/common/onyxc_int.h"
#ifdef __cplusplus
extern "C" {
@@ -62,6 +63,14 @@ void av1_highbd_resize_frame444(const uint8_t *const y, int y_stride,
int owidth, int bd);
#endif // CONFIG_HIGHBITDEPTH
+YV12_BUFFER_CONFIG *av1_scale_if_required_fast(AV1_COMMON *cm,
+ YV12_BUFFER_CONFIG *unscaled,
+ YV12_BUFFER_CONFIG *scaled);
+
+YV12_BUFFER_CONFIG *av1_scale_if_required(AV1_COMMON *cm,
+ YV12_BUFFER_CONFIG *unscaled,
+ YV12_BUFFER_CONFIG *scaled);
+
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/third_party/aom/av1/common/restoration.c b/third_party/aom/av1/common/restoration.c
index b7ed9f98b..441309348 100644
--- a/third_party/aom/av1/common/restoration.c
+++ b/third_party/aom/av1/common/restoration.c
@@ -160,9 +160,16 @@ static void loop_wiener_filter_tile(uint8_t *data, int tile_idx, int width,
int h = AOMMIN(MAX_SB_SIZE, (v_end - i + 15) & ~15);
const uint8_t *data_p = data + i * stride + j;
uint8_t *dst_p = dst + i * dst_stride + j;
+#if USE_WIENER_HIGH_INTERMEDIATE_PRECISION
+ aom_convolve8_add_src_hip(data_p, stride, dst_p, dst_stride,
+ rst->rsi->wiener_info[tile_idx].hfilter, 16,
+ rst->rsi->wiener_info[tile_idx].vfilter, 16, w,
+ h);
+#else
aom_convolve8_add_src(data_p, stride, dst_p, dst_stride,
rst->rsi->wiener_info[tile_idx].hfilter, 16,
rst->rsi->wiener_info[tile_idx].vfilter, 16, w, h);
+#endif // USE_WIENER_HIGH_INTERMEDIATE_PRECISION
}
}
@@ -992,10 +999,17 @@ static void loop_wiener_filter_tile_highbd(uint16_t *data, int tile_idx,
int h = AOMMIN(MAX_SB_SIZE, (v_end - i + 15) & ~15);
const uint16_t *data_p = data + i * stride + j;
uint16_t *dst_p = dst + i * dst_stride + j;
+#if USE_WIENER_HIGH_INTERMEDIATE_PRECISION
+ aom_highbd_convolve8_add_src_hip(
+ CONVERT_TO_BYTEPTR(data_p), stride, CONVERT_TO_BYTEPTR(dst_p),
+ dst_stride, rst->rsi->wiener_info[tile_idx].hfilter, 16,
+ rst->rsi->wiener_info[tile_idx].vfilter, 16, w, h, bit_depth);
+#else
aom_highbd_convolve8_add_src(
CONVERT_TO_BYTEPTR(data_p), stride, CONVERT_TO_BYTEPTR(dst_p),
dst_stride, rst->rsi->wiener_info[tile_idx].hfilter, 16,
rst->rsi->wiener_info[tile_idx].vfilter, 16, w, h, bit_depth);
+#endif // USE_WIENER_HIGH_INTERMEDIATE_PRECISION
}
}
diff --git a/third_party/aom/av1/common/restoration.h b/third_party/aom/av1/common/restoration.h
index 866f78b79..477f20a42 100644
--- a/third_party/aom/av1/common/restoration.h
+++ b/third_party/aom/av1/common/restoration.h
@@ -81,10 +81,17 @@ extern "C" {
#define WIENER_FILT_PREC_BITS 7
#define WIENER_FILT_STEP (1 << WIENER_FILT_PREC_BITS)
+// Whether to use high intermediate precision filtering
+#define USE_WIENER_HIGH_INTERMEDIATE_PRECISION 1
+
// 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_TAP3_MIDV \
+ (WIENER_FILT_STEP - \
+ 2 * (WIENER_FILT_TAP0_MIDV + WIENER_FILT_TAP1_MIDV + \
+ WIENER_FILT_TAP2_MIDV))
#define WIENER_FILT_TAP0_BITS 4
#define WIENER_FILT_TAP1_BITS 5
diff --git a/third_party/aom/av1/common/scan.c b/third_party/aom/av1/common/scan.c
index 9ad6c0b2f..a0881a9b7 100644
--- a/third_party/aom/av1/common/scan.c
+++ b/third_party/aom/av1/common/scan.c
@@ -14,7 +14,7 @@
#include "av1/common/common_data.h"
#include "av1/common/scan.h"
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
DECLARE_ALIGNED(16, static const int16_t, default_scan_2x2[4]) = {
0, 1, 2, 3,
};
@@ -73,17 +73,17 @@ DECLARE_ALIGNED(16, static const int16_t, mrow_scan_8x4[32]) = {
};
DECLARE_ALIGNED(16, static const int16_t, default_scan_4x16[64]) = {
- 0, 1, 4, 2, 5, 8, 3, 6, 9, 12, 7, 10, 13, 16, 11, 14,
- 17, 20, 15, 18, 21, 24, 19, 22, 25, 28, 23, 26, 29, 32, 27, 30,
- 33, 36, 31, 34, 37, 40, 35, 38, 41, 44, 39, 42, 45, 48, 43, 46,
- 49, 52, 47, 50, 53, 56, 51, 54, 57, 60, 55, 58, 61, 59, 62, 63,
+ 0, 1, 4, 5, 2, 8, 6, 9, 10, 3, 12, 7, 13, 11, 14, 16,
+ 17, 15, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
};
DECLARE_ALIGNED(16, static const int16_t, default_scan_16x4[64]) = {
- 0, 1, 16, 2, 17, 32, 3, 18, 33, 48, 4, 19, 34, 49, 5, 20,
- 35, 50, 6, 21, 36, 51, 7, 22, 37, 52, 8, 23, 38, 53, 9, 24,
- 39, 54, 10, 25, 40, 55, 11, 26, 41, 56, 12, 27, 42, 57, 13, 28,
- 43, 58, 14, 29, 44, 59, 15, 30, 45, 60, 31, 46, 61, 47, 62, 63,
+ 0, 1, 16, 17, 2, 32, 18, 33, 34, 3, 48, 19, 49, 35, 50, 4,
+ 20, 51, 36, 5, 52, 21, 37, 53, 6, 22, 38, 54, 7, 23, 39, 55,
+ 8, 24, 40, 56, 9, 25, 41, 57, 10, 26, 42, 58, 11, 27, 43, 59,
+ 12, 28, 44, 60, 13, 29, 45, 61, 14, 30, 46, 62, 15, 31, 47, 63,
};
#if CONFIG_EXT_TX
@@ -1491,7 +1491,7 @@ DECLARE_ALIGNED(16, static const int16_t, default_scan_64x64[4096]) = {
};
#endif // CONFIG_TX64X64
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
DECLARE_ALIGNED(16, static const int16_t,
default_scan_2x2_neighbors[5 * MAX_NEIGHBORS]) = {
0, 0, 0, 0, 0, 1, 1, 2, 0, 0,
@@ -1582,36 +1582,36 @@ DECLARE_ALIGNED(16, static const int16_t,
DECLARE_ALIGNED(16, static const int16_t,
default_scan_4x16_neighbors[65 * MAX_NEIGHBORS]) = {
- 0, 0, 0, 0, 0, 0, 1, 1, 1, 4, 4, 4, 2, 2, 2, 5, 5, 8, 8,
- 8, 3, 6, 6, 9, 9, 12, 12, 12, 7, 10, 10, 13, 13, 16, 16, 16, 11, 14,
- 14, 17, 17, 20, 20, 20, 15, 18, 18, 21, 21, 24, 24, 24, 19, 22, 22, 25, 25,
- 28, 28, 28, 23, 26, 26, 29, 29, 32, 32, 32, 27, 30, 30, 33, 33, 36, 36, 36,
- 31, 34, 34, 37, 37, 40, 40, 40, 35, 38, 38, 41, 41, 44, 44, 44, 39, 42, 42,
- 45, 45, 48, 48, 48, 43, 46, 46, 49, 49, 52, 52, 52, 47, 50, 50, 53, 53, 56,
- 56, 56, 51, 54, 54, 57, 57, 60, 55, 58, 58, 61, 59, 62, 0, 0
+ 0, 0, 0, 0, 0, 0, 1, 4, 1, 1, 4, 4, 2, 5, 5, 8, 6, 9, 2,
+ 2, 8, 8, 3, 6, 9, 12, 7, 10, 10, 13, 12, 12, 13, 16, 11, 14, 14, 17,
+ 15, 18, 16, 16, 17, 20, 18, 21, 19, 22, 20, 20, 21, 24, 22, 25, 23, 26, 24,
+ 24, 25, 28, 26, 29, 27, 30, 28, 28, 29, 32, 30, 33, 31, 34, 32, 32, 33, 36,
+ 34, 37, 35, 38, 36, 36, 37, 40, 38, 41, 39, 42, 40, 40, 41, 44, 42, 45, 43,
+ 46, 44, 44, 45, 48, 46, 49, 47, 50, 48, 48, 49, 52, 50, 53, 51, 54, 52, 52,
+ 53, 56, 54, 57, 55, 58, 56, 56, 57, 60, 58, 61, 59, 62, 0, 0
};
DECLARE_ALIGNED(16, static const int16_t,
default_scan_16x4_neighbors[65 * MAX_NEIGHBORS]) = {
- 0, 0, 0, 0, 0, 0, 1, 1, 1, 16, 16, 16, 2, 2, 2, 17, 17, 32, 32,
- 32, 3, 3, 3, 18, 18, 33, 33, 48, 4, 4, 4, 19, 19, 34, 34, 49, 5, 5,
- 5, 20, 20, 35, 35, 50, 6, 6, 6, 21, 21, 36, 36, 51, 7, 7, 7, 22, 22,
- 37, 37, 52, 8, 8, 8, 23, 23, 38, 38, 53, 9, 9, 9, 24, 24, 39, 39, 54,
- 10, 10, 10, 25, 25, 40, 40, 55, 11, 11, 11, 26, 26, 41, 41, 56, 12, 12, 12,
- 27, 27, 42, 42, 57, 13, 13, 13, 28, 28, 43, 43, 58, 14, 14, 14, 29, 29, 44,
- 44, 59, 15, 30, 30, 45, 45, 60, 31, 46, 46, 61, 47, 62, 0, 0
+ 0, 0, 0, 0, 0, 0, 1, 16, 1, 1, 16, 16, 2, 17, 17, 32, 18, 33, 2,
+ 2, 32, 32, 3, 18, 33, 48, 19, 34, 34, 49, 3, 3, 4, 19, 35, 50, 20, 35,
+ 4, 4, 36, 51, 5, 20, 21, 36, 37, 52, 5, 5, 6, 21, 22, 37, 38, 53, 6,
+ 6, 7, 22, 23, 38, 39, 54, 7, 7, 8, 23, 24, 39, 40, 55, 8, 8, 9, 24,
+ 25, 40, 41, 56, 9, 9, 10, 25, 26, 41, 42, 57, 10, 10, 11, 26, 27, 42, 43,
+ 58, 11, 11, 12, 27, 28, 43, 44, 59, 12, 12, 13, 28, 29, 44, 45, 60, 13, 13,
+ 14, 29, 30, 45, 46, 61, 14, 14, 15, 30, 31, 46, 47, 62, 0, 0
};
#if CONFIG_EXT_TX
DECLARE_ALIGNED(16, static const int16_t,
mrow_scan_4x16_neighbors[65 * MAX_NEIGHBORS]) = {
- 0, 0, 0, 0, 0, 0, 1, 1, 1, 16, 16, 16, 2, 2, 2, 17, 17, 32, 32,
- 32, 3, 3, 3, 18, 18, 33, 33, 48, 4, 4, 4, 19, 19, 34, 34, 49, 5, 5,
- 5, 20, 20, 35, 35, 50, 6, 6, 6, 21, 21, 36, 36, 51, 7, 7, 7, 22, 22,
- 37, 37, 52, 8, 8, 8, 23, 23, 38, 38, 53, 9, 9, 9, 24, 24, 39, 39, 54,
- 10, 10, 10, 25, 25, 40, 40, 55, 11, 11, 11, 26, 26, 41, 41, 56, 12, 12, 12,
- 27, 27, 42, 42, 57, 13, 13, 13, 28, 28, 43, 43, 58, 14, 14, 14, 29, 29, 44,
- 44, 59, 15, 30, 30, 45, 45, 60, 31, 46, 46, 61, 47, 62, 0, 0
+ 0, 0, 0, 0, 1, 1, 2, 2, 0, 0, 1, 4, 2, 5, 3, 6, 4, 4, 5,
+ 8, 6, 9, 7, 10, 8, 8, 9, 12, 10, 13, 11, 14, 12, 12, 13, 16, 14, 17,
+ 15, 18, 16, 16, 17, 20, 18, 21, 19, 22, 20, 20, 21, 24, 22, 25, 23, 26, 24,
+ 24, 25, 28, 26, 29, 27, 30, 28, 28, 29, 32, 30, 33, 31, 34, 32, 32, 33, 36,
+ 34, 37, 35, 38, 36, 36, 37, 40, 38, 41, 39, 42, 40, 40, 41, 44, 42, 45, 43,
+ 46, 44, 44, 45, 48, 46, 49, 47, 50, 48, 48, 49, 52, 50, 53, 51, 54, 52, 52,
+ 53, 56, 54, 57, 55, 58, 56, 56, 57, 60, 58, 61, 59, 62, 0, 0
};
DECLARE_ALIGNED(16, static const int16_t,
@@ -4249,7 +4249,7 @@ DECLARE_ALIGNED(16, static const int16_t,
};
#endif // CONFIG_TX64X64
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
DECLARE_ALIGNED(16, static const int16_t, av1_default_iscan_2x2[4]) = { 0, 1, 2,
3 };
#endif
@@ -4307,17 +4307,17 @@ DECLARE_ALIGNED(16, static const int16_t, av1_mrow_iscan_8x4[32]) = {
};
DECLARE_ALIGNED(16, static const int16_t, av1_default_iscan_4x16[64]) = {
- 0, 1, 3, 6, 2, 4, 7, 10, 5, 8, 11, 14, 9, 12, 15, 18,
- 13, 16, 19, 22, 17, 20, 23, 26, 21, 24, 27, 30, 25, 28, 31, 34,
- 29, 32, 35, 38, 33, 36, 39, 42, 37, 40, 43, 46, 41, 44, 47, 50,
- 45, 48, 51, 54, 49, 52, 55, 58, 53, 56, 59, 61, 57, 60, 62, 63,
+ 0, 1, 4, 9, 2, 3, 6, 11, 5, 7, 8, 13, 10, 12, 14, 17,
+ 15, 16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
};
DECLARE_ALIGNED(16, static const int16_t, av1_default_iscan_16x4[64]) = {
- 0, 1, 3, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54,
- 2, 4, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 58,
- 5, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 59, 61,
- 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 60, 62, 63,
+ 0, 1, 4, 9, 15, 19, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60,
+ 2, 3, 6, 11, 16, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61,
+ 5, 7, 8, 13, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62,
+ 10, 12, 14, 17, 20, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63,
};
#if CONFIG_EXT_TX
@@ -4343,10 +4343,10 @@ DECLARE_ALIGNED(16, static const int16_t, av1_mcol_iscan_4x16[64]) = {
};
DECLARE_ALIGNED(16, static const int16_t, av1_mcol_iscan_16x4[64]) = {
- 0, 16, 32, 48, 1, 17, 33, 49, 2, 18, 34, 50, 3, 19, 35, 51,
- 4, 20, 36, 52, 5, 21, 37, 53, 6, 22, 38, 54, 7, 23, 39, 55,
- 8, 24, 40, 56, 9, 25, 41, 57, 10, 26, 42, 58, 11, 27, 43, 59,
- 12, 28, 44, 60, 13, 29, 45, 61, 14, 30, 46, 62, 15, 31, 47, 63,
+ 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60,
+ 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61,
+ 2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62,
+ 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63,
};
#endif // CONFIG_EXT_TX
@@ -5719,7 +5719,7 @@ DECLARE_ALIGNED(16, static const int16_t, av1_default_iscan_64x64[4096]) = {
#endif // CONFIG_TX64X64
const SCAN_ORDER av1_default_scan_orders[TX_SIZES] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{ default_scan_2x2, av1_default_iscan_2x2, default_scan_2x2_neighbors },
#endif
{ default_scan_4x4, av1_default_iscan_4x4, default_scan_4x4_neighbors },
@@ -5732,7 +5732,7 @@ const SCAN_ORDER av1_default_scan_orders[TX_SIZES] = {
};
const SCAN_ORDER av1_intra_scan_orders[TX_SIZES_ALL][TX_TYPES] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{
// TX_2X2
{ default_scan_2x2, av1_default_iscan_2x2, default_scan_2x2_neighbors },
@@ -6043,7 +6043,7 @@ const SCAN_ORDER av1_intra_scan_orders[TX_SIZES_ALL][TX_TYPES] = {
};
const SCAN_ORDER av1_inter_scan_orders[TX_SIZES_ALL][TX_TYPES] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
{
// TX_2X2
{ default_scan_2x2, av1_default_iscan_2x2, default_scan_2x2_neighbors },
@@ -6493,7 +6493,7 @@ const SCAN_ORDER av1_inter_scan_orders[TX_SIZES_ALL][TX_TYPES] = {
static uint32_t *get_non_zero_prob(FRAME_CONTEXT *fc, TX_SIZE tx_size,
TX_TYPE tx_type) {
switch (tx_size) {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
case TX_2X2: return fc->non_zero_prob_2x2[tx_type];
#endif
case TX_4X4: return fc->non_zero_prob_4X4[tx_type];
@@ -6515,7 +6515,7 @@ static uint32_t *get_non_zero_prob(FRAME_CONTEXT *fc, TX_SIZE tx_size,
static int16_t *get_adapt_scan(FRAME_CONTEXT *fc, TX_SIZE tx_size,
TX_TYPE tx_type) {
switch (tx_size) {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
case TX_2X2: return fc->scan_2x2[tx_type];
#endif
case TX_4X4: return fc->scan_4X4[tx_type];
@@ -6537,7 +6537,7 @@ static int16_t *get_adapt_scan(FRAME_CONTEXT *fc, TX_SIZE tx_size,
static int16_t *get_adapt_iscan(FRAME_CONTEXT *fc, TX_SIZE tx_size,
TX_TYPE tx_type) {
switch (tx_size) {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
case TX_2X2: return fc->iscan_2x2[tx_type];
#endif
case TX_4X4: return fc->iscan_4X4[tx_type];
@@ -6559,7 +6559,7 @@ static int16_t *get_adapt_iscan(FRAME_CONTEXT *fc, TX_SIZE tx_size,
static int16_t *get_adapt_nb(FRAME_CONTEXT *fc, TX_SIZE tx_size,
TX_TYPE tx_type) {
switch (tx_size) {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
case TX_2X2: return fc->nb_2x2[tx_type];
#endif
case TX_4X4: return fc->nb_4X4[tx_type];
@@ -6581,7 +6581,7 @@ static int16_t *get_adapt_nb(FRAME_CONTEXT *fc, TX_SIZE tx_size,
static uint32_t *get_non_zero_counts(FRAME_COUNTS *counts, TX_SIZE tx_size,
TX_TYPE tx_type) {
switch (tx_size) {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
case TX_2X2: return counts->non_zero_count_2x2[tx_type];
#endif
case TX_4X4: return counts->non_zero_count_4X4[tx_type];
@@ -6606,7 +6606,7 @@ static INLINE int clamp_64(int64_t value, int low, int high) {
static void update_scan_prob(AV1_COMMON *cm, TX_SIZE tx_size, TX_TYPE tx_type,
int rate_16) {
- FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx];
+ FRAME_CONTEXT *pre_fc = cm->pre_fc;
uint32_t *prev_non_zero_prob = get_non_zero_prob(pre_fc, tx_size, tx_type);
uint32_t *non_zero_prob = get_non_zero_prob(cm->fc, tx_size, tx_type);
uint32_t *non_zero_count = get_non_zero_counts(&cm->counts, tx_size, tx_type);
diff --git a/third_party/aom/av1/common/seg_common.h b/third_party/aom/av1/common/seg_common.h
index 03ed38e79..69a63874a 100644
--- a/third_party/aom/av1/common/seg_common.h
+++ b/third_party/aom/av1/common/seg_common.h
@@ -48,9 +48,7 @@ struct segmentation {
struct segmentation_probs {
aom_prob tree_probs[SEG_TREE_PROBS];
-#if CONFIG_EC_MULTISYMBOL
aom_cdf_prob tree_cdf[CDF_SIZE(MAX_SEGMENTS)];
-#endif
aom_prob pred_probs[PREDICTION_PROBS];
};
diff --git a/third_party/aom/av1/common/thread_common.c b/third_party/aom/av1/common/thread_common.c
index ca8b1b3bd..d96a71aef 100644
--- a/third_party/aom/av1/common/thread_common.c
+++ b/third_party/aom/av1/common/thread_common.c
@@ -113,7 +113,7 @@ static INLINE void loop_filter_block_plane_ver(
break;
case LF_PATH_SLOW:
av1_filter_block_plane_non420_ver(cm, &planes[plane], mi, mi_row,
- mi_col);
+ mi_col, plane);
break;
}
}
@@ -135,7 +135,7 @@ static INLINE void loop_filter_block_plane_hor(
break;
case LF_PATH_SLOW:
av1_filter_block_plane_non420_hor(cm, &planes[plane], mi, mi_row,
- mi_col);
+ mi_col, plane);
break;
}
}
@@ -168,7 +168,7 @@ static int loop_filter_ver_row_worker(AV1LfSync *const lf_sync,
#if CONFIG_EXT_PARTITION_TYPES
for (plane = 0; plane < num_planes; ++plane)
av1_filter_block_plane_non420_ver(lf_data->cm, &lf_data->planes[plane],
- mi + mi_col, mi_row, mi_col);
+ mi + mi_col, mi_row, mi_col, plane);
#else
for (plane = 0; plane < num_planes; ++plane)
@@ -213,7 +213,7 @@ static int loop_filter_hor_row_worker(AV1LfSync *const lf_sync,
#if CONFIG_EXT_PARTITION_TYPES
for (plane = 0; plane < num_planes; ++plane)
av1_filter_block_plane_non420_hor(lf_data->cm, &lf_data->planes[plane],
- mi + mi_col, mi_row, mi_col);
+ mi + mi_col, mi_row, mi_col, plane);
#else
for (plane = 0; plane < num_planes; ++plane)
loop_filter_block_plane_hor(lf_data->cm, lf_data->planes, plane,
@@ -263,9 +263,9 @@ static int loop_filter_row_worker(AV1LfSync *const lf_sync,
#if CONFIG_EXT_PARTITION_TYPES
for (plane = 0; plane < num_planes; ++plane) {
av1_filter_block_plane_non420_ver(lf_data->cm, &lf_data->planes[plane],
- mi + mi_col, mi_row, mi_col);
+ mi + mi_col, mi_row, mi_col, plane);
av1_filter_block_plane_non420_hor(lf_data->cm, &lf_data->planes[plane],
- mi + mi_col, mi_row, mi_col);
+ mi + mi_col, mi_row, mi_col, plane);
}
#else
av1_setup_mask(lf_data->cm, mi_row, mi_col, mi + mi_col,
diff --git a/third_party/aom/av1/common/tile_common.c b/third_party/aom/av1/common/tile_common.c
index b8008ac2e..e9156ae32 100644
--- a/third_party/aom/av1/common/tile_common.c
+++ b/third_party/aom/av1/common/tile_common.c
@@ -86,17 +86,28 @@ void av1_update_boundary_info(const struct AV1Common *cm,
for (col = mi_col; col < (mi_col + cm->mib_size); col++) {
MODE_INFO *const mi = cm->mi + row * cm->mi_stride + col;
mi->mbmi.boundary_info = 0;
+
+ // If horizontal dependent tile is enabled, then the horizontal
+ // tile boundary is not treated as real tile boundary for loop
+ // filtering, only the horizontal tile group boundary is treated
+ // as tile boundary.
+ // Otherwise, tile group boundary is treated the same as tile boundary.
+ // Loop filtering operation is done based on the
+ // loopfilter_across_tiles_enabled flag for both tile boundary and tile
+ // group boundary.
+
if (cm->tile_cols * cm->tile_rows > 1) {
#if CONFIG_DEPENDENT_HORZTILES
+#if CONFIG_TILE_GROUPS
if (row == tile_info->mi_row_start &&
(!cm->dependent_horz_tiles || tile_info->tg_horz_boundary))
-#if CONFIG_TILE_GROUPS
#else
- if (row == tile_info->mi_row_start && !cm->dependent_horz_tiles)
+ if (row == tile_info->mi_row_start && !cm->dependent_horz_tiles)
#endif // CONFIG_TILE_GROUPS
#else
if (row == tile_info->mi_row_start)
#endif // CONFIG_DEPENDENT_HORZTILES
+
mi->mbmi.boundary_info |= TILE_ABOVE_BOUNDARY;
if (col == tile_info->mi_col_start)
mi->mbmi.boundary_info |= TILE_LEFT_BOUNDARY;
diff --git a/third_party/aom/av1/common/tile_common.h b/third_party/aom/av1/common/tile_common.h
index 617dda202..e34ee7ce8 100644
--- a/third_party/aom/av1/common/tile_common.h
+++ b/third_party/aom/av1/common/tile_common.h
@@ -38,7 +38,7 @@ void av1_tile_init(TileInfo *tile, const struct AV1Common *cm, int row,
void av1_tile_set_row(TileInfo *tile, const struct AV1Common *cm, int row);
void av1_tile_set_col(TileInfo *tile, const struct AV1Common *cm, int col);
#if CONFIG_DEPENDENT_HORZTILES && CONFIG_TILE_GROUPS
-void av1_tile_set_tg_boundary(TileInfo *tile, const struct AV1Common *cm,
+void av1_tile_set_tg_boundary(TileInfo *tile, const struct AV1Common *const cm,
int row, int col);
#endif
void av1_get_tile_n_bits(int mi_cols, int *min_log2_tile_cols,
diff --git a/third_party/aom/av1/common/txb_common.c b/third_party/aom/av1/common/txb_common.c
index 08a685b59..33eea811e 100644
--- a/third_party/aom/av1/common/txb_common.c
+++ b/third_party/aom/av1/common/txb_common.c
@@ -98,7 +98,7 @@ const int16_t av1_coeff_band_32x32[1024] = {
void av1_adapt_txb_probs(AV1_COMMON *cm, unsigned int count_sat,
unsigned int update_factor) {
FRAME_CONTEXT *fc = cm->fc;
- const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx];
+ const FRAME_CONTEXT *pre_fc = cm->pre_fc;
const FRAME_COUNTS *counts = &cm->counts;
TX_SIZE tx_size;
int plane, ctx, level;
diff --git a/third_party/aom/av1/common/txb_common.h b/third_party/aom/av1/common/txb_common.h
index cdd9ca26e..bea162d70 100644
--- a/third_party/aom/av1/common/txb_common.h
+++ b/third_party/aom/av1/common/txb_common.h
@@ -32,51 +32,98 @@ static int base_ref_offset[BASE_CONTEXT_POSITION_NUM][2] = {
/* clang-format on*/
};
-static INLINE int get_base_ctx(const tran_low_t *tcoeffs,
- int c, // raster order
- const int bwl, const int level) {
- const int row = c >> bwl;
- const int col = c - (row << bwl);
- const int stride = 1 << bwl;
- const int level_minus_1 = level - 1;
- int ctx = 0;
- int mag = 0;
- int idx;
- int ctx_idx = -1;
- tran_low_t abs_coeff;
-
- ctx = 0;
- for (idx = 0; idx < BASE_CONTEXT_POSITION_NUM; ++idx) {
- int ref_row = row + base_ref_offset[idx][0];
- int ref_col = col + base_ref_offset[idx][1];
- int pos = (ref_row << bwl) + ref_col;
-
+static INLINE int get_level_count(const tran_low_t *tcoeffs, int stride,
+ int row, int col, int level,
+ int (*nb_offset)[2], int nb_num) {
+ int count = 0;
+ for (int idx = 0; idx < nb_num; ++idx) {
+ const int ref_row = row + nb_offset[idx][0];
+ const int ref_col = col + nb_offset[idx][1];
+ const int pos = ref_row * stride + ref_col;
if (ref_row < 0 || ref_col < 0 || ref_row >= stride || ref_col >= stride)
continue;
+ tran_low_t abs_coeff = abs(tcoeffs[pos]);
+ count += abs_coeff > level;
+ }
+ return count;
+}
- abs_coeff = abs(tcoeffs[pos]);
- ctx += abs_coeff > level_minus_1;
-
- if (base_ref_offset[idx][0] >= 0 && base_ref_offset[idx][1] >= 0)
- mag |= abs_coeff > level;
+static INLINE void get_mag(int *mag, const tran_low_t *tcoeffs, int stride,
+ int row, int col, int (*nb_offset)[2], int nb_num) {
+ mag[0] = 0;
+ mag[1] = 0;
+ for (int idx = 0; idx < nb_num; ++idx) {
+ const int ref_row = row + nb_offset[idx][0];
+ const int ref_col = col + nb_offset[idx][1];
+ const int pos = ref_row * stride + ref_col;
+ if (ref_row < 0 || ref_col < 0 || ref_row >= stride || ref_col >= stride)
+ continue;
+ tran_low_t abs_coeff = abs(tcoeffs[pos]);
+ if (nb_offset[idx][0] >= 0 && nb_offset[idx][1] >= 0) {
+ if (abs_coeff > mag[0]) {
+ mag[0] = abs_coeff;
+ mag[1] = 1;
+ } else if (abs_coeff == mag[0]) {
+ ++mag[1];
+ }
+ }
+ }
+}
+static INLINE int get_level_count_mag(int *mag, const tran_low_t *tcoeffs,
+ int stride, int row, int col, int level,
+ int (*nb_offset)[2], int nb_num) {
+ int count = 0;
+ *mag = 0;
+ for (int idx = 0; idx < nb_num; ++idx) {
+ const int ref_row = row + nb_offset[idx][0];
+ const int ref_col = col + nb_offset[idx][1];
+ const int pos = ref_row * stride + ref_col;
+ if (ref_row < 0 || ref_col < 0 || ref_row >= stride || ref_col >= stride)
+ continue;
+ tran_low_t abs_coeff = abs(tcoeffs[pos]);
+ count += abs_coeff > level;
+ if (nb_offset[idx][0] >= 0 && nb_offset[idx][1] >= 0)
+ *mag = AOMMAX(*mag, abs_coeff);
}
- ctx = (ctx + 1) >> 1;
+ return count;
+}
+
+static INLINE int get_base_ctx_from_count_mag(int row, int col, int count,
+ int mag, int level) {
+ const int ctx = (count + 1) >> 1;
+ const int sig_mag = mag > level;
+ int ctx_idx = -1;
if (row == 0 && col == 0) {
- ctx_idx = (ctx << 1) + mag;
+ ctx_idx = (ctx << 1) + sig_mag;
assert(ctx_idx < 8);
} else if (row == 0) {
- ctx_idx = 8 + (ctx << 1) + mag;
+ ctx_idx = 8 + (ctx << 1) + sig_mag;
assert(ctx_idx < 18);
} else if (col == 0) {
- ctx_idx = 8 + 10 + (ctx << 1) + mag;
+ ctx_idx = 8 + 10 + (ctx << 1) + sig_mag;
assert(ctx_idx < 28);
} else {
- ctx_idx = 8 + 10 + 10 + (ctx << 1) + mag;
+ ctx_idx = 8 + 10 + 10 + (ctx << 1) + sig_mag;
assert(ctx_idx < COEFF_BASE_CONTEXTS);
}
return ctx_idx;
}
+static INLINE int get_base_ctx(const tran_low_t *tcoeffs,
+ int c, // raster order
+ const int bwl, const int level) {
+ const int stride = 1 << bwl;
+ const int row = c >> bwl;
+ const int col = c - (row << bwl);
+ const int level_minus_1 = level - 1;
+ int mag;
+ int count =
+ get_level_count_mag(&mag, tcoeffs, stride, row, col, level_minus_1,
+ base_ref_offset, BASE_CONTEXT_POSITION_NUM);
+ int ctx_idx = get_base_ctx_from_count_mag(row, col, count, mag, level);
+ return ctx_idx;
+}
+
#define BR_CONTEXT_POSITION_NUM 8 // Base range coefficient context
static int br_ref_offset[BR_CONTEXT_POSITION_NUM][2] = {
/* clang-format off*/
@@ -89,34 +136,13 @@ static int br_level_map[9] = {
0, 0, 1, 1, 2, 2, 3, 3, 3,
};
-static INLINE int get_level_ctx(const tran_low_t *tcoeffs,
- const int c, // raster order
- const int bwl) {
- const int row = c >> bwl;
- const int col = c - (row << bwl);
- const int stride = 1 << bwl;
- const int level_minus_1 = NUM_BASE_LEVELS;
- int ctx = 0;
- int idx;
- tran_low_t abs_coeff;
- int mag = 0, offset = 0;
-
- for (idx = 0; idx < BR_CONTEXT_POSITION_NUM; ++idx) {
- int ref_row = row + br_ref_offset[idx][0];
- int ref_col = col + br_ref_offset[idx][1];
- int pos = (ref_row << bwl) + ref_col;
-
- if (ref_row < 0 || ref_col < 0 || ref_row >= stride || ref_col >= stride)
- continue;
-
- abs_coeff = abs(tcoeffs[pos]);
- ctx += abs_coeff > level_minus_1;
-
- if (br_ref_offset[idx][0] >= 0 && br_ref_offset[idx][1] >= 0)
- mag = AOMMAX(mag, abs_coeff);
- }
-
- if (mag <= 1)
+#define BR_MAG_OFFSET 1
+// TODO(angiebird): optimize this function by using a table to map from
+// count/mag to ctx
+static INLINE int get_br_ctx_from_count_mag(int row, int col, int count,
+ int mag) {
+ int offset = 0;
+ if (mag <= BR_MAG_OFFSET)
offset = 0;
else if (mag <= 3)
offset = 1;
@@ -125,8 +151,7 @@ static INLINE int get_level_ctx(const tran_low_t *tcoeffs,
else
offset = 3;
- ctx = br_level_map[ctx];
-
+ int ctx = br_level_map[count];
ctx += offset * BR_TMP_OFFSET;
// DC: 0 - 1
@@ -142,17 +167,33 @@ static INLINE int get_level_ctx(const tran_low_t *tcoeffs,
return 8 + ctx;
}
-static int sig_ref_offset[11][2] = {
+static INLINE int get_br_ctx(const tran_low_t *tcoeffs,
+ const int c, // raster order
+ const int bwl) {
+ const int stride = 1 << bwl;
+ const int row = c >> bwl;
+ const int col = c - (row << bwl);
+ const int level_minus_1 = NUM_BASE_LEVELS;
+ int mag;
+ const int count =
+ get_level_count_mag(&mag, tcoeffs, stride, row, col, level_minus_1,
+ br_ref_offset, BR_CONTEXT_POSITION_NUM);
+ const int ctx = get_br_ctx_from_count_mag(row, col, count, mag);
+ return ctx;
+}
+
+#define SIG_REF_OFFSET_NUM 11
+static int sig_ref_offset[SIG_REF_OFFSET_NUM][2] = {
{ -2, -1 }, { -2, 0 }, { -2, 1 }, { -1, -2 }, { -1, -1 }, { -1, 0 },
{ -1, 1 }, { 0, -2 }, { 0, -1 }, { 1, -2 }, { 1, -1 },
};
static INLINE int get_nz_map_ctx(const tran_low_t *tcoeffs,
const uint8_t *txb_mask,
- const int c, // raster order
+ const int coeff_idx, // raster order
const int bwl) {
- const int row = c >> bwl;
- const int col = c - (row << bwl);
+ const int row = coeff_idx >> bwl;
+ const int col = coeff_idx - (row << bwl);
int ctx = 0;
int idx;
int stride = 1 << bwl;
@@ -178,7 +219,7 @@ static INLINE int get_nz_map_ctx(const tran_low_t *tcoeffs,
return 5 + ctx;
}
- for (idx = 0; idx < 11; ++idx) {
+ for (idx = 0; idx < SIG_REF_OFFSET_NUM; ++idx) {
int ref_row = row + sig_ref_offset[idx][0];
int ref_col = col + sig_ref_offset[idx][1];
int pos;
@@ -212,14 +253,93 @@ static INLINE int get_nz_map_ctx(const tran_low_t *tcoeffs,
return 14 + ctx;
}
+static INLINE int get_nz_count(const tran_low_t *tcoeffs, int stride, int row,
+ int col, const int16_t *iscan) {
+ int count = 0;
+ const int pos = row * stride + col;
+ for (int idx = 0; idx < SIG_REF_OFFSET_NUM; ++idx) {
+ const int ref_row = row + sig_ref_offset[idx][0];
+ const int ref_col = col + sig_ref_offset[idx][1];
+ if (ref_row < 0 || ref_col < 0 || ref_row >= stride || ref_col >= stride)
+ continue;
+ const int nb_pos = ref_row * stride + ref_col;
+ if (iscan[nb_pos] < iscan[pos]) count += (tcoeffs[nb_pos] != 0);
+ }
+ return count;
+}
+
+// TODO(angiebird): optimize this function by generate a table that maps from
+// count to ctx
+static INLINE int get_nz_map_ctx_from_count(int count,
+ const tran_low_t *tcoeffs,
+ int coeff_idx, // raster order
+ int bwl, const int16_t *iscan) {
+ const int row = coeff_idx >> bwl;
+ const int col = coeff_idx - (row << bwl);
+ int ctx = 0;
+
+ if (row == 0 && col == 0) return 0;
+
+ if (row == 0 && col == 1) return 1 + (tcoeffs[0] != 0);
+
+ if (row == 1 && col == 0) return 3 + (tcoeffs[0] != 0);
+
+ if (row == 1 && col == 1) {
+ int pos;
+ ctx = (tcoeffs[0] != 0);
+
+ if (iscan[1] < iscan[coeff_idx]) ctx += (tcoeffs[1] != 0);
+ pos = 1 << bwl;
+ if (iscan[pos] < iscan[coeff_idx]) ctx += (tcoeffs[pos] != 0);
+
+ ctx = (ctx + 1) >> 1;
+
+ assert(5 + ctx <= 7);
+
+ return 5 + ctx;
+ }
+
+ if (row == 0) {
+ ctx = (count + 1) >> 1;
+
+ assert(ctx < 3);
+ return 8 + ctx;
+ }
+
+ if (col == 0) {
+ ctx = (count + 1) >> 1;
+
+ assert(ctx < 3);
+ return 11 + ctx;
+ }
+
+ ctx = count >> 1;
+
+ assert(14 + ctx < 20);
+
+ return 14 + ctx;
+}
+
+// TODO(angiebird): merge this function with get_nz_map_ctx() after proper
+// testing
+static INLINE int get_nz_map_ctx2(const tran_low_t *tcoeffs,
+ const int coeff_idx, // raster order
+ const int bwl, const int16_t *iscan) {
+ int stride = 1 << bwl;
+ const int row = coeff_idx >> bwl;
+ const int col = coeff_idx - (row << bwl);
+ int count = get_nz_count(tcoeffs, stride, row, col, iscan);
+ return get_nz_map_ctx_from_count(count, tcoeffs, coeff_idx, bwl, iscan);
+}
+
static INLINE int get_eob_ctx(const tran_low_t *tcoeffs,
- const int c, // raster order
+ const int coeff_idx, // raster order
const int bwl) {
(void)tcoeffs;
- if (bwl == 2) return av1_coeff_band_4x4[c];
- if (bwl == 3) return av1_coeff_band_8x8[c];
- if (bwl == 4) return av1_coeff_band_16x16[c];
- if (bwl == 5) return av1_coeff_band_32x32[c];
+ if (bwl == 2) return av1_coeff_band_4x4[coeff_idx];
+ if (bwl == 3) return av1_coeff_band_8x8[coeff_idx];
+ if (bwl == 4) return av1_coeff_band_16x16[coeff_idx];
+ if (bwl == 5) return av1_coeff_band_32x32[coeff_idx];
assert(0);
return 0;
@@ -245,14 +365,14 @@ static INLINE int get_dc_sign_ctx(int dc_sign) {
static INLINE void get_txb_ctx(BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
int plane, const ENTROPY_CONTEXT *a,
const ENTROPY_CONTEXT *l, TXB_CTX *txb_ctx) {
- const int tx_size_in_blocks = 1 << tx_size;
+ const int txb_w_unit = tx_size_wide_unit[tx_size];
+ const int txb_h_unit = tx_size_high_unit[tx_size];
int ctx_offset = (plane == 0) ? 0 : 7;
- int k;
if (plane_bsize > txsize_to_bsize[tx_size]) ctx_offset += 3;
int dc_sign = 0;
- for (k = 0; k < tx_size_in_blocks; ++k) {
+ for (int k = 0; k < txb_w_unit; ++k) {
int sign = ((uint8_t)a[k]) >> COEFF_CONTEXT_BITS;
if (sign == 1)
--dc_sign;
@@ -260,8 +380,10 @@ static INLINE void get_txb_ctx(BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
++dc_sign;
else if (sign != 0)
assert(0);
+ }
- sign = ((uint8_t)l[k]) >> COEFF_CONTEXT_BITS;
+ for (int k = 0; k < txb_h_unit; ++k) {
+ int sign = ((uint8_t)l[k]) >> COEFF_CONTEXT_BITS;
if (sign == 1)
--dc_sign;
else if (sign == 2)
@@ -269,15 +391,21 @@ static INLINE void get_txb_ctx(BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
else if (sign != 0)
assert(0);
}
+
txb_ctx->dc_sign_ctx = get_dc_sign_ctx(dc_sign);
if (plane == 0) {
int top = 0;
int left = 0;
- for (k = 0; k < tx_size_in_blocks; ++k) {
+
+ for (int k = 0; k < txb_w_unit; ++k) {
top = AOMMAX(top, ((uint8_t)a[k] & COEFF_CONTEXT_MASK));
+ }
+
+ for (int k = 0; k < txb_h_unit; ++k) {
left = AOMMAX(left, ((uint8_t)l[k] & COEFF_CONTEXT_MASK));
}
+
top = AOMMIN(top, 255);
left = AOMMIN(left, 255);
diff --git a/third_party/aom/av1/common/warped_motion.c b/third_party/aom/av1/common/warped_motion.c
index 9d13dc705..fc832681a 100644
--- a/third_party/aom/av1/common/warped_motion.c
+++ b/third_party/aom/av1/common/warped_motion.c
@@ -98,7 +98,7 @@ static ProjectPointsFunc get_project_points_type(TransformationType type) {
}
}
-void project_points_translation(int32_t *mat, int *points, int *proj,
+void project_points_translation(const int32_t *mat, int *points, int *proj,
const int n, const int stride_points,
const int stride_proj, const int subsampling_x,
const int subsampling_y) {
@@ -124,9 +124,10 @@ void project_points_translation(int32_t *mat, int *points, int *proj,
}
}
-void project_points_rotzoom(int32_t *mat, int *points, int *proj, const int n,
- const int stride_points, const int stride_proj,
- const int subsampling_x, const int subsampling_y) {
+void project_points_rotzoom(const int32_t *mat, int *points, int *proj,
+ const int n, const int stride_points,
+ const int stride_proj, const int subsampling_x,
+ const int subsampling_y) {
int i;
for (i = 0; i < n; ++i) {
const int x = *(points++), y = *(points++);
@@ -151,9 +152,10 @@ void project_points_rotzoom(int32_t *mat, int *points, int *proj, const int n,
}
}
-void project_points_affine(int32_t *mat, int *points, int *proj, const int n,
- const int stride_points, const int stride_proj,
- const int subsampling_x, const int subsampling_y) {
+void project_points_affine(const int32_t *mat, int *points, int *proj,
+ const int n, const int stride_points,
+ const int stride_proj, const int subsampling_x,
+ const int subsampling_y) {
int i;
for (i = 0; i < n; ++i) {
const int x = *(points++), y = *(points++);
@@ -178,7 +180,7 @@ void project_points_affine(int32_t *mat, int *points, int *proj, const int n,
}
}
-void project_points_hortrapezoid(int32_t *mat, int *points, int *proj,
+void project_points_hortrapezoid(const int32_t *mat, int *points, int *proj,
const int n, const int stride_points,
const int stride_proj, const int subsampling_x,
const int subsampling_y) {
@@ -211,7 +213,7 @@ void project_points_hortrapezoid(int32_t *mat, int *points, int *proj,
}
}
-void project_points_vertrapezoid(int32_t *mat, int *points, int *proj,
+void project_points_vertrapezoid(const int32_t *mat, int *points, int *proj,
const int n, const int stride_points,
const int stride_proj, const int subsampling_x,
const int subsampling_y) {
@@ -244,7 +246,7 @@ void project_points_vertrapezoid(int32_t *mat, int *points, int *proj,
}
}
-void project_points_homography(int32_t *mat, int *points, int *proj,
+void project_points_homography(const int32_t *mat, int *points, int *proj,
const int n, const int stride_points,
const int stride_proj, const int subsampling_x,
const int subsampling_y) {
@@ -279,7 +281,7 @@ void project_points_homography(int32_t *mat, int *points, int *proj,
// 'points' are at original scale, output 'proj's are scaled up by
// 1 << WARPEDPIXEL_PREC_BITS
-void project_points(WarpedMotionParams *wm_params, int *points, int *proj,
+void project_points(const WarpedMotionParams *wm_params, int *points, int *proj,
const int n, const int stride_points, const int stride_proj,
const int subsampling_x, const int subsampling_y) {
switch (wm_params->wmtype) {
@@ -355,7 +357,7 @@ static const int16_t
#endif // WARPEDPIXEL_PREC_BITS == 6
};
-static int32_t do_ntap_filter(int32_t *p, int x) {
+static int32_t do_ntap_filter(const int32_t *const p, int x) {
int i;
int32_t sum = 0;
for (i = 0; i < WARPEDPIXEL_FILTER_TAPS; ++i) {
@@ -364,7 +366,7 @@ static int32_t do_ntap_filter(int32_t *p, int x) {
return sum;
}
-static int32_t do_cubic_filter(int32_t *p, int x) {
+static int32_t do_cubic_filter(const int32_t *const p, int x) {
if (x == 0) {
return p[0] * (1 << WARPEDPIXEL_FILTER_BITS);
} else if (x == (1 << WARPEDPIXEL_PREC_BITS)) {
@@ -383,19 +385,20 @@ static int32_t do_cubic_filter(int32_t *p, int x) {
}
}
-static INLINE void get_subcolumn(int taps, uint8_t *ref, int32_t *col,
- int stride, int x, int y_start) {
+static INLINE void get_subcolumn(int taps, const uint8_t *const ref,
+ int32_t *col, int stride, int x, int y_start) {
int i;
for (i = 0; i < taps; ++i) {
col[i] = ref[(i + y_start) * stride + x];
}
}
-static uint8_t bi_ntap_filter(uint8_t *ref, int x, int y, int stride) {
+static uint8_t bi_ntap_filter(const uint8_t *const ref, int x, int y,
+ int stride) {
int32_t val, arr[WARPEDPIXEL_FILTER_TAPS];
int k;
- int i = (int)x >> WARPEDPIXEL_PREC_BITS;
- int j = (int)y >> WARPEDPIXEL_PREC_BITS;
+ const int i = (int)x >> WARPEDPIXEL_PREC_BITS;
+ const int j = (int)y >> WARPEDPIXEL_PREC_BITS;
for (k = 0; k < WARPEDPIXEL_FILTER_TAPS; ++k) {
int32_t arr_temp[WARPEDPIXEL_FILTER_TAPS];
get_subcolumn(WARPEDPIXEL_FILTER_TAPS, ref, arr_temp, stride,
@@ -410,11 +413,12 @@ static uint8_t bi_ntap_filter(uint8_t *ref, int x, int y, int stride) {
return (uint8_t)clip_pixel(val);
}
-static uint8_t bi_cubic_filter(uint8_t *ref, int x, int y, int stride) {
+static uint8_t bi_cubic_filter(const uint8_t *const ref, int x, int y,
+ int stride) {
int32_t val, arr[4];
int k;
- int i = (int)x >> WARPEDPIXEL_PREC_BITS;
- int j = (int)y >> WARPEDPIXEL_PREC_BITS;
+ const int i = (int)x >> WARPEDPIXEL_PREC_BITS;
+ const int j = (int)y >> WARPEDPIXEL_PREC_BITS;
for (k = 0; k < 4; ++k) {
int32_t arr_temp[4];
get_subcolumn(4, ref, arr_temp, stride, i + k - 1, j - 1);
@@ -426,7 +430,8 @@ static uint8_t bi_cubic_filter(uint8_t *ref, int x, int y, int stride) {
return (uint8_t)clip_pixel(val);
}
-static uint8_t bi_linear_filter(uint8_t *ref, int x, int y, int stride) {
+static uint8_t bi_linear_filter(const uint8_t *const ref, int x, int y,
+ int stride) {
const int ix = x >> WARPEDPIXEL_PREC_BITS;
const int iy = y >> WARPEDPIXEL_PREC_BITS;
const int sx = x - (ix * (1 << WARPEDPIXEL_PREC_BITS));
@@ -442,12 +447,12 @@ static uint8_t bi_linear_filter(uint8_t *ref, int x, int y, int stride) {
return (uint8_t)clip_pixel(val);
}
-static uint8_t warp_interpolate(uint8_t *ref, int x, int y, int width,
- int height, int stride) {
- int ix = x >> WARPEDPIXEL_PREC_BITS;
- int iy = y >> WARPEDPIXEL_PREC_BITS;
- int sx = x - (ix * (1 << WARPEDPIXEL_PREC_BITS));
- int sy = y - (iy * (1 << WARPEDPIXEL_PREC_BITS));
+static uint8_t warp_interpolate(const uint8_t *const ref, int x, int y,
+ int width, int height, int stride) {
+ const int ix = x >> WARPEDPIXEL_PREC_BITS;
+ const int iy = y >> WARPEDPIXEL_PREC_BITS;
+ const int sx = x - (ix * (1 << WARPEDPIXEL_PREC_BITS));
+ const int sy = y - (iy * (1 << WARPEDPIXEL_PREC_BITS));
int32_t v;
if (ix < 0 && iy < 0)
@@ -602,6 +607,8 @@ const int16_t warped_filter[WARPEDPIXEL_PREC_SHIFTS * 3 + 1][8] = {
{ 0, 0, 1, - 4, 13, 124, - 7, 1 }, { 0, 0, 1, - 4, 11, 125, - 6, 1 },
{ 0, 0, 1, - 3, 8, 126, - 5, 1 }, { 0, 0, 1, - 2, 6, 126, - 4, 1 },
{ 0, 0, 0, - 1, 4, 127, - 3, 1 }, { 0, 0, 0, 0, 2, 127, - 1, 0 },
+ // dummy (replicate row index 191)
+ { 0, 0, 0, 0, 2, 127, - 1, 0 },
#elif WARPEDPIXEL_PREC_BITS == 5
// [-1, 0)
@@ -655,11 +662,10 @@ const int16_t warped_filter[WARPEDPIXEL_PREC_SHIFTS * 3 + 1][8] = {
{0, 0, 2, -8, 27, 117, -13, 3}, {0, 0, 2, -7, 22, 120, -11, 2},
{0, 0, 1, -6, 18, 122, -9, 2}, {0, 0, 1, -4, 13, 124, -7, 1},
{0, 0, 1, -3, 8, 126, -5, 1}, {0, 0, 0, -1, 4, 127, -3, 1},
+ // dummy (replicate row index 95)
+ {0, 0, 0, -1, 4, 127, -3, 1},
#endif // WARPEDPIXEL_PREC_BITS == 6
-
- // dummy
- { 0, 0, 0, 0, 1, 127, 0, 0 },
};
/* clang-format on */
@@ -695,14 +701,6 @@ static const uint16_t div_lut[DIV_LUT_NUM + 1] = {
8240, 8224, 8208, 8192,
};
-static INLINE int16_t saturate_int16(int32_t v) {
- if (v > 32767)
- return 32767;
- else if (v < -32768)
- return -32768;
- return v;
-}
-
#if CONFIG_WARPED_MOTION
// Decomposes a divisor D such that 1/D = y/2^shift, where y is returned
// at precision of DIV_LUT_PREC_BITS along with the shift.
@@ -740,7 +738,7 @@ static int16_t resolve_divisor_32(uint32_t D, int16_t *shift) {
return div_lut[f];
}
-static int is_affine_valid(WarpedMotionParams *wm) {
+static int is_affine_valid(const WarpedMotionParams *const wm) {
const int32_t *mat = wm->wmmat;
return (mat[2] > 0);
}
@@ -773,24 +771,34 @@ int get_shear_params(WarpedMotionParams *wm) {
INT16_MIN, INT16_MAX);
if (!is_affine_shear_allowed(wm->alpha, wm->beta, wm->gamma, wm->delta))
return 0;
+
+ wm->alpha = ROUND_POWER_OF_TWO_SIGNED(wm->alpha, WARP_PARAM_REDUCE_BITS) *
+ (1 << WARP_PARAM_REDUCE_BITS);
+ wm->beta = ROUND_POWER_OF_TWO_SIGNED(wm->beta, WARP_PARAM_REDUCE_BITS) *
+ (1 << WARP_PARAM_REDUCE_BITS);
+ wm->gamma = ROUND_POWER_OF_TWO_SIGNED(wm->gamma, WARP_PARAM_REDUCE_BITS) *
+ (1 << WARP_PARAM_REDUCE_BITS);
+ wm->delta = ROUND_POWER_OF_TWO_SIGNED(wm->delta, WARP_PARAM_REDUCE_BITS) *
+ (1 << WARP_PARAM_REDUCE_BITS);
return 1;
}
#if CONFIG_HIGHBITDEPTH
-static INLINE void highbd_get_subcolumn(int taps, uint16_t *ref, int32_t *col,
- int stride, int x, int y_start) {
+static INLINE void highbd_get_subcolumn(int taps, const uint16_t *const ref,
+ int32_t *col, int stride, int x,
+ int y_start) {
int i;
for (i = 0; i < taps; ++i) {
col[i] = ref[(i + y_start) * stride + x];
}
}
-static uint16_t highbd_bi_ntap_filter(uint16_t *ref, int x, int y, int stride,
- int bd) {
+static uint16_t highbd_bi_ntap_filter(const uint16_t *const ref, int x, int y,
+ int stride, int bd) {
int32_t val, arr[WARPEDPIXEL_FILTER_TAPS];
int k;
- int i = (int)x >> WARPEDPIXEL_PREC_BITS;
- int j = (int)y >> WARPEDPIXEL_PREC_BITS;
+ const int i = (int)x >> WARPEDPIXEL_PREC_BITS;
+ const int j = (int)y >> WARPEDPIXEL_PREC_BITS;
for (k = 0; k < WARPEDPIXEL_FILTER_TAPS; ++k) {
int32_t arr_temp[WARPEDPIXEL_FILTER_TAPS];
highbd_get_subcolumn(WARPEDPIXEL_FILTER_TAPS, ref, arr_temp, stride,
@@ -805,12 +813,12 @@ static uint16_t highbd_bi_ntap_filter(uint16_t *ref, int x, int y, int stride,
return (uint16_t)clip_pixel_highbd(val, bd);
}
-static uint16_t highbd_bi_cubic_filter(uint16_t *ref, int x, int y, int stride,
- int bd) {
+static uint16_t highbd_bi_cubic_filter(const uint16_t *const ref, int x, int y,
+ int stride, int bd) {
int32_t val, arr[4];
int k;
- int i = (int)x >> WARPEDPIXEL_PREC_BITS;
- int j = (int)y >> WARPEDPIXEL_PREC_BITS;
+ const int i = (int)x >> WARPEDPIXEL_PREC_BITS;
+ const int j = (int)y >> WARPEDPIXEL_PREC_BITS;
for (k = 0; k < 4; ++k) {
int32_t arr_temp[4];
highbd_get_subcolumn(4, ref, arr_temp, stride, i + k - 1, j - 1);
@@ -822,8 +830,8 @@ static uint16_t highbd_bi_cubic_filter(uint16_t *ref, int x, int y, int stride,
return (uint16_t)clip_pixel_highbd(val, bd);
}
-static uint16_t highbd_bi_linear_filter(uint16_t *ref, int x, int y, int stride,
- int bd) {
+static uint16_t highbd_bi_linear_filter(const uint16_t *const ref, int x, int y,
+ int stride, int bd) {
const int ix = x >> WARPEDPIXEL_PREC_BITS;
const int iy = y >> WARPEDPIXEL_PREC_BITS;
const int sx = x - (ix * (1 << WARPEDPIXEL_PREC_BITS));
@@ -839,12 +847,13 @@ static uint16_t highbd_bi_linear_filter(uint16_t *ref, int x, int y, int stride,
return (uint16_t)clip_pixel_highbd(val, bd);
}
-static uint16_t highbd_warp_interpolate(uint16_t *ref, int x, int y, int width,
- int height, int stride, int bd) {
- int ix = x >> WARPEDPIXEL_PREC_BITS;
- int iy = y >> WARPEDPIXEL_PREC_BITS;
- int sx = x - (ix * (1 << WARPEDPIXEL_PREC_BITS));
- int sy = y - (iy * (1 << WARPEDPIXEL_PREC_BITS));
+static uint16_t highbd_warp_interpolate(const uint16_t *const ref, int x, int y,
+ int width, int height, int stride,
+ int bd) {
+ const int ix = x >> WARPEDPIXEL_PREC_BITS;
+ const int iy = y >> WARPEDPIXEL_PREC_BITS;
+ const int sx = x - (ix * (1 << WARPEDPIXEL_PREC_BITS));
+ const int sy = y - (iy * (1 << WARPEDPIXEL_PREC_BITS));
int32_t v;
if (ix < 0 && iy < 0)
@@ -902,17 +911,15 @@ static INLINE int highbd_error_measure(int err, int bd) {
error_measure_lut[256 + e1] * e2;
}
-static void highbd_warp_plane_old(WarpedMotionParams *wm, uint8_t *ref8,
- int width, int height, int stride,
- uint8_t *pred8, int p_col, int p_row,
- int p_width, int p_height, int p_stride,
- int subsampling_x, int subsampling_y,
- int x_scale, int y_scale, int bd,
- int ref_frm) {
+static void highbd_warp_plane_old(
+ const WarpedMotionParams *const wm, const uint8_t *const ref8, int width,
+ int height, int stride, const uint8_t *const pred8, int p_col, int p_row,
+ int p_width, int p_height, int p_stride, int subsampling_x,
+ int subsampling_y, int x_scale, int y_scale, int bd, int comp_avg) {
int i, j;
ProjectPointsFunc projectpoints = get_project_points_type(wm->wmtype);
uint16_t *pred = CONVERT_TO_SHORTPTR(pred8);
- uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
+ const uint16_t *const ref = CONVERT_TO_SHORTPTR(ref8);
if (projectpoints == NULL) return;
for (i = p_row; i < p_row + p_height; ++i) {
for (j = p_col; j < p_col + p_width; ++j) {
@@ -922,7 +929,7 @@ static void highbd_warp_plane_old(WarpedMotionParams *wm, uint8_t *ref8,
projectpoints(wm->wmmat, in, out, 1, 2, 2, subsampling_x, subsampling_y);
out[0] = ROUND_POWER_OF_TWO_SIGNED(out[0] * x_scale, 4);
out[1] = ROUND_POWER_OF_TWO_SIGNED(out[1] * y_scale, 4);
- if (ref_frm)
+ if (comp_avg)
pred[(j - p_col) + (i - p_row) * p_stride] = ROUND_POWER_OF_TWO(
pred[(j - p_col) + (i - p_row) * p_stride] +
highbd_warp_interpolate(ref, out[0], out[1], width, height,
@@ -935,61 +942,33 @@ static void highbd_warp_plane_old(WarpedMotionParams *wm, uint8_t *ref8,
}
}
-// Note: For an explanation of the warp algorithm, see the comment
-// above warp_plane()
-//
-// Note also: The "worst case" in terms of modulus of the data stored into 'tmp'
-// (ie, the result of 'sum' in the horizontal filter) occurs when:
-// coeffs = { -2, 8, -22, 87, 72, -21, 8, -2}, and
-// ref = { 0, 255, 0, 255, 255, 0, 255, 0}
-// Before rounding, this gives sum = 716625. After rounding,
-// HORSHEAR_REDUCE_PREC_BITS = 4 => sum = 44789 > 2^15
-// HORSHEAR_REDUCE_PREC_BITS = 5 => sum = 22395 < 2^15
-//
-// So, as long as HORSHEAR_REDUCE_PREC_BITS >= 5, we can safely use a 16-bit
-// intermediate array.
-void av1_highbd_warp_affine_c(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,
+/* Note: For an explanation of the warp algorithm, and some notes on bit widths
+ for hardware implementations, see the comments above av1_warp_affine_c
+*/
+void av1_highbd_warp_affine_c(const int32_t *mat, const uint16_t *ref,
+ int width, int height, int stride, uint16_t *pred,
+ int p_col, int p_row, int p_width, int p_height,
int p_stride, int subsampling_x,
- int subsampling_y, int bd, int ref_frm,
+ int subsampling_y, int bd, int comp_avg,
int16_t alpha, int16_t beta, int16_t gamma,
int16_t delta) {
-#if HORSHEAR_REDUCE_PREC_BITS >= 5
- int16_t tmp[15 * 8];
-#else
- int32_t tmp[15 * 8];
-#endif
+ uint32_t tmp[15 * 8];
int i, j, k, l, m;
- /* Note: For this code to work, the left/right frame borders need to be
- extended by at least 13 pixels each. By the time we get here, other
- code will have set up this border, but we allow an explicit check
- for debugging purposes.
- */
- /*for (i = 0; i < height; ++i) {
- for (j = 0; j < 13; ++j) {
- assert(ref[i * stride - 13 + j] == ref[i * stride]);
- assert(ref[i * stride + width + j] == ref[i * stride + (width - 1)]);
- }
- }*/
-
for (i = p_row; i < p_row + p_height; i += 8) {
for (j = p_col; j < p_col + p_width; j += 8) {
int32_t x4, y4, ix4, sx4, iy4, sy4;
if (subsampling_x)
- x4 = ROUND_POWER_OF_TWO_SIGNED(
- mat[2] * 2 * (j + 4) + mat[3] * 2 * (i + 4) + mat[0] +
- (mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS)) / 2,
- 1);
+ x4 = (mat[2] * 4 * (j + 4) + mat[3] * 4 * (i + 4) + mat[0] * 2 +
+ (mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS))) /
+ 4;
else
x4 = mat[2] * (j + 4) + mat[3] * (i + 4) + mat[0];
if (subsampling_y)
- y4 = ROUND_POWER_OF_TWO_SIGNED(
- mat[4] * 2 * (j + 4) + mat[5] * 2 * (i + 4) + mat[1] +
- (mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS)) / 2,
- 1);
+ y4 = (mat[4] * 4 * (j + 4) + mat[5] * 4 * (i + 4) + mat[1] * 2 +
+ (mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS))) /
+ 4;
else
y4 = mat[4] * (j + 4) + mat[5] * (i + 4) + mat[1];
@@ -998,6 +977,12 @@ void av1_highbd_warp_affine_c(int32_t *mat, uint16_t *ref, int width,
iy4 = y4 >> WARPEDMODEL_PREC_BITS;
sy4 = y4 & ((1 << WARPEDMODEL_PREC_BITS) - 1);
+ sx4 += alpha * (-4) + beta * (-4);
+ sy4 += gamma * (-4) + delta * (-4);
+
+ sx4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1);
+ sy4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1);
+
// Horizontal filter
for (k = -7; k < 8; ++k) {
int iy = iy4 + k;
@@ -1006,62 +991,56 @@ void av1_highbd_warp_affine_c(int32_t *mat, uint16_t *ref, int width,
else if (iy > height - 1)
iy = height - 1;
- if (ix4 <= -7) {
- for (l = 0; l < 8; ++l) {
- tmp[(k + 7) * 8 + l] =
- ref[iy * stride] *
- (1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS));
- }
- } else if (ix4 >= width + 6) {
- for (l = 0; l < 8; ++l) {
- tmp[(k + 7) * 8 + l] =
- ref[iy * stride + (width - 1)] *
- (1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS));
- }
- } else {
- int sx = sx4 + alpha * (-4) + beta * k;
-
- for (l = -4; l < 4; ++l) {
- int ix = ix4 + l - 3;
- const int offs = ROUND_POWER_OF_TWO(sx, WARPEDDIFF_PREC_BITS) +
- WARPEDPIXEL_PREC_SHIFTS;
- const int16_t *coeffs = warped_filter[offs];
- int32_t sum = 0;
- // assert(offs >= 0 && offs <= WARPEDPIXEL_PREC_SHIFTS * 3);
- for (m = 0; m < 8; ++m) {
- sum += ref[iy * stride + ix + m] * coeffs[m];
- }
- sum = ROUND_POWER_OF_TWO(sum, HORSHEAR_REDUCE_PREC_BITS);
-#if HORSHEAR_REDUCE_PREC_BITS >= 5
- tmp[(k + 7) * 8 + (l + 4)] = saturate_int16(sum);
-#else
- tmp[(k + 7) * 8 + (l + 4)] = sum;
-#endif
- sx += alpha;
+ int sx = sx4 + beta * (k + 4);
+ for (l = -4; l < 4; ++l) {
+ int ix = ix4 + l - 3;
+ const int offs = ROUND_POWER_OF_TWO(sx, WARPEDDIFF_PREC_BITS) +
+ WARPEDPIXEL_PREC_SHIFTS;
+ assert(offs >= 0 && offs <= WARPEDPIXEL_PREC_SHIFTS * 3);
+ const int16_t *coeffs = warped_filter[offs];
+
+ int32_t sum = 1 << (bd + WARPEDPIXEL_FILTER_BITS - 1);
+ for (m = 0; m < 8; ++m) {
+ int sample_x = ix + m;
+ if (sample_x < 0)
+ sample_x = 0;
+ else if (sample_x > width - 1)
+ sample_x = width - 1;
+ sum += ref[iy * stride + sample_x] * coeffs[m];
}
+ sum = ROUND_POWER_OF_TWO(sum, HORSHEAR_REDUCE_PREC_BITS);
+ assert(0 <= sum &&
+ sum < (1 << (bd + WARPEDPIXEL_FILTER_BITS + 1 -
+ HORSHEAR_REDUCE_PREC_BITS)));
+ tmp[(k + 7) * 8 + (l + 4)] = sum;
+ sx += alpha;
}
}
// Vertical filter
for (k = -4; k < AOMMIN(4, p_row + p_height - i - 4); ++k) {
- int sy = sy4 + gamma * (-4) + delta * k;
+ int sy = sy4 + delta * (k + 4);
for (l = -4; l < 4; ++l) {
uint16_t *p =
&pred[(i - p_row + k + 4) * p_stride + (j - p_col + l + 4)];
const int offs = ROUND_POWER_OF_TWO(sy, WARPEDDIFF_PREC_BITS) +
WARPEDPIXEL_PREC_SHIFTS;
+ assert(offs >= 0 && offs <= WARPEDPIXEL_PREC_SHIFTS * 3);
const int16_t *coeffs = warped_filter[offs];
- int32_t sum = 0;
- // assert(offs >= 0 && offs <= WARPEDPIXEL_PREC_SHIFTS * 3);
+
+ int32_t sum = 1 << (bd + 2 * WARPEDPIXEL_FILTER_BITS -
+ HORSHEAR_REDUCE_PREC_BITS);
for (m = 0; m < 8; ++m) {
sum += tmp[(k + m + 4) * 8 + (l + 4)] * coeffs[m];
}
- sum = clip_pixel_highbd(
- ROUND_POWER_OF_TWO(sum, VERSHEAR_REDUCE_PREC_BITS), bd);
- if (ref_frm)
- *p = ROUND_POWER_OF_TWO(*p + sum, 1);
+ sum = ROUND_POWER_OF_TWO(sum, VERSHEAR_REDUCE_PREC_BITS);
+ assert(0 <= sum && sum < (1 << (bd + 2)));
+ uint16_t px =
+ clip_pixel_highbd(sum - (1 << (bd - 1)) - (1 << bd), bd);
+ if (comp_avg)
+ *p = ROUND_POWER_OF_TWO(*p + px, 1);
else
- *p = sum;
+ *p = px;
sy += gamma;
}
}
@@ -1069,63 +1048,69 @@ void av1_highbd_warp_affine_c(int32_t *mat, uint16_t *ref, int width,
}
}
-static void highbd_warp_plane(WarpedMotionParams *wm, uint8_t *ref8, int width,
- int height, int stride, uint8_t *pred8, int p_col,
- int p_row, int p_width, int p_height,
- int p_stride, int subsampling_x,
- int subsampling_y, int x_scale, int y_scale,
- int bd, int ref_frm) {
+static void highbd_warp_plane(WarpedMotionParams *wm, const uint8_t *const ref8,
+ int width, int height, int stride,
+ const uint8_t *const pred8, int p_col, int p_row,
+ int p_width, int p_height, int p_stride,
+ int subsampling_x, int subsampling_y, int x_scale,
+ int y_scale, int bd, int comp_avg) {
if (wm->wmtype == ROTZOOM) {
wm->wmmat[5] = wm->wmmat[2];
wm->wmmat[4] = -wm->wmmat[3];
}
if ((wm->wmtype == ROTZOOM || wm->wmtype == AFFINE) && x_scale == 16 &&
y_scale == 16) {
- int32_t *mat = wm->wmmat;
+ const int32_t *const mat = wm->wmmat;
const int16_t alpha = wm->alpha;
const int16_t beta = wm->beta;
const int16_t gamma = wm->gamma;
const int16_t delta = wm->delta;
- uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
+ const uint16_t *const ref = CONVERT_TO_SHORTPTR(ref8);
uint16_t *pred = CONVERT_TO_SHORTPTR(pred8);
av1_highbd_warp_affine(mat, ref, width, height, stride, pred, p_col, p_row,
p_width, p_height, p_stride, subsampling_x,
- subsampling_y, bd, ref_frm, alpha, beta, gamma,
+ subsampling_y, bd, comp_avg, alpha, beta, gamma,
delta);
} else {
highbd_warp_plane_old(wm, ref8, width, height, stride, pred8, p_col, p_row,
p_width, p_height, p_stride, subsampling_x,
- subsampling_y, x_scale, y_scale, bd, ref_frm);
+ subsampling_y, x_scale, y_scale, bd, comp_avg);
}
}
-static double highbd_warp_erroradv(WarpedMotionParams *wm, uint8_t *ref8,
- int width, int height, int stride,
- uint8_t *dst8, int p_col, int p_row,
- int p_width, int p_height, int p_stride,
- int subsampling_x, int subsampling_y,
- int x_scale, int y_scale, int bd) {
- int gm_err = 0, no_gm_err = 0;
- int64_t gm_sumerr = 0, no_gm_sumerr = 0;
- int i, j;
+static int64_t highbd_frame_error(const uint16_t *const ref, int stride,
+ const uint16_t *const dst, int p_col,
+ int p_row, int p_width, int p_height,
+ int p_stride, int bd) {
+ int64_t sum_error = 0;
+ for (int i = 0; i < p_height; ++i) {
+ for (int j = 0; j < p_width; ++j) {
+ sum_error += highbd_error_measure(
+ dst[j + i * p_stride] - ref[(j + p_col) + (i + p_row) * stride], bd);
+ }
+ }
+ return sum_error;
+}
+
+static int64_t highbd_warp_error(
+ WarpedMotionParams *wm, const uint8_t *const ref8, int width, int height,
+ int stride, const uint8_t *const dst8, int p_col, int p_row, int p_width,
+ int p_height, int p_stride, int subsampling_x, int subsampling_y,
+ int x_scale, int y_scale, int bd) {
+ int64_t gm_sumerr = 0;
uint16_t *tmp = aom_malloc(p_width * p_height * sizeof(*tmp));
- uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
- uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
+ if (!tmp) return INT64_MAX;
+
highbd_warp_plane(wm, ref8, width, height, stride, CONVERT_TO_BYTEPTR(tmp),
p_col, p_row, p_width, p_height, p_width, subsampling_x,
subsampling_y, x_scale, y_scale, bd, 0);
- for (i = 0; i < p_height; ++i) {
- for (j = 0; j < p_width; ++j) {
- gm_err = dst[j + i * p_stride] - tmp[j + i * p_width];
- no_gm_err =
- dst[j + i * p_stride] - ref[(j + p_col) + (i + p_row) * stride];
- gm_sumerr += highbd_error_measure(gm_err, bd);
- no_gm_sumerr += highbd_error_measure(no_gm_err, bd);
- }
- }
+
+ gm_sumerr = highbd_frame_error(tmp, p_width, CONVERT_TO_SHORTPTR(dst8), p_col,
+ p_row, p_width, p_height, p_stride, bd);
+
aom_free(tmp);
- return (double)gm_sumerr / no_gm_sumerr;
+ return gm_sumerr;
}
#endif // CONFIG_HIGHBITDEPTH
@@ -1133,11 +1118,12 @@ static INLINE int error_measure(int err) {
return error_measure_lut[255 + err];
}
-static void warp_plane_old(WarpedMotionParams *wm, 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,
+static void warp_plane_old(const WarpedMotionParams *const wm,
+ const uint8_t *const 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 x_scale,
- int y_scale, int ref_frm) {
+ int y_scale, int comp_avg) {
int i, j;
ProjectPointsFunc projectpoints = get_project_points_type(wm->wmtype);
if (projectpoints == NULL) return;
@@ -1149,7 +1135,7 @@ static void warp_plane_old(WarpedMotionParams *wm, uint8_t *ref, int width,
projectpoints(wm->wmmat, in, out, 1, 2, 2, subsampling_x, subsampling_y);
out[0] = ROUND_POWER_OF_TWO_SIGNED(out[0] * x_scale, 4);
out[1] = ROUND_POWER_OF_TWO_SIGNED(out[1] * y_scale, 4);
- if (ref_frm)
+ if (comp_avg)
pred[(j - p_col) + (i - p_row) * p_stride] = ROUND_POWER_OF_TWO(
pred[(j - p_col) + (i - p_row) * p_stride] +
warp_interpolate(ref, out[0], out[1], width, height, stride),
@@ -1180,61 +1166,96 @@ static void warp_plane_old(WarpedMotionParams *wm, uint8_t *ref, int width,
/ a b \ = / 1 0 \ * / 1+alpha beta \
\ c d / \ gamma 1+delta / \ 0 1 /
where a, b, c, d are wmmat[2], wmmat[3], wmmat[4], wmmat[5] respectively.
- The second shear (with alpha and beta) is applied by the horizontal filter,
- then the first shear (with gamma and delta) is applied by the vertical
- filter.
+ The horizontal shear (with alpha and beta) is applied first,
+ then the vertical shear (with gamma and delta) is applied second.
The only limitation is that, to fit this in a fixed 8-tap filter size,
the fractional pixel offsets must be at most +-1. Since the horizontal filter
generates 15 rows of 8 columns, and the initial point we project is at (4, 4)
within the block, the parameters must satisfy
- 4 * |alpha| + 7 * |beta| <= 1 and 4 * |gamma| + 7 * |delta| <= 1
+ 4 * |alpha| + 7 * |beta| <= 1 and 4 * |gamma| + 4 * |delta| <= 1
for this filter to be applicable.
- Note: warp_affine() assumes that the caller has done all of the relevant
+ Note: This function assumes that the caller has done all of the relevant
checks, ie. that we have a ROTZOOM or AFFINE model, that wm[4] and wm[5]
are set appropriately (if using a ROTZOOM model), and that alpha, beta,
gamma, delta are all in range.
TODO(david.barker): Maybe support scaled references?
*/
-void av1_warp_affine_c(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,
+/* A note on hardware implementation:
+ The warp filter is intended to be implementable using the same hardware as
+ the high-precision convolve filters from the loop-restoration and
+ convolve-round experiments.
+
+ For a single filter stage, considering all of the coefficient sets for the
+ warp filter and the regular convolution filter, an input in the range
+ [0, 2^k - 1] is mapped into the range [-56 * (2^k - 1), 184 * (2^k - 1)]
+ before rounding.
+
+ Allowing for some changes to the filter coefficient sets, call the range
+ [-64 * 2^k, 192 * 2^k]. Then, if we initialize the accumulator to 64 * 2^k,
+ we can replace this by the range [0, 256 * 2^k], which can be stored in an
+ unsigned value with 8 + k bits.
+
+ This allows the derivation of the appropriate bit widths and offsets for
+ the various intermediate values: If
+
+ F := WARPEDPIXEL_FILTER_BITS = 7 (or else the above ranges need adjusting)
+ So a *single* filter stage maps a k-bit input to a (k + F + 1)-bit
+ intermediate value.
+ H := HORSHEAR_REDUCE_PREC_BITS
+ V := VERSHEAR_REDUCE_PREC_BITS
+ (and note that we must have H + V = 2*F for the output to have the same
+ scale as the input)
+
+ then we end up with the following offsets and ranges:
+ Horizontal filter: Apply an offset of 1 << (bd + F - 1), sum fits into a
+ uint{bd + F + 1}
+ After rounding: The values stored in 'tmp' fit into a uint{bd + F + 1 - H}.
+ Vertical filter: Apply an offset of 1 << (bd + 2*F - H), sum fits into a
+ uint{bd + 2*F + 2 - H}
+ After rounding: The final value, before undoing the offset, fits into a
+ uint{bd + 2}.
+
+ Then we need to undo the offsets before clamping to a pixel. Note that,
+ if we do this at the end, the amount to subtract is actually independent
+ of H and V:
+
+ offset to subtract = (1 << ((bd + F - 1) - H + F - V)) +
+ (1 << ((bd + 2*F - H) - V))
+ == (1 << (bd - 1)) + (1 << bd)
+
+ This allows us to entirely avoid clamping in both the warp filter and
+ the convolve-round experiment. As of the time of writing, the Wiener filter
+ from loop-restoration can encode a central coefficient up to 216, which
+ leads to a maximum value of about 282 * 2^k after applying the offset.
+ So in that case we still need to clamp.
+*/
+void av1_warp_affine_c(const int32_t *mat, const uint8_t *ref, int width,
+ int height, int stride, uint8_t *pred, int p_col,
+ int p_row, int p_width, int p_height, int p_stride,
+ int subsampling_x, int subsampling_y, int comp_avg,
int16_t alpha, int16_t beta, int16_t gamma,
int16_t delta) {
- int16_t tmp[15 * 8];
+ uint16_t tmp[15 * 8];
int i, j, k, l, m;
-
- /* Note: For this code to work, the left/right frame borders need to be
- extended by at least 13 pixels each. By the time we get here, other
- code will have set up this border, but we allow an explicit check
- for debugging purposes.
- */
- /*for (i = 0; i < height; ++i) {
- for (j = 0; j < 13; ++j) {
- assert(ref[i * stride - 13 + j] == ref[i * stride]);
- assert(ref[i * stride + width + j] == ref[i * stride + (width - 1)]);
- }
- }*/
+ const int bd = 8;
for (i = p_row; i < p_row + p_height; i += 8) {
for (j = p_col; j < p_col + p_width; j += 8) {
int32_t x4, y4, ix4, sx4, iy4, sy4;
if (subsampling_x)
- x4 = ROUND_POWER_OF_TWO_SIGNED(
- mat[2] * 2 * (j + 4) + mat[3] * 2 * (i + 4) + mat[0] +
- (mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS)) / 2,
- 1);
+ x4 = (mat[2] * 4 * (j + 4) + mat[3] * 4 * (i + 4) + mat[0] * 2 +
+ (mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS))) /
+ 4;
else
x4 = mat[2] * (j + 4) + mat[3] * (i + 4) + mat[0];
if (subsampling_y)
- y4 = ROUND_POWER_OF_TWO_SIGNED(
- mat[4] * 2 * (j + 4) + mat[5] * 2 * (i + 4) + mat[1] +
- (mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS)) / 2,
- 1);
+ y4 = (mat[4] * 4 * (j + 4) + mat[5] * 4 * (i + 4) + mat[1] * 2 +
+ (mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS))) /
+ 4;
else
y4 = mat[4] * (j + 4) + mat[5] * (i + 4) + mat[1];
@@ -1243,82 +1264,75 @@ void av1_warp_affine_c(int32_t *mat, uint8_t *ref, int width, int height,
iy4 = y4 >> WARPEDMODEL_PREC_BITS;
sy4 = y4 & ((1 << WARPEDMODEL_PREC_BITS) - 1);
+ sx4 += alpha * (-4) + beta * (-4);
+ sy4 += gamma * (-4) + delta * (-4);
+
+ sx4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1);
+ sy4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1);
+
// Horizontal filter
for (k = -7; k < 8; ++k) {
+ // Clamp to top/bottom edge of the frame
int iy = iy4 + k;
if (iy < 0)
iy = 0;
else if (iy > height - 1)
iy = height - 1;
- if (ix4 <= -7) {
- // In this case, the rightmost pixel sampled is in column
- // ix4 + 3 + 7 - 3 = ix4 + 7 <= 0, ie. the entire block
- // will sample only from the leftmost column
- // (once border extension is taken into account)
- for (l = 0; l < 8; ++l) {
- tmp[(k + 7) * 8 + l] =
- ref[iy * stride] *
- (1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS));
- }
- } else if (ix4 >= width + 6) {
- // In this case, the leftmost pixel sampled is in column
- // ix4 - 4 + 0 - 3 = ix4 - 7 >= width - 1, ie. the entire block
- // will sample only from the rightmost column
- // (once border extension is taken into account)
- for (l = 0; l < 8; ++l) {
- tmp[(k + 7) * 8 + l] =
- ref[iy * stride + (width - 1)] *
- (1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS));
- }
- } else {
- // If we get here, then
- // the leftmost pixel sampled is
- // ix4 - 4 + 0 - 3 = ix4 - 7 >= -13
- // and the rightmost pixel sampled is at most
- // ix4 + 3 + 7 - 3 = ix4 + 7 <= width + 12
- // So, assuming that border extension has been done, we
- // don't need to explicitly clamp values.
- int sx = sx4 + alpha * (-4) + beta * k;
-
- for (l = -4; l < 4; ++l) {
- int ix = ix4 + l - 3;
- // At this point, sx = sx4 + alpha * l + beta * k
- const int offs = ROUND_POWER_OF_TWO(sx, WARPEDDIFF_PREC_BITS) +
- WARPEDPIXEL_PREC_SHIFTS;
- const int16_t *coeffs = warped_filter[offs];
- int32_t sum = 0;
- // assert(offs >= 0 && offs <= WARPEDPIXEL_PREC_SHIFTS * 3);
- for (m = 0; m < 8; ++m) {
- sum += ref[iy * stride + ix + m] * coeffs[m];
- }
- sum = ROUND_POWER_OF_TWO(sum, HORSHEAR_REDUCE_PREC_BITS);
- tmp[(k + 7) * 8 + (l + 4)] = saturate_int16(sum);
- sx += alpha;
+ int sx = sx4 + beta * (k + 4);
+
+ for (l = -4; l < 4; ++l) {
+ int ix = ix4 + l - 3;
+ // At this point, sx = sx4 + alpha * l + beta * k
+ const int offs = ROUND_POWER_OF_TWO(sx, WARPEDDIFF_PREC_BITS) +
+ WARPEDPIXEL_PREC_SHIFTS;
+ assert(offs >= 0 && offs <= WARPEDPIXEL_PREC_SHIFTS * 3);
+ const int16_t *coeffs = warped_filter[offs];
+
+ int32_t sum = 1 << (bd + WARPEDPIXEL_FILTER_BITS - 1);
+ for (m = 0; m < 8; ++m) {
+ // Clamp to left/right edge of the frame
+ int sample_x = ix + m;
+ if (sample_x < 0)
+ sample_x = 0;
+ else if (sample_x > width - 1)
+ sample_x = width - 1;
+
+ sum += ref[iy * stride + sample_x] * coeffs[m];
}
+ sum = ROUND_POWER_OF_TWO(sum, HORSHEAR_REDUCE_PREC_BITS);
+ assert(0 <= sum &&
+ sum < (1 << (bd + WARPEDPIXEL_FILTER_BITS + 1 -
+ HORSHEAR_REDUCE_PREC_BITS)));
+ tmp[(k + 7) * 8 + (l + 4)] = sum;
+ sx += alpha;
}
}
// Vertical filter
for (k = -4; k < AOMMIN(4, p_row + p_height - i - 4); ++k) {
- int sy = sy4 + gamma * (-4) + delta * k;
+ int sy = sy4 + delta * (k + 4);
for (l = -4; l < AOMMIN(4, p_col + p_width - j - 4); ++l) {
uint8_t *p =
&pred[(i - p_row + k + 4) * p_stride + (j - p_col + l + 4)];
// At this point, sy = sy4 + gamma * l + delta * k
const int offs = ROUND_POWER_OF_TWO(sy, WARPEDDIFF_PREC_BITS) +
WARPEDPIXEL_PREC_SHIFTS;
+ assert(offs >= 0 && offs <= WARPEDPIXEL_PREC_SHIFTS * 3);
const int16_t *coeffs = warped_filter[offs];
- int32_t sum = 0;
- // assert(offs >= 0 && offs <= WARPEDPIXEL_PREC_SHIFTS * 3);
+
+ int32_t sum = 1 << (bd + 2 * WARPEDPIXEL_FILTER_BITS -
+ HORSHEAR_REDUCE_PREC_BITS);
for (m = 0; m < 8; ++m) {
sum += tmp[(k + m + 4) * 8 + (l + 4)] * coeffs[m];
}
- sum = clip_pixel(ROUND_POWER_OF_TWO(sum, VERSHEAR_REDUCE_PREC_BITS));
- if (ref_frm)
- *p = ROUND_POWER_OF_TWO(*p + sum, 1);
+ sum = ROUND_POWER_OF_TWO(sum, VERSHEAR_REDUCE_PREC_BITS);
+ assert(0 <= sum && sum < (1 << (bd + 2)));
+ uint8_t px = clip_pixel(sum - (1 << (bd - 1)) - (1 << bd));
+ if (comp_avg)
+ *p = ROUND_POWER_OF_TWO(*p + px, 1);
else
- *p = sum;
+ *p = px;
sy += gamma;
}
}
@@ -1326,18 +1340,18 @@ void av1_warp_affine_c(int32_t *mat, uint8_t *ref, int width, int height,
}
}
-static void warp_plane(WarpedMotionParams *wm, 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 x_scale,
- int y_scale, int ref_frm) {
+static void warp_plane(WarpedMotionParams *wm, const uint8_t *const 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 x_scale, int y_scale, int comp_avg) {
if (wm->wmtype == ROTZOOM) {
wm->wmmat[5] = wm->wmmat[2];
wm->wmmat[4] = -wm->wmmat[3];
}
if ((wm->wmtype == ROTZOOM || wm->wmtype == AFFINE) && x_scale == 16 &&
y_scale == 16) {
- int32_t *mat = wm->wmmat;
+ const int32_t *const mat = wm->wmmat;
const int16_t alpha = wm->alpha;
const int16_t beta = wm->beta;
const int16_t gamma = wm->gamma;
@@ -1345,80 +1359,104 @@ static void warp_plane(WarpedMotionParams *wm, uint8_t *ref, int width,
av1_warp_affine(mat, ref, width, height, stride, pred, p_col, p_row,
p_width, p_height, p_stride, subsampling_x, subsampling_y,
- ref_frm, alpha, beta, gamma, delta);
+ comp_avg, alpha, beta, gamma, delta);
} else {
warp_plane_old(wm, ref, width, height, stride, pred, p_col, p_row, p_width,
p_height, p_stride, subsampling_x, subsampling_y, x_scale,
- y_scale, ref_frm);
+ y_scale, comp_avg);
}
}
-static double warp_erroradv(WarpedMotionParams *wm, uint8_t *ref, int width,
- int height, int stride, uint8_t *dst, int p_col,
- int p_row, int p_width, int p_height, int p_stride,
- int subsampling_x, int subsampling_y, int x_scale,
- int y_scale) {
- int gm_err = 0, no_gm_err = 0;
- int gm_sumerr = 0, no_gm_sumerr = 0;
- int i, j;
+static int64_t frame_error(const uint8_t *const ref, int stride,
+ const uint8_t *const dst, int p_col, int p_row,
+ int p_width, int p_height, int p_stride) {
+ int64_t sum_error = 0;
+ for (int i = 0; i < p_height; ++i) {
+ for (int j = 0; j < p_width; ++j) {
+ sum_error += (int64_t)error_measure(
+ dst[j + i * p_stride] - ref[(j + p_col) + (i + p_row) * stride]);
+ }
+ }
+ return sum_error;
+}
+
+static int64_t warp_error(WarpedMotionParams *wm, const uint8_t *const ref,
+ int width, int height, int stride,
+ const uint8_t *const dst, int p_col, int p_row,
+ int p_width, int p_height, int p_stride,
+ int subsampling_x, int subsampling_y, int x_scale,
+ int y_scale) {
+ int64_t gm_sumerr = 0;
uint8_t *tmp = aom_malloc(p_width * p_height);
+ if (!tmp) return INT64_MAX;
+
warp_plane(wm, ref, width, height, stride, tmp, p_col, p_row, p_width,
p_height, p_width, subsampling_x, subsampling_y, x_scale, y_scale,
0);
- for (i = 0; i < p_height; ++i) {
- for (j = 0; j < p_width; ++j) {
- gm_err = dst[j + i * p_stride] - tmp[j + i * p_width];
- no_gm_err =
- dst[j + i * p_stride] - ref[(j + p_col) + (i + p_row) * stride];
- gm_sumerr += error_measure(gm_err);
- no_gm_sumerr += error_measure(no_gm_err);
- }
- }
+ gm_sumerr =
+ frame_error(tmp, p_width, dst, p_col, p_row, p_width, p_height, p_stride);
aom_free(tmp);
- return (double)gm_sumerr / no_gm_sumerr;
+ return gm_sumerr;
}
-double av1_warp_erroradv(WarpedMotionParams *wm,
+int64_t av1_frame_error(
#if CONFIG_HIGHBITDEPTH
- int use_hbd, int bd,
+ int use_hbd, int bd,
#endif // CONFIG_HIGHBITDEPTH
- uint8_t *ref, int width, int height, int stride,
- uint8_t *dst, int p_col, int p_row, int p_width,
- int p_height, int p_stride, int subsampling_x,
- int subsampling_y, int x_scale, int y_scale) {
+ const uint8_t *ref, int stride, uint8_t *dst, int p_col, int p_row,
+ int p_width, int p_height, int p_stride) {
+#if CONFIG_HIGHBITDEPTH
+ if (use_hbd) {
+ return highbd_frame_error(CONVERT_TO_SHORTPTR(ref), stride,
+ CONVERT_TO_SHORTPTR(dst), p_col, p_row, p_width,
+ p_height, p_stride, bd);
+ }
+#endif // CONFIG_HIGHBITDEPTH
+ return frame_error(ref, stride, dst, p_col, p_row, p_width, p_height,
+ p_stride);
+}
+
+int64_t av1_warp_error(WarpedMotionParams *wm,
+#if CONFIG_HIGHBITDEPTH
+ int use_hbd, int bd,
+#endif // CONFIG_HIGHBITDEPTH
+ const uint8_t *ref, int width, int height, int stride,
+ uint8_t *dst, int p_col, int p_row, int p_width,
+ int p_height, int p_stride, int subsampling_x,
+ int subsampling_y, int x_scale, int y_scale) {
if (wm->wmtype <= AFFINE)
if (!get_shear_params(wm)) return 1;
#if CONFIG_HIGHBITDEPTH
if (use_hbd)
- return highbd_warp_erroradv(
- wm, ref, width, height, stride, dst, p_col, p_row, p_width, p_height,
- p_stride, subsampling_x, subsampling_y, x_scale, y_scale, bd);
+ return highbd_warp_error(wm, ref, width, height, stride, dst, p_col, p_row,
+ p_width, p_height, p_stride, subsampling_x,
+ subsampling_y, x_scale, y_scale, bd);
#endif // CONFIG_HIGHBITDEPTH
- return warp_erroradv(wm, ref, width, height, stride, dst, p_col, p_row,
- p_width, p_height, p_stride, subsampling_x,
- subsampling_y, x_scale, y_scale);
+ return warp_error(wm, ref, width, height, stride, dst, p_col, p_row, p_width,
+ p_height, p_stride, subsampling_x, subsampling_y, x_scale,
+ y_scale);
}
void av1_warp_plane(WarpedMotionParams *wm,
#if CONFIG_HIGHBITDEPTH
int use_hbd, int bd,
#endif // CONFIG_HIGHBITDEPTH
- uint8_t *ref, int width, int height, int stride,
+ const uint8_t *ref, int width, int height, int stride,
uint8_t *pred, int p_col, int p_row, int p_width,
int p_height, int p_stride, int subsampling_x,
- int subsampling_y, int x_scale, int y_scale, int ref_frm) {
+ int subsampling_y, int x_scale, int y_scale, int comp_avg) {
#if CONFIG_HIGHBITDEPTH
if (use_hbd)
highbd_warp_plane(wm, ref, width, height, stride, pred, p_col, p_row,
p_width, p_height, p_stride, subsampling_x, subsampling_y,
- x_scale, y_scale, bd, ref_frm);
+ x_scale, y_scale, bd, comp_avg);
else
#endif // CONFIG_HIGHBITDEPTH
warp_plane(wm, ref, width, height, stride, pred, p_col, p_row, p_width,
p_height, p_stride, subsampling_x, subsampling_y, x_scale,
- y_scale, ref_frm);
+ y_scale, comp_avg);
}
#if CONFIG_WARPED_MOTION
@@ -1454,7 +1492,6 @@ void av1_warp_plane(WarpedMotionParams *wm,
#define LS_PRODUCT2(a, b) \
(((a) * (b)*4 + ((a) + (b)) * 2 * LS_STEP + LS_STEP * LS_STEP * 2) >> 2)
-#if LEAST_SQUARES_ORDER == 2
static int find_affine_int(int np, int *pts1, int *pts2, BLOCK_SIZE bsize,
int mvy, int mvx, WarpedMotionParams *wm, int mi_row,
int mi_col) {
@@ -1588,164 +1625,6 @@ static int find_affine_int(int np, int *pts1, int *pts2, BLOCK_SIZE bsize,
return 0;
}
-#else
-
-static int find_affine_int(int np, int *pts1, int *pts2, BLOCK_SIZE bsize,
- int mvy, int mvx, WarpedMotionParams *wm, int mi_row,
- int mi_col) {
- int32_t A[3][3] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };
- int32_t Bx[3] = { 0, 0, 0 };
- int32_t By[3] = { 0, 0, 0 };
- int i, n = 0, off;
-
- int64_t C00, C01, C02, C11, C12, C22;
- int64_t Px[3], Py[3];
- int64_t Det, v;
- const int bw = block_size_wide[bsize];
- const int bh = block_size_high[bsize];
- const int cy_offset = AOMMAX(bh, MI_SIZE) / 2 - 1;
- const int cx_offset = AOMMAX(bw, MI_SIZE) / 2 - 1;
-
- // Offsets to make the values in the arrays smaller
- const int ux = mi_col * MI_SIZE * 8, uy = mi_row * MI_SIZE * 8;
- // Let source points (xi, yi) map to destimation points (xi', yi'),
- // for i = 0, 1, 2, .... n-1
- // Then if P = [x0, y0, 1,
- // x1, y1, 1
- // x2, y2, 1,
- // ....
- // ]
- // q = [x0', x1', x2', ... ]'
- // r = [y0', y1', y2', ... ]'
- // the least squares problems that need to be solved are:
- // [h1, h2, dx]' = inv(P'P)P'q and
- // [h3, h4, dy]' = inv(P'P)P'r
- // where the affine transformation is given by:
- // x' = h1.x + h2.y + dx
- // y' = h3.x + h4.y + dy
- //
- // The loop below computes: A = P'P, Bx = P'q, By = P'r
- // We need to just compute inv(A).Bx and inv(A).By for the solutions.
- //
- int sx, sy, dx, dy;
- // Contribution from sample in current block
- sx = cx_offset * 8;
- sy = cy_offset * 8;
- dx = sx + mvx;
- dy = sy + mvy;
- if (abs(sx - dx) < LS_MV_MAX && abs(sy - dy) < LS_MV_MAX) {
- A[0][0] += LS_SQUARE(sx);
- A[0][1] += LS_PRODUCT1(sx, sy);
- A[0][2] += LS_SUM(sx);
- A[1][1] += LS_SQUARE(sy);
- A[1][2] += LS_SUM(sy);
- A[2][2] += 4;
- Bx[0] += LS_PRODUCT2(sx, dx);
- Bx[1] += LS_PRODUCT1(sy, dx);
- Bx[2] += LS_SUM(dx);
- By[0] += LS_PRODUCT1(sx, dy);
- By[1] += LS_PRODUCT2(sy, dy);
- By[2] += LS_SUM(dy);
- n++;
- }
- // Contribution from neighbor block
- for (i = 0; i < np && n < LEAST_SQUARES_SAMPLES_MAX; i++) {
- dx = pts2[i * 2] - ux;
- dy = pts2[i * 2 + 1] - uy;
- sx = pts1[i * 2] - ux;
- sy = pts1[i * 2 + 1] - uy;
- if (abs(sx - dx) < LS_MV_MAX && abs(sy - dy) < LS_MV_MAX) {
- A[0][0] += LS_SQUARE(sx);
- A[0][1] += LS_PRODUCT1(sx, sy);
- A[0][2] += LS_SUM(sx);
- A[1][1] += LS_SQUARE(sy);
- A[1][2] += LS_SUM(sy);
- A[2][2] += 4;
- Bx[0] += LS_PRODUCT2(sx, dx);
- Bx[1] += LS_PRODUCT1(sy, dx);
- Bx[2] += LS_SUM(dx);
- By[0] += LS_PRODUCT1(sx, dy);
- By[1] += LS_PRODUCT2(sy, dy);
- By[2] += LS_SUM(dy);
- n++;
- }
- }
- // Compute Cofactors of A
- C00 = (int64_t)A[1][1] * A[2][2] - (int64_t)A[1][2] * A[1][2];
- C01 = (int64_t)A[1][2] * A[0][2] - (int64_t)A[0][1] * A[2][2];
- C02 = (int64_t)A[0][1] * A[1][2] - (int64_t)A[0][2] * A[1][1];
- C11 = (int64_t)A[0][0] * A[2][2] - (int64_t)A[0][2] * A[0][2];
- C12 = (int64_t)A[0][1] * A[0][2] - (int64_t)A[0][0] * A[1][2];
- C22 = (int64_t)A[0][0] * A[1][1] - (int64_t)A[0][1] * A[0][1];
-
- // Scale by 1/64
- C00 = ROUND_POWER_OF_TWO_SIGNED(C00, 6);
- C01 = ROUND_POWER_OF_TWO_SIGNED(C01, 6);
- C02 = ROUND_POWER_OF_TWO_SIGNED(C02, 6);
- C11 = ROUND_POWER_OF_TWO_SIGNED(C11, 6);
- C12 = ROUND_POWER_OF_TWO_SIGNED(C12, 6);
- C22 = ROUND_POWER_OF_TWO_SIGNED(C22, 6);
-
- // Compute Determinant of A
- Det = C00 * A[0][0] + C01 * A[0][1] + C02 * A[0][2];
- if (Det == 0) return 1;
-
- // These divided by the Det, are the least squares solutions
- Px[0] = C00 * Bx[0] + C01 * Bx[1] + C02 * Bx[2];
- Px[1] = C01 * Bx[0] + C11 * Bx[1] + C12 * Bx[2];
- Px[2] = C02 * Bx[0] + C12 * Bx[1] + C22 * Bx[2];
- Py[0] = C00 * By[0] + C01 * By[1] + C02 * By[2];
- Py[1] = C01 * By[0] + C11 * By[1] + C12 * By[2];
- Py[2] = C02 * By[0] + C12 * By[1] + C22 * By[2];
-
- int16_t shift;
- int64_t iDet;
- iDet = resolve_divisor_64(llabs(Det), &shift) * (Det < 0 ? -1 : 1);
- shift -= WARPEDMODEL_PREC_BITS;
- if (shift < 0) {
- iDet <<= (-shift);
- shift = 0;
- }
-
- v = Px[0] * iDet;
- wm->wmmat[2] = ROUND_POWER_OF_TWO_SIGNED_64(v, shift);
- v = Px[1] * iDet;
- wm->wmmat[3] = ROUND_POWER_OF_TWO_SIGNED_64(v, shift);
- v = Px[2] * iDet;
- wm->wmmat[0] = ROUND_POWER_OF_TWO_SIGNED_64(v, shift + 3);
- // Adjust x displacement for the offset
- off = (ux << WARPEDMODEL_PREC_BITS) - ux * wm->wmmat[2] - uy * wm->wmmat[3];
- wm->wmmat[0] += ROUND_POWER_OF_TWO_SIGNED(off, 3);
-
- v = Py[0] * iDet;
- wm->wmmat[4] = ROUND_POWER_OF_TWO_SIGNED_64(v, shift);
- v = Py[1] * iDet;
- wm->wmmat[5] = ROUND_POWER_OF_TWO_SIGNED_64(v, shift);
- v = Py[2] * iDet;
- wm->wmmat[1] = ROUND_POWER_OF_TWO_SIGNED_64(v, shift + 3);
- // Adjust y displacement for the offset
- off = (uy << WARPEDMODEL_PREC_BITS) - ux * wm->wmmat[4] - uy * wm->wmmat[5];
- wm->wmmat[1] += ROUND_POWER_OF_TWO_SIGNED(off, 3);
- wm->wmmat[6] = wm->wmmat[7] = 0;
-
- // Clamp values
- wm->wmmat[0] = clamp(wm->wmmat[0], -WARPEDMODEL_TRANS_CLAMP,
- WARPEDMODEL_TRANS_CLAMP - 1);
- wm->wmmat[1] = clamp(wm->wmmat[1], -WARPEDMODEL_TRANS_CLAMP,
- WARPEDMODEL_TRANS_CLAMP - 1);
- wm->wmmat[2] = clamp(wm->wmmat[2], -WARPEDMODEL_DIAGAFFINE_CLAMP,
- WARPEDMODEL_DIAGAFFINE_CLAMP - 1);
- wm->wmmat[5] = clamp(wm->wmmat[5], -WARPEDMODEL_DIAGAFFINE_CLAMP,
- WARPEDMODEL_DIAGAFFINE_CLAMP - 1);
- wm->wmmat[3] = clamp(wm->wmmat[3], -WARPEDMODEL_NONDIAGAFFINE_CLAMP,
- WARPEDMODEL_NONDIAGAFFINE_CLAMP - 1);
- wm->wmmat[4] = clamp(wm->wmmat[4], -WARPEDMODEL_NONDIAGAFFINE_CLAMP,
- WARPEDMODEL_NONDIAGAFFINE_CLAMP - 1);
-
- return 0;
-}
-#endif // LEAST_SQUARES_ORDER == 2
-
int find_projection(int np, int *pts1, int *pts2, BLOCK_SIZE bsize, int mvy,
int mvx, WarpedMotionParams *wm_params, int mi_row,
int mi_col) {
diff --git a/third_party/aom/av1/common/warped_motion.h b/third_party/aom/av1/common/warped_motion.h
index dfd8dae34..78abced47 100644
--- a/third_party/aom/av1/common/warped_motion.h
+++ b/third_party/aom/av1/common/warped_motion.h
@@ -35,59 +35,72 @@
extern const int16_t warped_filter[WARPEDPIXEL_PREC_SHIFTS * 3 + 1][8];
-typedef void (*ProjectPointsFunc)(int32_t *mat, int *points, int *proj,
+typedef void (*ProjectPointsFunc)(const int32_t *mat, int *points, int *proj,
const int n, const int stride_points,
const int stride_proj,
const int subsampling_x,
const int subsampling_y);
-void project_points_translation(int32_t *mat, int *points, int *proj,
+void project_points_translation(const int32_t *mat, int *points, int *proj,
const int n, const int stride_points,
const int stride_proj, const int subsampling_x,
const int subsampling_y);
-void project_points_rotzoom(int32_t *mat, int *points, int *proj, const int n,
- const int stride_points, const int stride_proj,
- const int subsampling_x, const int subsampling_y);
+void project_points_rotzoom(const int32_t *mat, int *points, int *proj,
+ const int n, const int stride_points,
+ const int stride_proj, const int subsampling_x,
+ const int subsampling_y);
-void project_points_affine(int32_t *mat, int *points, int *proj, const int n,
- const int stride_points, const int stride_proj,
- const int subsampling_x, const int subsampling_y);
+void project_points_affine(const int32_t *mat, int *points, int *proj,
+ const int n, const int stride_points,
+ const int stride_proj, const int subsampling_x,
+ const int subsampling_y);
-void project_points_hortrapezoid(int32_t *mat, int *points, int *proj,
+void project_points_hortrapezoid(const int32_t *mat, int *points, int *proj,
const int n, const int stride_points,
const int stride_proj, const int subsampling_x,
const int subsampling_y);
-void project_points_vertrapezoid(int32_t *mat, int *points, int *proj,
+void project_points_vertrapezoid(const int32_t *mat, int *points, int *proj,
const int n, const int stride_points,
const int stride_proj, const int subsampling_x,
const int subsampling_y);
-void project_points_homography(int32_t *mat, int *points, int *proj,
+void project_points_homography(const int32_t *mat, int *points, int *proj,
const int n, const int stride_points,
const int stride_proj, const int subsampling_x,
const int subsampling_y);
-void project_points(WarpedMotionParams *wm_params, int *points, int *proj,
+void project_points(const WarpedMotionParams *wm_params, int *points, int *proj,
const int n, const int stride_points, const int stride_proj,
const int subsampling_x, const int subsampling_y);
-double av1_warp_erroradv(WarpedMotionParams *wm,
+// Returns the error between the result of applying motion 'wm' to the frame
+// described by 'ref' and the frame described by 'dst'.
+int64_t av1_warp_error(WarpedMotionParams *wm,
#if CONFIG_HIGHBITDEPTH
- int use_hbd, int bd,
+ int use_hbd, int bd,
#endif // CONFIG_HIGHBITDEPTH
- uint8_t *ref, int width, int height, int stride,
- uint8_t *dst, int p_col, int p_row, int p_width,
- int p_height, int p_stride, int subsampling_x,
- int subsampling_y, int x_scale, int y_scale);
+ const uint8_t *ref, int width, int height, int stride,
+ uint8_t *dst, int p_col, int p_row, int p_width,
+ int p_height, int p_stride, int subsampling_x,
+ int subsampling_y, int x_scale, int y_scale);
+
+// Returns the error between the frame described by 'ref' and the frame
+// described by 'dst'.
+int64_t av1_frame_error(
+#if CONFIG_HIGHBITDEPTH
+ int use_hbd, int bd,
+#endif // CONFIG_HIGHBITDEPTH
+ const uint8_t *ref, int stride, uint8_t *dst, int p_col, int p_row,
+ int p_width, int p_height, int p_stride);
void av1_warp_plane(WarpedMotionParams *wm,
#if CONFIG_HIGHBITDEPTH
int use_hbd, int bd,
#endif // CONFIG_HIGHBITDEPTH
- uint8_t *ref, int width, int height, int stride,
+ const uint8_t *ref, int width, int height, int stride,
uint8_t *pred, int p_col, int p_row, int p_width,
int p_height, int p_stride, int subsampling_x,
- int subsampling_y, int x_scale, int y_scale, int ref_frm);
+ int subsampling_y, int x_scale, int y_scale, int comp_avg);
int find_projection(int np, int *pts1, int *pts2, BLOCK_SIZE bsize, int mvy,
int mvx, WarpedMotionParams *wm_params, int mi_row,
diff --git a/third_party/aom/av1/common/x86/av1_convolve_ssse3.c b/third_party/aom/av1/common/x86/av1_convolve_ssse3.c
index 91102bbaf..5e627ebcf 100644
--- a/third_party/aom/av1/common/x86/av1_convolve_ssse3.c
+++ b/third_party/aom/av1/common/x86/av1_convolve_ssse3.c
@@ -19,13 +19,13 @@
#define WIDTH_BOUND (16)
#define HEIGHT_BOUND (16)
-#if CONFIG_DUAL_FILTER
+#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
DECLARE_ALIGNED(16, static int8_t,
sub_pel_filters_12sharp_signal_dir[15][2][16]);
DECLARE_ALIGNED(16, static int8_t,
sub_pel_filters_12sharp_ver_signal_dir[15][6][16]);
-#endif // CONFIG_DUAL_FILTER
+#endif // CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
#if USE_TEMPORALFILTER_12TAP
DECLARE_ALIGNED(16, static int8_t,
@@ -39,7 +39,7 @@ typedef int8_t (*SubpelFilterCoeffs)[16];
static INLINE SubpelFilterCoeffs
get_subpel_filter_signal_dir(const InterpFilterParams p, int index) {
-#if CONFIG_DUAL_FILTER
+#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
if (p.interp_filter == MULTITAP_SHARP) {
return &sub_pel_filters_12sharp_signal_dir[index][0];
}
@@ -56,7 +56,7 @@ get_subpel_filter_signal_dir(const InterpFilterParams p, int index) {
static INLINE SubpelFilterCoeffs
get_subpel_filter_ver_signal_dir(const InterpFilterParams p, int index) {
-#if CONFIG_DUAL_FILTER
+#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
if (p.interp_filter == MULTITAP_SHARP) {
return &sub_pel_filters_12sharp_ver_signal_dir[index][0];
}
@@ -143,6 +143,7 @@ static void horiz_w4_ssse3(const uint8_t *src, const __m128i *f, int tapsNum,
const __m128i k_256 = _mm_set1_epi16(1 << 8);
const __m128i zero = _mm_setzero_si128();
+ assert(tapsNum == 10 || tapsNum == 12);
if (10 == tapsNum) {
src -= 1;
}
@@ -470,6 +471,7 @@ static void filter_horiz_v8p_ssse3(const uint8_t *src_ptr, ptrdiff_t src_pitch,
__m128i min_x2x3, max_x2x3;
__m128i temp;
+ assert(tapsNum == 10 || tapsNum == 12);
if (tapsNum == 10) {
src_ptr -= 1;
}
@@ -612,6 +614,7 @@ static void filter_horiz_v4p_ssse3(const uint8_t *src_ptr, ptrdiff_t src_pitch,
__m128i x0, x1, x2, x3, x4, x5;
__m128i min_x2x3, max_x2x3, temp;
+ assert(tapsNum == 10 || tapsNum == 12);
if (tapsNum == 10) {
src_ptr -= 1;
}
@@ -982,7 +985,7 @@ typedef struct SimdFilter {
int8_t (*simd_vert_filter)[6][16];
} SimdFilter;
-#if CONFIG_DUAL_FILTER
+#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
#define MULTITAP_FILTER_NUM 1
SimdFilter simd_filters[MULTITAP_FILTER_NUM] = {
{ MULTITAP_SHARP, &sub_pel_filters_12sharp_signal_dir[0],
@@ -1010,7 +1013,7 @@ void av1_lowbd_convolve_init_ssse3(void) {
temporal_simd_filter.simd_vert_filter);
}
#endif
-#if CONFIG_DUAL_FILTER
+#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
{
int i;
for (i = 0; i < MULTITAP_FILTER_NUM; ++i) {
diff --git a/third_party/aom/av1/common/x86/av1_fwd_txfm1d_sse4.c b/third_party/aom/av1/common/x86/av1_fwd_txfm1d_sse4.c
index d04b667f1..97d2e74b1 100644
--- a/third_party/aom/av1/common/x86/av1_fwd_txfm1d_sse4.c
+++ b/third_party/aom/av1/common/x86/av1_fwd_txfm1d_sse4.c
@@ -57,7 +57,7 @@ void av1_fdct32_new_sse4_1(const __m128i *input, __m128i *output,
// stage 2
stage_idx++;
bit = cos_bit[stage_idx];
- cospi = cospi_arr[bit - cos_bit_min];
+ cospi = cospi_arr(bit);
buf0[0] = _mm_add_epi32(buf1[0], buf1[15]);
buf0[15] = _mm_sub_epi32(buf1[0], buf1[15]);
buf0[1] = _mm_add_epi32(buf1[1], buf1[14]);
@@ -94,7 +94,7 @@ void av1_fdct32_new_sse4_1(const __m128i *input, __m128i *output,
// stage 3
stage_idx++;
bit = cos_bit[stage_idx];
- cospi = cospi_arr[bit - cos_bit_min];
+ cospi = cospi_arr(bit);
buf1[0] = _mm_add_epi32(buf0[0], buf0[7]);
buf1[7] = _mm_sub_epi32(buf0[0], buf0[7]);
buf1[1] = _mm_add_epi32(buf0[1], buf0[6]);
@@ -131,7 +131,7 @@ void av1_fdct32_new_sse4_1(const __m128i *input, __m128i *output,
// stage 4
stage_idx++;
bit = cos_bit[stage_idx];
- cospi = cospi_arr[bit - cos_bit_min];
+ cospi = cospi_arr(bit);
buf0[0] = _mm_add_epi32(buf1[0], buf1[3]);
buf0[3] = _mm_sub_epi32(buf1[0], buf1[3]);
buf0[1] = _mm_add_epi32(buf1[1], buf1[2]);
@@ -168,7 +168,7 @@ void av1_fdct32_new_sse4_1(const __m128i *input, __m128i *output,
// stage 5
stage_idx++;
bit = cos_bit[stage_idx];
- cospi = cospi_arr[bit - cos_bit_min];
+ cospi = cospi_arr(bit);
btf_32_sse4_1_type0(cospi[32], cospi[32], buf0[0], buf0[1], buf1[0],
buf1[1], bit);
btf_32_sse4_1_type1(cospi[48], cospi[16], buf0[2], buf0[3], buf1[2],
@@ -205,7 +205,7 @@ void av1_fdct32_new_sse4_1(const __m128i *input, __m128i *output,
// stage 6
stage_idx++;
bit = cos_bit[stage_idx];
- cospi = cospi_arr[bit - cos_bit_min];
+ cospi = cospi_arr(bit);
buf0[0] = buf1[0];
buf0[1] = buf1[1];
buf0[2] = buf1[2];
@@ -242,7 +242,7 @@ void av1_fdct32_new_sse4_1(const __m128i *input, __m128i *output,
// stage 7
stage_idx++;
bit = cos_bit[stage_idx];
- cospi = cospi_arr[bit - cos_bit_min];
+ cospi = cospi_arr(bit);
buf1[0] = buf0[0];
buf1[1] = buf0[1];
buf1[2] = buf0[2];
@@ -279,7 +279,7 @@ void av1_fdct32_new_sse4_1(const __m128i *input, __m128i *output,
// stage 8
stage_idx++;
bit = cos_bit[stage_idx];
- cospi = cospi_arr[bit - cos_bit_min];
+ cospi = cospi_arr(bit);
buf0[0] = buf1[0];
buf0[1] = buf1[1];
buf0[2] = buf1[2];
@@ -383,7 +383,7 @@ void av1_fadst4_new_sse4_1(const __m128i *input, __m128i *output,
// stage 2
stage_idx++;
bit = cos_bit[stage_idx];
- cospi = cospi_arr[bit - cos_bit_min];
+ cospi = cospi_arr(bit);
btf_32_sse4_1_type0(cospi[8], cospi[56], buf1[0], buf1[1], buf0[0], buf0[1],
bit);
btf_32_sse4_1_type0(cospi[40], cospi[24], buf1[2], buf1[3], buf0[2],
@@ -399,7 +399,7 @@ void av1_fadst4_new_sse4_1(const __m128i *input, __m128i *output,
// stage 4
stage_idx++;
bit = cos_bit[stage_idx];
- cospi = cospi_arr[bit - cos_bit_min];
+ cospi = cospi_arr(bit);
buf0[0] = buf1[0];
buf0[1] = buf1[1];
btf_32_sse4_1_type0(cospi[32], cospi[32], buf1[2], buf1[3], buf0[2],
@@ -475,7 +475,7 @@ void av1_fadst32_new_sse4_1(const __m128i *input, __m128i *output,
// stage 2
stage_idx++;
bit = cos_bit[stage_idx];
- cospi = cospi_arr[bit - cos_bit_min];
+ cospi = cospi_arr(bit);
btf_32_sse4_1_type0(cospi[1], cospi[63], buf1[0], buf1[1], buf0[0], buf0[1],
bit);
btf_32_sse4_1_type0(cospi[5], cospi[59], buf1[2], buf1[3], buf0[2], buf0[3],
@@ -547,7 +547,7 @@ void av1_fadst32_new_sse4_1(const __m128i *input, __m128i *output,
// stage 4
stage_idx++;
bit = cos_bit[stage_idx];
- cospi = cospi_arr[bit - cos_bit_min];
+ cospi = cospi_arr(bit);
buf0[0] = buf1[0];
buf0[1] = buf1[1];
buf0[2] = buf1[2];
@@ -619,7 +619,7 @@ void av1_fadst32_new_sse4_1(const __m128i *input, __m128i *output,
// stage 6
stage_idx++;
bit = cos_bit[stage_idx];
- cospi = cospi_arr[bit - cos_bit_min];
+ cospi = cospi_arr(bit);
buf0[0] = buf1[0];
buf0[1] = buf1[1];
buf0[2] = buf1[2];
@@ -691,7 +691,7 @@ void av1_fadst32_new_sse4_1(const __m128i *input, __m128i *output,
// stage 8
stage_idx++;
bit = cos_bit[stage_idx];
- cospi = cospi_arr[bit - cos_bit_min];
+ cospi = cospi_arr(bit);
buf0[0] = buf1[0];
buf0[1] = buf1[1];
buf0[2] = buf1[2];
@@ -763,7 +763,7 @@ void av1_fadst32_new_sse4_1(const __m128i *input, __m128i *output,
// stage 10
stage_idx++;
bit = cos_bit[stage_idx];
- cospi = cospi_arr[bit - cos_bit_min];
+ cospi = cospi_arr(bit);
buf0[0] = buf1[0];
buf0[1] = buf1[1];
btf_32_sse4_1_type0(cospi[32], cospi[32], buf1[2], buf1[3], buf0[2],
diff --git a/third_party/aom/av1/common/x86/av1_fwd_txfm2d_sse4.c b/third_party/aom/av1/common/x86/av1_fwd_txfm2d_sse4.c
index 78c261374..1d7c55349 100644
--- a/third_party/aom/av1/common/x86/av1_fwd_txfm2d_sse4.c
+++ b/third_party/aom/av1/common/x86/av1_fwd_txfm2d_sse4.c
@@ -37,16 +37,20 @@ static INLINE TxfmFuncSSE2 fwd_txfm_type_to_func(TXFM_TYPE txfm_type) {
}
static INLINE void fwd_txfm2d_sse4_1(const int16_t *input, int32_t *output,
- const int stride, const TXFM_2D_CFG *cfg,
+ const int stride,
+ const TXFM_2D_FLIP_CFG *cfg,
int32_t *txfm_buf) {
- const int txfm_size = cfg->txfm_size;
- const int8_t *shift = cfg->shift;
- const int8_t *stage_range_col = cfg->stage_range_col;
- const int8_t *stage_range_row = cfg->stage_range_row;
- const int8_t *cos_bit_col = cfg->cos_bit_col;
- const int8_t *cos_bit_row = cfg->cos_bit_row;
- const TxfmFuncSSE2 txfm_func_col = fwd_txfm_type_to_func(cfg->txfm_type_col);
- const TxfmFuncSSE2 txfm_func_row = fwd_txfm_type_to_func(cfg->txfm_type_row);
+ // TODO(sarahparker) must correct for rectangular transforms in follow up
+ const int txfm_size = cfg->row_cfg->txfm_size;
+ const int8_t *shift = cfg->row_cfg->shift;
+ const int8_t *stage_range_col = cfg->col_cfg->stage_range;
+ const int8_t *stage_range_row = cfg->row_cfg->stage_range;
+ const int8_t *cos_bit_col = cfg->col_cfg->cos_bit;
+ const int8_t *cos_bit_row = cfg->row_cfg->cos_bit;
+ const TxfmFuncSSE2 txfm_func_col =
+ fwd_txfm_type_to_func(cfg->col_cfg->txfm_type);
+ const TxfmFuncSSE2 txfm_func_row =
+ fwd_txfm_type_to_func(cfg->row_cfg->txfm_type);
__m128i *buf_128 = (__m128i *)txfm_buf;
__m128i *out_128 = (__m128i *)output;
@@ -69,7 +73,7 @@ void av1_fwd_txfm2d_32x32_sse4_1(const int16_t *input, int32_t *output,
DECLARE_ALIGNED(16, int32_t, txfm_buf[1024]);
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_32X32);
(void)bd;
- fwd_txfm2d_sse4_1(input, output, stride, cfg.cfg, txfm_buf);
+ fwd_txfm2d_sse4_1(input, output, stride, &cfg, txfm_buf);
}
void av1_fwd_txfm2d_64x64_sse4_1(const int16_t *input, int32_t *output,
@@ -77,5 +81,5 @@ void av1_fwd_txfm2d_64x64_sse4_1(const int16_t *input, int32_t *output,
DECLARE_ALIGNED(16, int32_t, txfm_buf[4096]);
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_64x64_cfg(tx_type);
(void)bd;
- fwd_txfm2d_sse4_1(input, output, stride, cfg.cfg, txfm_buf);
+ fwd_txfm2d_sse4_1(input, output, stride, &cfg, txfm_buf);
}
diff --git a/third_party/aom/av1/common/x86/av1_highbd_convolve_sse4.c b/third_party/aom/av1/common/x86/av1_highbd_convolve_sse4.c
index cf6249bdc..68461bc36 100644
--- a/third_party/aom/av1/common/x86/av1_highbd_convolve_sse4.c
+++ b/third_party/aom/av1/common/x86/av1_highbd_convolve_sse4.c
@@ -15,7 +15,7 @@
#include "./av1_rtcd.h"
#include "av1/common/filter.h"
-#if CONFIG_DUAL_FILTER
+#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
DECLARE_ALIGNED(16, static int16_t, subpel_filters_sharp[15][6][8]);
#endif
@@ -31,7 +31,7 @@ typedef void (*TransposeSave)(int width, int pixelsNum, uint32_t *src,
static INLINE HbdSubpelFilterCoeffs
hbd_get_subpel_filter_ver_signal_dir(const InterpFilterParams p, int index) {
-#if CONFIG_DUAL_FILTER
+#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
if (p.interp_filter == MULTITAP_SHARP) {
return &subpel_filters_sharp[index][0];
}
@@ -76,7 +76,7 @@ void av1_highbd_convolve_init_sse4_1(void) {
init_simd_filter(filter_ptr, taps, subpel_temporalfilter);
}
#endif
-#if CONFIG_DUAL_FILTER
+#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
{
InterpFilterParams filter_params =
av1_get_interp_filter_params(MULTITAP_SHARP);
@@ -246,6 +246,7 @@ static void highbd_filter_horiz(const uint16_t *src, int src_stride, __m128i *f,
int tapsNum, uint32_t *buf) {
__m128i u[8], v[6];
+ assert(tapsNum == 10 || tapsNum == 12);
if (tapsNum == 10) {
src -= 1;
}
@@ -412,6 +413,7 @@ static void filter_vert_horiz_parallel(const uint16_t *src, int src_stride,
int r = 0;
// TODO(luoyi) treat s[12] as a circular buffer in width = 2 case
+ assert(taps == 10 || taps == 12);
if (10 == taps) {
i += 1;
s[0] = zero;
diff --git a/third_party/aom/av1/common/x86/highbd_inv_txfm_avx2.c b/third_party/aom/av1/common/x86/highbd_inv_txfm_avx2.c
index d10f1ccc2..dd2a681bc 100644
--- a/third_party/aom/av1/common/x86/highbd_inv_txfm_avx2.c
+++ b/third_party/aom/av1/common/x86/highbd_inv_txfm_avx2.c
@@ -13,7 +13,7 @@
#include "./av1_rtcd.h"
#include "./aom_config.h"
-#include "av1/common/av1_inv_txfm2d_cfg.h"
+#include "av1/common/av1_inv_txfm1d_cfg.h"
// Note:
// Total 32x4 registers to represent 32x32 block coefficients.
@@ -154,20 +154,21 @@ static void write_buffer_32x32(__m256i *in, uint16_t *output, int stride,
}
}
-static INLINE __m256i half_btf_avx2(__m256i w0, __m256i n0, __m256i w1,
- __m256i n1, __m256i rounding, int bit) {
+static INLINE __m256i half_btf_avx2(const __m256i *w0, const __m256i *n0,
+ const __m256i *w1, const __m256i *n1,
+ const __m256i *rounding, int bit) {
__m256i x, y;
- x = _mm256_mullo_epi32(w0, n0);
- y = _mm256_mullo_epi32(w1, n1);
+ x = _mm256_mullo_epi32(*w0, *n0);
+ y = _mm256_mullo_epi32(*w1, *n1);
x = _mm256_add_epi32(x, y);
- x = _mm256_add_epi32(x, rounding);
+ x = _mm256_add_epi32(x, *rounding);
x = _mm256_srai_epi32(x, bit);
return x;
}
static void idct32_avx2(__m256i *in, __m256i *out, int bit) {
- const int32_t *cospi = cospi_arr[bit - cos_bit_min];
+ const int32_t *cospi = cospi_arr(bit);
const __m256i cospi62 = _mm256_set1_epi32(cospi[62]);
const __m256i cospi30 = _mm256_set1_epi32(cospi[30]);
const __m256i cospi46 = _mm256_set1_epi32(cospi[46]);
@@ -275,22 +276,38 @@ static void idct32_avx2(__m256i *in, __m256i *out, int bit) {
bf0[13] = bf1[13];
bf0[14] = bf1[14];
bf0[15] = bf1[15];
- bf0[16] = half_btf_avx2(cospi62, bf1[16], cospim2, bf1[31], rounding, bit);
- bf0[17] = half_btf_avx2(cospi30, bf1[17], cospim34, bf1[30], rounding, bit);
- bf0[18] = half_btf_avx2(cospi46, bf1[18], cospim18, bf1[29], rounding, bit);
- bf0[19] = half_btf_avx2(cospi14, bf1[19], cospim50, bf1[28], rounding, bit);
- bf0[20] = half_btf_avx2(cospi54, bf1[20], cospim10, bf1[27], rounding, bit);
- bf0[21] = half_btf_avx2(cospi22, bf1[21], cospim42, bf1[26], rounding, bit);
- bf0[22] = half_btf_avx2(cospi38, bf1[22], cospim26, bf1[25], rounding, bit);
- bf0[23] = half_btf_avx2(cospi6, bf1[23], cospim58, bf1[24], rounding, bit);
- bf0[24] = half_btf_avx2(cospi58, bf1[23], cospi6, bf1[24], rounding, bit);
- bf0[25] = half_btf_avx2(cospi26, bf1[22], cospi38, bf1[25], rounding, bit);
- bf0[26] = half_btf_avx2(cospi42, bf1[21], cospi22, bf1[26], rounding, bit);
- bf0[27] = half_btf_avx2(cospi10, bf1[20], cospi54, bf1[27], rounding, bit);
- bf0[28] = half_btf_avx2(cospi50, bf1[19], cospi14, bf1[28], rounding, bit);
- bf0[29] = half_btf_avx2(cospi18, bf1[18], cospi46, bf1[29], rounding, bit);
- bf0[30] = half_btf_avx2(cospi34, bf1[17], cospi30, bf1[30], rounding, bit);
- bf0[31] = half_btf_avx2(cospi2, bf1[16], cospi62, bf1[31], rounding, bit);
+ bf0[16] =
+ half_btf_avx2(&cospi62, &bf1[16], &cospim2, &bf1[31], &rounding, bit);
+ bf0[17] =
+ half_btf_avx2(&cospi30, &bf1[17], &cospim34, &bf1[30], &rounding, bit);
+ bf0[18] =
+ half_btf_avx2(&cospi46, &bf1[18], &cospim18, &bf1[29], &rounding, bit);
+ bf0[19] =
+ half_btf_avx2(&cospi14, &bf1[19], &cospim50, &bf1[28], &rounding, bit);
+ bf0[20] =
+ half_btf_avx2(&cospi54, &bf1[20], &cospim10, &bf1[27], &rounding, bit);
+ bf0[21] =
+ half_btf_avx2(&cospi22, &bf1[21], &cospim42, &bf1[26], &rounding, bit);
+ bf0[22] =
+ half_btf_avx2(&cospi38, &bf1[22], &cospim26, &bf1[25], &rounding, bit);
+ bf0[23] =
+ half_btf_avx2(&cospi6, &bf1[23], &cospim58, &bf1[24], &rounding, bit);
+ bf0[24] =
+ half_btf_avx2(&cospi58, &bf1[23], &cospi6, &bf1[24], &rounding, bit);
+ bf0[25] =
+ half_btf_avx2(&cospi26, &bf1[22], &cospi38, &bf1[25], &rounding, bit);
+ bf0[26] =
+ half_btf_avx2(&cospi42, &bf1[21], &cospi22, &bf1[26], &rounding, bit);
+ bf0[27] =
+ half_btf_avx2(&cospi10, &bf1[20], &cospi54, &bf1[27], &rounding, bit);
+ bf0[28] =
+ half_btf_avx2(&cospi50, &bf1[19], &cospi14, &bf1[28], &rounding, bit);
+ bf0[29] =
+ half_btf_avx2(&cospi18, &bf1[18], &cospi46, &bf1[29], &rounding, bit);
+ bf0[30] =
+ half_btf_avx2(&cospi34, &bf1[17], &cospi30, &bf1[30], &rounding, bit);
+ bf0[31] =
+ half_btf_avx2(&cospi2, &bf1[16], &cospi62, &bf1[31], &rounding, bit);
// stage 3
bf1[0] = bf0[0];
@@ -301,14 +318,22 @@ static void idct32_avx2(__m256i *in, __m256i *out, int bit) {
bf1[5] = bf0[5];
bf1[6] = bf0[6];
bf1[7] = bf0[7];
- bf1[8] = half_btf_avx2(cospi60, bf0[8], cospim4, bf0[15], rounding, bit);
- bf1[9] = half_btf_avx2(cospi28, bf0[9], cospim36, bf0[14], rounding, bit);
- bf1[10] = half_btf_avx2(cospi44, bf0[10], cospim20, bf0[13], rounding, bit);
- bf1[11] = half_btf_avx2(cospi12, bf0[11], cospim52, bf0[12], rounding, bit);
- bf1[12] = half_btf_avx2(cospi52, bf0[11], cospi12, bf0[12], rounding, bit);
- bf1[13] = half_btf_avx2(cospi20, bf0[10], cospi44, bf0[13], rounding, bit);
- bf1[14] = half_btf_avx2(cospi36, bf0[9], cospi28, bf0[14], rounding, bit);
- bf1[15] = half_btf_avx2(cospi4, bf0[8], cospi60, bf0[15], rounding, bit);
+ bf1[8] =
+ half_btf_avx2(&cospi60, &bf0[8], &cospim4, &bf0[15], &rounding, bit);
+ bf1[9] =
+ half_btf_avx2(&cospi28, &bf0[9], &cospim36, &bf0[14], &rounding, bit);
+ bf1[10] =
+ half_btf_avx2(&cospi44, &bf0[10], &cospim20, &bf0[13], &rounding, bit);
+ bf1[11] =
+ half_btf_avx2(&cospi12, &bf0[11], &cospim52, &bf0[12], &rounding, bit);
+ bf1[12] =
+ half_btf_avx2(&cospi52, &bf0[11], &cospi12, &bf0[12], &rounding, bit);
+ bf1[13] =
+ half_btf_avx2(&cospi20, &bf0[10], &cospi44, &bf0[13], &rounding, bit);
+ bf1[14] =
+ half_btf_avx2(&cospi36, &bf0[9], &cospi28, &bf0[14], &rounding, bit);
+ bf1[15] =
+ half_btf_avx2(&cospi4, &bf0[8], &cospi60, &bf0[15], &rounding, bit);
bf1[16] = _mm256_add_epi32(bf0[16], bf0[17]);
bf1[17] = _mm256_sub_epi32(bf0[16], bf0[17]);
bf1[18] = _mm256_sub_epi32(bf0[19], bf0[18]);
@@ -331,10 +356,13 @@ static void idct32_avx2(__m256i *in, __m256i *out, int bit) {
bf0[1] = bf1[1];
bf0[2] = bf1[2];
bf0[3] = bf1[3];
- bf0[4] = half_btf_avx2(cospi56, bf1[4], cospim8, bf1[7], rounding, bit);
- bf0[5] = half_btf_avx2(cospi24, bf1[5], cospim40, bf1[6], rounding, bit);
- bf0[6] = half_btf_avx2(cospi40, bf1[5], cospi24, bf1[6], rounding, bit);
- bf0[7] = half_btf_avx2(cospi8, bf1[4], cospi56, bf1[7], rounding, bit);
+ bf0[4] =
+ half_btf_avx2(&cospi56, &bf1[4], &cospim8, &bf1[7], &rounding, bit);
+ bf0[5] =
+ half_btf_avx2(&cospi24, &bf1[5], &cospim40, &bf1[6], &rounding, bit);
+ bf0[6] =
+ half_btf_avx2(&cospi40, &bf1[5], &cospi24, &bf1[6], &rounding, bit);
+ bf0[7] = half_btf_avx2(&cospi8, &bf1[4], &cospi56, &bf1[7], &rounding, bit);
bf0[8] = _mm256_add_epi32(bf1[8], bf1[9]);
bf0[9] = _mm256_sub_epi32(bf1[8], bf1[9]);
bf0[10] = _mm256_sub_epi32(bf1[11], bf1[10]);
@@ -344,40 +372,54 @@ static void idct32_avx2(__m256i *in, __m256i *out, int bit) {
bf0[14] = _mm256_sub_epi32(bf1[15], bf1[14]);
bf0[15] = _mm256_add_epi32(bf1[14], bf1[15]);
bf0[16] = bf1[16];
- bf0[17] = half_btf_avx2(cospim8, bf1[17], cospi56, bf1[30], rounding, bit);
- bf0[18] = half_btf_avx2(cospim56, bf1[18], cospim8, bf1[29], rounding, bit);
+ bf0[17] =
+ half_btf_avx2(&cospim8, &bf1[17], &cospi56, &bf1[30], &rounding, bit);
+ bf0[18] =
+ half_btf_avx2(&cospim56, &bf1[18], &cospim8, &bf1[29], &rounding, bit);
bf0[19] = bf1[19];
bf0[20] = bf1[20];
- bf0[21] = half_btf_avx2(cospim40, bf1[21], cospi24, bf1[26], rounding, bit);
+ bf0[21] =
+ half_btf_avx2(&cospim40, &bf1[21], &cospi24, &bf1[26], &rounding, bit);
bf0[22] =
- half_btf_avx2(cospim24, bf1[22], cospim40, bf1[25], rounding, bit);
+ half_btf_avx2(&cospim24, &bf1[22], &cospim40, &bf1[25], &rounding, bit);
bf0[23] = bf1[23];
bf0[24] = bf1[24];
- bf0[25] = half_btf_avx2(cospim40, bf1[22], cospi24, bf1[25], rounding, bit);
- bf0[26] = half_btf_avx2(cospi24, bf1[21], cospi40, bf1[26], rounding, bit);
+ bf0[25] =
+ half_btf_avx2(&cospim40, &bf1[22], &cospi24, &bf1[25], &rounding, bit);
+ bf0[26] =
+ half_btf_avx2(&cospi24, &bf1[21], &cospi40, &bf1[26], &rounding, bit);
bf0[27] = bf1[27];
bf0[28] = bf1[28];
- bf0[29] = half_btf_avx2(cospim8, bf1[18], cospi56, bf1[29], rounding, bit);
- bf0[30] = half_btf_avx2(cospi56, bf1[17], cospi8, bf1[30], rounding, bit);
+ bf0[29] =
+ half_btf_avx2(&cospim8, &bf1[18], &cospi56, &bf1[29], &rounding, bit);
+ bf0[30] =
+ half_btf_avx2(&cospi56, &bf1[17], &cospi8, &bf1[30], &rounding, bit);
bf0[31] = bf1[31];
// stage 5
- bf1[0] = half_btf_avx2(cospi32, bf0[0], cospi32, bf0[1], rounding, bit);
- bf1[1] = half_btf_avx2(cospi32, bf0[0], cospim32, bf0[1], rounding, bit);
- bf1[2] = half_btf_avx2(cospi48, bf0[2], cospim16, bf0[3], rounding, bit);
- bf1[3] = half_btf_avx2(cospi16, bf0[2], cospi48, bf0[3], rounding, bit);
+ bf1[0] =
+ half_btf_avx2(&cospi32, &bf0[0], &cospi32, &bf0[1], &rounding, bit);
+ bf1[1] =
+ half_btf_avx2(&cospi32, &bf0[0], &cospim32, &bf0[1], &rounding, bit);
+ bf1[2] =
+ half_btf_avx2(&cospi48, &bf0[2], &cospim16, &bf0[3], &rounding, bit);
+ bf1[3] =
+ half_btf_avx2(&cospi16, &bf0[2], &cospi48, &bf0[3], &rounding, bit);
bf1[4] = _mm256_add_epi32(bf0[4], bf0[5]);
bf1[5] = _mm256_sub_epi32(bf0[4], bf0[5]);
bf1[6] = _mm256_sub_epi32(bf0[7], bf0[6]);
bf1[7] = _mm256_add_epi32(bf0[6], bf0[7]);
bf1[8] = bf0[8];
- bf1[9] = half_btf_avx2(cospim16, bf0[9], cospi48, bf0[14], rounding, bit);
+ bf1[9] =
+ half_btf_avx2(&cospim16, &bf0[9], &cospi48, &bf0[14], &rounding, bit);
bf1[10] =
- half_btf_avx2(cospim48, bf0[10], cospim16, bf0[13], rounding, bit);
+ half_btf_avx2(&cospim48, &bf0[10], &cospim16, &bf0[13], &rounding, bit);
bf1[11] = bf0[11];
bf1[12] = bf0[12];
- bf1[13] = half_btf_avx2(cospim16, bf0[10], cospi48, bf0[13], rounding, bit);
- bf1[14] = half_btf_avx2(cospi48, bf0[9], cospi16, bf0[14], rounding, bit);
+ bf1[13] =
+ half_btf_avx2(&cospim16, &bf0[10], &cospi48, &bf0[13], &rounding, bit);
+ bf1[14] =
+ half_btf_avx2(&cospi48, &bf0[9], &cospi16, &bf0[14], &rounding, bit);
bf1[15] = bf0[15];
bf1[16] = _mm256_add_epi32(bf0[16], bf0[19]);
bf1[17] = _mm256_add_epi32(bf0[17], bf0[18]);
@@ -402,8 +444,10 @@ static void idct32_avx2(__m256i *in, __m256i *out, int bit) {
bf0[2] = _mm256_sub_epi32(bf1[1], bf1[2]);
bf0[3] = _mm256_sub_epi32(bf1[0], bf1[3]);
bf0[4] = bf1[4];
- bf0[5] = half_btf_avx2(cospim32, bf1[5], cospi32, bf1[6], rounding, bit);
- bf0[6] = half_btf_avx2(cospi32, bf1[5], cospi32, bf1[6], rounding, bit);
+ bf0[5] =
+ half_btf_avx2(&cospim32, &bf1[5], &cospi32, &bf1[6], &rounding, bit);
+ bf0[6] =
+ half_btf_avx2(&cospi32, &bf1[5], &cospi32, &bf1[6], &rounding, bit);
bf0[7] = bf1[7];
bf0[8] = _mm256_add_epi32(bf1[8], bf1[11]);
bf0[9] = _mm256_add_epi32(bf1[9], bf1[10]);
@@ -415,20 +459,26 @@ static void idct32_avx2(__m256i *in, __m256i *out, int bit) {
bf0[15] = _mm256_add_epi32(bf1[12], bf1[15]);
bf0[16] = bf1[16];
bf0[17] = bf1[17];
- bf0[18] = half_btf_avx2(cospim16, bf1[18], cospi48, bf1[29], rounding, bit);
- bf0[19] = half_btf_avx2(cospim16, bf1[19], cospi48, bf1[28], rounding, bit);
+ bf0[18] =
+ half_btf_avx2(&cospim16, &bf1[18], &cospi48, &bf1[29], &rounding, bit);
+ bf0[19] =
+ half_btf_avx2(&cospim16, &bf1[19], &cospi48, &bf1[28], &rounding, bit);
bf0[20] =
- half_btf_avx2(cospim48, bf1[20], cospim16, bf1[27], rounding, bit);
+ half_btf_avx2(&cospim48, &bf1[20], &cospim16, &bf1[27], &rounding, bit);
bf0[21] =
- half_btf_avx2(cospim48, bf1[21], cospim16, bf1[26], rounding, bit);
+ half_btf_avx2(&cospim48, &bf1[21], &cospim16, &bf1[26], &rounding, bit);
bf0[22] = bf1[22];
bf0[23] = bf1[23];
bf0[24] = bf1[24];
bf0[25] = bf1[25];
- bf0[26] = half_btf_avx2(cospim16, bf1[21], cospi48, bf1[26], rounding, bit);
- bf0[27] = half_btf_avx2(cospim16, bf1[20], cospi48, bf1[27], rounding, bit);
- bf0[28] = half_btf_avx2(cospi48, bf1[19], cospi16, bf1[28], rounding, bit);
- bf0[29] = half_btf_avx2(cospi48, bf1[18], cospi16, bf1[29], rounding, bit);
+ bf0[26] =
+ half_btf_avx2(&cospim16, &bf1[21], &cospi48, &bf1[26], &rounding, bit);
+ bf0[27] =
+ half_btf_avx2(&cospim16, &bf1[20], &cospi48, &bf1[27], &rounding, bit);
+ bf0[28] =
+ half_btf_avx2(&cospi48, &bf1[19], &cospi16, &bf1[28], &rounding, bit);
+ bf0[29] =
+ half_btf_avx2(&cospi48, &bf1[18], &cospi16, &bf1[29], &rounding, bit);
bf0[30] = bf1[30];
bf0[31] = bf1[31];
@@ -443,10 +493,14 @@ static void idct32_avx2(__m256i *in, __m256i *out, int bit) {
bf1[7] = _mm256_sub_epi32(bf0[0], bf0[7]);
bf1[8] = bf0[8];
bf1[9] = bf0[9];
- bf1[10] = half_btf_avx2(cospim32, bf0[10], cospi32, bf0[13], rounding, bit);
- bf1[11] = half_btf_avx2(cospim32, bf0[11], cospi32, bf0[12], rounding, bit);
- bf1[12] = half_btf_avx2(cospi32, bf0[11], cospi32, bf0[12], rounding, bit);
- bf1[13] = half_btf_avx2(cospi32, bf0[10], cospi32, bf0[13], rounding, bit);
+ bf1[10] =
+ half_btf_avx2(&cospim32, &bf0[10], &cospi32, &bf0[13], &rounding, bit);
+ bf1[11] =
+ half_btf_avx2(&cospim32, &bf0[11], &cospi32, &bf0[12], &rounding, bit);
+ bf1[12] =
+ half_btf_avx2(&cospi32, &bf0[11], &cospi32, &bf0[12], &rounding, bit);
+ bf1[13] =
+ half_btf_avx2(&cospi32, &bf0[10], &cospi32, &bf0[13], &rounding, bit);
bf1[14] = bf0[14];
bf1[15] = bf0[15];
bf1[16] = _mm256_add_epi32(bf0[16], bf0[23]);
@@ -487,14 +541,22 @@ static void idct32_avx2(__m256i *in, __m256i *out, int bit) {
bf0[17] = bf1[17];
bf0[18] = bf1[18];
bf0[19] = bf1[19];
- bf0[20] = half_btf_avx2(cospim32, bf1[20], cospi32, bf1[27], rounding, bit);
- bf0[21] = half_btf_avx2(cospim32, bf1[21], cospi32, bf1[26], rounding, bit);
- bf0[22] = half_btf_avx2(cospim32, bf1[22], cospi32, bf1[25], rounding, bit);
- bf0[23] = half_btf_avx2(cospim32, bf1[23], cospi32, bf1[24], rounding, bit);
- bf0[24] = half_btf_avx2(cospi32, bf1[23], cospi32, bf1[24], rounding, bit);
- bf0[25] = half_btf_avx2(cospi32, bf1[22], cospi32, bf1[25], rounding, bit);
- bf0[26] = half_btf_avx2(cospi32, bf1[21], cospi32, bf1[26], rounding, bit);
- bf0[27] = half_btf_avx2(cospi32, bf1[20], cospi32, bf1[27], rounding, bit);
+ bf0[20] =
+ half_btf_avx2(&cospim32, &bf1[20], &cospi32, &bf1[27], &rounding, bit);
+ bf0[21] =
+ half_btf_avx2(&cospim32, &bf1[21], &cospi32, &bf1[26], &rounding, bit);
+ bf0[22] =
+ half_btf_avx2(&cospim32, &bf1[22], &cospi32, &bf1[25], &rounding, bit);
+ bf0[23] =
+ half_btf_avx2(&cospim32, &bf1[23], &cospi32, &bf1[24], &rounding, bit);
+ bf0[24] =
+ half_btf_avx2(&cospi32, &bf1[23], &cospi32, &bf1[24], &rounding, bit);
+ bf0[25] =
+ half_btf_avx2(&cospi32, &bf1[22], &cospi32, &bf1[25], &rounding, bit);
+ bf0[26] =
+ half_btf_avx2(&cospi32, &bf1[21], &cospi32, &bf1[26], &rounding, bit);
+ bf0[27] =
+ half_btf_avx2(&cospi32, &bf1[20], &cospi32, &bf1[27], &rounding, bit);
bf0[28] = bf1[28];
bf0[29] = bf1[29];
bf0[30] = bf1[30];
@@ -539,18 +601,20 @@ static void idct32_avx2(__m256i *in, __m256i *out, int bit) {
void av1_inv_txfm2d_add_32x32_avx2(const int32_t *coeff, uint16_t *output,
int stride, int tx_type, int bd) {
__m256i in[128], out[128];
- const TXFM_2D_CFG *cfg = NULL;
+ const TXFM_1D_CFG *row_cfg = NULL;
+ const TXFM_1D_CFG *col_cfg = NULL;
switch (tx_type) {
case DCT_DCT:
- cfg = &inv_txfm_2d_cfg_dct_dct_32;
+ row_cfg = &inv_txfm_1d_row_cfg_dct_32;
+ col_cfg = &inv_txfm_1d_col_cfg_dct_32;
load_buffer_32x32(coeff, in);
transpose_32x32(in, out);
- idct32_avx2(out, in, cfg->cos_bit_row[2]);
- round_shift_32x32(in, -cfg->shift[0]);
+ idct32_avx2(out, in, row_cfg->cos_bit[2]);
+ round_shift_32x32(in, -row_cfg->shift[0]);
transpose_32x32(in, out);
- idct32_avx2(out, in, cfg->cos_bit_col[2]);
- write_buffer_32x32(in, output, stride, 0, 0, -cfg->shift[1], bd);
+ idct32_avx2(out, in, col_cfg->cos_bit[2]);
+ write_buffer_32x32(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
break;
default: assert(0);
}
diff --git a/third_party/aom/av1/common/x86/highbd_inv_txfm_sse4.c b/third_party/aom/av1/common/x86/highbd_inv_txfm_sse4.c
index 24b2760b9..a93699f0b 100644
--- a/third_party/aom/av1/common/x86/highbd_inv_txfm_sse4.c
+++ b/third_party/aom/av1/common/x86/highbd_inv_txfm_sse4.c
@@ -13,7 +13,7 @@
#include "./av1_rtcd.h"
#include "./aom_config.h"
-#include "av1/common/av1_inv_txfm2d_cfg.h"
+#include "av1/common/av1_inv_txfm1d_cfg.h"
#include "av1/common/x86/highbd_txfm_utility_sse4.h"
static INLINE void load_buffer_4x4(const int32_t *coeff, __m128i *in) {
@@ -24,7 +24,7 @@ static INLINE void load_buffer_4x4(const int32_t *coeff, __m128i *in) {
}
static void idct4x4_sse4_1(__m128i *in, int bit) {
- const int32_t *cospi = cospi_arr[bit - cos_bit_min];
+ const int32_t *cospi = cospi_arr(bit);
const __m128i cospi32 = _mm_set1_epi32(cospi[32]);
const __m128i cospi48 = _mm_set1_epi32(cospi[48]);
const __m128i cospi16 = _mm_set1_epi32(cospi[16]);
@@ -72,7 +72,7 @@ static void idct4x4_sse4_1(__m128i *in, int bit) {
}
static void iadst4x4_sse4_1(__m128i *in, int bit) {
- const int32_t *cospi = cospi_arr[bit - cos_bit_min];
+ const int32_t *cospi = cospi_arr(bit);
const __m128i cospi32 = _mm_set1_epi32(cospi[32]);
const __m128i cospi8 = _mm_set1_epi32(cospi[8]);
const __m128i cospim8 = _mm_set1_epi32(-cospi[8]);
@@ -232,72 +232,82 @@ static void write_buffer_4x4(__m128i *in, uint16_t *output, int stride,
void av1_inv_txfm2d_add_4x4_sse4_1(const int32_t *coeff, uint16_t *output,
int stride, int tx_type, int bd) {
__m128i in[4];
- const TXFM_2D_CFG *cfg = NULL;
+ const TXFM_1D_CFG *row_cfg = NULL;
+ const TXFM_1D_CFG *col_cfg = NULL;
switch (tx_type) {
case DCT_DCT:
- cfg = &inv_txfm_2d_cfg_dct_dct_4;
+ row_cfg = &inv_txfm_1d_row_cfg_dct_4;
+ col_cfg = &inv_txfm_1d_col_cfg_dct_4;
load_buffer_4x4(coeff, in);
- idct4x4_sse4_1(in, cfg->cos_bit_row[2]);
- idct4x4_sse4_1(in, cfg->cos_bit_col[2]);
- write_buffer_4x4(in, output, stride, 0, 0, -cfg->shift[1], bd);
+ idct4x4_sse4_1(in, row_cfg->cos_bit[2]);
+ idct4x4_sse4_1(in, col_cfg->cos_bit[2]);
+ write_buffer_4x4(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
break;
case ADST_DCT:
- cfg = &inv_txfm_2d_cfg_adst_dct_4;
+ row_cfg = &inv_txfm_1d_row_cfg_dct_4;
+ col_cfg = &inv_txfm_1d_col_cfg_adst_4;
load_buffer_4x4(coeff, in);
- idct4x4_sse4_1(in, cfg->cos_bit_row[2]);
- iadst4x4_sse4_1(in, cfg->cos_bit_col[2]);
- write_buffer_4x4(in, output, stride, 0, 0, -cfg->shift[1], bd);
+ idct4x4_sse4_1(in, row_cfg->cos_bit[2]);
+ iadst4x4_sse4_1(in, col_cfg->cos_bit[2]);
+ write_buffer_4x4(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
break;
case DCT_ADST:
- cfg = &inv_txfm_2d_cfg_dct_adst_4;
+ row_cfg = &inv_txfm_1d_row_cfg_adst_4;
+ col_cfg = &inv_txfm_1d_col_cfg_dct_4;
load_buffer_4x4(coeff, in);
- iadst4x4_sse4_1(in, cfg->cos_bit_row[2]);
- idct4x4_sse4_1(in, cfg->cos_bit_col[2]);
- write_buffer_4x4(in, output, stride, 0, 0, -cfg->shift[1], bd);
+ iadst4x4_sse4_1(in, row_cfg->cos_bit[2]);
+ idct4x4_sse4_1(in, col_cfg->cos_bit[2]);
+ write_buffer_4x4(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
break;
case ADST_ADST:
- cfg = &inv_txfm_2d_cfg_adst_adst_4;
+ row_cfg = &inv_txfm_1d_row_cfg_adst_4;
+ col_cfg = &inv_txfm_1d_col_cfg_adst_4;
load_buffer_4x4(coeff, in);
- iadst4x4_sse4_1(in, cfg->cos_bit_row[2]);
- iadst4x4_sse4_1(in, cfg->cos_bit_col[2]);
- write_buffer_4x4(in, output, stride, 0, 0, -cfg->shift[1], bd);
+ iadst4x4_sse4_1(in, row_cfg->cos_bit[2]);
+ iadst4x4_sse4_1(in, col_cfg->cos_bit[2]);
+ write_buffer_4x4(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
break;
#if CONFIG_EXT_TX
case FLIPADST_DCT:
- cfg = &inv_txfm_2d_cfg_adst_dct_4;
+ row_cfg = &inv_txfm_1d_row_cfg_dct_4;
+ col_cfg = &inv_txfm_1d_col_cfg_adst_4;
load_buffer_4x4(coeff, in);
- idct4x4_sse4_1(in, cfg->cos_bit_row[2]);
- iadst4x4_sse4_1(in, cfg->cos_bit_col[2]);
- write_buffer_4x4(in, output, stride, 0, 1, -cfg->shift[1], bd);
+ idct4x4_sse4_1(in, row_cfg->cos_bit[2]);
+ iadst4x4_sse4_1(in, col_cfg->cos_bit[2]);
+ write_buffer_4x4(in, output, stride, 0, 1, -row_cfg->shift[1], bd);
break;
case DCT_FLIPADST:
- cfg = &inv_txfm_2d_cfg_dct_adst_4;
+ row_cfg = &inv_txfm_1d_row_cfg_adst_4;
+ col_cfg = &inv_txfm_1d_col_cfg_dct_4;
load_buffer_4x4(coeff, in);
- iadst4x4_sse4_1(in, cfg->cos_bit_row[2]);
- idct4x4_sse4_1(in, cfg->cos_bit_col[2]);
- write_buffer_4x4(in, output, stride, 1, 0, -cfg->shift[1], bd);
+ iadst4x4_sse4_1(in, row_cfg->cos_bit[2]);
+ idct4x4_sse4_1(in, col_cfg->cos_bit[2]);
+ write_buffer_4x4(in, output, stride, 1, 0, -row_cfg->shift[1], bd);
break;
case FLIPADST_FLIPADST:
- cfg = &inv_txfm_2d_cfg_adst_adst_4;
+ row_cfg = &inv_txfm_1d_row_cfg_adst_4;
+ col_cfg = &inv_txfm_1d_col_cfg_adst_4;
load_buffer_4x4(coeff, in);
- iadst4x4_sse4_1(in, cfg->cos_bit_row[2]);
- iadst4x4_sse4_1(in, cfg->cos_bit_col[2]);
- write_buffer_4x4(in, output, stride, 1, 1, -cfg->shift[1], bd);
+ iadst4x4_sse4_1(in, row_cfg->cos_bit[2]);
+ iadst4x4_sse4_1(in, col_cfg->cos_bit[2]);
+ write_buffer_4x4(in, output, stride, 1, 1, -row_cfg->shift[1], bd);
break;
case ADST_FLIPADST:
- cfg = &inv_txfm_2d_cfg_adst_adst_4;
+ row_cfg = &inv_txfm_1d_row_cfg_adst_4;
+ col_cfg = &inv_txfm_1d_col_cfg_adst_4;
load_buffer_4x4(coeff, in);
- iadst4x4_sse4_1(in, cfg->cos_bit_row[2]);
- iadst4x4_sse4_1(in, cfg->cos_bit_col[2]);
- write_buffer_4x4(in, output, stride, 1, 0, -cfg->shift[1], bd);
+ iadst4x4_sse4_1(in, row_cfg->cos_bit[2]);
+ iadst4x4_sse4_1(in, col_cfg->cos_bit[2]);
+ write_buffer_4x4(in, output, stride, 1, 0, -row_cfg->shift[1], bd);
break;
case FLIPADST_ADST:
- cfg = &inv_txfm_2d_cfg_adst_adst_4;
+ row_cfg = &inv_txfm_1d_row_cfg_adst_4;
+ col_cfg = &inv_txfm_1d_col_cfg_adst_4;
load_buffer_4x4(coeff, in);
- iadst4x4_sse4_1(in, cfg->cos_bit_row[2]);
- iadst4x4_sse4_1(in, cfg->cos_bit_col[2]);
- write_buffer_4x4(in, output, stride, 0, 1, -cfg->shift[1], bd);
+ iadst4x4_sse4_1(in, row_cfg->cos_bit[2]);
+ iadst4x4_sse4_1(in, col_cfg->cos_bit[2]);
+ write_buffer_4x4(in, output, stride, 0, 1, -row_cfg->shift[1], bd);
break;
#endif // CONFIG_EXT_TX
default: assert(0);
@@ -325,7 +335,7 @@ static void load_buffer_8x8(const int32_t *coeff, __m128i *in) {
}
static void idct8x8_sse4_1(__m128i *in, __m128i *out, int bit) {
- const int32_t *cospi = cospi_arr[bit - cos_bit_min];
+ const int32_t *cospi = cospi_arr(bit);
const __m128i cospi56 = _mm_set1_epi32(cospi[56]);
const __m128i cospim8 = _mm_set1_epi32(-cospi[8]);
const __m128i cospi24 = _mm_set1_epi32(cospi[24]);
@@ -439,7 +449,7 @@ static void idct8x8_sse4_1(__m128i *in, __m128i *out, int bit) {
}
static void iadst8x8_sse4_1(__m128i *in, __m128i *out, int bit) {
- const int32_t *cospi = cospi_arr[bit - cos_bit_min];
+ const int32_t *cospi = cospi_arr(bit);
const __m128i cospi32 = _mm_set1_epi32(cospi[32]);
const __m128i cospi16 = _mm_set1_epi32(cospi[16]);
const __m128i cospim16 = _mm_set1_epi32(-cospi[16]);
@@ -698,90 +708,100 @@ static void write_buffer_8x8(__m128i *in, uint16_t *output, int stride,
void av1_inv_txfm2d_add_8x8_sse4_1(const int32_t *coeff, uint16_t *output,
int stride, int tx_type, int bd) {
__m128i in[16], out[16];
- const TXFM_2D_CFG *cfg = NULL;
+ const TXFM_1D_CFG *row_cfg = NULL;
+ const TXFM_1D_CFG *col_cfg = NULL;
switch (tx_type) {
case DCT_DCT:
- cfg = &inv_txfm_2d_cfg_dct_dct_8;
+ row_cfg = &inv_txfm_1d_row_cfg_dct_8;
+ col_cfg = &inv_txfm_1d_col_cfg_dct_8;
load_buffer_8x8(coeff, in);
transpose_8x8(in, out);
- idct8x8_sse4_1(out, in, cfg->cos_bit_row[2]);
+ idct8x8_sse4_1(out, in, row_cfg->cos_bit[2]);
transpose_8x8(in, out);
- idct8x8_sse4_1(out, in, cfg->cos_bit_col[2]);
- write_buffer_8x8(in, output, stride, 0, 0, -cfg->shift[1], bd);
+ idct8x8_sse4_1(out, in, col_cfg->cos_bit[2]);
+ write_buffer_8x8(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
break;
case DCT_ADST:
- cfg = &inv_txfm_2d_cfg_dct_adst_8;
+ row_cfg = &inv_txfm_1d_row_cfg_adst_8;
+ col_cfg = &inv_txfm_1d_col_cfg_dct_8;
load_buffer_8x8(coeff, in);
transpose_8x8(in, out);
- iadst8x8_sse4_1(out, in, cfg->cos_bit_row[2]);
+ iadst8x8_sse4_1(out, in, row_cfg->cos_bit[2]);
transpose_8x8(in, out);
- idct8x8_sse4_1(out, in, cfg->cos_bit_col[2]);
- write_buffer_8x8(in, output, stride, 0, 0, -cfg->shift[1], bd);
+ idct8x8_sse4_1(out, in, col_cfg->cos_bit[2]);
+ write_buffer_8x8(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
break;
case ADST_DCT:
- cfg = &inv_txfm_2d_cfg_adst_dct_8;
+ row_cfg = &inv_txfm_1d_row_cfg_dct_8;
+ col_cfg = &inv_txfm_1d_col_cfg_adst_8;
load_buffer_8x8(coeff, in);
transpose_8x8(in, out);
- idct8x8_sse4_1(out, in, cfg->cos_bit_row[2]);
+ idct8x8_sse4_1(out, in, row_cfg->cos_bit[2]);
transpose_8x8(in, out);
- iadst8x8_sse4_1(out, in, cfg->cos_bit_col[2]);
- write_buffer_8x8(in, output, stride, 0, 0, -cfg->shift[1], bd);
+ iadst8x8_sse4_1(out, in, col_cfg->cos_bit[2]);
+ write_buffer_8x8(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
break;
case ADST_ADST:
- cfg = &inv_txfm_2d_cfg_adst_adst_8;
+ row_cfg = &inv_txfm_1d_row_cfg_adst_8;
+ col_cfg = &inv_txfm_1d_col_cfg_adst_8;
load_buffer_8x8(coeff, in);
transpose_8x8(in, out);
- iadst8x8_sse4_1(out, in, cfg->cos_bit_row[2]);
+ iadst8x8_sse4_1(out, in, row_cfg->cos_bit[2]);
transpose_8x8(in, out);
- iadst8x8_sse4_1(out, in, cfg->cos_bit_col[2]);
- write_buffer_8x8(in, output, stride, 0, 0, -cfg->shift[1], bd);
+ iadst8x8_sse4_1(out, in, col_cfg->cos_bit[2]);
+ write_buffer_8x8(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
break;
#if CONFIG_EXT_TX
case FLIPADST_DCT:
- cfg = &inv_txfm_2d_cfg_adst_dct_8;
+ row_cfg = &inv_txfm_1d_row_cfg_dct_8;
+ col_cfg = &inv_txfm_1d_col_cfg_adst_8;
load_buffer_8x8(coeff, in);
transpose_8x8(in, out);
- idct8x8_sse4_1(out, in, cfg->cos_bit_row[2]);
+ idct8x8_sse4_1(out, in, row_cfg->cos_bit[2]);
transpose_8x8(in, out);
- iadst8x8_sse4_1(out, in, cfg->cos_bit_col[2]);
- write_buffer_8x8(in, output, stride, 0, 1, -cfg->shift[1], bd);
+ iadst8x8_sse4_1(out, in, col_cfg->cos_bit[2]);
+ write_buffer_8x8(in, output, stride, 0, 1, -row_cfg->shift[1], bd);
break;
case DCT_FLIPADST:
- cfg = &inv_txfm_2d_cfg_dct_adst_8;
+ row_cfg = &inv_txfm_1d_row_cfg_adst_8;
+ col_cfg = &inv_txfm_1d_col_cfg_dct_8;
load_buffer_8x8(coeff, in);
transpose_8x8(in, out);
- iadst8x8_sse4_1(out, in, cfg->cos_bit_row[2]);
+ iadst8x8_sse4_1(out, in, row_cfg->cos_bit[2]);
transpose_8x8(in, out);
- idct8x8_sse4_1(out, in, cfg->cos_bit_col[2]);
- write_buffer_8x8(in, output, stride, 1, 0, -cfg->shift[1], bd);
+ idct8x8_sse4_1(out, in, col_cfg->cos_bit[2]);
+ write_buffer_8x8(in, output, stride, 1, 0, -row_cfg->shift[1], bd);
break;
case ADST_FLIPADST:
- cfg = &inv_txfm_2d_cfg_adst_adst_8;
+ row_cfg = &inv_txfm_1d_row_cfg_adst_8;
+ col_cfg = &inv_txfm_1d_col_cfg_adst_8;
load_buffer_8x8(coeff, in);
transpose_8x8(in, out);
- iadst8x8_sse4_1(out, in, cfg->cos_bit_row[2]);
+ iadst8x8_sse4_1(out, in, row_cfg->cos_bit[2]);
transpose_8x8(in, out);
- iadst8x8_sse4_1(out, in, cfg->cos_bit_col[2]);
- write_buffer_8x8(in, output, stride, 1, 0, -cfg->shift[1], bd);
+ iadst8x8_sse4_1(out, in, col_cfg->cos_bit[2]);
+ write_buffer_8x8(in, output, stride, 1, 0, -row_cfg->shift[1], bd);
break;
case FLIPADST_FLIPADST:
- cfg = &inv_txfm_2d_cfg_adst_adst_8;
+ row_cfg = &inv_txfm_1d_row_cfg_adst_8;
+ col_cfg = &inv_txfm_1d_col_cfg_adst_8;
load_buffer_8x8(coeff, in);
transpose_8x8(in, out);
- iadst8x8_sse4_1(out, in, cfg->cos_bit_row[2]);
+ iadst8x8_sse4_1(out, in, row_cfg->cos_bit[2]);
transpose_8x8(in, out);
- iadst8x8_sse4_1(out, in, cfg->cos_bit_col[2]);
- write_buffer_8x8(in, output, stride, 1, 1, -cfg->shift[1], bd);
+ iadst8x8_sse4_1(out, in, col_cfg->cos_bit[2]);
+ write_buffer_8x8(in, output, stride, 1, 1, -row_cfg->shift[1], bd);
break;
case FLIPADST_ADST:
- cfg = &inv_txfm_2d_cfg_adst_adst_8;
+ row_cfg = &inv_txfm_1d_row_cfg_adst_8;
+ col_cfg = &inv_txfm_1d_col_cfg_adst_8;
load_buffer_8x8(coeff, in);
transpose_8x8(in, out);
- iadst8x8_sse4_1(out, in, cfg->cos_bit_row[2]);
+ iadst8x8_sse4_1(out, in, row_cfg->cos_bit[2]);
transpose_8x8(in, out);
- iadst8x8_sse4_1(out, in, cfg->cos_bit_col[2]);
- write_buffer_8x8(in, output, stride, 0, 1, -cfg->shift[1], bd);
+ iadst8x8_sse4_1(out, in, col_cfg->cos_bit[2]);
+ write_buffer_8x8(in, output, stride, 0, 1, -row_cfg->shift[1], bd);
break;
#endif // CONFIG_EXT_TX
default: assert(0);
@@ -849,7 +869,7 @@ static void write_buffer_16x16(__m128i *in, uint16_t *output, int stride,
}
static void idct16x16_sse4_1(__m128i *in, __m128i *out, int bit) {
- const int32_t *cospi = cospi_arr[bit - cos_bit_min];
+ const int32_t *cospi = cospi_arr(bit);
const __m128i cospi60 = _mm_set1_epi32(cospi[60]);
const __m128i cospim4 = _mm_set1_epi32(-cospi[4]);
const __m128i cospi28 = _mm_set1_epi32(cospi[28]);
@@ -907,24 +927,24 @@ static void idct16x16_sse4_1(__m128i *in, __m128i *out, int bit) {
v[6] = u[6];
v[7] = u[7];
- v[8] = half_btf_sse4_1(cospi60, u[8], cospim4, u[15], rnding, bit);
- v[9] = half_btf_sse4_1(cospi28, u[9], cospim36, u[14], rnding, bit);
- v[10] = half_btf_sse4_1(cospi44, u[10], cospim20, u[13], rnding, bit);
- v[11] = half_btf_sse4_1(cospi12, u[11], cospim52, u[12], rnding, bit);
- v[12] = half_btf_sse4_1(cospi52, u[11], cospi12, u[12], rnding, bit);
- v[13] = half_btf_sse4_1(cospi20, u[10], cospi44, u[13], rnding, bit);
- v[14] = half_btf_sse4_1(cospi36, u[9], cospi28, u[14], rnding, bit);
- v[15] = half_btf_sse4_1(cospi4, u[8], cospi60, u[15], rnding, bit);
+ v[8] = half_btf_sse4_1(&cospi60, &u[8], &cospim4, &u[15], &rnding, bit);
+ v[9] = half_btf_sse4_1(&cospi28, &u[9], &cospim36, &u[14], &rnding, bit);
+ v[10] = half_btf_sse4_1(&cospi44, &u[10], &cospim20, &u[13], &rnding, bit);
+ v[11] = half_btf_sse4_1(&cospi12, &u[11], &cospim52, &u[12], &rnding, bit);
+ v[12] = half_btf_sse4_1(&cospi52, &u[11], &cospi12, &u[12], &rnding, bit);
+ v[13] = half_btf_sse4_1(&cospi20, &u[10], &cospi44, &u[13], &rnding, bit);
+ v[14] = half_btf_sse4_1(&cospi36, &u[9], &cospi28, &u[14], &rnding, bit);
+ v[15] = half_btf_sse4_1(&cospi4, &u[8], &cospi60, &u[15], &rnding, bit);
// stage 3
u[0] = v[0];
u[1] = v[1];
u[2] = v[2];
u[3] = v[3];
- u[4] = half_btf_sse4_1(cospi56, v[4], cospim8, v[7], rnding, bit);
- u[5] = half_btf_sse4_1(cospi24, v[5], cospim40, v[6], rnding, bit);
- u[6] = half_btf_sse4_1(cospi40, v[5], cospi24, v[6], rnding, bit);
- u[7] = half_btf_sse4_1(cospi8, v[4], cospi56, v[7], rnding, bit);
+ u[4] = half_btf_sse4_1(&cospi56, &v[4], &cospim8, &v[7], &rnding, bit);
+ u[5] = half_btf_sse4_1(&cospi24, &v[5], &cospim40, &v[6], &rnding, bit);
+ u[6] = half_btf_sse4_1(&cospi40, &v[5], &cospi24, &v[6], &rnding, bit);
+ u[7] = half_btf_sse4_1(&cospi8, &v[4], &cospi56, &v[7], &rnding, bit);
u[8] = _mm_add_epi32(v[8], v[9]);
u[9] = _mm_sub_epi32(v[8], v[9]);
u[10] = _mm_sub_epi32(v[11], v[10]);
@@ -945,19 +965,19 @@ static void idct16x16_sse4_1(__m128i *in, __m128i *out, int bit) {
v[1] = _mm_add_epi32(v[1], rnding);
v[1] = _mm_srai_epi32(v[1], bit);
- v[2] = half_btf_sse4_1(cospi48, u[2], cospim16, u[3], rnding, bit);
- v[3] = half_btf_sse4_1(cospi16, u[2], cospi48, u[3], rnding, bit);
+ v[2] = half_btf_sse4_1(&cospi48, &u[2], &cospim16, &u[3], &rnding, bit);
+ v[3] = half_btf_sse4_1(&cospi16, &u[2], &cospi48, &u[3], &rnding, bit);
v[4] = _mm_add_epi32(u[4], u[5]);
v[5] = _mm_sub_epi32(u[4], u[5]);
v[6] = _mm_sub_epi32(u[7], u[6]);
v[7] = _mm_add_epi32(u[6], u[7]);
v[8] = u[8];
- v[9] = half_btf_sse4_1(cospim16, u[9], cospi48, u[14], rnding, bit);
- v[10] = half_btf_sse4_1(cospim48, u[10], cospim16, u[13], rnding, bit);
+ v[9] = half_btf_sse4_1(&cospim16, &u[9], &cospi48, &u[14], &rnding, bit);
+ v[10] = half_btf_sse4_1(&cospim48, &u[10], &cospim16, &u[13], &rnding, bit);
v[11] = u[11];
v[12] = u[12];
- v[13] = half_btf_sse4_1(cospim16, u[10], cospi48, u[13], rnding, bit);
- v[14] = half_btf_sse4_1(cospi48, u[9], cospi16, u[14], rnding, bit);
+ v[13] = half_btf_sse4_1(&cospim16, &u[10], &cospi48, &u[13], &rnding, bit);
+ v[14] = half_btf_sse4_1(&cospi48, &u[9], &cospi16, &u[14], &rnding, bit);
v[15] = u[15];
// stage 5
@@ -1043,7 +1063,7 @@ static void idct16x16_sse4_1(__m128i *in, __m128i *out, int bit) {
}
static void iadst16x16_sse4_1(__m128i *in, __m128i *out, int bit) {
- const int32_t *cospi = cospi_arr[bit - cos_bit_min];
+ const int32_t *cospi = cospi_arr(bit);
const __m128i cospi32 = _mm_set1_epi32(cospi[32]);
const __m128i cospi48 = _mm_set1_epi32(cospi[48]);
const __m128i cospi16 = _mm_set1_epi32(cospi[16]);
@@ -1183,18 +1203,18 @@ static void iadst16x16_sse4_1(__m128i *in, __m128i *out, int bit) {
v[1] = u[1];
v[2] = u[2];
v[3] = u[3];
- v[4] = half_btf_sse4_1(cospi16, u[4], cospi48, u[5], rnding, bit);
- v[5] = half_btf_sse4_1(cospi48, u[4], cospim16, u[5], rnding, bit);
- v[6] = half_btf_sse4_1(cospim48, u[6], cospi16, u[7], rnding, bit);
- v[7] = half_btf_sse4_1(cospi16, u[6], cospi48, u[7], rnding, bit);
+ v[4] = half_btf_sse4_1(&cospi16, &u[4], &cospi48, &u[5], &rnding, bit);
+ v[5] = half_btf_sse4_1(&cospi48, &u[4], &cospim16, &u[5], &rnding, bit);
+ v[6] = half_btf_sse4_1(&cospim48, &u[6], &cospi16, &u[7], &rnding, bit);
+ v[7] = half_btf_sse4_1(&cospi16, &u[6], &cospi48, &u[7], &rnding, bit);
v[8] = u[8];
v[9] = u[9];
v[10] = u[10];
v[11] = u[11];
- v[12] = half_btf_sse4_1(cospi16, u[12], cospi48, u[13], rnding, bit);
- v[13] = half_btf_sse4_1(cospi48, u[12], cospim16, u[13], rnding, bit);
- v[14] = half_btf_sse4_1(cospim48, u[14], cospi16, u[15], rnding, bit);
- v[15] = half_btf_sse4_1(cospi16, u[14], cospi48, u[15], rnding, bit);
+ v[12] = half_btf_sse4_1(&cospi16, &u[12], &cospi48, &u[13], &rnding, bit);
+ v[13] = half_btf_sse4_1(&cospi48, &u[12], &cospim16, &u[13], &rnding, bit);
+ v[14] = half_btf_sse4_1(&cospim48, &u[14], &cospi16, &u[15], &rnding, bit);
+ v[15] = half_btf_sse4_1(&cospi16, &u[14], &cospi48, &u[15], &rnding, bit);
// stage 5
u[0] = _mm_add_epi32(v[0], v[4]);
@@ -1223,14 +1243,14 @@ static void iadst16x16_sse4_1(__m128i *in, __m128i *out, int bit) {
v[5] = u[5];
v[6] = u[6];
v[7] = u[7];
- v[8] = half_btf_sse4_1(cospi8, u[8], cospi56, u[9], rnding, bit);
- v[9] = half_btf_sse4_1(cospi56, u[8], cospim8, u[9], rnding, bit);
- v[10] = half_btf_sse4_1(cospi40, u[10], cospi24, u[11], rnding, bit);
- v[11] = half_btf_sse4_1(cospi24, u[10], cospim40, u[11], rnding, bit);
- v[12] = half_btf_sse4_1(cospim56, u[12], cospi8, u[13], rnding, bit);
- v[13] = half_btf_sse4_1(cospi8, u[12], cospi56, u[13], rnding, bit);
- v[14] = half_btf_sse4_1(cospim24, u[14], cospi40, u[15], rnding, bit);
- v[15] = half_btf_sse4_1(cospi40, u[14], cospi24, u[15], rnding, bit);
+ v[8] = half_btf_sse4_1(&cospi8, &u[8], &cospi56, &u[9], &rnding, bit);
+ v[9] = half_btf_sse4_1(&cospi56, &u[8], &cospim8, &u[9], &rnding, bit);
+ v[10] = half_btf_sse4_1(&cospi40, &u[10], &cospi24, &u[11], &rnding, bit);
+ v[11] = half_btf_sse4_1(&cospi24, &u[10], &cospim40, &u[11], &rnding, bit);
+ v[12] = half_btf_sse4_1(&cospim56, &u[12], &cospi8, &u[13], &rnding, bit);
+ v[13] = half_btf_sse4_1(&cospi8, &u[12], &cospi56, &u[13], &rnding, bit);
+ v[14] = half_btf_sse4_1(&cospim24, &u[14], &cospi40, &u[15], &rnding, bit);
+ v[15] = half_btf_sse4_1(&cospi40, &u[14], &cospi24, &u[15], &rnding, bit);
// stage 7
u[0] = _mm_add_epi32(v[0], v[8]);
@@ -1251,22 +1271,22 @@ static void iadst16x16_sse4_1(__m128i *in, __m128i *out, int bit) {
u[15] = _mm_sub_epi32(v[7], v[15]);
// stage 8
- v[0] = half_btf_sse4_1(cospi2, u[0], cospi62, u[1], rnding, bit);
- v[1] = half_btf_sse4_1(cospi62, u[0], cospim2, u[1], rnding, bit);
- v[2] = half_btf_sse4_1(cospi10, u[2], cospi54, u[3], rnding, bit);
- v[3] = half_btf_sse4_1(cospi54, u[2], cospim10, u[3], rnding, bit);
- v[4] = half_btf_sse4_1(cospi18, u[4], cospi46, u[5], rnding, bit);
- v[5] = half_btf_sse4_1(cospi46, u[4], cospim18, u[5], rnding, bit);
- v[6] = half_btf_sse4_1(cospi26, u[6], cospi38, u[7], rnding, bit);
- v[7] = half_btf_sse4_1(cospi38, u[6], cospim26, u[7], rnding, bit);
- v[8] = half_btf_sse4_1(cospi34, u[8], cospi30, u[9], rnding, bit);
- v[9] = half_btf_sse4_1(cospi30, u[8], cospim34, u[9], rnding, bit);
- v[10] = half_btf_sse4_1(cospi42, u[10], cospi22, u[11], rnding, bit);
- v[11] = half_btf_sse4_1(cospi22, u[10], cospim42, u[11], rnding, bit);
- v[12] = half_btf_sse4_1(cospi50, u[12], cospi14, u[13], rnding, bit);
- v[13] = half_btf_sse4_1(cospi14, u[12], cospim50, u[13], rnding, bit);
- v[14] = half_btf_sse4_1(cospi58, u[14], cospi6, u[15], rnding, bit);
- v[15] = half_btf_sse4_1(cospi6, u[14], cospim58, u[15], rnding, bit);
+ v[0] = half_btf_sse4_1(&cospi2, &u[0], &cospi62, &u[1], &rnding, bit);
+ v[1] = half_btf_sse4_1(&cospi62, &u[0], &cospim2, &u[1], &rnding, bit);
+ v[2] = half_btf_sse4_1(&cospi10, &u[2], &cospi54, &u[3], &rnding, bit);
+ v[3] = half_btf_sse4_1(&cospi54, &u[2], &cospim10, &u[3], &rnding, bit);
+ v[4] = half_btf_sse4_1(&cospi18, &u[4], &cospi46, &u[5], &rnding, bit);
+ v[5] = half_btf_sse4_1(&cospi46, &u[4], &cospim18, &u[5], &rnding, bit);
+ v[6] = half_btf_sse4_1(&cospi26, &u[6], &cospi38, &u[7], &rnding, bit);
+ v[7] = half_btf_sse4_1(&cospi38, &u[6], &cospim26, &u[7], &rnding, bit);
+ v[8] = half_btf_sse4_1(&cospi34, &u[8], &cospi30, &u[9], &rnding, bit);
+ v[9] = half_btf_sse4_1(&cospi30, &u[8], &cospim34, &u[9], &rnding, bit);
+ v[10] = half_btf_sse4_1(&cospi42, &u[10], &cospi22, &u[11], &rnding, bit);
+ v[11] = half_btf_sse4_1(&cospi22, &u[10], &cospim42, &u[11], &rnding, bit);
+ v[12] = half_btf_sse4_1(&cospi50, &u[12], &cospi14, &u[13], &rnding, bit);
+ v[13] = half_btf_sse4_1(&cospi14, &u[12], &cospim50, &u[13], &rnding, bit);
+ v[14] = half_btf_sse4_1(&cospi58, &u[14], &cospi6, &u[15], &rnding, bit);
+ v[15] = half_btf_sse4_1(&cospi6, &u[14], &cospim58, &u[15], &rnding, bit);
// stage 9
out[0 * 4 + col] = v[1];
@@ -1298,99 +1318,109 @@ static void round_shift_16x16(__m128i *in, int shift) {
void av1_inv_txfm2d_add_16x16_sse4_1(const int32_t *coeff, uint16_t *output,
int stride, int tx_type, int bd) {
__m128i in[64], out[64];
- const TXFM_2D_CFG *cfg = NULL;
+ const TXFM_1D_CFG *row_cfg = NULL;
+ const TXFM_1D_CFG *col_cfg = NULL;
switch (tx_type) {
case DCT_DCT:
- cfg = &inv_txfm_2d_cfg_dct_dct_16;
+ row_cfg = &inv_txfm_1d_row_cfg_dct_16;
+ col_cfg = &inv_txfm_1d_col_cfg_dct_16;
load_buffer_16x16(coeff, in);
transpose_16x16(in, out);
- idct16x16_sse4_1(out, in, cfg->cos_bit_row[2]);
- round_shift_16x16(in, -cfg->shift[0]);
+ idct16x16_sse4_1(out, in, row_cfg->cos_bit[2]);
+ round_shift_16x16(in, -row_cfg->shift[0]);
transpose_16x16(in, out);
- idct16x16_sse4_1(out, in, cfg->cos_bit_col[2]);
- write_buffer_16x16(in, output, stride, 0, 0, -cfg->shift[1], bd);
+ idct16x16_sse4_1(out, in, col_cfg->cos_bit[2]);
+ write_buffer_16x16(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
break;
case DCT_ADST:
- cfg = &inv_txfm_2d_cfg_dct_adst_16;
+ row_cfg = &inv_txfm_1d_row_cfg_adst_16;
+ col_cfg = &inv_txfm_1d_col_cfg_dct_16;
load_buffer_16x16(coeff, in);
transpose_16x16(in, out);
- iadst16x16_sse4_1(out, in, cfg->cos_bit_row[2]);
- round_shift_16x16(in, -cfg->shift[0]);
+ iadst16x16_sse4_1(out, in, row_cfg->cos_bit[2]);
+ round_shift_16x16(in, -row_cfg->shift[0]);
transpose_16x16(in, out);
- idct16x16_sse4_1(out, in, cfg->cos_bit_col[2]);
- write_buffer_16x16(in, output, stride, 0, 0, -cfg->shift[1], bd);
+ idct16x16_sse4_1(out, in, col_cfg->cos_bit[2]);
+ write_buffer_16x16(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
break;
case ADST_DCT:
- cfg = &inv_txfm_2d_cfg_adst_dct_16;
+ row_cfg = &inv_txfm_1d_row_cfg_dct_16;
+ col_cfg = &inv_txfm_1d_col_cfg_adst_16;
load_buffer_16x16(coeff, in);
transpose_16x16(in, out);
- idct16x16_sse4_1(out, in, cfg->cos_bit_row[2]);
- round_shift_16x16(in, -cfg->shift[0]);
+ idct16x16_sse4_1(out, in, row_cfg->cos_bit[2]);
+ round_shift_16x16(in, -row_cfg->shift[0]);
transpose_16x16(in, out);
- iadst16x16_sse4_1(out, in, cfg->cos_bit_col[2]);
- write_buffer_16x16(in, output, stride, 0, 0, -cfg->shift[1], bd);
+ iadst16x16_sse4_1(out, in, col_cfg->cos_bit[2]);
+ write_buffer_16x16(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
break;
case ADST_ADST:
- cfg = &inv_txfm_2d_cfg_adst_adst_16;
+ row_cfg = &inv_txfm_1d_row_cfg_adst_16;
+ col_cfg = &inv_txfm_1d_col_cfg_adst_16;
load_buffer_16x16(coeff, in);
transpose_16x16(in, out);
- iadst16x16_sse4_1(out, in, cfg->cos_bit_row[2]);
- round_shift_16x16(in, -cfg->shift[0]);
+ iadst16x16_sse4_1(out, in, row_cfg->cos_bit[2]);
+ round_shift_16x16(in, -row_cfg->shift[0]);
transpose_16x16(in, out);
- iadst16x16_sse4_1(out, in, cfg->cos_bit_col[2]);
- write_buffer_16x16(in, output, stride, 0, 0, -cfg->shift[1], bd);
+ iadst16x16_sse4_1(out, in, col_cfg->cos_bit[2]);
+ write_buffer_16x16(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
break;
#if CONFIG_EXT_TX
case FLIPADST_DCT:
- cfg = &inv_txfm_2d_cfg_adst_dct_16;
+ row_cfg = &inv_txfm_1d_row_cfg_dct_16;
+ col_cfg = &inv_txfm_1d_col_cfg_adst_16;
load_buffer_16x16(coeff, in);
transpose_16x16(in, out);
- idct16x16_sse4_1(out, in, cfg->cos_bit_row[2]);
- round_shift_16x16(in, -cfg->shift[0]);
+ idct16x16_sse4_1(out, in, row_cfg->cos_bit[2]);
+ round_shift_16x16(in, -row_cfg->shift[0]);
transpose_16x16(in, out);
- iadst16x16_sse4_1(out, in, cfg->cos_bit_col[2]);
- write_buffer_16x16(in, output, stride, 0, 1, -cfg->shift[1], bd);
+ iadst16x16_sse4_1(out, in, col_cfg->cos_bit[2]);
+ write_buffer_16x16(in, output, stride, 0, 1, -row_cfg->shift[1], bd);
break;
case DCT_FLIPADST:
- cfg = &inv_txfm_2d_cfg_dct_adst_16;
+ row_cfg = &inv_txfm_1d_row_cfg_adst_16;
+ col_cfg = &inv_txfm_1d_col_cfg_dct_16;
load_buffer_16x16(coeff, in);
transpose_16x16(in, out);
- iadst16x16_sse4_1(out, in, cfg->cos_bit_row[2]);
- round_shift_16x16(in, -cfg->shift[0]);
+ iadst16x16_sse4_1(out, in, row_cfg->cos_bit[2]);
+ round_shift_16x16(in, -row_cfg->shift[0]);
transpose_16x16(in, out);
- idct16x16_sse4_1(out, in, cfg->cos_bit_col[2]);
- write_buffer_16x16(in, output, stride, 1, 0, -cfg->shift[1], bd);
+ idct16x16_sse4_1(out, in, col_cfg->cos_bit[2]);
+ write_buffer_16x16(in, output, stride, 1, 0, -row_cfg->shift[1], bd);
break;
case ADST_FLIPADST:
- cfg = &inv_txfm_2d_cfg_adst_adst_16;
+ row_cfg = &inv_txfm_1d_row_cfg_adst_16;
+ col_cfg = &inv_txfm_1d_col_cfg_adst_16;
load_buffer_16x16(coeff, in);
transpose_16x16(in, out);
- iadst16x16_sse4_1(out, in, cfg->cos_bit_row[2]);
- round_shift_16x16(in, -cfg->shift[0]);
+ iadst16x16_sse4_1(out, in, row_cfg->cos_bit[2]);
+ round_shift_16x16(in, -row_cfg->shift[0]);
transpose_16x16(in, out);
- iadst16x16_sse4_1(out, in, cfg->cos_bit_col[2]);
- write_buffer_16x16(in, output, stride, 1, 0, -cfg->shift[1], bd);
+ iadst16x16_sse4_1(out, in, col_cfg->cos_bit[2]);
+ write_buffer_16x16(in, output, stride, 1, 0, -row_cfg->shift[1], bd);
break;
case FLIPADST_FLIPADST:
- cfg = &inv_txfm_2d_cfg_adst_adst_16;
+ row_cfg = &inv_txfm_1d_row_cfg_adst_16;
+ col_cfg = &inv_txfm_1d_col_cfg_adst_16;
load_buffer_16x16(coeff, in);
transpose_16x16(in, out);
- iadst16x16_sse4_1(out, in, cfg->cos_bit_row[2]);
- round_shift_16x16(in, -cfg->shift[0]);
+ iadst16x16_sse4_1(out, in, row_cfg->cos_bit[2]);
+ round_shift_16x16(in, -row_cfg->shift[0]);
transpose_16x16(in, out);
- iadst16x16_sse4_1(out, in, cfg->cos_bit_col[2]);
- write_buffer_16x16(in, output, stride, 1, 1, -cfg->shift[1], bd);
+ iadst16x16_sse4_1(out, in, col_cfg->cos_bit[2]);
+ write_buffer_16x16(in, output, stride, 1, 1, -row_cfg->shift[1], bd);
break;
case FLIPADST_ADST:
- cfg = &inv_txfm_2d_cfg_adst_adst_16;
+ row_cfg = &inv_txfm_1d_row_cfg_adst_16;
+ col_cfg = &inv_txfm_1d_col_cfg_adst_16;
load_buffer_16x16(coeff, in);
transpose_16x16(in, out);
- iadst16x16_sse4_1(out, in, cfg->cos_bit_row[2]);
- round_shift_16x16(in, -cfg->shift[0]);
+ iadst16x16_sse4_1(out, in, row_cfg->cos_bit[2]);
+ round_shift_16x16(in, -row_cfg->shift[0]);
transpose_16x16(in, out);
- iadst16x16_sse4_1(out, in, cfg->cos_bit_col[2]);
- write_buffer_16x16(in, output, stride, 0, 1, -cfg->shift[1], bd);
+ iadst16x16_sse4_1(out, in, col_cfg->cos_bit[2]);
+ write_buffer_16x16(in, output, stride, 0, 1, -row_cfg->shift[1], bd);
break;
#endif
default: assert(0);
diff --git a/third_party/aom/av1/common/x86/highbd_txfm_utility_sse4.h b/third_party/aom/av1/common/x86/highbd_txfm_utility_sse4.h
index bc96defe3..fb246674a 100644
--- a/third_party/aom/av1/common/x86/highbd_txfm_utility_sse4.h
+++ b/third_party/aom/av1/common/x86/highbd_txfm_utility_sse4.h
@@ -77,14 +77,15 @@ static INLINE void transpose_16x16(const __m128i *in, __m128i *out) {
// Note:
// rounding = 1 << (bit - 1)
-static INLINE __m128i half_btf_sse4_1(__m128i w0, __m128i n0, __m128i w1,
- __m128i n1, __m128i rounding, int bit) {
+static INLINE __m128i half_btf_sse4_1(const __m128i *w0, const __m128i *n0,
+ const __m128i *w1, const __m128i *n1,
+ const __m128i *rounding, int bit) {
__m128i x, y;
- x = _mm_mullo_epi32(w0, n0);
- y = _mm_mullo_epi32(w1, n1);
+ x = _mm_mullo_epi32(*w0, *n0);
+ y = _mm_mullo_epi32(*w1, *n1);
x = _mm_add_epi32(x, y);
- x = _mm_add_epi32(x, rounding);
+ x = _mm_add_epi32(x, *rounding);
x = _mm_srai_epi32(x, bit);
return x;
}
diff --git a/third_party/aom/av1/common/x86/highbd_warp_plane_ssse3.c b/third_party/aom/av1/common/x86/highbd_warp_plane_ssse3.c
index c25db88b7..37e2f61e7 100644
--- a/third_party/aom/av1/common/x86/highbd_warp_plane_ssse3.c
+++ b/third_party/aom/av1/common/x86/highbd_warp_plane_ssse3.c
@@ -14,16 +14,13 @@
#include "./av1_rtcd.h"
#include "av1/common/warped_motion.h"
-static const __m128i *const filter = (const __m128i *const)warped_filter;
-
-/* SSE2 version of the rotzoom/affine warp filter */
-void av1_highbd_warp_affine_ssse3(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) {
+void av1_highbd_warp_affine_ssse3(const int32_t *mat, const uint16_t *ref,
+ int width, int height, int stride,
+ uint16_t *pred, int p_col, int p_row,
+ int p_width, int p_height, int p_stride,
+ int subsampling_x, int subsampling_y, int bd,
+ int comp_avg, int16_t alpha, int16_t beta,
+ int16_t gamma, int16_t delta) {
#if HORSHEAR_REDUCE_PREC_BITS >= 5
__m128i tmp[15];
#else
@@ -47,23 +44,21 @@ void av1_highbd_warp_affine_ssse3(int32_t *mat, uint16_t *ref, int width,
for (j = 0; j < p_width; j += 8) {
// (x, y) coordinates of the center of this block in the destination
// image
- int32_t dst_x = p_col + j + 4;
- int32_t dst_y = p_row + i + 4;
+ const int32_t dst_x = p_col + j + 4;
+ const int32_t dst_y = p_row + i + 4;
int32_t x4, y4, ix4, sx4, iy4, sy4;
if (subsampling_x)
- x4 = ROUND_POWER_OF_TWO_SIGNED(
- mat[2] * 2 * dst_x + mat[3] * 2 * dst_y + mat[0] +
- (mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS)) / 2,
- 1);
+ x4 = (mat[2] * 4 * dst_x + mat[3] * 4 * dst_y + mat[0] * 2 +
+ (mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS))) /
+ 4;
else
x4 = mat[2] * dst_x + mat[3] * dst_y + mat[0];
if (subsampling_y)
- y4 = ROUND_POWER_OF_TWO_SIGNED(
- mat[4] * 2 * dst_x + mat[5] * 2 * dst_y + mat[1] +
- (mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS)) / 2,
- 1);
+ y4 = (mat[4] * 4 * dst_x + mat[5] * 4 * dst_y + mat[1] * 2 +
+ (mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS))) /
+ 4;
else
y4 = mat[4] * dst_x + mat[5] * dst_y + mat[1];
@@ -72,71 +67,103 @@ void av1_highbd_warp_affine_ssse3(int32_t *mat, uint16_t *ref, int width,
iy4 = y4 >> WARPEDMODEL_PREC_BITS;
sy4 = y4 & ((1 << WARPEDMODEL_PREC_BITS) - 1);
+ // Add in all the constant terms, including rounding and offset
+ sx4 += alpha * (-4) + beta * (-4) + (1 << (WARPEDDIFF_PREC_BITS - 1)) +
+ (WARPEDPIXEL_PREC_SHIFTS << WARPEDDIFF_PREC_BITS);
+ sy4 += gamma * (-4) + delta * (-4) + (1 << (WARPEDDIFF_PREC_BITS - 1)) +
+ (WARPEDPIXEL_PREC_SHIFTS << WARPEDDIFF_PREC_BITS);
+
+ sx4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1);
+ sy4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1);
+
// Horizontal filter
- for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
- int iy = iy4 + k;
- if (iy < 0)
- iy = 0;
- else if (iy > height - 1)
- iy = height - 1;
-
- // If the block is aligned such that, after clamping, every sample
- // would be taken from the leftmost/rightmost column, then we can
- // skip the expensive horizontal filter.
- if (ix4 <= -7) {
+ // If the block is aligned such that, after clamping, every sample
+ // would be taken from the leftmost/rightmost column, then we can
+ // skip the expensive horizontal filter.
+ if (ix4 <= -7) {
+ for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
+ int iy = iy4 + k;
+ if (iy < 0)
+ iy = 0;
+ else if (iy > height - 1)
+ iy = height - 1;
tmp[k + 7] = _mm_set1_epi16(
+ (1 << (bd + WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS -
+ 1)) +
ref[iy * stride] *
- (1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)));
- } else if (ix4 >= width + 6) {
+ (1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)));
+ }
+ } else if (ix4 >= width + 6) {
+ for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
+ int iy = iy4 + k;
+ if (iy < 0)
+ iy = 0;
+ else if (iy > height - 1)
+ iy = height - 1;
tmp[k + 7] = _mm_set1_epi16(
+ (1 << (bd + WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS -
+ 1)) +
ref[iy * stride + (width - 1)] *
- (1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)));
- } else {
- int sx = sx4 + alpha * (-4) + beta * k +
- // Include rounding and offset here
- (1 << (WARPEDDIFF_PREC_BITS - 1)) +
- (WARPEDPIXEL_PREC_SHIFTS << WARPEDDIFF_PREC_BITS);
+ (1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)));
+ }
+ } else {
+ for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
+ int iy = iy4 + k;
+ if (iy < 0)
+ iy = 0;
+ else if (iy > height - 1)
+ iy = height - 1;
+ int sx = sx4 + beta * (k + 4);
// Load source pixels
- __m128i src =
+ const __m128i src =
_mm_loadu_si128((__m128i *)(ref + iy * stride + ix4 - 7));
- __m128i src2 =
+ const __m128i src2 =
_mm_loadu_si128((__m128i *)(ref + iy * stride + ix4 + 1));
// Filter even-index pixels
- __m128i tmp_0 = filter[(sx + 0 * alpha) >> WARPEDDIFF_PREC_BITS];
- __m128i tmp_2 = filter[(sx + 2 * alpha) >> WARPEDDIFF_PREC_BITS];
- __m128i tmp_4 = filter[(sx + 4 * alpha) >> WARPEDDIFF_PREC_BITS];
- __m128i tmp_6 = filter[(sx + 6 * alpha) >> WARPEDDIFF_PREC_BITS];
+ const __m128i tmp_0 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sx + 0 * alpha) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_2 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sx + 2 * alpha) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_4 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sx + 4 * alpha) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_6 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sx + 6 * alpha) >> WARPEDDIFF_PREC_BITS)));
// coeffs 0 1 0 1 2 3 2 3 for pixels 0, 2
- __m128i tmp_8 = _mm_unpacklo_epi32(tmp_0, tmp_2);
+ const __m128i tmp_8 = _mm_unpacklo_epi32(tmp_0, tmp_2);
// coeffs 0 1 0 1 2 3 2 3 for pixels 4, 6
- __m128i tmp_10 = _mm_unpacklo_epi32(tmp_4, tmp_6);
+ const __m128i tmp_10 = _mm_unpacklo_epi32(tmp_4, tmp_6);
// coeffs 4 5 4 5 6 7 6 7 for pixels 0, 2
- __m128i tmp_12 = _mm_unpackhi_epi32(tmp_0, tmp_2);
+ const __m128i tmp_12 = _mm_unpackhi_epi32(tmp_0, tmp_2);
// coeffs 4 5 4 5 6 7 6 7 for pixels 4, 6
- __m128i tmp_14 = _mm_unpackhi_epi32(tmp_4, tmp_6);
+ const __m128i tmp_14 = _mm_unpackhi_epi32(tmp_4, tmp_6);
// coeffs 0 1 0 1 0 1 0 1 for pixels 0, 2, 4, 6
- __m128i coeff_0 = _mm_unpacklo_epi64(tmp_8, tmp_10);
+ const __m128i coeff_0 = _mm_unpacklo_epi64(tmp_8, tmp_10);
// coeffs 2 3 2 3 2 3 2 3 for pixels 0, 2, 4, 6
- __m128i coeff_2 = _mm_unpackhi_epi64(tmp_8, tmp_10);
+ const __m128i coeff_2 = _mm_unpackhi_epi64(tmp_8, tmp_10);
// coeffs 4 5 4 5 4 5 4 5 for pixels 0, 2, 4, 6
- __m128i coeff_4 = _mm_unpacklo_epi64(tmp_12, tmp_14);
+ const __m128i coeff_4 = _mm_unpacklo_epi64(tmp_12, tmp_14);
// coeffs 6 7 6 7 6 7 6 7 for pixels 0, 2, 4, 6
- __m128i coeff_6 = _mm_unpackhi_epi64(tmp_12, tmp_14);
+ const __m128i coeff_6 = _mm_unpackhi_epi64(tmp_12, tmp_14);
- __m128i round_const =
- _mm_set1_epi32((1 << HORSHEAR_REDUCE_PREC_BITS) >> 1);
+ const __m128i round_const =
+ _mm_set1_epi32((1 << (bd + WARPEDPIXEL_FILTER_BITS - 1)) +
+ ((1 << HORSHEAR_REDUCE_PREC_BITS) >> 1));
// Calculate filtered results
- __m128i res_0 = _mm_madd_epi16(src, coeff_0);
- __m128i res_2 =
+ const __m128i res_0 = _mm_madd_epi16(src, coeff_0);
+ const __m128i res_2 =
_mm_madd_epi16(_mm_alignr_epi8(src2, src, 4), coeff_2);
- __m128i res_4 =
+ const __m128i res_4 =
_mm_madd_epi16(_mm_alignr_epi8(src2, src, 8), coeff_4);
- __m128i res_6 =
+ const __m128i res_6 =
_mm_madd_epi16(_mm_alignr_epi8(src2, src, 12), coeff_6);
__m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_4),
@@ -145,28 +172,36 @@ void av1_highbd_warp_affine_ssse3(int32_t *mat, uint16_t *ref, int width,
HORSHEAR_REDUCE_PREC_BITS);
// Filter odd-index pixels
- __m128i tmp_1 = filter[(sx + 1 * alpha) >> WARPEDDIFF_PREC_BITS];
- __m128i tmp_3 = filter[(sx + 3 * alpha) >> WARPEDDIFF_PREC_BITS];
- __m128i tmp_5 = filter[(sx + 5 * alpha) >> WARPEDDIFF_PREC_BITS];
- __m128i tmp_7 = filter[(sx + 7 * alpha) >> WARPEDDIFF_PREC_BITS];
-
- __m128i tmp_9 = _mm_unpacklo_epi32(tmp_1, tmp_3);
- __m128i tmp_11 = _mm_unpacklo_epi32(tmp_5, tmp_7);
- __m128i tmp_13 = _mm_unpackhi_epi32(tmp_1, tmp_3);
- __m128i tmp_15 = _mm_unpackhi_epi32(tmp_5, tmp_7);
-
- __m128i coeff_1 = _mm_unpacklo_epi64(tmp_9, tmp_11);
- __m128i coeff_3 = _mm_unpackhi_epi64(tmp_9, tmp_11);
- __m128i coeff_5 = _mm_unpacklo_epi64(tmp_13, tmp_15);
- __m128i coeff_7 = _mm_unpackhi_epi64(tmp_13, tmp_15);
-
- __m128i res_1 =
+ const __m128i tmp_1 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sx + 1 * alpha) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_3 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sx + 3 * alpha) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_5 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sx + 5 * alpha) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_7 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sx + 7 * alpha) >> WARPEDDIFF_PREC_BITS)));
+
+ const __m128i tmp_9 = _mm_unpacklo_epi32(tmp_1, tmp_3);
+ const __m128i tmp_11 = _mm_unpacklo_epi32(tmp_5, tmp_7);
+ const __m128i tmp_13 = _mm_unpackhi_epi32(tmp_1, tmp_3);
+ const __m128i tmp_15 = _mm_unpackhi_epi32(tmp_5, tmp_7);
+
+ const __m128i coeff_1 = _mm_unpacklo_epi64(tmp_9, tmp_11);
+ const __m128i coeff_3 = _mm_unpackhi_epi64(tmp_9, tmp_11);
+ const __m128i coeff_5 = _mm_unpacklo_epi64(tmp_13, tmp_15);
+ const __m128i coeff_7 = _mm_unpackhi_epi64(tmp_13, tmp_15);
+
+ const __m128i res_1 =
_mm_madd_epi16(_mm_alignr_epi8(src2, src, 2), coeff_1);
- __m128i res_3 =
+ const __m128i res_3 =
_mm_madd_epi16(_mm_alignr_epi8(src2, src, 6), coeff_3);
- __m128i res_5 =
+ const __m128i res_5 =
_mm_madd_epi16(_mm_alignr_epi8(src2, src, 10), coeff_5);
- __m128i res_7 =
+ const __m128i res_7 =
_mm_madd_epi16(_mm_alignr_epi8(src2, src, 14), coeff_7);
__m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_5),
@@ -183,101 +218,118 @@ void av1_highbd_warp_affine_ssse3(int32_t *mat, uint16_t *ref, int width,
// Vertical filter
for (k = -4; k < AOMMIN(4, p_height - i - 4); ++k) {
- int sy = sy4 + gamma * (-4) + delta * k +
- (1 << (WARPEDDIFF_PREC_BITS - 1)) +
- (WARPEDPIXEL_PREC_SHIFTS << WARPEDDIFF_PREC_BITS);
+ int sy = sy4 + delta * (k + 4);
// Load from tmp and rearrange pairs of consecutive rows into the
// column order 0 0 2 2 4 4 6 6; 1 1 3 3 5 5 7 7
- __m128i *src = tmp + (k + 4);
- __m128i src_0 = _mm_unpacklo_epi16(src[0], src[1]);
- __m128i src_2 = _mm_unpacklo_epi16(src[2], src[3]);
- __m128i src_4 = _mm_unpacklo_epi16(src[4], src[5]);
- __m128i src_6 = _mm_unpacklo_epi16(src[6], src[7]);
+ const __m128i *src = tmp + (k + 4);
+ const __m128i src_0 = _mm_unpacklo_epi16(src[0], src[1]);
+ const __m128i src_2 = _mm_unpacklo_epi16(src[2], src[3]);
+ const __m128i src_4 = _mm_unpacklo_epi16(src[4], src[5]);
+ const __m128i src_6 = _mm_unpacklo_epi16(src[6], src[7]);
// Filter even-index pixels
- __m128i tmp_0 = filter[(sy + 0 * gamma) >> WARPEDDIFF_PREC_BITS];
- __m128i tmp_2 = filter[(sy + 2 * gamma) >> WARPEDDIFF_PREC_BITS];
- __m128i tmp_4 = filter[(sy + 4 * gamma) >> WARPEDDIFF_PREC_BITS];
- __m128i tmp_6 = filter[(sy + 6 * gamma) >> WARPEDDIFF_PREC_BITS];
-
- __m128i tmp_8 = _mm_unpacklo_epi32(tmp_0, tmp_2);
- __m128i tmp_10 = _mm_unpacklo_epi32(tmp_4, tmp_6);
- __m128i tmp_12 = _mm_unpackhi_epi32(tmp_0, tmp_2);
- __m128i tmp_14 = _mm_unpackhi_epi32(tmp_4, tmp_6);
-
- __m128i coeff_0 = _mm_unpacklo_epi64(tmp_8, tmp_10);
- __m128i coeff_2 = _mm_unpackhi_epi64(tmp_8, tmp_10);
- __m128i coeff_4 = _mm_unpacklo_epi64(tmp_12, tmp_14);
- __m128i coeff_6 = _mm_unpackhi_epi64(tmp_12, tmp_14);
-
- __m128i res_0 = _mm_madd_epi16(src_0, coeff_0);
- __m128i res_2 = _mm_madd_epi16(src_2, coeff_2);
- __m128i res_4 = _mm_madd_epi16(src_4, coeff_4);
- __m128i res_6 = _mm_madd_epi16(src_6, coeff_6);
-
- __m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_2),
- _mm_add_epi32(res_4, res_6));
+ const __m128i tmp_0 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 0 * gamma) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_2 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 2 * gamma) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_4 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 4 * gamma) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_6 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 6 * gamma) >> WARPEDDIFF_PREC_BITS)));
+
+ const __m128i tmp_8 = _mm_unpacklo_epi32(tmp_0, tmp_2);
+ const __m128i tmp_10 = _mm_unpacklo_epi32(tmp_4, tmp_6);
+ const __m128i tmp_12 = _mm_unpackhi_epi32(tmp_0, tmp_2);
+ const __m128i tmp_14 = _mm_unpackhi_epi32(tmp_4, tmp_6);
+
+ const __m128i coeff_0 = _mm_unpacklo_epi64(tmp_8, tmp_10);
+ const __m128i coeff_2 = _mm_unpackhi_epi64(tmp_8, tmp_10);
+ const __m128i coeff_4 = _mm_unpacklo_epi64(tmp_12, tmp_14);
+ const __m128i coeff_6 = _mm_unpackhi_epi64(tmp_12, tmp_14);
+
+ const __m128i res_0 = _mm_madd_epi16(src_0, coeff_0);
+ const __m128i res_2 = _mm_madd_epi16(src_2, coeff_2);
+ const __m128i res_4 = _mm_madd_epi16(src_4, coeff_4);
+ const __m128i res_6 = _mm_madd_epi16(src_6, coeff_6);
+
+ const __m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_2),
+ _mm_add_epi32(res_4, res_6));
// Filter odd-index pixels
- __m128i src_1 = _mm_unpackhi_epi16(src[0], src[1]);
- __m128i src_3 = _mm_unpackhi_epi16(src[2], src[3]);
- __m128i src_5 = _mm_unpackhi_epi16(src[4], src[5]);
- __m128i src_7 = _mm_unpackhi_epi16(src[6], src[7]);
-
- __m128i tmp_1 = filter[(sy + 1 * gamma) >> WARPEDDIFF_PREC_BITS];
- __m128i tmp_3 = filter[(sy + 3 * gamma) >> WARPEDDIFF_PREC_BITS];
- __m128i tmp_5 = filter[(sy + 5 * gamma) >> WARPEDDIFF_PREC_BITS];
- __m128i tmp_7 = filter[(sy + 7 * gamma) >> WARPEDDIFF_PREC_BITS];
-
- __m128i tmp_9 = _mm_unpacklo_epi32(tmp_1, tmp_3);
- __m128i tmp_11 = _mm_unpacklo_epi32(tmp_5, tmp_7);
- __m128i tmp_13 = _mm_unpackhi_epi32(tmp_1, tmp_3);
- __m128i tmp_15 = _mm_unpackhi_epi32(tmp_5, tmp_7);
-
- __m128i coeff_1 = _mm_unpacklo_epi64(tmp_9, tmp_11);
- __m128i coeff_3 = _mm_unpackhi_epi64(tmp_9, tmp_11);
- __m128i coeff_5 = _mm_unpacklo_epi64(tmp_13, tmp_15);
- __m128i coeff_7 = _mm_unpackhi_epi64(tmp_13, tmp_15);
-
- __m128i res_1 = _mm_madd_epi16(src_1, coeff_1);
- __m128i res_3 = _mm_madd_epi16(src_3, coeff_3);
- __m128i res_5 = _mm_madd_epi16(src_5, coeff_5);
- __m128i res_7 = _mm_madd_epi16(src_7, coeff_7);
-
- __m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_3),
- _mm_add_epi32(res_5, res_7));
+ const __m128i src_1 = _mm_unpackhi_epi16(src[0], src[1]);
+ const __m128i src_3 = _mm_unpackhi_epi16(src[2], src[3]);
+ const __m128i src_5 = _mm_unpackhi_epi16(src[4], src[5]);
+ const __m128i src_7 = _mm_unpackhi_epi16(src[6], src[7]);
+
+ const __m128i tmp_1 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 1 * gamma) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_3 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 3 * gamma) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_5 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 5 * gamma) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_7 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 7 * gamma) >> WARPEDDIFF_PREC_BITS)));
+
+ const __m128i tmp_9 = _mm_unpacklo_epi32(tmp_1, tmp_3);
+ const __m128i tmp_11 = _mm_unpacklo_epi32(tmp_5, tmp_7);
+ const __m128i tmp_13 = _mm_unpackhi_epi32(tmp_1, tmp_3);
+ const __m128i tmp_15 = _mm_unpackhi_epi32(tmp_5, tmp_7);
+
+ const __m128i coeff_1 = _mm_unpacklo_epi64(tmp_9, tmp_11);
+ const __m128i coeff_3 = _mm_unpackhi_epi64(tmp_9, tmp_11);
+ const __m128i coeff_5 = _mm_unpacklo_epi64(tmp_13, tmp_15);
+ const __m128i coeff_7 = _mm_unpackhi_epi64(tmp_13, tmp_15);
+
+ const __m128i res_1 = _mm_madd_epi16(src_1, coeff_1);
+ const __m128i res_3 = _mm_madd_epi16(src_3, coeff_3);
+ const __m128i res_5 = _mm_madd_epi16(src_5, coeff_5);
+ const __m128i res_7 = _mm_madd_epi16(src_7, coeff_7);
+
+ const __m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_3),
+ _mm_add_epi32(res_5, res_7));
// Rearrange pixels back into the order 0 ... 7
- __m128i res_lo = _mm_unpacklo_epi32(res_even, res_odd);
- __m128i res_hi = _mm_unpackhi_epi32(res_even, res_odd);
+ const __m128i res_lo = _mm_unpacklo_epi32(res_even, res_odd);
+ const __m128i res_hi = _mm_unpackhi_epi32(res_even, res_odd);
// Round and pack into 8 bits
- __m128i round_const =
- _mm_set1_epi32((1 << VERSHEAR_REDUCE_PREC_BITS) >> 1);
+ const __m128i round_const =
+ _mm_set1_epi32(-(1 << (bd + VERSHEAR_REDUCE_PREC_BITS - 1)) +
+ ((1 << VERSHEAR_REDUCE_PREC_BITS) >> 1));
- __m128i res_lo_round = _mm_srai_epi32(
+ const __m128i res_lo_round = _mm_srai_epi32(
_mm_add_epi32(res_lo, round_const), VERSHEAR_REDUCE_PREC_BITS);
- __m128i res_hi_round = _mm_srai_epi32(
+ const __m128i res_hi_round = _mm_srai_epi32(
_mm_add_epi32(res_hi, round_const), VERSHEAR_REDUCE_PREC_BITS);
__m128i res_16bit = _mm_packs_epi32(res_lo_round, res_hi_round);
// Clamp res_16bit to the range [0, 2^bd - 1]
- __m128i max_val = _mm_set1_epi16((1 << bd) - 1);
- __m128i zero = _mm_setzero_si128();
+ const __m128i max_val = _mm_set1_epi16((1 << bd) - 1);
+ const __m128i zero = _mm_setzero_si128();
res_16bit = _mm_max_epi16(_mm_min_epi16(res_16bit, max_val), zero);
// Store, blending with 'pred' if needed
- __m128i *p = (__m128i *)&pred[(i + k + 4) * p_stride + j];
+ __m128i *const p = (__m128i *)&pred[(i + k + 4) * p_stride + j];
// Note: If we're outputting a 4x4 block, we need to be very careful
// to only output 4 pixels at this point, to avoid encode/decode
// mismatches when encoding with multiple threads.
if (p_width == 4) {
- if (ref_frm) res_16bit = _mm_avg_epu16(res_16bit, _mm_loadl_epi64(p));
+ if (comp_avg)
+ res_16bit = _mm_avg_epu16(res_16bit, _mm_loadl_epi64(p));
_mm_storel_epi64(p, res_16bit);
} else {
- if (ref_frm) res_16bit = _mm_avg_epu16(res_16bit, _mm_loadu_si128(p));
+ if (comp_avg)
+ res_16bit = _mm_avg_epu16(res_16bit, _mm_loadu_si128(p));
_mm_storeu_si128(p, res_16bit);
}
}
diff --git a/third_party/aom/av1/common/x86/hybrid_inv_txfm_avx2.c b/third_party/aom/av1/common/x86/hybrid_inv_txfm_avx2.c
index efc8d1e24..c69614e42 100644
--- a/third_party/aom/av1/common/x86/hybrid_inv_txfm_avx2.c
+++ b/third_party/aom/av1/common/x86/hybrid_inv_txfm_avx2.c
@@ -14,67 +14,9 @@
#include "./aom_config.h"
#include "./av1_rtcd.h"
-#include "aom_dsp/x86/txfm_common_avx2.h"
-
-static INLINE void load_coeff(const tran_low_t *coeff, __m256i *in) {
-#if CONFIG_HIGHBITDEPTH
- *in = _mm256_setr_epi16(
- (int16_t)coeff[0], (int16_t)coeff[1], (int16_t)coeff[2],
- (int16_t)coeff[3], (int16_t)coeff[4], (int16_t)coeff[5],
- (int16_t)coeff[6], (int16_t)coeff[7], (int16_t)coeff[8],
- (int16_t)coeff[9], (int16_t)coeff[10], (int16_t)coeff[11],
- (int16_t)coeff[12], (int16_t)coeff[13], (int16_t)coeff[14],
- (int16_t)coeff[15]);
-#else
- *in = _mm256_loadu_si256((const __m256i *)coeff);
-#endif
-}
-
-static void load_buffer_16x16(const tran_low_t *coeff, __m256i *in) {
- int i = 0;
- while (i < 16) {
- load_coeff(coeff + (i << 4), &in[i]);
- i += 1;
- }
-}
-
-static void recon_and_store(const __m256i *res, uint8_t *output) {
- const __m128i zero = _mm_setzero_si128();
- __m128i x = _mm_loadu_si128((__m128i const *)output);
- __m128i p0 = _mm_unpacklo_epi8(x, zero);
- __m128i p1 = _mm_unpackhi_epi8(x, zero);
-
- p0 = _mm_add_epi16(p0, _mm256_castsi256_si128(*res));
- p1 = _mm_add_epi16(p1, _mm256_extractf128_si256(*res, 1));
- x = _mm_packus_epi16(p0, p1);
- _mm_storeu_si128((__m128i *)output, x);
-}
-
-#define IDCT_ROUNDING_POS (6)
-
-static void write_buffer_16x16(__m256i *in, const int stride, uint8_t *output) {
- const __m256i rounding = _mm256_set1_epi16(1 << (IDCT_ROUNDING_POS - 1));
- int i = 0;
-
- while (i < 16) {
- in[i] = _mm256_add_epi16(in[i], rounding);
- in[i] = _mm256_srai_epi16(in[i], IDCT_ROUNDING_POS);
- recon_and_store(&in[i], output + i * stride);
- i += 1;
- }
-}
-
-static INLINE void unpack_butter_fly(const __m256i *a0, const __m256i *a1,
- const __m256i *c0, const __m256i *c1,
- __m256i *b0, __m256i *b1) {
- __m256i x0, x1;
- x0 = _mm256_unpacklo_epi16(*a0, *a1);
- x1 = _mm256_unpackhi_epi16(*a0, *a1);
- *b0 = butter_fly(x0, x1, *c0);
- *b1 = butter_fly(x0, x1, *c1);
-}
+#include "aom_dsp/x86/inv_txfm_common_avx2.h"
-static void idct16_avx2(__m256i *in) {
+void av1_idct16_avx2(__m256i *in) {
const __m256i cospi_p30_m02 = pair256_set_epi16(cospi_30_64, -cospi_2_64);
const __m256i cospi_p02_p30 = pair256_set_epi16(cospi_2_64, cospi_30_64);
const __m256i cospi_p14_m18 = pair256_set_epi16(cospi_14_64, -cospi_18_64);
@@ -216,8 +158,8 @@ static void idct16_avx2(__m256i *in) {
}
static void idct16(__m256i *in) {
- mm256_transpose_16x16(in);
- idct16_avx2(in);
+ mm256_transpose_16x16(in, in);
+ av1_idct16_avx2(in);
}
static INLINE void butterfly_32b(const __m256i *a0, const __m256i *a1,
@@ -398,7 +340,7 @@ static void iadst16_avx2(__m256i *in) {
}
static void iadst16(__m256i *in) {
- mm256_transpose_16x16(in);
+ mm256_transpose_16x16(in, in);
iadst16_avx2(in);
}
@@ -416,8 +358,8 @@ static void flip_col(uint8_t **dest, int *stride, int rows) {
}
static void iidtx16(__m256i *in) {
- mm256_transpose_16x16(in);
- txfm_scaling16_avx2(Sqrt2, in);
+ mm256_transpose_16x16(in, in);
+ txfm_scaling16_avx2((int16_t)Sqrt2, in);
}
#endif
@@ -503,5 +445,5 @@ void av1_iht16x16_256_add_avx2(const tran_low_t *input, uint8_t *dest,
#endif // CONFIG_EXT_TX
default: assert(0); break;
}
- write_buffer_16x16(in, stride, dest);
+ store_buffer_16xN(in, stride, dest, 16);
}
diff --git a/third_party/aom/av1/common/x86/idct_intrin_sse2.c b/third_party/aom/av1/common/x86/idct_intrin_sse2.c
index 522e8988c..d6a598746 100644
--- a/third_party/aom/av1/common/x86/idct_intrin_sse2.c
+++ b/third_party/aom/av1/common/x86/idct_intrin_sse2.c
@@ -17,14 +17,14 @@
#include "av1/common/enums.h"
#if CONFIG_EXT_TX
-static INLINE void fliplr_4x4(__m128i in[2]) {
+static INLINE void fliplr_4x4(__m128i *in /*in[2]*/) {
in[0] = _mm_shufflelo_epi16(in[0], 0x1b);
in[0] = _mm_shufflehi_epi16(in[0], 0x1b);
in[1] = _mm_shufflelo_epi16(in[1], 0x1b);
in[1] = _mm_shufflehi_epi16(in[1], 0x1b);
}
-static INLINE void fliplr_8x8(__m128i in[8]) {
+static INLINE void fliplr_8x8(__m128i *in /*in[8]*/) {
in[0] = mm_reverse_epi16(in[0]);
in[1] = mm_reverse_epi16(in[1]);
in[2] = mm_reverse_epi16(in[2]);
@@ -36,7 +36,7 @@ static INLINE void fliplr_8x8(__m128i in[8]) {
in[7] = mm_reverse_epi16(in[7]);
}
-static INLINE void fliplr_16x8(__m128i in[16]) {
+static INLINE void fliplr_16x8(__m128i *in /*in[16]*/) {
fliplr_8x8(&in[0]);
fliplr_8x8(&in[8]);
}
@@ -356,7 +356,7 @@ static void iidtx8_sse2(__m128i *in) {
}
static INLINE void iidtx4_sse2(__m128i *in) {
- const __m128i v_scale_w = _mm_set1_epi16(Sqrt2);
+ const __m128i v_scale_w = _mm_set1_epi16((int16_t)Sqrt2);
const __m128i v_p0l_w = _mm_mullo_epi16(in[0], v_scale_w);
const __m128i v_p0h_w = _mm_mulhi_epi16(in[0], v_scale_w);
diff --git a/third_party/aom/av1/common/x86/warp_plane_sse2.c b/third_party/aom/av1/common/x86/warp_plane_sse2.c
index 925e4650d..cdc4e8d0f 100644
--- a/third_party/aom/av1/common/x86/warp_plane_sse2.c
+++ b/third_party/aom/av1/common/x86/warp_plane_sse2.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved
+ * Copyright (c) 2017, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@@ -14,17 +14,15 @@
#include "./av1_rtcd.h"
#include "av1/common/warped_motion.h"
-static const __m128i *const filter = (const __m128i *const)warped_filter;
-
-/* SSE2 version of the rotzoom/affine warp filter */
-void av1_warp_affine_sse2(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,
+void av1_warp_affine_sse2(const int32_t *mat, const uint8_t *ref, int width,
+ int height, int stride, uint8_t *pred, int p_col,
+ int p_row, int p_width, int p_height, int p_stride,
+ int subsampling_x, int subsampling_y, int comp_avg,
int16_t alpha, int16_t beta, int16_t gamma,
int16_t delta) {
__m128i tmp[15];
int i, j, k;
+ const int bd = 8;
/* Note: For this code to work, the left/right frame borders need to be
extended by at least 13 pixels each. By the time we get here, other
@@ -42,23 +40,21 @@ void av1_warp_affine_sse2(int32_t *mat, uint8_t *ref, int width, int height,
for (j = 0; j < p_width; j += 8) {
// (x, y) coordinates of the center of this block in the destination
// image
- int32_t dst_x = p_col + j + 4;
- int32_t dst_y = p_row + i + 4;
+ const int32_t dst_x = p_col + j + 4;
+ const int32_t dst_y = p_row + i + 4;
int32_t x4, y4, ix4, sx4, iy4, sy4;
if (subsampling_x)
- x4 = ROUND_POWER_OF_TWO_SIGNED(
- mat[2] * 2 * dst_x + mat[3] * 2 * dst_y + mat[0] +
- (mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS)) / 2,
- 1);
+ x4 = (mat[2] * 4 * dst_x + mat[3] * 4 * dst_y + mat[0] * 2 +
+ (mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS))) /
+ 4;
else
x4 = mat[2] * dst_x + mat[3] * dst_y + mat[0];
if (subsampling_y)
- y4 = ROUND_POWER_OF_TWO_SIGNED(
- mat[4] * 2 * dst_x + mat[5] * 2 * dst_y + mat[1] +
- (mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS)) / 2,
- 1);
+ y4 = (mat[4] * 4 * dst_x + mat[5] * 4 * dst_y + mat[1] * 2 +
+ (mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS))) /
+ 4;
else
y4 = mat[4] * dst_x + mat[5] * dst_y + mat[1];
@@ -67,76 +63,104 @@ void av1_warp_affine_sse2(int32_t *mat, uint8_t *ref, int width, int height,
iy4 = y4 >> WARPEDMODEL_PREC_BITS;
sy4 = y4 & ((1 << WARPEDMODEL_PREC_BITS) - 1);
+ // Add in all the constant terms, including rounding and offset
+ sx4 += alpha * (-4) + beta * (-4) + (1 << (WARPEDDIFF_PREC_BITS - 1)) +
+ (WARPEDPIXEL_PREC_SHIFTS << WARPEDDIFF_PREC_BITS);
+ sy4 += gamma * (-4) + delta * (-4) + (1 << (WARPEDDIFF_PREC_BITS - 1)) +
+ (WARPEDPIXEL_PREC_SHIFTS << WARPEDDIFF_PREC_BITS);
+
+ sx4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1);
+ sy4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1);
+
// Horizontal filter
- for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
- int iy = iy4 + k;
- if (iy < 0)
- iy = 0;
- else if (iy > height - 1)
- iy = height - 1;
-
- // If the block is aligned such that, after clamping, every sample
- // would be taken from the leftmost/rightmost column, then we can
- // skip the expensive horizontal filter.
- if (ix4 <= -7) {
+ // If the block is aligned such that, after clamping, every sample
+ // would be taken from the leftmost/rightmost column, then we can
+ // skip the expensive horizontal filter.
+ if (ix4 <= -7) {
+ for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
+ int iy = iy4 + k;
+ if (iy < 0)
+ iy = 0;
+ else if (iy > height - 1)
+ iy = height - 1;
tmp[k + 7] = _mm_set1_epi16(
+ (1 << (bd + WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS -
+ 1)) +
ref[iy * stride] *
- (1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)));
- } else if (ix4 >= width + 6) {
+ (1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)));
+ }
+ } else if (ix4 >= width + 6) {
+ for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
+ int iy = iy4 + k;
+ if (iy < 0)
+ iy = 0;
+ else if (iy > height - 1)
+ iy = height - 1;
tmp[k + 7] = _mm_set1_epi16(
+ (1 << (bd + WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS -
+ 1)) +
ref[iy * stride + (width - 1)] *
- (1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)));
- } else {
- int sx = sx4 + alpha * (-4) + beta * k +
- // Include rounding and offset here
- (1 << (WARPEDDIFF_PREC_BITS - 1)) +
- (WARPEDPIXEL_PREC_SHIFTS << WARPEDDIFF_PREC_BITS);
+ (1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)));
+ }
+ } else {
+ for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
+ int iy = iy4 + k;
+ if (iy < 0)
+ iy = 0;
+ else if (iy > height - 1)
+ iy = height - 1;
+ int sx = sx4 + beta * (k + 4);
// Load source pixels
- __m128i zero = _mm_setzero_si128();
- __m128i src =
+ const __m128i zero = _mm_setzero_si128();
+ const __m128i src =
_mm_loadu_si128((__m128i *)(ref + iy * stride + ix4 - 7));
// Filter even-index pixels
- __m128i tmp_0 = _mm_loadu_si128(
- (__m128i *)(filter + ((sx + 0 * alpha) >> WARPEDDIFF_PREC_BITS)));
- __m128i tmp_2 = _mm_loadu_si128(
- (__m128i *)(filter + ((sx + 2 * alpha) >> WARPEDDIFF_PREC_BITS)));
- __m128i tmp_4 = _mm_loadu_si128(
- (__m128i *)(filter + ((sx + 4 * alpha) >> WARPEDDIFF_PREC_BITS)));
- __m128i tmp_6 = _mm_loadu_si128(
- (__m128i *)(filter + ((sx + 6 * alpha) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_0 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sx + 0 * alpha) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_2 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sx + 2 * alpha) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_4 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sx + 4 * alpha) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_6 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sx + 6 * alpha) >> WARPEDDIFF_PREC_BITS)));
// coeffs 0 1 0 1 2 3 2 3 for pixels 0, 2
- __m128i tmp_8 = _mm_unpacklo_epi32(tmp_0, tmp_2);
+ const __m128i tmp_8 = _mm_unpacklo_epi32(tmp_0, tmp_2);
// coeffs 0 1 0 1 2 3 2 3 for pixels 4, 6
- __m128i tmp_10 = _mm_unpacklo_epi32(tmp_4, tmp_6);
+ const __m128i tmp_10 = _mm_unpacklo_epi32(tmp_4, tmp_6);
// coeffs 4 5 4 5 6 7 6 7 for pixels 0, 2
- __m128i tmp_12 = _mm_unpackhi_epi32(tmp_0, tmp_2);
+ const __m128i tmp_12 = _mm_unpackhi_epi32(tmp_0, tmp_2);
// coeffs 4 5 4 5 6 7 6 7 for pixels 4, 6
- __m128i tmp_14 = _mm_unpackhi_epi32(tmp_4, tmp_6);
+ const __m128i tmp_14 = _mm_unpackhi_epi32(tmp_4, tmp_6);
// coeffs 0 1 0 1 0 1 0 1 for pixels 0, 2, 4, 6
- __m128i coeff_0 = _mm_unpacklo_epi64(tmp_8, tmp_10);
+ const __m128i coeff_0 = _mm_unpacklo_epi64(tmp_8, tmp_10);
// coeffs 2 3 2 3 2 3 2 3 for pixels 0, 2, 4, 6
- __m128i coeff_2 = _mm_unpackhi_epi64(tmp_8, tmp_10);
+ const __m128i coeff_2 = _mm_unpackhi_epi64(tmp_8, tmp_10);
// coeffs 4 5 4 5 4 5 4 5 for pixels 0, 2, 4, 6
- __m128i coeff_4 = _mm_unpacklo_epi64(tmp_12, tmp_14);
+ const __m128i coeff_4 = _mm_unpacklo_epi64(tmp_12, tmp_14);
// coeffs 6 7 6 7 6 7 6 7 for pixels 0, 2, 4, 6
- __m128i coeff_6 = _mm_unpackhi_epi64(tmp_12, tmp_14);
+ const __m128i coeff_6 = _mm_unpackhi_epi64(tmp_12, tmp_14);
- __m128i round_const =
- _mm_set1_epi32((1 << HORSHEAR_REDUCE_PREC_BITS) >> 1);
+ const __m128i round_const =
+ _mm_set1_epi32((1 << (bd + WARPEDPIXEL_FILTER_BITS - 1)) +
+ ((1 << HORSHEAR_REDUCE_PREC_BITS) >> 1));
// Calculate filtered results
- __m128i src_0 = _mm_unpacklo_epi8(src, zero);
- __m128i res_0 = _mm_madd_epi16(src_0, coeff_0);
- __m128i src_2 = _mm_unpacklo_epi8(_mm_srli_si128(src, 2), zero);
- __m128i res_2 = _mm_madd_epi16(src_2, coeff_2);
- __m128i src_4 = _mm_unpacklo_epi8(_mm_srli_si128(src, 4), zero);
- __m128i res_4 = _mm_madd_epi16(src_4, coeff_4);
- __m128i src_6 = _mm_unpacklo_epi8(_mm_srli_si128(src, 6), zero);
- __m128i res_6 = _mm_madd_epi16(src_6, coeff_6);
+ const __m128i src_0 = _mm_unpacklo_epi8(src, zero);
+ const __m128i res_0 = _mm_madd_epi16(src_0, coeff_0);
+ const __m128i src_2 = _mm_unpacklo_epi8(_mm_srli_si128(src, 2), zero);
+ const __m128i res_2 = _mm_madd_epi16(src_2, coeff_2);
+ const __m128i src_4 = _mm_unpacklo_epi8(_mm_srli_si128(src, 4), zero);
+ const __m128i res_4 = _mm_madd_epi16(src_4, coeff_4);
+ const __m128i src_6 = _mm_unpacklo_epi8(_mm_srli_si128(src, 6), zero);
+ const __m128i res_6 = _mm_madd_epi16(src_6, coeff_6);
__m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_4),
_mm_add_epi32(res_2, res_6));
@@ -144,33 +168,37 @@ void av1_warp_affine_sse2(int32_t *mat, uint8_t *ref, int width, int height,
HORSHEAR_REDUCE_PREC_BITS);
// Filter odd-index pixels
- __m128i tmp_1 = _mm_loadu_si128(
- (__m128i *)(filter + ((sx + 1 * alpha) >> WARPEDDIFF_PREC_BITS)));
- __m128i tmp_3 = _mm_loadu_si128(
- (__m128i *)(filter + ((sx + 3 * alpha) >> WARPEDDIFF_PREC_BITS)));
- __m128i tmp_5 = _mm_loadu_si128(
- (__m128i *)(filter + ((sx + 5 * alpha) >> WARPEDDIFF_PREC_BITS)));
- __m128i tmp_7 = _mm_loadu_si128(
- (__m128i *)(filter + ((sx + 7 * alpha) >> WARPEDDIFF_PREC_BITS)));
-
- __m128i tmp_9 = _mm_unpacklo_epi32(tmp_1, tmp_3);
- __m128i tmp_11 = _mm_unpacklo_epi32(tmp_5, tmp_7);
- __m128i tmp_13 = _mm_unpackhi_epi32(tmp_1, tmp_3);
- __m128i tmp_15 = _mm_unpackhi_epi32(tmp_5, tmp_7);
-
- __m128i coeff_1 = _mm_unpacklo_epi64(tmp_9, tmp_11);
- __m128i coeff_3 = _mm_unpackhi_epi64(tmp_9, tmp_11);
- __m128i coeff_5 = _mm_unpacklo_epi64(tmp_13, tmp_15);
- __m128i coeff_7 = _mm_unpackhi_epi64(tmp_13, tmp_15);
-
- __m128i src_1 = _mm_unpacklo_epi8(_mm_srli_si128(src, 1), zero);
- __m128i res_1 = _mm_madd_epi16(src_1, coeff_1);
- __m128i src_3 = _mm_unpacklo_epi8(_mm_srli_si128(src, 3), zero);
- __m128i res_3 = _mm_madd_epi16(src_3, coeff_3);
- __m128i src_5 = _mm_unpacklo_epi8(_mm_srli_si128(src, 5), zero);
- __m128i res_5 = _mm_madd_epi16(src_5, coeff_5);
- __m128i src_7 = _mm_unpacklo_epi8(_mm_srli_si128(src, 7), zero);
- __m128i res_7 = _mm_madd_epi16(src_7, coeff_7);
+ const __m128i tmp_1 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sx + 1 * alpha) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_3 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sx + 3 * alpha) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_5 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sx + 5 * alpha) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_7 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sx + 7 * alpha) >> WARPEDDIFF_PREC_BITS)));
+
+ const __m128i tmp_9 = _mm_unpacklo_epi32(tmp_1, tmp_3);
+ const __m128i tmp_11 = _mm_unpacklo_epi32(tmp_5, tmp_7);
+ const __m128i tmp_13 = _mm_unpackhi_epi32(tmp_1, tmp_3);
+ const __m128i tmp_15 = _mm_unpackhi_epi32(tmp_5, tmp_7);
+
+ const __m128i coeff_1 = _mm_unpacklo_epi64(tmp_9, tmp_11);
+ const __m128i coeff_3 = _mm_unpackhi_epi64(tmp_9, tmp_11);
+ const __m128i coeff_5 = _mm_unpacklo_epi64(tmp_13, tmp_15);
+ const __m128i coeff_7 = _mm_unpackhi_epi64(tmp_13, tmp_15);
+
+ const __m128i src_1 = _mm_unpacklo_epi8(_mm_srli_si128(src, 1), zero);
+ const __m128i res_1 = _mm_madd_epi16(src_1, coeff_1);
+ const __m128i src_3 = _mm_unpacklo_epi8(_mm_srli_si128(src, 3), zero);
+ const __m128i res_3 = _mm_madd_epi16(src_3, coeff_3);
+ const __m128i src_5 = _mm_unpacklo_epi8(_mm_srli_si128(src, 5), zero);
+ const __m128i res_5 = _mm_madd_epi16(src_5, coeff_5);
+ const __m128i src_7 = _mm_unpacklo_epi8(_mm_srli_si128(src, 7), zero);
+ const __m128i res_7 = _mm_madd_epi16(src_7, coeff_7);
__m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_5),
_mm_add_epi32(res_3, res_7));
@@ -186,109 +214,116 @@ void av1_warp_affine_sse2(int32_t *mat, uint8_t *ref, int width, int height,
// Vertical filter
for (k = -4; k < AOMMIN(4, p_height - i - 4); ++k) {
- int sy = sy4 + gamma * (-4) + delta * k +
- (1 << (WARPEDDIFF_PREC_BITS - 1)) +
- (WARPEDPIXEL_PREC_SHIFTS << WARPEDDIFF_PREC_BITS);
+ int sy = sy4 + delta * (k + 4);
// Load from tmp and rearrange pairs of consecutive rows into the
// column order 0 0 2 2 4 4 6 6; 1 1 3 3 5 5 7 7
- __m128i *src = tmp + (k + 4);
- __m128i src_0 = _mm_unpacklo_epi16(src[0], src[1]);
- __m128i src_2 = _mm_unpacklo_epi16(src[2], src[3]);
- __m128i src_4 = _mm_unpacklo_epi16(src[4], src[5]);
- __m128i src_6 = _mm_unpacklo_epi16(src[6], src[7]);
+ const __m128i *src = tmp + (k + 4);
+ const __m128i src_0 = _mm_unpacklo_epi16(src[0], src[1]);
+ const __m128i src_2 = _mm_unpacklo_epi16(src[2], src[3]);
+ const __m128i src_4 = _mm_unpacklo_epi16(src[4], src[5]);
+ const __m128i src_6 = _mm_unpacklo_epi16(src[6], src[7]);
// Filter even-index pixels
- __m128i tmp_0 = _mm_loadu_si128(
- (__m128i *)(filter + ((sy + 0 * gamma) >> WARPEDDIFF_PREC_BITS)));
- __m128i tmp_2 = _mm_loadu_si128(
- (__m128i *)(filter + ((sy + 2 * gamma) >> WARPEDDIFF_PREC_BITS)));
- __m128i tmp_4 = _mm_loadu_si128(
- (__m128i *)(filter + ((sy + 4 * gamma) >> WARPEDDIFF_PREC_BITS)));
- __m128i tmp_6 = _mm_loadu_si128(
- (__m128i *)(filter + ((sy + 6 * gamma) >> WARPEDDIFF_PREC_BITS)));
-
- __m128i tmp_8 = _mm_unpacklo_epi32(tmp_0, tmp_2);
- __m128i tmp_10 = _mm_unpacklo_epi32(tmp_4, tmp_6);
- __m128i tmp_12 = _mm_unpackhi_epi32(tmp_0, tmp_2);
- __m128i tmp_14 = _mm_unpackhi_epi32(tmp_4, tmp_6);
-
- __m128i coeff_0 = _mm_unpacklo_epi64(tmp_8, tmp_10);
- __m128i coeff_2 = _mm_unpackhi_epi64(tmp_8, tmp_10);
- __m128i coeff_4 = _mm_unpacklo_epi64(tmp_12, tmp_14);
- __m128i coeff_6 = _mm_unpackhi_epi64(tmp_12, tmp_14);
-
- __m128i res_0 = _mm_madd_epi16(src_0, coeff_0);
- __m128i res_2 = _mm_madd_epi16(src_2, coeff_2);
- __m128i res_4 = _mm_madd_epi16(src_4, coeff_4);
- __m128i res_6 = _mm_madd_epi16(src_6, coeff_6);
-
- __m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_2),
- _mm_add_epi32(res_4, res_6));
+ const __m128i tmp_0 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 0 * gamma) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_2 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 2 * gamma) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_4 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 4 * gamma) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_6 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 6 * gamma) >> WARPEDDIFF_PREC_BITS)));
+
+ const __m128i tmp_8 = _mm_unpacklo_epi32(tmp_0, tmp_2);
+ const __m128i tmp_10 = _mm_unpacklo_epi32(tmp_4, tmp_6);
+ const __m128i tmp_12 = _mm_unpackhi_epi32(tmp_0, tmp_2);
+ const __m128i tmp_14 = _mm_unpackhi_epi32(tmp_4, tmp_6);
+
+ const __m128i coeff_0 = _mm_unpacklo_epi64(tmp_8, tmp_10);
+ const __m128i coeff_2 = _mm_unpackhi_epi64(tmp_8, tmp_10);
+ const __m128i coeff_4 = _mm_unpacklo_epi64(tmp_12, tmp_14);
+ const __m128i coeff_6 = _mm_unpackhi_epi64(tmp_12, tmp_14);
+
+ const __m128i res_0 = _mm_madd_epi16(src_0, coeff_0);
+ const __m128i res_2 = _mm_madd_epi16(src_2, coeff_2);
+ const __m128i res_4 = _mm_madd_epi16(src_4, coeff_4);
+ const __m128i res_6 = _mm_madd_epi16(src_6, coeff_6);
+
+ const __m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_2),
+ _mm_add_epi32(res_4, res_6));
// Filter odd-index pixels
- __m128i src_1 = _mm_unpackhi_epi16(src[0], src[1]);
- __m128i src_3 = _mm_unpackhi_epi16(src[2], src[3]);
- __m128i src_5 = _mm_unpackhi_epi16(src[4], src[5]);
- __m128i src_7 = _mm_unpackhi_epi16(src[6], src[7]);
-
- __m128i tmp_1 = _mm_loadu_si128(
- (__m128i *)(filter + ((sy + 1 * gamma) >> WARPEDDIFF_PREC_BITS)));
- __m128i tmp_3 = _mm_loadu_si128(
- (__m128i *)(filter + ((sy + 3 * gamma) >> WARPEDDIFF_PREC_BITS)));
- __m128i tmp_5 = _mm_loadu_si128(
- (__m128i *)(filter + ((sy + 5 * gamma) >> WARPEDDIFF_PREC_BITS)));
- __m128i tmp_7 = _mm_loadu_si128(
- (__m128i *)(filter + ((sy + 7 * gamma) >> WARPEDDIFF_PREC_BITS)));
-
- __m128i tmp_9 = _mm_unpacklo_epi32(tmp_1, tmp_3);
- __m128i tmp_11 = _mm_unpacklo_epi32(tmp_5, tmp_7);
- __m128i tmp_13 = _mm_unpackhi_epi32(tmp_1, tmp_3);
- __m128i tmp_15 = _mm_unpackhi_epi32(tmp_5, tmp_7);
-
- __m128i coeff_1 = _mm_unpacklo_epi64(tmp_9, tmp_11);
- __m128i coeff_3 = _mm_unpackhi_epi64(tmp_9, tmp_11);
- __m128i coeff_5 = _mm_unpacklo_epi64(tmp_13, tmp_15);
- __m128i coeff_7 = _mm_unpackhi_epi64(tmp_13, tmp_15);
-
- __m128i res_1 = _mm_madd_epi16(src_1, coeff_1);
- __m128i res_3 = _mm_madd_epi16(src_3, coeff_3);
- __m128i res_5 = _mm_madd_epi16(src_5, coeff_5);
- __m128i res_7 = _mm_madd_epi16(src_7, coeff_7);
-
- __m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_3),
- _mm_add_epi32(res_5, res_7));
+ const __m128i src_1 = _mm_unpackhi_epi16(src[0], src[1]);
+ const __m128i src_3 = _mm_unpackhi_epi16(src[2], src[3]);
+ const __m128i src_5 = _mm_unpackhi_epi16(src[4], src[5]);
+ const __m128i src_7 = _mm_unpackhi_epi16(src[6], src[7]);
+
+ const __m128i tmp_1 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 1 * gamma) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_3 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 3 * gamma) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_5 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 5 * gamma) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_7 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 7 * gamma) >> WARPEDDIFF_PREC_BITS)));
+
+ const __m128i tmp_9 = _mm_unpacklo_epi32(tmp_1, tmp_3);
+ const __m128i tmp_11 = _mm_unpacklo_epi32(tmp_5, tmp_7);
+ const __m128i tmp_13 = _mm_unpackhi_epi32(tmp_1, tmp_3);
+ const __m128i tmp_15 = _mm_unpackhi_epi32(tmp_5, tmp_7);
+
+ const __m128i coeff_1 = _mm_unpacklo_epi64(tmp_9, tmp_11);
+ const __m128i coeff_3 = _mm_unpackhi_epi64(tmp_9, tmp_11);
+ const __m128i coeff_5 = _mm_unpacklo_epi64(tmp_13, tmp_15);
+ const __m128i coeff_7 = _mm_unpackhi_epi64(tmp_13, tmp_15);
+
+ const __m128i res_1 = _mm_madd_epi16(src_1, coeff_1);
+ const __m128i res_3 = _mm_madd_epi16(src_3, coeff_3);
+ const __m128i res_5 = _mm_madd_epi16(src_5, coeff_5);
+ const __m128i res_7 = _mm_madd_epi16(src_7, coeff_7);
+
+ const __m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_3),
+ _mm_add_epi32(res_5, res_7));
// Rearrange pixels back into the order 0 ... 7
- __m128i res_lo = _mm_unpacklo_epi32(res_even, res_odd);
- __m128i res_hi = _mm_unpackhi_epi32(res_even, res_odd);
+ const __m128i res_lo = _mm_unpacklo_epi32(res_even, res_odd);
+ const __m128i res_hi = _mm_unpackhi_epi32(res_even, res_odd);
// Round and pack into 8 bits
- __m128i round_const =
- _mm_set1_epi32((1 << VERSHEAR_REDUCE_PREC_BITS) >> 1);
+ const __m128i round_const =
+ _mm_set1_epi32(-(1 << (bd + VERSHEAR_REDUCE_PREC_BITS - 1)) +
+ ((1 << VERSHEAR_REDUCE_PREC_BITS) >> 1));
- __m128i res_lo_round = _mm_srai_epi32(
+ const __m128i res_lo_round = _mm_srai_epi32(
_mm_add_epi32(res_lo, round_const), VERSHEAR_REDUCE_PREC_BITS);
- __m128i res_hi_round = _mm_srai_epi32(
+ const __m128i res_hi_round = _mm_srai_epi32(
_mm_add_epi32(res_hi, round_const), VERSHEAR_REDUCE_PREC_BITS);
- __m128i res_16bit = _mm_packs_epi32(res_lo_round, res_hi_round);
+ const __m128i res_16bit = _mm_packs_epi32(res_lo_round, res_hi_round);
__m128i res_8bit = _mm_packus_epi16(res_16bit, res_16bit);
// Store, blending with 'pred' if needed
- __m128i *p = (__m128i *)&pred[(i + k + 4) * p_stride + j];
+ __m128i *const p = (__m128i *)&pred[(i + k + 4) * p_stride + j];
// Note: If we're outputting a 4x4 block, we need to be very careful
// to only output 4 pixels at this point, to avoid encode/decode
// mismatches when encoding with multiple threads.
if (p_width == 4) {
- if (ref_frm) {
+ if (comp_avg) {
const __m128i orig = _mm_cvtsi32_si128(*(uint32_t *)p);
res_8bit = _mm_avg_epu8(res_8bit, orig);
}
*(uint32_t *)p = _mm_cvtsi128_si32(res_8bit);
} else {
- if (ref_frm) res_8bit = _mm_avg_epu8(res_8bit, _mm_loadl_epi64(p));
+ if (comp_avg) res_8bit = _mm_avg_epu8(res_8bit, _mm_loadl_epi64(p));
_mm_storel_epi64(p, res_8bit);
}
}
diff --git a/third_party/aom/av1/common/x86/warp_plane_ssse3.c b/third_party/aom/av1/common/x86/warp_plane_ssse3.c
new file mode 100644
index 000000000..494410e99
--- /dev/null
+++ b/third_party/aom/av1/common/x86/warp_plane_ssse3.c
@@ -0,0 +1,508 @@
+/*
+ * 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.
+ */
+
+#include <tmmintrin.h>
+
+#include "./av1_rtcd.h"
+#include "av1/common/warped_motion.h"
+
+/* This is a modified version of 'warped_filter' from warped_motion.c:
+ * Each coefficient is stored in 8 bits instead of 16 bits
+ * The coefficients are rearranged in the column order 0, 2, 4, 6, 1, 3, 5, 7
+
+ This is done in order to avoid overflow: Since the tap with the largest
+ coefficient could be any of taps 2, 3, 4 or 5, we can't use the summation
+ order ((0 + 1) + (4 + 5)) + ((2 + 3) + (6 + 7)) used in the regular
+ convolve functions.
+
+ Instead, we use the summation order
+ ((0 + 2) + (4 + 6)) + ((1 + 3) + (5 + 7)).
+ The rearrangement of coefficients in this table is so that we can get the
+ coefficients into the correct order more quickly.
+*/
+/* clang-format off */
+DECLARE_ALIGNED(8, static const int8_t,
+ filter_8bit[WARPEDPIXEL_PREC_SHIFTS * 3 + 1][8]) = {
+#if WARPEDPIXEL_PREC_BITS == 6
+ // [-1, 0)
+ { 0, 127, 0, 0, 0, 1, 0, 0}, { 0, 127, 0, 0, -1, 2, 0, 0},
+ { 1, 127, -1, 0, -3, 4, 0, 0}, { 1, 126, -2, 0, -4, 6, 1, 0},
+ { 1, 126, -3, 0, -5, 8, 1, 0}, { 1, 125, -4, 0, -6, 11, 1, 0},
+ { 1, 124, -4, 0, -7, 13, 1, 0}, { 2, 123, -5, 0, -8, 15, 1, 0},
+ { 2, 122, -6, 0, -9, 18, 1, 0}, { 2, 121, -6, 0, -10, 20, 1, 0},
+ { 2, 120, -7, 0, -11, 22, 2, 0}, { 2, 119, -8, 0, -12, 25, 2, 0},
+ { 3, 117, -8, 0, -13, 27, 2, 0}, { 3, 116, -9, 0, -13, 29, 2, 0},
+ { 3, 114, -10, 0, -14, 32, 3, 0}, { 3, 113, -10, 0, -15, 35, 2, 0},
+ { 3, 111, -11, 0, -15, 37, 3, 0}, { 3, 109, -11, 0, -16, 40, 3, 0},
+ { 3, 108, -12, 0, -16, 42, 3, 0}, { 4, 106, -13, 0, -17, 45, 3, 0},
+ { 4, 104, -13, 0, -17, 47, 3, 0}, { 4, 102, -14, 0, -17, 50, 3, 0},
+ { 4, 100, -14, 0, -17, 52, 3, 0}, { 4, 98, -15, 0, -18, 55, 4, 0},
+ { 4, 96, -15, 0, -18, 58, 3, 0}, { 4, 94, -16, 0, -18, 60, 4, 0},
+ { 4, 91, -16, 0, -18, 63, 4, 0}, { 4, 89, -16, 0, -18, 65, 4, 0},
+ { 4, 87, -17, 0, -18, 68, 4, 0}, { 4, 85, -17, 0, -18, 70, 4, 0},
+ { 4, 82, -17, 0, -18, 73, 4, 0}, { 4, 80, -17, 0, -18, 75, 4, 0},
+ { 4, 78, -18, 0, -18, 78, 4, 0}, { 4, 75, -18, 0, -17, 80, 4, 0},
+ { 4, 73, -18, 0, -17, 82, 4, 0}, { 4, 70, -18, 0, -17, 85, 4, 0},
+ { 4, 68, -18, 0, -17, 87, 4, 0}, { 4, 65, -18, 0, -16, 89, 4, 0},
+ { 4, 63, -18, 0, -16, 91, 4, 0}, { 4, 60, -18, 0, -16, 94, 4, 0},
+ { 3, 58, -18, 0, -15, 96, 4, 0}, { 4, 55, -18, 0, -15, 98, 4, 0},
+ { 3, 52, -17, 0, -14, 100, 4, 0}, { 3, 50, -17, 0, -14, 102, 4, 0},
+ { 3, 47, -17, 0, -13, 104, 4, 0}, { 3, 45, -17, 0, -13, 106, 4, 0},
+ { 3, 42, -16, 0, -12, 108, 3, 0}, { 3, 40, -16, 0, -11, 109, 3, 0},
+ { 3, 37, -15, 0, -11, 111, 3, 0}, { 2, 35, -15, 0, -10, 113, 3, 0},
+ { 3, 32, -14, 0, -10, 114, 3, 0}, { 2, 29, -13, 0, -9, 116, 3, 0},
+ { 2, 27, -13, 0, -8, 117, 3, 0}, { 2, 25, -12, 0, -8, 119, 2, 0},
+ { 2, 22, -11, 0, -7, 120, 2, 0}, { 1, 20, -10, 0, -6, 121, 2, 0},
+ { 1, 18, -9, 0, -6, 122, 2, 0}, { 1, 15, -8, 0, -5, 123, 2, 0},
+ { 1, 13, -7, 0, -4, 124, 1, 0}, { 1, 11, -6, 0, -4, 125, 1, 0},
+ { 1, 8, -5, 0, -3, 126, 1, 0}, { 1, 6, -4, 0, -2, 126, 1, 0},
+ { 0, 4, -3, 0, -1, 127, 1, 0}, { 0, 2, -1, 0, 0, 127, 0, 0},
+ // [0, 1)
+ { 0, 0, 1, 0, 0, 127, 0, 0}, { 0, -1, 2, 0, 0, 127, 0, 0},
+ { 0, -3, 4, 1, 1, 127, -2, 0}, { 0, -5, 6, 1, 1, 127, -2, 0},
+ { 0, -6, 8, 1, 2, 126, -3, 0}, {-1, -7, 11, 2, 2, 126, -4, -1},
+ {-1, -8, 13, 2, 3, 125, -5, -1}, {-1, -10, 16, 3, 3, 124, -6, -1},
+ {-1, -11, 18, 3, 4, 123, -7, -1}, {-1, -12, 20, 3, 4, 122, -7, -1},
+ {-1, -13, 23, 3, 4, 121, -8, -1}, {-2, -14, 25, 4, 5, 120, -9, -1},
+ {-1, -15, 27, 4, 5, 119, -10, -1}, {-1, -16, 30, 4, 5, 118, -11, -1},
+ {-2, -17, 33, 5, 6, 116, -12, -1}, {-2, -17, 35, 5, 6, 114, -12, -1},
+ {-2, -18, 38, 5, 6, 113, -13, -1}, {-2, -19, 41, 6, 7, 111, -14, -2},
+ {-2, -19, 43, 6, 7, 110, -15, -2}, {-2, -20, 46, 6, 7, 108, -15, -2},
+ {-2, -20, 49, 6, 7, 106, -16, -2}, {-2, -21, 51, 7, 7, 104, -16, -2},
+ {-2, -21, 54, 7, 7, 102, -17, -2}, {-2, -21, 56, 7, 8, 100, -18, -2},
+ {-2, -22, 59, 7, 8, 98, -18, -2}, {-2, -22, 62, 7, 8, 96, -19, -2},
+ {-2, -22, 64, 7, 8, 94, -19, -2}, {-2, -22, 67, 8, 8, 91, -20, -2},
+ {-2, -22, 69, 8, 8, 89, -20, -2}, {-2, -22, 72, 8, 8, 87, -21, -2},
+ {-2, -21, 74, 8, 8, 84, -21, -2}, {-2, -22, 77, 8, 8, 82, -21, -2},
+ {-2, -21, 79, 8, 8, 79, -21, -2}, {-2, -21, 82, 8, 8, 77, -22, -2},
+ {-2, -21, 84, 8, 8, 74, -21, -2}, {-2, -21, 87, 8, 8, 72, -22, -2},
+ {-2, -20, 89, 8, 8, 69, -22, -2}, {-2, -20, 91, 8, 8, 67, -22, -2},
+ {-2, -19, 94, 8, 7, 64, -22, -2}, {-2, -19, 96, 8, 7, 62, -22, -2},
+ {-2, -18, 98, 8, 7, 59, -22, -2}, {-2, -18, 100, 8, 7, 56, -21, -2},
+ {-2, -17, 102, 7, 7, 54, -21, -2}, {-2, -16, 104, 7, 7, 51, -21, -2},
+ {-2, -16, 106, 7, 6, 49, -20, -2}, {-2, -15, 108, 7, 6, 46, -20, -2},
+ {-2, -15, 110, 7, 6, 43, -19, -2}, {-2, -14, 111, 7, 6, 41, -19, -2},
+ {-1, -13, 113, 6, 5, 38, -18, -2}, {-1, -12, 114, 6, 5, 35, -17, -2},
+ {-1, -12, 116, 6, 5, 33, -17, -2}, {-1, -11, 118, 5, 4, 30, -16, -1},
+ {-1, -10, 119, 5, 4, 27, -15, -1}, {-1, -9, 120, 5, 4, 25, -14, -2},
+ {-1, -8, 121, 4, 3, 23, -13, -1}, {-1, -7, 122, 4, 3, 20, -12, -1},
+ {-1, -7, 123, 4, 3, 18, -11, -1}, {-1, -6, 124, 3, 3, 16, -10, -1},
+ {-1, -5, 125, 3, 2, 13, -8, -1}, {-1, -4, 126, 2, 2, 11, -7, -1},
+ { 0, -3, 126, 2, 1, 8, -6, 0}, { 0, -2, 127, 1, 1, 6, -5, 0},
+ { 0, -2, 127, 1, 1, 4, -3, 0}, { 0, 0, 127, 0, 0, 2, -1, 0},
+ // [1, 2)
+ { 0, 0, 127, 0, 0, 1, 0, 0}, { 0, 0, 127, 0, 0, -1, 2, 0},
+ { 0, 1, 127, -1, 0, -3, 4, 0}, { 0, 1, 126, -2, 0, -4, 6, 1},
+ { 0, 1, 126, -3, 0, -5, 8, 1}, { 0, 1, 125, -4, 0, -6, 11, 1},
+ { 0, 1, 124, -4, 0, -7, 13, 1}, { 0, 2, 123, -5, 0, -8, 15, 1},
+ { 0, 2, 122, -6, 0, -9, 18, 1}, { 0, 2, 121, -6, 0, -10, 20, 1},
+ { 0, 2, 120, -7, 0, -11, 22, 2}, { 0, 2, 119, -8, 0, -12, 25, 2},
+ { 0, 3, 117, -8, 0, -13, 27, 2}, { 0, 3, 116, -9, 0, -13, 29, 2},
+ { 0, 3, 114, -10, 0, -14, 32, 3}, { 0, 3, 113, -10, 0, -15, 35, 2},
+ { 0, 3, 111, -11, 0, -15, 37, 3}, { 0, 3, 109, -11, 0, -16, 40, 3},
+ { 0, 3, 108, -12, 0, -16, 42, 3}, { 0, 4, 106, -13, 0, -17, 45, 3},
+ { 0, 4, 104, -13, 0, -17, 47, 3}, { 0, 4, 102, -14, 0, -17, 50, 3},
+ { 0, 4, 100, -14, 0, -17, 52, 3}, { 0, 4, 98, -15, 0, -18, 55, 4},
+ { 0, 4, 96, -15, 0, -18, 58, 3}, { 0, 4, 94, -16, 0, -18, 60, 4},
+ { 0, 4, 91, -16, 0, -18, 63, 4}, { 0, 4, 89, -16, 0, -18, 65, 4},
+ { 0, 4, 87, -17, 0, -18, 68, 4}, { 0, 4, 85, -17, 0, -18, 70, 4},
+ { 0, 4, 82, -17, 0, -18, 73, 4}, { 0, 4, 80, -17, 0, -18, 75, 4},
+ { 0, 4, 78, -18, 0, -18, 78, 4}, { 0, 4, 75, -18, 0, -17, 80, 4},
+ { 0, 4, 73, -18, 0, -17, 82, 4}, { 0, 4, 70, -18, 0, -17, 85, 4},
+ { 0, 4, 68, -18, 0, -17, 87, 4}, { 0, 4, 65, -18, 0, -16, 89, 4},
+ { 0, 4, 63, -18, 0, -16, 91, 4}, { 0, 4, 60, -18, 0, -16, 94, 4},
+ { 0, 3, 58, -18, 0, -15, 96, 4}, { 0, 4, 55, -18, 0, -15, 98, 4},
+ { 0, 3, 52, -17, 0, -14, 100, 4}, { 0, 3, 50, -17, 0, -14, 102, 4},
+ { 0, 3, 47, -17, 0, -13, 104, 4}, { 0, 3, 45, -17, 0, -13, 106, 4},
+ { 0, 3, 42, -16, 0, -12, 108, 3}, { 0, 3, 40, -16, 0, -11, 109, 3},
+ { 0, 3, 37, -15, 0, -11, 111, 3}, { 0, 2, 35, -15, 0, -10, 113, 3},
+ { 0, 3, 32, -14, 0, -10, 114, 3}, { 0, 2, 29, -13, 0, -9, 116, 3},
+ { 0, 2, 27, -13, 0, -8, 117, 3}, { 0, 2, 25, -12, 0, -8, 119, 2},
+ { 0, 2, 22, -11, 0, -7, 120, 2}, { 0, 1, 20, -10, 0, -6, 121, 2},
+ { 0, 1, 18, -9, 0, -6, 122, 2}, { 0, 1, 15, -8, 0, -5, 123, 2},
+ { 0, 1, 13, -7, 0, -4, 124, 1}, { 0, 1, 11, -6, 0, -4, 125, 1},
+ { 0, 1, 8, -5, 0, -3, 126, 1}, { 0, 1, 6, -4, 0, -2, 126, 1},
+ { 0, 0, 4, -3, 0, -1, 127, 1}, { 0, 0, 2, -1, 0, 0, 127, 0},
+ // dummy (replicate row index 191)
+ { 0, 0, 2, -1, 0, 0, 127, 0},
+
+#else
+ // [-1, 0)
+ { 0, 127, 0, 0, 0, 1, 0, 0}, { 1, 127, -1, 0, -3, 4, 0, 0},
+ { 1, 126, -3, 0, -5, 8, 1, 0}, { 1, 124, -4, 0, -7, 13, 1, 0},
+ { 2, 122, -6, 0, -9, 18, 1, 0}, { 2, 120, -7, 0, -11, 22, 2, 0},
+ { 3, 117, -8, 0, -13, 27, 2, 0}, { 3, 114, -10, 0, -14, 32, 3, 0},
+ { 3, 111, -11, 0, -15, 37, 3, 0}, { 3, 108, -12, 0, -16, 42, 3, 0},
+ { 4, 104, -13, 0, -17, 47, 3, 0}, { 4, 100, -14, 0, -17, 52, 3, 0},
+ { 4, 96, -15, 0, -18, 58, 3, 0}, { 4, 91, -16, 0, -18, 63, 4, 0},
+ { 4, 87, -17, 0, -18, 68, 4, 0}, { 4, 82, -17, 0, -18, 73, 4, 0},
+ { 4, 78, -18, 0, -18, 78, 4, 0}, { 4, 73, -18, 0, -17, 82, 4, 0},
+ { 4, 68, -18, 0, -17, 87, 4, 0}, { 4, 63, -18, 0, -16, 91, 4, 0},
+ { 3, 58, -18, 0, -15, 96, 4, 0}, { 3, 52, -17, 0, -14, 100, 4, 0},
+ { 3, 47, -17, 0, -13, 104, 4, 0}, { 3, 42, -16, 0, -12, 108, 3, 0},
+ { 3, 37, -15, 0, -11, 111, 3, 0}, { 3, 32, -14, 0, -10, 114, 3, 0},
+ { 2, 27, -13, 0, -8, 117, 3, 0}, { 2, 22, -11, 0, -7, 120, 2, 0},
+ { 1, 18, -9, 0, -6, 122, 2, 0}, { 1, 13, -7, 0, -4, 124, 1, 0},
+ { 1, 8, -5, 0, -3, 126, 1, 0}, { 0, 4, -3, 0, -1, 127, 1, 0},
+ // [0, 1)
+ { 0, 0, 1, 0, 0, 127, 0, 0}, { 0, -3, 4, 1, 1, 127, -2, 0},
+ { 0, -6, 8, 1, 2, 126, -3, 0}, {-1, -8, 13, 2, 3, 125, -5, -1},
+ {-1, -11, 18, 3, 4, 123, -7, -1}, {-1, -13, 23, 3, 4, 121, -8, -1},
+ {-1, -15, 27, 4, 5, 119, -10, -1}, {-2, -17, 33, 5, 6, 116, -12, -1},
+ {-2, -18, 38, 5, 6, 113, -13, -1}, {-2, -19, 43, 6, 7, 110, -15, -2},
+ {-2, -20, 49, 6, 7, 106, -16, -2}, {-2, -21, 54, 7, 7, 102, -17, -2},
+ {-2, -22, 59, 7, 8, 98, -18, -2}, {-2, -22, 64, 7, 8, 94, -19, -2},
+ {-2, -22, 69, 8, 8, 89, -20, -2}, {-2, -21, 74, 8, 8, 84, -21, -2},
+ {-2, -21, 79, 8, 8, 79, -21, -2}, {-2, -21, 84, 8, 8, 74, -21, -2},
+ {-2, -20, 89, 8, 8, 69, -22, -2}, {-2, -19, 94, 8, 7, 64, -22, -2},
+ {-2, -18, 98, 8, 7, 59, -22, -2}, {-2, -17, 102, 7, 7, 54, -21, -2},
+ {-2, -16, 106, 7, 6, 49, -20, -2}, {-2, -15, 110, 7, 6, 43, -19, -2},
+ {-1, -13, 113, 6, 5, 38, -18, -2}, {-1, -12, 116, 6, 5, 33, -17, -2},
+ {-1, -10, 119, 5, 4, 27, -15, -1}, {-1, -8, 121, 4, 3, 23, -13, -1},
+ {-1, -7, 123, 4, 3, 18, -11, -1}, {-1, -5, 125, 3, 2, 13, -8, -1},
+ { 0, -3, 126, 2, 1, 8, -6, 0}, { 0, -2, 127, 1, 1, 4, -3, 0},
+ // [1, 2)
+ { 0, 0, 127, 0, 0, 1, 0, 0}, { 0, 1, 127, -1, 0, -3, 4, 0},
+ { 0, 1, 126, -3, 0, -5, 8, 1}, { 0, 1, 124, -4, 0, -7, 13, 1},
+ { 0, 2, 122, -6, 0, -9, 18, 1}, { 0, 2, 120, -7, 0, -11, 22, 2},
+ { 0, 3, 117, -8, 0, -13, 27, 2}, { 0, 3, 114, -10, 0, -14, 32, 3},
+ { 0, 3, 111, -11, 0, -15, 37, 3}, { 0, 3, 108, -12, 0, -16, 42, 3},
+ { 0, 4, 104, -13, 0, -17, 47, 3}, { 0, 4, 100, -14, 0, -17, 52, 3},
+ { 0, 4, 96, -15, 0, -18, 58, 3}, { 0, 4, 91, -16, 0, -18, 63, 4},
+ { 0, 4, 87, -17, 0, -18, 68, 4}, { 0, 4, 82, -17, 0, -18, 73, 4},
+ { 0, 4, 78, -18, 0, -18, 78, 4}, { 0, 4, 73, -18, 0, -17, 82, 4},
+ { 0, 4, 68, -18, 0, -17, 87, 4}, { 0, 4, 63, -18, 0, -16, 91, 4},
+ { 0, 3, 58, -18, 0, -15, 96, 4}, { 0, 3, 52, -17, 0, -14, 100, 4},
+ { 0, 3, 47, -17, 0, -13, 104, 4}, { 0, 3, 42, -16, 0, -12, 108, 3},
+ { 0, 3, 37, -15, 0, -11, 111, 3}, { 0, 3, 32, -14, 0, -10, 114, 3},
+ { 0, 2, 27, -13, 0, -8, 117, 3}, { 0, 2, 22, -11, 0, -7, 120, 2},
+ { 0, 1, 18, -9, 0, -6, 122, 2}, { 0, 1, 13, -7, 0, -4, 124, 1},
+ { 0, 1, 8, -5, 0, -3, 126, 1}, { 0, 0, 4, -3, 0, -1, 127, 1},
+ // dummy (replicate row index 95)
+ { 0, 0, 4, -3, 0, -1, 127, 1},
+#endif // WARPEDPIXEL_PREC_BITS == 6
+};
+/* clang-format on */
+
+// Shuffle masks: we want to convert a sequence of bytes 0, 1, 2, ..., 15
+// in an SSE register into two sequences:
+// 0, 2, 2, 4, ..., 12, 12, 14, <don't care>
+// 1, 3, 3, 5, ..., 13, 13, 15, <don't care>
+static const uint8_t even_mask[16] = { 0, 2, 2, 4, 4, 6, 6, 8,
+ 8, 10, 10, 12, 12, 14, 14, 0 };
+static const uint8_t odd_mask[16] = { 1, 3, 3, 5, 5, 7, 7, 9,
+ 9, 11, 11, 13, 13, 15, 15, 0 };
+
+void av1_warp_affine_ssse3(const int32_t *mat, const uint8_t *ref, int width,
+ int height, int stride, uint8_t *pred, int p_col,
+ int p_row, int p_width, int p_height, int p_stride,
+ int subsampling_x, int subsampling_y, int comp_avg,
+ int16_t alpha, int16_t beta, int16_t gamma,
+ int16_t delta) {
+ __m128i tmp[15];
+ int i, j, k;
+ const int bd = 8;
+
+ /* Note: For this code to work, the left/right frame borders need to be
+ extended by at least 13 pixels each. By the time we get here, other
+ code will have set up this border, but we allow an explicit check
+ for debugging purposes.
+ */
+ /*for (i = 0; i < height; ++i) {
+ for (j = 0; j < 13; ++j) {
+ assert(ref[i * stride - 13 + j] == ref[i * stride]);
+ assert(ref[i * stride + width + j] == ref[i * stride + (width - 1)]);
+ }
+ }*/
+
+ for (i = 0; i < p_height; i += 8) {
+ for (j = 0; j < p_width; j += 8) {
+ // (x, y) coordinates of the center of this block in the destination
+ // image
+ const int32_t dst_x = p_col + j + 4;
+ const int32_t dst_y = p_row + i + 4;
+
+ int32_t x4, y4, ix4, sx4, iy4, sy4;
+ if (subsampling_x)
+ x4 = (mat[2] * 4 * dst_x + mat[3] * 4 * dst_y + mat[0] * 2 +
+ (mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS))) /
+ 4;
+ else
+ x4 = mat[2] * dst_x + mat[3] * dst_y + mat[0];
+
+ if (subsampling_y)
+ y4 = (mat[4] * 4 * dst_x + mat[5] * 4 * dst_y + mat[1] * 2 +
+ (mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS))) /
+ 4;
+ else
+ y4 = mat[4] * dst_x + mat[5] * dst_y + mat[1];
+
+ ix4 = x4 >> WARPEDMODEL_PREC_BITS;
+ sx4 = x4 & ((1 << WARPEDMODEL_PREC_BITS) - 1);
+ iy4 = y4 >> WARPEDMODEL_PREC_BITS;
+ sy4 = y4 & ((1 << WARPEDMODEL_PREC_BITS) - 1);
+
+ // Add in all the constant terms, including rounding and offset
+ sx4 += alpha * (-4) + beta * (-4) + (1 << (WARPEDDIFF_PREC_BITS - 1)) +
+ (WARPEDPIXEL_PREC_SHIFTS << WARPEDDIFF_PREC_BITS);
+ sy4 += gamma * (-4) + delta * (-4) + (1 << (WARPEDDIFF_PREC_BITS - 1)) +
+ (WARPEDPIXEL_PREC_SHIFTS << WARPEDDIFF_PREC_BITS);
+
+ sx4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1);
+ sy4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1);
+
+ // Horizontal filter
+ // If the block is aligned such that, after clamping, every sample
+ // would be taken from the leftmost/rightmost column, then we can
+ // skip the expensive horizontal filter.
+ if (ix4 <= -7) {
+ for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
+ int iy = iy4 + k;
+ if (iy < 0)
+ iy = 0;
+ else if (iy > height - 1)
+ iy = height - 1;
+ tmp[k + 7] = _mm_set1_epi16(
+ (1 << (bd + WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS -
+ 1)) +
+ ref[iy * stride] *
+ (1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)));
+ }
+ } else if (ix4 >= width + 6) {
+ for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
+ int iy = iy4 + k;
+ if (iy < 0)
+ iy = 0;
+ else if (iy > height - 1)
+ iy = height - 1;
+ tmp[k + 7] = _mm_set1_epi16(
+ (1 << (bd + WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS -
+ 1)) +
+ ref[iy * stride + (width - 1)] *
+ (1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)));
+ }
+ } else {
+ for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
+ int iy = iy4 + k;
+ if (iy < 0)
+ iy = 0;
+ else if (iy > height - 1)
+ iy = height - 1;
+ int sx = sx4 + beta * (k + 4);
+
+ // Load source pixels
+ const __m128i src =
+ _mm_loadu_si128((__m128i *)(ref + iy * stride + ix4 - 7));
+ const __m128i src_even =
+ _mm_shuffle_epi8(src, _mm_loadu_si128((__m128i *)even_mask));
+ const __m128i src_odd =
+ _mm_shuffle_epi8(src, _mm_loadu_si128((__m128i *)odd_mask));
+
+ // Filter even-index pixels
+ const __m128i tmp_0 = _mm_loadl_epi64((
+ __m128i *)&filter_8bit[(sx + 0 * alpha) >> WARPEDDIFF_PREC_BITS]);
+ const __m128i tmp_1 = _mm_loadl_epi64((
+ __m128i *)&filter_8bit[(sx + 1 * alpha) >> WARPEDDIFF_PREC_BITS]);
+ const __m128i tmp_2 = _mm_loadl_epi64((
+ __m128i *)&filter_8bit[(sx + 2 * alpha) >> WARPEDDIFF_PREC_BITS]);
+ const __m128i tmp_3 = _mm_loadl_epi64((
+ __m128i *)&filter_8bit[(sx + 3 * alpha) >> WARPEDDIFF_PREC_BITS]);
+ const __m128i tmp_4 = _mm_loadl_epi64((
+ __m128i *)&filter_8bit[(sx + 4 * alpha) >> WARPEDDIFF_PREC_BITS]);
+ const __m128i tmp_5 = _mm_loadl_epi64((
+ __m128i *)&filter_8bit[(sx + 5 * alpha) >> WARPEDDIFF_PREC_BITS]);
+ const __m128i tmp_6 = _mm_loadl_epi64((
+ __m128i *)&filter_8bit[(sx + 6 * alpha) >> WARPEDDIFF_PREC_BITS]);
+ const __m128i tmp_7 = _mm_loadl_epi64((
+ __m128i *)&filter_8bit[(sx + 7 * alpha) >> WARPEDDIFF_PREC_BITS]);
+
+ // Coeffs 0 2 0 2 4 6 4 6 1 3 1 3 5 7 5 7 for pixels 0 2
+ const __m128i tmp_8 = _mm_unpacklo_epi16(tmp_0, tmp_2);
+ // Coeffs 0 2 0 2 4 6 4 6 1 3 1 3 5 7 5 7 for pixels 1 3
+ const __m128i tmp_9 = _mm_unpacklo_epi16(tmp_1, tmp_3);
+ // Coeffs 0 2 0 2 4 6 4 6 1 3 1 3 5 7 5 7 for pixels 4 6
+ const __m128i tmp_10 = _mm_unpacklo_epi16(tmp_4, tmp_6);
+ // Coeffs 0 2 0 2 4 6 4 6 1 3 1 3 5 7 5 7 for pixels 5 7
+ const __m128i tmp_11 = _mm_unpacklo_epi16(tmp_5, tmp_7);
+
+ // Coeffs 0 2 0 2 0 2 0 2 4 6 4 6 4 6 4 6 for pixels 0 2 4 6
+ const __m128i tmp_12 = _mm_unpacklo_epi32(tmp_8, tmp_10);
+ // Coeffs 1 3 1 3 1 3 1 3 5 7 5 7 5 7 5 7 for pixels 0 2 4 6
+ const __m128i tmp_13 = _mm_unpackhi_epi32(tmp_8, tmp_10);
+ // Coeffs 0 2 0 2 0 2 0 2 4 6 4 6 4 6 4 6 for pixels 1 3 5 7
+ const __m128i tmp_14 = _mm_unpacklo_epi32(tmp_9, tmp_11);
+ // Coeffs 1 3 1 3 1 3 1 3 5 7 5 7 5 7 5 7 for pixels 1 3 5 7
+ const __m128i tmp_15 = _mm_unpackhi_epi32(tmp_9, tmp_11);
+
+ // Coeffs 0 2 for pixels 0 2 4 6 1 3 5 7
+ const __m128i coeff_02 = _mm_unpacklo_epi64(tmp_12, tmp_14);
+ // Coeffs 4 6 for pixels 0 2 4 6 1 3 5 7
+ const __m128i coeff_46 = _mm_unpackhi_epi64(tmp_12, tmp_14);
+ // Coeffs 1 3 for pixels 0 2 4 6 1 3 5 7
+ const __m128i coeff_13 = _mm_unpacklo_epi64(tmp_13, tmp_15);
+ // Coeffs 5 7 for pixels 0 2 4 6 1 3 5 7
+ const __m128i coeff_57 = _mm_unpackhi_epi64(tmp_13, tmp_15);
+
+ // The pixel order we need for 'src' is:
+ // 0 2 2 4 4 6 6 8 1 3 3 5 5 7 7 9
+ const __m128i src_02 = _mm_unpacklo_epi64(src_even, src_odd);
+ const __m128i res_02 = _mm_maddubs_epi16(src_02, coeff_02);
+ // 4 6 6 8 8 10 10 12 5 7 7 9 9 11 11 13
+ const __m128i src_46 = _mm_unpacklo_epi64(_mm_srli_si128(src_even, 4),
+ _mm_srli_si128(src_odd, 4));
+ const __m128i res_46 = _mm_maddubs_epi16(src_46, coeff_46);
+ // 1 3 3 5 5 7 7 9 2 4 4 6 6 8 8 10
+ const __m128i src_13 =
+ _mm_unpacklo_epi64(src_odd, _mm_srli_si128(src_even, 2));
+ const __m128i res_13 = _mm_maddubs_epi16(src_13, coeff_13);
+ // 5 7 7 9 9 11 11 13 6 8 8 10 10 12 12 14
+ const __m128i src_57 = _mm_unpacklo_epi64(
+ _mm_srli_si128(src_odd, 4), _mm_srli_si128(src_even, 6));
+ const __m128i res_57 = _mm_maddubs_epi16(src_57, coeff_57);
+
+ const __m128i round_const =
+ _mm_set1_epi16((1 << (bd + WARPEDPIXEL_FILTER_BITS - 1)) +
+ ((1 << HORSHEAR_REDUCE_PREC_BITS) >> 1));
+
+ // Note: The values res_02 + res_46 and res_13 + res_57 both
+ // fit into int16s at this point, but their sum may be too wide to fit
+ // into an int16. However, once we also add round_const, the sum of
+ // all of these fits into a uint16.
+ //
+ // The wrapping behaviour of _mm_add_* is used here to make sure we
+ // get the correct result despite converting between different
+ // (implicit) types.
+ const __m128i res_even = _mm_add_epi16(res_02, res_46);
+ const __m128i res_odd = _mm_add_epi16(res_13, res_57);
+ const __m128i res =
+ _mm_add_epi16(_mm_add_epi16(res_even, res_odd), round_const);
+ tmp[k + 7] = _mm_srli_epi16(res, HORSHEAR_REDUCE_PREC_BITS);
+ }
+ }
+
+ // Vertical filter
+ for (k = -4; k < AOMMIN(4, p_height - i - 4); ++k) {
+ int sy = sy4 + delta * (k + 4);
+
+ // Load from tmp and rearrange pairs of consecutive rows into the
+ // column order 0 0 2 2 4 4 6 6; 1 1 3 3 5 5 7 7
+ const __m128i *src = tmp + (k + 4);
+ const __m128i src_0 = _mm_unpacklo_epi16(src[0], src[1]);
+ const __m128i src_2 = _mm_unpacklo_epi16(src[2], src[3]);
+ const __m128i src_4 = _mm_unpacklo_epi16(src[4], src[5]);
+ const __m128i src_6 = _mm_unpacklo_epi16(src[6], src[7]);
+
+ // Filter even-index pixels
+ const __m128i tmp_0 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 0 * gamma) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_2 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 2 * gamma) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_4 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 4 * gamma) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_6 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 6 * gamma) >> WARPEDDIFF_PREC_BITS)));
+
+ const __m128i tmp_8 = _mm_unpacklo_epi32(tmp_0, tmp_2);
+ const __m128i tmp_10 = _mm_unpacklo_epi32(tmp_4, tmp_6);
+ const __m128i tmp_12 = _mm_unpackhi_epi32(tmp_0, tmp_2);
+ const __m128i tmp_14 = _mm_unpackhi_epi32(tmp_4, tmp_6);
+
+ const __m128i coeff_0 = _mm_unpacklo_epi64(tmp_8, tmp_10);
+ const __m128i coeff_2 = _mm_unpackhi_epi64(tmp_8, tmp_10);
+ const __m128i coeff_4 = _mm_unpacklo_epi64(tmp_12, tmp_14);
+ const __m128i coeff_6 = _mm_unpackhi_epi64(tmp_12, tmp_14);
+
+ const __m128i res_0 = _mm_madd_epi16(src_0, coeff_0);
+ const __m128i res_2 = _mm_madd_epi16(src_2, coeff_2);
+ const __m128i res_4 = _mm_madd_epi16(src_4, coeff_4);
+ const __m128i res_6 = _mm_madd_epi16(src_6, coeff_6);
+
+ const __m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_2),
+ _mm_add_epi32(res_4, res_6));
+
+ // Filter odd-index pixels
+ const __m128i src_1 = _mm_unpackhi_epi16(src[0], src[1]);
+ const __m128i src_3 = _mm_unpackhi_epi16(src[2], src[3]);
+ const __m128i src_5 = _mm_unpackhi_epi16(src[4], src[5]);
+ const __m128i src_7 = _mm_unpackhi_epi16(src[6], src[7]);
+
+ const __m128i tmp_1 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 1 * gamma) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_3 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 3 * gamma) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_5 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 5 * gamma) >> WARPEDDIFF_PREC_BITS)));
+ const __m128i tmp_7 = _mm_loadu_si128(
+ (__m128i *)(warped_filter +
+ ((sy + 7 * gamma) >> WARPEDDIFF_PREC_BITS)));
+
+ const __m128i tmp_9 = _mm_unpacklo_epi32(tmp_1, tmp_3);
+ const __m128i tmp_11 = _mm_unpacklo_epi32(tmp_5, tmp_7);
+ const __m128i tmp_13 = _mm_unpackhi_epi32(tmp_1, tmp_3);
+ const __m128i tmp_15 = _mm_unpackhi_epi32(tmp_5, tmp_7);
+
+ const __m128i coeff_1 = _mm_unpacklo_epi64(tmp_9, tmp_11);
+ const __m128i coeff_3 = _mm_unpackhi_epi64(tmp_9, tmp_11);
+ const __m128i coeff_5 = _mm_unpacklo_epi64(tmp_13, tmp_15);
+ const __m128i coeff_7 = _mm_unpackhi_epi64(tmp_13, tmp_15);
+
+ const __m128i res_1 = _mm_madd_epi16(src_1, coeff_1);
+ const __m128i res_3 = _mm_madd_epi16(src_3, coeff_3);
+ const __m128i res_5 = _mm_madd_epi16(src_5, coeff_5);
+ const __m128i res_7 = _mm_madd_epi16(src_7, coeff_7);
+
+ const __m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_3),
+ _mm_add_epi32(res_5, res_7));
+
+ // Rearrange pixels back into the order 0 ... 7
+ const __m128i res_lo = _mm_unpacklo_epi32(res_even, res_odd);
+ const __m128i res_hi = _mm_unpackhi_epi32(res_even, res_odd);
+
+ // Round and pack into 8 bits
+ const __m128i round_const =
+ _mm_set1_epi32(-(1 << (bd + VERSHEAR_REDUCE_PREC_BITS - 1)) +
+ ((1 << VERSHEAR_REDUCE_PREC_BITS) >> 1));
+
+ const __m128i res_lo_round = _mm_srai_epi32(
+ _mm_add_epi32(res_lo, round_const), VERSHEAR_REDUCE_PREC_BITS);
+ const __m128i res_hi_round = _mm_srai_epi32(
+ _mm_add_epi32(res_hi, round_const), VERSHEAR_REDUCE_PREC_BITS);
+
+ const __m128i res_16bit = _mm_packs_epi32(res_lo_round, res_hi_round);
+ __m128i res_8bit = _mm_packus_epi16(res_16bit, res_16bit);
+
+ // Store, blending with 'pred' if needed
+ __m128i *const p = (__m128i *)&pred[(i + k + 4) * p_stride + j];
+
+ // Note: If we're outputting a 4x4 block, we need to be very careful
+ // to only output 4 pixels at this point, to avoid encode/decode
+ // mismatches when encoding with multiple threads.
+ if (p_width == 4) {
+ if (comp_avg) {
+ const __m128i orig = _mm_cvtsi32_si128(*(uint32_t *)p);
+ res_8bit = _mm_avg_epu8(res_8bit, orig);
+ }
+ *(uint32_t *)p = _mm_cvtsi128_si32(res_8bit);
+ } else {
+ if (comp_avg) res_8bit = _mm_avg_epu8(res_8bit, _mm_loadl_epi64(p));
+ _mm_storel_epi64(p, res_8bit);
+ }
+ }
+ }
+ }
+}
diff --git a/third_party/aom/av1/decoder/decodeframe.c b/third_party/aom/av1/decoder/decodeframe.c
index 289d38670..610519981 100644
--- a/third_party/aom/av1/decoder/decodeframe.c
+++ b/third_party/aom/av1/decoder/decodeframe.c
@@ -92,7 +92,7 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
struct aom_read_bit_buffer *rb);
static int is_compound_reference_allowed(const AV1_COMMON *cm) {
-#if CONFIG_LOWDELAY_COMPOUND // Normative in decoder
+#if CONFIG_ONE_SIDED_COMPOUND // Normative in decoder
return !frame_is_intra_only(cm);
#else
int i;
@@ -190,7 +190,6 @@ static void read_switchable_interp_probs(FRAME_CONTEXT *fc, aom_reader *r) {
#endif
static void read_inter_mode_probs(FRAME_CONTEXT *fc, aom_reader *r) {
-#if CONFIG_REF_MV
int i;
for (i = 0; i < NEWMV_MODE_CONTEXTS; ++i)
av1_diff_update_prob(r, &fc->newmv_prob[i], ACCT_STR);
@@ -200,18 +199,6 @@ static void read_inter_mode_probs(FRAME_CONTEXT *fc, aom_reader *r) {
av1_diff_update_prob(r, &fc->refmv_prob[i], ACCT_STR);
for (i = 0; i < DRL_MODE_CONTEXTS; ++i)
av1_diff_update_prob(r, &fc->drl_prob[i], ACCT_STR);
-#else
-#if !CONFIG_EC_ADAPT
- int i, j;
- for (i = 0; i < INTER_MODE_CONTEXTS; ++i) {
- for (j = 0; j < INTER_MODES - 1; ++j)
- av1_diff_update_prob(r, &fc->inter_mode_probs[i][j], ACCT_STR);
- }
-#else
- (void)fc;
- (void)r;
-#endif
-#endif
}
#if CONFIG_EXT_INTER
@@ -367,9 +354,7 @@ static int av1_pvq_decode_helper(MACROBLOCKD *xd, tran_low_t *ref_coeff,
od_coeff ref_int32[OD_TXSIZE_MAX * OD_TXSIZE_MAX];
od_coeff out_int32[OD_TXSIZE_MAX * OD_TXSIZE_MAX];
-#if CONFIG_HIGHBITDEPTH
hbd_downshift = xd->bd - 8;
-#endif // CONFIG_HIGHBITDEPTH
od_raster_to_coding_order(ref_coeff_pvq, blk_size, tx_type, ref_coeff,
blk_size);
@@ -533,6 +518,133 @@ static int get_block_idx(const MACROBLOCKD *xd, int plane, int row, int col) {
return row * max_blocks_wide + col * txh_unit;
}
+#if CONFIG_DPCM_INTRA
+static void process_block_dpcm_vert(TX_SIZE tx_size, TX_TYPE_1D tx_type_1d,
+ const tran_low_t *dqcoeff, uint8_t *dst,
+ int dst_stride) {
+ const int tx1d_width = tx_size_wide[tx_size];
+ const int tx1d_height = tx_size_high[tx_size];
+ dpcm_inv_txfm_add_func inverse_tx =
+ av1_get_dpcm_inv_txfm_add_func(tx1d_width);
+ for (int r = 0; r < tx1d_height; ++r) {
+ if (r > 0) memcpy(dst, dst - dst_stride, tx1d_width * sizeof(dst[0]));
+ inverse_tx(dqcoeff, 1, tx_type_1d, dst);
+ dqcoeff += tx1d_width;
+ dst += dst_stride;
+ }
+}
+
+static void process_block_dpcm_horz(TX_SIZE tx_size, TX_TYPE_1D tx_type_1d,
+ const tran_low_t *dqcoeff, uint8_t *dst,
+ int dst_stride) {
+ const int tx1d_width = tx_size_wide[tx_size];
+ const int tx1d_height = tx_size_high[tx_size];
+ dpcm_inv_txfm_add_func inverse_tx =
+ av1_get_dpcm_inv_txfm_add_func(tx1d_height);
+ tran_low_t tx_buff[64];
+ for (int c = 0; c < tx1d_width; ++c, ++dqcoeff, ++dst) {
+ for (int r = 0; r < tx1d_height; ++r) {
+ if (c > 0) dst[r * dst_stride] = dst[r * dst_stride - 1];
+ tx_buff[r] = dqcoeff[r * tx1d_width];
+ }
+ inverse_tx(tx_buff, dst_stride, tx_type_1d, dst);
+ }
+}
+
+#if CONFIG_HIGHBITDEPTH
+static void hbd_process_block_dpcm_vert(TX_SIZE tx_size, TX_TYPE_1D tx_type_1d,
+ int bd, const tran_low_t *dqcoeff,
+ uint8_t *dst8, int dst_stride) {
+ uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
+ const int tx1d_width = tx_size_wide[tx_size];
+ const int tx1d_height = tx_size_high[tx_size];
+ hbd_dpcm_inv_txfm_add_func inverse_tx =
+ av1_get_hbd_dpcm_inv_txfm_add_func(tx1d_width);
+ for (int r = 0; r < tx1d_height; ++r) {
+ if (r > 0) memcpy(dst, dst - dst_stride, tx1d_width * sizeof(dst[0]));
+ inverse_tx(dqcoeff, 1, tx_type_1d, bd, dst);
+ dqcoeff += tx1d_width;
+ dst += dst_stride;
+ }
+}
+
+static void hbd_process_block_dpcm_horz(TX_SIZE tx_size, TX_TYPE_1D tx_type_1d,
+ int bd, const tran_low_t *dqcoeff,
+ uint8_t *dst8, int dst_stride) {
+ uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
+ const int tx1d_width = tx_size_wide[tx_size];
+ const int tx1d_height = tx_size_high[tx_size];
+ hbd_dpcm_inv_txfm_add_func inverse_tx =
+ av1_get_hbd_dpcm_inv_txfm_add_func(tx1d_height);
+ tran_low_t tx_buff[64];
+ switch (tx1d_height) {
+ case 4: inverse_tx = av1_hbd_dpcm_inv_txfm_add_4_c; break;
+ case 8: inverse_tx = av1_hbd_dpcm_inv_txfm_add_8_c; break;
+ case 16: inverse_tx = av1_hbd_dpcm_inv_txfm_add_16_c; break;
+ case 32: inverse_tx = av1_hbd_dpcm_inv_txfm_add_32_c; break;
+ default: assert(0);
+ }
+
+ for (int c = 0; c < tx1d_width; ++c, ++dqcoeff, ++dst) {
+ for (int r = 0; r < tx1d_height; ++r) {
+ if (c > 0) dst[r * dst_stride] = dst[r * dst_stride - 1];
+ tx_buff[r] = dqcoeff[r * tx1d_width];
+ }
+ inverse_tx(tx_buff, dst_stride, tx_type_1d, bd, dst);
+ }
+}
+#endif // CONFIG_HIGHBITDEPTH
+
+static void inverse_transform_block_dpcm(MACROBLOCKD *xd, int plane,
+ PREDICTION_MODE mode, TX_SIZE tx_size,
+ TX_TYPE tx_type, uint8_t *dst,
+ int dst_stride, int16_t scan_line) {
+ struct macroblockd_plane *const pd = &xd->plane[plane];
+ tran_low_t *const dqcoeff = pd->dqcoeff;
+ TX_TYPE_1D tx_type_1d = DCT_1D;
+ switch (tx_type) {
+ case IDTX: tx_type_1d = IDTX_1D; break;
+ case V_DCT:
+ assert(mode == H_PRED);
+ tx_type_1d = DCT_1D;
+ break;
+ case H_DCT:
+ assert(mode == V_PRED);
+ tx_type_1d = DCT_1D;
+ break;
+ default: assert(0);
+ }
+ switch (mode) {
+ case V_PRED:
+#if CONFIG_HIGHBITDEPTH
+ if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
+ hbd_process_block_dpcm_vert(tx_size, tx_type_1d, xd->bd, dqcoeff, dst,
+ dst_stride);
+ } else {
+#endif // CONFIG_HIGHBITDEPTH
+ process_block_dpcm_vert(tx_size, tx_type_1d, dqcoeff, dst, dst_stride);
+#if CONFIG_HIGHBITDEPTH
+ }
+#endif // CONFIG_HIGHBITDEPTH
+ break;
+ case H_PRED:
+#if CONFIG_HIGHBITDEPTH
+ if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
+ hbd_process_block_dpcm_horz(tx_size, tx_type_1d, xd->bd, dqcoeff, dst,
+ dst_stride);
+ } else {
+#endif // CONFIG_HIGHBITDEPTH
+ process_block_dpcm_horz(tx_size, tx_type_1d, dqcoeff, dst, dst_stride);
+#if CONFIG_HIGHBITDEPTH
+ }
+#endif // CONFIG_HIGHBITDEPTH
+ break;
+ default: assert(0);
+ }
+ memset(dqcoeff, 0, (scan_line + 1) * sizeof(dqcoeff[0]));
+}
+#endif // CONFIG_DPCM_INTRA
+
static void predict_and_reconstruct_intra_block(
AV1_COMMON *cm, MACROBLOCKD *const xd, aom_reader *const r,
MB_MODE_INFO *const mbmi, int plane, int row, int col, TX_SIZE tx_size) {
@@ -564,8 +676,22 @@ static void predict_and_reconstruct_intra_block(
if (eob) {
uint8_t *dst =
&pd->dst.buf[(row * pd->dst.stride + col) << tx_size_wide_log2[0]];
- inverse_transform_block(xd, plane, tx_type, tx_size, dst, pd->dst.stride,
- max_scan_line, eob);
+#if CONFIG_DPCM_INTRA
+ const int block_raster_idx =
+ av1_block_index_to_raster_order(tx_size, block_idx);
+ const PREDICTION_MODE mode = (plane == 0)
+ ? get_y_mode(xd->mi[0], block_raster_idx)
+ : mbmi->uv_mode;
+ if (av1_use_dpcm_intra(plane, mode, tx_type, mbmi)) {
+ inverse_transform_block_dpcm(xd, plane, mode, tx_size, tx_type, dst,
+ pd->dst.stride, max_scan_line);
+ } else {
+#endif // CONFIG_DPCM_INTRA
+ inverse_transform_block(xd, plane, tx_type, tx_size, dst,
+ pd->dst.stride, max_scan_line, eob);
+#if CONFIG_DPCM_INTRA
+ }
+#endif // CONFIG_DPCM_INTRA
}
#else
TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx, tx_size);
@@ -605,10 +731,9 @@ static void decode_reconstruct_tx(AV1_COMMON *cm, MACROBLOCKD *const xd,
PLANE_TYPE plane_type = get_plane_type(plane);
int block_idx = get_block_idx(xd, plane, blk_row, blk_col);
#if CONFIG_LV_MAP
- (void)segment_id;
int16_t max_scan_line = 0;
int eob;
- av1_read_coeffs_txb_facade(cm, xd, r, row, col, block_idx, plane,
+ av1_read_coeffs_txb_facade(cm, xd, r, blk_row, blk_col, block_idx, plane,
pd->dqcoeff, &max_scan_line, &eob);
// tx_type will be read out in av1_read_coeffs_txb_facade
TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx, plane_tx_size);
@@ -628,6 +753,7 @@ static void decode_reconstruct_tx(AV1_COMMON *cm, MACROBLOCKD *const xd,
} else {
const TX_SIZE sub_txs = sub_tx_size_map[tx_size];
const int bsl = tx_size_wide_unit[sub_txs];
+ assert(sub_txs < tx_size);
int i;
assert(bsl > 0);
@@ -890,13 +1016,13 @@ static void dec_predict_b_extend(
(c >> xd->plane[2].subsampling_x);
if (!b_sub8x8)
- av1_build_inter_predictors_sb_extend(xd,
+ av1_build_inter_predictors_sb_extend(&pbi->common, xd,
#if CONFIG_EXT_INTER
mi_row_ori, mi_col_ori,
#endif // CONFIG_EXT_INTER
mi_row_pred, mi_col_pred, bsize_pred);
else
- av1_build_inter_predictors_sb_sub8x8_extend(xd,
+ av1_build_inter_predictors_sb_sub8x8_extend(&pbi->common, xd,
#if CONFIG_EXT_INTER
mi_row_ori, mi_col_ori,
#endif // CONFIG_EXT_INTER
@@ -1584,9 +1710,11 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi,
#endif
#if CONFIG_CB4X4
- if (mbmi->skip) reset_skip_context(xd, bsize);
+ if (mbmi->skip) av1_reset_skip_context(xd, mi_row, mi_col, bsize);
#else
- if (mbmi->skip) reset_skip_context(xd, AOMMAX(BLOCK_8X8, bsize));
+ if (mbmi->skip) {
+ av1_reset_skip_context(xd, mi_row, mi_col, AOMMAX(BLOCK_8X8, bsize));
+ }
#endif
#if CONFIG_COEF_INTERLEAVE
@@ -1660,7 +1788,7 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi,
}
} else {
// Prediction
- av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL,
+ av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL,
AOMMAX(bsize, BLOCK_8X8));
// Reconstruction
@@ -1770,9 +1898,9 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi,
}
#if CONFIG_CB4X4
- av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL, bsize);
+ av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, bsize);
#else
- av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL,
+ av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL,
AOMMAX(bsize, BLOCK_8X8));
#endif
@@ -1966,38 +2094,23 @@ static PARTITION_TYPE read_partition(AV1_COMMON *cm, MACROBLOCKD *xd,
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
(void)cm;
-#elif CONFIG_EC_MULTISYMBOL
+#else
FRAME_CONTEXT *ec_ctx = cm->fc;
#endif
-#if CONFIG_EC_MULTISYMBOL
aom_cdf_prob *partition_cdf = (ctx >= 0) ? ec_ctx->partition_cdf[ctx] : NULL;
-#endif
if (has_rows && has_cols)
#if CONFIG_EXT_PARTITION_TYPES
if (bsize <= BLOCK_8X8)
-#if CONFIG_EC_MULTISYMBOL
p = (PARTITION_TYPE)aom_read_symbol(r, partition_cdf, PARTITION_TYPES,
ACCT_STR);
-#else
- p = (PARTITION_TYPE)aom_read_tree(r, av1_partition_tree, probs, ACCT_STR);
-#endif
else
-#if CONFIG_EC_MULTISYMBOL
p = (PARTITION_TYPE)aom_read_symbol(r, partition_cdf, EXT_PARTITION_TYPES,
ACCT_STR);
#else
- p = (PARTITION_TYPE)aom_read_tree(r, av1_ext_partition_tree, probs,
- ACCT_STR);
-#endif
-#else
-#if CONFIG_EC_MULTISYMBOL
p = (PARTITION_TYPE)aom_read_symbol(r, partition_cdf, PARTITION_TYPES,
ACCT_STR);
-#else
- p = (PARTITION_TYPE)aom_read_tree(r, av1_partition_tree, probs, ACCT_STR);
-#endif
#endif // CONFIG_EXT_PARTITION_TYPES
else if (!has_rows && has_cols)
p = aom_read(r, probs[1], ACCT_STR) ? PARTITION_SPLIT : PARTITION_HORZ;
@@ -2283,7 +2396,7 @@ static void decode_partition(AV1Decoder *const pbi, MACROBLOCKD *const xd,
set_skip_context(xd, mi_row, mi_col);
skip = read_skip(cm, xd, xd->mi[0]->mbmi.segment_id_supertx, r);
if (skip) {
- reset_skip_context(xd, bsize);
+ av1_reset_skip_context(xd, mi_row, mi_col, bsize);
} else {
#if CONFIG_EXT_TX
if (get_ext_tx_types(supertx_size, bsize, 1, cm->reduced_tx_set_used) >
@@ -2353,19 +2466,7 @@ static void decode_partition(AV1Decoder *const pbi, MACROBLOCKD *const xd,
#endif // CONFIG_EXT_PARTITION_TYPES
#if CONFIG_CDEF
-#if CONFIG_EXT_PARTITION
- if (cm->sb_size == BLOCK_128X128 && bsize == BLOCK_128X128) {
- if (!sb_all_skip(cm, mi_row, mi_col)) {
- cm->mi_grid_visible[mi_row * cm->mi_stride + mi_col]->mbmi.cdef_strength =
- aom_read_literal(r, cm->cdef_bits, ACCT_STR);
- } else {
- cm->mi_grid_visible[mi_row * cm->mi_stride + mi_col]->mbmi.cdef_strength =
- 0;
- }
- } else if (cm->sb_size == BLOCK_64X64 && bsize == BLOCK_64X64) {
-#else
- if (bsize == BLOCK_64X64) {
-#endif
+ if (bsize == cm->sb_size) {
if (!sb_all_skip(cm, mi_row, mi_col)) {
cm->mi_grid_visible[mi_row * cm->mi_stride + mi_col]->mbmi.cdef_strength =
aom_read_literal(r, cm->cdef_bits, ACCT_STR);
@@ -2400,7 +2501,7 @@ static void setup_bool_decoder(const uint8_t *data, const uint8_t *data_end,
"Failed to allocate bool decoder %d", 1);
}
-#if !CONFIG_PVQ && !(CONFIG_EC_ADAPT && CONFIG_NEW_TOKENSET) && !CONFIG_LV_MAP
+#if !CONFIG_PVQ && !CONFIG_EC_ADAPT && !CONFIG_LV_MAP
static void read_coef_probs_common(av1_coeff_probs_model *coef_probs,
aom_reader *r) {
int i, j, k, l, m;
@@ -2488,8 +2589,13 @@ static void decode_restoration_mode(AV1_COMMON *cm,
aom_rb_read_bit(rb) ? RESTORE_SWITCHABLE : RESTORE_NONE;
}
for (p = 1; p < MAX_MB_PLANE; ++p) {
- cm->rst_info[p].frame_restoration_type =
- aom_rb_read_bit(rb) ? RESTORE_WIENER : RESTORE_NONE;
+ rsi = &cm->rst_info[p];
+ if (aom_rb_read_bit(rb)) {
+ rsi->frame_restoration_type =
+ aom_rb_read_bit(rb) ? RESTORE_SGRPROJ : RESTORE_WIENER;
+ } else {
+ rsi->frame_restoration_type = RESTORE_NONE;
+ }
}
cm->rst_info[0].restoration_tilesize = RESTORATION_TILESIZE_MAX;
@@ -2514,19 +2620,19 @@ static void read_wiener_filter(WienerInfo *wiener_info,
aom_read_primitive_refsubexpfin(
rb, WIENER_FILT_TAP0_MAXV - WIENER_FILT_TAP0_MINV + 1,
WIENER_FILT_TAP0_SUBEXP_K,
- ref_wiener_info->vfilter[0] - WIENER_FILT_TAP0_MINV) +
+ ref_wiener_info->vfilter[0] - WIENER_FILT_TAP0_MINV, ACCT_STR) +
WIENER_FILT_TAP0_MINV;
wiener_info->vfilter[1] = wiener_info->vfilter[WIENER_WIN - 2] =
aom_read_primitive_refsubexpfin(
rb, WIENER_FILT_TAP1_MAXV - WIENER_FILT_TAP1_MINV + 1,
WIENER_FILT_TAP1_SUBEXP_K,
- ref_wiener_info->vfilter[1] - WIENER_FILT_TAP1_MINV) +
+ ref_wiener_info->vfilter[1] - WIENER_FILT_TAP1_MINV, ACCT_STR) +
WIENER_FILT_TAP1_MINV;
wiener_info->vfilter[2] = wiener_info->vfilter[WIENER_WIN - 3] =
aom_read_primitive_refsubexpfin(
rb, WIENER_FILT_TAP2_MAXV - WIENER_FILT_TAP2_MINV + 1,
WIENER_FILT_TAP2_SUBEXP_K,
- ref_wiener_info->vfilter[2] - WIENER_FILT_TAP2_MINV) +
+ ref_wiener_info->vfilter[2] - WIENER_FILT_TAP2_MINV, ACCT_STR) +
WIENER_FILT_TAP2_MINV;
// The central element has an implicit +WIENER_FILT_STEP
wiener_info->vfilter[WIENER_HALFWIN] =
@@ -2537,19 +2643,19 @@ static void read_wiener_filter(WienerInfo *wiener_info,
aom_read_primitive_refsubexpfin(
rb, WIENER_FILT_TAP0_MAXV - WIENER_FILT_TAP0_MINV + 1,
WIENER_FILT_TAP0_SUBEXP_K,
- ref_wiener_info->hfilter[0] - WIENER_FILT_TAP0_MINV) +
+ ref_wiener_info->hfilter[0] - WIENER_FILT_TAP0_MINV, ACCT_STR) +
WIENER_FILT_TAP0_MINV;
wiener_info->hfilter[1] = wiener_info->hfilter[WIENER_WIN - 2] =
aom_read_primitive_refsubexpfin(
rb, WIENER_FILT_TAP1_MAXV - WIENER_FILT_TAP1_MINV + 1,
WIENER_FILT_TAP1_SUBEXP_K,
- ref_wiener_info->hfilter[1] - WIENER_FILT_TAP1_MINV) +
+ ref_wiener_info->hfilter[1] - WIENER_FILT_TAP1_MINV, ACCT_STR) +
WIENER_FILT_TAP1_MINV;
wiener_info->hfilter[2] = wiener_info->hfilter[WIENER_WIN - 3] =
aom_read_primitive_refsubexpfin(
rb, WIENER_FILT_TAP2_MAXV - WIENER_FILT_TAP2_MINV + 1,
WIENER_FILT_TAP2_SUBEXP_K,
- ref_wiener_info->hfilter[2] - WIENER_FILT_TAP2_MINV) +
+ ref_wiener_info->hfilter[2] - WIENER_FILT_TAP2_MINV, ACCT_STR) +
WIENER_FILT_TAP2_MINV;
// The central element has an implicit +WIENER_FILT_STEP
wiener_info->hfilter[WIENER_HALFWIN] =
@@ -2564,12 +2670,12 @@ static void read_sgrproj_filter(SgrprojInfo *sgrproj_info,
sgrproj_info->xqd[0] =
aom_read_primitive_refsubexpfin(
rb, SGRPROJ_PRJ_MAX0 - SGRPROJ_PRJ_MIN0 + 1, SGRPROJ_PRJ_SUBEXP_K,
- ref_sgrproj_info->xqd[0] - SGRPROJ_PRJ_MIN0) +
+ ref_sgrproj_info->xqd[0] - SGRPROJ_PRJ_MIN0, ACCT_STR) +
SGRPROJ_PRJ_MIN0;
sgrproj_info->xqd[1] =
aom_read_primitive_refsubexpfin(
rb, SGRPROJ_PRJ_MAX1 - SGRPROJ_PRJ_MIN1 + 1, SGRPROJ_PRJ_SUBEXP_K,
- ref_sgrproj_info->xqd[1] - SGRPROJ_PRJ_MIN1) +
+ ref_sgrproj_info->xqd[1] - SGRPROJ_PRJ_MIN1, ACCT_STR) +
SGRPROJ_PRJ_MIN1;
memcpy(ref_sgrproj_info, sgrproj_info, sizeof(*sgrproj_info));
}
@@ -2622,6 +2728,7 @@ static void decode_restoration(AV1_COMMON *cm, aom_reader *rb) {
}
for (p = 1; p < MAX_MB_PLANE; ++p) {
set_default_wiener(&ref_wiener_info);
+ set_default_sgrproj(&ref_sgrproj_info);
rsi = &cm->rst_info[p];
if (rsi->frame_restoration_type == RESTORE_WIENER) {
for (i = 0; i < ntiles_uv; ++i) {
@@ -2635,6 +2742,21 @@ static void decode_restoration(AV1_COMMON *cm, aom_reader *rb) {
read_wiener_filter(&rsi->wiener_info[i], &ref_wiener_info, rb);
}
}
+ } else if (rsi->frame_restoration_type == RESTORE_SGRPROJ) {
+ for (i = 0; i < ntiles_uv; ++i) {
+ if (ntiles_uv > 1)
+ rsi->restoration_type[i] =
+ aom_read(rb, RESTORE_NONE_SGRPROJ_PROB, ACCT_STR)
+ ? RESTORE_SGRPROJ
+ : RESTORE_NONE;
+ else
+ rsi->restoration_type[i] = RESTORE_SGRPROJ;
+ if (rsi->restoration_type[i] == RESTORE_SGRPROJ) {
+ read_sgrproj_filter(&rsi->sgrproj_info[i], &ref_sgrproj_info, rb);
+ }
+ }
+ } else if (rsi->frame_restoration_type != RESTORE_NONE) {
+ assert(0);
}
}
}
@@ -2703,88 +2825,46 @@ static void setup_quantization(AV1_COMMON *const cm,
#endif
}
+// Build y/uv dequant values based on segmentation.
static void setup_segmentation_dequant(AV1_COMMON *const cm) {
- // Build y/uv dequant values based on segmentation.
- int i = 0;
-#if CONFIG_AOM_QM
- int lossless;
- int j = 0;
- int qmlevel;
- int using_qm = cm->using_qmatrix;
- int minqm = cm->min_qmlevel;
- int maxqm = cm->max_qmlevel;
-#endif
-#if CONFIG_NEW_QUANT
- int b;
- int dq;
-#endif // CONFIG_NEW_QUANT
- if (cm->seg.enabled) {
- for (i = 0; i < MAX_SEGMENTS; ++i) {
- const int qindex = av1_get_qindex(&cm->seg, i, cm->base_qindex);
- cm->y_dequant[i][0] =
- av1_dc_quant(qindex, cm->y_dc_delta_q, cm->bit_depth);
- cm->y_dequant[i][1] = av1_ac_quant(qindex, 0, cm->bit_depth);
- cm->uv_dequant[i][0] =
- av1_dc_quant(qindex, cm->uv_dc_delta_q, cm->bit_depth);
- cm->uv_dequant[i][1] =
- av1_ac_quant(qindex, cm->uv_ac_delta_q, cm->bit_depth);
#if CONFIG_AOM_QM
- lossless = qindex == 0 && cm->y_dc_delta_q == 0 &&
- cm->uv_dc_delta_q == 0 && cm->uv_ac_delta_q == 0;
- // NB: depends on base index so there is only 1 set per frame
- // No quant weighting when lossless or signalled not using QM
- qmlevel = (lossless || using_qm == 0)
- ? NUM_QM_LEVELS - 1
- : aom_get_qmlevel(cm->base_qindex, minqm, maxqm);
- for (j = 0; j < TX_SIZES; ++j) {
- cm->y_iqmatrix[i][1][j] = aom_iqmatrix(cm, qmlevel, 0, j, 1);
- cm->y_iqmatrix[i][0][j] = aom_iqmatrix(cm, qmlevel, 0, j, 0);
- cm->uv_iqmatrix[i][1][j] = aom_iqmatrix(cm, qmlevel, 1, j, 1);
- cm->uv_iqmatrix[i][0][j] = aom_iqmatrix(cm, qmlevel, 1, j, 0);
- }
-#endif // CONFIG_AOM_QM
-#if CONFIG_NEW_QUANT
- for (dq = 0; dq < QUANT_PROFILES; dq++) {
- for (b = 0; b < COEF_BANDS; ++b) {
- av1_get_dequant_val_nuq(cm->y_dequant[i][b != 0], b,
- cm->y_dequant_nuq[i][dq][b], NULL, dq);
- av1_get_dequant_val_nuq(cm->uv_dequant[i][b != 0], b,
- cm->uv_dequant_nuq[i][dq][b], NULL, dq);
- }
- }
-#endif // CONFIG_NEW_QUANT
- }
- } else {
- const int qindex = cm->base_qindex;
- // When segmentation is disabled, only the first value is used. The
- // remaining are don't cares.
- cm->y_dequant[0][0] = av1_dc_quant(qindex, cm->y_dc_delta_q, cm->bit_depth);
- cm->y_dequant[0][1] = av1_ac_quant(qindex, 0, cm->bit_depth);
- cm->uv_dequant[0][0] =
+ const int using_qm = cm->using_qmatrix;
+ const int minqm = cm->min_qmlevel;
+ const int maxqm = cm->max_qmlevel;
+#endif
+ // When segmentation is disabled, only the first value is used. The
+ // remaining are don't cares.
+ const int max_segments = cm->seg.enabled ? MAX_SEGMENTS : 1;
+ for (int i = 0; i < max_segments; ++i) {
+ const int qindex = av1_get_qindex(&cm->seg, i, cm->base_qindex);
+ cm->y_dequant[i][0] = av1_dc_quant(qindex, cm->y_dc_delta_q, cm->bit_depth);
+ cm->y_dequant[i][1] = av1_ac_quant(qindex, 0, cm->bit_depth);
+ cm->uv_dequant[i][0] =
av1_dc_quant(qindex, cm->uv_dc_delta_q, cm->bit_depth);
- cm->uv_dequant[0][1] =
+ cm->uv_dequant[i][1] =
av1_ac_quant(qindex, cm->uv_ac_delta_q, cm->bit_depth);
#if CONFIG_AOM_QM
- lossless = qindex == 0 && cm->y_dc_delta_q == 0 && cm->uv_dc_delta_q == 0 &&
- cm->uv_ac_delta_q == 0;
+ const int lossless = qindex == 0 && cm->y_dc_delta_q == 0 &&
+ cm->uv_dc_delta_q == 0 && cm->uv_ac_delta_q == 0;
+ // NB: depends on base index so there is only 1 set per frame
// No quant weighting when lossless or signalled not using QM
- qmlevel = (lossless || using_qm == 0)
- ? NUM_QM_LEVELS - 1
- : aom_get_qmlevel(cm->base_qindex, minqm, maxqm);
- for (j = 0; j < TX_SIZES; ++j) {
+ const int qmlevel = (lossless || using_qm == 0)
+ ? NUM_QM_LEVELS - 1
+ : aom_get_qmlevel(cm->base_qindex, minqm, maxqm);
+ for (int j = 0; j < TX_SIZES_ALL; ++j) {
cm->y_iqmatrix[i][1][j] = aom_iqmatrix(cm, qmlevel, 0, j, 1);
cm->y_iqmatrix[i][0][j] = aom_iqmatrix(cm, qmlevel, 0, j, 0);
cm->uv_iqmatrix[i][1][j] = aom_iqmatrix(cm, qmlevel, 1, j, 1);
cm->uv_iqmatrix[i][0][j] = aom_iqmatrix(cm, qmlevel, 1, j, 0);
}
-#endif
+#endif // CONFIG_AOM_QM
#if CONFIG_NEW_QUANT
- for (dq = 0; dq < QUANT_PROFILES; dq++) {
- for (b = 0; b < COEF_BANDS; ++b) {
- av1_get_dequant_val_nuq(cm->y_dequant[0][b != 0], b,
- cm->y_dequant_nuq[0][dq][b], NULL, dq);
- av1_get_dequant_val_nuq(cm->uv_dequant[0][b != 0], b,
- cm->uv_dequant_nuq[0][dq][b], NULL, dq);
+ for (int dq = 0; dq < QUANT_PROFILES; dq++) {
+ for (int b = 0; b < COEF_BANDS; ++b) {
+ av1_get_dequant_val_nuq(cm->y_dequant[i][b != 0], b,
+ cm->y_dequant_nuq[i][dq][b], NULL, dq);
+ av1_get_dequant_val_nuq(cm->uv_dequant[i][b != 0], b,
+ cm->uv_dequant_nuq[i][dq][b], NULL, dq);
}
}
#endif // CONFIG_NEW_QUANT
@@ -2808,12 +2888,7 @@ static void setup_render_size(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
static void setup_superres_size(AV1_COMMON *const cm,
struct aom_read_bit_buffer *rb, int *width,
int *height) {
- // TODO(afergs): Test this behaviour
- // Frame superres is probably in compatible with this render resolution
- assert(cm->width == cm->render_width && cm->height == cm->render_height);
-
- cm->superres_width = cm->width;
- cm->superres_height = cm->height;
+ // TODO(afergs): Save input resolution - it's the upscaled resolution
if (aom_rb_read_bit(rb)) {
cm->superres_scale_numerator =
(uint8_t)aom_rb_read_literal(rb, SUPERRES_SCALE_BITS);
@@ -2824,10 +2899,9 @@ static void setup_superres_size(AV1_COMMON *const cm,
// by default (ie. when it isn't sent)...
// resize_context_buffers() will change cm->width to equal cm->render_width,
// then they'll be the same again
- *width = cm->render_width =
- cm->width * cm->superres_scale_numerator / SUPERRES_SCALE_DENOMINATOR;
- *height = cm->render_height =
- cm->height * cm->superres_scale_numerator / SUPERRES_SCALE_DENOMINATOR;
+ *width = *width * cm->superres_scale_numerator / SUPERRES_SCALE_DENOMINATOR;
+ *height =
+ *width * cm->superres_scale_numerator / SUPERRES_SCALE_DENOMINATOR;
} else {
// 1:1 scaling - ie. no scaling, scale not provided
cm->superres_scale_numerator = SUPERRES_SCALE_DENOMINATOR;
@@ -2940,6 +3014,9 @@ static void setup_frame_size_with_refs(AV1_COMMON *cm,
if (!found) {
av1_read_frame_size(rb, &width, &height);
setup_render_size(cm, rb);
+#if CONFIG_FRAME_SUPERRES
+ setup_superres_size(cm, rb, &width, &height);
+#endif // CONFIG_FRAME_SUPERRES
}
if (width <= 0 || height <= 0)
@@ -3439,10 +3516,6 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data,
#endif // CONFIG_EXT_TILE
int tile_row, tile_col;
-#if CONFIG_SUBFRAME_PROB_UPDATE
- cm->do_subframe_update = n_tiles == 1;
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
-
if (cm->lf.filter_level && !cm->skip_loop_filter &&
pbi->lf_worker.data1 == NULL) {
CHECK_MEM_ERROR(cm, pbi->lf_worker.data1,
@@ -3594,19 +3667,6 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data,
if (pbi->mb.corrupted)
aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME,
"Failed to decode tile data");
-#if CONFIG_SUBFRAME_PROB_UPDATE
- if (cm->do_subframe_update &&
- cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
- const int mi_rows_per_update =
- MI_SIZE * AOMMAX(cm->mi_rows / MI_SIZE / COEF_PROBS_BUFS, 1);
- if ((mi_row + MI_SIZE) % mi_rows_per_update == 0 &&
- mi_row + MI_SIZE < cm->mi_rows &&
- cm->coef_probs_update_idx < COEF_PROBS_BUFS - 1) {
- av1_partial_adapt_probs(cm, mi_row, mi_col);
- ++cm->coef_probs_update_idx;
- }
- }
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
}
}
@@ -3971,15 +4031,7 @@ static void read_bitdepth_colorspace_sampling(AV1_COMMON *cm,
}
#if CONFIG_HIGHBITDEPTH
- if (cm->bit_depth > AOM_BITS_8) {
- cm->use_highbitdepth = 1;
- } else {
-#if CONFIG_LOWBITDEPTH
- cm->use_highbitdepth = 0;
-#else
- cm->use_highbitdepth = 1;
-#endif
- }
+ cm->use_highbitdepth = cm->bit_depth > AOM_BITS_8 || !CONFIG_LOWBITDEPTH;
#endif
cm->color_space = aom_rb_read_literal(rb, 3);
@@ -4022,6 +4074,28 @@ void read_sequence_header(SequenceHeader *seq_params) {
}
#endif
+#if CONFIG_EXT_INTER
+static void read_compound_tools(AV1_COMMON *cm,
+ struct aom_read_bit_buffer *rb) {
+ (void)cm;
+ (void)rb;
+#if CONFIG_INTERINTRA
+ if (!frame_is_intra_only(cm) && cm->reference_mode != COMPOUND_REFERENCE) {
+ cm->allow_interintra_compound = aom_rb_read_bit(rb);
+ } else {
+ cm->allow_interintra_compound = 0;
+ }
+#endif // CONFIG_INTERINTRA
+#if CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT
+ if (!frame_is_intra_only(cm) && cm->reference_mode != SINGLE_REFERENCE) {
+ cm->allow_masked_compound = aom_rb_read_bit(rb);
+ } else {
+ cm->allow_masked_compound = 0;
+ }
+#endif // CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT
+}
+#endif // CONFIG_EXT_INTER
+
static size_t read_uncompressed_header(AV1Decoder *pbi,
struct aom_read_bit_buffer *rb) {
AV1_COMMON *const cm = &pbi->common;
@@ -4163,14 +4237,20 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
#if CONFIG_ANS && ANS_MAX_SYMBOLS
cm->ans_window_size_log2 = aom_rb_read_literal(rb, 4) + 8;
#endif // CONFIG_ANS && ANS_MAX_SYMBOLS
-#if CONFIG_PALETTE
+#if CONFIG_PALETTE || CONFIG_INTRABC
cm->allow_screen_content_tools = aom_rb_read_bit(rb);
-#endif // CONFIG_PALETTE
+#endif // CONFIG_PALETTE || CONFIG_INTRABC
+#if CONFIG_TEMPMV_SIGNALING
+ cm->use_prev_frame_mvs = 0;
+#endif
} else {
cm->intra_only = cm->show_frame ? 0 : aom_rb_read_bit(rb);
-#if CONFIG_PALETTE
+#if CONFIG_PALETTE || CONFIG_INTRABC
if (cm->intra_only) cm->allow_screen_content_tools = aom_rb_read_bit(rb);
-#endif // CONFIG_PALETTE
+#endif // CONFIG_PALETTE || CONFIG_INTRABC
+#if CONFIG_TEMPMV_SIGNALING
+ if (cm->intra_only || cm->error_resilient_mode) cm->use_prev_frame_mvs = 0;
+#endif
if (cm->error_resilient_mode) {
cm->reset_frame_context = RESET_FRAME_CONTEXT_ALL;
} else {
@@ -4293,9 +4373,7 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
}
#endif
-#if CONFIG_HIGHBITDEPTH
get_frame_new_buffer(cm)->bit_depth = cm->bit_depth;
-#endif
get_frame_new_buffer(cm)->color_space = cm->color_space;
get_frame_new_buffer(cm)->color_range = cm->color_range;
get_frame_new_buffer(cm)->render_width = cm->render_width;
@@ -4361,9 +4439,7 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
decode_restoration_mode(cm, rb);
#endif // CONFIG_LOOP_RESTORATION
setup_quantization(cm, rb);
-#if CONFIG_HIGHBITDEPTH
xd->bd = (int)cm->bit_depth;
-#endif
#if CONFIG_Q_ADAPT_PROBS
av1_default_coef_probs(cm);
@@ -4427,6 +4503,9 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
setup_segmentation_dequant(cm);
cm->tx_mode = read_tx_mode(cm, xd, rb);
cm->reference_mode = read_frame_reference_mode(cm, rb);
+#if CONFIG_EXT_INTER
+ read_compound_tools(cm, rb);
+#endif // CONFIG_EXT_INTER
#if CONFIG_EXT_TX
cm->reduced_tx_set_used = aom_rb_read_bit(rb);
@@ -4505,37 +4584,41 @@ static void read_global_motion_params(WarpedMotionParams *params,
params->wmmat[6] =
aom_read_signed_primitive_refsubexpfin(
r, GM_ROW3HOMO_MAX + 1, SUBEXPFIN_K,
- (ref_params->wmmat[6] >> GM_ROW3HOMO_PREC_DIFF)) *
+ (ref_params->wmmat[6] >> GM_ROW3HOMO_PREC_DIFF), ACCT_STR) *
GM_ROW3HOMO_DECODE_FACTOR;
if (type != VERTRAPEZOID)
params->wmmat[7] =
aom_read_signed_primitive_refsubexpfin(
r, GM_ROW3HOMO_MAX + 1, SUBEXPFIN_K,
- (ref_params->wmmat[7] >> GM_ROW3HOMO_PREC_DIFF)) *
+ (ref_params->wmmat[7] >> GM_ROW3HOMO_PREC_DIFF), ACCT_STR) *
GM_ROW3HOMO_DECODE_FACTOR;
case AFFINE:
case ROTZOOM:
params->wmmat[2] = aom_read_signed_primitive_refsubexpfin(
r, GM_ALPHA_MAX + 1, SUBEXPFIN_K,
(ref_params->wmmat[2] >> GM_ALPHA_PREC_DIFF) -
- (1 << GM_ALPHA_PREC_BITS)) *
+ (1 << GM_ALPHA_PREC_BITS),
+ ACCT_STR) *
GM_ALPHA_DECODE_FACTOR +
(1 << WARPEDMODEL_PREC_BITS);
if (type != VERTRAPEZOID)
- params->wmmat[3] = aom_read_signed_primitive_refsubexpfin(
- r, GM_ALPHA_MAX + 1, SUBEXPFIN_K,
- (ref_params->wmmat[3] >> GM_ALPHA_PREC_DIFF)) *
- GM_ALPHA_DECODE_FACTOR;
+ params->wmmat[3] =
+ aom_read_signed_primitive_refsubexpfin(
+ r, GM_ALPHA_MAX + 1, SUBEXPFIN_K,
+ (ref_params->wmmat[3] >> GM_ALPHA_PREC_DIFF), ACCT_STR) *
+ GM_ALPHA_DECODE_FACTOR;
if (type >= AFFINE) {
if (type != HORTRAPEZOID)
- params->wmmat[4] = aom_read_signed_primitive_refsubexpfin(
- r, GM_ALPHA_MAX + 1, SUBEXPFIN_K,
- (ref_params->wmmat[4] >> GM_ALPHA_PREC_DIFF)) *
- GM_ALPHA_DECODE_FACTOR;
+ params->wmmat[4] =
+ aom_read_signed_primitive_refsubexpfin(
+ r, GM_ALPHA_MAX + 1, SUBEXPFIN_K,
+ (ref_params->wmmat[4] >> GM_ALPHA_PREC_DIFF), ACCT_STR) *
+ GM_ALPHA_DECODE_FACTOR;
params->wmmat[5] = aom_read_signed_primitive_refsubexpfin(
r, GM_ALPHA_MAX + 1, SUBEXPFIN_K,
(ref_params->wmmat[5] >> GM_ALPHA_PREC_DIFF) -
- (1 << GM_ALPHA_PREC_BITS)) *
+ (1 << GM_ALPHA_PREC_BITS),
+ ACCT_STR) *
GM_ALPHA_DECODE_FACTOR +
(1 << WARPEDMODEL_PREC_BITS);
} else {
@@ -4552,14 +4635,16 @@ static void read_global_motion_params(WarpedMotionParams *params,
trans_prec_diff = (type == TRANSLATION)
? GM_TRANS_ONLY_PREC_DIFF + !allow_hp
: GM_TRANS_PREC_DIFF;
- params->wmmat[0] = aom_read_signed_primitive_refsubexpfin(
- r, (1 << trans_bits) + 1, SUBEXPFIN_K,
- (ref_params->wmmat[0] >> trans_prec_diff)) *
- trans_dec_factor;
- params->wmmat[1] = aom_read_signed_primitive_refsubexpfin(
- r, (1 << trans_bits) + 1, SUBEXPFIN_K,
- (ref_params->wmmat[1] >> trans_prec_diff)) *
- trans_dec_factor;
+ params->wmmat[0] =
+ aom_read_signed_primitive_refsubexpfin(
+ r, (1 << trans_bits) + 1, SUBEXPFIN_K,
+ (ref_params->wmmat[0] >> trans_prec_diff), ACCT_STR) *
+ trans_dec_factor;
+ params->wmmat[1] =
+ aom_read_signed_primitive_refsubexpfin(
+ r, (1 << trans_bits) + 1, SUBEXPFIN_K,
+ (ref_params->wmmat[1] >> trans_prec_diff), ACCT_STR) *
+ trans_dec_factor;
case IDENTITY: break;
default: assert(0);
}
@@ -4621,14 +4706,18 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
#if !CONFIG_EC_ADAPT
if (cm->tx_mode == TX_MODE_SELECT) read_tx_size_probs(fc, &r);
#endif
+#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
+ if (cm->tx_mode == TX_MODE_SELECT)
+ av1_diff_update_prob(&r, &fc->quarter_tx_size_prob, ACCT_STR);
+#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
#if CONFIG_LV_MAP
av1_read_txb_probs(fc, cm->tx_mode, &r);
#else // CONFIG_LV_MAP
#if !CONFIG_PVQ
-#if !(CONFIG_EC_ADAPT && CONFIG_NEW_TOKENSET)
+#if !CONFIG_EC_ADAPT
read_coef_probs(fc, cm->tx_mode, &r);
-#endif // !(CONFIG_EC_ADAPT && CONFIG_NEW_TOKENSET)
+#endif // !CONFIG_EC_ADAPT
#endif // !CONFIG_PVQ
#endif // CONFIG_LV_MAP
@@ -4699,24 +4788,26 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
if (frame_is_intra_only(cm)) {
av1_copy(cm->kf_y_prob, av1_kf_y_mode_prob);
-#if CONFIG_EC_MULTISYMBOL
av1_copy(cm->fc->kf_y_cdf, av1_kf_y_mode_cdf);
-#endif
#if !CONFIG_EC_ADAPT
for (k = 0; k < INTRA_MODES; k++)
for (j = 0; j < INTRA_MODES; j++)
for (i = 0; i < INTRA_MODES - 1; ++i)
av1_diff_update_prob(&r, &cm->kf_y_prob[k][j][i], ACCT_STR);
#endif
- } else {
-#if !CONFIG_REF_MV
- nmv_context *const nmvc = &fc->nmvc;
+#if CONFIG_INTRABC
+ if (cm->allow_screen_content_tools) {
+ av1_diff_update_prob(&r, &fc->intrabc_prob, ACCT_STR);
+ }
#endif
+ } else {
read_inter_mode_probs(fc, &r);
#if CONFIG_EXT_INTER
read_inter_compound_mode_probs(fc, &r);
- if (cm->reference_mode != COMPOUND_REFERENCE) {
+#if CONFIG_INTERINTRA
+ if (cm->reference_mode != COMPOUND_REFERENCE &&
+ cm->allow_interintra_compound) {
for (i = 0; i < BLOCK_SIZE_GROUPS; i++) {
if (is_interintra_allowed_bsize_group(i)) {
av1_diff_update_prob(&r, &fc->interintra_prob[i], ACCT_STR);
@@ -4726,14 +4817,17 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
for (j = 0; j < INTERINTRA_MODES - 1; j++)
av1_diff_update_prob(&r, &fc->interintra_mode_prob[i][j], ACCT_STR);
}
+#if CONFIG_WEDGE
for (i = 0; i < BLOCK_SIZES; i++) {
if (is_interintra_allowed_bsize(i) && is_interintra_wedge_used(i)) {
av1_diff_update_prob(&r, &fc->wedge_interintra_prob[i], ACCT_STR);
}
}
+#endif // CONFIG_WEDGE
}
+#endif // CONFIG_INTERINTRA
#if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
- if (cm->reference_mode != SINGLE_REFERENCE) {
+ if (cm->reference_mode != SINGLE_REFERENCE && cm->allow_masked_compound) {
for (i = 0; i < BLOCK_SIZES; i++) {
for (j = 0; j < COMPOUND_TYPES - 1; j++) {
av1_diff_update_prob(&r, &fc->compound_type_prob[i][j], ACCT_STR);
@@ -4768,12 +4862,8 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
}
#endif
-#if CONFIG_REF_MV
for (i = 0; i < NMV_CONTEXTS; ++i)
read_mv_probs(&fc->nmvc[i], cm->allow_high_precision_mv, &r);
-#else
- read_mv_probs(nmvc, cm->allow_high_precision_mv, &r);
-#endif
#if !CONFIG_EC_ADAPT
read_ext_tx_probs(fc, &r);
#endif // EC_ADAPT
@@ -4782,21 +4872,15 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
#endif
#if CONFIG_GLOBAL_MOTION
read_global_motion(cm, &r);
-#endif // EC_ADAPT, DAALA_EC
+#endif
}
-#if CONFIG_EC_MULTISYMBOL && !CONFIG_EC_ADAPT
-#if CONFIG_NEW_TOKENSET
+#if !CONFIG_EC_ADAPT
av1_coef_head_cdfs(fc);
-#endif
/* Make tail distribution from head */
av1_coef_pareto_cdfs(fc);
-#if CONFIG_REF_MV
for (i = 0; i < NMV_CONTEXTS; ++i) av1_set_mv_cdfs(&fc->nmvc[i]);
-#else
- av1_set_mv_cdfs(&fc->nmvc);
-#endif
av1_set_mode_cdfs(cm);
-#endif // CONFIG_EC_MULTISYMBOL && !CONFIG_EC_ADAPT
+#endif // !CONFIG_EC_ADAPT
return aom_reader_has_error(&r);
}
@@ -4820,10 +4904,8 @@ static void debug_check_frame_counts(const AV1_COMMON *const cm) {
assert(!memcmp(cm->counts.coef, zero_counts.coef, sizeof(cm->counts.coef)));
assert(!memcmp(cm->counts.eob_branch, zero_counts.eob_branch,
sizeof(cm->counts.eob_branch)));
-#if CONFIG_EC_MULTISYMBOL
assert(!memcmp(cm->counts.blockz_count, zero_counts.blockz_count,
sizeof(cm->counts.blockz_count)));
-#endif
assert(!memcmp(cm->counts.switchable_interp, zero_counts.switchable_interp,
sizeof(cm->counts.switchable_interp)));
assert(!memcmp(cm->counts.inter_mode, zero_counts.inter_mode,
@@ -4832,10 +4914,14 @@ static void debug_check_frame_counts(const AV1_COMMON *const cm) {
assert(!memcmp(cm->counts.inter_compound_mode,
zero_counts.inter_compound_mode,
sizeof(cm->counts.inter_compound_mode)));
+#if CONFIG_INTERINTRA
assert(!memcmp(cm->counts.interintra, zero_counts.interintra,
sizeof(cm->counts.interintra)));
+#if CONFIG_WEDGE
assert(!memcmp(cm->counts.wedge_interintra, zero_counts.wedge_interintra,
sizeof(cm->counts.wedge_interintra)));
+#endif // CONFIG_WEDGE
+#endif // CONFIG_INTERINTRA
assert(!memcmp(cm->counts.compound_interinter,
zero_counts.compound_interinter,
sizeof(cm->counts.compound_interinter)));
@@ -4859,14 +4945,10 @@ static void debug_check_frame_counts(const AV1_COMMON *const cm) {
assert(!memcmp(&cm->counts.tx_size, &zero_counts.tx_size,
sizeof(cm->counts.tx_size)));
assert(!memcmp(cm->counts.skip, zero_counts.skip, sizeof(cm->counts.skip)));
-#if CONFIG_REF_MV
assert(
!memcmp(&cm->counts.mv[0], &zero_counts.mv[0], sizeof(cm->counts.mv[0])));
assert(
!memcmp(&cm->counts.mv[1], &zero_counts.mv[1], sizeof(cm->counts.mv[0])));
-#else
- assert(!memcmp(&cm->counts.mv, &zero_counts.mv, sizeof(cm->counts.mv)));
-#endif
assert(!memcmp(cm->counts.inter_ext_tx, zero_counts.inter_ext_tx,
sizeof(cm->counts.inter_ext_tx)));
assert(!memcmp(cm->counts.intra_ext_tx, zero_counts.intra_ext_tx,
@@ -4931,6 +5013,9 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data,
uint8_t clear_data[MAX_AV1_HEADER_SIZE];
size_t first_partition_size;
YV12_BUFFER_CONFIG *new_fb;
+#if CONFIG_EXT_REFS || CONFIG_TEMPMV_SIGNALING
+ RefBuffer *last_fb_ref_buf = &cm->frame_refs[LAST_FRAME - LAST_FRAME];
+#endif // CONFIG_EXT_REFS || CONFIG_TEMPMV_SIGNALING
#if CONFIG_ADAPT_SCAN
av1_deliver_eob_threshold(cm, xd);
@@ -4958,6 +5043,18 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data,
#endif
new_fb = get_frame_new_buffer(cm);
xd->cur_buf = new_fb;
+#if CONFIG_INTRABC
+#if CONFIG_HIGHBITDEPTH
+ av1_setup_scale_factors_for_frame(
+ &xd->sf_identity, xd->cur_buf->y_crop_width, xd->cur_buf->y_crop_height,
+ xd->cur_buf->y_crop_width, xd->cur_buf->y_crop_height,
+ cm->use_highbitdepth);
+#else
+ av1_setup_scale_factors_for_frame(
+ &xd->sf_identity, xd->cur_buf->y_crop_width, xd->cur_buf->y_crop_height,
+ xd->cur_buf->y_crop_width, xd->cur_buf->y_crop_height);
+#endif // CONFIG_HIGHBITDEPTH
+#endif // CONFIG_INTRABC
#if CONFIG_GLOBAL_MOTION
int i;
for (i = LAST_FRAME; i <= ALTREF_FRAME; ++i) {
@@ -4978,26 +5075,9 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data,
aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME,
"Truncated packet or corrupt header length");
-#if CONFIG_REF_MV
cm->setup_mi(cm);
-#endif
-#if CONFIG_TEMPMV_SIGNALING
- if (cm->use_prev_frame_mvs) {
- RefBuffer *last_fb_ref_buf = &cm->frame_refs[LAST_FRAME - LAST_FRAME];
- cm->prev_frame = &cm->buffer_pool->frame_bufs[last_fb_ref_buf->idx];
- assert(!cm->error_resilient_mode &&
- cm->width == last_fb_ref_buf->buf->y_width &&
- cm->height == last_fb_ref_buf->buf->y_height &&
- !cm->prev_frame->intra_only);
- }
-#else
- cm->use_prev_frame_mvs =
- !cm->error_resilient_mode && cm->width == cm->last_width &&
- cm->height == cm->last_height && !cm->last_intra_only &&
- cm->last_show_frame && (cm->last_frame_type != KEY_FRAME);
-#endif
-#if CONFIG_EXT_REFS
+#if CONFIG_EXT_REFS || CONFIG_TEMPMV_SIGNALING
// NOTE(zoeliu): As cm->prev_frame can take neither a frame of
// show_exisiting_frame=1, nor can it take a frame not used as
// a reference, it is probable that by the time it is being
@@ -5008,16 +5088,33 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data,
// (1) Simply disable the use of previous frame mvs; or
// (2) Have cm->prev_frame point to one reference frame buffer,
// e.g. LAST_FRAME.
- if (cm->use_prev_frame_mvs && !dec_is_ref_frame_buf(pbi, cm->prev_frame)) {
+ if (!dec_is_ref_frame_buf(pbi, cm->prev_frame)) {
// Reassign the LAST_FRAME buffer to cm->prev_frame.
- RefBuffer *last_fb_ref_buf = &cm->frame_refs[LAST_FRAME - LAST_FRAME];
- cm->prev_frame = &cm->buffer_pool->frame_bufs[last_fb_ref_buf->idx];
+ cm->prev_frame = last_fb_ref_buf->idx != INVALID_IDX
+ ? &cm->buffer_pool->frame_bufs[last_fb_ref_buf->idx]
+ : NULL;
}
-#endif // CONFIG_EXT_REFS
+#endif // CONFIG_EXT_REFS || CONFIG_TEMPMV_SIGNALING
+
+#if CONFIG_TEMPMV_SIGNALING
+ if (cm->use_prev_frame_mvs) {
+ assert(!cm->error_resilient_mode && cm->prev_frame &&
+ cm->width == last_fb_ref_buf->buf->y_width &&
+ cm->height == last_fb_ref_buf->buf->y_height &&
+ !cm->prev_frame->intra_only);
+ }
+#else
+ cm->use_prev_frame_mvs = !cm->error_resilient_mode && cm->prev_frame &&
+ cm->width == cm->prev_frame->buf.y_crop_width &&
+ cm->height == cm->prev_frame->buf.y_crop_height &&
+ !cm->last_intra_only && cm->last_show_frame &&
+ (cm->last_frame_type != KEY_FRAME);
+#endif // CONFIG_TEMPMV_SIGNALING
av1_setup_block_planes(xd, cm->subsampling_x, cm->subsampling_y);
*cm->fc = cm->frame_contexts[cm->frame_context_idx];
+ cm->pre_fc = &cm->frame_contexts[cm->frame_context_idx];
if (!cm->fc->initialized)
aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME,
"Uninitialized entropy context.");
@@ -5053,11 +5150,6 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data,
av1_frameworker_unlock_stats(worker);
}
-#if CONFIG_SUBFRAME_PROB_UPDATE
- av1_copy(cm->starting_coef_probs, cm->fc->coef_probs);
- cm->coef_probs_update_idx = 0;
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
-
if (pbi->max_threads > 1 && !CONFIG_CB4X4 &&
#if CONFIG_EXT_TILE
pbi->dec_tile_col < 0 && // Decoding all columns
@@ -5105,10 +5197,6 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data,
sizeof(&pbi->tile_data[0].tctx.partition_cdf[0][0]));
make_update_tile_list_dec(pbi, cm->tile_rows, cm->tile_cols, tile_ctxs);
#endif
-
-#if CONFIG_SUBFRAME_PROB_UPDATE
- cm->partial_prob_update = 0;
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
av1_adapt_coef_probs(cm);
av1_adapt_intra_frame_probs(cm);
#if CONFIG_EC_ADAPT
diff --git a/third_party/aom/av1/decoder/decodemv.c b/third_party/aom/av1/decoder/decodemv.c
index ec0f87751..b3ce86e49 100644
--- a/third_party/aom/av1/decoder/decodemv.c
+++ b/third_party/aom/av1/decoder/decodemv.c
@@ -45,16 +45,10 @@ static INLINE int read_uniform(aom_reader *r, int n) {
}
#endif // CONFIG_EXT_INTRA || CONFIG_FILTER_INTRA || CONFIG_PALETTE
-#if CONFIG_EC_MULTISYMBOL
static PREDICTION_MODE read_intra_mode(aom_reader *r, aom_cdf_prob *cdf) {
return (PREDICTION_MODE)
av1_intra_mode_inv[aom_read_symbol(r, cdf, INTRA_MODES, ACCT_STR)];
}
-#else
-static PREDICTION_MODE read_intra_mode(aom_reader *r, const aom_prob *p) {
- return (PREDICTION_MODE)aom_read_tree(r, av1_intra_mode_tree, p, ACCT_STR);
-}
-#endif
#if CONFIG_DELTA_Q
static int read_delta_qindex(AV1_COMMON *cm, MACROBLOCKD *xd, aom_reader *r,
@@ -75,16 +69,7 @@ static int read_delta_qindex(AV1_COMMON *cm, MACROBLOCKD *xd, aom_reader *r,
#endif
if ((bsize != BLOCK_LARGEST || mbmi->skip == 0) && read_delta_q_flag) {
-#if !CONFIG_EC_MULTISYMBOL
- int bit = 1;
- abs = 0;
- while (abs < DELTA_Q_SMALL && bit) {
- bit = aom_read(r, ec_ctx->delta_q_prob[abs], ACCT_STR);
- abs += bit;
- }
-#else
abs = aom_read_symbol(r, ec_ctx->delta_q_cdf, DELTA_Q_PROBS + 1, ACCT_STR);
-#endif
smallval = (abs < DELTA_Q_SMALL);
if (counts) {
for (i = 0; i < abs; ++i) counts->delta_q[i][1]++;
@@ -127,17 +112,8 @@ static int read_delta_lflevel(AV1_COMMON *cm, MACROBLOCKD *xd, aom_reader *r,
#endif
if ((bsize != BLOCK_64X64 || mbmi->skip == 0) && read_delta_lf_flag) {
-#if !CONFIG_EC_MULTISYMBOL
- int bit = 1;
- abs = 0;
- while (abs < DELTA_LF_SMALL && bit) {
- bit = aom_read(r, ec_ctx->delta_lf_prob[abs], ACCT_STR);
- abs += bit;
- }
-#else
abs =
aom_read_symbol(r, ec_ctx->delta_lf_cdf, DELTA_LF_PROBS + 1, ACCT_STR);
-#endif
smallval = (abs < DELTA_LF_SMALL);
if (counts) {
for (i = 0; i < abs; ++i) counts->delta_lf[i][1]++;
@@ -162,52 +138,51 @@ static int read_delta_lflevel(AV1_COMMON *cm, MACROBLOCKD *xd, aom_reader *r,
#endif
#endif
-static PREDICTION_MODE read_intra_mode_y(AV1_COMMON *cm, MACROBLOCKD *xd,
+static PREDICTION_MODE read_intra_mode_y(FRAME_CONTEXT *ec_ctx, MACROBLOCKD *xd,
aom_reader *r, int size_group) {
-#if CONFIG_EC_ADAPT
- FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
-#elif CONFIG_EC_MULTISYMBOL
- FRAME_CONTEXT *ec_ctx = cm->fc;
-#endif
-
const PREDICTION_MODE y_mode =
-#if CONFIG_EC_MULTISYMBOL
read_intra_mode(r, ec_ctx->y_mode_cdf[size_group]);
-#else
- read_intra_mode(r, cm->fc->y_mode_prob[size_group]);
-#endif
FRAME_COUNTS *counts = xd->counts;
-#if CONFIG_EC_ADAPT
- (void)cm;
-#endif
if (counts) ++counts->y_mode[size_group][y_mode];
return y_mode;
}
-static PREDICTION_MODE read_intra_mode_uv(AV1_COMMON *cm, MACROBLOCKD *xd,
- aom_reader *r,
+static PREDICTION_MODE read_intra_mode_uv(FRAME_CONTEXT *ec_ctx,
+ MACROBLOCKD *xd, aom_reader *r,
PREDICTION_MODE y_mode) {
-#if CONFIG_EC_ADAPT
- FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
-#elif CONFIG_EC_MULTISYMBOL
- FRAME_CONTEXT *ec_ctx = cm->fc;
-#endif
-
const PREDICTION_MODE uv_mode =
-#if CONFIG_EC_MULTISYMBOL
read_intra_mode(r, ec_ctx->uv_mode_cdf[y_mode]);
-#else
- read_intra_mode(r, cm->fc->uv_mode_prob[y_mode]);
-#endif
FRAME_COUNTS *counts = xd->counts;
-#if CONFIG_EC_ADAPT
- (void)cm;
-#endif
if (counts) ++counts->uv_mode[y_mode][uv_mode];
return uv_mode;
}
-#if CONFIG_EXT_INTER
+#if CONFIG_CFL
+static int read_cfl_alphas(FRAME_CONTEXT *const ec_ctx, aom_reader *r, int skip,
+ CFL_SIGN_TYPE signs_out[CFL_PRED_PLANES]) {
+ if (skip) {
+ signs_out[CFL_PRED_U] = CFL_SIGN_POS;
+ signs_out[CFL_PRED_V] = CFL_SIGN_POS;
+ return 0;
+ } else {
+ const int ind = aom_read_symbol(r, ec_ctx->cfl_alpha_cdf, CFL_ALPHABET_SIZE,
+ "cfl:alpha");
+ // Signs are only coded for nonzero values
+ // sign == 0 implies negative alpha
+ // sign == 1 implies positive alpha
+ signs_out[CFL_PRED_U] = cfl_alpha_codes[ind][CFL_PRED_U]
+ ? aom_read_bit(r, "cfl:sign")
+ : CFL_SIGN_POS;
+ signs_out[CFL_PRED_V] = cfl_alpha_codes[ind][CFL_PRED_V]
+ ? aom_read_bit(r, "cfl:sign")
+ : CFL_SIGN_POS;
+
+ return ind;
+ }
+}
+#endif
+
+#if CONFIG_EXT_INTER && CONFIG_INTERINTRA
static INTERINTRA_MODE read_interintra_mode(AV1_COMMON *cm, MACROBLOCKD *xd,
aom_reader *r, int size_group) {
const INTERINTRA_MODE ii_mode = (INTERINTRA_MODE)aom_read_tree(
@@ -217,11 +192,10 @@ static INTERINTRA_MODE read_interintra_mode(AV1_COMMON *cm, MACROBLOCKD *xd,
if (counts) ++counts->interintra_mode[size_group][ii_mode];
return ii_mode;
}
-#endif // CONFIG_EXT_INTER
+#endif // CONFIG_EXT_INTER && CONFIG_INTERINTRA
static PREDICTION_MODE read_inter_mode(FRAME_CONTEXT *ec_ctx, MACROBLOCKD *xd,
aom_reader *r, int16_t ctx) {
-#if CONFIG_REF_MV
FRAME_COUNTS *counts = xd->counts;
int16_t mode_ctx = ctx & NEWMV_CTX_MASK;
aom_prob mode_prob = ec_ctx->newmv_prob[mode_ctx];
@@ -262,22 +236,8 @@ static PREDICTION_MODE read_inter_mode(FRAME_CONTEXT *ec_ctx, MACROBLOCKD *xd,
// Invalid prediction mode.
assert(0);
-#else
-#if CONFIG_EC_MULTISYMBOL
- const int mode = av1_inter_mode_inv[aom_read_symbol(
- r, ec_ctx->inter_mode_cdf[ctx], INTER_MODES, ACCT_STR)];
-#else
- const int mode = aom_read_tree(r, av1_inter_mode_tree,
- ec_ctx->inter_mode_probs[ctx], ACCT_STR);
-#endif
- FRAME_COUNTS *counts = xd->counts;
- if (counts) ++counts->inter_mode[ctx][mode];
-
- return NEARESTMV + mode;
-#endif
}
-#if CONFIG_REF_MV
static void read_drl_idx(const AV1_COMMON *cm, MACROBLOCKD *xd,
MB_MODE_INFO *mbmi, aom_reader *r) {
uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame);
@@ -324,7 +284,6 @@ static void read_drl_idx(const AV1_COMMON *cm, MACROBLOCKD *xd,
}
}
}
-#endif
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
static MOTION_MODE read_motion_mode(AV1_COMMON *cm, MACROBLOCKD *xd,
@@ -373,11 +332,7 @@ static PREDICTION_MODE read_inter_compound_mode(AV1_COMMON *cm, MACROBLOCKD *xd,
#endif // CONFIG_EXT_INTER
static int read_segment_id(aom_reader *r, struct segmentation_probs *segp) {
-#if CONFIG_EC_MULTISYMBOL
return aom_read_symbol(r, segp->tree_cdf, MAX_SEGMENTS, ACCT_STR);
-#else
- return aom_read_tree(r, av1_segment_tree, segp->tree_probs, ACCT_STR);
-#endif
}
#if CONFIG_VAR_TX
@@ -390,8 +345,8 @@ static void read_tx_size_vartx(AV1_COMMON *cm, MACROBLOCKD *xd,
const int tx_col = blk_col >> 1;
const int max_blocks_high = max_block_high(xd, mbmi->sb_type, 0);
const int max_blocks_wide = max_block_wide(xd, mbmi->sb_type, 0);
- int ctx = txfm_partition_context(xd->above_txfm_context + tx_col,
- xd->left_txfm_context + tx_row,
+ int ctx = txfm_partition_context(xd->above_txfm_context + blk_col,
+ xd->left_txfm_context + blk_row,
mbmi->sb_type, tx_size);
TX_SIZE(*const inter_tx_size)
[MAX_MIB_SIZE] =
@@ -407,8 +362,8 @@ static void read_tx_size_vartx(AV1_COMMON *cm, MACROBLOCKD *xd,
mbmi->tx_size = tx_size;
mbmi->min_tx_size = AOMMIN(mbmi->min_tx_size, get_min_tx_size(tx_size));
if (counts) ++counts->txfm_partition[ctx][0];
- txfm_partition_update(xd->above_txfm_context + tx_col,
- xd->left_txfm_context + tx_row, tx_size, tx_size);
+ txfm_partition_update(xd->above_txfm_context + blk_col,
+ xd->left_txfm_context + blk_row, tx_size, tx_size);
return;
}
@@ -429,8 +384,8 @@ static void read_tx_size_vartx(AV1_COMMON *cm, MACROBLOCKD *xd,
inter_tx_size[idy][idx] = inter_tx_size[0][0];
mbmi->tx_size = sub_txs;
mbmi->min_tx_size = get_min_tx_size(mbmi->tx_size);
- txfm_partition_update(xd->above_txfm_context + tx_col,
- xd->left_txfm_context + tx_row, sub_txs, tx_size);
+ txfm_partition_update(xd->above_txfm_context + blk_col,
+ xd->left_txfm_context + blk_row, sub_txs, tx_size);
return;
}
@@ -450,8 +405,8 @@ static void read_tx_size_vartx(AV1_COMMON *cm, MACROBLOCKD *xd,
mbmi->tx_size = tx_size;
mbmi->min_tx_size = AOMMIN(mbmi->min_tx_size, get_min_tx_size(tx_size));
if (counts) ++counts->txfm_partition[ctx][0];
- txfm_partition_update(xd->above_txfm_context + tx_col,
- xd->left_txfm_context + tx_row, tx_size, tx_size);
+ txfm_partition_update(xd->above_txfm_context + blk_col,
+ xd->left_txfm_context + blk_row, tx_size, tx_size);
}
}
#endif
@@ -467,14 +422,8 @@ static TX_SIZE read_selected_tx_size(AV1_COMMON *cm, MACROBLOCKD *xd,
FRAME_CONTEXT *ec_ctx = cm->fc;
#endif
- const int depth =
-#if CONFIG_EC_MULTISYMBOL
- aom_read_symbol(r, ec_ctx->tx_size_cdf[tx_size_cat][ctx], tx_size_cat + 2,
- ACCT_STR);
-#else
- aom_read_tree(r, av1_tx_size_tree[tx_size_cat],
- ec_ctx->tx_size_probs[tx_size_cat][ctx], ACCT_STR);
-#endif
+ const int depth = aom_read_symbol(r, ec_ctx->tx_size_cdf[tx_size_cat][ctx],
+ tx_size_cat + 2, ACCT_STR);
const TX_SIZE tx_size = depth_to_tx_size(depth);
#if CONFIG_RECT_TX
assert(!is_rect_tx(tx_size));
@@ -498,14 +447,25 @@ static TX_SIZE read_tx_size(AV1_COMMON *cm, MACROBLOCKD *xd, int is_inter,
: intra_tx_size_cat_lookup[bsize];
const TX_SIZE coded_tx_size =
read_selected_tx_size(cm, xd, tx_size_cat, r);
-#if CONFIG_EXT_TX && CONFIG_RECT_TX
+#if CONFIG_RECT_TX && (CONFIG_EXT_TX || CONFIG_VAR_TX)
if (coded_tx_size > max_txsize_lookup[bsize]) {
assert(coded_tx_size == max_txsize_lookup[bsize] + 1);
+#if CONFIG_EXT_TX && CONFIG_RECT_TX_EXT
+ if (is_quarter_tx_allowed(xd, &xd->mi[0]->mbmi, is_inter)) {
+ int quarter_tx = aom_read(r, cm->fc->quarter_tx_size_prob, ACCT_STR);
+ FRAME_COUNTS *counts = xd->counts;
+
+ if (counts) ++counts->quarter_tx_size[quarter_tx];
+ return quarter_tx ? quarter_txsize_lookup[bsize]
+ : max_txsize_rect_lookup[bsize];
+ }
+#endif // CONFIG_EXT_TX && CONFIG_RECT_TX_EXT
+
return max_txsize_rect_lookup[bsize];
}
#else
assert(coded_tx_size <= max_txsize_lookup[bsize]);
-#endif // CONFIG_EXT_TX && CONFIG_RECT_TX
+#endif // CONFIG_RECT_TX && (CONFIG_EXT_TX || CONFIG_VAR_TX)
return coded_tx_size;
} else {
return tx_size_from_tx_mode(bsize, tx_mode, is_inter);
@@ -636,6 +596,93 @@ static int read_skip(AV1_COMMON *cm, const MACROBLOCKD *xd, int segment_id,
}
#if CONFIG_PALETTE
+#if CONFIG_PALETTE_DELTA_ENCODING
+static int uint16_compare(const void *a, const void *b) {
+ const uint16_t va = *(const uint16_t *)a;
+ const uint16_t vb = *(const uint16_t *)b;
+ return va - vb;
+}
+
+static void read_palette_colors_y(MACROBLOCKD *const xd, int bit_depth,
+ PALETTE_MODE_INFO *const pmi, aom_reader *r) {
+ uint16_t color_cache[2 * PALETTE_MAX_SIZE];
+ const MODE_INFO *const above_mi = xd->above_mi;
+ const MODE_INFO *const left_mi = xd->left_mi;
+ const int n_cache = av1_get_palette_cache(above_mi, left_mi, 0, color_cache);
+ const int n = pmi->palette_size[0];
+ int idx = 0;
+ for (int i = 0; i < n_cache && idx < n; ++i)
+ if (aom_read_bit(r, ACCT_STR)) pmi->palette_colors[idx++] = color_cache[i];
+ if (idx < n) {
+ pmi->palette_colors[idx++] = aom_read_literal(r, bit_depth, ACCT_STR);
+ if (idx < n) {
+ const int min_bits = bit_depth - 3;
+ int bits = min_bits + aom_read_literal(r, 2, ACCT_STR);
+ int range = (1 << bit_depth) - pmi->palette_colors[idx - 1] - 1;
+ for (; idx < n; ++idx) {
+ const int delta = aom_read_literal(r, bits, ACCT_STR) + 1;
+ pmi->palette_colors[idx] = pmi->palette_colors[idx - 1] + delta;
+ range -= delta;
+ bits = AOMMIN(bits, av1_ceil_log2(range));
+ }
+ }
+ }
+ qsort(pmi->palette_colors, n, sizeof(pmi->palette_colors[0]), uint16_compare);
+}
+
+static void read_palette_colors_uv(MACROBLOCKD *const xd, int bit_depth,
+ PALETTE_MODE_INFO *const pmi,
+ aom_reader *r) {
+ const int n = pmi->palette_size[1];
+ // U channel colors.
+ uint16_t color_cache[2 * PALETTE_MAX_SIZE];
+ const MODE_INFO *const above_mi = xd->above_mi;
+ const MODE_INFO *const left_mi = xd->left_mi;
+ const int n_cache = av1_get_palette_cache(above_mi, left_mi, 1, color_cache);
+ int idx = PALETTE_MAX_SIZE;
+ for (int i = 0; i < n_cache && idx < PALETTE_MAX_SIZE + n; ++i)
+ if (aom_read_bit(r, ACCT_STR)) pmi->palette_colors[idx++] = color_cache[i];
+ if (idx < PALETTE_MAX_SIZE + n) {
+ pmi->palette_colors[idx++] = aom_read_literal(r, bit_depth, ACCT_STR);
+ if (idx < PALETTE_MAX_SIZE + n) {
+ const int min_bits = bit_depth - 3;
+ int bits = min_bits + aom_read_literal(r, 2, ACCT_STR);
+ int range = (1 << bit_depth) - pmi->palette_colors[idx - 1];
+ for (; idx < PALETTE_MAX_SIZE + n; ++idx) {
+ const int delta = aom_read_literal(r, bits, ACCT_STR);
+ pmi->palette_colors[idx] = pmi->palette_colors[idx - 1] + delta;
+ range -= delta;
+ bits = AOMMIN(bits, av1_ceil_log2(range));
+ }
+ }
+ }
+ qsort(pmi->palette_colors + PALETTE_MAX_SIZE, n,
+ sizeof(pmi->palette_colors[0]), uint16_compare);
+
+ // V channel colors.
+ if (aom_read_bit(r, ACCT_STR)) { // Delta encoding.
+ const int min_bits_v = bit_depth - 4;
+ const int max_val = 1 << bit_depth;
+ int bits = min_bits_v + aom_read_literal(r, 2, ACCT_STR);
+ pmi->palette_colors[2 * PALETTE_MAX_SIZE] =
+ aom_read_literal(r, bit_depth, ACCT_STR);
+ for (int i = 1; i < n; ++i) {
+ int delta = aom_read_literal(r, bits, ACCT_STR);
+ if (delta && aom_read_bit(r, ACCT_STR)) delta = -delta;
+ int val = (int)pmi->palette_colors[2 * PALETTE_MAX_SIZE + i - 1] + delta;
+ if (val < 0) val += max_val;
+ if (val >= max_val) val -= max_val;
+ pmi->palette_colors[2 * PALETTE_MAX_SIZE + i] = val;
+ }
+ } else {
+ for (int i = 0; i < n; ++i) {
+ pmi->palette_colors[2 * PALETTE_MAX_SIZE + i] =
+ aom_read_literal(r, bit_depth, ACCT_STR);
+ }
+ }
+}
+#endif // CONFIG_PALETTE_DELTA_ENCODING
+
static void read_palette_mode_info(AV1_COMMON *const cm, MACROBLOCKD *const xd,
aom_reader *r) {
MODE_INFO *const mi = xd->mi[0];
@@ -643,7 +690,7 @@ static void read_palette_mode_info(AV1_COMMON *const cm, MACROBLOCKD *const xd,
const MODE_INFO *const above_mi = xd->above_mi;
const MODE_INFO *const left_mi = xd->left_mi;
const BLOCK_SIZE bsize = mbmi->sb_type;
- int i, n;
+ int n;
PALETTE_MODE_INFO *const pmi = &mbmi->palette_mode_info;
if (mbmi->mode == DC_PRED) {
@@ -664,16 +711,9 @@ static void read_palette_mode_info(AV1_COMMON *const cm, MACROBLOCKD *const xd,
2;
n = pmi->palette_size[0];
#if CONFIG_PALETTE_DELTA_ENCODING
- const int min_bits = cm->bit_depth - 3;
- int bits = min_bits + aom_read_literal(r, 2, ACCT_STR);
- pmi->palette_colors[0] = aom_read_literal(r, cm->bit_depth, ACCT_STR);
- for (i = 1; i < n; ++i) {
- pmi->palette_colors[i] = pmi->palette_colors[i - 1] +
- aom_read_literal(r, bits, ACCT_STR) + 1;
- bits = AOMMIN(
- bits, av1_ceil_log2((1 << cm->bit_depth) - pmi->palette_colors[i]));
- }
+ read_palette_colors_y(xd, cm->bit_depth, pmi, r);
#else
+ int i;
for (i = 0; i < n; ++i)
pmi->palette_colors[i] = aom_read_literal(r, cm->bit_depth, ACCT_STR);
#endif // CONFIG_PALETTE_DELTA_ENCODING
@@ -693,42 +733,9 @@ static void read_palette_mode_info(AV1_COMMON *const cm, MACROBLOCKD *const xd,
2;
n = pmi->palette_size[1];
#if CONFIG_PALETTE_DELTA_ENCODING
- // U channel colors.
- const int min_bits_u = cm->bit_depth - 3;
- int bits = min_bits_u + aom_read_literal(r, 2, ACCT_STR);
- pmi->palette_colors[PALETTE_MAX_SIZE] =
- aom_read_literal(r, cm->bit_depth, ACCT_STR);
- for (i = 1; i < n; ++i) {
- pmi->palette_colors[PALETTE_MAX_SIZE + i] =
- pmi->palette_colors[PALETTE_MAX_SIZE + i - 1] +
- aom_read_literal(r, bits, ACCT_STR);
- bits = AOMMIN(bits,
- av1_ceil_log2(1 + (1 << cm->bit_depth) -
- pmi->palette_colors[PALETTE_MAX_SIZE + i]));
- }
- // V channel colors.
- if (aom_read_bit(r, ACCT_STR)) { // Delta encoding.
- const int min_bits_v = cm->bit_depth - 4;
- const int max_val = 1 << cm->bit_depth;
- bits = min_bits_v + aom_read_literal(r, 2, ACCT_STR);
- pmi->palette_colors[2 * PALETTE_MAX_SIZE] =
- aom_read_literal(r, cm->bit_depth, ACCT_STR);
- for (i = 1; i < n; ++i) {
- int delta = aom_read_literal(r, bits, ACCT_STR);
- if (delta && aom_read_bit(r, ACCT_STR)) delta = -delta;
- int val =
- (int)pmi->palette_colors[2 * PALETTE_MAX_SIZE + i - 1] + delta;
- if (val < 0) val += max_val;
- if (val >= max_val) val -= max_val;
- pmi->palette_colors[2 * PALETTE_MAX_SIZE + i] = val;
- }
- } else {
- for (i = 0; i < n; ++i) {
- pmi->palette_colors[2 * PALETTE_MAX_SIZE + i] =
- aom_read_literal(r, cm->bit_depth, ACCT_STR);
- }
- }
+ read_palette_colors_uv(xd, cm->bit_depth, pmi, r);
#else
+ int i;
for (i = 0; i < n; ++i) {
pmi->palette_colors[PALETTE_MAX_SIZE + i] =
aom_read_literal(r, cm->bit_depth, ACCT_STR);
@@ -745,7 +752,8 @@ static void read_palette_mode_info(AV1_COMMON *const cm, MACROBLOCKD *const xd,
#if CONFIG_FILTER_INTRA
static void read_filter_intra_mode_info(AV1_COMMON *const cm,
- MACROBLOCKD *const xd, aom_reader *r) {
+ MACROBLOCKD *const xd, int mi_row,
+ int mi_col, aom_reader *r) {
MODE_INFO *const mi = xd->mi[0];
MB_MODE_INFO *const mbmi = &mi->mbmi;
FRAME_COUNTS *counts = xd->counts;
@@ -768,6 +776,17 @@ static void read_filter_intra_mode_info(AV1_COMMON *const cm,
->filter_intra[0][filter_intra_mode_info->use_filter_intra_mode[0]];
}
}
+
+#if CONFIG_CB4X4
+ if (!is_chroma_reference(mi_row, mi_col, mbmi->sb_type,
+ xd->plane[1].subsampling_x,
+ xd->plane[1].subsampling_y))
+ return;
+#else
+ (void)mi_row;
+ (void)mi_col;
+#endif // CONFIG_CB4X4
+
if (mbmi->uv_mode == DC_PRED
#if CONFIG_PALETTE
&& mbmi->palette_mode_info.palette_size[1] == 0
@@ -812,13 +831,8 @@ static void read_intra_angle_info(AV1_COMMON *const cm, MACROBLOCKD *const xd,
p_angle = mode_to_angle_map[mbmi->mode] + mbmi->angle_delta[0] * ANGLE_STEP;
if (av1_is_intra_filter_switchable(p_angle)) {
FRAME_COUNTS *counts = xd->counts;
-#if CONFIG_EC_MULTISYMBOL
mbmi->intra_filter = aom_read_symbol(r, ec_ctx->intra_filter_cdf[ctx],
INTRA_FILTERS, ACCT_STR);
-#else
- mbmi->intra_filter = aom_read_tree(
- r, av1_intra_filter_tree, ec_ctx->intra_filter_probs[ctx], ACCT_STR);
-#endif // CONFIG_EC_MULTISYMBOL
if (counts) ++counts->intra_filter[ctx][mbmi->intra_filter];
} else {
mbmi->intra_filter = INTRA_FILTER_LINEAR;
@@ -880,29 +894,16 @@ void av1_read_tx_type(const AV1_COMMON *const cm, MACROBLOCKD *xd,
if (inter_block) {
if (eset > 0) {
-#if CONFIG_EC_MULTISYMBOL
*tx_type = av1_ext_tx_inter_inv[eset][aom_read_symbol(
r, ec_ctx->inter_ext_tx_cdf[eset][square_tx_size],
ext_tx_cnt_inter[eset], ACCT_STR)];
-#else
- *tx_type = aom_read_tree(
- r, av1_ext_tx_inter_tree[eset],
- ec_ctx->inter_ext_tx_prob[eset][square_tx_size], ACCT_STR);
-#endif
if (counts) ++counts->inter_ext_tx[eset][square_tx_size][*tx_type];
}
} else if (ALLOW_INTRA_EXT_TX) {
if (eset > 0) {
-#if CONFIG_EC_MULTISYMBOL
*tx_type = av1_ext_tx_intra_inv[eset][aom_read_symbol(
r, ec_ctx->intra_ext_tx_cdf[eset][square_tx_size][mbmi->mode],
ext_tx_cnt_intra[eset], ACCT_STR)];
-#else
- *tx_type = aom_read_tree(
- r, av1_ext_tx_intra_tree[eset],
- ec_ctx->intra_ext_tx_prob[eset][square_tx_size][mbmi->mode],
- ACCT_STR);
-#endif
if (counts)
++counts->intra_ext_tx[eset][square_tx_size][mbmi->mode][*tx_type];
}
@@ -923,25 +924,14 @@ void av1_read_tx_type(const AV1_COMMON *const cm, MACROBLOCKD *xd,
FRAME_COUNTS *counts = xd->counts;
if (inter_block) {
-#if CONFIG_EC_MULTISYMBOL
*tx_type = av1_ext_tx_inv[aom_read_symbol(
r, ec_ctx->inter_ext_tx_cdf[tx_size], TX_TYPES, ACCT_STR)];
-#else
- *tx_type = aom_read_tree(r, av1_ext_tx_tree,
- ec_ctx->inter_ext_tx_prob[tx_size], ACCT_STR);
-#endif
if (counts) ++counts->inter_ext_tx[tx_size][*tx_type];
} else {
const TX_TYPE tx_type_nom = intra_mode_to_tx_type_context[mbmi->mode];
-#if CONFIG_EC_MULTISYMBOL
*tx_type = av1_ext_tx_inv[aom_read_symbol(
r, ec_ctx->intra_ext_tx_cdf[tx_size][tx_type_nom], TX_TYPES,
ACCT_STR)];
-#else
- *tx_type = aom_read_tree(
- r, av1_ext_tx_tree, ec_ctx->intra_ext_tx_prob[tx_size][tx_type_nom],
- ACCT_STR);
-#endif
if (counts) ++counts->intra_ext_tx[tx_size][tx_type_nom][*tx_type];
}
} else {
@@ -972,7 +962,6 @@ static INLINE int assign_dv(AV1_COMMON *cm, MACROBLOCKD *xd, int_mv *mv,
read_mv(r, &mv->as_mv, &ref_mv->as_mv, &ec_ctx->ndvc, dv_counts, 0);
int valid = is_mv_valid(&mv->as_mv) &&
is_dv_valid(mv->as_mv, &xd->tile, mi_row, mi_col, bsize);
- // TODO(aconverse@google.com): additional validation
return valid;
}
#endif // CONFIG_INTRABC
@@ -995,7 +984,7 @@ static void read_intra_frame_mode_info(AV1_COMMON *const cm,
const int y_mis = AOMMIN(cm->mi_rows - mi_row, bh);
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
-#elif CONFIG_EC_MULTISYMBOL
+#else
FRAME_CONTEXT *ec_ctx = cm->fc;
#endif
@@ -1022,24 +1011,56 @@ static void read_intra_frame_mode_info(AV1_COMMON *const cm,
}
#endif
- mbmi->tx_size = read_tx_size(cm, xd, 0, 1, r);
mbmi->ref_frame[0] = INTRA_FRAME;
mbmi->ref_frame[1] = NONE_FRAME;
+ mbmi->tx_size = read_tx_size(cm, xd, 0, 1, r);
#if CONFIG_INTRABC
if (bsize >= BLOCK_8X8 && cm->allow_screen_content_tools) {
- mbmi->use_intrabc = aom_read(r, INTRABC_PROB, ACCT_STR);
+ mbmi->use_intrabc = aom_read(r, ec_ctx->intrabc_prob, ACCT_STR);
if (mbmi->use_intrabc) {
- int_mv dv_ref;
mbmi->mode = mbmi->uv_mode = DC_PRED;
#if CONFIG_DUAL_FILTER
for (int idx = 0; idx < 4; ++idx) mbmi->interp_filter[idx] = BILINEAR;
#else
mbmi->interp_filter = BILINEAR;
#endif
- av1_find_ref_dv(&dv_ref, mi_row, mi_col);
+
+ int16_t inter_mode_ctx[MODE_CTX_REF_FRAMES];
+ int_mv ref_mvs[MAX_MV_REF_CANDIDATES] = {};
+
+ av1_find_mv_refs(cm, xd, mi, INTRA_FRAME, &xd->ref_mv_count[INTRA_FRAME],
+ xd->ref_mv_stack[INTRA_FRAME],
+#if CONFIG_EXT_INTER
+ NULL,
+#endif // CONFIG_EXT_INTER
+ ref_mvs, mi_row, mi_col, NULL, NULL, inter_mode_ctx);
+
+ int_mv nearestmv, nearmv;
+ av1_find_best_ref_mvs(0, ref_mvs, &nearestmv, &nearmv);
+
+ int_mv dv_ref = nearestmv.as_int == 0 ? nearmv : nearestmv;
+ if (dv_ref.as_int == 0) av1_find_ref_dv(&dv_ref, mi_row, mi_col);
+
xd->corrupted |=
!assign_dv(cm, xd, &mbmi->mv[0], &dv_ref, mi_row, mi_col, bsize, r);
+#if CONFIG_VAR_TX
+ // TODO(aconverse@google.com): Evaluate allowing VAR TX on intrabc blocks
+ const int width = block_size_wide[bsize] >> tx_size_wide_log2[0];
+ const int height = block_size_high[bsize] >> tx_size_high_log2[0];
+ int idx, idy;
+ for (idy = 0; idy < height; ++idy)
+ for (idx = 0; idx < width; ++idx)
+ mbmi->inter_tx_size[idy >> 1][idx >> 1] = mbmi->tx_size;
+ mbmi->min_tx_size = get_min_tx_size(mbmi->tx_size);
+#endif // CONFIG_VAR_TX
+#if CONFIG_EXT_TX && !CONFIG_TXK_SEL
+ av1_read_tx_type(cm, xd,
+#if CONFIG_SUPERTX
+ 0,
+#endif
+ r);
+#endif // CONFIG_EXT_TX && !CONFIG_TXK_SEL
return;
}
}
@@ -1048,68 +1069,51 @@ static void read_intra_frame_mode_info(AV1_COMMON *const cm,
#if CONFIG_CB4X4
(void)i;
mbmi->mode =
-#if CONFIG_EC_MULTISYMBOL
read_intra_mode(r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, 0));
#else
- read_intra_mode(r, get_y_mode_probs(cm, mi, above_mi, left_mi, 0));
-#endif
-#else
switch (bsize) {
case BLOCK_4X4:
for (i = 0; i < 4; ++i)
- mi->bmi[i].as_mode =
-#if CONFIG_EC_MULTISYMBOL
- read_intra_mode(r,
- get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, i));
-#else
- read_intra_mode(r, get_y_mode_probs(cm, mi, above_mi, left_mi, i));
-#endif
+ mi->bmi[i].as_mode = read_intra_mode(
+ r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, i));
mbmi->mode = mi->bmi[3].as_mode;
break;
case BLOCK_4X8:
mi->bmi[0].as_mode = mi->bmi[2].as_mode =
-#if CONFIG_EC_MULTISYMBOL
read_intra_mode(r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, 0));
-#else
- read_intra_mode(r, get_y_mode_probs(cm, mi, above_mi, left_mi, 0));
-#endif
mi->bmi[1].as_mode = mi->bmi[3].as_mode = mbmi->mode =
-#if CONFIG_EC_MULTISYMBOL
read_intra_mode(r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, 1));
-#else
- read_intra_mode(r, get_y_mode_probs(cm, mi, above_mi, left_mi, 1));
-#endif
break;
case BLOCK_8X4:
mi->bmi[0].as_mode = mi->bmi[1].as_mode =
-#if CONFIG_EC_MULTISYMBOL
read_intra_mode(r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, 0));
-#else
- read_intra_mode(r, get_y_mode_probs(cm, mi, above_mi, left_mi, 0));
-#endif
mi->bmi[2].as_mode = mi->bmi[3].as_mode = mbmi->mode =
-#if CONFIG_EC_MULTISYMBOL
read_intra_mode(r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, 2));
-#else
- read_intra_mode(r, get_y_mode_probs(cm, mi, above_mi, left_mi, 2));
-#endif
break;
default:
mbmi->mode =
-#if CONFIG_EC_MULTISYMBOL
read_intra_mode(r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, 0));
-#else
- read_intra_mode(r, get_y_mode_probs(cm, mi, above_mi, left_mi, 0));
-#endif
}
#endif
#if CONFIG_CB4X4
if (is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x,
- xd->plane[1].subsampling_y))
- mbmi->uv_mode = read_intra_mode_uv(cm, xd, r, mbmi->mode);
+ xd->plane[1].subsampling_y)) {
+ mbmi->uv_mode = read_intra_mode_uv(ec_ctx, xd, r, mbmi->mode);
#else
- mbmi->uv_mode = read_intra_mode_uv(cm, xd, r, mbmi->mode);
+ mbmi->uv_mode = read_intra_mode_uv(ec_ctx, xd, r, mbmi->mode);
+#endif
+
+#if CONFIG_CFL
+ // TODO(ltrudeau) support PALETTE
+ if (mbmi->uv_mode == DC_PRED) {
+ mbmi->cfl_alpha_idx =
+ read_cfl_alphas(ec_ctx, r, mbmi->skip, mbmi->cfl_alpha_signs);
+ }
+#endif // CONFIG_CFL
+
+#if CONFIG_CB4X4
+ }
#endif
#if CONFIG_EXT_INTRA
@@ -1125,7 +1129,7 @@ static void read_intra_frame_mode_info(AV1_COMMON *const cm,
mbmi->filter_intra_mode_info.use_filter_intra_mode[0] = 0;
mbmi->filter_intra_mode_info.use_filter_intra_mode[1] = 0;
if (bsize >= BLOCK_8X8 || CONFIG_CB4X4)
- read_filter_intra_mode_info(cm, xd, r);
+ read_filter_intra_mode_info(cm, xd, mi_row, mi_col, r);
#endif // CONFIG_FILTER_INTRA
#if !CONFIG_TXK_SEL
@@ -1141,11 +1145,7 @@ static int read_mv_component(aom_reader *r, nmv_component *mvcomp, int usehp) {
int mag, d, fr, hp;
const int sign = aom_read(r, mvcomp->sign, ACCT_STR);
const int mv_class =
-#if CONFIG_EC_MULTISYMBOL
aom_read_symbol(r, mvcomp->class_cdf, MV_CLASSES, ACCT_STR);
-#else
- aom_read_tree(r, av1_mv_class_tree, mvcomp->classes, ACCT_STR);
-#endif
const int class0 = mv_class == MV_CLASS_0;
// Integer part
@@ -1161,14 +1161,9 @@ static int read_mv_component(aom_reader *r, nmv_component *mvcomp, int usehp) {
mag = CLASS0_SIZE << (mv_class + 2);
}
-// Fractional part
-#if CONFIG_EC_MULTISYMBOL
+ // Fractional part
fr = aom_read_symbol(r, class0 ? mvcomp->class0_fp_cdf[d] : mvcomp->fp_cdf,
MV_FP_SIZE, ACCT_STR);
-#else
- fr = aom_read_tree(r, av1_mv_fp_tree,
- class0 ? mvcomp->class0_fp[d] : mvcomp->fp, ACCT_STR);
-#endif
// High precision part (if hp is not used, the default value of the hp is 1)
hp = usehp ? aom_read(r, class0 ? mvcomp->class0_hp : mvcomp->hp, ACCT_STR)
@@ -1185,11 +1180,7 @@ static INLINE void read_mv(aom_reader *r, MV *mv, const MV *ref,
MV_JOINT_TYPE joint_type;
MV diff = { 0, 0 };
joint_type =
-#if CONFIG_EC_MULTISYMBOL
(MV_JOINT_TYPE)aom_read_symbol(r, ctx->joint_cdf, MV_JOINTS, ACCT_STR);
-#else
- (MV_JOINT_TYPE)aom_read_tree(r, av1_mv_joint_tree, ctx->joints, ACCT_STR);
-#endif
if (mv_joint_vertical(joint_type))
diff.row = read_mv_component(r, &ctx->comps[0], allow_hp);
@@ -1207,7 +1198,7 @@ static REFERENCE_MODE read_block_reference_mode(AV1_COMMON *cm,
const MACROBLOCKD *xd,
aom_reader *r) {
#if !SUB8X8_COMP_REF
- if (xd->mi[0]->mbmi.sb_type < BLOCK_8X8) return SINGLE_REFERENCE;
+ if (xd->mi[0]->mbmi.sb_type == BLOCK_4X4) return SINGLE_REFERENCE;
#endif
if (cm->reference_mode == REFERENCE_MODE_SELECT) {
const int ctx = av1_get_reference_mode_context(cm, xd);
@@ -1236,7 +1227,7 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
const REFERENCE_MODE mode = read_block_reference_mode(cm, xd, r);
// FIXME(rbultje) I'm pretty sure this breaks segmentation ref frame coding
if (mode == COMPOUND_REFERENCE) {
-#if CONFIG_LOWDELAY_COMPOUND // Normative in decoder (for low delay)
+#if CONFIG_ONE_SIDED_COMPOUND // Normative in decoder (for low delay)
const int idx = 1;
#else
#if CONFIG_EXT_REFS
@@ -1356,16 +1347,10 @@ static INLINE void read_mb_interp_filter(AV1_COMMON *const cm,
if (has_subpel_mv_component(xd->mi[0], xd, dir) ||
(mbmi->ref_frame[1] > INTRA_FRAME &&
has_subpel_mv_component(xd->mi[0], xd, dir + 2))) {
-#if CONFIG_EC_MULTISYMBOL
mbmi->interp_filter[dir] =
(InterpFilter)av1_switchable_interp_inv[aom_read_symbol(
r, ec_ctx->switchable_interp_cdf[ctx], SWITCHABLE_FILTERS,
ACCT_STR)];
-#else
- mbmi->interp_filter[dir] = (InterpFilter)aom_read_tree(
- r, av1_switchable_interp_tree, ec_ctx->switchable_interp_prob[ctx],
- ACCT_STR);
-#endif
if (counts) ++counts->switchable_interp[ctx][mbmi->interp_filter[dir]];
}
}
@@ -1375,21 +1360,15 @@ static INLINE void read_mb_interp_filter(AV1_COMMON *const cm,
mbmi->interp_filter[2] = mbmi->interp_filter[0];
mbmi->interp_filter[3] = mbmi->interp_filter[1];
}
-#else // CONFIG_DUAL_FILTER
+#else // CONFIG_DUAL_FILTER
if (cm->interp_filter != SWITCHABLE) {
mbmi->interp_filter = cm->interp_filter;
} else {
const int ctx = av1_get_pred_context_switchable_interp(xd);
-#if CONFIG_EC_MULTISYMBOL
mbmi->interp_filter =
(InterpFilter)av1_switchable_interp_inv[aom_read_symbol(
r, ec_ctx->switchable_interp_cdf[ctx], SWITCHABLE_FILTERS,
ACCT_STR)];
-#else
- mbmi->interp_filter = (InterpFilter)aom_read_tree(
- r, av1_switchable_interp_tree, ec_ctx->switchable_interp_prob[ctx],
- ACCT_STR);
-#endif
if (counts) ++counts->switchable_interp[ctx][mbmi->interp_filter];
}
#endif // CONFIG_DUAL_FILTER
@@ -1405,41 +1384,66 @@ static void read_intra_block_mode_info(AV1_COMMON *const cm, const int mi_row,
mbmi->ref_frame[0] = INTRA_FRAME;
mbmi->ref_frame[1] = NONE_FRAME;
+#if CONFIG_EC_ADAPT
+ FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
+#else
+ FRAME_CONTEXT *ec_ctx = cm->fc;
+#endif
+
#if CONFIG_CB4X4
(void)i;
- mbmi->mode = read_intra_mode_y(cm, xd, r, size_group_lookup[bsize]);
+ mbmi->mode = read_intra_mode_y(ec_ctx, xd, r, size_group_lookup[bsize]);
#else
switch (bsize) {
case BLOCK_4X4:
for (i = 0; i < 4; ++i)
- mi->bmi[i].as_mode = read_intra_mode_y(cm, xd, r, 0);
+ mi->bmi[i].as_mode = read_intra_mode_y(ec_ctx, xd, r, 0);
mbmi->mode = mi->bmi[3].as_mode;
break;
case BLOCK_4X8:
- mi->bmi[0].as_mode = mi->bmi[2].as_mode = read_intra_mode_y(cm, xd, r, 0);
+ mi->bmi[0].as_mode = mi->bmi[2].as_mode =
+ read_intra_mode_y(ec_ctx, xd, r, 0);
mi->bmi[1].as_mode = mi->bmi[3].as_mode = mbmi->mode =
- read_intra_mode_y(cm, xd, r, 0);
+ read_intra_mode_y(ec_ctx, xd, r, 0);
break;
case BLOCK_8X4:
- mi->bmi[0].as_mode = mi->bmi[1].as_mode = read_intra_mode_y(cm, xd, r, 0);
+ mi->bmi[0].as_mode = mi->bmi[1].as_mode =
+ read_intra_mode_y(ec_ctx, xd, r, 0);
mi->bmi[2].as_mode = mi->bmi[3].as_mode = mbmi->mode =
- read_intra_mode_y(cm, xd, r, 0);
+ read_intra_mode_y(ec_ctx, xd, r, 0);
break;
default:
- mbmi->mode = read_intra_mode_y(cm, xd, r, size_group_lookup[bsize]);
+ mbmi->mode = read_intra_mode_y(ec_ctx, xd, r, size_group_lookup[bsize]);
}
#endif
#if CONFIG_CB4X4
if (is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x,
- xd->plane[1].subsampling_y))
- mbmi->uv_mode = read_intra_mode_uv(cm, xd, r, mbmi->mode);
+ xd->plane[1].subsampling_y)) {
+ mbmi->uv_mode = read_intra_mode_uv(ec_ctx, xd, r, mbmi->mode);
#else
- mbmi->uv_mode = read_intra_mode_uv(cm, xd, r, mbmi->mode);
+ mbmi->uv_mode = read_intra_mode_uv(ec_ctx, xd, r, mbmi->mode);
(void)mi_row;
(void)mi_col;
#endif
+#if CONFIG_CFL
+ // TODO(ltrudeau) support PALETTE
+ if (mbmi->uv_mode == DC_PRED) {
+ mbmi->cfl_alpha_idx = read_cfl_alphas(
+#if CONFIG_EC_ADAPT
+ xd->tile_ctx,
+#else
+ cm->fc,
+#endif // CONFIG_EC_ADAPT
+ r, mbmi->skip, mbmi->cfl_alpha_signs);
+ }
+#endif // CONFIG_CFL
+
+#if CONFIG_CB4X4
+ }
+#endif
+
#if CONFIG_EXT_INTRA
read_intra_angle_info(cm, xd, r);
#endif // CONFIG_EXT_INTRA
@@ -1453,7 +1457,7 @@ static void read_intra_block_mode_info(AV1_COMMON *const cm, const int mi_row,
mbmi->filter_intra_mode_info.use_filter_intra_mode[0] = 0;
mbmi->filter_intra_mode_info.use_filter_intra_mode[1] = 0;
if (bsize >= BLOCK_8X8 || CONFIG_CB4X4)
- read_filter_intra_mode_info(cm, xd, r);
+ read_filter_intra_mode_info(cm, xd, mi_row, mi_col, r);
#endif // CONFIG_FILTER_INTRA
}
@@ -1477,7 +1481,6 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
FRAME_CONTEXT *ec_ctx = cm->fc;
#endif
BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
-#if CONFIG_REF_MV
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
#if CONFIG_CB4X4
int_mv *pred_mv = mbmi->pred_mv;
@@ -1486,9 +1489,6 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
int_mv *pred_mv =
(bsize >= BLOCK_8X8) ? mbmi->pred_mv : xd->mi[0]->bmi[block].pred_mv;
#endif // CONFIG_CB4X4
-#else
- (void)block;
-#endif // CONFIG_REF_MV
(void)ref_frame;
(void)cm;
(void)mi_row;
@@ -1498,12 +1498,7 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
switch (mode) {
case NEWMV: {
FRAME_COUNTS *counts = xd->counts;
-#if !CONFIG_REF_MV
- nmv_context *const nmvc = &ec_ctx->nmvc;
- nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL;
-#endif
for (i = 0; i < 1 + is_compound; ++i) {
-#if CONFIG_REF_MV
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx =
av1_nmv_ctx(xd->ref_mv_count[rf_type], xd->ref_mv_stack[rf_type], i,
@@ -1511,13 +1506,10 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
nmv_context *const nmvc = &ec_ctx->nmvc[nmv_ctx];
nmv_context_counts *const mv_counts =
counts ? &counts->mv[nmv_ctx] : NULL;
-#endif
read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, nmvc, mv_counts, allow_hp);
ret = ret && is_mv_valid(&mv[i].as_mv);
-#if CONFIG_REF_MV
pred_mv[i].as_int = ref_mv[i].as_int;
-#endif
}
break;
}
@@ -1525,20 +1517,16 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
mv[0].as_int = nearest_mv[0].as_int;
if (is_compound) mv[1].as_int = nearest_mv[1].as_int;
-#if CONFIG_REF_MV
pred_mv[0].as_int = nearest_mv[0].as_int;
if (is_compound) pred_mv[1].as_int = nearest_mv[1].as_int;
-#endif
break;
}
case NEARMV: {
mv[0].as_int = near_mv[0].as_int;
if (is_compound) mv[1].as_int = near_mv[1].as_int;
-#if CONFIG_REF_MV
pred_mv[0].as_int = near_mv[0].as_int;
if (is_compound) pred_mv[1].as_int = near_mv[1].as_int;
-#endif
break;
}
case ZEROMV: {
@@ -1557,22 +1545,15 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
if (is_compound) mv[1].as_int = 0;
#endif // CONFIG_GLOBAL_MOTION
-#if CONFIG_REF_MV
pred_mv[0].as_int = mv[0].as_int;
if (is_compound) pred_mv[1].as_int = mv[1].as_int;
-#endif
break;
}
#if CONFIG_EXT_INTER
case NEW_NEWMV: {
FRAME_COUNTS *counts = xd->counts;
-#if !CONFIG_REF_MV
- nmv_context *const nmvc = &ec_ctx->nmvc;
- nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL;
-#endif
assert(is_compound);
for (i = 0; i < 2; ++i) {
-#if CONFIG_REF_MV
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx =
av1_nmv_ctx(xd->ref_mv_count[rf_type], xd->ref_mv_stack[rf_type], i,
@@ -1580,7 +1561,6 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
nmv_context *const nmvc = &ec_ctx->nmvc[nmv_ctx];
nmv_context_counts *const mv_counts =
counts ? &counts->mv[nmv_ctx] : NULL;
-#endif
read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, nmvc, mv_counts, allow_hp);
ret = ret && is_mv_valid(&mv[i].as_mv);
}
@@ -1592,18 +1572,6 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
mv[1].as_int = nearest_mv[1].as_int;
break;
}
- case NEAREST_NEARMV: {
- assert(is_compound);
- mv[0].as_int = nearest_mv[0].as_int;
- mv[1].as_int = near_mv[1].as_int;
- break;
- }
- case NEAR_NEARESTMV: {
- assert(is_compound);
- mv[0].as_int = near_mv[0].as_int;
- mv[1].as_int = nearest_mv[1].as_int;
- break;
- }
case NEAR_NEARMV: {
assert(is_compound);
mv[0].as_int = near_mv[0].as_int;
@@ -1612,17 +1580,12 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
}
case NEW_NEARESTMV: {
FRAME_COUNTS *counts = xd->counts;
-#if CONFIG_REF_MV
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx = av1_nmv_ctx(xd->ref_mv_count[rf_type],
xd->ref_mv_stack[rf_type], 0, mbmi->ref_mv_idx);
nmv_context *const nmvc = &ec_ctx->nmvc[nmv_ctx];
nmv_context_counts *const mv_counts =
counts ? &counts->mv[nmv_ctx] : NULL;
-#else
- nmv_context *const nmvc = &ec_ctx->nmvc;
- nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL;
-#endif
read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, nmvc, mv_counts, allow_hp);
assert(is_compound);
ret = ret && is_mv_valid(&mv[0].as_mv);
@@ -1631,17 +1594,12 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
}
case NEAREST_NEWMV: {
FRAME_COUNTS *counts = xd->counts;
-#if CONFIG_REF_MV
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx = av1_nmv_ctx(xd->ref_mv_count[rf_type],
xd->ref_mv_stack[rf_type], 1, mbmi->ref_mv_idx);
nmv_context_counts *const mv_counts =
counts ? &counts->mv[nmv_ctx] : NULL;
nmv_context *const nmvc = &ec_ctx->nmvc[nmv_ctx];
-#else
- nmv_context *const nmvc = &ec_ctx->nmvc;
- nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL;
-#endif
mv[0].as_int = nearest_mv[0].as_int;
read_mv(r, &mv[1].as_mv, &ref_mv[1].as_mv, nmvc, mv_counts, allow_hp);
assert(is_compound);
@@ -1650,17 +1608,12 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
}
case NEAR_NEWMV: {
FRAME_COUNTS *counts = xd->counts;
-#if CONFIG_REF_MV
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx = av1_nmv_ctx(xd->ref_mv_count[rf_type],
xd->ref_mv_stack[rf_type], 1, mbmi->ref_mv_idx);
nmv_context *const nmvc = &ec_ctx->nmvc[nmv_ctx];
nmv_context_counts *const mv_counts =
counts ? &counts->mv[nmv_ctx] : NULL;
-#else
- nmv_context *const nmvc = &ec_ctx->nmvc;
- nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL;
-#endif
mv[0].as_int = near_mv[0].as_int;
read_mv(r, &mv[1].as_mv, &ref_mv[1].as_mv, nmvc, mv_counts, allow_hp);
assert(is_compound);
@@ -1670,17 +1623,12 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
}
case NEW_NEARMV: {
FRAME_COUNTS *counts = xd->counts;
-#if CONFIG_REF_MV
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx = av1_nmv_ctx(xd->ref_mv_count[rf_type],
xd->ref_mv_stack[rf_type], 0, mbmi->ref_mv_idx);
nmv_context *const nmvc = &ec_ctx->nmvc[nmv_ctx];
nmv_context_counts *const mv_counts =
counts ? &counts->mv[nmv_ctx] : NULL;
-#else
- nmv_context *const nmvc = &ec_ctx->nmvc;
- nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL;
-#endif
read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, nmvc, mv_counts, allow_hp);
assert(is_compound);
ret = ret && is_mv_valid(&mv[0].as_mv);
@@ -1748,9 +1696,9 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
int_mv ref_mvs[MODE_CTX_REF_FRAMES][MAX_MV_REF_CANDIDATES];
int ref, is_compound;
int16_t inter_mode_ctx[MODE_CTX_REF_FRAMES];
-#if CONFIG_REF_MV && CONFIG_EXT_INTER
+#if CONFIG_EXT_INTER
int16_t compound_inter_mode_ctx[MODE_CTX_REF_FRAMES];
-#endif // CONFIG_REF_MV && CONFIG_EXT_INTER
+#endif // CONFIG_EXT_INTER
int16_t mode_ctx = 0;
#if CONFIG_WARPED_MOTION
int pts[SAMPLES_ARRAY_SIZE], pts_inref[SAMPLES_ARRAY_SIZE];
@@ -1761,6 +1709,8 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
FRAME_CONTEXT *ec_ctx = cm->fc;
#endif
+ assert(NELEMENTS(mode_2_counter) == MB_MODE_COUNT);
+
#if CONFIG_PALETTE
mbmi->palette_mode_info.palette_size[0] = 0;
mbmi->palette_mode_info.palette_size[1] = 0;
@@ -1774,18 +1724,14 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
for (ref = 0; ref < 1 + is_compound; ++ref) {
MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref];
- av1_find_mv_refs(cm, xd, mi, frame,
-#if CONFIG_REF_MV
- &xd->ref_mv_count[frame], xd->ref_mv_stack[frame],
+ av1_find_mv_refs(
+ cm, xd, mi, frame, &xd->ref_mv_count[frame], xd->ref_mv_stack[frame],
#if CONFIG_EXT_INTER
- compound_inter_mode_ctx,
+ compound_inter_mode_ctx,
#endif // CONFIG_EXT_INTER
-#endif
- ref_mvs[frame], mi_row, mi_col, fpm_sync, (void *)pbi,
- inter_mode_ctx);
+ ref_mvs[frame], mi_row, mi_col, fpm_sync, (void *)pbi, inter_mode_ctx);
}
-#if CONFIG_REF_MV
if (is_compound) {
MV_REFERENCE_FRAME ref_frame = av1_ref_frame_type(mbmi->ref_frame);
av1_find_mv_refs(cm, xd, mi, ref_frame, &xd->ref_mv_count[ref_frame],
@@ -1833,9 +1779,6 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
mode_ctx =
av1_mode_context_analyzer(inter_mode_ctx, mbmi->ref_frame, bsize, -1);
mbmi->ref_mv_idx = 0;
-#else
- mode_ctx = inter_mode_ctx[mbmi->ref_frame[0]];
-#endif
if (segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
mbmi->mode = ZEROMV;
@@ -1852,7 +1795,6 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
else
#endif // CONFIG_EXT_INTER
mbmi->mode = read_inter_mode(ec_ctx, xd, r, mode_ctx);
-#if CONFIG_REF_MV
#if CONFIG_EXT_INTER
if (mbmi->mode == NEWMV || mbmi->mode == NEW_NEWMV ||
have_nearmv_in_inter_mode(mbmi->mode))
@@ -1860,7 +1802,6 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
if (mbmi->mode == NEARMV || mbmi->mode == NEWMV)
#endif
read_drl_idx(cm, xd, mbmi, r);
-#endif
}
}
@@ -1876,7 +1817,6 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
}
}
-#if CONFIG_REF_MV
if (mbmi->ref_mv_idx > 0) {
int_mv cur_mv =
xd->ref_mv_stack[mbmi->ref_frame[0]][1 + mbmi->ref_mv_idx].this_mv;
@@ -1905,10 +1845,10 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
lower_mv_precision(&nearestmv[0].as_mv, allow_hp);
lower_mv_precision(&nearestmv[1].as_mv, allow_hp);
#if CONFIG_EXT_INTER
- } else if (mbmi->mode == NEAREST_NEWMV || mbmi->mode == NEAREST_NEARMV) {
+ } else if (mbmi->mode == NEAREST_NEWMV) {
nearestmv[0] = xd->ref_mv_stack[ref_frame_type][0].this_mv;
lower_mv_precision(&nearestmv[0].as_mv, allow_hp);
- } else if (mbmi->mode == NEW_NEARESTMV || mbmi->mode == NEAR_NEARESTMV) {
+ } else if (mbmi->mode == NEW_NEARESTMV) {
nearestmv[1] = xd->ref_mv_stack[ref_frame_type][0].comp_mv;
lower_mv_precision(&nearestmv[1].as_mv, allow_hp);
}
@@ -1938,7 +1878,6 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
}
#endif // CONFIG_EXT_INTER
}
-#endif
#if !CONFIG_DUAL_FILTER && !CONFIG_WARPED_MOTION && !CONFIG_GLOBAL_MOTION
read_mb_interp_filter(cm, xd, mbmi, r);
@@ -1958,13 +1897,11 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
int_mv block[2];
const int j = idy * 2 + idx;
int_mv ref_mv_s8[2];
-#if CONFIG_REF_MV
#if CONFIG_EXT_INTER
if (!is_compound)
#endif // CONFIG_EXT_INTER
mode_ctx = av1_mode_context_analyzer(inter_mode_ctx, mbmi->ref_frame,
bsize, j);
-#endif
#if CONFIG_EXT_INTER
if (is_compound)
b_mode = read_inter_compound_mode(cm, xd, r, mode_ctx);
@@ -1977,10 +1914,8 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
#else
if (b_mode != ZEROMV) {
#endif // CONFIG_EXT_INTER
-#if CONFIG_REF_MV
CANDIDATE_MV ref_mv_stack[2][MAX_REF_MV_STACK_SIZE];
uint8_t ref_mv_count[2];
-#endif
for (ref = 0; ref < 1 + is_compound; ++ref)
#if CONFIG_EXT_INTER
{
@@ -1989,9 +1924,7 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
j, mi_row, mi_col, NULL);
#endif // CONFIG_EXT_INTER
av1_append_sub8x8_mvs_for_idx(cm, xd, j, ref, mi_row, mi_col,
-#if CONFIG_REF_MV
ref_mv_stack[ref], &ref_mv_count[ref],
-#endif
#if CONFIG_EXT_INTER
mv_ref_list,
#endif // CONFIG_EXT_INTER
@@ -2009,12 +1942,8 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
}
for (ref = 0; ref < 1 + is_compound && b_mode != ZEROMV; ++ref) {
-#if CONFIG_REF_MV
ref_mv_s8[ref] = nearest_sub8x8[ref];
lower_mv_precision(&ref_mv_s8[ref].as_mv, allow_hp);
-#else
- ref_mv_s8[ref] = nearestmv[ref];
-#endif
}
#if CONFIG_EXT_INTER
(void)ref_mv_s8;
@@ -2041,10 +1970,8 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
}
}
-#if CONFIG_REF_MV
mbmi->pred_mv[0].as_int = mi->bmi[3].pred_mv[0].as_int;
mbmi->pred_mv[1].as_int = mi->bmi[3].pred_mv[1].as_int;
-#endif
mi->mbmi.mode = b_mode;
mbmi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int;
@@ -2056,42 +1983,35 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
#if CONFIG_EXT_INTER
if (is_compound) {
-#if CONFIG_REF_MV
int ref_mv_idx = mbmi->ref_mv_idx;
// Special case: NEAR_NEWMV and NEW_NEARMV modes use
// 1 + mbmi->ref_mv_idx (like NEARMV) instead of
// mbmi->ref_mv_idx (like NEWMV)
if (mbmi->mode == NEAR_NEWMV || mbmi->mode == NEW_NEARMV)
ref_mv_idx = 1 + mbmi->ref_mv_idx;
-#endif
if (compound_ref0_mode(mbmi->mode) == NEWMV) {
-#if CONFIG_REF_MV
uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame);
if (xd->ref_mv_count[ref_frame_type] > 1) {
ref_mv[0] = xd->ref_mv_stack[ref_frame_type][ref_mv_idx].this_mv;
clamp_mv_ref(&ref_mv[0].as_mv, xd->n8_w << MI_SIZE_LOG2,
xd->n8_h << MI_SIZE_LOG2, xd);
}
-#endif
nearestmv[0] = ref_mv[0];
}
if (compound_ref1_mode(mbmi->mode) == NEWMV) {
-#if CONFIG_REF_MV
uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame);
if (xd->ref_mv_count[ref_frame_type] > 1) {
ref_mv[1] = xd->ref_mv_stack[ref_frame_type][ref_mv_idx].comp_mv;
clamp_mv_ref(&ref_mv[1].as_mv, xd->n8_w << MI_SIZE_LOG2,
xd->n8_h << MI_SIZE_LOG2, xd);
}
-#endif
nearestmv[1] = ref_mv[1];
}
} else {
#endif // CONFIG_EXT_INTER
if (mbmi->mode == NEWMV) {
for (ref = 0; ref < 1 + is_compound; ++ref) {
-#if CONFIG_REF_MV
uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame);
if (xd->ref_mv_count[ref_frame_type] > 1) {
ref_mv[ref] =
@@ -2102,7 +2022,6 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
clamp_mv_ref(&ref_mv[ref].as_mv, xd->n8_w << MI_SIZE_LOG2,
xd->n8_h << MI_SIZE_LOG2, xd);
}
-#endif
nearestmv[ref] = ref_mv[ref];
}
}
@@ -2116,13 +2035,13 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
aom_merge_corrupted_flag(&xd->corrupted, mv_corrupted_flag);
}
-#if CONFIG_EXT_INTER
+#if CONFIG_EXT_INTER && CONFIG_INTERINTRA
mbmi->use_wedge_interintra = 0;
if (cm->reference_mode != COMPOUND_REFERENCE &&
#if CONFIG_SUPERTX
!supertx_enabled &&
#endif
- is_interintra_allowed(mbmi)) {
+ cm->allow_interintra_compound && is_interintra_allowed(mbmi)) {
const int bsize_group = size_group_lookup[bsize];
const int interintra =
aom_read(r, cm->fc->interintra_prob[bsize_group], ACCT_STR);
@@ -2157,7 +2076,7 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
}
}
}
-#endif // CONFIG_EXT_INTER
+#endif // CONFIG_EXT_INTER && CONFIG_INTERINTRA
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
mbmi->motion_mode = SIMPLE_TRANSLATION;
@@ -2201,22 +2120,24 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
) {
if (is_any_masked_compound_used(bsize)) {
#if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
- mbmi->interinter_compound_type =
- aom_read_tree(r, av1_compound_type_tree,
- cm->fc->compound_type_prob[bsize], ACCT_STR);
-#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
+ if (cm->allow_masked_compound) {
+ mbmi->interinter_compound_type =
+ aom_read_tree(r, av1_compound_type_tree,
+ cm->fc->compound_type_prob[bsize], ACCT_STR);
#if CONFIG_WEDGE
- if (mbmi->interinter_compound_type == COMPOUND_WEDGE) {
- mbmi->wedge_index =
- aom_read_literal(r, get_wedge_bits_lookup(bsize), ACCT_STR);
- mbmi->wedge_sign = aom_read_bit(r, ACCT_STR);
- }
+ if (mbmi->interinter_compound_type == COMPOUND_WEDGE) {
+ mbmi->wedge_index =
+ aom_read_literal(r, get_wedge_bits_lookup(bsize), ACCT_STR);
+ mbmi->wedge_sign = aom_read_bit(r, ACCT_STR);
+ }
#endif // CONFIG_WEDGE
#if CONFIG_COMPOUND_SEGMENT
- if (mbmi->interinter_compound_type == COMPOUND_SEG) {
- mbmi->mask_type = aom_read_literal(r, MAX_SEG_MASK_BITS, ACCT_STR);
- }
+ if (mbmi->interinter_compound_type == COMPOUND_SEG) {
+ mbmi->mask_type = aom_read_literal(r, MAX_SEG_MASK_BITS, ACCT_STR);
+ }
#endif // CONFIG_COMPOUND_SEGMENT
+ }
+#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
} else {
mbmi->interinter_compound_type = COMPOUND_AVERAGE;
}
@@ -2278,9 +2199,10 @@ static void read_inter_frame_mode_info(AV1Decoder *const pbi,
inter_block = read_is_inter_block(cm, xd, mbmi->segment_id, r);
#if CONFIG_VAR_TX
- xd->above_txfm_context = cm->above_txfm_context + mi_col;
- xd->left_txfm_context =
- xd->left_txfm_context_buffer + (mi_row & MAX_MIB_MASK);
+ xd->above_txfm_context =
+ cm->above_txfm_context + (mi_col << TX_UNIT_WIDE_LOG2);
+ xd->left_txfm_context = xd->left_txfm_context_buffer +
+ ((mi_row & MAX_MIB_MASK) << TX_UNIT_HIGH_LOG2);
if (cm->tx_mode == TX_MODE_SELECT &&
#if CONFIG_CB4X4
@@ -2371,7 +2293,6 @@ void av1_read_mode_info(AV1Decoder *const pbi, MACROBLOCKD *xd,
if (frame_is_intra_only(cm)) {
read_intra_frame_mode_info(cm, xd, mi_row, mi_col, r);
-#if CONFIG_REF_MV
for (h = 0; h < y_mis; ++h) {
MV_REF *const frame_mv = frame_mvs + h * cm->mi_cols;
for (w = 0; w < x_mis; ++w) {
@@ -2380,7 +2301,6 @@ void av1_read_mode_info(AV1Decoder *const pbi, MACROBLOCKD *xd,
mv->ref_frame[1] = NONE_FRAME;
}
}
-#endif
} else {
read_inter_frame_mode_info(pbi, xd,
#if CONFIG_SUPERTX
@@ -2395,10 +2315,8 @@ void av1_read_mode_info(AV1Decoder *const pbi, MACROBLOCKD *xd,
mv->ref_frame[1] = mi->mbmi.ref_frame[1];
mv->mv[0].as_int = mi->mbmi.mv[0].as_int;
mv->mv[1].as_int = mi->mbmi.mv[1].as_int;
-#if CONFIG_REF_MV
mv->pred_mv[0].as_int = mi->mbmi.pred_mv[0].as_int;
mv->pred_mv[1].as_int = mi->mbmi.pred_mv[1].as_int;
-#endif
}
}
}
diff --git a/third_party/aom/av1/decoder/decoder.c b/third_party/aom/av1/decoder/decoder.c
index 1bd91086e..b4f37d4e7 100644
--- a/third_party/aom/av1/decoder/decoder.c
+++ b/third_party/aom/av1/decoder/decoder.c
@@ -50,7 +50,6 @@ static void initialize_dec(void) {
av1_init_wedge_masks();
#endif // CONFIG_EXT_INTER
init_done = 1;
-#if CONFIG_EC_MULTISYMBOL
av1_indices_from_tree(av1_intra_mode_ind, av1_intra_mode_inv,
av1_intra_mode_tree);
av1_indices_from_tree(av1_switchable_interp_ind, av1_switchable_interp_inv,
@@ -68,7 +67,6 @@ static void initialize_dec(void) {
#endif
av1_indices_from_tree(av1_inter_mode_ind, av1_inter_mode_inv,
av1_inter_mode_tree);
-#endif
}
}
diff --git a/third_party/aom/av1/decoder/decoder.h b/third_party/aom/av1/decoder/decoder.h
index 4a90b4ad5..139fde1c0 100644
--- a/third_party/aom/av1/decoder/decoder.h
+++ b/third_party/aom/av1/decoder/decoder.h
@@ -203,7 +203,7 @@ static INLINE void decrease_ref_count(int idx, RefCntBuffer *const frame_bufs,
}
}
-#if CONFIG_EXT_REFS
+#if CONFIG_EXT_REFS || CONFIG_TEMPMV_SIGNALING
static INLINE int dec_is_ref_frame_buf(AV1Decoder *const pbi,
RefCntBuffer *frame_buf) {
AV1_COMMON *const cm = &pbi->common;
diff --git a/third_party/aom/av1/decoder/decodetxb.c b/third_party/aom/av1/decoder/decodetxb.c
index e1db09775..90685a18d 100644
--- a/third_party/aom/av1/decoder/decodetxb.c
+++ b/third_party/aom/av1/decoder/decodetxb.c
@@ -169,7 +169,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
sign = aom_read_bit(r, ACCT_STR);
}
- ctx = get_level_ctx(tcoeffs, scan[c], bwl);
+ ctx = get_br_ctx(tcoeffs, scan[c], bwl);
if (cm->fc->coeff_lps[tx_size][plane_type][ctx] == 0) exit(0);
diff --git a/third_party/aom/av1/decoder/detokenize.c b/third_party/aom/av1/decoder/detokenize.c
index 494f1681f..2e3309c07 100644
--- a/third_party/aom/av1/decoder/detokenize.c
+++ b/third_party/aom/av1/decoder/detokenize.c
@@ -106,7 +106,7 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
dequant_val_type_nuq *dq_val,
#endif // CONFIG_NEW_QUANT
#if CONFIG_AOM_QM
- const qm_val_t *iqm[2][TX_SIZES],
+ const qm_val_t *iqm[2][TX_SIZES_ALL],
#endif // CONFIG_AOM_QM
int ctx, const int16_t *scan, const int16_t *nb,
int16_t *max_scan_line, aom_reader *r) {
@@ -123,7 +123,6 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
#endif // CONFIG_AOM_QM
int band, c = 0;
const int tx_size_ctx = txsize_sqr_map[tx_size];
-#if CONFIG_NEW_TOKENSET
aom_cdf_prob(*coef_head_cdfs)[COEFF_CONTEXTS][CDF_SIZE(ENTROPY_TOKENS)] =
ec_ctx->coef_head_cdfs[tx_size_ctx][type][ref];
aom_cdf_prob(*coef_tail_cdfs)[COEFF_CONTEXTS][CDF_SIZE(ENTROPY_TOKENS)] =
@@ -135,18 +134,6 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
unsigned int(*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1] = NULL;
unsigned int(*eob_branch_count)[COEFF_CONTEXTS] = NULL;
#endif
-#else
- aom_prob(*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
- ec_ctx->coef_probs[tx_size_ctx][type][ref];
- const aom_prob *prob;
-#if CONFIG_EC_MULTISYMBOL
- aom_cdf_prob(*coef_cdfs)[COEFF_CONTEXTS][CDF_SIZE(ENTROPY_TOKENS)] =
- ec_ctx->coef_cdfs[tx_size_ctx][type][ref];
- aom_cdf_prob(*cdf)[CDF_SIZE(ENTROPY_TOKENS)];
-#endif // CONFIG_EC_MULTISYMBOL
- unsigned int(*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1] = NULL;
- unsigned int(*eob_branch_count)[COEFF_CONTEXTS] = NULL;
-#endif // CONFIG_NEW_TOKENSET
uint8_t token_cache[MAX_TX_SQUARE];
const uint8_t *band_translate = get_band_translate(tx_size);
int dq_shift;
@@ -156,23 +143,17 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
const tran_low_t *dqv_val = &dq_val[0][0];
#endif // CONFIG_NEW_QUANT
(void)tx_type;
-#if CONFIG_AOM_QM
- (void)iqmatrix;
-#endif // CONFIG_AOM_QM
if (counts) {
-#if !CONFIG_NEW_TOKENSET || !CONFIG_EC_ADAPT
+#if !CONFIG_EC_ADAPT
coef_counts = counts->coef[tx_size_ctx][type][ref];
eob_branch_count = counts->eob_branch[tx_size_ctx][type][ref];
-#endif
-#if CONFIG_NEW_TOKENSET && !CONFIG_EC_ADAPT
blockz_count = counts->blockz_count[tx_size_ctx][type][ref][ctx];
#endif
}
dq_shift = av1_get_tx_scale(tx_size);
-#if CONFIG_NEW_TOKENSET
band = *band_translate++;
int more_data = 1;
@@ -238,12 +219,7 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
*max_scan_line = AOMMAX(*max_scan_line, scan[c]);
token_cache[scan[c]] = av1_pt_energy_class[token];
- val = token_to_value(r, token, tx_size,
-#if CONFIG_HIGHBITDEPTH
- xd->bd);
-#else
- 8);
-#endif // CONFIG_HIGHBITDEPTH
+ val = token_to_value(r, token, tx_size, xd->bd);
#if CONFIG_NEW_QUANT
v = av1_dequant_abscoeff_nuq(val, dqv, dqv_val);
@@ -258,11 +234,7 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
v = aom_read_bit(r, ACCT_STR) ? -v : v;
#if CONFIG_COEFFICIENT_RANGE_CHECKING
-#if CONFIG_HIGHBITDEPTH
check_range(v, xd->bd);
-#else
- check_range(v, 8);
-#endif // CONFIG_HIGHBITDEPTH
#endif // CONFIG_COEFFICIENT_RANGE_CHECKING
dqcoeff[scan[c]] = v;
@@ -273,94 +245,6 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
dqv = dq[1];
ctx = get_coef_context(nb, token_cache, c);
band = *band_translate++;
-
-#else // CONFIG_NEW_TOKENSET
- while (c < max_eob) {
- int val = -1;
- band = *band_translate++;
- prob = coef_probs[band][ctx];
- if (counts) ++eob_branch_count[band][ctx];
- if (!aom_read(r, prob[EOB_CONTEXT_NODE], ACCT_STR)) {
- INCREMENT_COUNT(EOB_MODEL_TOKEN);
- break;
- }
-
-#if CONFIG_NEW_QUANT
- dqv_val = &dq_val[band][0];
-#endif // CONFIG_NEW_QUANT
-
- while (!aom_read(r, prob[ZERO_CONTEXT_NODE], ACCT_STR)) {
- INCREMENT_COUNT(ZERO_TOKEN);
- dqv = dq[1];
- token_cache[scan[c]] = 0;
- ++c;
- if (c >= max_eob) return c; // zero tokens at the end (no eob token)
- ctx = get_coef_context(nb, token_cache, c);
- band = *band_translate++;
- prob = coef_probs[band][ctx];
-#if CONFIG_NEW_QUANT
- dqv_val = &dq_val[band][0];
-#endif // CONFIG_NEW_QUANT
- }
-
- *max_scan_line = AOMMAX(*max_scan_line, scan[c]);
-
-#if CONFIG_EC_MULTISYMBOL
- cdf = &coef_cdfs[band][ctx];
- token = ONE_TOKEN +
- aom_read_symbol(r, *cdf, CATEGORY6_TOKEN - ONE_TOKEN + 1, ACCT_STR);
- INCREMENT_COUNT(ONE_TOKEN + (token > ONE_TOKEN));
- assert(token != ZERO_TOKEN);
- val = token_to_value(r, token, tx_size,
-#if CONFIG_HIGHBITDEPTH
- xd->bd);
-#else
- 8);
-#endif // CONFIG_HIGHBITDEPTH
-#else // CONFIG_EC_MULTISYMBOL
- if (!aom_read(r, prob[ONE_CONTEXT_NODE], ACCT_STR)) {
- INCREMENT_COUNT(ONE_TOKEN);
- token = ONE_TOKEN;
- val = 1;
- } else {
- INCREMENT_COUNT(TWO_TOKEN);
- token = aom_read_tree(r, av1_coef_con_tree,
- av1_pareto8_full[prob[PIVOT_NODE] - 1], ACCT_STR);
- assert(token != ZERO_TOKEN && token != ONE_TOKEN);
- val = token_to_value(r, token, tx_size,
-#if CONFIG_HIGHBITDEPTH
- xd->bd);
-#else
- 8);
-#endif // CONFIG_HIGHBITDEPTH
- }
-#endif // CONFIG_EC_MULTISYMBOL
-#if CONFIG_NEW_QUANT
- v = av1_dequant_abscoeff_nuq(val, dqv, dqv_val);
- v = dq_shift ? ROUND_POWER_OF_TWO(v, dq_shift) : v;
-#else
-#if CONFIG_AOM_QM
- dqv = ((iqmatrix[scan[c]] * (int)dqv) + (1 << (AOM_QM_BITS - 1))) >>
- AOM_QM_BITS;
-#endif
- v = (val * dqv) >> dq_shift;
-#endif // CONFIG_NEW_QUANT
-
-#if CONFIG_COEFFICIENT_RANGE_CHECKING
-#if CONFIG_HIGHBITDEPTH
- dqcoeff[scan[c]] =
- highbd_check_range((aom_read_bit(r, ACCT_STR) ? -v : v), xd->bd);
-#else
- dqcoeff[scan[c]] = check_range(aom_read_bit(r, ACCT_STR) ? -v : v, 8);
-#endif // CONFIG_HIGHBITDEPTH
-#else
- dqcoeff[scan[c]] = aom_read_bit(r, ACCT_STR) ? -v : v;
-#endif // CONFIG_COEFFICIENT_RANGE_CHECKING
- token_cache[scan[c]] = av1_pt_energy_class[token];
- ++c;
- ctx = get_coef_context(nb, token_cache, c);
- dqv = dq[1];
-#endif // CONFIG_NEW_TOKENSET
}
return c;
diff --git a/third_party/aom/av1/decoder/inspection.c b/third_party/aom/av1/decoder/inspection.c
index 2e8a61087..926c77e17 100644
--- a/third_party/aom/av1/decoder/inspection.c
+++ b/third_party/aom/av1/decoder/inspection.c
@@ -14,6 +14,9 @@
#if CONFIG_CDEF
#include "av1/common/cdef.h"
#endif
+#if CONFIG_CFL
+#include "av1/common/cfl.h"
+#endif
void ifd_init(insp_frame_data *fd, int frame_width, int frame_height) {
fd->mi_cols = ALIGN_POWER_OF_TWO(frame_width, 3) >> MI_SIZE_LOG2;
@@ -97,6 +100,16 @@ int ifd_inspect(insp_frame_data *fd, void *decoder) {
cm->cdef_strengths[mbmi->cdef_strength] % CLPF_STRENGTHS;
mi->cdef_strength += mi->cdef_strength == 3;
#endif
+#if CONFIG_CFL
+ if (mbmi->uv_mode == DC_PRED) {
+ mi->cfl_alpha_idx = mbmi->cfl_alpha_idx;
+ mi->cfl_alpha_sign = (mbmi->cfl_alpha_signs[CFL_PRED_V] << CFL_PRED_V) +
+ mbmi->cfl_alpha_signs[CFL_PRED_U];
+ } else {
+ mi->cfl_alpha_idx = 0;
+ mi->cfl_alpha_sign = 0;
+ }
+#endif
}
}
return 1;
diff --git a/third_party/aom/av1/decoder/inspection.h b/third_party/aom/av1/decoder/inspection.h
index d6cf4319a..06a94b737 100644
--- a/third_party/aom/av1/decoder/inspection.h
+++ b/third_party/aom/av1/decoder/inspection.h
@@ -15,6 +15,7 @@
extern "C" {
#endif // __cplusplus
+#include "av1/common/seg_common.h"
#if CONFIG_ACCOUNTING
#include "av1/decoder/accounting.h"
#endif
@@ -49,6 +50,10 @@ struct insp_mi_data {
int8_t cdef_level;
int8_t cdef_strength;
#endif
+#if CONFIG_CFL
+ int8_t cfl_alpha_idx;
+ int8_t cfl_alpha_sign;
+#endif
};
typedef struct insp_frame_data insp_frame_data;
diff --git a/third_party/aom/av1/decoder/laplace_decoder.c b/third_party/aom/av1/decoder/laplace_decoder.c
index b6cf50bc7..5cc080ea7 100644
--- a/third_party/aom/av1/decoder/laplace_decoder.c
+++ b/third_party/aom/av1/decoder/laplace_decoder.c
@@ -39,10 +39,10 @@ static int aom_decode_pvq_split_(aom_reader *r, od_pvq_codeword_ctx *adapt,
count += msbs << shift;
if (count > sum) {
count = sum;
-#if CONFIG_DAALA_EC
+#if !CONFIG_ANS
r->ec.error = 1;
#else
-# error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
+# error "CONFIG_PVQ currently requires !CONFIG_ANS."
#endif
}
return count;
diff --git a/third_party/aom/av1/encoder/aq_cyclicrefresh.c b/third_party/aom/av1/encoder/aq_cyclicrefresh.c
index e41c608b6..b2b410617 100644
--- a/third_party/aom/av1/encoder/aq_cyclicrefresh.c
+++ b/third_party/aom/av1/encoder/aq_cyclicrefresh.c
@@ -353,8 +353,8 @@ void av1_cyclic_refresh_check_golden_update(AV1_COMP *const cpi) {
// frame because of the camera movement, set this frame as the golden frame.
// Use 70% and 5% as the thresholds for golden frame refreshing.
// Also, force this frame as a golden update frame if this frame will change
- // the resolution (resize_pending != 0).
- if (cpi->resize_pending != 0 ||
+ // the resolution (av1_resize_pending != 0).
+ if (av1_resize_pending(cpi) ||
(cnt1 * 10 > (70 * rows * cols) && cnt2 * 20 < cnt1)) {
av1_cyclic_refresh_set_golden_update(cpi);
rc->frames_till_gf_update_due = rc->baseline_gf_interval;
diff --git a/third_party/aom/av1/encoder/av1_quantize.c b/third_party/aom/av1/encoder/av1_quantize.c
index 6cffac264..63727df1f 100644
--- a/third_party/aom/av1/encoder/av1_quantize.c
+++ b/third_party/aom/av1/encoder/av1_quantize.c
@@ -1594,50 +1594,48 @@ static int get_qzbin_factor(int q, aom_bit_depth_t bit_depth) {
#endif
}
-void av1_init_quantizer(AV1_COMP *cpi) {
- AV1_COMMON *const cm = &cpi->common;
- QUANTS *const quants = &cpi->quants;
+void av1_build_quantizer(aom_bit_depth_t bit_depth, int y_dc_delta_q,
+ int uv_dc_delta_q, int uv_ac_delta_q,
+ QUANTS *const quants, Dequants *const deq) {
int i, q, quant;
-#if CONFIG_NEW_QUANT
- int dq;
-#endif
for (q = 0; q < QINDEX_RANGE; q++) {
- const int qzbin_factor = get_qzbin_factor(q, cm->bit_depth);
+ const int qzbin_factor = get_qzbin_factor(q, bit_depth);
const int qrounding_factor = q == 0 ? 64 : 48;
for (i = 0; i < 2; ++i) {
int qrounding_factor_fp = 64;
// y
- quant = i == 0 ? av1_dc_quant(q, cm->y_dc_delta_q, cm->bit_depth)
- : av1_ac_quant(q, 0, cm->bit_depth);
+ quant = i == 0 ? av1_dc_quant(q, y_dc_delta_q, bit_depth)
+ : av1_ac_quant(q, 0, bit_depth);
invert_quant(&quants->y_quant[q][i], &quants->y_quant_shift[q][i], quant);
quants->y_quant_fp[q][i] = (1 << 16) / quant;
quants->y_round_fp[q][i] = (qrounding_factor_fp * quant) >> 7;
quants->y_zbin[q][i] = ROUND_POWER_OF_TWO(qzbin_factor * quant, 7);
quants->y_round[q][i] = (qrounding_factor * quant) >> 7;
- cpi->y_dequant[q][i] = quant;
+ deq->y_dequant[q][i] = quant;
// uv
- quant = i == 0 ? av1_dc_quant(q, cm->uv_dc_delta_q, cm->bit_depth)
- : av1_ac_quant(q, cm->uv_ac_delta_q, cm->bit_depth);
+ quant = i == 0 ? av1_dc_quant(q, uv_dc_delta_q, bit_depth)
+ : av1_ac_quant(q, uv_ac_delta_q, bit_depth);
invert_quant(&quants->uv_quant[q][i], &quants->uv_quant_shift[q][i],
quant);
quants->uv_quant_fp[q][i] = (1 << 16) / quant;
quants->uv_round_fp[q][i] = (qrounding_factor_fp * quant) >> 7;
quants->uv_zbin[q][i] = ROUND_POWER_OF_TWO(qzbin_factor * quant, 7);
quants->uv_round[q][i] = (qrounding_factor * quant) >> 7;
- cpi->uv_dequant[q][i] = quant;
+ deq->uv_dequant[q][i] = quant;
}
#if CONFIG_NEW_QUANT
+ int dq;
for (dq = 0; dq < QUANT_PROFILES; dq++) {
for (i = 0; i < COEF_BANDS; i++) {
- const int y_quant = cpi->y_dequant[q][i != 0];
- const int uvquant = cpi->uv_dequant[q][i != 0];
- av1_get_dequant_val_nuq(y_quant, i, cpi->y_dequant_val_nuq[dq][q][i],
+ const int y_quant = deq->y_dequant[q][i != 0];
+ const int uvquant = deq->uv_dequant[q][i != 0];
+ av1_get_dequant_val_nuq(y_quant, i, deq->y_dequant_val_nuq[dq][q][i],
quants->y_cuml_bins_nuq[dq][q][i], dq);
- av1_get_dequant_val_nuq(uvquant, i, cpi->uv_dequant_val_nuq[dq][q][i],
+ av1_get_dequant_val_nuq(uvquant, i, deq->uv_dequant_val_nuq[dq][q][i],
quants->uv_cuml_bins_nuq[dq][q][i], dq);
}
}
@@ -1650,7 +1648,7 @@ void av1_init_quantizer(AV1_COMP *cpi) {
quants->y_quant_shift[q][i] = quants->y_quant_shift[q][1];
quants->y_zbin[q][i] = quants->y_zbin[q][1];
quants->y_round[q][i] = quants->y_round[q][1];
- cpi->y_dequant[q][i] = cpi->y_dequant[q][1];
+ deq->y_dequant[q][i] = deq->y_dequant[q][1];
quants->uv_quant[q][i] = quants->uv_quant[q][1];
quants->uv_quant_fp[q][i] = quants->uv_quant_fp[q][1];
@@ -1658,11 +1656,19 @@ void av1_init_quantizer(AV1_COMP *cpi) {
quants->uv_quant_shift[q][i] = quants->uv_quant_shift[q][1];
quants->uv_zbin[q][i] = quants->uv_zbin[q][1];
quants->uv_round[q][i] = quants->uv_round[q][1];
- cpi->uv_dequant[q][i] = cpi->uv_dequant[q][1];
+ deq->uv_dequant[q][i] = deq->uv_dequant[q][1];
}
}
}
+void av1_init_quantizer(AV1_COMP *cpi) {
+ AV1_COMMON *const cm = &cpi->common;
+ QUANTS *const quants = &cpi->quants;
+ Dequants *const dequants = &cpi->dequants;
+ av1_build_quantizer(cm->bit_depth, cm->y_dc_delta_q, cm->uv_dc_delta_q,
+ cm->uv_ac_delta_q, quants, dequants);
+}
+
void av1_init_plane_quantizers(const AV1_COMP *cpi, MACROBLOCK *x,
int segment_id) {
const AV1_COMMON *const cm = &cpi->common;
@@ -1712,11 +1718,12 @@ void av1_init_plane_quantizers(const AV1_COMP *cpi, MACROBLOCK *x,
memcpy(&xd->plane[0].seg_iqmatrix[segment_id], cm->giqmatrix[qmlevel][0],
sizeof(cm->giqmatrix[qmlevel][0]));
#endif
- xd->plane[0].dequant = cpi->y_dequant[qindex];
+ xd->plane[0].dequant = cpi->dequants.y_dequant[qindex];
#if CONFIG_NEW_QUANT
for (dq = 0; dq < QUANT_PROFILES; dq++) {
x->plane[0].cuml_bins_nuq[dq] = quants->y_cuml_bins_nuq[dq][qindex];
- xd->plane[0].dequant_val_nuq[dq] = cpi->y_dequant_val_nuq[dq][qindex];
+ xd->plane[0].dequant_val_nuq[dq] =
+ cpi->dequants.y_dequant_val_nuq[dq][qindex];
}
#endif // CONFIG_NEW_QUANT
@@ -1734,11 +1741,12 @@ void av1_init_plane_quantizers(const AV1_COMP *cpi, MACROBLOCK *x,
memcpy(&xd->plane[i].seg_iqmatrix[segment_id], cm->giqmatrix[qmlevel][1],
sizeof(cm->giqmatrix[qmlevel][1]));
#endif
- xd->plane[i].dequant = cpi->uv_dequant[qindex];
+ xd->plane[i].dequant = cpi->dequants.uv_dequant[qindex];
#if CONFIG_NEW_QUANT
for (dq = 0; dq < QUANT_PROFILES; dq++) {
x->plane[i].cuml_bins_nuq[dq] = quants->uv_cuml_bins_nuq[dq][qindex];
- xd->plane[i].dequant_val_nuq[dq] = cpi->uv_dequant_val_nuq[dq][qindex];
+ xd->plane[i].dequant_val_nuq[dq] =
+ cpi->dequants.uv_dequant_val_nuq[dq][qindex];
}
#endif // CONFIG_NEW_QUANT
}
diff --git a/third_party/aom/av1/encoder/av1_quantize.h b/third_party/aom/av1/encoder/av1_quantize.h
index c87b6b7dc..4bc9cccc2 100644
--- a/third_party/aom/av1/encoder/av1_quantize.h
+++ b/third_party/aom/av1/encoder/av1_quantize.h
@@ -69,6 +69,17 @@ typedef struct {
DECLARE_ALIGNED(16, int16_t, uv_round[QINDEX_RANGE][8]);
} QUANTS;
+typedef struct {
+ DECLARE_ALIGNED(16, int16_t, y_dequant[QINDEX_RANGE][8]); // 8: SIMD width
+ DECLARE_ALIGNED(16, int16_t, uv_dequant[QINDEX_RANGE][8]); // 8: SIMD width
+#if CONFIG_NEW_QUANT
+ DECLARE_ALIGNED(16, dequant_val_type_nuq,
+ y_dequant_val_nuq[QUANT_PROFILES][QINDEX_RANGE][COEF_BANDS]);
+ DECLARE_ALIGNED(16, dequant_val_type_nuq,
+ uv_dequant_val_nuq[QUANT_PROFILES][QINDEX_RANGE][COEF_BANDS]);
+#endif // CONFIG_NEW_QUANT
+} Dequants;
+
struct AV1_COMP;
struct AV1Common;
@@ -77,6 +88,10 @@ void av1_frame_init_quantizer(struct AV1_COMP *cpi);
void av1_init_plane_quantizers(const struct AV1_COMP *cpi, MACROBLOCK *x,
int segment_id);
+void av1_build_quantizer(aom_bit_depth_t bit_depth, int y_dc_delta_q,
+ int uv_dc_delta_q, int uv_ac_delta_q,
+ QUANTS *const quants, Dequants *const deq);
+
void av1_init_quantizer(struct AV1_COMP *cpi);
void av1_set_quantizer(struct AV1Common *cm, int q);
diff --git a/third_party/aom/av1/encoder/bitstream.c b/third_party/aom/av1/encoder/bitstream.c
index 7cc6179ea..f8378b14d 100644
--- a/third_party/aom/av1/encoder/bitstream.c
+++ b/third_party/aom/av1/encoder/bitstream.c
@@ -63,21 +63,12 @@
static struct av1_token intra_mode_encodings[INTRA_MODES];
static struct av1_token switchable_interp_encodings[SWITCHABLE_FILTERS];
-#if CONFIG_EXT_PARTITION_TYPES && !CONFIG_EC_MULTISYMBOL
-static const struct av1_token ext_partition_encodings[EXT_PARTITION_TYPES] = {
- { 0, 1 }, { 4, 3 }, { 12, 4 }, { 7, 3 },
- { 10, 4 }, { 11, 4 }, { 26, 5 }, { 27, 5 }
-};
-#endif
static struct av1_token partition_encodings[PARTITION_TYPES];
-#if !CONFIG_REF_MV
-static struct av1_token inter_mode_encodings[INTER_MODES];
-#endif
#if CONFIG_EXT_INTER
static const struct av1_token
inter_compound_mode_encodings[INTER_COMPOUND_MODES] = {
- { 2, 2 }, { 50, 6 }, { 51, 6 }, { 24, 5 }, { 52, 6 },
- { 53, 6 }, { 54, 6 }, { 55, 6 }, { 0, 1 }, { 7, 3 }
+ { 2, 2 }, { 12, 4 }, { 52, 6 }, { 53, 6 },
+ { 54, 6 }, { 55, 6 }, { 0, 1 }, { 7, 3 }
};
#endif // CONFIG_EXT_INTER
#if CONFIG_PALETTE
@@ -85,16 +76,6 @@ static struct av1_token palette_size_encodings[PALETTE_SIZES];
static struct av1_token palette_color_index_encodings[PALETTE_SIZES]
[PALETTE_COLORS];
#endif // CONFIG_PALETTE
-#if !CONFIG_EC_MULTISYMBOL
-static const struct av1_token tx_size_encodings[MAX_TX_DEPTH][TX_SIZES] = {
- { { 0, 1 }, { 1, 1 } }, // Max tx_size is 8X8
- { { 0, 1 }, { 2, 2 }, { 3, 2 } }, // Max tx_size is 16X16
- { { 0, 1 }, { 2, 2 }, { 6, 3 }, { 7, 3 } }, // Max tx_size is 32X32
-#if CONFIG_TX64X64
- { { 0, 1 }, { 2, 2 }, { 6, 3 }, { 14, 4 }, { 15, 4 } }, // Max tx_size 64X64
-#endif // CONFIG_TX64X64
-};
-#endif
#if CONFIG_EXT_INTRA || CONFIG_FILTER_INTRA || CONFIG_PALETTE
static INLINE void write_uniform(aom_writer *w, int n, int v) {
@@ -125,7 +106,9 @@ static struct av1_token intra_filter_encodings[INTRA_FILTERS];
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
#if CONFIG_EXT_INTER
+#if CONFIG_INTERINTRA
static struct av1_token interintra_mode_encodings[INTERINTRA_MODES];
+#endif
#if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
static struct av1_token compound_type_encodings[COMPOUND_TYPES];
#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
@@ -162,9 +145,6 @@ void av1_encode_token_init(void) {
av1_tokens_from_tree(intra_mode_encodings, av1_intra_mode_tree);
av1_tokens_from_tree(switchable_interp_encodings, av1_switchable_interp_tree);
av1_tokens_from_tree(partition_encodings, av1_partition_tree);
-#if !CONFIG_REF_MV
- av1_tokens_from_tree(inter_mode_encodings, av1_inter_mode_tree);
-#endif
#if CONFIG_PALETTE
av1_tokens_from_tree(palette_size_encodings, av1_palette_size_tree);
@@ -178,7 +158,9 @@ void av1_encode_token_init(void) {
av1_tokens_from_tree(intra_filter_encodings, av1_intra_filter_tree);
#endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
#if CONFIG_EXT_INTER
+#if CONFIG_INTERINTRA
av1_tokens_from_tree(interintra_mode_encodings, av1_interintra_mode_tree);
+#endif // CONFIG_INTERINTRA
#if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
av1_tokens_from_tree(compound_type_encodings, av1_compound_type_tree);
#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
@@ -195,7 +177,6 @@ void av1_encode_token_init(void) {
av1_switchable_restore_tree);
#endif // CONFIG_LOOP_RESTORATION
-#if CONFIG_EC_MULTISYMBOL
/* This hack is necessary when CONFIG_DUAL_FILTER is enabled because the five
SWITCHABLE_FILTERS are not consecutive, e.g., 0, 1, 2, 3, 4, when doing
an in-order traversal of the av1_switchable_interp_tree structure. */
@@ -218,7 +199,6 @@ void av1_encode_token_init(void) {
av1_intra_mode_tree);
av1_indices_from_tree(av1_inter_mode_ind, av1_inter_mode_inv,
av1_inter_mode_tree);
-#endif
}
static void write_intra_mode_kf(const AV1_COMMON *cm, FRAME_CONTEXT *frame_ctx,
@@ -228,37 +208,28 @@ static void write_intra_mode_kf(const AV1_COMMON *cm, FRAME_CONTEXT *frame_ctx,
#if CONFIG_INTRABC
assert(!is_intrabc_block(&mi->mbmi));
#endif // CONFIG_INTRABC
-#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, av1_intra_mode_ind[mode],
get_y_mode_cdf(frame_ctx, mi, above_mi, left_mi, block),
INTRA_MODES);
(void)cm;
-#else
- av1_write_token(w, av1_intra_mode_tree,
- get_y_mode_probs(cm, mi, above_mi, left_mi, block),
- &intra_mode_encodings[mode]);
- (void)frame_ctx;
-#endif
}
-#if CONFIG_EXT_INTER
+#if CONFIG_EXT_INTER && CONFIG_INTERINTRA
static void write_interintra_mode(aom_writer *w, INTERINTRA_MODE mode,
const aom_prob *probs) {
av1_write_token(w, av1_interintra_mode_tree, probs,
&interintra_mode_encodings[mode]);
}
-#endif // CONFIG_EXT_INTER
+#endif // CONFIG_EXT_INTER && CONFIG_INTERINTRA
static void write_inter_mode(aom_writer *w, PREDICTION_MODE mode,
FRAME_CONTEXT *ec_ctx, const int16_t mode_ctx) {
-#if CONFIG_REF_MV
const int16_t newmv_ctx = mode_ctx & NEWMV_CTX_MASK;
const aom_prob newmv_prob = ec_ctx->newmv_prob[newmv_ctx];
-#define IS_NEWMV_MODE(mode) ((mode) == NEWMV)
- aom_write(w, !IS_NEWMV_MODE(mode), newmv_prob);
+ aom_write(w, mode != NEWMV, newmv_prob);
- if (!IS_NEWMV_MODE(mode)) {
+ if (mode != NEWMV) {
const int16_t zeromv_ctx = (mode_ctx >> ZEROMV_OFFSET) & ZEROMV_CTX_MASK;
const aom_prob zeromv_prob = ec_ctx->zeromv_prob[zeromv_ctx];
@@ -281,25 +252,8 @@ static void write_inter_mode(aom_writer *w, PREDICTION_MODE mode,
aom_write(w, mode != NEARESTMV, refmv_prob);
}
}
-
-#undef IS_NEWMV_MODE
-
-#else // !CONFIG_REF_MV
- assert(is_inter_mode(mode));
-#if CONFIG_EC_MULTISYMBOL
- aom_write_symbol(w, av1_inter_mode_ind[INTER_OFFSET(mode)],
- ec_ctx->inter_mode_cdf[mode_ctx], INTER_MODES);
-#else
- {
- const aom_prob *const inter_probs = ec_ctx->inter_mode_probs[mode_ctx];
- av1_write_token(w, av1_inter_mode_tree, inter_probs,
- &inter_mode_encodings[INTER_OFFSET(mode)]);
- }
-#endif
-#endif
}
-#if CONFIG_REF_MV
static void write_drl_idx(const AV1_COMMON *cm, const MB_MODE_INFO *mbmi,
const MB_MODE_INFO_EXT *mbmi_ext, aom_writer *w) {
uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame);
@@ -341,7 +295,6 @@ static void write_drl_idx(const AV1_COMMON *cm, const MB_MODE_INFO *mbmi,
return;
}
}
-#endif
#if CONFIG_EXT_INTER
static void write_inter_compound_mode(AV1_COMMON *cm, aom_writer *w,
@@ -409,22 +362,22 @@ static void write_tx_size_vartx(const AV1_COMMON *cm, const MACROBLOCKD *xd,
const int max_blocks_high = max_block_high(xd, mbmi->sb_type, 0);
const int max_blocks_wide = max_block_wide(xd, mbmi->sb_type, 0);
- int ctx = txfm_partition_context(xd->above_txfm_context + tx_col,
- xd->left_txfm_context + tx_row,
+ int ctx = txfm_partition_context(xd->above_txfm_context + blk_col,
+ xd->left_txfm_context + blk_row,
mbmi->sb_type, tx_size);
if (blk_row >= max_blocks_high || blk_col >= max_blocks_wide) return;
if (depth == MAX_VARTX_DEPTH) {
- txfm_partition_update(xd->above_txfm_context + tx_col,
- xd->left_txfm_context + tx_row, tx_size, tx_size);
+ txfm_partition_update(xd->above_txfm_context + blk_col,
+ xd->left_txfm_context + blk_row, tx_size, tx_size);
return;
}
if (tx_size == mbmi->inter_tx_size[tx_row][tx_col]) {
aom_write(w, 0, cm->fc->txfm_partition_prob[ctx]);
- txfm_partition_update(xd->above_txfm_context + tx_col,
- xd->left_txfm_context + tx_row, tx_size, tx_size);
+ txfm_partition_update(xd->above_txfm_context + blk_col,
+ xd->left_txfm_context + blk_row, tx_size, tx_size);
} else {
const TX_SIZE sub_txs = sub_tx_size_map[tx_size];
const int bsl = tx_size_wide_unit[sub_txs];
@@ -433,8 +386,8 @@ static void write_tx_size_vartx(const AV1_COMMON *cm, const MACROBLOCKD *xd,
aom_write(w, 1, cm->fc->txfm_partition_prob[ctx]);
if (tx_size == TX_8X8) {
- txfm_partition_update(xd->above_txfm_context + tx_col,
- xd->left_txfm_context + tx_row, sub_txs, tx_size);
+ txfm_partition_update(xd->above_txfm_context + blk_col,
+ xd->left_txfm_context + blk_row, sub_txs, tx_size);
return;
}
@@ -482,22 +435,18 @@ static void write_selected_tx_size(const AV1_COMMON *cm, const MACROBLOCKD *xd,
const int depth = tx_size_to_depth(coded_tx_size);
#if CONFIG_EXT_TX && CONFIG_RECT_TX
assert(IMPLIES(is_rect_tx(tx_size), is_rect_tx_allowed(xd, mbmi)));
- assert(
- IMPLIES(is_rect_tx(tx_size), tx_size == max_txsize_rect_lookup[bsize]));
#endif // CONFIG_EXT_TX && CONFIG_RECT_TX
-#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, depth, ec_ctx->tx_size_cdf[tx_size_cat][tx_size_ctx],
tx_size_cat + 2);
-#else
- av1_write_token(w, av1_tx_size_tree[tx_size_cat],
- ec_ctx->tx_size_probs[tx_size_cat][tx_size_ctx],
- &tx_size_encodings[tx_size_cat][depth]);
-#endif
+#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
+ if (is_quarter_tx_allowed(xd, mbmi, is_inter) && tx_size != coded_tx_size)
+ aom_write(w, tx_size == quarter_txsize_lookup[bsize],
+ cm->fc->quarter_tx_size_prob);
+#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
}
}
-#if CONFIG_REF_MV
static void update_inter_mode_probs(AV1_COMMON *cm, aom_writer *w,
FRAME_COUNTS *counts) {
int i;
@@ -519,7 +468,6 @@ static void update_inter_mode_probs(AV1_COMMON *cm, aom_writer *w,
av1_cond_prob_diff_update(w, &cm->fc->drl_prob[i], counts->drl_mode[i],
probwt);
}
-#endif
#if CONFIG_EXT_INTER
static void update_inter_compound_mode_probs(AV1_COMMON *cm, int probwt,
@@ -598,17 +546,8 @@ static void write_delta_qindex(const AV1_COMMON *cm, const MACROBLOCKD *xd,
(void)xd;
#endif
-#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, AOMMIN(abs, DELTA_Q_SMALL), ec_ctx->delta_q_cdf,
DELTA_Q_PROBS + 1);
-#else
- int i = 0;
- while (i < DELTA_Q_SMALL && i <= abs) {
- int bit = (i < abs);
- aom_write(w, bit, ec_ctx->delta_q_prob[i]);
- i++;
- }
-#endif
if (!smallval) {
rem_bits = OD_ILOG_NZ(abs - 1) - 1;
@@ -655,17 +594,8 @@ static void write_delta_lflevel(const AV1_COMMON *cm, const MACROBLOCKD *xd,
(void)xd;
#endif
-#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, AOMMIN(abs, DELTA_LF_SMALL), ec_ctx->delta_lf_cdf,
DELTA_LF_PROBS + 1);
-#else
- int i = 0;
- while (i < DELTA_LF_SMALL && i <= abs) {
- int bit = (i < abs);
- aom_write(w, bit, ec_ctx->delta_lf_prob[i]);
- i++;
- }
-#endif // CONFIG_EC_MULTISYMBOL
if (!smallval) {
rem_bits = OD_ILOG_NZ(abs - 1) - 1;
@@ -908,7 +838,7 @@ static INLINE void write_coeff_extra(const aom_prob *pb, int value,
}
#endif
-#if CONFIG_NEW_TOKENSET && !CONFIG_LV_MAP
+#if !CONFIG_LV_MAP
static void pack_mb_tokens(aom_writer *w, const TOKENEXTRA **tp,
const TOKENEXTRA *const stop,
aom_bit_depth_t bit_depth, const TX_SIZE tx_size,
@@ -921,18 +851,22 @@ static void pack_mb_tokens(aom_writer *w, const TOKENEXTRA **tp,
while (p < stop && p->token != EOSB_TOKEN) {
const int token = p->token;
+ const int eob_val = p->eob_val;
if (token == BLOCK_Z_TOKEN) {
aom_write_symbol(w, 0, *p->head_cdf, HEAD_TOKENS + 1);
p++;
+#if CONFIG_VAR_TX
+ break;
+#endif
continue;
}
const av1_extra_bit *const extra_bits = &av1_extra_bits[token];
- if (p->eob_val == LAST_EOB) {
+ if (eob_val == LAST_EOB) {
// Just code a flag indicating whether the value is >1 or 1.
aom_write_bit(w, token != ONE_TOKEN);
} else {
- int comb_symb = 2 * AOMMIN(token, TWO_TOKEN) - p->eob_val + p->first_val;
+ int comb_symb = 2 * AOMMIN(token, TWO_TOKEN) - eob_val + p->first_val;
aom_write_symbol(w, comb_symb, *p->head_cdf, HEAD_TOKENS + p->first_val);
}
if (token > ONE_TOKEN) {
@@ -966,104 +900,13 @@ static void pack_mb_tokens(aom_writer *w, const TOKENEXTRA **tp,
#if CONFIG_VAR_TX
++count;
- if (token == EOB_TOKEN || count == seg_eob) break;
-#endif
- }
-
- *tp = p;
-}
-#else // CONFIG_NEW_TOKENSET
-#if !CONFIG_LV_MAP
-static void pack_mb_tokens(aom_writer *w, const TOKENEXTRA **tp,
- const TOKENEXTRA *const stop,
- aom_bit_depth_t bit_depth, const TX_SIZE tx_size,
- TOKEN_STATS *token_stats) {
- const TOKENEXTRA *p = *tp;
-#if CONFIG_VAR_TX
- int count = 0;
- const int seg_eob = tx_size_2d[tx_size];
-#endif
-
- while (p < stop && p->token != EOSB_TOKEN) {
- const int token = p->token;
-#if !CONFIG_EC_MULTISYMBOL
- const struct av1_token *const coef_encoding = &av1_coef_encodings[token];
- int coef_value = coef_encoding->value;
- int coef_length = coef_encoding->len;
-#endif // !CONFIG_EC_MULTISYMBOL
- const av1_extra_bit *const extra_bits = &av1_extra_bits[token];
-
-#if CONFIG_EC_MULTISYMBOL
- /* skip one or two nodes */
- if (!p->skip_eob_node)
- aom_write_record(w, token != EOB_TOKEN, p->context_tree[0], token_stats);
- if (token != EOB_TOKEN) {
- aom_write_record(w, token != ZERO_TOKEN, p->context_tree[1], token_stats);
- if (token != ZERO_TOKEN) {
- aom_write_symbol(w, token - ONE_TOKEN, *p->token_cdf,
- CATEGORY6_TOKEN - ONE_TOKEN + 1);
- }
- }
-#else
- /* skip one or two nodes */
- if (p->skip_eob_node)
- coef_length -= p->skip_eob_node;
- else
- aom_write_record(w, token != EOB_TOKEN, p->context_tree[0], token_stats);
-
- if (token != EOB_TOKEN) {
- aom_write_record(w, token != ZERO_TOKEN, p->context_tree[1], token_stats);
-
- if (token != ZERO_TOKEN) {
- aom_write_record(w, token != ONE_TOKEN, p->context_tree[2],
- token_stats);
-
- if (token != ONE_TOKEN) {
- const int unconstrained_len = UNCONSTRAINED_NODES - p->skip_eob_node;
- aom_write_tree_record(
- w, av1_coef_con_tree,
- av1_pareto8_full[p->context_tree[PIVOT_NODE] - 1], coef_value,
- coef_length - unconstrained_len, 0, token_stats);
- }
- }
- }
-#endif // CONFIG_EC_MULTISYMBOL
-
- if (extra_bits->base_val) {
- const int bit_string = p->extra;
- const int bit_string_length = extra_bits->len; // Length of extra bits to
- // be written excluding
- // the sign bit.
- int skip_bits = (extra_bits->base_val == CAT6_MIN_VAL)
- ? (int)sizeof(av1_cat6_prob) -
- av1_get_cat6_extrabits_size(tx_size, bit_depth)
- : 0;
-
- assert(!(bit_string >> (bit_string_length - skip_bits + 1)));
- if (bit_string_length > 0) {
-#if CONFIG_NEW_MULTISYMBOL
- skip_bits &= ~3;
- write_coeff_extra(extra_bits->cdf, bit_string >> 1,
- bit_string_length - skip_bits, w);
-#else
- write_coeff_extra(extra_bits->prob, bit_string >> 1, bit_string_length,
- skip_bits, w, token_stats);
-#endif
- }
- aom_write_bit_record(w, bit_string & 1, token_stats);
- }
- ++p;
-
-#if CONFIG_VAR_TX
- ++count;
- if (token == EOB_TOKEN || count == seg_eob) break;
+ if (eob_val == EARLY_EOB || count == seg_eob) break;
#endif
}
*tp = p;
}
#endif // !CONFIG_LV_MAP
-#endif // CONFIG_NEW_TOKENSET
#else // !CONFIG_PVQ
static PVQ_INFO *get_pvq_block(PVQ_QUEUE *pvq_q) {
PVQ_INFO *pvq;
@@ -1150,6 +993,80 @@ static void pack_pvq_tokens(aom_writer *w, MACROBLOCK *const x,
#endif // !CONFIG_PVG
#if CONFIG_VAR_TX && !CONFIG_COEF_INTERLEAVE
+#if CONFIG_LV_MAP
+static void pack_txb_tokens(aom_writer *w,
+#if CONFIG_LV_MAP
+ AV1_COMMON *cm,
+#endif // CONFIG_LV_MAP
+ const TOKENEXTRA **tp,
+ const TOKENEXTRA *const tok_end,
+#if CONFIG_PVQ || CONFIG_LV_MAP
+ MACROBLOCK *const x,
+#endif
+ MACROBLOCKD *xd, MB_MODE_INFO *mbmi, int plane,
+ BLOCK_SIZE plane_bsize, aom_bit_depth_t bit_depth,
+ int block, int blk_row, int blk_col,
+ TX_SIZE tx_size, TOKEN_STATS *token_stats) {
+ const struct macroblockd_plane *const pd = &xd->plane[plane];
+ 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);
+ TX_SIZE plane_tx_size;
+ const int max_blocks_high = max_block_high(xd, plane_bsize, plane);
+ const int max_blocks_wide = max_block_wide(xd, plane_bsize, plane);
+
+ if (blk_row >= max_blocks_high || blk_col >= max_blocks_wide) return;
+
+ plane_tx_size =
+ plane ? uv_txsize_lookup[bsize][mbmi->inter_tx_size[tx_row][tx_col]][0][0]
+ : mbmi->inter_tx_size[tx_row][tx_col];
+
+ if (tx_size == plane_tx_size) {
+ TOKEN_STATS tmp_token_stats;
+ init_token_stats(&tmp_token_stats);
+
+#if !CONFIG_PVQ
+ tran_low_t *tcoeff = BLOCK_OFFSET(x->mbmi_ext->tcoeff[plane], block);
+ uint16_t eob = x->mbmi_ext->eobs[plane][block];
+ TXB_CTX txb_ctx = { x->mbmi_ext->txb_skip_ctx[plane][block],
+ x->mbmi_ext->dc_sign_ctx[plane][block] };
+ av1_write_coeffs_txb(cm, xd, w, block, plane, tcoeff, eob, &txb_ctx);
+#else
+ pack_pvq_tokens(w, x, xd, plane, bsize, tx_size);
+#endif
+#if CONFIG_RD_DEBUG
+ token_stats->txb_coeff_cost_map[blk_row][blk_col] = tmp_token_stats.cost;
+ token_stats->cost += tmp_token_stats.cost;
+#endif
+ } else {
+ const TX_SIZE sub_txs = sub_tx_size_map[tx_size];
+ const int bsl = tx_size_wide_unit[sub_txs];
+ int i;
+
+ assert(bsl > 0);
+
+ for (i = 0; i < 4; ++i) {
+ const int offsetr = blk_row + (i >> 1) * bsl;
+ const int offsetc = blk_col + (i & 0x01) * bsl;
+ const int step = tx_size_wide_unit[sub_txs] * tx_size_high_unit[sub_txs];
+
+ if (offsetr >= max_blocks_high || offsetc >= max_blocks_wide) continue;
+
+ pack_txb_tokens(w,
+#if CONFIG_LV_MAP
+ cm,
+#endif
+ tp, tok_end,
+#if CONFIG_PVQ || CONFIG_LV_MAP
+ x,
+#endif
+ xd, mbmi, plane, plane_bsize, bit_depth, block, offsetr,
+ offsetc, sub_txs, token_stats);
+ block += step;
+ }
+ }
+}
+#else // CONFIG_LV_MAP
static void pack_txb_tokens(aom_writer *w, const TOKENEXTRA **tp,
const TOKENEXTRA *const tok_end,
#if CONFIG_PVQ
@@ -1209,16 +1126,13 @@ static void pack_txb_tokens(aom_writer *w, const TOKENEXTRA **tp,
}
}
}
-#endif
+#endif // CONFIG_LV_MAP
+#endif // CONFIG_VAR_TX
static void write_segment_id(aom_writer *w, const struct segmentation *seg,
struct segmentation_probs *segp, int segment_id) {
if (seg->enabled && seg->update_map) {
-#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, segment_id, segp->tree_cdf, MAX_SEGMENTS);
-#else
- aom_write_tree(w, av1_segment_tree, segp->tree_probs, segment_id, 3, 0);
-#endif
}
}
@@ -1242,7 +1156,7 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd,
#if SUB8X8_COMP_REF
aom_write(w, is_compound, av1_get_reference_mode_prob(cm, xd));
#else
- if (mbmi->sb_type >= BLOCK_8X8)
+ if (mbmi->sb_type != BLOCK_4X4)
aom_write(w, is_compound, av1_get_reference_mode_prob(cm, xd));
#endif
} else {
@@ -1307,7 +1221,9 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd,
#if CONFIG_FILTER_INTRA
static void write_filter_intra_mode_info(const AV1_COMMON *const cm,
+ const MACROBLOCKD *xd,
const MB_MODE_INFO *const mbmi,
+ int mi_row, int mi_col,
aom_writer *w) {
if (mbmi->mode == DC_PRED
#if CONFIG_PALETTE
@@ -1323,6 +1239,17 @@ static void write_filter_intra_mode_info(const AV1_COMMON *const cm,
}
}
+#if CONFIG_CB4X4
+ if (!is_chroma_reference(mi_row, mi_col, mbmi->sb_type,
+ xd->plane[1].subsampling_x,
+ xd->plane[1].subsampling_y))
+ return;
+#else
+ (void)xd;
+ (void)mi_row;
+ (void)mi_col;
+#endif // CONFIG_CB4X4
+
if (mbmi->uv_mode == DC_PRED
#if CONFIG_PALETTE
&& mbmi->palette_mode_info.palette_size[1] == 0
@@ -1358,15 +1285,9 @@ static void write_intra_angle_info(const MACROBLOCKD *xd,
#if CONFIG_INTRA_INTERP
p_angle = mode_to_angle_map[mbmi->mode] + mbmi->angle_delta[0] * ANGLE_STEP;
if (av1_is_intra_filter_switchable(p_angle)) {
-#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, mbmi->intra_filter,
ec_ctx->intra_filter_cdf[intra_filter_ctx],
INTRA_FILTERS);
-#else
- av1_write_token(w, av1_intra_filter_tree,
- ec_ctx->intra_filter_probs[intra_filter_ctx],
- &intra_filter_encodings[mbmi->intra_filter]);
-#endif // CONFIG_EC_MULTISYMBOL
}
#endif // CONFIG_INTRA_INTERP
}
@@ -1409,15 +1330,9 @@ static void write_mb_interp_filter(AV1_COMP *cpi, const MACROBLOCKD *xd,
(mbmi->ref_frame[1] > INTRA_FRAME &&
has_subpel_mv_component(xd->mi[0], xd, dir + 2))) {
const int ctx = av1_get_pred_context_switchable_interp(xd, dir);
-#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, av1_switchable_interp_ind[mbmi->interp_filter[dir]],
ec_ctx->switchable_interp_cdf[ctx],
SWITCHABLE_FILTERS);
-#else
- av1_write_token(w, av1_switchable_interp_tree,
- ec_ctx->switchable_interp_prob[ctx],
- &switchable_interp_encodings[mbmi->interp_filter[dir]]);
-#endif
++cpi->interp_filter_selected[0][mbmi->interp_filter[dir]];
} else {
assert(mbmi->interp_filter[dir] == EIGHTTAP_REGULAR);
@@ -1426,14 +1341,8 @@ static void write_mb_interp_filter(AV1_COMP *cpi, const MACROBLOCKD *xd,
#else
{
const int ctx = av1_get_pred_context_switchable_interp(xd);
-#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, av1_switchable_interp_ind[mbmi->interp_filter],
ec_ctx->switchable_interp_cdf[ctx], SWITCHABLE_FILTERS);
-#else
- av1_write_token(w, av1_switchable_interp_tree,
- ec_ctx->switchable_interp_prob[ctx],
- &switchable_interp_encodings[mbmi->interp_filter]);
-#endif
++cpi->interp_filter_selected[0][mbmi->interp_filter];
}
#endif // CONFIG_DUAL_FILTER
@@ -1442,48 +1351,91 @@ static void write_mb_interp_filter(AV1_COMP *cpi, const MACROBLOCKD *xd,
#if CONFIG_PALETTE
#if CONFIG_PALETTE_DELTA_ENCODING
-// Write luma palette color values with delta encoding. Write the first value as
-// literal, and the deltas between each value and the previous one. The luma
-// palette is sorted so each delta is larger than 0.
-static void write_palette_colors_y(const PALETTE_MODE_INFO *const pmi,
- int bit_depth, aom_writer *w) {
- const int n = pmi->palette_size[0];
- int min_bits, i;
- int bits = av1_get_palette_delta_bits_y(pmi, bit_depth, &min_bits);
+// Transmit color values with delta encoding. Write the first value as
+// literal, and the deltas between each value and the previous one. "min_val" is
+// the smallest possible value of the deltas.
+static void delta_encode_palette_colors(const int *colors, int num,
+ int bit_depth, int min_val,
+ aom_writer *w) {
+ if (num <= 0) return;
+ assert(colors[0] < (1 << bit_depth));
+ aom_write_literal(w, colors[0], bit_depth);
+ if (num == 1) return;
+ int max_delta = 0;
+ int deltas[PALETTE_MAX_SIZE];
+ memset(deltas, 0, sizeof(deltas));
+ for (int i = 1; i < num; ++i) {
+ assert(colors[i] < (1 << bit_depth));
+ const int delta = colors[i] - colors[i - 1];
+ deltas[i - 1] = delta;
+ assert(delta >= min_val);
+ if (delta > max_delta) max_delta = delta;
+ }
+ const int min_bits = bit_depth - 3;
+ int bits = AOMMAX(av1_ceil_log2(max_delta + 1 - min_val), min_bits);
+ assert(bits <= bit_depth);
+ int range = (1 << bit_depth) - colors[0] - min_val;
aom_write_literal(w, bits - min_bits, 2);
- aom_write_literal(w, pmi->palette_colors[0], bit_depth);
- for (i = 1; i < n; ++i) {
- aom_write_literal(
- w, pmi->palette_colors[i] - pmi->palette_colors[i - 1] - 1, bits);
- bits =
- AOMMIN(bits, av1_ceil_log2((1 << bit_depth) - pmi->palette_colors[i]));
+ for (int i = 0; i < num - 1; ++i) {
+ aom_write_literal(w, deltas[i] - min_val, bits);
+ range -= deltas[i];
+ bits = AOMMIN(bits, av1_ceil_log2(range));
}
}
-// Write chroma palette color values. Use delta encoding for u channel as its
-// palette is sorted. For v channel, either use delta encoding or transmit
-// raw values directly, whichever costs less.
-static void write_palette_colors_uv(const PALETTE_MODE_INFO *const pmi,
+// Transmit luma palette color values. First signal if each color in the color
+// cache is used. Those colors that are not in the cache are transmitted with
+// delta encoding.
+static void write_palette_colors_y(const MACROBLOCKD *const xd,
+ const PALETTE_MODE_INFO *const pmi,
+ int bit_depth, aom_writer *w) {
+ const int n = pmi->palette_size[0];
+ const MODE_INFO *const above_mi = xd->above_mi;
+ const MODE_INFO *const left_mi = xd->left_mi;
+ uint16_t color_cache[2 * PALETTE_MAX_SIZE];
+ const int n_cache = av1_get_palette_cache(above_mi, left_mi, 0, color_cache);
+ int out_cache_colors[PALETTE_MAX_SIZE];
+ uint8_t cache_color_found[2 * PALETTE_MAX_SIZE];
+ const int n_out_cache =
+ av1_index_color_cache(color_cache, n_cache, pmi->palette_colors, n,
+ cache_color_found, out_cache_colors);
+ int n_in_cache = 0;
+ for (int i = 0; i < n_cache && n_in_cache < n; ++i) {
+ const int found = cache_color_found[i];
+ aom_write_bit(w, found);
+ n_in_cache += found;
+ }
+ assert(n_in_cache + n_out_cache == n);
+ delta_encode_palette_colors(out_cache_colors, n_out_cache, bit_depth, 1, w);
+}
+
+// Write chroma palette color values. U channel is handled similarly to the luma
+// channel. For v channel, either use delta encoding or transmit raw values
+// directly, whichever costs less.
+static void write_palette_colors_uv(const MACROBLOCKD *const xd,
+ const PALETTE_MODE_INFO *const pmi,
int bit_depth, aom_writer *w) {
- int i;
const int n = pmi->palette_size[1];
-#if CONFIG_HIGHBITDEPTH
const uint16_t *colors_u = pmi->palette_colors + PALETTE_MAX_SIZE;
const uint16_t *colors_v = pmi->palette_colors + 2 * PALETTE_MAX_SIZE;
-#else
- const uint8_t *colors_u = pmi->palette_colors + PALETTE_MAX_SIZE;
- const uint8_t *colors_v = pmi->palette_colors + 2 * PALETTE_MAX_SIZE;
-#endif // CONFIG_HIGHBITDEPTH
// U channel colors.
- int min_bits_u = 0;
- int bits_u = av1_get_palette_delta_bits_u(pmi, bit_depth, &min_bits_u);
- aom_write_literal(w, bits_u - min_bits_u, 2);
- aom_write_literal(w, colors_u[0], bit_depth);
- for (i = 1; i < n; ++i) {
- aom_write_literal(w, colors_u[i] - colors_u[i - 1], bits_u);
- bits_u = AOMMIN(bits_u, av1_ceil_log2(1 + (1 << bit_depth) - colors_u[i]));
- }
- // V channel colors.
+ const MODE_INFO *const above_mi = xd->above_mi;
+ const MODE_INFO *const left_mi = xd->left_mi;
+ uint16_t color_cache[2 * PALETTE_MAX_SIZE];
+ const int n_cache = av1_get_palette_cache(above_mi, left_mi, 1, color_cache);
+ int out_cache_colors[PALETTE_MAX_SIZE];
+ uint8_t cache_color_found[2 * PALETTE_MAX_SIZE];
+ const int n_out_cache = av1_index_color_cache(
+ color_cache, n_cache, colors_u, n, cache_color_found, out_cache_colors);
+ int n_in_cache = 0;
+ for (int i = 0; i < n_cache && n_in_cache < n; ++i) {
+ const int found = cache_color_found[i];
+ aom_write_bit(w, found);
+ n_in_cache += found;
+ }
+ delta_encode_palette_colors(out_cache_colors, n_out_cache, bit_depth, 0, w);
+
+ // V channel colors. Don't use color cache as the colors are not sorted.
const int max_val = 1 << bit_depth;
int zero_count = 0, min_bits_v = 0;
int bits_v =
@@ -1492,10 +1444,12 @@ static void write_palette_colors_uv(const PALETTE_MODE_INFO *const pmi,
2 + bit_depth + (bits_v + 1) * (n - 1) - zero_count;
const int rate_using_raw = bit_depth * n;
if (rate_using_delta < rate_using_raw) { // delta encoding
+ assert(colors_v[0] < (1 << bit_depth));
aom_write_bit(w, 1);
aom_write_literal(w, bits_v - min_bits_v, 2);
aom_write_literal(w, colors_v[0], bit_depth);
- for (i = 1; i < n; ++i) {
+ for (int i = 1; i < n; ++i) {
+ assert(colors_v[i] < (1 << bit_depth));
if (colors_v[i] == colors_v[i - 1]) { // No need to signal sign bit.
aom_write_literal(w, 0, bits_v);
continue;
@@ -1512,7 +1466,10 @@ static void write_palette_colors_uv(const PALETTE_MODE_INFO *const pmi,
}
} else { // Transmit raw values.
aom_write_bit(w, 0);
- for (i = 0; i < n; ++i) aom_write_literal(w, colors_v[i], bit_depth);
+ for (int i = 0; i < n; ++i) {
+ assert(colors_v[i] < (1 << bit_depth));
+ aom_write_literal(w, colors_v[i], bit_depth);
+ }
}
}
#endif // CONFIG_PALETTE_DELTA_ENCODING
@@ -1542,11 +1499,12 @@ static void write_palette_mode_info(const AV1_COMMON *cm, const MACROBLOCKD *xd,
av1_default_palette_y_size_prob[bsize - BLOCK_8X8],
&palette_size_encodings[n - PALETTE_MIN_SIZE]);
#if CONFIG_PALETTE_DELTA_ENCODING
- write_palette_colors_y(pmi, cm->bit_depth, w);
+ write_palette_colors_y(xd, pmi, cm->bit_depth, w);
#else
- int i;
- for (i = 0; i < n; ++i)
+ for (int i = 0; i < n; ++i) {
+ assert(pmi->palette_colors[i] < (1 << cm->bit_depth));
aom_write_literal(w, pmi->palette_colors[i], cm->bit_depth);
+ }
#endif // CONFIG_PALETTE_DELTA_ENCODING
write_uniform(w, n, pmi->palette_first_color_idx[0]);
}
@@ -1561,10 +1519,13 @@ static void write_palette_mode_info(const AV1_COMMON *cm, const MACROBLOCKD *xd,
av1_default_palette_uv_size_prob[bsize - BLOCK_8X8],
&palette_size_encodings[n - PALETTE_MIN_SIZE]);
#if CONFIG_PALETTE_DELTA_ENCODING
- write_palette_colors_uv(pmi, cm->bit_depth, w);
+ write_palette_colors_uv(xd, pmi, cm->bit_depth, w);
#else
- int i;
- for (i = 0; i < n; ++i) {
+ for (int i = 0; i < n; ++i) {
+ assert(pmi->palette_colors[PALETTE_MAX_SIZE + i] <
+ (1 << cm->bit_depth));
+ assert(pmi->palette_colors[2 * PALETTE_MAX_SIZE + i] <
+ (1 << cm->bit_depth));
aom_write_literal(w, pmi->palette_colors[PALETTE_MAX_SIZE + i],
cm->bit_depth);
aom_write_literal(w, pmi->palette_colors[2 * PALETTE_MAX_SIZE + i],
@@ -1625,30 +1586,17 @@ void av1_write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd,
if (is_inter) {
assert(ext_tx_used_inter[eset][tx_type]);
if (eset > 0) {
-#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, av1_ext_tx_inter_ind[eset][tx_type],
ec_ctx->inter_ext_tx_cdf[eset][square_tx_size],
ext_tx_cnt_inter[eset]);
-#else
- av1_write_token(w, av1_ext_tx_inter_tree[eset],
- ec_ctx->inter_ext_tx_prob[eset][square_tx_size],
- &ext_tx_inter_encodings[eset][tx_type]);
-#endif
}
} else if (ALLOW_INTRA_EXT_TX) {
assert(ext_tx_used_intra[eset][tx_type]);
if (eset > 0) {
-#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(
w, av1_ext_tx_intra_ind[eset][tx_type],
ec_ctx->intra_ext_tx_cdf[eset][square_tx_size][mbmi->mode],
ext_tx_cnt_intra[eset]);
-#else
- av1_write_token(
- w, av1_ext_tx_intra_tree[eset],
- ec_ctx->intra_ext_tx_prob[eset][square_tx_size][mbmi->mode],
- &ext_tx_intra_encodings[eset][tx_type]);
-#endif
}
}
}
@@ -1662,28 +1610,14 @@ void av1_write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd,
#endif // CONFIG_SUPERTX
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
if (is_inter) {
-#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, av1_ext_tx_ind[tx_type],
ec_ctx->inter_ext_tx_cdf[tx_size], TX_TYPES);
-#else
- av1_write_token(w, av1_ext_tx_tree, ec_ctx->inter_ext_tx_prob[tx_size],
- &ext_tx_encodings[tx_type]);
-#endif
} else {
-#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(
w, av1_ext_tx_ind[tx_type],
ec_ctx->intra_ext_tx_cdf[tx_size]
[intra_mode_to_tx_type_context[mbmi->mode]],
TX_TYPES);
-#else
- av1_write_token(
- w, av1_ext_tx_tree,
- ec_ctx
- ->intra_ext_tx_prob[tx_size]
- [intra_mode_to_tx_type_context[mbmi->mode]],
- &ext_tx_encodings[tx_type]);
-#endif
}
}
#endif // CONFIG_EXT_TX
@@ -1692,29 +1626,45 @@ void av1_write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd,
static void write_intra_mode(FRAME_CONTEXT *frame_ctx, BLOCK_SIZE bsize,
PREDICTION_MODE mode, aom_writer *w) {
-#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, av1_intra_mode_ind[mode],
frame_ctx->y_mode_cdf[size_group_lookup[bsize]],
INTRA_MODES);
-#else
- av1_write_token(w, av1_intra_mode_tree,
- frame_ctx->y_mode_prob[size_group_lookup[bsize]],
- &intra_mode_encodings[mode]);
-#endif
}
static void write_intra_uv_mode(FRAME_CONTEXT *frame_ctx,
PREDICTION_MODE uv_mode, PREDICTION_MODE y_mode,
aom_writer *w) {
-#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, av1_intra_mode_ind[uv_mode],
frame_ctx->uv_mode_cdf[y_mode], INTRA_MODES);
-#else
- av1_write_token(w, av1_intra_mode_tree, frame_ctx->uv_mode_prob[y_mode],
- &intra_mode_encodings[uv_mode]);
-#endif
}
+#if CONFIG_CFL
+static void write_cfl_alphas(FRAME_CONTEXT *const frame_ctx, int skip, int ind,
+ const CFL_SIGN_TYPE signs[CFL_SIGNS],
+ aom_writer *w) {
+ if (skip) {
+ assert(ind == 0);
+ assert(signs[CFL_PRED_U] == CFL_SIGN_POS);
+ assert(signs[CFL_PRED_V] == CFL_SIGN_POS);
+ } else {
+ // Check for uninitialized signs
+ if (cfl_alpha_codes[ind][CFL_PRED_U] == 0)
+ assert(signs[CFL_PRED_U] == CFL_SIGN_POS);
+ if (cfl_alpha_codes[ind][CFL_PRED_V] == 0)
+ assert(signs[CFL_PRED_V] == CFL_SIGN_POS);
+
+ // Write a symbol representing a combination of alpha Cb and alpha Cr.
+ aom_write_symbol(w, ind, frame_ctx->cfl_alpha_cdf, CFL_ALPHABET_SIZE);
+
+ // Signs are only signaled for nonzero codes.
+ if (cfl_alpha_codes[ind][CFL_PRED_U] != 0)
+ aom_write_bit(w, signs[CFL_PRED_U]);
+ if (cfl_alpha_codes[ind][CFL_PRED_V] != 0)
+ aom_write_bit(w, signs[CFL_PRED_V]);
+ }
+}
+#endif
+
static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row,
const int mi_col,
#if CONFIG_SUPERTX
@@ -1734,9 +1684,6 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row,
#else
FRAME_CONTEXT *ec_ctx = cm->fc;
#endif
-#if !CONFIG_REF_MV
- nmv_context *nmvc = &ec_ctx->nmvc;
-#endif
const MODE_INFO *mi = xd->mi[0];
const struct segmentation *const seg = &cm->seg;
@@ -1859,12 +1806,23 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row,
}
#if CONFIG_CB4X4
if (is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x,
- xd->plane[1].subsampling_y))
+ xd->plane[1].subsampling_y)) {
write_intra_uv_mode(ec_ctx, mbmi->uv_mode, mode, w);
#else // !CONFIG_CB4X4
write_intra_uv_mode(ec_ctx, mbmi->uv_mode, mode, w);
#endif // CONFIG_CB4X4
+#if CONFIG_CFL
+ if (mbmi->uv_mode == DC_PRED) {
+ write_cfl_alphas(ec_ctx, mbmi->skip, mbmi->cfl_alpha_idx,
+ mbmi->cfl_alpha_signs, w);
+ }
+#endif
+
+#if CONFIG_CB4X4
+ }
+#endif
+
#if CONFIG_EXT_INTRA
write_intra_angle_info(xd, ec_ctx, w);
#endif // CONFIG_EXT_INTRA
@@ -1874,13 +1832,12 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row,
#endif // CONFIG_PALETTE
#if CONFIG_FILTER_INTRA
if (bsize >= BLOCK_8X8 || unify_bsize)
- write_filter_intra_mode_info(cm, mbmi, w);
+ write_filter_intra_mode_info(cm, xd, mbmi, mi_row, mi_col, w);
#endif // CONFIG_FILTER_INTRA
} else {
int16_t mode_ctx;
write_ref_frames(cm, xd, w);
-#if CONFIG_REF_MV
#if CONFIG_EXT_INTER
if (is_compound)
mode_ctx = mbmi_ext->compound_mode_context[mbmi->ref_frame[0]];
@@ -1888,9 +1845,6 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row,
#endif // CONFIG_EXT_INTER
mode_ctx = av1_mode_context_analyzer(mbmi_ext->mode_context,
mbmi->ref_frame, bsize, -1);
-#else // CONFIG_REF_MV
- mode_ctx = mbmi_ext->mode_context[mbmi->ref_frame[0]];
-#endif // CONFIG_REF_MV
// If segment skip is not enabled code the mode.
if (!segfeature_active(seg, segment_id, SEG_LVL_SKIP)) {
@@ -1902,7 +1856,6 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row,
#endif // CONFIG_EXT_INTER
write_inter_mode(w, mode, ec_ctx, mode_ctx);
-#if CONFIG_REF_MV
#if CONFIG_EXT_INTER
if (mode == NEWMV || mode == NEW_NEWMV ||
have_nearmv_in_inter_mode(mode))
@@ -1912,7 +1865,6 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row,
write_drl_idx(cm, mbmi, mbmi_ext, w);
else
assert(mbmi->ref_mv_idx == 0);
-#endif
}
}
@@ -1928,13 +1880,11 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row,
for (idx = 0; idx < 2; idx += num_4x4_w) {
const int j = idy * 2 + idx;
const PREDICTION_MODE b_mode = mi->bmi[j].as_mode;
-#if CONFIG_REF_MV
#if CONFIG_EXT_INTER
if (!is_compound)
#endif // CONFIG_EXT_INTER
mode_ctx = av1_mode_context_analyzer(mbmi_ext->mode_context,
mbmi->ref_frame, bsize, j);
-#endif
#if CONFIG_EXT_INTER
if (is_inter_compound_mode(b_mode))
write_inter_compound_mode(cm, w, b_mode, mode_ctx);
@@ -1948,45 +1898,35 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row,
if (b_mode == NEWMV) {
#endif // CONFIG_EXT_INTER
for (ref = 0; ref < 1 + is_compound; ++ref) {
-#if CONFIG_REF_MV
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx = av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], ref,
mbmi->ref_mv_idx);
nmv_context *nmvc = &ec_ctx->nmvc[nmv_ctx];
-#endif
av1_encode_mv(cpi, w, &mi->bmi[j].as_mv[ref].as_mv,
#if CONFIG_EXT_INTER
&mi->bmi[j].ref_mv[ref].as_mv,
#else
-#if CONFIG_REF_MV
&mi->bmi[j].pred_mv[ref].as_mv,
-#else
- &mbmi_ext->ref_mvs[mbmi->ref_frame[ref]][0].as_mv,
-#endif // CONFIG_REF_MV
#endif // CONFIG_EXT_INTER
nmvc, allow_hp);
}
}
#if CONFIG_EXT_INTER
else if (b_mode == NEAREST_NEWMV || b_mode == NEAR_NEWMV) {
-#if CONFIG_REF_MV
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx = av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], 1,
mbmi->ref_mv_idx);
nmv_context *nmvc = &ec_ctx->nmvc[nmv_ctx];
-#endif
av1_encode_mv(cpi, w, &mi->bmi[j].as_mv[1].as_mv,
&mi->bmi[j].ref_mv[1].as_mv, nmvc, allow_hp);
} else if (b_mode == NEW_NEARESTMV || b_mode == NEW_NEARMV) {
-#if CONFIG_REF_MV
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx = av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], 0,
mbmi->ref_mv_idx);
nmv_context *nmvc = &ec_ctx->nmvc[nmv_ctx];
-#endif
av1_encode_mv(cpi, w, &mi->bmi[j].as_mv[0].as_mv,
&mi->bmi[j].ref_mv[0].as_mv, nmvc, allow_hp);
}
@@ -2001,37 +1941,31 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row,
#endif // CONFIG_EXT_INTER
int_mv ref_mv;
for (ref = 0; ref < 1 + is_compound; ++ref) {
-#if CONFIG_REF_MV
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx = av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], ref,
mbmi->ref_mv_idx);
nmv_context *nmvc = &ec_ctx->nmvc[nmv_ctx];
-#endif
ref_mv = mbmi_ext->ref_mvs[mbmi->ref_frame[ref]][0];
av1_encode_mv(cpi, w, &mbmi->mv[ref].as_mv, &ref_mv.as_mv, nmvc,
allow_hp);
}
#if CONFIG_EXT_INTER
} else if (mode == NEAREST_NEWMV || mode == NEAR_NEWMV) {
-#if CONFIG_REF_MV
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx =
av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], 1, mbmi->ref_mv_idx);
nmv_context *nmvc = &ec_ctx->nmvc[nmv_ctx];
-#endif
av1_encode_mv(cpi, w, &mbmi->mv[1].as_mv,
&mbmi_ext->ref_mvs[mbmi->ref_frame[1]][0].as_mv, nmvc,
allow_hp);
} else if (mode == NEW_NEARESTMV || mode == NEW_NEARMV) {
-#if CONFIG_REF_MV
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx =
av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], 0, mbmi->ref_mv_idx);
nmv_context *nmvc = &ec_ctx->nmvc[nmv_ctx];
-#endif
av1_encode_mv(cpi, w, &mbmi->mv[0].as_mv,
&mbmi_ext->ref_mvs[mbmi->ref_frame[0]][0].as_mv, nmvc,
allow_hp);
@@ -2039,12 +1973,12 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row,
}
}
-#if CONFIG_EXT_INTER
+#if CONFIG_EXT_INTER && CONFIG_INTERINTRA
if (cpi->common.reference_mode != COMPOUND_REFERENCE &&
#if CONFIG_SUPERTX
!supertx_enabled &&
#endif // CONFIG_SUPERTX
- is_interintra_allowed(mbmi)) {
+ cpi->common.allow_interintra_compound && is_interintra_allowed(mbmi)) {
const int interintra = mbmi->ref_frame[1] == INTRA_FRAME;
const int bsize_group = size_group_lookup[bsize];
aom_write(w, interintra, cm->fc->interintra_prob[bsize_group]);
@@ -2062,7 +1996,7 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row,
}
}
}
-#endif // CONFIG_EXT_INTER
+#endif // CONFIG_EXT_INTER && CONFIG_INTERINTRA
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
#if CONFIG_SUPERTX
@@ -2082,21 +2016,23 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row,
#endif // CONFIG_MOTION_VAR
&& is_any_masked_compound_used(bsize)) {
#if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
- av1_write_token(w, av1_compound_type_tree,
- cm->fc->compound_type_prob[bsize],
- &compound_type_encodings[mbmi->interinter_compound_type]);
-#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
+ if (cm->allow_masked_compound) {
+ av1_write_token(
+ w, av1_compound_type_tree, cm->fc->compound_type_prob[bsize],
+ &compound_type_encodings[mbmi->interinter_compound_type]);
#if CONFIG_WEDGE
- if (mbmi->interinter_compound_type == COMPOUND_WEDGE) {
- aom_write_literal(w, mbmi->wedge_index, get_wedge_bits_lookup(bsize));
- aom_write_bit(w, mbmi->wedge_sign);
- }
+ if (mbmi->interinter_compound_type == COMPOUND_WEDGE) {
+ aom_write_literal(w, mbmi->wedge_index, get_wedge_bits_lookup(bsize));
+ aom_write_bit(w, mbmi->wedge_sign);
+ }
#endif // CONFIG_WEDGE
#if CONFIG_COMPOUND_SEGMENT
- if (mbmi->interinter_compound_type == COMPOUND_SEG) {
- aom_write_literal(w, mbmi->mask_type, MAX_SEG_MASK_BITS);
- }
+ if (mbmi->interinter_compound_type == COMPOUND_SEG) {
+ aom_write_literal(w, mbmi->mask_type, MAX_SEG_MASK_BITS);
+ }
#endif // CONFIG_COMPOUND_SEGMENT
+ }
+#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
}
#endif // CONFIG_EXT_INTER
@@ -2114,15 +2050,17 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row,
#endif // !CONFIG_TXK_SEL
}
+static void write_mb_modes_kf(AV1_COMMON *cm,
#if CONFIG_DELTA_Q
-static void write_mb_modes_kf(AV1_COMMON *cm, MACROBLOCKD *xd, const int mi_row,
- const int mi_col, aom_writer *w) {
- int skip;
+ MACROBLOCKD *xd,
#else
-static void write_mb_modes_kf(AV1_COMMON *cm, const MACROBLOCKD *xd,
+ const MACROBLOCKD *xd,
+#endif // CONFIG_DELTA_Q
+#if CONFIG_INTRABC
+ const MB_MODE_INFO_EXT *mbmi_ext,
+#endif // CONFIG_INTRABC
const int mi_row, const int mi_col,
aom_writer *w) {
-#endif
const struct segmentation *const seg = &cm->seg;
struct segmentation_probs *const segp = &cm->fc->seg;
const MODE_INFO *const mi = xd->mi[0];
@@ -2147,7 +2085,7 @@ static void write_mb_modes_kf(AV1_COMMON *cm, const MACROBLOCKD *xd,
if (seg->update_map) write_segment_id(w, seg, segp, mbmi->segment_id);
#if CONFIG_DELTA_Q
- skip = write_skip(cm, xd, mbmi->segment_id, mi, w);
+ const int skip = write_skip(cm, xd, mbmi->segment_id, mi, w);
if (cm->delta_q_present_flag) {
int super_block_upper_left =
((mi_row & MAX_MIB_MASK) == 0) && ((mi_col & MAX_MIB_MASK) == 0);
@@ -2188,13 +2126,19 @@ static void write_mb_modes_kf(AV1_COMMON *cm, const MACROBLOCKD *xd,
#if CONFIG_INTRABC
if (bsize >= BLOCK_8X8 && cm->allow_screen_content_tools) {
int use_intrabc = is_intrabc_block(mbmi);
- aom_write(w, use_intrabc, INTRABC_PROB);
+ aom_write(w, use_intrabc, ec_ctx->intrabc_prob);
if (use_intrabc) {
assert(mbmi->mode == DC_PRED);
assert(mbmi->uv_mode == DC_PRED);
- int_mv dv_ref;
- av1_find_ref_dv(&dv_ref, mi_row, mi_col);
+ int_mv dv_ref = mbmi_ext->ref_mvs[INTRA_FRAME][0];
av1_encode_dv(w, &mbmi->mv[0].as_mv, &dv_ref.as_mv, &ec_ctx->ndvc);
+#if CONFIG_EXT_TX && !CONFIG_TXK_SEL
+ av1_write_tx_type(cm, xd,
+#if CONFIG_SUPERTX
+ 0,
+#endif
+ w);
+#endif // CONFIG_EXT_TX && !CONFIG_TXK_SEL
return;
}
}
@@ -2218,12 +2162,22 @@ static void write_mb_modes_kf(AV1_COMMON *cm, const MACROBLOCKD *xd,
#if CONFIG_CB4X4
if (is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x,
- xd->plane[1].subsampling_y))
+ xd->plane[1].subsampling_y)) {
write_intra_uv_mode(ec_ctx, mbmi->uv_mode, mbmi->mode, w);
#else // !CONFIG_CB4X4
write_intra_uv_mode(ec_ctx, mbmi->uv_mode, mbmi->mode, w);
#endif // CONFIG_CB4X4
+#if CONFIG_CFL
+ if (mbmi->uv_mode == DC_PRED) {
+ write_cfl_alphas(ec_ctx, mbmi->skip, mbmi->cfl_alpha_idx,
+ mbmi->cfl_alpha_signs, w);
+ }
+#endif
+
+#if CONFIG_CB4X4
+ }
+#endif
#if CONFIG_EXT_INTRA
write_intra_angle_info(xd, ec_ctx, w);
#endif // CONFIG_EXT_INTRA
@@ -2233,7 +2187,7 @@ static void write_mb_modes_kf(AV1_COMMON *cm, const MACROBLOCKD *xd,
#endif // CONFIG_PALETTE
#if CONFIG_FILTER_INTRA
if (bsize >= BLOCK_8X8 || unify_bsize)
- write_filter_intra_mode_info(cm, mbmi, w);
+ write_filter_intra_mode_info(cm, xd, mbmi, mi_row, mi_col, w);
#endif // CONFIG_FILTER_INTRA
#if !CONFIG_TXK_SEL
@@ -2325,12 +2279,17 @@ static void write_mbmi_b(AV1_COMP *cpi, const TileInfo *const tile,
cm->mi_rows, cm->mi_cols);
if (frame_is_intra_only(cm)) {
- write_mb_modes_kf(cm, xd, mi_row, mi_col, w);
+ write_mb_modes_kf(cm, xd,
+#if CONFIG_INTRABC
+ cpi->td.mb.mbmi_ext,
+#endif // CONFIG_INTRABC
+ mi_row, mi_col, w);
} else {
#if CONFIG_VAR_TX
- xd->above_txfm_context = cm->above_txfm_context + mi_col;
- xd->left_txfm_context =
- xd->left_txfm_context_buffer + (mi_row & MAX_MIB_MASK);
+ xd->above_txfm_context =
+ cm->above_txfm_context + (mi_col << TX_UNIT_WIDE_LOG2);
+ xd->left_txfm_context = xd->left_txfm_context_buffer +
+ ((mi_row & MAX_MIB_MASK) << TX_UNIT_HIGH_LOG2);
#endif
#if CONFIG_DUAL_FILTER
// has_subpel_mv_component needs the ref frame buffers set up to look
@@ -2539,8 +2498,12 @@ static void write_tokens_b(AV1_COMP *cpi, const TileInfo *const tile,
const int bkh = tx_size_high_unit[max_tx_size];
for (row = 0; row < num_4x4_h; row += bkh) {
for (col = 0; col < num_4x4_w; col += bkw) {
- pack_txb_tokens(w, tok, tok_end,
-#if CONFIG_PVQ
+ pack_txb_tokens(w,
+#if CONFIG_LV_MAP
+ cm,
+#endif
+ tok, tok_end,
+#if CONFIG_PVQ || CONFIG_LV_MAP
x,
#endif
xd, mbmi, plane, plane_bsize, cm->bit_depth, block,
@@ -2556,10 +2519,10 @@ static void write_tokens_b(AV1_COMP *cpi, const TileInfo *const tile,
}
#endif // CONFIG_RD_DEBUG
} else {
+#if CONFIG_LV_MAP
+ av1_write_coeffs_mb(cm, x, w, plane);
+#else
TX_SIZE tx = get_tx_size(plane, xd);
-#if CONFIG_CB4X4 && !CONFIG_CHROMA_2X2
- tx = AOMMAX(TX_4X4, tx);
-#endif
const int bkw = tx_size_wide_unit[tx];
const int bkh = tx_size_high_unit[tx];
for (row = 0; row < num_4x4_h; row += bkh) {
@@ -2571,6 +2534,7 @@ static void write_tokens_b(AV1_COMP *cpi, const TileInfo *const tile,
#endif
}
}
+#endif // CONFIG_LV_MAP
}
#else
TX_SIZE tx = get_tx_size(plane, xd);
@@ -2727,7 +2691,7 @@ static void write_partition(const AV1_COMMON *const cm,
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
(void)cm;
-#elif CONFIG_EC_MULTISYMBOL
+#else
FRAME_CONTEXT *ec_ctx = cm->fc;
#endif
@@ -2736,24 +2700,11 @@ static void write_partition(const AV1_COMMON *const cm,
if (has_rows && has_cols) {
#if CONFIG_EXT_PARTITION_TYPES
if (bsize <= BLOCK_8X8)
-#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, p, ec_ctx->partition_cdf[ctx], PARTITION_TYPES);
-#else
- av1_write_token(w, av1_partition_tree, probs, &partition_encodings[p]);
-#endif
else
-#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, p, ec_ctx->partition_cdf[ctx], EXT_PARTITION_TYPES);
#else
- av1_write_token(w, av1_ext_partition_tree, probs,
- &ext_partition_encodings[p]);
-#endif // CONFIG_EC_MULTISYMBOL
-#else
-#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, p, ec_ctx->partition_cdf[ctx], PARTITION_TYPES);
-#else
- av1_write_token(w, av1_partition_tree, probs, &partition_encodings[p]);
-#endif
#endif // CONFIG_EXT_PARTITION_TYPES
} else if (!has_rows && has_cols) {
assert(p == PARTITION_SPLIT || p == PARTITION_HORZ);
@@ -2920,7 +2871,6 @@ static void write_modes_sb(AV1_COMP *const cpi, const TileInfo *const tile,
const int eset =
get_ext_tx_set(supertx_size, bsize, 1, cm->reduced_tx_set_used);
if (eset > 0) {
-#if CONFIG_EC_MULTISYMBOL
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
#else
@@ -2929,11 +2879,6 @@ static void write_modes_sb(AV1_COMP *const cpi, const TileInfo *const tile,
aom_write_symbol(w, av1_ext_tx_inter_ind[eset][mbmi->tx_type],
ec_ctx->inter_ext_tx_cdf[eset][supertx_size],
ext_tx_cnt_inter[eset]);
-#else
- av1_write_token(w, av1_ext_tx_inter_tree[eset],
- cm->fc->inter_ext_tx_prob[eset][supertx_size],
- &ext_tx_inter_encodings[eset][mbmi->tx_type]);
-#endif
}
}
#else
@@ -2989,21 +2934,11 @@ static void write_modes_sb(AV1_COMP *const cpi, const TileInfo *const tile,
#endif // CONFIG_EXT_PARTITION_TYPES
#if CONFIG_CDEF
-#if CONFIG_EXT_PARTITION
- if (cm->sb_size == BLOCK_128X128 && bsize == BLOCK_128X128 &&
- !sb_all_skip(cm, mi_row, mi_col)) {
+ if (bsize == cm->sb_size && !sb_all_skip(cm, mi_row, mi_col) &&
+ cm->cdef_bits != 0) {
aom_write_literal(w, cm->mi_grid_visible[mi_row * cm->mi_stride + mi_col]
->mbmi.cdef_strength,
cm->cdef_bits);
- } else if (cm->sb_size == BLOCK_64X64 && bsize == BLOCK_64X64 &&
-#else
- if (bsize == BLOCK_64X64 &&
-#endif // CONFIG_EXT_PARTITION
- !sb_all_skip(cm, mi_row, mi_col)) {
- if (cm->cdef_bits != 0)
- aom_write_literal(w, cm->mi_grid_visible[mi_row * cm->mi_stride + mi_col]
- ->mbmi.cdef_strength,
- cm->cdef_bits);
}
#endif
}
@@ -3066,7 +3001,7 @@ static void write_modes(AV1_COMP *const cpi, const TileInfo *const tile,
}
#if !CONFIG_LV_MAP
-#if !CONFIG_PVQ && !(CONFIG_EC_ADAPT && CONFIG_NEW_TOKENSET)
+#if !CONFIG_PVQ && !CONFIG_EC_ADAPT
static void build_tree_distribution(AV1_COMP *cpi, TX_SIZE tx_size,
av1_coeff_stats *coef_branch_ct,
av1_coeff_probs_model *coef_probs) {
@@ -3097,7 +3032,7 @@ static void build_tree_distribution(AV1_COMP *cpi, TX_SIZE tx_size,
}
}
-#if !(CONFIG_EC_ADAPT && CONFIG_NEW_TOKENSET)
+#if !CONFIG_EC_ADAPT
static void update_coef_probs_common(aom_writer *const bc, AV1_COMP *cpi,
TX_SIZE tx_size,
av1_coeff_stats *frame_branch_ct,
@@ -3249,235 +3184,12 @@ static void update_coef_probs_common(aom_writer *const bc, AV1_COMP *cpi,
}
}
#endif
-#if CONFIG_SUBFRAME_PROB_UPDATE
-// Calculate the token counts between subsequent subframe updates.
-static void get_coef_counts_diff(
- AV1_COMP *cpi, int index,
- av1_coeff_count coef_counts[TX_SIZES][PLANE_TYPES],
- unsigned int eob_counts[TX_SIZES][PLANE_TYPES][REF_TYPES][COEF_BANDS]
- [COEFF_CONTEXTS]) {
- int i, j, k, l, m, tx_size, val;
- const int max_idx = cpi->common.coef_probs_update_idx;
- const TX_MODE tx_mode = cpi->common.tx_mode;
- const int max_tx_size = tx_mode_to_biggest_tx_size[tx_mode];
- const SUBFRAME_STATS *subframe_stats = &cpi->subframe_stats;
-
- assert(max_idx < COEF_PROBS_BUFS);
-
- for (tx_size = 0; tx_size <= max_tx_size; ++tx_size)
- for (i = 0; i < PLANE_TYPES; ++i)
- for (j = 0; j < REF_TYPES; ++j)
- for (k = 0; k < COEF_BANDS; ++k)
- for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
- if (index == max_idx) {
- val =
- cpi->common.counts.eob_branch[tx_size][i][j][k][l] -
- subframe_stats->eob_counts_buf[max_idx][tx_size][i][j][k][l];
- } else {
- val = subframe_stats
- ->eob_counts_buf[index + 1][tx_size][i][j][k][l] -
- subframe_stats->eob_counts_buf[index][tx_size][i][j][k][l];
- }
- assert(val >= 0);
- eob_counts[tx_size][i][j][k][l] = val;
-
- for (m = 0; m < ENTROPY_TOKENS; ++m) {
- if (index == max_idx) {
- val = cpi->td.rd_counts.coef_counts[tx_size][i][j][k][l][m] -
- subframe_stats
- ->coef_counts_buf[max_idx][tx_size][i][j][k][l][m];
- } else {
- val = subframe_stats
- ->coef_counts_buf[index + 1][tx_size][i][j][k][l][m] -
- subframe_stats
- ->coef_counts_buf[index][tx_size][i][j][k][l][m];
- }
- assert(val >= 0);
- coef_counts[tx_size][i][j][k][l][m] = val;
- }
- }
-}
-
-static void update_coef_probs_subframe(
- aom_writer *const bc, AV1_COMP *cpi, TX_SIZE tx_size,
- av1_coeff_stats branch_ct[COEF_PROBS_BUFS][TX_SIZES][PLANE_TYPES],
- av1_coeff_probs_model *new_coef_probs) {
- av1_coeff_probs_model *old_coef_probs = cpi->common.fc->coef_probs[tx_size];
- const aom_prob upd = DIFF_UPDATE_PROB;
- const int entropy_nodes_update = UNCONSTRAINED_NODES;
- int i, j, k, l, t;
- int stepsize = cpi->sf.coeff_prob_appx_step;
- const int max_idx = cpi->common.coef_probs_update_idx;
- int idx;
- unsigned int this_branch_ct[ENTROPY_NODES][COEF_PROBS_BUFS][2];
-
- switch (cpi->sf.use_fast_coef_updates) {
- case TWO_LOOP: {
- /* dry run to see if there is any update at all needed */
- int savings = 0;
- int update[2] = { 0, 0 };
- for (i = 0; i < PLANE_TYPES; ++i) {
- for (j = 0; j < REF_TYPES; ++j) {
- for (k = 0; k < COEF_BANDS; ++k) {
- for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
- for (t = 0; t < ENTROPY_NODES; ++t) {
- for (idx = 0; idx <= max_idx; ++idx) {
- memcpy(this_branch_ct[t][idx],
- branch_ct[idx][tx_size][i][j][k][l][t],
- 2 * sizeof(this_branch_ct[t][idx][0]));
- }
- }
- for (t = 0; t < entropy_nodes_update; ++t) {
- aom_prob newp = new_coef_probs[i][j][k][l][t];
- const aom_prob oldp = old_coef_probs[i][j][k][l][t];
- int s, u = 0;
-
- if (t == PIVOT_NODE)
- s = av1_prob_update_search_model_subframe(
- this_branch_ct, old_coef_probs[i][j][k][l], &newp, upd,
- stepsize, max_idx);
- else
- s = av1_prob_update_search_subframe(this_branch_ct[t], oldp,
- &newp, upd, max_idx);
- if (s > 0 && newp != oldp) u = 1;
- if (u)
- savings += s - (int)(av1_cost_zero(upd));
- else
- savings -= (int)(av1_cost_zero(upd));
- update[u]++;
- }
- }
- }
- }
- }
-
- /* Is coef updated at all */
- if (update[1] == 0 || savings < 0) {
- aom_write_bit(bc, 0);
- return;
- }
- aom_write_bit(bc, 1);
- for (i = 0; i < PLANE_TYPES; ++i) {
- for (j = 0; j < REF_TYPES; ++j) {
- for (k = 0; k < COEF_BANDS; ++k) {
- for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
- for (t = 0; t < ENTROPY_NODES; ++t) {
- for (idx = 0; idx <= max_idx; ++idx) {
- memcpy(this_branch_ct[t][idx],
- branch_ct[idx][tx_size][i][j][k][l][t],
- 2 * sizeof(this_branch_ct[t][idx][0]));
- }
- }
- for (t = 0; t < entropy_nodes_update; ++t) {
- aom_prob newp = new_coef_probs[i][j][k][l][t];
- aom_prob *oldp = old_coef_probs[i][j][k][l] + t;
- int s;
- int u = 0;
-
- if (t == PIVOT_NODE)
- s = av1_prob_update_search_model_subframe(
- this_branch_ct, old_coef_probs[i][j][k][l], &newp, upd,
- stepsize, max_idx);
- else
- s = av1_prob_update_search_subframe(this_branch_ct[t], *oldp,
- &newp, upd, max_idx);
- if (s > 0 && newp != *oldp) u = 1;
- aom_write(bc, u, upd);
- if (u) {
- /* send/use new probability */
- av1_write_prob_diff_update(bc, newp, *oldp);
- *oldp = newp;
- }
- }
- }
- }
- }
- }
- return;
- }
-
- case ONE_LOOP_REDUCED: {
- int updates = 0;
- int noupdates_before_first = 0;
- for (i = 0; i < PLANE_TYPES; ++i) {
- for (j = 0; j < REF_TYPES; ++j) {
- for (k = 0; k < COEF_BANDS; ++k) {
- for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
- for (t = 0; t < ENTROPY_NODES; ++t) {
- for (idx = 0; idx <= max_idx; ++idx) {
- memcpy(this_branch_ct[t][idx],
- branch_ct[idx][tx_size][i][j][k][l][t],
- 2 * sizeof(this_branch_ct[t][idx][0]));
- }
- }
- for (t = 0; t < entropy_nodes_update; ++t) {
- aom_prob newp = new_coef_probs[i][j][k][l][t];
- aom_prob *oldp = old_coef_probs[i][j][k][l] + t;
- int s;
- int u = 0;
- if (t == PIVOT_NODE)
- s = av1_prob_update_search_model_subframe(
- this_branch_ct, old_coef_probs[i][j][k][l], &newp, upd,
- stepsize, max_idx);
- else
- s = av1_prob_update_search_subframe(this_branch_ct[t], *oldp,
- &newp, upd, max_idx);
- if (s > 0 && newp != *oldp) u = 1;
- updates += u;
- if (u == 0 && updates == 0) {
- noupdates_before_first++;
- continue;
- }
- if (u == 1 && updates == 1) {
- int v;
- // first update
- aom_write_bit(bc, 1);
- for (v = 0; v < noupdates_before_first; ++v)
- aom_write(bc, 0, upd);
- }
- aom_write(bc, u, upd);
- if (u) {
- /* send/use new probability */
- av1_write_prob_diff_update(bc, newp, *oldp);
- *oldp = newp;
- }
- }
- }
- }
- }
- }
- if (updates == 0) {
- aom_write_bit(bc, 0); // no updates
- }
- return;
- }
- default: assert(0);
- }
-}
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
-
-#if !(CONFIG_EC_ADAPT && CONFIG_NEW_TOKENSET)
+#if !CONFIG_EC_ADAPT
static void update_coef_probs(AV1_COMP *cpi, aom_writer *w) {
const TX_MODE tx_mode = cpi->common.tx_mode;
const TX_SIZE max_tx_size = tx_mode_to_biggest_tx_size[tx_mode];
TX_SIZE tx_size;
-#if CONFIG_SUBFRAME_PROB_UPDATE
- AV1_COMMON *cm = &cpi->common;
- SUBFRAME_STATS *subframe_stats = &cpi->subframe_stats;
- int i;
- av1_coeff_probs_model dummy_frame_coef_probs[PLANE_TYPES];
-
- if (cm->do_subframe_update &&
- cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
- av1_copy(cpi->common.fc->coef_probs,
- subframe_stats->enc_starting_coef_probs);
- for (i = 0; i <= cpi->common.coef_probs_update_idx; ++i) {
- get_coef_counts_diff(cpi, i, cpi->wholeframe_stats.coef_counts_buf[i],
- cpi->wholeframe_stats.eob_counts_buf[i]);
- }
- }
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
for (tx_size = 0; tx_size <= max_tx_size; ++tx_size) {
av1_coeff_stats frame_branch_ct[PLANE_TYPES];
@@ -3486,63 +3198,13 @@ static void update_coef_probs(AV1_COMP *cpi, aom_writer *w) {
(tx_size >= TX_16X16 && cpi->sf.tx_size_search_method == USE_TX_8X8)) {
aom_write_bit(w, 0);
} else {
-#if CONFIG_SUBFRAME_PROB_UPDATE
- if (cm->do_subframe_update &&
- cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
- unsigned int this_eob_counts_copy[PLANE_TYPES][REF_TYPES][COEF_BANDS]
- [COEFF_CONTEXTS];
- av1_coeff_count coef_counts_copy[PLANE_TYPES];
- av1_copy(this_eob_counts_copy, cpi->common.counts.eob_branch[tx_size]);
- av1_copy(coef_counts_copy, cpi->td.rd_counts.coef_counts[tx_size]);
- build_tree_distribution(cpi, tx_size, frame_branch_ct,
- frame_coef_probs);
- for (i = 0; i <= cpi->common.coef_probs_update_idx; ++i) {
- av1_copy(cpi->common.counts.eob_branch[tx_size],
- cpi->wholeframe_stats.eob_counts_buf[i][tx_size]);
- av1_copy(cpi->td.rd_counts.coef_counts[tx_size],
- cpi->wholeframe_stats.coef_counts_buf[i][tx_size]);
- build_tree_distribution(cpi, tx_size, cpi->branch_ct_buf[i][tx_size],
- dummy_frame_coef_probs);
- }
- av1_copy(cpi->common.counts.eob_branch[tx_size], this_eob_counts_copy);
- av1_copy(cpi->td.rd_counts.coef_counts[tx_size], coef_counts_copy);
-
- update_coef_probs_subframe(w, cpi, tx_size, cpi->branch_ct_buf,
- frame_coef_probs);
- } else {
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
- build_tree_distribution(cpi, tx_size, frame_branch_ct,
- frame_coef_probs);
- update_coef_probs_common(w, cpi, tx_size, frame_branch_ct,
- frame_coef_probs);
-#if CONFIG_SUBFRAME_PROB_UPDATE
- }
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
- }
- }
-
-#if CONFIG_SUBFRAME_PROB_UPDATE
- av1_copy(cm->starting_coef_probs, cm->fc->coef_probs);
- av1_copy(subframe_stats->coef_probs_buf[0], cm->fc->coef_probs);
- if (cm->do_subframe_update &&
- cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
- unsigned int eob_counts_copy[TX_SIZES][PLANE_TYPES][REF_TYPES][COEF_BANDS]
- [COEFF_CONTEXTS];
- av1_copy(eob_counts_copy, cm->counts.eob_branch);
- for (i = 1; i <= cpi->common.coef_probs_update_idx; ++i) {
- for (tx_size = 0; tx_size <= max_tx_size; ++tx_size)
- av1_full_to_model_counts(cm->counts.coef[tx_size],
- subframe_stats->coef_counts_buf[i][tx_size]);
- av1_copy(cm->counts.eob_branch, subframe_stats->eob_counts_buf[i]);
- av1_partial_adapt_probs(cm, 0, 0);
- av1_copy(subframe_stats->coef_probs_buf[i], cm->fc->coef_probs);
+ build_tree_distribution(cpi, tx_size, frame_branch_ct, frame_coef_probs);
+ update_coef_probs_common(w, cpi, tx_size, frame_branch_ct,
+ frame_coef_probs);
}
- av1_copy(cm->fc->coef_probs, subframe_stats->coef_probs_buf[0]);
- av1_copy(cm->counts.eob_branch, eob_counts_copy);
}
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
}
-#endif // !(CONFIG_EC_ADAPT && CONFIG_NEW_TOKENSET)
+#endif // !CONFIG_EC_ADAPT
#endif // !CONFIG_EC_ADAPT
#endif // !CONFIG_LV_MAP
@@ -3574,7 +3236,14 @@ static void encode_restoration_mode(AV1_COMMON *cm,
rsi = &cm->rst_info[p];
switch (rsi->frame_restoration_type) {
case RESTORE_NONE: aom_wb_write_bit(wb, 0); break;
- case RESTORE_WIENER: aom_wb_write_bit(wb, 1); break;
+ case RESTORE_WIENER:
+ aom_wb_write_bit(wb, 1);
+ aom_wb_write_bit(wb, 0);
+ break;
+ case RESTORE_SGRPROJ:
+ aom_wb_write_bit(wb, 1);
+ aom_wb_write_bit(wb, 1);
+ break;
default: assert(0);
}
}
@@ -3687,6 +3356,7 @@ static void encode_restoration(AV1_COMMON *cm, aom_writer *wb) {
}
for (p = 1; p < MAX_MB_PLANE; ++p) {
set_default_wiener(&ref_wiener_info);
+ set_default_sgrproj(&ref_sgrproj_info);
rsi = &cm->rst_info[p];
if (rsi->frame_restoration_type == RESTORE_WIENER) {
for (i = 0; i < ntiles_uv; ++i) {
@@ -3697,6 +3367,15 @@ static void encode_restoration(AV1_COMMON *cm, aom_writer *wb) {
write_wiener_filter(&rsi->wiener_info[i], &ref_wiener_info, wb);
}
}
+ } else if (rsi->frame_restoration_type == RESTORE_SGRPROJ) {
+ for (i = 0; i < ntiles_uv; ++i) {
+ if (ntiles_uv > 1)
+ aom_write(wb, rsi->restoration_type[i] != RESTORE_NONE,
+ RESTORE_NONE_SGRPROJ_PROB);
+ if (rsi->restoration_type[i] != RESTORE_NONE) {
+ write_sgrproj_filter(&rsi->sgrproj_info[i], &ref_sgrproj_info, wb);
+ }
+ }
} else if (rsi->frame_restoration_type != RESTORE_NONE) {
assert(0);
}
@@ -3972,6 +3651,9 @@ static void write_tile_info(const AV1_COMMON *const cm,
aom_wb_write_literal(wb, tile_width - 1, 6);
aom_wb_write_literal(wb, tile_height - 1, 6);
}
+#if CONFIG_DEPENDENT_HORZTILES
+ if (tile_height > 1) aom_wb_write_bit(wb, cm->dependent_horz_tiles);
+#endif
#else
int min_log2_tile_cols, max_log2_tile_cols, ones;
av1_get_tile_n_bits(cm->mi_cols, &min_log2_tile_cols, &max_log2_tile_cols);
@@ -3985,11 +3667,10 @@ static void write_tile_info(const AV1_COMMON *const cm,
// rows
aom_wb_write_bit(wb, cm->log2_tile_rows != 0);
if (cm->log2_tile_rows != 0) aom_wb_write_bit(wb, cm->log2_tile_rows != 1);
-#endif // CONFIG_EXT_TILE
-
#if CONFIG_DEPENDENT_HORZTILES
if (cm->log2_tile_rows != 0) aom_wb_write_bit(wb, cm->dependent_horz_tiles);
#endif
+#endif // CONFIG_EXT_TILE
#if CONFIG_LOOPFILTERING_ACROSS_TILES
aom_wb_write_bit(wb, cm->loop_filter_across_tiles_enabled);
@@ -4442,9 +4123,6 @@ static void write_render_size(const AV1_COMMON *cm,
#if CONFIG_FRAME_SUPERRES
static void write_superres_scale(const AV1_COMMON *const cm,
struct aom_write_bit_buffer *wb) {
- // This scaling and frame superres are probably incompatible
- assert(cm->width == cm->render_width && cm->height == cm->render_height);
-
// First bit is whether to to scale or not
if (cm->superres_scale_numerator == SUPERRES_SCALE_DENOMINATOR) {
aom_wb_write_bit(wb, 0); // no scaling
@@ -4460,23 +4138,9 @@ static void write_superres_scale(const AV1_COMMON *const cm,
static void write_frame_size(const AV1_COMMON *cm,
struct aom_write_bit_buffer *wb) {
-#if CONFIG_FRAME_SUPERRES
- // If SUPERRES scaling is happening, write the full resolution instead of the
- // downscaled resolution. The decoder will reduce this resolution itself.
- if (cm->superres_scale_numerator != SUPERRES_SCALE_DENOMINATOR) {
- aom_wb_write_literal(wb, cm->superres_width - 1, 16);
- aom_wb_write_literal(wb, cm->superres_height - 1, 16);
- } else {
-#endif // CONFIG_FRAME_SUPERRES
- aom_wb_write_literal(wb, cm->width - 1, 16);
- aom_wb_write_literal(wb, cm->height - 1, 16);
-#if CONFIG_FRAME_SUPERRES
- }
-#endif // CONFIG_FRAME_SUPERRES
+ aom_wb_write_literal(wb, cm->width - 1, 16);
+ aom_wb_write_literal(wb, cm->height - 1, 16);
- // TODO(afergs): Also write something different to render_size?
- // When superres scales, they'll be almost guaranteed to be
- // different on the other side.
write_render_size(cm, wb);
#if CONFIG_FRAME_SUPERRES
write_superres_scale(cm, wb);
@@ -4559,6 +4223,28 @@ void write_sequence_header(SequenceHeader *seq_params) {
}
#endif
+#if CONFIG_EXT_INTER
+static void write_compound_tools(const AV1_COMMON *cm,
+ struct aom_write_bit_buffer *wb) {
+ (void)cm;
+ (void)wb;
+#if CONFIG_INTERINTRA
+ if (!frame_is_intra_only(cm) && cm->reference_mode != COMPOUND_REFERENCE) {
+ aom_wb_write_bit(wb, cm->allow_interintra_compound);
+ } else {
+ assert(cm->allow_interintra_compound == 0);
+ }
+#endif // CONFIG_INTERINTRA
+#if CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT
+ if (!frame_is_intra_only(cm) && cm->reference_mode != SINGLE_REFERENCE) {
+ aom_wb_write_bit(wb, cm->allow_masked_compound);
+ } else {
+ assert(cm->allow_masked_compound == 0);
+ }
+#endif // CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT
+}
+#endif // CONFIG_EXT_INTER
+
static void write_uncompressed_header(AV1_COMP *cpi,
struct aom_write_bit_buffer *wb) {
AV1_COMMON *const cm = &cpi->common;
@@ -4637,14 +4323,14 @@ static void write_uncompressed_header(AV1_COMP *cpi,
assert(cpi->common.ans_window_size_log2 < 24);
aom_wb_write_literal(wb, cpi->common.ans_window_size_log2 - 8, 4);
#endif // CONFIG_ANS && ANS_MAX_SYMBOLS
-#if CONFIG_PALETTE
+#if CONFIG_PALETTE || CONFIG_INTRABC
aom_wb_write_bit(wb, cm->allow_screen_content_tools);
-#endif // CONFIG_PALETTE
+#endif // CONFIG_PALETTE || CONFIG_INTRABC
} else {
if (!cm->show_frame) aom_wb_write_bit(wb, cm->intra_only);
-#if CONFIG_PALETTE
+#if CONFIG_PALETTE || CONFIG_INTRABC
if (cm->intra_only) aom_wb_write_bit(wb, cm->allow_screen_content_tools);
-#endif // CONFIG_PALETTE
+#endif // CONFIG_PALETTE || CONFIG_INTRABC
if (!cm->error_resilient_mode) {
if (cm->intra_only) {
aom_wb_write_bit(wb,
@@ -4813,6 +4499,9 @@ static void write_uncompressed_header(AV1_COMP *cpi,
if (!use_hybrid_pred) aom_wb_write_bit(wb, use_compound_pred);
#endif // !CONFIG_REF_ADAPT
}
+#if CONFIG_EXT_INTER
+ write_compound_tools(cm, wb);
+#endif // CONFIG_EXT_INTER
#if CONFIG_EXT_TX
aom_wb_write_bit(wb, cm->reduced_tx_set_used);
@@ -4896,14 +4585,6 @@ static void write_global_motion(AV1_COMP *cpi, aom_writer *w) {
AV1_COMMON *const cm = &cpi->common;
int frame;
for (frame = LAST_FRAME; frame <= ALTREF_FRAME; ++frame) {
-#if !CONFIG_REF_MV
- // With ref-mv, clearing unused global motion models here is
- // unsafe, and we need to rely on the recode loop to do it
- // instead. See av1_find_mv_refs for details.
- if (!cpi->td.rd_counts.global_motion_used[frame]) {
- set_default_warp_params(&cm->global_motion[frame]);
- }
-#endif
write_global_motion_params(
&cm->global_motion[frame], &cm->prev_frame->global_motion[frame],
cm->fc->global_motion_types_prob, w, cm->allow_high_precision_mv);
@@ -4950,13 +4631,18 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
#if !CONFIG_EC_ADAPT
update_txfm_probs(cm, header_bc, counts);
#endif
+#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
+ if (cm->tx_mode == TX_MODE_SELECT)
+ av1_cond_prob_diff_update(header_bc, &cm->fc->quarter_tx_size_prob,
+ cm->counts.quarter_tx_size, probwt);
+#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
#if CONFIG_LV_MAP
av1_write_txb_probs(cpi, header_bc);
#else
#if !CONFIG_PVQ
-#if !(CONFIG_EC_ADAPT && CONFIG_NEW_TOKENSET)
+#if !CONFIG_EC_ADAPT
update_coef_probs(cpi, header_bc);
-#endif // !(CONFIG_EC_ADAPT && CONFIG_NEW_TOKENSET)
+#endif // !CONFIG_EC_ADAPT
#endif // CONFIG_PVQ
#endif // CONFIG_LV_MAP
@@ -5023,9 +4709,7 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
if (frame_is_intra_only(cm)) {
av1_copy(cm->kf_y_prob, av1_kf_y_mode_prob);
-#if CONFIG_EC_MULTISYMBOL
av1_copy(cm->fc->kf_y_cdf, av1_kf_y_mode_cdf);
-#endif
#if !CONFIG_EC_ADAPT
for (i = 0; i < INTRA_MODES; ++i)
@@ -5034,21 +4718,19 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
counts->kf_y_mode[i][j], INTRA_MODES, probwt,
header_bc);
#endif // CONFIG_EC_ADAPT
- } else {
-#if CONFIG_REF_MV
- update_inter_mode_probs(cm, header_bc, counts);
-#else
-#if !CONFIG_EC_ADAPT
- for (i = 0; i < INTER_MODE_CONTEXTS; ++i) {
- prob_diff_update(av1_inter_mode_tree, cm->fc->inter_mode_probs[i],
- counts->inter_mode[i], INTER_MODES, probwt, header_bc);
+#if CONFIG_INTRABC
+ if (cm->allow_screen_content_tools) {
+ av1_cond_prob_diff_update(header_bc, &fc->intrabc_prob,
+ cm->counts.intrabc, probwt);
}
#endif
-#endif
+ } else {
+ update_inter_mode_probs(cm, header_bc, counts);
#if CONFIG_EXT_INTER
update_inter_compound_mode_probs(cm, probwt, header_bc);
-
- if (cm->reference_mode != COMPOUND_REFERENCE) {
+#if CONFIG_INTERINTRA
+ if (cm->reference_mode != COMPOUND_REFERENCE &&
+ cm->allow_interintra_compound) {
for (i = 0; i < BLOCK_SIZE_GROUPS; i++) {
if (is_interintra_allowed_bsize_group(i)) {
av1_cond_prob_diff_update(header_bc, &fc->interintra_prob[i],
@@ -5060,14 +4742,17 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
av1_interintra_mode_tree, cm->fc->interintra_mode_prob[i],
counts->interintra_mode[i], INTERINTRA_MODES, probwt, header_bc);
}
+#if CONFIG_WEDGE
for (i = 0; i < BLOCK_SIZES; i++) {
if (is_interintra_allowed_bsize(i) && is_interintra_wedge_used(i))
av1_cond_prob_diff_update(header_bc, &fc->wedge_interintra_prob[i],
cm->counts.wedge_interintra[i], probwt);
}
+#endif // CONFIG_WEDGE
}
+#endif // CONFIG_INTERINTRA
#if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
- if (cm->reference_mode != SINGLE_REFERENCE) {
+ if (cm->reference_mode != SINGLE_REFERENCE && cm->allow_masked_compound) {
for (i = 0; i < BLOCK_SIZES; i++)
prob_diff_update(av1_compound_type_tree, fc->compound_type_prob[i],
cm->counts.compound_interinter[i], COMPOUND_TYPES,
@@ -5133,12 +4818,7 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
}
#endif
- av1_write_nmv_probs(cm, cm->allow_high_precision_mv, header_bc,
-#if CONFIG_REF_MV
- counts->mv);
-#else
- &counts->mv);
-#endif
+ av1_write_nmv_probs(cm, cm->allow_high_precision_mv, header_bc, counts->mv);
#if !CONFIG_EC_ADAPT
update_ext_tx_probs(cm, header_bc);
#endif
@@ -5149,22 +4829,12 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
write_global_motion(cpi, header_bc);
#endif // CONFIG_GLOBAL_MOTION
}
-#if CONFIG_EC_MULTISYMBOL
#if !CONFIG_EC_ADAPT
-#if CONFIG_NEW_TOKENSET
av1_coef_head_cdfs(fc);
-#endif
av1_coef_pareto_cdfs(fc);
-#if CONFIG_REF_MV
for (i = 0; i < NMV_CONTEXTS; ++i) av1_set_mv_cdfs(&fc->nmvc[i]);
-#else
- av1_set_mv_cdfs(&fc->nmvc);
-#endif
-#if CONFIG_EC_MULTISYMBOL
av1_set_mode_cdfs(cm);
-#endif
#endif // !CONFIG_EC_ADAPT
-#endif
#if CONFIG_ANS
aom_buf_ans_flush(header_bc);
header_size = buf_ans_write_end(header_bc);
diff --git a/third_party/aom/av1/encoder/block.h b/third_party/aom/av1/encoder/block.h
index 39e08d5b4..e16479e64 100644
--- a/third_party/aom/av1/encoder/block.h
+++ b/third_party/aom/av1/encoder/block.h
@@ -17,9 +17,7 @@
#if CONFIG_PVQ
#include "av1/encoder/encint.h"
#endif
-#if CONFIG_REF_MV
#include "av1/common/mvref_common.h"
-#endif
#ifdef __cplusplus
extern "C" {
@@ -79,13 +77,11 @@ typedef struct {
int dc_sign_ctx[MAX_MB_PLANE]
[MAX_SB_SQUARE / (TX_SIZE_W_MIN * TX_SIZE_H_MIN)];
#endif
-#if CONFIG_REF_MV
uint8_t ref_mv_count[MODE_CTX_REF_FRAMES];
CANDIDATE_MV ref_mv_stack[MODE_CTX_REF_FRAMES][MAX_REF_MV_STACK_SIZE];
#if CONFIG_EXT_INTER
int16_t compound_mode_context[MODE_CTX_REF_FRAMES];
#endif // CONFIG_EXT_INTER
-#endif
} MB_MODE_INFO_EXT;
typedef struct {
@@ -141,27 +137,18 @@ struct macroblock {
unsigned int pred_sse[TOTAL_REFS_PER_FRAME];
int pred_mv_sad[TOTAL_REFS_PER_FRAME];
-#if CONFIG_REF_MV
int *nmvjointcost;
int nmv_vec_cost[NMV_CONTEXTS][MV_JOINTS];
int *nmvcost[NMV_CONTEXTS][2];
int *nmvcost_hp[NMV_CONTEXTS][2];
int **mv_cost_stack[NMV_CONTEXTS];
- int *nmvjointsadcost;
-#else
- int nmvjointcost[MV_JOINTS];
- int *nmvcost[2];
- int *nmvcost_hp[2];
- int nmvjointsadcost[MV_JOINTS];
-#endif
-
int **mvcost;
- int *nmvsadcost[2];
- int *nmvsadcost_hp[2];
- int **mvsadcost;
+
#if CONFIG_MOTION_VAR
int32_t *wsrc_buf;
int32_t *mask_buf;
+ uint8_t *above_pred_buf;
+ uint8_t *left_pred_buf;
#endif // CONFIG_MOTION_VAR
#if CONFIG_PALETTE
@@ -174,10 +161,8 @@ struct macroblock {
#if CONFIG_VAR_TX
uint8_t blk_skip[MAX_MB_PLANE][MAX_MIB_SIZE * MAX_MIB_SIZE * 8];
-#if CONFIG_REF_MV
uint8_t blk_skip_drl[MAX_MB_PLANE][MAX_MIB_SIZE * MAX_MIB_SIZE * 8];
#endif
-#endif
int skip;
@@ -226,8 +211,11 @@ struct macroblock {
// This is needed when using the 8x8 Daala distortion metric during RDO,
// because it evaluates distortion in a different order than the underlying
// 4x4 blocks are coded.
- int rate_4x4[256];
-#endif
+ int rate_4x4[MAX_SB_SQUARE / (TX_SIZE_W_MIN * TX_SIZE_H_MIN)];
+#if CONFIG_CB4X4
+ DECLARE_ALIGNED(16, uint8_t, decoded_8x8[8 * 8]);
+#endif // CONFIG_CB4X4
+#endif // CONFIG_DAALA_DIST
#if CONFIG_CFL
// Whether luma needs to be stored during RDO.
int cfl_store_y;
diff --git a/third_party/aom/av1/encoder/context_tree.h b/third_party/aom/av1/encoder/context_tree.h
index 67954126c..4f9d5e374 100644
--- a/third_party/aom/av1/encoder/context_tree.h
+++ b/third_party/aom/av1/encoder/context_tree.h
@@ -34,7 +34,6 @@ typedef struct {
uint8_t *blk_skip[MAX_MB_PLANE];
#endif
- // dual buffer pointers, 0: in use, 1: best in store
tran_low_t *coeff[MAX_MB_PLANE];
tran_low_t *qcoeff[MAX_MB_PLANE];
tran_low_t *dqcoeff[MAX_MB_PLANE];
@@ -48,9 +47,8 @@ typedef struct {
int num_4x4_blk;
int skip;
- int pred_pixel_ready;
// For current partition, only if all Y, U, and V transform blocks'
- // coefficients are quantized to 0, skippable is set to 0.
+ // coefficients are quantized to 0, skippable is set to 1.
int skippable;
int best_mode_index;
int hybrid_pred_diff;
diff --git a/third_party/aom/av1/encoder/corner_match.c b/third_party/aom/av1/encoder/corner_match.c
index 64ee0c5ae..3827b65fa 100644
--- a/third_party/aom/av1/encoder/corner_match.c
+++ b/third_party/aom/av1/encoder/corner_match.c
@@ -9,16 +9,13 @@
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
-#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <math.h>
+#include "./av1_rtcd.h"
#include "av1/encoder/corner_match.h"
-#define MATCH_SZ 13
-#define MATCH_SZ_BY2 ((MATCH_SZ - 1) / 2)
-#define MATCH_SZ_SQ (MATCH_SZ * MATCH_SZ)
#define SEARCH_SZ 9
#define SEARCH_SZ_BY2 ((SEARCH_SZ - 1) / 2)
@@ -28,8 +25,8 @@
centered at (x, y).
*/
static double compute_variance(unsigned char *im, int stride, int x, int y) {
- int sum = 0.0;
- int sumsq = 0.0;
+ int sum = 0;
+ int sumsq = 0;
int var;
int i, j;
for (i = 0; i < MATCH_SZ; ++i)
@@ -46,9 +43,9 @@ static double compute_variance(unsigned char *im, int stride, int x, int y) {
correlation/standard deviation are taken over MATCH_SZ by MATCH_SZ windows
of each image, centered at (x1, y1) and (x2, y2) respectively.
*/
-static double compute_cross_correlation(unsigned char *im1, int stride1, int x1,
- int y1, unsigned char *im2, int stride2,
- int x2, int y2) {
+double compute_cross_correlation_c(unsigned char *im1, int stride1, int x1,
+ int y1, unsigned char *im2, int stride2,
+ int x2, int y2) {
int v1, v2;
int sum1 = 0;
int sum2 = 0;
diff --git a/third_party/aom/av1/encoder/corner_match.h b/third_party/aom/av1/encoder/corner_match.h
index c0458642c..3b16f9efc 100644
--- a/third_party/aom/av1/encoder/corner_match.h
+++ b/third_party/aom/av1/encoder/corner_match.h
@@ -15,6 +15,10 @@
#include <stdlib.h>
#include <memory.h>
+#define MATCH_SZ 13
+#define MATCH_SZ_BY2 ((MATCH_SZ - 1) / 2)
+#define MATCH_SZ_SQ (MATCH_SZ * MATCH_SZ)
+
typedef struct {
int x, y;
int rx, ry;
diff --git a/third_party/aom/av1/encoder/daala_compat_enc.c b/third_party/aom/av1/encoder/daala_compat_enc.c
index 3df424cac..c60e2d3d7 100644
--- a/third_party/aom/av1/encoder/daala_compat_enc.c
+++ b/third_party/aom/av1/encoder/daala_compat_enc.c
@@ -12,19 +12,19 @@
#include "encint.h"
void od_encode_checkpoint(const daala_enc_ctx *enc, od_rollback_buffer *rbuf) {
-#if CONFIG_DAALA_EC
+#if !CONFIG_ANS
od_ec_enc_checkpoint(&rbuf->ec, &enc->w.ec);
#else
-#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
+#error "CONFIG_PVQ currently requires !CONFIG_ANS."
#endif
OD_COPY(&rbuf->adapt, enc->state.adapt, 1);
}
void od_encode_rollback(daala_enc_ctx *enc, const od_rollback_buffer *rbuf) {
-#if CONFIG_DAALA_EC
+#if !CONFIG_ANS
od_ec_enc_rollback(&enc->w.ec, &rbuf->ec);
#else
-#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
+#error "CONFIG_PVQ currently requires !CONFIG_ANS."
#endif
OD_COPY(enc->state.adapt, &rbuf->adapt, 1);
}
diff --git a/third_party/aom/av1/encoder/dct.c b/third_party/aom/av1/encoder/dct.c
index 09e1b0563..f6b64f0f7 100644
--- a/third_party/aom/av1/encoder/dct.c
+++ b/third_party/aom/av1/encoder/dct.c
@@ -19,7 +19,7 @@
#include "aom_ports/mem.h"
#include "av1/common/blockd.h"
#include "av1/common/av1_fwd_txfm1d.h"
-#include "av1/common/av1_fwd_txfm2d_cfg.h"
+#include "av1/common/av1_fwd_txfm1d_cfg.h"
#include "av1/common/idct.h"
static INLINE void range_check(const tran_low_t *input, const int size,
@@ -1022,6 +1022,10 @@ static void fhalfright32(const tran_low_t *input, tran_low_t *output) {
}
#if CONFIG_EXT_TX
+// TODO(sarahparker) these functions will be removed once the highbitdepth
+// codepath works properly for rectangular transforms. They have almost
+// identical versions in av1_fwd_txfm1d.c, but those are currently only
+// being used for square transforms.
static void fidtx4(const tran_low_t *input, tran_low_t *output) {
int i;
for (i = 0; i < 4; ++i)
@@ -2133,8 +2137,7 @@ static void fdct64_col(const tran_low_t *input, tran_low_t *output) {
int32_t in[64], out[64];
int i;
for (i = 0; i < 64; ++i) in[i] = (int32_t)input[i];
- av1_fdct64_new(in, out, fwd_cos_bit_col_dct_dct_64,
- fwd_stage_range_col_dct_dct_64);
+ av1_fdct64_new(in, out, fwd_cos_bit_col_dct_64, fwd_stage_range_col_dct_64);
for (i = 0; i < 64; ++i) output[i] = (tran_low_t)out[i];
}
@@ -2142,8 +2145,7 @@ static void fdct64_row(const tran_low_t *input, tran_low_t *output) {
int32_t in[64], out[64];
int i;
for (i = 0; i < 64; ++i) in[i] = (int32_t)input[i];
- av1_fdct64_new(in, out, fwd_cos_bit_row_dct_dct_64,
- fwd_stage_range_row_dct_dct_64);
+ av1_fdct64_new(in, out, fwd_cos_bit_row_dct_64, fwd_stage_range_row_dct_64);
for (i = 0; i < 64; ++i) output[i] = (tran_low_t)out[i];
}
@@ -2225,4 +2227,49 @@ void av1_highbd_fht64x64_c(const int16_t *input, tran_low_t *output, int stride,
}
#endif // CONFIG_TX64X64
#endif // CONFIG_HIGHBITDEPTH
+
+#if CONFIG_DPCM_INTRA
+void av1_dpcm_ft4_c(const int16_t *input, int stride, TX_TYPE_1D tx_type,
+ tran_low_t *output) {
+ assert(tx_type < TX_TYPES_1D);
+ static const transform_1d FHT[] = { fdct4, fadst4, fadst4, fidtx4 };
+ const transform_1d ft = FHT[tx_type];
+ tran_low_t temp_in[4];
+ for (int i = 0; i < 4; ++i)
+ temp_in[i] = (tran_low_t)fdct_round_shift(input[i * stride] * 4 * Sqrt2);
+ ft(temp_in, output);
+}
+
+void av1_dpcm_ft8_c(const int16_t *input, int stride, TX_TYPE_1D tx_type,
+ tran_low_t *output) {
+ assert(tx_type < TX_TYPES_1D);
+ static const transform_1d FHT[] = { fdct8, fadst8, fadst8, fidtx8 };
+ const transform_1d ft = FHT[tx_type];
+ tran_low_t temp_in[8];
+ for (int i = 0; i < 8; ++i) temp_in[i] = input[i * stride] * 4;
+ ft(temp_in, output);
+}
+
+void av1_dpcm_ft16_c(const int16_t *input, int stride, TX_TYPE_1D tx_type,
+ tran_low_t *output) {
+ assert(tx_type < TX_TYPES_1D);
+ static const transform_1d FHT[] = { fdct16, fadst16, fadst16, fidtx16 };
+ const transform_1d ft = FHT[tx_type];
+ tran_low_t temp_in[16];
+ for (int i = 0; i < 16; ++i)
+ temp_in[i] = (tran_low_t)fdct_round_shift(input[i * stride] * 2 * Sqrt2);
+ ft(temp_in, output);
+}
+
+void av1_dpcm_ft32_c(const int16_t *input, int stride, TX_TYPE_1D tx_type,
+ tran_low_t *output) {
+ assert(tx_type < TX_TYPES_1D);
+ static const transform_1d FHT[] = { fdct32, fhalfright32, fhalfright32,
+ fidtx32 };
+ const transform_1d ft = FHT[tx_type];
+ tran_low_t temp_in[32];
+ for (int i = 0; i < 32; ++i) temp_in[i] = input[i * stride];
+ ft(temp_in, output);
+}
+#endif // CONFIG_DPCM_INTRA
#endif // !AV1_DCT_GTEST
diff --git a/third_party/aom/av1/encoder/encodeframe.c b/third_party/aom/av1/encoder/encodeframe.c
index d254157e7..36d09c02a 100644
--- a/third_party/aom/av1/encoder/encodeframe.c
+++ b/third_party/aom/av1/encoder/encodeframe.c
@@ -72,8 +72,7 @@
static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
TOKENEXTRA **t, RUN_TYPE dry_run, int mi_row,
- int mi_col, BLOCK_SIZE bsize,
- PICK_MODE_CONTEXT *ctx, int *rate);
+ int mi_col, BLOCK_SIZE bsize, int *rate);
#if CONFIG_SUPERTX
static int check_intra_b(PICK_MODE_CONTEXT *ctx);
@@ -273,14 +272,13 @@ static void set_offsets_without_segment_id(const AV1_COMP *const cpi,
const int mi_width = mi_size_wide[bsize];
const int mi_height = mi_size_high[bsize];
- set_skip_context(xd, mi_row, mi_col);
-
set_mode_info_offsets(cpi, x, xd, mi_row, mi_col);
-
+ set_skip_context(xd, mi_row, mi_col);
#if CONFIG_VAR_TX
- xd->above_txfm_context = cm->above_txfm_context + mi_col;
- xd->left_txfm_context =
- xd->left_txfm_context_buffer + (mi_row & MAX_MIB_MASK);
+ xd->above_txfm_context =
+ cm->above_txfm_context + (mi_col << TX_UNIT_WIDE_LOG2);
+ xd->left_txfm_context = xd->left_txfm_context_buffer +
+ ((mi_row & MAX_MIB_MASK) << TX_UNIT_HIGH_LOG2);
xd->max_tx_size = max_txsize_lookup[bsize];
#endif
@@ -452,563 +450,6 @@ static void set_segment_id_supertx(const AV1_COMP *const cpi,
}
#endif // CONFIG_SUPERTX
-static void set_block_size(AV1_COMP *const cpi, MACROBLOCK *const x,
- MACROBLOCKD *const xd, int mi_row, int mi_col,
- BLOCK_SIZE bsize) {
- if (cpi->common.mi_cols > mi_col && cpi->common.mi_rows > mi_row) {
- const int mi_width = AOMMAX(mi_size_wide[bsize], mi_size_wide[BLOCK_8X8]);
- const int mi_height = AOMMAX(mi_size_high[bsize], mi_size_high[BLOCK_8X8]);
- for (int r = 0; r < mi_height; ++r) {
- for (int c = 0; c < mi_width; ++c) {
- set_mode_info_offsets(cpi, x, xd, mi_row + r, mi_col + c);
- xd->mi[0]->mbmi.sb_type = bsize;
- }
- }
- }
-}
-
-static void set_vt_partitioning(AV1_COMP *cpi, MACROBLOCK *const x,
- MACROBLOCKD *const xd, VAR_TREE *vt, int mi_row,
- int mi_col, const int64_t *const threshold,
- const BLOCK_SIZE *const bsize_min) {
- AV1_COMMON *const cm = &cpi->common;
- const int hbw = mi_size_wide[vt->bsize] / 2;
- const int hbh = mi_size_high[vt->bsize] / 2;
- const int has_cols = mi_col + hbw < cm->mi_cols;
- const int has_rows = mi_row + hbh < cm->mi_rows;
-
- if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return;
-
- assert(vt->bsize >= BLOCK_8X8);
-
- assert(hbh == hbw);
-
- if (vt->bsize == BLOCK_8X8 && cm->frame_type != KEY_FRAME) {
- set_block_size(cpi, x, xd, mi_row, mi_col, BLOCK_8X8);
- return;
- }
-
- if (vt->force_split || (!has_cols && !has_rows)) goto split;
-
- // For bsize=bsize_min (16x16/8x8 for 8x8/4x4 downsampling), select if
- // variance is below threshold, otherwise split will be selected.
- // No check for vert/horiz split as too few samples for variance.
- if (vt->bsize == bsize_min[0]) {
- if (has_cols && has_rows && vt->variances.none.variance < threshold[0]) {
- set_block_size(cpi, x, xd, mi_row, mi_col, vt->bsize);
- return;
- } else {
- BLOCK_SIZE subsize = get_subsize(vt->bsize, PARTITION_SPLIT);
- set_block_size(cpi, x, xd, mi_row, mi_col, subsize);
- if (vt->bsize > BLOCK_8X8) {
- set_block_size(cpi, x, xd, mi_row, mi_col + hbw, subsize);
- set_block_size(cpi, x, xd, mi_row + hbh, mi_col, subsize);
- set_block_size(cpi, x, xd, mi_row + hbh, mi_col + hbw, subsize);
- }
- return;
- }
- } else if (vt->bsize > bsize_min[0]) {
- // For key frame: take split for bsize above 32X32 or very high variance.
- if (cm->frame_type == KEY_FRAME &&
- (vt->bsize > BLOCK_32X32 ||
- vt->variances.none.variance > (threshold[0] << 4))) {
- goto split;
- }
- // If variance is low, take the bsize (no split).
- if (has_cols && has_rows && vt->variances.none.variance < threshold[0]) {
- set_block_size(cpi, x, xd, mi_row, mi_col, vt->bsize);
- return;
- }
-
- // Check vertical split.
- if (has_rows) {
- BLOCK_SIZE subsize = get_subsize(vt->bsize, PARTITION_VERT);
- if (vt->variances.vert[0].variance < threshold[0] &&
- vt->variances.vert[1].variance < threshold[0] &&
- get_plane_block_size(subsize, &xd->plane[1]) < BLOCK_INVALID) {
- set_block_size(cpi, x, xd, mi_row, mi_col, subsize);
- set_block_size(cpi, x, xd, mi_row, mi_col + hbw, subsize);
- return;
- }
- }
- // Check horizontal split.
- if (has_cols) {
- BLOCK_SIZE subsize = get_subsize(vt->bsize, PARTITION_HORZ);
- if (vt->variances.horz[0].variance < threshold[0] &&
- vt->variances.horz[1].variance < threshold[0] &&
- get_plane_block_size(subsize, &xd->plane[1]) < BLOCK_INVALID) {
- set_block_size(cpi, x, xd, mi_row, mi_col, subsize);
- set_block_size(cpi, x, xd, mi_row + hbh, mi_col, subsize);
- return;
- }
- }
- }
-
-split : {
- set_vt_partitioning(cpi, x, xd, vt->split[0], mi_row, mi_col, threshold + 1,
- bsize_min + 1);
- set_vt_partitioning(cpi, x, xd, vt->split[1], mi_row, mi_col + hbw,
- threshold + 1, bsize_min + 1);
- set_vt_partitioning(cpi, x, xd, vt->split[2], mi_row + hbh, mi_col,
- threshold + 1, bsize_min + 1);
- set_vt_partitioning(cpi, x, xd, vt->split[3], mi_row + hbh, mi_col + hbw,
- threshold + 1, bsize_min + 1);
- return;
-}
-}
-
-// Set the variance split thresholds for following the block sizes:
-// 0 - threshold_64x64, 1 - threshold_32x32, 2 - threshold_16x16,
-// 3 - vbp_threshold_8x8. vbp_threshold_8x8 (to split to 4x4 partition) is
-// currently only used on key frame.
-static void set_vbp_thresholds(AV1_COMP *cpi, int64_t thresholds[], int q) {
- AV1_COMMON *const cm = &cpi->common;
- const int is_key_frame = (cm->frame_type == KEY_FRAME);
- const int threshold_multiplier = is_key_frame ? 20 : 1;
- const int64_t threshold_base =
- (int64_t)(threshold_multiplier * cpi->y_dequant[q][1]);
- if (is_key_frame) {
- thresholds[1] = threshold_base;
- thresholds[2] = threshold_base >> 2;
- thresholds[3] = threshold_base >> 2;
- thresholds[4] = threshold_base << 2;
- } else {
- thresholds[2] = threshold_base;
- if (cm->width <= 352 && cm->height <= 288) {
- thresholds[1] = threshold_base >> 2;
- thresholds[3] = threshold_base << 3;
- } else {
- thresholds[1] = threshold_base;
- thresholds[2] = (5 * threshold_base) >> 2;
- if (cm->width >= 1920 && cm->height >= 1080)
- thresholds[2] = (7 * threshold_base) >> 2;
- thresholds[3] = threshold_base << cpi->oxcf.speed;
- }
- }
- thresholds[0] = INT64_MIN;
-}
-
-void av1_set_variance_partition_thresholds(AV1_COMP *cpi, int q) {
- AV1_COMMON *const cm = &cpi->common;
- SPEED_FEATURES *const sf = &cpi->sf;
- const int is_key_frame = (cm->frame_type == KEY_FRAME);
- if (sf->partition_search_type != VAR_BASED_PARTITION &&
- sf->partition_search_type != REFERENCE_PARTITION) {
- return;
- } else {
- set_vbp_thresholds(cpi, cpi->vbp_thresholds, q);
- // The thresholds below are not changed locally.
- if (is_key_frame) {
- cpi->vbp_threshold_sad = 0;
- cpi->vbp_bsize_min = BLOCK_8X8;
- } else {
- if (cm->width <= 352 && cm->height <= 288)
- cpi->vbp_threshold_sad = 100;
- else
- cpi->vbp_threshold_sad = (cpi->y_dequant[q][1] << 1) > 1000
- ? (cpi->y_dequant[q][1] << 1)
- : 1000;
- cpi->vbp_bsize_min = BLOCK_16X16;
- }
- cpi->vbp_threshold_minmax = 15 + (q >> 3);
- }
-}
-
-// Compute the minmax over the 8x8 subblocks.
-static int compute_minmax_8x8(const uint8_t *src, int src_stride,
- const uint8_t *ref, int ref_stride,
-#if CONFIG_HIGHBITDEPTH
- int highbd,
-#endif
- int pixels_wide, int pixels_high) {
- int k;
- int minmax_max = 0;
- int minmax_min = 255;
- // Loop over the 4 8x8 subblocks.
- for (k = 0; k < 4; k++) {
- const int x8_idx = ((k & 1) << 3);
- const int y8_idx = ((k >> 1) << 3);
- int min = 0;
- int max = 0;
- if (x8_idx < pixels_wide && y8_idx < pixels_high) {
- const int src_offset = y8_idx * src_stride + x8_idx;
- const int ref_offset = y8_idx * ref_stride + x8_idx;
-#if CONFIG_HIGHBITDEPTH
- if (highbd) {
- aom_highbd_minmax_8x8(src + src_offset, src_stride, ref + ref_offset,
- ref_stride, &min, &max);
- } else {
- aom_minmax_8x8(src + src_offset, src_stride, ref + ref_offset,
- ref_stride, &min, &max);
- }
-#else
- aom_minmax_8x8(src + src_offset, src_stride, ref + ref_offset, ref_stride,
- &min, &max);
-#endif
- if ((max - min) > minmax_max) minmax_max = (max - min);
- if ((max - min) < minmax_min) minmax_min = (max - min);
- }
- }
- return (minmax_max - minmax_min);
-}
-
-#if CONFIG_HIGHBITDEPTH
-static INLINE int avg_4x4(const uint8_t *const src, const int stride,
- const int highbd) {
- if (highbd) {
- return aom_highbd_avg_4x4(src, stride);
- } else {
- return aom_avg_4x4(src, stride);
- }
-}
-#else
-static INLINE int avg_4x4(const uint8_t *const src, const int stride) {
- return aom_avg_4x4(src, stride);
-}
-#endif
-
-#if CONFIG_HIGHBITDEPTH
-static INLINE int avg_8x8(const uint8_t *const src, const int stride,
- const int highbd) {
- if (highbd) {
- return aom_highbd_avg_8x8(src, stride);
- } else {
- return aom_avg_8x8(src, stride);
- }
-}
-#else
-static INLINE int avg_8x8(const uint8_t *const src, const int stride) {
- return aom_avg_8x8(src, stride);
-}
-#endif
-
-static void init_variance_tree(VAR_TREE *const vt,
-#if CONFIG_HIGHBITDEPTH
- const int highbd,
-#endif
- BLOCK_SIZE bsize, BLOCK_SIZE leaf_size,
- const int width, const int height,
- const uint8_t *const src, const int src_stride,
- const uint8_t *const ref, const int ref_stride) {
- assert(bsize >= leaf_size);
-
- vt->bsize = bsize;
-
- vt->force_split = 0;
-
- vt->src = src;
- vt->src_stride = src_stride;
- vt->ref = ref;
- vt->ref_stride = ref_stride;
-
- vt->width = width;
- vt->height = height;
-
-#if CONFIG_HIGHBITDEPTH
- vt->highbd = highbd;
-#endif // CONFIG_HIGHBITDEPTH
-
- if (bsize > leaf_size) {
- const BLOCK_SIZE subsize = get_subsize(bsize, PARTITION_SPLIT);
- const int px = block_size_wide[subsize];
-
- init_variance_tree(vt->split[0],
-#if CONFIG_HIGHBITDEPTH
- highbd,
-#endif // CONFIG_HIGHBITDEPTH
- subsize, leaf_size, AOMMIN(px, width),
- AOMMIN(px, height), src, src_stride, ref, ref_stride);
- init_variance_tree(vt->split[1],
-#if CONFIG_HIGHBITDEPTH
- highbd,
-#endif // CONFIG_HIGHBITDEPTH
- subsize, leaf_size, width - px, AOMMIN(px, height),
- src + px, src_stride, ref + px, ref_stride);
- init_variance_tree(vt->split[2],
-#if CONFIG_HIGHBITDEPTH
- highbd,
-#endif // CONFIG_HIGHBITDEPTH
- subsize, leaf_size, AOMMIN(px, width), height - px,
- src + px * src_stride, src_stride, ref + px * ref_stride,
- ref_stride);
- init_variance_tree(vt->split[3],
-#if CONFIG_HIGHBITDEPTH
- highbd,
-#endif // CONFIG_HIGHBITDEPTH
- subsize, leaf_size, width - px, height - px,
- src + px * src_stride + px, src_stride,
- ref + px * ref_stride + px, ref_stride);
- }
-}
-
-// Fill the variance tree based on averaging pixel values (sub-sampling), at
-// the leaf node size.
-static void fill_variance_tree(VAR_TREE *const vt, const BLOCK_SIZE leaf_size) {
- if (vt->bsize > leaf_size) {
- fill_variance_tree(vt->split[0], leaf_size);
- fill_variance_tree(vt->split[1], leaf_size);
- fill_variance_tree(vt->split[2], leaf_size);
- fill_variance_tree(vt->split[3], leaf_size);
- fill_variance_node(vt);
- } else if (vt->width <= 0 || vt->height <= 0) {
- fill_variance(0, 0, 0, &vt->variances.none);
- } else {
- unsigned int sse = 0;
- int sum = 0;
- int src_avg;
- int ref_avg;
- assert(leaf_size == BLOCK_4X4 || leaf_size == BLOCK_8X8);
- if (leaf_size == BLOCK_4X4) {
- src_avg = avg_4x4(vt->src, vt->src_stride IF_HBD(, vt->highbd));
- ref_avg = avg_4x4(vt->ref, vt->ref_stride IF_HBD(, vt->highbd));
- } else {
- src_avg = avg_8x8(vt->src, vt->src_stride IF_HBD(, vt->highbd));
- ref_avg = avg_8x8(vt->ref, vt->ref_stride IF_HBD(, vt->highbd));
- }
- sum = src_avg - ref_avg;
- sse = sum * sum;
- fill_variance(sse, sum, 0, &vt->variances.none);
- }
-}
-
-static void refine_variance_tree(VAR_TREE *const vt, const int64_t threshold) {
- if (vt->bsize >= BLOCK_8X8) {
- if (vt->bsize == BLOCK_16X16) {
- if (vt->variances.none.variance <= threshold)
- return;
- else
- vt->force_split = 0;
- }
-
- refine_variance_tree(vt->split[0], threshold);
- refine_variance_tree(vt->split[1], threshold);
- refine_variance_tree(vt->split[2], threshold);
- refine_variance_tree(vt->split[3], threshold);
-
- if (vt->bsize <= BLOCK_16X16) fill_variance_node(vt);
- } else if (vt->width <= 0 || vt->height <= 0) {
- fill_variance(0, 0, 0, &vt->variances.none);
- } else {
- const int src_avg = avg_4x4(vt->src, vt->src_stride IF_HBD(, vt->highbd));
- const int ref_avg = avg_4x4(vt->ref, vt->ref_stride IF_HBD(, vt->highbd));
- const int sum = src_avg - ref_avg;
- const unsigned int sse = sum * sum;
- assert(vt->bsize == BLOCK_4X4);
- fill_variance(sse, sum, 0, &vt->variances.none);
- }
-}
-
-static int check_split_key_frame(VAR_TREE *const vt, const int64_t threshold) {
- if (vt->bsize == BLOCK_32X32) {
- vt->force_split = vt->variances.none.variance > threshold;
- } else {
- vt->force_split |= check_split_key_frame(vt->split[0], threshold);
- vt->force_split |= check_split_key_frame(vt->split[1], threshold);
- vt->force_split |= check_split_key_frame(vt->split[2], threshold);
- vt->force_split |= check_split_key_frame(vt->split[3], threshold);
- }
- return vt->force_split;
-}
-
-static int check_split(AV1_COMP *const cpi, VAR_TREE *const vt,
- const int segment_id, const int64_t *const thresholds) {
- if (vt->bsize == BLOCK_16X16) {
- vt->force_split = vt->variances.none.variance > thresholds[0];
- if (!vt->force_split && vt->variances.none.variance > thresholds[-1] &&
- !cyclic_refresh_segment_id_boosted(segment_id)) {
- // We have some nominal amount of 16x16 variance (based on average),
- // compute the minmax over the 8x8 sub-blocks, and if above threshold,
- // force split to 8x8 block for this 16x16 block.
- int minmax =
- compute_minmax_8x8(vt->src, vt->src_stride, vt->ref, vt->ref_stride,
-#if CONFIG_HIGHBITDEPTH
- vt->highbd,
-#endif
- vt->width, vt->height);
- vt->force_split = minmax > cpi->vbp_threshold_minmax;
- }
- } else {
- vt->force_split |=
- check_split(cpi, vt->split[0], segment_id, thresholds + 1);
- vt->force_split |=
- check_split(cpi, vt->split[1], segment_id, thresholds + 1);
- vt->force_split |=
- check_split(cpi, vt->split[2], segment_id, thresholds + 1);
- vt->force_split |=
- check_split(cpi, vt->split[3], segment_id, thresholds + 1);
-
- if (vt->bsize == BLOCK_32X32 && !vt->force_split) {
- vt->force_split = vt->variances.none.variance > thresholds[0];
- }
- }
-
- return vt->force_split;
-}
-
-// This function chooses partitioning based on the variance between source and
-// reconstructed last (or golden), where variance is computed for down-sampled
-// inputs.
-static void choose_partitioning(AV1_COMP *const cpi, ThreadData *const td,
- const TileInfo *const tile, MACROBLOCK *const x,
- const int mi_row, const int mi_col) {
- AV1_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &x->e_mbd;
- VAR_TREE *const vt = td->var_root[cm->mib_size_log2 - MIN_MIB_SIZE_LOG2];
-#if CONFIG_DUAL_FILTER
- int i;
-#endif
- const uint8_t *src;
- const uint8_t *ref;
- int src_stride;
- int ref_stride;
- int pixels_wide = MI_SIZE * mi_size_wide[cm->sb_size];
- int pixels_high = MI_SIZE * mi_size_high[cm->sb_size];
- int64_t thresholds[5] = {
- cpi->vbp_thresholds[0], cpi->vbp_thresholds[1], cpi->vbp_thresholds[2],
- cpi->vbp_thresholds[3], cpi->vbp_thresholds[4],
- };
- BLOCK_SIZE bsize_min[5] = { BLOCK_16X16, BLOCK_16X16, BLOCK_16X16,
- cpi->vbp_bsize_min, BLOCK_8X8 };
- const int start_level = cm->sb_size == BLOCK_64X64 ? 1 : 0;
- const int64_t *const thre = thresholds + start_level;
- const BLOCK_SIZE *const bmin = bsize_min + start_level;
-
- const int is_key_frame = (cm->frame_type == KEY_FRAME);
- const int low_res = (cm->width <= 352 && cm->height <= 288);
-
- int segment_id = CR_SEGMENT_ID_BASE;
-
- if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ && cm->seg.enabled) {
- const uint8_t *const map =
- cm->seg.update_map ? cpi->segmentation_map : cm->last_frame_seg_map;
- segment_id = get_segment_id(cm, map, cm->sb_size, mi_row, mi_col);
-
- if (cyclic_refresh_segment_id_boosted(segment_id)) {
- int q = av1_get_qindex(&cm->seg, segment_id, cm->base_qindex);
- set_vbp_thresholds(cpi, thresholds, q);
- }
- }
-
- set_offsets(cpi, tile, x, mi_row, mi_col, cm->sb_size);
-
- if (xd->mb_to_right_edge < 0) pixels_wide += (xd->mb_to_right_edge >> 3);
- if (xd->mb_to_bottom_edge < 0) pixels_high += (xd->mb_to_bottom_edge >> 3);
-
- src = x->plane[0].src.buf;
- src_stride = x->plane[0].src.stride;
-
- if (!is_key_frame) {
- MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
- const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_buffer(cpi, LAST_FRAME);
- const YV12_BUFFER_CONFIG *yv12_g = get_ref_frame_buffer(cpi, GOLDEN_FRAME);
- unsigned int y_sad, y_sad_g;
-
- const int hbs = cm->mib_size / 2;
- const int split_vert = mi_col + hbs >= cm->mi_cols;
- const int split_horz = mi_row + hbs >= cm->mi_rows;
- BLOCK_SIZE bsize;
-
- if (split_vert && split_horz)
- bsize = get_subsize(cm->sb_size, PARTITION_SPLIT);
- else if (split_vert)
- bsize = get_subsize(cm->sb_size, PARTITION_VERT);
- else if (split_horz)
- bsize = get_subsize(cm->sb_size, PARTITION_HORZ);
- else
- bsize = cm->sb_size;
-
- assert(yv12 != NULL);
-
- if (yv12_g && yv12_g != yv12) {
- av1_setup_pre_planes(xd, 0, yv12_g, mi_row, mi_col,
- &cm->frame_refs[GOLDEN_FRAME - 1].sf);
- y_sad_g = cpi->fn_ptr[bsize].sdf(
- x->plane[0].src.buf, x->plane[0].src.stride, xd->plane[0].pre[0].buf,
- xd->plane[0].pre[0].stride);
- } else {
- y_sad_g = UINT_MAX;
- }
-
- av1_setup_pre_planes(xd, 0, yv12, mi_row, mi_col,
- &cm->frame_refs[LAST_FRAME - 1].sf);
- mbmi->ref_frame[0] = LAST_FRAME;
- mbmi->ref_frame[1] = NONE_FRAME;
- mbmi->sb_type = cm->sb_size;
- mbmi->mv[0].as_int = 0;
-#if CONFIG_DUAL_FILTER
- for (i = 0; i < 4; ++i) mbmi->interp_filter[i] = BILINEAR;
-#else
- mbmi->interp_filter = BILINEAR;
-#endif
-
- y_sad = av1_int_pro_motion_estimation(cpi, x, bsize, mi_row, mi_col);
-
- if (y_sad_g < y_sad) {
- av1_setup_pre_planes(xd, 0, yv12_g, mi_row, mi_col,
- &cm->frame_refs[GOLDEN_FRAME - 1].sf);
- mbmi->ref_frame[0] = GOLDEN_FRAME;
- mbmi->mv[0].as_int = 0;
- y_sad = y_sad_g;
- } else {
- x->pred_mv[LAST_FRAME] = mbmi->mv[0].as_mv;
- }
-
- av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL, cm->sb_size);
-
- ref = xd->plane[0].dst.buf;
- ref_stride = xd->plane[0].dst.stride;
-
- // If the y_sad is very small, take the largest partition and exit.
- // Don't check on boosted segment for now, as largest is suppressed there.
- if (segment_id == CR_SEGMENT_ID_BASE && y_sad < cpi->vbp_threshold_sad) {
- if (!split_vert && !split_horz) {
- set_block_size(cpi, x, xd, mi_row, mi_col, cm->sb_size);
- return;
- }
- }
- } else {
- ref = AV1_VAR_OFFS;
- ref_stride = 0;
-#if CONFIG_HIGHBITDEPTH
- if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
- switch (xd->bd) {
- case 10: ref = CONVERT_TO_BYTEPTR(AV1_HIGH_VAR_OFFS_10); break;
- case 12: ref = CONVERT_TO_BYTEPTR(AV1_HIGH_VAR_OFFS_12); break;
- case 8:
- default: ref = CONVERT_TO_BYTEPTR(AV1_HIGH_VAR_OFFS_8); break;
- }
- }
-#endif // CONFIG_HIGHBITDEPTH
- }
-
- init_variance_tree(
- vt,
-#if CONFIG_HIGHBITDEPTH
- xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH,
-#endif // CONFIG_HIGHBITDEPTH
- cm->sb_size, (is_key_frame || low_res) ? BLOCK_4X4 : BLOCK_8X8,
- pixels_wide, pixels_high, src, src_stride, ref, ref_stride);
-
- // Fill in the entire tree of variances and compute splits.
- if (is_key_frame) {
- fill_variance_tree(vt, BLOCK_4X4);
- check_split_key_frame(vt, thre[1]);
- } else {
- fill_variance_tree(vt, BLOCK_8X8);
- check_split(cpi, vt, segment_id, thre);
- if (low_res) {
- refine_variance_tree(vt, thre[1] << 1);
- }
- }
-
- vt->force_split |= mi_col + cm->mib_size > cm->mi_cols ||
- mi_row + cm->mib_size > cm->mi_rows;
-
- // Now go through the entire structure, splitting every block size until
- // we get to one that's got a variance lower than our threshold.
- set_vt_partitioning(cpi, x, xd, vt, mi_row, mi_col, thre, bmin);
-}
-
#if CONFIG_DUAL_FILTER
static void reset_intmv_filter_type(const AV1_COMMON *const cm, MACROBLOCKD *xd,
MB_MODE_INFO *mbmi) {
@@ -1067,7 +508,6 @@ static void reset_tx_size(MACROBLOCKD *xd, MB_MODE_INFO *mbmi,
}
}
-#if CONFIG_REF_MV
static void set_ref_and_pred_mvs(MACROBLOCK *const x, int_mv *const mi_pred_mv,
int8_t rf_type) {
MACROBLOCKD *const xd = &x->e_mbd;
@@ -1116,7 +556,6 @@ static void set_ref_and_pred_mvs(MACROBLOCK *const x, int_mv *const mi_pred_mv,
}
#endif // CONFIG_EXT_INTER
}
-#endif // CONFIG_REF_MV
static void update_state(const AV1_COMP *const cpi, ThreadData *td,
PICK_MODE_CONTEXT *ctx, int mi_row, int mi_col,
@@ -1144,9 +583,7 @@ static void update_state(const AV1_COMP *const cpi, ThreadData *td,
const int mi_height = mi_size_high[bsize];
const int unify_bsize = CONFIG_CB4X4;
-#if CONFIG_REF_MV
int8_t rf_type;
-#endif
#if !CONFIG_SUPERTX
assert(mi->mbmi.sb_type == bsize);
@@ -1159,13 +596,11 @@ static void update_state(const AV1_COMP *const cpi, ThreadData *td,
reset_intmv_filter_type(cm, xd, mbmi);
#endif
-#if CONFIG_REF_MV
rf_type = av1_ref_frame_type(mbmi->ref_frame);
if (x->mbmi_ext->ref_mv_count[rf_type] > 1 &&
(mbmi->sb_type >= BLOCK_8X8 || unify_bsize)) {
set_ref_and_pred_mvs(x, mi->mbmi.pred_mv, rf_type);
}
-#endif // CONFIG_REF_MV
// If segmentation in use
if (seg->enabled) {
@@ -1250,7 +685,11 @@ static void update_state(const AV1_COMP *const cpi, ThreadData *td,
THR_D63_PRED /*D63_PRED*/,
#if CONFIG_ALT_INTRA
THR_SMOOTH, /*SMOOTH_PRED*/
-#endif // CONFIG_ALT_INTRA
+#if CONFIG_SMOOTH_HV
+ THR_SMOOTH_V, /*SMOOTH_V_PRED*/
+ THR_SMOOTH_H, /*SMOOTH_H_PRED*/
+#endif // CONFIG_SMOOTH_HV
+#endif // CONFIG_ALT_INTRA
THR_TM /*TM_PRED*/,
};
++mode_chosen_counts[kf_mode_index[mbmi->mode]];
@@ -1339,9 +778,7 @@ static void update_state_supertx(const AV1_COMP *const cpi, ThreadData *td,
MV_REF *const frame_mvs = cm->cur_frame->mvs + mi_row * cm->mi_cols + mi_col;
int w, h;
-#if CONFIG_REF_MV
int8_t rf_type;
-#endif
*mi_addr = *mi;
*x->mbmi_ext = ctx->mbmi_ext;
@@ -1352,13 +789,11 @@ static void update_state_supertx(const AV1_COMP *const cpi, ThreadData *td,
reset_intmv_filter_type(cm, xd, mbmi);
#endif
-#if CONFIG_REF_MV
rf_type = av1_ref_frame_type(mbmi->ref_frame);
if (x->mbmi_ext->ref_mv_count[rf_type] > 1 &&
(mbmi->sb_type >= BLOCK_8X8 || unify_bsize)) {
set_ref_and_pred_mvs(x, mi->mbmi.pred_mv, rf_type);
}
-#endif // CONFIG_REF_MV
// If segmentation in use
if (seg->enabled) {
@@ -1846,6 +1281,29 @@ static int set_segment_rdmult(const AV1_COMP *const cpi, MACROBLOCK *const x,
return av1_compute_rd_mult(cpi, segment_qindex + cm->y_dc_delta_q);
}
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+static void daala_dist_set_sub8x8_dst(MACROBLOCK *const x, uint8_t *dst8x8,
+ BLOCK_SIZE bsize, int bw, int bh,
+ int mi_row, int mi_col) {
+ MACROBLOCKD *const xd = &x->e_mbd;
+ struct macroblockd_plane *const pd = &xd->plane[0];
+ const int dst_stride = pd->dst.stride;
+ uint8_t *dst = pd->dst.buf;
+
+ assert(bsize < BLOCK_8X8);
+
+ if (bsize < BLOCK_8X8) {
+ int i, j;
+ uint8_t *dst_sub8x8 = &dst8x8[((mi_row & 1) * 8 + (mi_col & 1)) << 2];
+
+ for (j = 0; j < bh; ++j)
+ for (i = 0; i < bw; ++i) {
+ dst_sub8x8[j * 8 + i] = dst[j * dst_stride + i];
+ }
+ }
+}
+#endif
+
static void rd_pick_sb_modes(const AV1_COMP *const cpi, TileDataEnc *tile_data,
MACROBLOCK *const x, int mi_row, int mi_col,
RD_STATS *rd_cost,
@@ -1865,7 +1323,6 @@ static void rd_pick_sb_modes(const AV1_COMP *const cpi, TileDataEnc *tile_data,
struct macroblockd_plane *const pd = xd->plane;
const AQ_MODE aq_mode = cpi->oxcf.aq_mode;
int i, orig_rdmult;
- const int unify_bsize = CONFIG_CB4X4;
aom_clear_system_state();
@@ -1915,7 +1372,6 @@ static void rd_pick_sb_modes(const AV1_COMP *const cpi, TileDataEnc *tile_data,
#endif // CONFIG_PALETTE
ctx->skippable = 0;
- ctx->pred_pixel_ready = 0;
// Set to zero to make sure we do not use the previous encoded frame stats
mbmi->skip = 0;
@@ -1967,38 +1423,21 @@ static void rd_pick_sb_modes(const AV1_COMP *const cpi, TileDataEnc *tile_data,
*totalrate_nocoef = 0;
#endif // CONFIG_SUPERTX
} else {
- if (bsize >= BLOCK_8X8 || unify_bsize) {
- if (segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
- av1_rd_pick_inter_mode_sb_seg_skip(cpi, tile_data, x, mi_row, mi_col,
- rd_cost, bsize, ctx, best_rd);
+ if (segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
+ av1_rd_pick_inter_mode_sb_seg_skip(cpi, tile_data, x, mi_row, mi_col,
+ rd_cost, bsize, ctx, best_rd);
#if CONFIG_SUPERTX
- *totalrate_nocoef = rd_cost->rate;
+ *totalrate_nocoef = rd_cost->rate;
#endif // CONFIG_SUPERTX
- } else {
- av1_rd_pick_inter_mode_sb(cpi, tile_data, x, mi_row, mi_col, rd_cost,
-#if CONFIG_SUPERTX
- totalrate_nocoef,
-#endif // CONFIG_SUPERTX
- bsize, ctx, best_rd);
-#if CONFIG_SUPERTX
- assert(*totalrate_nocoef >= 0);
-#endif // CONFIG_SUPERTX
- }
} else {
- if (segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
- // The decoder rejects sub8x8 partitions when SEG_LVL_SKIP is set.
- rd_cost->rate = INT_MAX;
- } else {
- av1_rd_pick_inter_mode_sub8x8(cpi, tile_data, x, mi_row, mi_col,
- rd_cost,
+ av1_rd_pick_inter_mode_sb(cpi, tile_data, x, mi_row, mi_col, rd_cost,
#if CONFIG_SUPERTX
- totalrate_nocoef,
+ totalrate_nocoef,
#endif // CONFIG_SUPERTX
- bsize, ctx, best_rd);
+ bsize, ctx, best_rd);
#if CONFIG_SUPERTX
- assert(*totalrate_nocoef >= 0);
+ assert(*totalrate_nocoef >= 0);
#endif // CONFIG_SUPERTX
- }
}
}
@@ -2020,7 +1459,6 @@ static void rd_pick_sb_modes(const AV1_COMP *const cpi, TileDataEnc *tile_data,
ctx->dist = rd_cost->dist;
}
-#if CONFIG_REF_MV
static void update_inter_mode_stats(FRAME_COUNTS *counts, PREDICTION_MODE mode,
int16_t mode_context) {
int16_t mode_ctx = mode_context & NEWMV_CTX_MASK;
@@ -2050,7 +1488,6 @@ static void update_inter_mode_stats(FRAME_COUNTS *counts, PREDICTION_MODE mode,
}
}
}
-#endif
static void update_stats(const AV1_COMMON *const cm, ThreadData *td, int mi_row,
int mi_col
@@ -2070,7 +1507,6 @@ static void update_stats(const AV1_COMMON *const cm, ThreadData *td, int mi_row,
const MB_MODE_INFO *const mbmi = &mi->mbmi;
const MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext;
const BLOCK_SIZE bsize = mbmi->sb_type;
- const int unify_bsize = CONFIG_CB4X4;
#if CONFIG_DELTA_Q
// delta quant applies to both intra and inter
@@ -2125,7 +1561,7 @@ static void update_stats(const AV1_COMMON *const cm, ThreadData *td, int mi_row,
if (cm->reference_mode == REFERENCE_MODE_SELECT) {
#if !SUB8X8_COMP_REF
- if (mbmi->sb_type >= BLOCK_8X8)
+ if (mbmi->sb_type != BLOCK_4X4)
counts->comp_inter[av1_get_reference_mode_context(cm, xd)]
[has_second_ref(mbmi)]++;
#else
@@ -2183,12 +1619,12 @@ static void update_stats(const AV1_COMMON *const cm, ThreadData *td, int mi_row,
#endif // CONFIG_EXT_REFS
}
-#if CONFIG_EXT_INTER
+#if CONFIG_EXT_INTER && CONFIG_INTERINTRA
if (cm->reference_mode != COMPOUND_REFERENCE &&
#if CONFIG_SUPERTX
!supertx_enabled &&
#endif
- is_interintra_allowed(mbmi)) {
+ cm->allow_interintra_compound && is_interintra_allowed(mbmi)) {
const int bsize_group = size_group_lookup[bsize];
if (mbmi->ref_frame[1] == INTRA_FRAME) {
counts->interintra[bsize_group][1]++;
@@ -2199,7 +1635,7 @@ static void update_stats(const AV1_COMMON *const cm, ThreadData *td, int mi_row,
counts->interintra[bsize_group][0]++;
}
}
-#endif // CONFIG_EXT_INTER
+#endif // CONFIG_EXT_INTER && CONFIG_INTERINTRA
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
const MOTION_MODE motion_allowed = motion_mode_allowed(
@@ -2242,105 +1678,67 @@ static void update_stats(const AV1_COMMON *const cm, ThreadData *td, int mi_row,
if (inter_block &&
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
int16_t mode_ctx;
-#if !CONFIG_REF_MV
- mode_ctx = mbmi_ext->mode_context[mbmi->ref_frame[0]];
-#endif
- if (bsize >= BLOCK_8X8 || unify_bsize) {
- const PREDICTION_MODE mode = mbmi->mode;
-#if CONFIG_REF_MV
+ const PREDICTION_MODE mode = mbmi->mode;
#if CONFIG_EXT_INTER
- if (has_second_ref(mbmi)) {
- mode_ctx = mbmi_ext->compound_mode_context[mbmi->ref_frame[0]];
- ++counts->inter_compound_mode[mode_ctx][INTER_COMPOUND_OFFSET(mode)];
- } else {
+ if (has_second_ref(mbmi)) {
+ mode_ctx = mbmi_ext->compound_mode_context[mbmi->ref_frame[0]];
+ ++counts->inter_compound_mode[mode_ctx][INTER_COMPOUND_OFFSET(mode)];
+ } else {
#endif // CONFIG_EXT_INTER
- mode_ctx = av1_mode_context_analyzer(mbmi_ext->mode_context,
- mbmi->ref_frame, bsize, -1);
- update_inter_mode_stats(counts, mode, mode_ctx);
+ mode_ctx = av1_mode_context_analyzer(mbmi_ext->mode_context,
+ mbmi->ref_frame, bsize, -1);
+ update_inter_mode_stats(counts, mode, mode_ctx);
#if CONFIG_EXT_INTER
- }
+ }
#endif // CONFIG_EXT_INTER
#if CONFIG_EXT_INTER
- if (mbmi->mode == NEWMV || mbmi->mode == NEW_NEWMV) {
+ if (mbmi->mode == NEWMV || mbmi->mode == NEW_NEWMV) {
#else
- if (mbmi->mode == NEWMV) {
+ if (mbmi->mode == NEWMV) {
#endif
- uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame);
- int idx;
+ uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame);
+ int idx;
- for (idx = 0; idx < 2; ++idx) {
- if (mbmi_ext->ref_mv_count[ref_frame_type] > idx + 1) {
- uint8_t drl_ctx =
- av1_drl_ctx(mbmi_ext->ref_mv_stack[ref_frame_type], idx);
- ++counts->drl_mode[drl_ctx][mbmi->ref_mv_idx != idx];
+ for (idx = 0; idx < 2; ++idx) {
+ if (mbmi_ext->ref_mv_count[ref_frame_type] > idx + 1) {
+ uint8_t drl_ctx =
+ av1_drl_ctx(mbmi_ext->ref_mv_stack[ref_frame_type], idx);
+ ++counts->drl_mode[drl_ctx][mbmi->ref_mv_idx != idx];
- if (mbmi->ref_mv_idx == idx) break;
- }
+ if (mbmi->ref_mv_idx == idx) break;
}
}
+ }
#if CONFIG_EXT_INTER
- if (have_nearmv_in_inter_mode(mbmi->mode)) {
+ if (have_nearmv_in_inter_mode(mbmi->mode)) {
#else
- if (mbmi->mode == NEARMV) {
+ if (mbmi->mode == NEARMV) {
#endif
- uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame);
- int idx;
+ uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame);
+ int idx;
- for (idx = 1; idx < 3; ++idx) {
- if (mbmi_ext->ref_mv_count[ref_frame_type] > idx + 1) {
- uint8_t drl_ctx =
- av1_drl_ctx(mbmi_ext->ref_mv_stack[ref_frame_type], idx);
- ++counts->drl_mode[drl_ctx][mbmi->ref_mv_idx != idx - 1];
+ for (idx = 1; idx < 3; ++idx) {
+ if (mbmi_ext->ref_mv_count[ref_frame_type] > idx + 1) {
+ uint8_t drl_ctx =
+ av1_drl_ctx(mbmi_ext->ref_mv_stack[ref_frame_type], idx);
+ ++counts->drl_mode[drl_ctx][mbmi->ref_mv_idx != idx - 1];
- if (mbmi->ref_mv_idx == idx - 1) break;
- }
- }
- }
-#else
-#if CONFIG_EXT_INTER
- if (is_inter_compound_mode(mode))
- ++counts->inter_compound_mode[mode_ctx][INTER_COMPOUND_OFFSET(mode)];
- else
-#endif // CONFIG_EXT_INTER
- ++counts->inter_mode[mode_ctx][INTER_OFFSET(mode)];
-#endif
- } else {
- const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize];
- const int num_4x4_h = num_4x4_blocks_high_lookup[bsize];
- int idx, idy;
- for (idy = 0; idy < 2; idy += num_4x4_h) {
- for (idx = 0; idx < 2; idx += num_4x4_w) {
- const int j = idy * 2 + idx;
- const PREDICTION_MODE b_mode = mi->bmi[j].as_mode;
-#if CONFIG_REF_MV
-#if CONFIG_EXT_INTER
- if (has_second_ref(mbmi)) {
- mode_ctx = mbmi_ext->compound_mode_context[mbmi->ref_frame[0]];
- ++counts->inter_compound_mode[mode_ctx]
- [INTER_COMPOUND_OFFSET(b_mode)];
- } else {
-#endif // CONFIG_EXT_INTER
- mode_ctx = av1_mode_context_analyzer(mbmi_ext->mode_context,
- mbmi->ref_frame, bsize, j);
- update_inter_mode_stats(counts, b_mode, mode_ctx);
-#if CONFIG_EXT_INTER
- }
-#endif // CONFIG_EXT_INTER
-#else
-#if CONFIG_EXT_INTER
- if (is_inter_compound_mode(b_mode))
- ++counts->inter_compound_mode[mode_ctx]
- [INTER_COMPOUND_OFFSET(b_mode)];
- else
-#endif // CONFIG_EXT_INTER
- ++counts->inter_mode[mode_ctx][INTER_OFFSET(b_mode)];
-#endif
+ if (mbmi->ref_mv_idx == idx - 1) break;
}
}
}
}
+#if CONFIG_INTRABC
+ } else {
+ if (cm->allow_screen_content_tools && bsize >= BLOCK_8X8) {
+ FRAME_COUNTS *const counts = td->counts;
+ ++counts->intrabc[mbmi->use_intrabc];
+ } else {
+ assert(!mbmi->use_intrabc);
+ }
+#endif
}
}
@@ -2352,8 +1750,8 @@ typedef struct {
#if CONFIG_VAR_TX
TXFM_CONTEXT *p_ta;
TXFM_CONTEXT *p_tl;
- TXFM_CONTEXT ta[MAX_MIB_SIZE];
- TXFM_CONTEXT tl[MAX_MIB_SIZE];
+ TXFM_CONTEXT ta[2 * MAX_MIB_SIZE];
+ TXFM_CONTEXT tl[2 * MAX_MIB_SIZE];
#endif
} RD_SEARCH_MACROBLOCK_CONTEXT;
@@ -2373,12 +1771,15 @@ static void restore_context(MACROBLOCK *x,
int mi_width = mi_size_wide[bsize];
int mi_height = mi_size_high[bsize];
for (p = 0; p < MAX_MB_PLANE; p++) {
- memcpy(xd->above_context[p] + ((mi_col * 2) >> xd->plane[p].subsampling_x),
+ int tx_col;
+ int tx_row;
+ tx_col = mi_col << (MI_SIZE_LOG2 - tx_size_wide_log2[0]);
+ tx_row = (mi_row & MAX_MIB_MASK) << (MI_SIZE_LOG2 - tx_size_high_log2[0]);
+ memcpy(xd->above_context[p] + (tx_col >> xd->plane[p].subsampling_x),
ctx->a + num_4x4_blocks_wide * p,
(sizeof(ENTROPY_CONTEXT) * num_4x4_blocks_wide) >>
xd->plane[p].subsampling_x);
- memcpy(xd->left_context[p] +
- ((mi_row & MAX_MIB_MASK) * 2 >> xd->plane[p].subsampling_y),
+ memcpy(xd->left_context[p] + (tx_row >> xd->plane[p].subsampling_y),
ctx->l + num_4x4_blocks_high * p,
(sizeof(ENTROPY_CONTEXT) * num_4x4_blocks_high) >>
xd->plane[p].subsampling_y);
@@ -2391,9 +1792,9 @@ static void restore_context(MACROBLOCK *x,
xd->above_txfm_context = ctx->p_ta;
xd->left_txfm_context = ctx->p_tl;
memcpy(xd->above_txfm_context, ctx->ta,
- sizeof(*xd->above_txfm_context) * mi_width);
+ sizeof(*xd->above_txfm_context) * (mi_width << TX_UNIT_WIDE_LOG2));
memcpy(xd->left_txfm_context, ctx->tl,
- sizeof(*xd->left_txfm_context) * mi_height);
+ sizeof(*xd->left_txfm_context) * (mi_height << TX_UNIT_HIGH_LOG2));
#endif
#if CONFIG_PVQ
od_encode_rollback(&x->daala_enc, rdo_buf);
@@ -2417,13 +1818,16 @@ static void save_context(const MACROBLOCK *x, RD_SEARCH_MACROBLOCK_CONTEXT *ctx,
// buffer the above/left context information of the block in search.
for (p = 0; p < MAX_MB_PLANE; ++p) {
+ int tx_col;
+ int tx_row;
+ tx_col = mi_col << (MI_SIZE_LOG2 - tx_size_wide_log2[0]);
+ tx_row = (mi_row & MAX_MIB_MASK) << (MI_SIZE_LOG2 - tx_size_high_log2[0]);
memcpy(ctx->a + num_4x4_blocks_wide * p,
- xd->above_context[p] + (mi_col * 2 >> xd->plane[p].subsampling_x),
+ xd->above_context[p] + (tx_col >> xd->plane[p].subsampling_x),
(sizeof(ENTROPY_CONTEXT) * num_4x4_blocks_wide) >>
xd->plane[p].subsampling_x);
memcpy(ctx->l + num_4x4_blocks_high * p,
- xd->left_context[p] +
- ((mi_row & MAX_MIB_MASK) * 2 >> xd->plane[p].subsampling_y),
+ xd->left_context[p] + (tx_row >> xd->plane[p].subsampling_y),
(sizeof(ENTROPY_CONTEXT) * num_4x4_blocks_high) >>
xd->plane[p].subsampling_y);
}
@@ -2433,9 +1837,9 @@ static void save_context(const MACROBLOCK *x, RD_SEARCH_MACROBLOCK_CONTEXT *ctx,
sizeof(xd->left_seg_context[0]) * mi_height);
#if CONFIG_VAR_TX
memcpy(ctx->ta, xd->above_txfm_context,
- sizeof(*xd->above_txfm_context) * mi_width);
+ sizeof(*xd->above_txfm_context) * (mi_width << TX_UNIT_WIDE_LOG2));
memcpy(ctx->tl, xd->left_txfm_context,
- sizeof(*xd->left_txfm_context) * mi_height);
+ sizeof(*xd->left_txfm_context) * (mi_height << TX_UNIT_HIGH_LOG2));
ctx->p_ta = xd->above_txfm_context;
ctx->p_tl = xd->left_txfm_context;
#endif
@@ -2479,7 +1883,7 @@ static void encode_b(const AV1_COMP *const cpi, const TileInfo *const tile,
get_frame_new_buffer(&cpi->common), mi_row, mi_col);
}
#endif
- encode_superblock(cpi, td, tp, dry_run, mi_row, mi_col, bsize, ctx, rate);
+ encode_superblock(cpi, td, tp, dry_run, mi_row, mi_col, bsize, rate);
if (!dry_run) {
#if CONFIG_EXT_DELTA_Q
@@ -2563,12 +1967,13 @@ static void encode_sb(const AV1_COMP *const cpi, ThreadData *td,
if (!x->skip) {
int this_rate = 0;
av1_encode_sb_supertx((AV1_COMMON *)cm, x, bsize);
- av1_tokenize_sb_supertx(cpi, td, tp, dry_run, bsize, rate);
+ av1_tokenize_sb_supertx(cpi, td, tp, dry_run, mi_row, mi_col, bsize,
+ rate);
if (rate) *rate += this_rate;
} else {
xd->mi[0]->mbmi.skip = 1;
if (!dry_run) td->counts->skip[av1_get_skip_context(xd)][1]++;
- reset_skip_context(xd, bsize);
+ av1_reset_skip_context(xd, mi_row, mi_col, bsize);
}
if (!dry_run) {
for (y_idx = 0; y_idx < mi_height; y_idx++)
@@ -2849,9 +2254,10 @@ static void rd_use_partition(AV1_COMP *cpi, ThreadData *td,
pc_tree->partitioning = partition;
#if CONFIG_VAR_TX
- xd->above_txfm_context = cm->above_txfm_context + mi_col;
- xd->left_txfm_context =
- xd->left_txfm_context_buffer + (mi_row & MAX_MIB_MASK);
+ xd->above_txfm_context =
+ cm->above_txfm_context + (mi_col << TX_UNIT_WIDE_LOG2);
+ xd->left_txfm_context = xd->left_txfm_context_buffer +
+ ((mi_row & MAX_MIB_MASK) << TX_UNIT_HIGH_LOG2);
#endif
#if !CONFIG_PVQ
save_context(x, &x_ctx, mi_row, mi_col, bsize);
@@ -2943,7 +2349,7 @@ static void rd_use_partition(AV1_COMP *cpi, ThreadData *td,
av1_init_rd_stats(&tmp_rdc);
update_state(cpi, td, ctx_h, mi_row, mi_col, subsize, 1);
encode_superblock(cpi, td, tp, DRY_RUN_NORMAL, mi_row, mi_col, subsize,
- ctx_h, NULL);
+ NULL);
rd_pick_sb_modes(cpi, tile_data, x, mi_row + hbs, mi_col, &tmp_rdc,
#if CONFIG_SUPERTX
&rt_nocoef,
@@ -2986,7 +2392,7 @@ static void rd_use_partition(AV1_COMP *cpi, ThreadData *td,
av1_init_rd_stats(&tmp_rdc);
update_state(cpi, td, ctx_v, mi_row, mi_col, subsize, 1);
encode_superblock(cpi, td, tp, DRY_RUN_NORMAL, mi_row, mi_col, subsize,
- ctx_v, NULL);
+ NULL);
rd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col + hbs, &tmp_rdc,
#if CONFIG_SUPERTX
&rt_nocoef,
@@ -3566,7 +2972,7 @@ static void rd_test_partition3(
PICK_MODE_CONTEXT *ctx_0 = &ctxs[0];
update_state(cpi, td, ctx_0, mi_row0, mi_col0, subsize0, 1);
encode_superblock(cpi, td, tp, DRY_RUN_NORMAL, mi_row0, mi_col0, subsize0,
- ctx_0, NULL);
+ NULL);
if (cpi->sf.adaptive_motion_search) load_pred_mv(x, ctx_0);
@@ -3607,7 +3013,7 @@ static void rd_test_partition3(
PICK_MODE_CONTEXT *ctx_1 = &ctxs[1];
update_state(cpi, td, ctx_1, mi_row1, mi_col1, subsize1, 1);
encode_superblock(cpi, td, tp, DRY_RUN_NORMAL, mi_row1, mi_col1, subsize1,
- ctx_1, NULL);
+ NULL);
if (cpi->sf.adaptive_motion_search) load_pred_mv(x, ctx_1);
@@ -3865,9 +3271,10 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
}
#if CONFIG_VAR_TX
- xd->above_txfm_context = cm->above_txfm_context + mi_col;
- xd->left_txfm_context =
- xd->left_txfm_context_buffer + (mi_row & MAX_MIB_MASK);
+ xd->above_txfm_context =
+ cm->above_txfm_context + (mi_col << TX_UNIT_WIDE_LOG2);
+ xd->left_txfm_context = xd->left_txfm_context_buffer +
+ ((mi_row & MAX_MIB_MASK) << TX_UNIT_HIGH_LOG2);
#endif
#if !CONFIG_PVQ
save_context(x, &x_ctx, mi_row, mi_col, bsize);
@@ -4157,9 +3564,29 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
#if CONFIG_SUPERTX
sum_rate_nocoef += this_rate_nocoef;
#endif // CONFIG_SUPERTX
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ sum_rdc.dist_y += this_rdc.dist_y;
+#endif
}
}
reached_last_index = (idx == 4);
+
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ if (reached_last_index && sum_rdc.rdcost != INT64_MAX &&
+ bsize == BLOCK_8X8) {
+ int use_activity_masking = 0;
+ int64_t daala_dist;
+ const int src_stride = x->plane[0].src.stride;
+ daala_dist = av1_daala_dist(x->plane[0].src.buf - 4 * src_stride - 4,
+ src_stride, x->decoded_8x8, 8, 8, 8, 1,
+ use_activity_masking, x->qindex)
+ << 4;
+ sum_rdc.dist = sum_rdc.dist - sum_rdc.dist_y + daala_dist;
+ sum_rdc.rdcost =
+ RDCOST(x->rdmult, x->rddiv, sum_rdc.rate, sum_rdc.dist);
+ }
+#endif // CONFIG_DAALA_DIST && CONFIG_CB4X4
+
#if CONFIG_SUPERTX
if (supertx_allowed && sum_rdc.rdcost < INT64_MAX && reached_last_index) {
TX_SIZE supertx_size = max_txsize_lookup[bsize];
@@ -4267,7 +3694,7 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
PICK_MODE_CONTEXT *ctx_h = &pc_tree->horizontal[0];
update_state(cpi, td, ctx_h, mi_row, mi_col, subsize, 1);
encode_superblock(cpi, td, tp, DRY_RUN_NORMAL, mi_row, mi_col, subsize,
- ctx_h, NULL);
+ NULL);
if (cpi->sf.adaptive_motion_search) load_pred_mv(x, ctx_h);
@@ -4297,6 +3724,16 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
subsize, &pc_tree->horizontal[1],
best_rdc.rdcost - sum_rdc.rdcost);
#endif // CONFIG_SUPERTX
+
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ if (this_rdc.rate != INT_MAX && bsize == BLOCK_8X8) {
+ update_state(cpi, td, &pc_tree->horizontal[1], mi_row + mi_step, mi_col,
+ subsize, DRY_RUN_NORMAL);
+ encode_superblock(cpi, td, tp, DRY_RUN_NORMAL, mi_row + mi_step, mi_col,
+ subsize, NULL);
+ }
+#endif // CONFIG_DAALA_DIST && CONFIG_CB4X4
+
if (this_rdc.rate == INT_MAX) {
sum_rdc.rdcost = INT64_MAX;
#if CONFIG_SUPERTX
@@ -4309,7 +3746,24 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
#if CONFIG_SUPERTX
sum_rate_nocoef += this_rate_nocoef;
#endif // CONFIG_SUPERTX
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ sum_rdc.dist_y += this_rdc.dist_y;
+#endif
}
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ if (sum_rdc.rdcost != INT64_MAX && bsize == BLOCK_8X8) {
+ int use_activity_masking = 0;
+ int64_t daala_dist;
+ const int src_stride = x->plane[0].src.stride;
+ daala_dist = av1_daala_dist(x->plane[0].src.buf - 4 * src_stride,
+ src_stride, x->decoded_8x8, 8, 8, 8, 1,
+ use_activity_masking, x->qindex)
+ << 4;
+ sum_rdc.dist = sum_rdc.dist - sum_rdc.dist_y + daala_dist;
+ sum_rdc.rdcost =
+ RDCOST(x->rdmult, x->rddiv, sum_rdc.rate, sum_rdc.dist);
+ }
+#endif // CONFIG_DAALA_DIST && CONFIG_CB4X4
}
#if CONFIG_SUPERTX
@@ -4413,7 +3867,7 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
!force_vert_split && (bsize > BLOCK_8X8 || unify_bsize)) {
update_state(cpi, td, &pc_tree->vertical[0], mi_row, mi_col, subsize, 1);
encode_superblock(cpi, td, tp, DRY_RUN_NORMAL, mi_row, mi_col, subsize,
- &pc_tree->vertical[0], NULL);
+ NULL);
if (cpi->sf.adaptive_motion_search) load_pred_mv(x, ctx_none);
@@ -4444,6 +3898,16 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
subsize, &pc_tree->vertical[1],
best_rdc.rdcost - sum_rdc.rdcost);
#endif // CONFIG_SUPERTX
+
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ if (this_rdc.rate != INT_MAX && bsize == BLOCK_8X8) {
+ update_state(cpi, td, &pc_tree->vertical[1], mi_row, mi_col + mi_step,
+ subsize, DRY_RUN_NORMAL);
+ encode_superblock(cpi, td, tp, DRY_RUN_NORMAL, mi_row, mi_col + mi_step,
+ subsize, NULL);
+ }
+#endif // CONFIG_DAALA_DIST && CONFIG_CB4X4
+
if (this_rdc.rate == INT_MAX) {
sum_rdc.rdcost = INT64_MAX;
#if CONFIG_SUPERTX
@@ -4456,7 +3920,24 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
#if CONFIG_SUPERTX
sum_rate_nocoef += this_rate_nocoef;
#endif // CONFIG_SUPERTX
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ sum_rdc.dist_y += this_rdc.dist_y;
+#endif
}
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ if (sum_rdc.rdcost != INT64_MAX && bsize == BLOCK_8X8) {
+ int use_activity_masking = 0;
+ int64_t daala_dist;
+ const int src_stride = x->plane[0].src.stride;
+ daala_dist =
+ av1_daala_dist(x->plane[0].src.buf - 4, src_stride, x->decoded_8x8,
+ 8, 8, 8, 1, use_activity_masking, x->qindex)
+ << 4;
+ sum_rdc.dist = sum_rdc.dist - sum_rdc.dist_y + daala_dist;
+ sum_rdc.rdcost =
+ RDCOST(x->rdmult, x->rddiv, sum_rdc.rate, sum_rdc.dist);
+ }
+#endif // CONFIG_DAALA_DIST && CONFIG_CB4X4
}
#if CONFIG_SUPERTX
if (supertx_allowed && sum_rdc.rdcost < INT64_MAX && !abort_flag) {
@@ -4612,6 +4093,14 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
x->cfl_store_y = 0;
#endif
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ if (best_rdc.rate < INT_MAX && best_rdc.dist < INT64_MAX &&
+ bsize == BLOCK_4X4 && pc_tree->index == 3) {
+ encode_sb(cpi, td, tile_info, tp, mi_row, mi_col, DRY_RUN_NORMAL, bsize,
+ pc_tree, NULL);
+ }
+#endif // CONFIG_DAALA_DIST && CONFIG_CB4X4
+
if (bsize == cm->sb_size) {
#if !CONFIG_PVQ && !CONFIG_LV_MAP
assert(tp_orig < *tp || (tp_orig == *tp && xd->mi[0]->mbmi.skip));
@@ -4762,14 +4251,6 @@ static void encode_rd_sb_row(AV1_COMP *cpi, ThreadData *td,
&dummy_rate_nocoef,
#endif // CONFIG_SUPERTX
1, pc_root);
- } else if (sf->partition_search_type == VAR_BASED_PARTITION) {
- choose_partitioning(cpi, td, tile_info, x, mi_row, mi_col);
- rd_use_partition(cpi, td, tile_data, mi, tp, mi_row, mi_col, cm->sb_size,
- &dummy_rate, &dummy_dist,
-#if CONFIG_SUPERTX
- &dummy_rate_nocoef,
-#endif // CONFIG_SUPERTX
- 1, pc_root);
} else {
// If required set upper and lower partition size limits
if (sf->auto_min_max_partition_size) {
@@ -4785,32 +4266,6 @@ static void encode_rd_sb_row(AV1_COMP *cpi, ThreadData *td,
INT64_MAX, pc_root);
}
}
-#if CONFIG_SUBFRAME_PROB_UPDATE
- if (cm->do_subframe_update &&
- cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
- const int mi_rows_per_update =
- MI_SIZE * AOMMAX(cm->mi_rows / MI_SIZE / COEF_PROBS_BUFS, 1);
- if ((mi_row + MI_SIZE) % mi_rows_per_update == 0 &&
- mi_row + MI_SIZE < cm->mi_rows &&
- cm->coef_probs_update_idx < COEF_PROBS_BUFS - 1) {
- TX_SIZE t;
- SUBFRAME_STATS *subframe_stats = &cpi->subframe_stats;
-
- for (t = 0; t < TX_SIZES; ++t)
- av1_full_to_model_counts(cpi->td.counts->coef[t],
- cpi->td.rd_counts.coef_counts[t]);
- av1_partial_adapt_probs(cm, mi_row, mi_col);
- ++cm->coef_probs_update_idx;
- av1_copy(subframe_stats->coef_probs_buf[cm->coef_probs_update_idx],
- cm->fc->coef_probs);
- av1_copy(subframe_stats->coef_counts_buf[cm->coef_probs_update_idx],
- cpi->td.rd_counts.coef_counts);
- av1_copy(subframe_stats->eob_counts_buf[cm->coef_probs_update_idx],
- cm->counts.eob_branch);
- av1_fill_token_costs(x->token_costs, cm->fc->coef_probs);
- }
- }
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
}
static void init_encode_frame_mb_context(AV1_COMP *cpi) {
@@ -5041,16 +4496,11 @@ void av1_encode_tile(AV1_COMP *cpi, ThreadData *td, int tile_row,
}
}
-#if CONFIG_DAALA_EC
+#if !CONFIG_ANS
od_ec_enc_init(&td->mb.daala_enc.w.ec, 65025);
-#else
-#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
-#endif
-
-#if CONFIG_DAALA_EC
od_ec_enc_reset(&td->mb.daala_enc.w.ec);
#else
-#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
+#error "CONFIG_PVQ currently requires !CONFIG_ANS."
#endif
#endif // #if CONFIG_PVQ
@@ -5079,10 +4529,10 @@ void av1_encode_tile(AV1_COMP *cpi, ThreadData *td, int tile_row,
(unsigned int)(tok - cpi->tile_tok[tile_row][tile_col]);
assert(cpi->tok_count[tile_row][tile_col] <= allocated_tokens(*tile_info));
#if CONFIG_PVQ
-#if CONFIG_DAALA_EC
+#if !CONFIG_ANS
od_ec_enc_clear(&td->mb.daala_enc.w.ec);
#else
-#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
+#error "CONFIG_PVQ currently requires !CONFIG_ANS."
#endif
td->mb.pvq_q->last_pos = td->mb.pvq_q->curr_pos;
@@ -5186,6 +4636,24 @@ static int gm_get_params_cost(WarpedMotionParams *gm,
}
return (params_cost << AV1_PROB_COST_SHIFT);
}
+
+static int do_gm_search_logic(SPEED_FEATURES *const sf, int num_refs_using_gm,
+ int frame) {
+ (void)num_refs_using_gm;
+ (void)frame;
+ switch (sf->gm_search_type) {
+ case GM_FULL_SEARCH: return 1;
+ case GM_REDUCED_REF_SEARCH:
+#if CONFIG_EXT_REFS
+ return !(frame == LAST2_FRAME || frame == LAST3_FRAME);
+#else
+ return (num_refs_using_gm < 2);
+#endif // CONFIG_EXT_REFS
+ case GM_DISABLE_SEARCH: return 0;
+ default: assert(0);
+ }
+ return 1;
+}
#endif // CONFIG_GLOBAL_MOTION
static void encode_frame_internal(AV1_COMP *cpi) {
@@ -5205,9 +4673,7 @@ static void encode_frame_internal(AV1_COMP *cpi) {
x->min_partition_size = AOMMIN(x->min_partition_size, cm->sb_size);
x->max_partition_size = AOMMIN(x->max_partition_size, cm->sb_size);
-#if CONFIG_REF_MV
cm->setup_mi(cm);
-#endif
xd->mi = cm->mi_grid_visible;
xd->mi[0] = cm->mi;
@@ -5218,27 +4684,46 @@ static void encode_frame_internal(AV1_COMP *cpi) {
#if CONFIG_GLOBAL_MOTION
av1_zero(rdc->global_motion_used);
+ av1_zero(cpi->gmparams_cost);
if (cpi->common.frame_type == INTER_FRAME && cpi->source &&
!cpi->global_motion_search_done) {
- YV12_BUFFER_CONFIG *ref_buf;
+ YV12_BUFFER_CONFIG *ref_buf[TOTAL_REFS_PER_FRAME];
int frame;
double params_by_motion[RANSAC_NUM_MOTIONS * (MAX_PARAMDIM - 1)];
const double *params_this_motion;
int inliers_by_motion[RANSAC_NUM_MOTIONS];
WarpedMotionParams tmp_wm_params;
- static const double kInfiniteErrAdv = 1e12;
static const double kIdentityParams[MAX_PARAMDIM - 1] = {
0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0
};
+ int num_refs_using_gm = 0;
for (frame = LAST_FRAME; frame <= ALTREF_FRAME; ++frame) {
- ref_buf = get_ref_frame_buffer(cpi, frame);
- if (ref_buf) {
+ ref_buf[frame] = get_ref_frame_buffer(cpi, frame);
+ int pframe;
+ // check for duplicate buffer
+ for (pframe = LAST_FRAME; pframe < frame; ++pframe) {
+ if (ref_buf[frame] == ref_buf[pframe]) break;
+ }
+ if (pframe < frame) {
+ memcpy(&cm->global_motion[frame], &cm->global_motion[pframe],
+ sizeof(WarpedMotionParams));
+ } else if (ref_buf[frame] &&
+ do_gm_search_logic(&cpi->sf, num_refs_using_gm, frame)) {
TransformationType model;
+ const int64_t ref_frame_error = av1_frame_error(
+#if CONFIG_HIGHBITDEPTH
+ xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd,
+#endif // CONFIG_HIGHBITDEPTH
+ ref_buf[frame]->y_buffer, ref_buf[frame]->y_stride,
+ cpi->source->y_buffer, 0, 0, cpi->source->y_width,
+ cpi->source->y_height, cpi->source->y_stride);
+
+ if (ref_frame_error == 0) continue;
+
aom_clear_system_state();
for (model = ROTZOOM; model < GLOBAL_TRANS_TYPES_ENC; ++model) {
- double best_erroradvantage = kInfiniteErrAdv;
-
+ int64_t best_warp_error = INT64_MAX;
// Initially set all params to identity.
for (i = 0; i < RANSAC_NUM_MOTIONS; ++i) {
memcpy(params_by_motion + (MAX_PARAMDIM - 1) * i, kIdentityParams,
@@ -5246,7 +4731,7 @@ static void encode_frame_internal(AV1_COMP *cpi) {
}
compute_global_motion_feature_based(
- model, cpi->source, ref_buf,
+ model, cpi->source, ref_buf[frame],
#if CONFIG_HIGHBITDEPTH
cpi->common.bit_depth,
#endif // CONFIG_HIGHBITDEPTH
@@ -5259,17 +4744,17 @@ static void encode_frame_internal(AV1_COMP *cpi) {
convert_model_to_params(params_this_motion, &tmp_wm_params);
if (tmp_wm_params.wmtype != IDENTITY) {
- const double erroradv_this_motion = refine_integerized_param(
+ const int64_t warp_error = refine_integerized_param(
&tmp_wm_params, tmp_wm_params.wmtype,
#if CONFIG_HIGHBITDEPTH
xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd,
#endif // CONFIG_HIGHBITDEPTH
- ref_buf->y_buffer, ref_buf->y_width, ref_buf->y_height,
- ref_buf->y_stride, cpi->source->y_buffer,
- cpi->source->y_width, cpi->source->y_height,
- cpi->source->y_stride, 3);
- if (erroradv_this_motion < best_erroradvantage) {
- best_erroradvantage = erroradv_this_motion;
+ ref_buf[frame]->y_buffer, ref_buf[frame]->y_width,
+ ref_buf[frame]->y_height, ref_buf[frame]->y_stride,
+ cpi->source->y_buffer, cpi->source->y_width,
+ cpi->source->y_height, cpi->source->y_stride, 3);
+ if (warp_error < best_warp_error) {
+ best_warp_error = warp_error;
// Save the wm_params modified by refine_integerized_param()
// rather than motion index to avoid rerunning refine() below.
memcpy(&(cm->global_motion[frame]), &tmp_wm_params,
@@ -5295,17 +4780,17 @@ static void encode_frame_internal(AV1_COMP *cpi) {
// If the best error advantage found doesn't meet the threshold for
// this motion type, revert to IDENTITY.
if (!is_enough_erroradvantage(
- best_erroradvantage,
+ (double)best_warp_error / ref_frame_error,
gm_get_params_cost(&cm->global_motion[frame],
&cm->prev_frame->global_motion[frame],
cm->allow_high_precision_mv))) {
set_default_warp_params(&cm->global_motion[frame]);
}
-
if (cm->global_motion[frame].wmtype != IDENTITY) break;
}
aom_clear_system_state();
}
+ if (cm->global_motion[frame].wmtype != IDENTITY) num_refs_using_gm++;
cpi->gmparams_cost[frame] =
gm_get_params_cost(&cm->global_motion[frame],
&cm->prev_frame->global_motion[frame],
@@ -5352,21 +4837,8 @@ static void encode_frame_internal(AV1_COMP *cpi) {
av1_initialize_rd_consts(cpi);
av1_initialize_me_consts(cpi, x, cm->base_qindex);
init_encode_frame_mb_context(cpi);
-#if CONFIG_TEMPMV_SIGNALING
- if (last_fb_buf_idx != INVALID_IDX) {
- cm->prev_frame = &cm->buffer_pool->frame_bufs[last_fb_buf_idx];
- cm->use_prev_frame_mvs &= !cm->error_resilient_mode &&
- cm->width == cm->prev_frame->buf.y_width &&
- cm->height == cm->prev_frame->buf.y_height &&
- !cm->intra_only && !cm->prev_frame->intra_only;
- }
-#else
- cm->use_prev_frame_mvs =
- !cm->error_resilient_mode && cm->width == cm->last_width &&
- cm->height == cm->last_height && !cm->intra_only && cm->last_show_frame;
-#endif
-#if CONFIG_EXT_REFS
+#if CONFIG_EXT_REFS || CONFIG_TEMPMV_SIGNALING
// NOTE(zoeliu): As cm->prev_frame can take neither a frame of
// show_exisiting_frame=1, nor can it take a frame not used as
// a reference, it is probable that by the time it is being
@@ -5377,11 +4849,29 @@ static void encode_frame_internal(AV1_COMP *cpi) {
// (1) Simply disable the use of previous frame mvs; or
// (2) Have cm->prev_frame point to one reference frame buffer,
// e.g. LAST_FRAME.
- if (cm->use_prev_frame_mvs && !enc_is_ref_frame_buf(cpi, cm->prev_frame)) {
+ if (!enc_is_ref_frame_buf(cpi, cm->prev_frame)) {
// Reassign the LAST_FRAME buffer to cm->prev_frame.
- cm->prev_frame = &cm->buffer_pool->frame_bufs[last_fb_buf_idx];
+ cm->prev_frame = last_fb_buf_idx != INVALID_IDX
+ ? &cm->buffer_pool->frame_bufs[last_fb_buf_idx]
+ : NULL;
}
-#endif // CONFIG_EXT_REFS
+#endif // CONFIG_EXT_REFS || CONFIG_TEMPMV_SIGNALING
+
+#if CONFIG_TEMPMV_SIGNALING
+ if (cm->prev_frame) {
+ cm->use_prev_frame_mvs &= !cm->error_resilient_mode &&
+ cm->width == cm->prev_frame->buf.y_width &&
+ cm->height == cm->prev_frame->buf.y_height &&
+ !cm->intra_only && !cm->prev_frame->intra_only;
+ } else {
+ cm->use_prev_frame_mvs = 0;
+ }
+#else
+ cm->use_prev_frame_mvs = !cm->error_resilient_mode && cm->prev_frame &&
+ cm->width == cm->prev_frame->buf.y_crop_width &&
+ cm->height == cm->prev_frame->buf.y_crop_height &&
+ !cm->intra_only && cm->last_show_frame;
+#endif // CONFIG_TEMPMV_SIGNALING
// Special case: set prev_mi to NULL when the previous mode info
// context cannot be used.
@@ -5390,14 +4880,8 @@ static void encode_frame_internal(AV1_COMP *cpi) {
#if CONFIG_VAR_TX
x->txb_split_count = 0;
-#if CONFIG_REF_MV
av1_zero(x->blk_skip_drl);
#endif
-#endif
-
- if (cpi->sf.partition_search_type == VAR_BASED_PARTITION &&
- cpi->td.var_root[0] == NULL)
- av1_setup_var_tree(&cpi->common, &cpi->td);
{
struct aom_usec_timer emr_timer;
@@ -5429,6 +4913,20 @@ static void encode_frame_internal(AV1_COMP *cpi) {
#endif
}
+#if CONFIG_EXT_INTER
+static void make_consistent_compound_tools(AV1_COMMON *cm) {
+ (void)cm;
+#if CONFIG_INTERINTRA
+ if (frame_is_intra_only(cm) || cm->reference_mode == COMPOUND_REFERENCE)
+ cm->allow_interintra_compound = 0;
+#endif // CONFIG_INTERINTRA
+#if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
+ if (frame_is_intra_only(cm) || cm->reference_mode == SINGLE_REFERENCE)
+ cm->allow_masked_compound = 0;
+#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
+}
+#endif // CONFIG_EXT_INTER
+
void av1_encode_frame(AV1_COMP *cpi) {
AV1_COMMON *const cm = &cpi->common;
#if CONFIG_EXT_TX
@@ -5444,29 +4942,15 @@ void av1_encode_frame(AV1_COMP *cpi) {
// side behavior is where the ALT ref buffer has opposite sign bias to
// the other two.
if (!frame_is_intra_only(cm)) {
-#if CONFIG_LOWDELAY_COMPOUND // Normative in encoder
- cpi->allow_comp_inter_inter = 1;
-#if CONFIG_EXT_REFS
- cm->comp_fwd_ref[0] = LAST_FRAME;
- cm->comp_fwd_ref[1] = LAST2_FRAME;
- cm->comp_fwd_ref[2] = LAST3_FRAME;
- cm->comp_fwd_ref[3] = GOLDEN_FRAME;
- cm->comp_bwd_ref[0] = BWDREF_FRAME;
- cm->comp_bwd_ref[1] = ALTREF_FRAME;
-#else
- cm->comp_fixed_ref = ALTREF_FRAME;
- cm->comp_var_ref[0] = LAST_FRAME;
- cm->comp_var_ref[1] = GOLDEN_FRAME;
-#endif // CONFIG_EXT_REFS
-#else
+#if !CONFIG_ONE_SIDED_COMPOUND
if ((cm->ref_frame_sign_bias[ALTREF_FRAME] ==
cm->ref_frame_sign_bias[GOLDEN_FRAME]) ||
(cm->ref_frame_sign_bias[ALTREF_FRAME] ==
cm->ref_frame_sign_bias[LAST_FRAME])) {
cpi->allow_comp_inter_inter = 0;
} else {
+#endif
cpi->allow_comp_inter_inter = 1;
-
#if CONFIG_EXT_REFS
cm->comp_fwd_ref[0] = LAST_FRAME;
cm->comp_fwd_ref[1] = LAST2_FRAME;
@@ -5475,10 +4959,11 @@ void av1_encode_frame(AV1_COMP *cpi) {
cm->comp_bwd_ref[0] = BWDREF_FRAME;
cm->comp_bwd_ref[1] = ALTREF_FRAME;
#else
- cm->comp_fixed_ref = ALTREF_FRAME;
- cm->comp_var_ref[0] = LAST_FRAME;
- cm->comp_var_ref[1] = GOLDEN_FRAME;
-#endif // CONFIG_EXT_REFS
+ cm->comp_fixed_ref = ALTREF_FRAME;
+ cm->comp_var_ref[0] = LAST_FRAME;
+ cm->comp_var_ref[1] = GOLDEN_FRAME;
+#endif // CONFIG_EXT_REFS
+#if !CONFIG_ONE_SIDED_COMPOUND // Normative in encoder
}
#endif
} else {
@@ -5529,6 +5014,9 @@ void av1_encode_frame(AV1_COMP *cpi) {
cm->interp_filter = SWITCHABLE;
#endif
+#if CONFIG_EXT_INTER
+ make_consistent_compound_tools(cm);
+#endif // CONFIG_EXT_INTER
encode_frame_internal(cpi);
for (i = 0; i < REFERENCE_MODES; ++i)
@@ -5553,12 +5041,19 @@ void av1_encode_frame(AV1_COMP *cpi) {
#endif // !CONFIG_REF_ADAPT
}
}
+#if CONFIG_EXT_INTER
+ make_consistent_compound_tools(cm);
+#endif // CONFIG_EXT_INTER
#if CONFIG_VAR_TX
if (cm->tx_mode == TX_MODE_SELECT && cpi->td.mb.txb_split_count == 0)
cm->tx_mode = ALLOW_32X32 + CONFIG_TX64X64;
#else
+#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
+ if (cm->tx_mode == TX_MODE_SELECT && counts->quarter_tx_size[1] == 0) {
+#else
if (cm->tx_mode == TX_MODE_SELECT) {
+#endif
#if CONFIG_TX64X64
int count4x4 = 0;
int count8x8_8x8p = 0, count8x8_lp = 0;
@@ -5566,41 +5061,50 @@ void av1_encode_frame(AV1_COMP *cpi) {
int count32x32_32x32p = 0, count32x32_lp = 0;
int count64x64_64x64p = 0;
for (i = 0; i < TX_SIZE_CONTEXTS; ++i) {
+ int depth;
// counts->tx_size[max_depth][context_idx][this_depth_level]
- count4x4 += counts->tx_size[0][i][0];
- count4x4 += counts->tx_size[1][i][0];
- count4x4 += counts->tx_size[2][i][0];
- count4x4 += counts->tx_size[3][i][0];
-
- count8x8_8x8p += counts->tx_size[0][i][1];
- count8x8_lp += counts->tx_size[1][i][1];
- count8x8_lp += counts->tx_size[2][i][1];
- count8x8_lp += counts->tx_size[3][i][1];
-
- count16x16_16x16p += counts->tx_size[1][i][2];
- count16x16_lp += counts->tx_size[2][i][2];
- count16x16_lp += counts->tx_size[3][i][2];
-
- count32x32_32x32p += counts->tx_size[2][i][3];
- count32x32_lp += counts->tx_size[3][i][3];
-
- count64x64_64x64p += counts->tx_size[3][i][4];
+ depth = tx_size_to_depth(TX_4X4);
+ count4x4 += counts->tx_size[TX_8X8 - TX_SIZE_CTX_MIN][i][depth];
+ count4x4 += counts->tx_size[TX_16X16 - TX_SIZE_CTX_MIN][i][depth];
+ count4x4 += counts->tx_size[TX_32X32 - TX_SIZE_CTX_MIN][i][depth];
+ count4x4 += counts->tx_size[TX_64X64 - TX_SIZE_CTX_MIN][i][depth];
+
+ depth = tx_size_to_depth(TX_8X8);
+ count8x8_8x8p += counts->tx_size[TX_8X8 - TX_SIZE_CTX_MIN][i][depth];
+ count8x8_lp += counts->tx_size[TX_16X16 - TX_SIZE_CTX_MIN][i][depth];
+ count8x8_lp += counts->tx_size[TX_32X32 - TX_SIZE_CTX_MIN][i][depth];
+ count8x8_lp += counts->tx_size[TX_64X64 - TX_SIZE_CTX_MIN][i][depth];
+
+ depth = tx_size_to_depth(TX_16X16);
+ count16x16_16x16p +=
+ counts->tx_size[TX_16X16 - TX_SIZE_CTX_MIN][i][depth];
+ count16x16_lp += counts->tx_size[TX_32X32 - TX_SIZE_CTX_MIN][i][depth];
+ count16x16_lp += counts->tx_size[TX_64X64 - TX_SIZE_CTX_MIN][i][depth];
+
+ depth = tx_size_to_depth(TX_32X32);
+ count32x32_32x32p +=
+ counts->tx_size[TX_32X32 - TX_SIZE_CTX_MIN][i][depth];
+ count32x32_lp += counts->tx_size[TX_64X64 - TX_SIZE_CTX_MIN][i][depth];
+
+ depth = tx_size_to_depth(TX_64X64);
+ count64x64_64x64p +=
+ counts->tx_size[TX_64X64 - TX_SIZE_CTX_MIN][i][depth];
}
#if CONFIG_EXT_TX && CONFIG_RECT_TX
- count4x4 += counts->tx_size_implied[0][TX_4X4];
- count4x4 += counts->tx_size_implied[1][TX_4X4];
- count4x4 += counts->tx_size_implied[2][TX_4X4];
- count4x4 += counts->tx_size_implied[3][TX_4X4];
- count8x8_8x8p += counts->tx_size_implied[1][TX_8X8];
- count8x8_lp += counts->tx_size_implied[2][TX_8X8];
- count8x8_lp += counts->tx_size_implied[3][TX_8X8];
- count8x8_lp += counts->tx_size_implied[4][TX_8X8];
- count16x16_16x16p += counts->tx_size_implied[2][TX_16X16];
- count16x16_lp += counts->tx_size_implied[3][TX_16X16];
- count16x16_lp += counts->tx_size_implied[4][TX_16X16];
- count32x32_32x32p += counts->tx_size_implied[3][TX_32X32];
- count32x32_lp += counts->tx_size_implied[4][TX_32X32];
- count64x64_64x64p += counts->tx_size_implied[4][TX_64X64];
+ count4x4 += counts->tx_size_implied[TX_4X4][TX_4X4];
+ count4x4 += counts->tx_size_implied[TX_8X8][TX_4X4];
+ count4x4 += counts->tx_size_implied[TX_16X16][TX_4X4];
+ count4x4 += counts->tx_size_implied[TX_32X32][TX_4X4];
+ count8x8_8x8p += counts->tx_size_implied[TX_8X8][TX_8X8];
+ count8x8_lp += counts->tx_size_implied[TX_16X16][TX_8X8];
+ count8x8_lp += counts->tx_size_implied[TX_32X32][TX_8X8];
+ count8x8_lp += counts->tx_size_implied[TX_64X64][TX_8X8];
+ count16x16_16x16p += counts->tx_size_implied[TX_16X16][TX_16X16];
+ count16x16_lp += counts->tx_size_implied[TX_32X32][TX_16X16];
+ count16x16_lp += counts->tx_size_implied[TX_64X64][TX_16X16];
+ count32x32_32x32p += counts->tx_size_implied[TX_32X32][TX_32X32];
+ count32x32_lp += counts->tx_size_implied[TX_64X64][TX_32X32];
+ count64x64_64x64p += counts->tx_size_implied[TX_64X64][TX_64X64];
#endif // CONFIG_EXT_TX && CONFIG_RECT_TX
if (count4x4 == 0 && count16x16_lp == 0 && count16x16_16x16p == 0 &&
count32x32_lp == 0 && count32x32_32x32p == 0 &&
@@ -5652,30 +5156,37 @@ void av1_encode_frame(AV1_COMP *cpi) {
int count16x16_16x16p = 0, count16x16_lp = 0;
int count32x32 = 0;
for (i = 0; i < TX_SIZE_CONTEXTS; ++i) {
+ int depth;
// counts->tx_size[max_depth][context_idx][this_depth_level]
- count4x4 += counts->tx_size[0][i][0];
- count4x4 += counts->tx_size[1][i][0];
- count4x4 += counts->tx_size[2][i][0];
-
- count8x8_8x8p += counts->tx_size[0][i][1];
- count8x8_lp += counts->tx_size[1][i][1];
- count8x8_lp += counts->tx_size[2][i][1];
-
- count16x16_16x16p += counts->tx_size[1][i][2];
- count16x16_lp += counts->tx_size[2][i][2];
- count32x32 += counts->tx_size[2][i][3];
+ depth = tx_size_to_depth(TX_4X4);
+ count4x4 += counts->tx_size[TX_8X8 - TX_SIZE_CTX_MIN][i][depth];
+ count4x4 += counts->tx_size[TX_16X16 - TX_SIZE_CTX_MIN][i][depth];
+ count4x4 += counts->tx_size[TX_32X32 - TX_SIZE_CTX_MIN][i][depth];
+
+ depth = tx_size_to_depth(TX_8X8);
+ count8x8_8x8p += counts->tx_size[TX_8X8 - TX_SIZE_CTX_MIN][i][depth];
+ count8x8_lp += counts->tx_size[TX_16X16 - TX_SIZE_CTX_MIN][i][depth];
+ count8x8_lp += counts->tx_size[TX_32X32 - TX_SIZE_CTX_MIN][i][depth];
+
+ depth = tx_size_to_depth(TX_16X16);
+ count16x16_16x16p +=
+ counts->tx_size[TX_16X16 - TX_SIZE_CTX_MIN][i][depth];
+ count16x16_lp += counts->tx_size[TX_32X32 - TX_SIZE_CTX_MIN][i][depth];
+
+ depth = tx_size_to_depth(TX_32X32);
+ count32x32 += counts->tx_size[TX_32X32 - TX_SIZE_CTX_MIN][i][depth];
}
#if CONFIG_EXT_TX && CONFIG_RECT_TX
- count4x4 += counts->tx_size_implied[0][TX_4X4];
- count4x4 += counts->tx_size_implied[1][TX_4X4];
- count4x4 += counts->tx_size_implied[2][TX_4X4];
- count4x4 += counts->tx_size_implied[3][TX_4X4];
- count8x8_8x8p += counts->tx_size_implied[1][TX_8X8];
- count8x8_lp += counts->tx_size_implied[2][TX_8X8];
- count8x8_lp += counts->tx_size_implied[3][TX_8X8];
- count16x16_lp += counts->tx_size_implied[3][TX_16X16];
- count16x16_16x16p += counts->tx_size_implied[2][TX_16X16];
- count32x32 += counts->tx_size_implied[3][TX_32X32];
+ count4x4 += counts->tx_size_implied[TX_4X4][TX_4X4];
+ count4x4 += counts->tx_size_implied[TX_8X8][TX_4X4];
+ count4x4 += counts->tx_size_implied[TX_16X16][TX_4X4];
+ count4x4 += counts->tx_size_implied[TX_32X32][TX_4X4];
+ count8x8_8x8p += counts->tx_size_implied[TX_8X8][TX_8X8];
+ count8x8_lp += counts->tx_size_implied[TX_16X16][TX_8X8];
+ count8x8_lp += counts->tx_size_implied[TX_32X32][TX_8X8];
+ count16x16_16x16p += counts->tx_size_implied[TX_16X16][TX_16X16];
+ count16x16_lp += counts->tx_size_implied[TX_32X32][TX_16X16];
+ count32x32 += counts->tx_size_implied[TX_32X32][TX_32X32];
#endif // CONFIG_EXT_TX && CONFIG_RECT_TX
if (count4x4 == 0 && count16x16_lp == 0 && count16x16_16x16p == 0 &&
#if CONFIG_SUPERTX
@@ -5709,6 +5220,9 @@ void av1_encode_frame(AV1_COMP *cpi) {
}
#endif
} else {
+#if CONFIG_EXT_INTER
+ make_consistent_compound_tools(cm);
+#endif // CONFIG_EXT_INTER
encode_frame_internal(cpi);
}
}
@@ -5758,6 +5272,11 @@ static void sum_intra_stats(FRAME_COUNTS *counts, MACROBLOCKD *xd,
++counts->filter_intra[0][use_filter_intra_mode];
}
if (mbmi->uv_mode == DC_PRED
+#if CONFIG_CB4X4
+ &&
+ is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x,
+ xd->plane[1].subsampling_y)
+#endif
#if CONFIG_PALETTE
&& mbmi->palette_mode_info.palette_size[1] == 0
#endif // CONFIG_PALETTE
@@ -5799,8 +5318,8 @@ static void update_txfm_count(MACROBLOCK *x, MACROBLOCKD *xd,
const int tx_col = blk_col >> 1;
const int max_blocks_high = max_block_high(xd, mbmi->sb_type, 0);
const int max_blocks_wide = max_block_wide(xd, mbmi->sb_type, 0);
- int ctx = txfm_partition_context(xd->above_txfm_context + tx_col,
- xd->left_txfm_context + tx_row,
+ int ctx = txfm_partition_context(xd->above_txfm_context + blk_col,
+ xd->left_txfm_context + blk_row,
mbmi->sb_type, tx_size);
const TX_SIZE plane_tx_size = mbmi->inter_tx_size[tx_row][tx_col];
@@ -5809,8 +5328,8 @@ static void update_txfm_count(MACROBLOCK *x, MACROBLOCKD *xd,
if (tx_size == plane_tx_size) {
++counts->txfm_partition[ctx][0];
mbmi->tx_size = tx_size;
- txfm_partition_update(xd->above_txfm_context + tx_col,
- xd->left_txfm_context + tx_row, tx_size, tx_size);
+ txfm_partition_update(xd->above_txfm_context + blk_col,
+ xd->left_txfm_context + blk_row, tx_size, tx_size);
} else {
const TX_SIZE sub_txs = sub_tx_size_map[tx_size];
const int bs = tx_size_wide_unit[sub_txs];
@@ -5822,8 +5341,8 @@ static void update_txfm_count(MACROBLOCK *x, MACROBLOCKD *xd,
if (tx_size == TX_8X8) {
mbmi->inter_tx_size[tx_row][tx_col] = TX_4X4;
mbmi->tx_size = TX_4X4;
- txfm_partition_update(xd->above_txfm_context + tx_col,
- xd->left_txfm_context + tx_row, TX_4X4, tx_size);
+ txfm_partition_update(xd->above_txfm_context + blk_col,
+ xd->left_txfm_context + blk_row, TX_4X4, tx_size);
return;
}
@@ -5847,9 +5366,10 @@ static void tx_partition_count_update(const AV1_COMMON *const cm, MACROBLOCK *x,
const int bw = tx_size_wide_unit[max_tx_size];
int idx, idy;
- xd->above_txfm_context = cm->above_txfm_context + mi_col;
- xd->left_txfm_context =
- xd->left_txfm_context_buffer + (mi_row & MAX_MIB_MASK);
+ xd->above_txfm_context =
+ cm->above_txfm_context + (mi_col << TX_UNIT_WIDE_LOG2);
+ xd->left_txfm_context = xd->left_txfm_context_buffer +
+ ((mi_row & MAX_MIB_MASK) << TX_UNIT_HIGH_LOG2);
for (idy = 0; idy < mi_height; idy += bh)
for (idx = 0; idx < mi_width; idx += bw)
@@ -5870,8 +5390,8 @@ static void set_txfm_context(MACROBLOCKD *xd, TX_SIZE tx_size, int blk_row,
if (tx_size == plane_tx_size) {
mbmi->tx_size = tx_size;
- txfm_partition_update(xd->above_txfm_context + tx_col,
- xd->left_txfm_context + tx_row, tx_size, tx_size);
+ txfm_partition_update(xd->above_txfm_context + blk_col,
+ xd->left_txfm_context + blk_row, tx_size, tx_size);
} else {
const TX_SIZE sub_txs = sub_tx_size_map[tx_size];
@@ -5881,8 +5401,8 @@ static void set_txfm_context(MACROBLOCKD *xd, TX_SIZE tx_size, int blk_row,
if (tx_size == TX_8X8) {
mbmi->inter_tx_size[tx_row][tx_col] = TX_4X4;
mbmi->tx_size = TX_4X4;
- txfm_partition_update(xd->above_txfm_context + tx_col,
- xd->left_txfm_context + tx_row, TX_4X4, tx_size);
+ txfm_partition_update(xd->above_txfm_context + blk_col,
+ xd->left_txfm_context + blk_row, TX_4X4, tx_size);
return;
}
@@ -5905,9 +5425,10 @@ static void tx_partition_set_contexts(const AV1_COMMON *const cm,
const int bw = tx_size_wide_unit[max_tx_size];
int idx, idy;
- xd->above_txfm_context = cm->above_txfm_context + mi_col;
- xd->left_txfm_context =
- xd->left_txfm_context_buffer + (mi_row & MAX_MIB_MASK);
+ xd->above_txfm_context =
+ cm->above_txfm_context + (mi_col << TX_UNIT_WIDE_LOG2);
+ xd->left_txfm_context = xd->left_txfm_context_buffer +
+ ((mi_row & MAX_MIB_MASK) << TX_UNIT_HIGH_LOG2);
for (idy = 0; idy < mi_height; idy += bh)
for (idx = 0; idx < mi_width; idx += bw)
@@ -5964,8 +5485,7 @@ void av1_update_tx_type_count(const AV1_COMMON *cm, MACROBLOCKD *xd,
static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
TOKENEXTRA **t, RUN_TYPE dry_run, int mi_row,
- int mi_col, BLOCK_SIZE bsize,
- PICK_MODE_CONTEXT *ctx, int *rate) {
+ int mi_col, BLOCK_SIZE bsize, int *rate) {
const AV1_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &td->mb;
MACROBLOCKD *const xd = &x->e_mbd;
@@ -6039,10 +5559,9 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
av1_setup_pre_planes(xd, ref, cfg, mi_row, mi_col,
&xd->block_refs[ref]->sf);
}
- if (!(cpi->sf.reuse_inter_pred_sby && ctx->pred_pixel_ready) || seg_skip)
- av1_build_inter_predictors_sby(xd, mi_row, mi_col, NULL, block_size);
+ av1_build_inter_predictors_sby(cm, xd, mi_row, mi_col, NULL, block_size);
- av1_build_inter_predictors_sbuv(xd, mi_row, mi_col, NULL, block_size);
+ av1_build_inter_predictors_sbuv(cm, xd, mi_row, mi_col, NULL, block_size);
#if CONFIG_MOTION_VAR
if (mbmi->motion_mode == OBMC_CAUSAL) {
#if CONFIG_NCOBMC
@@ -6068,6 +5587,13 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
#endif
}
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ if (bsize < BLOCK_8X8) {
+ daala_dist_set_sub8x8_dst(x, x->decoded_8x8, bsize, block_size_wide[bsize],
+ block_size_high[bsize], mi_row, mi_col);
+ }
+#endif
+
if (!dry_run) {
#if CONFIG_VAR_TX
TX_SIZE tx_size =
@@ -6092,7 +5618,7 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
const TX_SIZE coded_tx_size = txsize_sqr_up_map[tx_size];
const int depth = tx_size_to_depth(coded_tx_size);
++td->counts->tx_size[tx_size_cat][tx_size_ctx][depth];
- if (tx_size != max_txsize_lookup[bsize]) ++x->txb_split_count;
+ if (tx_size != max_txsize_rect_lookup[bsize]) ++x->txb_split_count;
}
#else
const int tx_size_ctx = get_tx_size_context(xd);
@@ -6103,6 +5629,13 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
++td->counts->tx_size[tx_size_cat][tx_size_ctx][depth];
#endif
+#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
+ if (is_quarter_tx_allowed(xd, mbmi, is_inter) &&
+ mbmi->tx_size != txsize_sqr_up_map[mbmi->tx_size]) {
+ ++td->counts->quarter_tx_size[mbmi->tx_size ==
+ quarter_txsize_lookup[mbmi->sb_type]];
+ }
+#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
#if CONFIG_EXT_TX && CONFIG_RECT_TX
assert(IMPLIES(is_rect_tx(tx_size), is_rect_tx_allowed(xd, mbmi)));
#endif // CONFIG_EXT_TX && CONFIG_RECT_TX
@@ -6135,7 +5668,7 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
#if CONFIG_VAR_TX
mbmi->min_tx_size = get_min_tx_size(intra_tx_size);
- if (intra_tx_size != max_txsize_lookup[bsize]) ++x->txb_split_count;
+ if (intra_tx_size != max_txsize_rect_lookup[bsize]) ++x->txb_split_count;
#endif
}
@@ -6327,13 +5860,13 @@ static void predict_superblock(const AV1_COMP *const cpi, ThreadData *td,
}
if (!b_sub8x8)
- av1_build_inter_predictors_sb_extend(xd,
+ av1_build_inter_predictors_sb_extend(cm, xd,
#if CONFIG_EXT_INTER
mi_row_ori, mi_col_ori,
#endif // CONFIG_EXT_INTER
mi_row_pred, mi_col_pred, bsize_pred);
else
- av1_build_inter_predictors_sb_sub8x8_extend(xd,
+ av1_build_inter_predictors_sb_sub8x8_extend(cm, xd,
#if CONFIG_EXT_INTER
mi_row_ori, mi_col_ori,
#endif // CONFIG_EXT_INTER
diff --git a/third_party/aom/av1/encoder/encodeframe.h b/third_party/aom/av1/encoder/encodeframe.h
index 08d6d20de..46a99e1cf 100644
--- a/third_party/aom/av1/encoder/encodeframe.h
+++ b/third_party/aom/av1/encoder/encodeframe.h
@@ -25,13 +25,6 @@ struct yv12_buffer_config;
struct AV1_COMP;
struct ThreadData;
-// Constants used in SOURCE_VAR_BASED_PARTITION
-#define VAR_HIST_MAX_BG_VAR 1000
-#define VAR_HIST_FACTOR 10
-#define VAR_HIST_BINS (VAR_HIST_MAX_BG_VAR / VAR_HIST_FACTOR + 1)
-#define VAR_HIST_LARGE_CUT_OFF 75
-#define VAR_HIST_SMALL_CUT_OFF 45
-
void av1_setup_src_planes(struct macroblock *x,
const struct yv12_buffer_config *src, int mi_row,
int mi_col);
@@ -42,8 +35,6 @@ void av1_init_tile_data(struct AV1_COMP *cpi);
void av1_encode_tile(struct AV1_COMP *cpi, struct ThreadData *td, int tile_row,
int tile_col);
-void av1_set_variance_partition_thresholds(struct AV1_COMP *cpi, int q);
-
void av1_update_tx_type_count(const struct AV1Common *cm, MACROBLOCKD *xd,
#if CONFIG_TXK_SEL
int block, int plane,
diff --git a/third_party/aom/av1/encoder/encodemb.c b/third_party/aom/av1/encoder/encodemb.c
index c450244b1..7c9781533 100644
--- a/third_party/aom/av1/encoder/encodemb.c
+++ b/third_party/aom/av1/encoder/encodemb.c
@@ -115,7 +115,7 @@ static const int plane_rd_mult[REF_TYPES][PLANE_TYPES] = {
#if CONFIG_EC_ADAPT
{ 10, 7 }, { 8, 5 },
#else
- { 10, 6 }, { 8, 5 },
+ { 10, 6 }, { 8, 6 },
#endif
};
@@ -125,35 +125,31 @@ static const int plane_rd_mult[REF_TYPES][PLANE_TYPES] = {
rd_cost1 = RDCOST(rdmult, rddiv, rate1, error1); \
}
-static INLINE int64_t
-get_token_bit_costs(unsigned int token_costs[2][COEFF_CONTEXTS][ENTROPY_TOKENS],
- int skip_eob, int ctx, int token) {
-#if CONFIG_NEW_TOKENSET
+static INLINE unsigned int get_token_bit_costs(
+ unsigned int token_costs[2][COEFF_CONTEXTS][ENTROPY_TOKENS], int skip_eob,
+ int ctx, int token) {
(void)skip_eob;
return token_costs[token == ZERO_TOKEN || token == EOB_TOKEN][ctx][token];
-#else
- return token_costs[skip_eob][ctx][token];
-#endif
}
+#if !CONFIG_LV_MAP
#define USE_GREEDY_OPTIMIZE_B 0
#if USE_GREEDY_OPTIMIZE_B
-typedef struct av1_token_state {
+typedef struct av1_token_state_greedy {
int16_t token;
tran_low_t qc;
tran_low_t dqc;
-} av1_token_state;
+} av1_token_state_greedy;
-int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
- TX_SIZE tx_size, int ctx) {
-#if !CONFIG_PVQ
+static int optimize_b_greedy(const AV1_COMMON *cm, MACROBLOCK *mb, int plane,
+ int block, TX_SIZE tx_size, int ctx) {
MACROBLOCKD *const xd = &mb->e_mbd;
struct macroblock_plane *const p = &mb->plane[plane];
struct macroblockd_plane *const pd = &xd->plane[plane];
const int ref = is_inter_block(&xd->mi[0]->mbmi);
- av1_token_state tokens[MAX_TX_SQUARE + 1][2];
+ av1_token_state_greedy tokens[MAX_TX_SQUARE + 1][2];
uint8_t token_cache[MAX_TX_SQUARE];
const tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block);
tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
@@ -176,38 +172,23 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
#if CONFIG_NEW_QUANT
int dq = get_dq_profile_from_ctx(mb->qindex, ctx, ref, plane_type);
const dequant_val_type_nuq *dequant_val = pd->dequant_val_nuq[dq];
-#elif !CONFIG_AOM_QM
- const int dq_step[2] = { dequant_ptr[0] >> shift, dequant_ptr[1] >> shift };
#endif // CONFIG_NEW_QUANT
int sz = 0;
const int64_t rddiv = mb->rddiv;
int64_t rd_cost0, rd_cost1;
int16_t t0, t1;
int i, final_eob;
-#if CONFIG_HIGHBITDEPTH
const int cat6_bits = av1_get_cat6_extrabits_size(tx_size, xd->bd);
-#else
- const int cat6_bits = av1_get_cat6_extrabits_size(tx_size, 8);
-#endif
unsigned int(*token_costs)[2][COEFF_CONTEXTS][ENTROPY_TOKENS] =
mb->token_costs[txsize_sqr_map[tx_size]][plane_type][ref];
const int default_eob = tx_size_2d[tx_size];
- assert((mb->qindex == 0) ^ (xd->lossless[xd->mi[0]->mbmi.segment_id] == 0));
+ assert(mb->qindex > 0);
assert((!plane_type && !plane) || (plane_type && plane));
assert(eob <= default_eob);
int64_t rdmult = (mb->rdmult * plane_rd_mult[ref][plane_type]) >> 1;
-/* CpuSpeedTest uses "--min-q=0 --max-q=0" and expects 100dB psnr
-* This creates conflict with search for a better EOB position
-* The line below is to make sure EOB search is disabled at this corner case.
-*/
-#if !CONFIG_NEW_QUANT && !CONFIG_AOM_QM
- if (dq_step[1] <= 4) {
- rdmult = 1;
- }
-#endif
int64_t rate0, rate1;
for (i = 0; i < eob; i++) {
@@ -402,22 +383,10 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
dqc_a = shift ? ROUND_POWER_OF_TWO(dqc_a, shift) : dqc_a;
if (sz) dqc_a = -dqc_a;
#else
-// The 32x32 transform coefficient uses half quantization step size.
-// Account for the rounding difference in the dequantized coefficeint
-// value when the quantization index is dropped from an even number
-// to an odd number.
-
-#if CONFIG_AOM_QM
- tran_low_t offset = dqv >> shift;
-#else
- tran_low_t offset = dq_step[rc != 0];
-#endif
- if (shift & x_a) offset += (dqv & 0x01);
-
- if (sz == 0)
- dqc_a = dqcoeff[rc] - offset;
+ if (x_a < 0)
+ dqc_a = -((-x_a * dqv) >> shift);
else
- dqc_a = dqcoeff[rc] + offset;
+ dqc_a = (x_a * dqv) >> shift;
#endif // CONFIG_NEW_QUANT
} else {
dqc_a = 0;
@@ -483,19 +452,11 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
mb->plane[plane].eobs[block] = final_eob;
return final_eob;
-
-#else // !CONFIG_PVQ
- (void)cm;
- (void)tx_size;
- (void)ctx;
- struct macroblock_plane *const p = &mb->plane[plane];
- return p->eobs[block];
-#endif // !CONFIG_PVQ
}
#else // USE_GREEDY_OPTIMIZE_B
-typedef struct av1_token_state {
+typedef struct av1_token_state_org {
int64_t error;
int rate;
int16_t next;
@@ -503,16 +464,15 @@ typedef struct av1_token_state {
tran_low_t qc;
tran_low_t dqc;
uint8_t best_index;
-} av1_token_state;
+} av1_token_state_org;
-int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
- TX_SIZE tx_size, int ctx) {
-#if !CONFIG_PVQ
+static int optimize_b_org(const AV1_COMMON *cm, MACROBLOCK *mb, int plane,
+ int block, TX_SIZE tx_size, int ctx) {
MACROBLOCKD *const xd = &mb->e_mbd;
struct macroblock_plane *const p = &mb->plane[plane];
struct macroblockd_plane *const pd = &xd->plane[plane];
const int ref = is_inter_block(&xd->mi[0]->mbmi);
- av1_token_state tokens[MAX_TX_SQUARE + 1][2];
+ av1_token_state_org tokens[MAX_TX_SQUARE + 1][2];
uint8_t token_cache[MAX_TX_SQUARE];
const tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block);
tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
@@ -536,8 +496,6 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
#if CONFIG_NEW_QUANT
int dq = get_dq_profile_from_ctx(mb->qindex, ctx, ref, plane_type);
const dequant_val_type_nuq *dequant_val = pd->dequant_val_nuq[dq];
-#elif !CONFIG_AOM_QM
- const int dq_step[2] = { dequant_ptr[0] >> shift, dequant_ptr[1] >> shift };
#endif // CONFIG_NEW_QUANT
int next = eob, sz = 0;
const int64_t rdmult = (mb->rdmult * plane_rd_mult[ref][plane_type]) >> 1;
@@ -549,11 +507,7 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
int best, band = (eob < default_eob) ? band_translate[eob]
: band_translate[eob - 1];
int pt, i, final_eob;
-#if CONFIG_HIGHBITDEPTH
const int cat6_bits = av1_get_cat6_extrabits_size(tx_size, xd->bd);
-#else
- const int cat6_bits = av1_get_cat6_extrabits_size(tx_size, 8);
-#endif
unsigned int(*token_costs)[2][COEFF_CONTEXTS][ENTROPY_TOKENS] =
mb->token_costs[txsize_sqr_map[tx_size]][plane_type][ref];
const uint16_t *band_counts = &band_count_table[tx_size][band];
@@ -566,11 +520,10 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
? av1_get_qindex(&cm->seg, xd->mi[0]->mbmi.segment_id,
cm->base_qindex)
: cm->base_qindex;
- if (qindex == 0) {
- assert((qindex == 0) ^ (xd->lossless[xd->mi[0]->mbmi.segment_id] == 0));
- }
+ assert(qindex > 0);
+ (void)qindex;
#else
- assert((mb->qindex == 0) ^ (xd->lossless[xd->mi[0]->mbmi.segment_id] == 0));
+ assert(mb->qindex > 0);
#endif
token_costs += band;
@@ -777,22 +730,10 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
: tokens[i][1].dqc;
if (sz) tokens[i][1].dqc = -tokens[i][1].dqc;
#else
-// The 32x32 transform coefficient uses half quantization step size.
-// Account for the rounding difference in the dequantized coefficeint
-// value when the quantization index is dropped from an even number
-// to an odd number.
-
-#if CONFIG_AOM_QM
- tran_low_t offset = dqv >> shift;
-#else
- tran_low_t offset = dq_step[rc != 0];
-#endif
- if (shift & x) offset += (dqv & 0x01);
-
- if (sz == 0)
- tokens[i][1].dqc = dqcoeff[rc] - offset;
+ if (x < 0)
+ tokens[i][1].dqc = -((-x * dqv) >> shift);
else
- tokens[i][1].dqc = dqcoeff[rc] + offset;
+ tokens[i][1].dqc = (x * dqv) >> shift;
#endif // CONFIG_NEW_QUANT
} else {
tokens[i][1].dqc = 0;
@@ -858,16 +799,47 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
mb->plane[plane].eobs[block] = final_eob;
assert(final_eob <= default_eob);
return final_eob;
-#else // !CONFIG_PVQ
+}
+
+#endif // USE_GREEDY_OPTIMIZE_B
+#endif // !CONFIG_LV_MAP
+
+int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
+ BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
+ const ENTROPY_CONTEXT *a, const ENTROPY_CONTEXT *l) {
+ MACROBLOCKD *const xd = &mb->e_mbd;
+ struct macroblock_plane *const p = &mb->plane[plane];
+ const int eob = p->eobs[block];
+ assert((mb->qindex == 0) ^ (xd->lossless[xd->mi[0]->mbmi.segment_id] == 0));
+ if (eob == 0) return eob;
+ if (xd->lossless[xd->mi[0]->mbmi.segment_id]) return eob;
+#if CONFIG_PVQ
(void)cm;
(void)tx_size;
- (void)ctx;
- struct macroblock_plane *const p = &mb->plane[plane];
- return p->eobs[block];
-#endif // !CONFIG_PVQ
-}
+ (void)a;
+ (void)l;
+ return eob;
+#endif
+
+#if !CONFIG_LV_MAP
+ (void)plane_bsize;
+#if CONFIG_VAR_TX
+ int ctx = get_entropy_context(tx_size, a, l);
+#else
+ int ctx = combine_entropy_contexts(*a, *l);
+#endif
+#if USE_GREEDY_OPTIMIZE_B
+ return optimize_b_greedy(cm, mb, plane, block, tx_size, ctx);
+#else // USE_GREEDY_OPTIMIZE_B
+ return optimize_b_org(cm, mb, plane, block, tx_size, ctx);
#endif // USE_GREEDY_OPTIMIZE_B
+#else // !CONFIG_LV_MAP
+ TXB_CTX txb_ctx;
+ get_txb_ctx(plane_bsize, tx_size, plane, a, l, &txb_ctx);
+ return av1_optimize_txb(cm, mb, plane, block, tx_size, &txb_ctx);
+#endif // !CONFIG_LV_MAP
+}
#if !CONFIG_PVQ
#if CONFIG_HIGHBITDEPTH
@@ -1158,8 +1130,7 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
#endif
#if !CONFIG_PVQ
- if (p->eobs[block] && !xd->lossless[xd->mi[0]->mbmi.segment_id])
- av1_optimize_b(cm, x, plane, block, tx_size, ctx);
+ av1_optimize_b(cm, x, plane, block, plane_bsize, tx_size, a, l);
av1_set_txb_context(x, plane, block, tx_size, a, l);
@@ -1202,12 +1173,13 @@ static void encode_block_inter(int plane, int block, int blk_row, int blk_col,
if (tx_size == plane_tx_size) {
encode_block(plane, block, blk_row, blk_col, plane_bsize, tx_size, arg);
} else {
+ assert(tx_size < TX_SIZES_ALL);
const TX_SIZE sub_txs = sub_tx_size_map[tx_size];
+ assert(sub_txs < tx_size);
// This is the square transform block partition entry point.
int bsl = tx_size_wide_unit[sub_txs];
int i;
assert(bsl > 0);
- assert(tx_size < TX_SIZES_ALL);
for (i = 0; i < 4; ++i) {
const int offsetr = blk_row + ((i >> 1) * bsl);
@@ -1301,8 +1273,8 @@ void av1_encode_sby_pass1(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize) {
encode_block_pass1, &args);
}
-void av1_encode_sb(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize,
- const int mi_row, const int mi_col) {
+void av1_encode_sb(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize, int mi_row,
+ int mi_col) {
MACROBLOCKD *const xd = &x->e_mbd;
struct optimize_ctx ctx;
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
@@ -1433,6 +1405,301 @@ static void encode_block_intra_and_set_context(int plane, int block,
#endif
}
+#if CONFIG_DPCM_INTRA
+static int get_eob(const tran_low_t *qcoeff, intptr_t n_coeffs,
+ const int16_t *scan) {
+ int eob = -1;
+ for (int i = (int)n_coeffs - 1; i >= 0; i--) {
+ const int rc = scan[i];
+ if (qcoeff[rc]) {
+ eob = i;
+ break;
+ }
+ }
+ return eob + 1;
+}
+
+static void quantize_scaler(int coeff, int16_t zbin, int16_t round_value,
+ int16_t quant, int16_t quant_shift, int16_t dequant,
+ int log_scale, tran_low_t *const qcoeff,
+ tran_low_t *const dqcoeff) {
+ zbin = ROUND_POWER_OF_TWO(zbin, log_scale);
+ round_value = ROUND_POWER_OF_TWO(round_value, log_scale);
+ const int coeff_sign = (coeff >> 31);
+ const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
+ if (abs_coeff >= zbin) {
+ int tmp = clamp(abs_coeff + round_value, INT16_MIN, INT16_MAX);
+ tmp = ((((tmp * quant) >> 16) + tmp) * quant_shift) >> (16 - log_scale);
+ *qcoeff = (tmp ^ coeff_sign) - coeff_sign;
+ *dqcoeff = (*qcoeff * dequant) / (1 << log_scale);
+ }
+}
+
+typedef void (*dpcm_fwd_tx_func)(const int16_t *input, int stride,
+ TX_TYPE_1D tx_type, tran_low_t *output);
+
+static dpcm_fwd_tx_func get_dpcm_fwd_tx_func(int tx_length) {
+ switch (tx_length) {
+ case 4: return av1_dpcm_ft4_c;
+ case 8: return av1_dpcm_ft8_c;
+ case 16: return av1_dpcm_ft16_c;
+ case 32:
+ return av1_dpcm_ft32_c;
+ // TODO(huisu): add support for TX_64X64.
+ default: assert(0); return NULL;
+ }
+}
+
+static void process_block_dpcm_vert(TX_SIZE tx_size, TX_TYPE_1D tx_type_1d,
+ struct macroblockd_plane *const pd,
+ struct macroblock_plane *const p,
+ uint8_t *src, int src_stride, uint8_t *dst,
+ int dst_stride, int16_t *src_diff,
+ int diff_stride, tran_low_t *coeff,
+ tran_low_t *qcoeff, tran_low_t *dqcoeff) {
+ const int tx1d_width = tx_size_wide[tx_size];
+ dpcm_fwd_tx_func forward_tx = get_dpcm_fwd_tx_func(tx1d_width);
+ dpcm_inv_txfm_add_func inverse_tx =
+ av1_get_dpcm_inv_txfm_add_func(tx1d_width);
+ const int tx1d_height = tx_size_high[tx_size];
+ const int log_scale = av1_get_tx_scale(tx_size);
+ int q_idx = 0;
+ for (int r = 0; r < tx1d_height; ++r) {
+ // Update prediction.
+ if (r > 0) memcpy(dst, dst - dst_stride, tx1d_width * sizeof(dst[0]));
+ // Subtraction.
+ for (int c = 0; c < tx1d_width; ++c) src_diff[c] = src[c] - dst[c];
+ // Forward transform.
+ forward_tx(src_diff, 1, tx_type_1d, coeff);
+ // Quantization.
+ for (int c = 0; c < tx1d_width; ++c) {
+ quantize_scaler(coeff[c], p->zbin[q_idx], p->round[q_idx],
+ p->quant[q_idx], p->quant_shift[q_idx],
+ pd->dequant[q_idx], log_scale, &qcoeff[c], &dqcoeff[c]);
+ q_idx = 1;
+ }
+ // Inverse transform.
+ inverse_tx(dqcoeff, 1, tx_type_1d, dst);
+ // Move to the next row.
+ coeff += tx1d_width;
+ qcoeff += tx1d_width;
+ dqcoeff += tx1d_width;
+ src_diff += diff_stride;
+ dst += dst_stride;
+ src += src_stride;
+ }
+}
+
+static void process_block_dpcm_horz(TX_SIZE tx_size, TX_TYPE_1D tx_type_1d,
+ struct macroblockd_plane *const pd,
+ struct macroblock_plane *const p,
+ uint8_t *src, int src_stride, uint8_t *dst,
+ int dst_stride, int16_t *src_diff,
+ int diff_stride, tran_low_t *coeff,
+ tran_low_t *qcoeff, tran_low_t *dqcoeff) {
+ const int tx1d_height = tx_size_high[tx_size];
+ dpcm_fwd_tx_func forward_tx = get_dpcm_fwd_tx_func(tx1d_height);
+ dpcm_inv_txfm_add_func inverse_tx =
+ av1_get_dpcm_inv_txfm_add_func(tx1d_height);
+ const int tx1d_width = tx_size_wide[tx_size];
+ const int log_scale = av1_get_tx_scale(tx_size);
+ int q_idx = 0;
+ for (int c = 0; c < tx1d_width; ++c) {
+ for (int r = 0; r < tx1d_height; ++r) {
+ // Update prediction.
+ if (c > 0) dst[r * dst_stride] = dst[r * dst_stride - 1];
+ // Subtraction.
+ src_diff[r * diff_stride] = src[r * src_stride] - dst[r * dst_stride];
+ }
+ // Forward transform.
+ tran_low_t tx_buff[64];
+ forward_tx(src_diff, diff_stride, tx_type_1d, tx_buff);
+ for (int r = 0; r < tx1d_height; ++r) coeff[r * tx1d_width] = tx_buff[r];
+ // Quantization.
+ for (int r = 0; r < tx1d_height; ++r) {
+ quantize_scaler(coeff[r * tx1d_width], p->zbin[q_idx], p->round[q_idx],
+ p->quant[q_idx], p->quant_shift[q_idx],
+ pd->dequant[q_idx], log_scale, &qcoeff[r * tx1d_width],
+ &dqcoeff[r * tx1d_width]);
+ q_idx = 1;
+ }
+ // Inverse transform.
+ for (int r = 0; r < tx1d_height; ++r) tx_buff[r] = dqcoeff[r * tx1d_width];
+ inverse_tx(tx_buff, dst_stride, tx_type_1d, dst);
+ // Move to the next column.
+ ++coeff, ++qcoeff, ++dqcoeff, ++src_diff, ++dst, ++src;
+ }
+}
+
+#if CONFIG_HIGHBITDEPTH
+static void hbd_process_block_dpcm_vert(
+ TX_SIZE tx_size, TX_TYPE_1D tx_type_1d, int bd,
+ struct macroblockd_plane *const pd, struct macroblock_plane *const p,
+ uint8_t *src8, int src_stride, uint8_t *dst8, int dst_stride,
+ int16_t *src_diff, int diff_stride, tran_low_t *coeff, tran_low_t *qcoeff,
+ tran_low_t *dqcoeff) {
+ const int tx1d_width = tx_size_wide[tx_size];
+ dpcm_fwd_tx_func forward_tx = get_dpcm_fwd_tx_func(tx1d_width);
+ hbd_dpcm_inv_txfm_add_func inverse_tx =
+ av1_get_hbd_dpcm_inv_txfm_add_func(tx1d_width);
+ uint16_t *src = CONVERT_TO_SHORTPTR(src8);
+ uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
+ const int tx1d_height = tx_size_high[tx_size];
+ const int log_scale = av1_get_tx_scale(tx_size);
+ int q_idx = 0;
+ for (int r = 0; r < tx1d_height; ++r) {
+ // Update prediction.
+ if (r > 0) memcpy(dst, dst - dst_stride, tx1d_width * sizeof(dst[0]));
+ // Subtraction.
+ for (int c = 0; c < tx1d_width; ++c) src_diff[c] = src[c] - dst[c];
+ // Forward transform.
+ forward_tx(src_diff, 1, tx_type_1d, coeff);
+ // Quantization.
+ for (int c = 0; c < tx1d_width; ++c) {
+ quantize_scaler(coeff[c], p->zbin[q_idx], p->round[q_idx],
+ p->quant[q_idx], p->quant_shift[q_idx],
+ pd->dequant[q_idx], log_scale, &qcoeff[c], &dqcoeff[c]);
+ q_idx = 1;
+ }
+ // Inverse transform.
+ inverse_tx(dqcoeff, 1, tx_type_1d, bd, dst);
+ // Move to the next row.
+ coeff += tx1d_width;
+ qcoeff += tx1d_width;
+ dqcoeff += tx1d_width;
+ src_diff += diff_stride;
+ dst += dst_stride;
+ src += src_stride;
+ }
+}
+
+static void hbd_process_block_dpcm_horz(
+ TX_SIZE tx_size, TX_TYPE_1D tx_type_1d, int bd,
+ struct macroblockd_plane *const pd, struct macroblock_plane *const p,
+ uint8_t *src8, int src_stride, uint8_t *dst8, int dst_stride,
+ int16_t *src_diff, int diff_stride, tran_low_t *coeff, tran_low_t *qcoeff,
+ tran_low_t *dqcoeff) {
+ const int tx1d_height = tx_size_high[tx_size];
+ dpcm_fwd_tx_func forward_tx = get_dpcm_fwd_tx_func(tx1d_height);
+ hbd_dpcm_inv_txfm_add_func inverse_tx =
+ av1_get_hbd_dpcm_inv_txfm_add_func(tx1d_height);
+ uint16_t *src = CONVERT_TO_SHORTPTR(src8);
+ uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
+ const int tx1d_width = tx_size_wide[tx_size];
+ const int log_scale = av1_get_tx_scale(tx_size);
+ int q_idx = 0;
+ for (int c = 0; c < tx1d_width; ++c) {
+ for (int r = 0; r < tx1d_height; ++r) {
+ // Update prediction.
+ if (c > 0) dst[r * dst_stride] = dst[r * dst_stride - 1];
+ // Subtraction.
+ src_diff[r * diff_stride] = src[r * src_stride] - dst[r * dst_stride];
+ }
+ // Forward transform.
+ tran_low_t tx_buff[64];
+ forward_tx(src_diff, diff_stride, tx_type_1d, tx_buff);
+ for (int r = 0; r < tx1d_height; ++r) coeff[r * tx1d_width] = tx_buff[r];
+ // Quantization.
+ for (int r = 0; r < tx1d_height; ++r) {
+ quantize_scaler(coeff[r * tx1d_width], p->zbin[q_idx], p->round[q_idx],
+ p->quant[q_idx], p->quant_shift[q_idx],
+ pd->dequant[q_idx], log_scale, &qcoeff[r * tx1d_width],
+ &dqcoeff[r * tx1d_width]);
+ q_idx = 1;
+ }
+ // Inverse transform.
+ for (int r = 0; r < tx1d_height; ++r) tx_buff[r] = dqcoeff[r * tx1d_width];
+ inverse_tx(tx_buff, dst_stride, tx_type_1d, bd, dst);
+ // Move to the next column.
+ ++coeff, ++qcoeff, ++dqcoeff, ++src_diff, ++dst, ++src;
+ }
+}
+#endif // CONFIG_HIGHBITDEPTH
+
+void av1_encode_block_intra_dpcm(const AV1_COMMON *cm, MACROBLOCK *x,
+ PREDICTION_MODE mode, int plane, int block,
+ int blk_row, int blk_col,
+ BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
+ TX_TYPE tx_type, ENTROPY_CONTEXT *ta,
+ ENTROPY_CONTEXT *tl, int8_t *skip) {
+ MACROBLOCKD *const xd = &x->e_mbd;
+ struct macroblock_plane *const p = &x->plane[plane];
+ struct macroblockd_plane *const pd = &xd->plane[plane];
+ tran_low_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
+ const int diff_stride = block_size_wide[plane_bsize];
+ const int src_stride = p->src.stride;
+ const int dst_stride = pd->dst.stride;
+ const int tx1d_width = tx_size_wide[tx_size];
+ const int tx1d_height = tx_size_high[tx_size];
+ const SCAN_ORDER *const scan_order = get_scan(cm, tx_size, tx_type, 0);
+ tran_low_t *coeff = BLOCK_OFFSET(p->coeff, block);
+ tran_low_t *qcoeff = BLOCK_OFFSET(p->qcoeff, block);
+ uint8_t *dst =
+ &pd->dst.buf[(blk_row * dst_stride + blk_col) << tx_size_wide_log2[0]];
+ uint8_t *src =
+ &p->src.buf[(blk_row * src_stride + blk_col) << tx_size_wide_log2[0]];
+ int16_t *src_diff =
+ &p->src_diff[(blk_row * diff_stride + blk_col) << tx_size_wide_log2[0]];
+ uint16_t *eob = &p->eobs[block];
+ *eob = 0;
+ memset(qcoeff, 0, tx1d_height * tx1d_width * sizeof(*qcoeff));
+ memset(dqcoeff, 0, tx1d_height * tx1d_width * sizeof(*dqcoeff));
+
+ if (LIKELY(!x->skip_block)) {
+ TX_TYPE_1D tx_type_1d = DCT_1D;
+ switch (tx_type) {
+ case IDTX: tx_type_1d = IDTX_1D; break;
+ case V_DCT:
+ assert(mode == H_PRED);
+ tx_type_1d = DCT_1D;
+ break;
+ case H_DCT:
+ assert(mode == V_PRED);
+ tx_type_1d = DCT_1D;
+ break;
+ default: assert(0);
+ }
+ switch (mode) {
+ case V_PRED:
+#if CONFIG_HIGHBITDEPTH
+ if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
+ hbd_process_block_dpcm_vert(tx_size, tx_type_1d, xd->bd, pd, p, src,
+ src_stride, dst, dst_stride, src_diff,
+ diff_stride, coeff, qcoeff, dqcoeff);
+ } else {
+#endif // CONFIG_HIGHBITDEPTH
+ process_block_dpcm_vert(tx_size, tx_type_1d, pd, p, src, src_stride,
+ dst, dst_stride, src_diff, diff_stride, coeff,
+ qcoeff, dqcoeff);
+#if CONFIG_HIGHBITDEPTH
+ }
+#endif // CONFIG_HIGHBITDEPTH
+ break;
+ case H_PRED:
+#if CONFIG_HIGHBITDEPTH
+ if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
+ hbd_process_block_dpcm_horz(tx_size, tx_type_1d, xd->bd, pd, p, src,
+ src_stride, dst, dst_stride, src_diff,
+ diff_stride, coeff, qcoeff, dqcoeff);
+ } else {
+#endif // CONFIG_HIGHBITDEPTH
+ process_block_dpcm_horz(tx_size, tx_type_1d, pd, p, src, src_stride,
+ dst, dst_stride, src_diff, diff_stride, coeff,
+ qcoeff, dqcoeff);
+#if CONFIG_HIGHBITDEPTH
+ }
+#endif // CONFIG_HIGHBITDEPTH
+ break;
+ default: assert(0);
+ }
+ *eob = get_eob(qcoeff, tx1d_height * tx1d_width, scan_order->scan);
+ }
+
+ ta[blk_col] = tl[blk_row] = *eob > 0;
+ if (*eob) *skip = 0;
+}
+#endif // CONFIG_DPCM_INTRA
+
void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
void *arg) {
@@ -1449,7 +1716,33 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
const int dst_stride = pd->dst.stride;
uint8_t *dst =
&pd->dst.buf[(blk_row * dst_stride + blk_col) << tx_size_wide_log2[0]];
+#if CONFIG_CFL
+
+#if CONFIG_EC_ADAPT
+ FRAME_CONTEXT *const ec_ctx = xd->tile_ctx;
+#else
+ FRAME_CONTEXT *const ec_ctx = cm->fc;
+#endif // CONFIG_EC_ADAPT
+
+ av1_predict_intra_block_encoder_facade(x, ec_ctx, plane, block, blk_col,
+ blk_row, tx_size, plane_bsize);
+#else
av1_predict_intra_block_facade(xd, plane, block, blk_col, blk_row, tx_size);
+#endif
+
+#if CONFIG_DPCM_INTRA
+ const int block_raster_idx = av1_block_index_to_raster_order(tx_size, block);
+ const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
+ const PREDICTION_MODE mode =
+ (plane == 0) ? get_y_mode(xd->mi[0], block_raster_idx) : mbmi->uv_mode;
+ if (av1_use_dpcm_intra(plane, mode, tx_type, mbmi)) {
+ av1_encode_block_intra_dpcm(cm, x, mode, plane, block, blk_row, blk_col,
+ plane_bsize, tx_size, tx_type, args->ta,
+ args->tl, args->skip);
+ return;
+ }
+#endif // CONFIG_DPCM_INTRA
+
av1_subtract_txb(x, plane, plane_bsize, blk_col, blk_row, tx_size);
const ENTROPY_CONTEXT *a = &args->ta[blk_col];
@@ -1458,9 +1751,7 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
if (args->enable_optimize_b) {
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
ctx, AV1_XFORM_QUANT_FP);
- if (p->eobs[block]) {
- av1_optimize_b(cm, x, plane, block, tx_size, ctx);
- }
+ av1_optimize_b(cm, x, plane, block, plane_bsize, tx_size, a, l);
} else {
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
ctx, AV1_XFORM_QUANT_B);
@@ -1480,16 +1771,216 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
// Note : *(args->skip) == mbmi->skip
#endif
#if CONFIG_CFL
+ MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
if (plane == AOM_PLANE_Y && x->cfl_store_y) {
cfl_store(xd->cfl, dst, dst_stride, blk_row, blk_col, tx_size);
}
+
+ if (mbmi->uv_mode == DC_PRED) {
+ // TODO(ltrudeau) find a cleaner way to detect last transform block
+ if (plane == AOM_PLANE_U) {
+ xd->cfl->num_tx_blk[CFL_PRED_U] =
+ (blk_row == 0 && blk_col == 0) ? 1
+ : xd->cfl->num_tx_blk[CFL_PRED_U] + 1;
+ }
+
+ if (plane == AOM_PLANE_V) {
+ xd->cfl->num_tx_blk[CFL_PRED_V] =
+ (blk_row == 0 && blk_col == 0) ? 1
+ : xd->cfl->num_tx_blk[CFL_PRED_V] + 1;
+
+ if (mbmi->skip &&
+ xd->cfl->num_tx_blk[CFL_PRED_U] == xd->cfl->num_tx_blk[CFL_PRED_V]) {
+ assert(plane_bsize != BLOCK_INVALID);
+ const int block_width = block_size_wide[plane_bsize];
+ const int block_height = block_size_high[plane_bsize];
+
+ // if SKIP is chosen at the block level, and ind != 0, we must change
+ // the prediction
+ if (mbmi->cfl_alpha_idx != 0) {
+ const struct macroblockd_plane *const pd_cb = &xd->plane[AOM_PLANE_U];
+ uint8_t *const dst_cb = pd_cb->dst.buf;
+ const int dst_stride_cb = pd_cb->dst.stride;
+ uint8_t *const dst_cr = pd->dst.buf;
+ const int dst_stride_cr = pd->dst.stride;
+ for (int j = 0; j < block_height; j++) {
+ for (int i = 0; i < block_width; i++) {
+ dst_cb[dst_stride_cb * j + i] =
+ (uint8_t)(xd->cfl->dc_pred[CFL_PRED_U] + 0.5);
+ dst_cr[dst_stride_cr * j + i] =
+ (uint8_t)(xd->cfl->dc_pred[CFL_PRED_V] + 0.5);
+ }
+ }
+ mbmi->cfl_alpha_idx = 0;
+ mbmi->cfl_alpha_signs[CFL_PRED_U] = CFL_SIGN_POS;
+ mbmi->cfl_alpha_signs[CFL_PRED_V] = CFL_SIGN_POS;
+ }
+ }
+ }
+ }
#endif
}
+#if CONFIG_CFL
+static int cfl_alpha_dist(const uint8_t *y_pix, int y_stride, double y_avg,
+ const uint8_t *src, int src_stride, int blk_width,
+ int blk_height, double dc_pred, double alpha,
+ int *dist_neg_out) {
+ const double dc_pred_bias = dc_pred + 0.5;
+ int dist = 0;
+ int diff;
+
+ if (alpha == 0.0) {
+ const int dc_pred_i = (int)dc_pred_bias;
+ for (int j = 0; j < blk_height; j++) {
+ for (int i = 0; i < blk_width; i++) {
+ diff = src[i] - dc_pred_i;
+ dist += diff * diff;
+ }
+ src += src_stride;
+ }
+
+ if (dist_neg_out) *dist_neg_out = dist;
+
+ return dist;
+ }
+
+ int dist_neg = 0;
+ for (int j = 0; j < blk_height; j++) {
+ for (int i = 0; i < blk_width; i++) {
+ const double scaled_luma = alpha * (y_pix[i] - y_avg);
+ const int uv = src[i];
+ diff = uv - (int)(scaled_luma + dc_pred_bias);
+ dist += diff * diff;
+ diff = uv + (int)(scaled_luma - dc_pred_bias);
+ dist_neg += diff * diff;
+ }
+ y_pix += y_stride;
+ src += src_stride;
+ }
+
+ if (dist_neg_out) *dist_neg_out = dist_neg;
+
+ return dist;
+}
+
+static int cfl_compute_alpha_ind(MACROBLOCK *const x, const CFL_CTX *const cfl,
+ BLOCK_SIZE bsize,
+ CFL_SIGN_TYPE signs_out[CFL_SIGNS]) {
+ const struct macroblock_plane *const p_u = &x->plane[AOM_PLANE_U];
+ const struct macroblock_plane *const p_v = &x->plane[AOM_PLANE_V];
+ const uint8_t *const src_u = p_u->src.buf;
+ const uint8_t *const src_v = p_v->src.buf;
+ const int src_stride_u = p_u->src.stride;
+ const int src_stride_v = p_v->src.stride;
+ const int block_width = block_size_wide[bsize];
+ const int block_height = block_size_high[bsize];
+ const double dc_pred_u = cfl->dc_pred[CFL_PRED_U];
+ const double dc_pred_v = cfl->dc_pred[CFL_PRED_V];
+
+ // Temporary pixel buffer used to store the CfL prediction when we compute the
+ // alpha index.
+ uint8_t tmp_pix[MAX_SB_SQUARE];
+ // Load CfL Prediction over the entire block
+ const double y_avg =
+ cfl_load(cfl, tmp_pix, MAX_SB_SIZE, 0, 0, block_width, block_height);
+
+ int sse[CFL_PRED_PLANES][CFL_MAGS_SIZE];
+ sse[CFL_PRED_U][0] =
+ cfl_alpha_dist(tmp_pix, MAX_SB_SIZE, y_avg, src_u, src_stride_u,
+ block_width, block_height, dc_pred_u, 0, NULL);
+ sse[CFL_PRED_V][0] =
+ cfl_alpha_dist(tmp_pix, MAX_SB_SIZE, y_avg, src_v, src_stride_v,
+ block_width, block_height, dc_pred_v, 0, NULL);
+ for (int m = 1; m < CFL_MAGS_SIZE; m += 2) {
+ assert(cfl_alpha_mags[m + 1] == -cfl_alpha_mags[m]);
+ sse[CFL_PRED_U][m] = cfl_alpha_dist(
+ tmp_pix, MAX_SB_SIZE, y_avg, src_u, src_stride_u, block_width,
+ block_height, dc_pred_u, cfl_alpha_mags[m], &sse[CFL_PRED_U][m + 1]);
+ sse[CFL_PRED_V][m] = cfl_alpha_dist(
+ tmp_pix, MAX_SB_SIZE, y_avg, src_v, src_stride_v, block_width,
+ block_height, dc_pred_v, cfl_alpha_mags[m], &sse[CFL_PRED_V][m + 1]);
+ }
+
+ int dist;
+ int64_t cost;
+ int64_t best_cost;
+
+ // Compute least squares parameter of the entire block
+ // IMPORTANT: We assume that the first code is 0,0
+ int ind = 0;
+ signs_out[CFL_PRED_U] = CFL_SIGN_POS;
+ signs_out[CFL_PRED_V] = CFL_SIGN_POS;
+
+ dist = sse[CFL_PRED_U][0] + sse[CFL_PRED_V][0];
+ dist *= 16;
+ best_cost = RDCOST(x->rdmult, x->rddiv, cfl->costs[0], dist);
+
+ for (int c = 1; c < CFL_ALPHABET_SIZE; c++) {
+ const int idx_u = cfl_alpha_codes[c][CFL_PRED_U];
+ const int idx_v = cfl_alpha_codes[c][CFL_PRED_V];
+ for (CFL_SIGN_TYPE sign_u = idx_u == 0; sign_u < CFL_SIGNS; sign_u++) {
+ for (CFL_SIGN_TYPE sign_v = idx_v == 0; sign_v < CFL_SIGNS; sign_v++) {
+ dist = sse[CFL_PRED_U][idx_u + (sign_u == CFL_SIGN_NEG)] +
+ sse[CFL_PRED_V][idx_v + (sign_v == CFL_SIGN_NEG)];
+ dist *= 16;
+ cost = RDCOST(x->rdmult, x->rddiv, cfl->costs[c], dist);
+ if (cost < best_cost) {
+ best_cost = cost;
+ ind = c;
+ signs_out[CFL_PRED_U] = sign_u;
+ signs_out[CFL_PRED_V] = sign_v;
+ }
+ }
+ }
+ }
+
+ return ind;
+}
+
+static inline void cfl_update_costs(CFL_CTX *cfl, FRAME_CONTEXT *ec_ctx) {
+ assert(ec_ctx->cfl_alpha_cdf[CFL_ALPHABET_SIZE - 1] ==
+ AOM_ICDF(CDF_PROB_TOP));
+ const int prob_den = CDF_PROB_TOP;
+
+ int prob_num = AOM_ICDF(ec_ctx->cfl_alpha_cdf[0]);
+ cfl->costs[0] = av1_cost_zero(get_prob(prob_num, prob_den));
+
+ for (int c = 1; c < CFL_ALPHABET_SIZE; c++) {
+ int sign_bit_cost = (cfl_alpha_codes[c][CFL_PRED_U] != 0) +
+ (cfl_alpha_codes[c][CFL_PRED_V] != 0);
+ prob_num = AOM_ICDF(ec_ctx->cfl_alpha_cdf[c]) -
+ AOM_ICDF(ec_ctx->cfl_alpha_cdf[c - 1]);
+ cfl->costs[c] = av1_cost_zero(get_prob(prob_num, prob_den)) +
+ av1_cost_literal(sign_bit_cost);
+ }
+}
+
+void av1_predict_intra_block_encoder_facade(MACROBLOCK *x,
+ FRAME_CONTEXT *ec_ctx, int plane,
+ int block_idx, int blk_col,
+ int blk_row, TX_SIZE tx_size,
+ BLOCK_SIZE plane_bsize) {
+ MACROBLOCKD *const xd = &x->e_mbd;
+ MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
+ if (plane != AOM_PLANE_Y && mbmi->uv_mode == DC_PRED) {
+ if (blk_col == 0 && blk_row == 0 && plane == AOM_PLANE_U) {
+ CFL_CTX *const cfl = xd->cfl;
+ cfl_update_costs(cfl, ec_ctx);
+ cfl_dc_pred(xd, plane_bsize, tx_size);
+ mbmi->cfl_alpha_idx =
+ cfl_compute_alpha_ind(x, cfl, plane_bsize, mbmi->cfl_alpha_signs);
+ }
+ }
+ av1_predict_intra_block_facade(xd, plane, block_idx, blk_col, blk_row,
+ tx_size);
+}
+#endif
+
void av1_encode_intra_block_plane(AV1_COMMON *cm, MACROBLOCK *x,
BLOCK_SIZE bsize, int plane,
- int enable_optimize_b, const int mi_row,
- const int mi_col) {
+ int enable_optimize_b, int mi_row,
+ int mi_col) {
const MACROBLOCKD *const xd = &x->e_mbd;
ENTROPY_CONTEXT ta[2 * MAX_MIB_SIZE] = { 0 };
ENTROPY_CONTEXT tl[2 * MAX_MIB_SIZE] = { 0 };
@@ -1545,9 +2036,7 @@ PVQ_SKIP_TYPE av1_pvq_encode_helper(MACROBLOCK *x, tran_low_t *const coeff,
DECLARE_ALIGNED(16, int32_t, ref_int32[OD_TXSIZE_MAX * OD_TXSIZE_MAX]);
DECLARE_ALIGNED(16, int32_t, out_int32[OD_TXSIZE_MAX * OD_TXSIZE_MAX]);
-#if CONFIG_HIGHBITDEPTH
hbd_downshift = x->e_mbd.bd - 8;
-#endif
assert(OD_COEFF_SHIFT >= 4);
// DC quantizer for PVQ
@@ -1563,10 +2052,10 @@ PVQ_SKIP_TYPE av1_pvq_encode_helper(MACROBLOCK *x, tran_low_t *const coeff,
*eob = 0;
-#if CONFIG_DAALA_EC
+#if !CONFIG_ANS
tell = od_ec_enc_tell_frac(&daala_enc->w.ec);
#else
-#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
+#error "CONFIG_PVQ currently requires !CONFIG_ANS."
#endif
// Change coefficient ordering for pvq encoding.
@@ -1635,11 +2124,11 @@ PVQ_SKIP_TYPE av1_pvq_encode_helper(MACROBLOCK *x, tran_low_t *const coeff,
*eob = tx_blk_size * tx_blk_size;
-#if CONFIG_DAALA_EC
+#if !CONFIG_ANS
*rate = (od_ec_enc_tell_frac(&daala_enc->w.ec) - tell)
<< (AV1_PROB_COST_SHIFT - OD_BITRES);
#else
-#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
+#error "CONFIG_PVQ currently requires !CONFIG_ANS."
#endif
assert(*rate >= 0);
diff --git a/third_party/aom/av1/encoder/encodemb.h b/third_party/aom/av1/encoder/encodemb.h
index 73fde1d88..35a2c1570 100644
--- a/third_party/aom/av1/encoder/encodemb.h
+++ b/third_party/aom/av1/encoder/encodemb.h
@@ -54,7 +54,8 @@ void av1_xform_quant(const AV1_COMMON *cm, MACROBLOCK *x, int plane, int block,
TX_SIZE tx_size, int ctx, AV1_XFORM_QUANT xform_quant_idx);
int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
- TX_SIZE tx_size, int ctx);
+ BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
+ const ENTROPY_CONTEXT *a, const ENTROPY_CONTEXT *l);
void av1_subtract_txb(MACROBLOCK *x, int plane, BLOCK_SIZE plane_bsize,
int blk_col, int blk_row, TX_SIZE tx_size);
@@ -85,6 +86,23 @@ void av1_store_pvq_enc_info(PVQ_INFO *pvq_info, int *qg, int *theta, int *k,
int *size, int skip_rest, int skip_dir, int bs);
#endif
+#if CONFIG_CFL
+void av1_predict_intra_block_encoder_facade(MACROBLOCK *x,
+ FRAME_CONTEXT *ec_ctx, int plane,
+ int block_idx, int blk_col,
+ int blk_row, TX_SIZE tx_size,
+ BLOCK_SIZE plane_bsize);
+#endif
+
+#if CONFIG_DPCM_INTRA
+void av1_encode_block_intra_dpcm(const AV1_COMMON *cm, MACROBLOCK *x,
+ PREDICTION_MODE mode, int plane, int block,
+ int blk_row, int blk_col,
+ BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
+ TX_TYPE tx_type, ENTROPY_CONTEXT *ta,
+ ENTROPY_CONTEXT *tl, int8_t *skip);
+#endif // CONFIG_DPCM_INTRA
+
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/third_party/aom/av1/encoder/encodemv.c b/third_party/aom/av1/encoder/encodemv.c
index a2a53f840..eb0ff88c4 100644
--- a/third_party/aom/av1/encoder/encodemv.c
+++ b/third_party/aom/av1/encoder/encodemv.c
@@ -45,13 +45,8 @@ static void encode_mv_component(aom_writer *w, int comp, nmv_component *mvcomp,
// Sign
aom_write(w, sign, mvcomp->sign);
-// Class
-#if CONFIG_EC_MULTISYMBOL
+ // Class
aom_write_symbol(w, mv_class, mvcomp->class_cdf, MV_CLASSES);
-#else
- av1_write_token(w, av1_mv_class_tree, mvcomp->classes,
- &mv_class_encodings[mv_class]);
-#endif
// Integer bits
if (mv_class == MV_CLASS_0) {
@@ -62,16 +57,10 @@ static void encode_mv_component(aom_writer *w, int comp, nmv_component *mvcomp,
for (i = 0; i < n; ++i) aom_write(w, (d >> i) & 1, mvcomp->bits[i]);
}
-// Fractional bits
-#if CONFIG_EC_MULTISYMBOL
+ // Fractional bits
aom_write_symbol(
w, fr, mv_class == MV_CLASS_0 ? mvcomp->class0_fp_cdf[d] : mvcomp->fp_cdf,
MV_FP_SIZE);
-#else
- av1_write_token(w, av1_mv_fp_tree,
- mv_class == MV_CLASS_0 ? mvcomp->class0_fp[d] : mvcomp->fp,
- &mv_fp_encodings[fr]);
-#endif
// High precision bit
if (usehp)
@@ -171,7 +160,6 @@ static void write_mv_update(const aom_tree_index *tree,
void av1_write_nmv_probs(AV1_COMMON *cm, int usehp, aom_writer *w,
nmv_context_counts *const nmv_counts) {
int i;
-#if CONFIG_REF_MV
int nmv_ctx = 0;
for (nmv_ctx = 0; nmv_ctx < NMV_CONTEXTS; ++nmv_ctx) {
nmv_context *const mvc = &cm->fc->nmvc[nmv_ctx];
@@ -213,57 +201,13 @@ void av1_write_nmv_probs(AV1_COMMON *cm, int usehp, aom_writer *w,
}
}
}
-#else
- nmv_context *const mvc = &cm->fc->nmvc;
- nmv_context_counts *const counts = nmv_counts;
-
-#if !CONFIG_EC_ADAPT
- write_mv_update(av1_mv_joint_tree, mvc->joints, counts->joints, MV_JOINTS, w);
-
- for (i = 0; i < 2; ++i) {
- int j;
- nmv_component *comp = &mvc->comps[i];
- nmv_component_counts *comp_counts = &counts->comps[i];
-
- update_mv(w, comp_counts->sign, &comp->sign, MV_UPDATE_PROB);
- write_mv_update(av1_mv_class_tree, comp->classes, comp_counts->classes,
- MV_CLASSES, w);
- write_mv_update(av1_mv_class0_tree, comp->class0, comp_counts->class0,
- CLASS0_SIZE, w);
- for (j = 0; j < MV_OFFSET_BITS; ++j)
- update_mv(w, comp_counts->bits[j], &comp->bits[j], MV_UPDATE_PROB);
- }
-
- for (i = 0; i < 2; ++i) {
- int j;
- for (j = 0; j < CLASS0_SIZE; ++j) {
- write_mv_update(av1_mv_fp_tree, mvc->comps[i].class0_fp[j],
- counts->comps[i].class0_fp[j], MV_FP_SIZE, w);
- }
- write_mv_update(av1_mv_fp_tree, mvc->comps[i].fp, counts->comps[i].fp,
- MV_FP_SIZE, w);
- }
-#endif // !CONFIG_EC_ADAPT
-
- if (usehp) {
- for (i = 0; i < 2; ++i) {
- update_mv(w, counts->comps[i].class0_hp, &mvc->comps[i].class0_hp,
- MV_UPDATE_PROB);
- update_mv(w, counts->comps[i].hp, &mvc->comps[i].hp, MV_UPDATE_PROB);
- }
- }
-#endif
}
void av1_encode_mv(AV1_COMP *cpi, aom_writer *w, const MV *mv, const MV *ref,
nmv_context *mvctx, int usehp) {
const MV diff = { mv->row - ref->row, mv->col - ref->col };
const MV_JOINT_TYPE j = av1_get_mv_joint(&diff);
-#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, j, mvctx->joint_cdf, MV_JOINTS);
-#else
- av1_write_token(w, av1_mv_joint_tree, mvctx->joints, &mv_joint_encodings[j]);
-#endif
if (mv_joint_vertical(j))
encode_mv_component(w, diff.row, &mvctx->comps[0], usehp);
@@ -284,11 +228,7 @@ void av1_encode_dv(aom_writer *w, const MV *mv, const MV *ref,
const MV diff = { mv->row - ref->row, mv->col - ref->col };
const MV_JOINT_TYPE j = av1_get_mv_joint(&diff);
-#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, j, mvctx->joint_cdf, MV_JOINTS);
-#else
- av1_write_token(w, av1_mv_joint_tree, mvctx->joints, &mv_joint_encodings[j]);
-#endif
if (mv_joint_vertical(j))
encode_mv_component(w, diff.row, &mvctx->comps[0], 0);
@@ -306,135 +246,101 @@ void av1_build_nmv_cost_table(int *mvjoint, int *mvcost[2],
#if CONFIG_EXT_INTER
static void inc_mvs(const MB_MODE_INFO *mbmi, const MB_MODE_INFO_EXT *mbmi_ext,
- const int_mv mvs[2],
-#if CONFIG_REF_MV
- const int_mv pred_mvs[2],
-#endif
+ const int_mv mvs[2], const int_mv pred_mvs[2],
nmv_context_counts *nmv_counts) {
int i;
PREDICTION_MODE mode = mbmi->mode;
-#if !CONFIG_REF_MV
- nmv_context_counts *counts = nmv_counts;
-#endif
if (mode == NEWMV || mode == NEW_NEWMV) {
for (i = 0; i < 1 + has_second_ref(mbmi); ++i) {
const MV *ref = &mbmi_ext->ref_mvs[mbmi->ref_frame[i]][0].as_mv;
const MV diff = { mvs[i].as_mv.row - ref->row,
mvs[i].as_mv.col - ref->col };
-#if CONFIG_REF_MV
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx =
av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], i, mbmi->ref_mv_idx);
nmv_context_counts *counts = &nmv_counts[nmv_ctx];
(void)pred_mvs;
-#endif
av1_inc_mv(&diff, counts, 1);
}
} else if (mode == NEAREST_NEWMV || mode == NEAR_NEWMV) {
const MV *ref = &mbmi_ext->ref_mvs[mbmi->ref_frame[1]][0].as_mv;
const MV diff = { mvs[1].as_mv.row - ref->row,
mvs[1].as_mv.col - ref->col };
-#if CONFIG_REF_MV
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx =
av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], 1, mbmi->ref_mv_idx);
nmv_context_counts *counts = &nmv_counts[nmv_ctx];
-#endif
av1_inc_mv(&diff, counts, 1);
} else if (mode == NEW_NEARESTMV || mode == NEW_NEARMV) {
const MV *ref = &mbmi_ext->ref_mvs[mbmi->ref_frame[0]][0].as_mv;
const MV diff = { mvs[0].as_mv.row - ref->row,
mvs[0].as_mv.col - ref->col };
-#if CONFIG_REF_MV
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx =
av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], 0, mbmi->ref_mv_idx);
nmv_context_counts *counts = &nmv_counts[nmv_ctx];
-#endif
av1_inc_mv(&diff, counts, 1);
}
}
static void inc_mvs_sub8x8(const MODE_INFO *mi, int block, const int_mv mvs[2],
-#if CONFIG_REF_MV
const MB_MODE_INFO_EXT *mbmi_ext,
-#endif
nmv_context_counts *nmv_counts) {
int i;
PREDICTION_MODE mode = mi->bmi[block].as_mode;
-#if CONFIG_REF_MV
const MB_MODE_INFO *mbmi = &mi->mbmi;
-#else
- nmv_context_counts *counts = nmv_counts;
-#endif
if (mode == NEWMV || mode == NEW_NEWMV) {
for (i = 0; i < 1 + has_second_ref(&mi->mbmi); ++i) {
const MV *ref = &mi->bmi[block].ref_mv[i].as_mv;
const MV diff = { mvs[i].as_mv.row - ref->row,
mvs[i].as_mv.col - ref->col };
-#if CONFIG_REF_MV
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx =
av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], i, mbmi->ref_mv_idx);
nmv_context_counts *counts = &nmv_counts[nmv_ctx];
-#endif
av1_inc_mv(&diff, counts, 1);
}
} else if (mode == NEAREST_NEWMV || mode == NEAR_NEWMV) {
const MV *ref = &mi->bmi[block].ref_mv[1].as_mv;
const MV diff = { mvs[1].as_mv.row - ref->row,
mvs[1].as_mv.col - ref->col };
-#if CONFIG_REF_MV
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx =
av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], 1, mbmi->ref_mv_idx);
nmv_context_counts *counts = &nmv_counts[nmv_ctx];
-#endif
av1_inc_mv(&diff, counts, 1);
} else if (mode == NEW_NEARESTMV || mode == NEW_NEARMV) {
const MV *ref = &mi->bmi[block].ref_mv[0].as_mv;
const MV diff = { mvs[0].as_mv.row - ref->row,
mvs[0].as_mv.col - ref->col };
-#if CONFIG_REF_MV
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx =
av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], 0, mbmi->ref_mv_idx);
nmv_context_counts *counts = &nmv_counts[nmv_ctx];
-#endif
av1_inc_mv(&diff, counts, 1);
}
}
#else
static void inc_mvs(const MB_MODE_INFO *mbmi, const MB_MODE_INFO_EXT *mbmi_ext,
- const int_mv mvs[2],
-#if CONFIG_REF_MV
- const int_mv pred_mvs[2],
-#endif
+ const int_mv mvs[2], const int_mv pred_mvs[2],
nmv_context_counts *nmv_counts) {
int i;
-#if !CONFIG_REF_MV
- nmv_context_counts *counts = nmv_counts;
-#endif
for (i = 0; i < 1 + has_second_ref(mbmi); ++i) {
-#if CONFIG_REF_MV
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx =
av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], i, mbmi->ref_mv_idx);
nmv_context_counts *counts = &nmv_counts[nmv_ctx];
const MV *ref = &pred_mvs[i].as_mv;
-#else
- const MV *ref = &mbmi_ext->ref_mvs[mbmi->ref_frame[i]][0].as_mv;
-#endif
const MV diff = { mvs[i].as_mv.row - ref->row,
mvs[i].as_mv.col - ref->col };
av1_inc_mv(&diff, counts, 1);
@@ -464,20 +370,11 @@ void av1_update_mv_count(ThreadData *td) {
#if CONFIG_EXT_INTER
if (have_newmv_in_inter_mode(mi->bmi[i].as_mode))
- inc_mvs_sub8x8(mi, i, mi->bmi[i].as_mv,
-#if CONFIG_REF_MV
- mbmi_ext, td->counts->mv);
-#else
- &td->counts->mv);
-#endif
+ inc_mvs_sub8x8(mi, i, mi->bmi[i].as_mv, mbmi_ext, td->counts->mv);
#else
if (mi->bmi[i].as_mode == NEWMV)
- inc_mvs(mbmi, mbmi_ext, mi->bmi[i].as_mv,
-#if CONFIG_REF_MV
- mi->bmi[i].pred_mv, td->counts->mv);
-#else
- &td->counts->mv);
-#endif
+ inc_mvs(mbmi, mbmi_ext, mi->bmi[i].as_mv, mi->bmi[i].pred_mv,
+ td->counts->mv);
#endif // CONFIG_EXT_INTER
}
}
@@ -487,11 +384,6 @@ void av1_update_mv_count(ThreadData *td) {
#else
if (mbmi->mode == NEWMV)
#endif // CONFIG_EXT_INTER
- inc_mvs(mbmi, mbmi_ext, mbmi->mv,
-#if CONFIG_REF_MV
- mbmi->pred_mv, td->counts->mv);
-#else
- &td->counts->mv);
-#endif
+ inc_mvs(mbmi, mbmi_ext, mbmi->mv, mbmi->pred_mv, td->counts->mv);
}
}
diff --git a/third_party/aom/av1/encoder/encoder.c b/third_party/aom/av1/encoder/encoder.c
index 027109151..4782ce2b7 100644
--- a/third_party/aom/av1/encoder/encoder.c
+++ b/third_party/aom/av1/encoder/encoder.c
@@ -246,29 +246,17 @@ void av1_set_high_precision_mv(AV1_COMP *cpi, int allow_high_precision_mv) {
MACROBLOCK *const mb = &cpi->td.mb;
cpi->common.allow_high_precision_mv = allow_high_precision_mv;
-#if CONFIG_REF_MV
if (cpi->common.allow_high_precision_mv) {
int i;
for (i = 0; i < NMV_CONTEXTS; ++i) {
mb->mv_cost_stack[i] = mb->nmvcost_hp[i];
- mb->mvsadcost = mb->nmvsadcost_hp;
}
} else {
int i;
for (i = 0; i < NMV_CONTEXTS; ++i) {
mb->mv_cost_stack[i] = mb->nmvcost[i];
- mb->mvsadcost = mb->nmvsadcost;
}
}
-#else
- if (cpi->common.allow_high_precision_mv) {
- mb->mvcost = mb->nmvcost_hp;
- mb->mvsadcost = mb->nmvcost_hp;
- } else {
- mb->mvcost = mb->nmvcost;
- mb->mvsadcost = mb->nmvcost;
- }
-#endif
}
static BLOCK_SIZE select_sb_size(const AV1_COMP *const cpi) {
@@ -334,13 +322,14 @@ static void setup_frame(AV1_COMP *cpi) {
av1_zero(cpi->interp_filter_selected[0]);
}
#if CONFIG_EXT_REFS
-#if CONFIG_LOWDELAY_COMPOUND // No change to bitstream
+#if CONFIG_ONE_SIDED_COMPOUND // No change to bitstream
if (cpi->sf.recode_loop == DISALLOW_RECODE) {
cpi->refresh_bwd_ref_frame = cpi->refresh_last_frame;
cpi->rc.is_bipred_frame = 1;
}
#endif
#endif
+ cm->pre_fc = &cm->frame_contexts[cm->frame_context_idx];
cpi->vaq_refresh = 0;
@@ -464,6 +453,20 @@ static void dealloc_compressor_data(AV1_COMP *cpi) {
aom_free(cpi->active_map.map);
cpi->active_map.map = NULL;
+#if CONFIG_MOTION_VAR
+ aom_free(cpi->td.mb.above_pred_buf);
+ cpi->td.mb.above_pred_buf = NULL;
+
+ aom_free(cpi->td.mb.left_pred_buf);
+ cpi->td.mb.left_pred_buf = NULL;
+
+ aom_free(cpi->td.mb.wsrc_buf);
+ cpi->td.mb.wsrc_buf = NULL;
+
+ aom_free(cpi->td.mb.mask_buf);
+ cpi->td.mb.mask_buf = NULL;
+#endif
+
// Free up-sampled reference buffers.
for (i = 0; i < (REF_FRAMES + 1); i++)
aom_free_frame_buffer(&cpi->upsampled_ref_bufs[i].buf);
@@ -492,17 +495,12 @@ static void dealloc_compressor_data(AV1_COMP *cpi) {
cpi->tile_tok[0][0] = 0;
av1_free_pc_tree(&cpi->td);
- av1_free_var_tree(&cpi->td);
#if CONFIG_PALETTE
if (cpi->common.allow_screen_content_tools)
aom_free(cpi->td.mb.palette_buffer);
#endif // CONFIG_PALETTE
- if (cpi->source_diff_var != NULL) {
- aom_free(cpi->source_diff_var);
- cpi->source_diff_var = NULL;
- }
#if CONFIG_ANS
aom_buf_ans_free(&cpi->buf_ans);
#endif // CONFIG_ANS
@@ -511,26 +509,17 @@ static void dealloc_compressor_data(AV1_COMP *cpi) {
static void save_coding_context(AV1_COMP *cpi) {
CODING_CONTEXT *const cc = &cpi->coding_context;
AV1_COMMON *cm = &cpi->common;
-#if CONFIG_REF_MV
int i;
-#endif
-// Stores a snapshot of key state variables which can subsequently be
-// restored with a call to av1_restore_coding_context. These functions are
-// intended for use in a re-code loop in av1_compress_frame where the
-// quantizer value is adjusted between loop iterations.
-#if CONFIG_REF_MV
+ // Stores a snapshot of key state variables which can subsequently be
+ // restored with a call to av1_restore_coding_context. These functions are
+ // intended for use in a re-code loop in av1_compress_frame where the
+ // quantizer value is adjusted between loop iterations.
for (i = 0; i < NMV_CONTEXTS; ++i) {
av1_copy(cc->nmv_vec_cost[i], cpi->td.mb.nmv_vec_cost[i]);
av1_copy(cc->nmv_costs, cpi->nmv_costs);
av1_copy(cc->nmv_costs_hp, cpi->nmv_costs_hp);
}
-#else
- av1_copy(cc->nmvjointcost, cpi->td.mb.nmvjointcost);
-#endif
-
- av1_copy(cc->nmvcosts, cpi->nmvcosts);
- av1_copy(cc->nmvcosts_hp, cpi->nmvcosts_hp);
av1_copy(cc->last_ref_lf_deltas, cm->lf.last_ref_deltas);
av1_copy(cc->last_mode_lf_deltas, cm->lf.last_mode_deltas);
@@ -541,24 +530,15 @@ static void save_coding_context(AV1_COMP *cpi) {
static void restore_coding_context(AV1_COMP *cpi) {
CODING_CONTEXT *const cc = &cpi->coding_context;
AV1_COMMON *cm = &cpi->common;
-#if CONFIG_REF_MV
int i;
-#endif
-// Restore key state variables to the snapshot state stored in the
-// previous call to av1_save_coding_context.
-#if CONFIG_REF_MV
+ // Restore key state variables to the snapshot state stored in the
+ // previous call to av1_save_coding_context.
for (i = 0; i < NMV_CONTEXTS; ++i) {
av1_copy(cpi->td.mb.nmv_vec_cost[i], cc->nmv_vec_cost[i]);
av1_copy(cpi->nmv_costs, cc->nmv_costs);
av1_copy(cpi->nmv_costs_hp, cc->nmv_costs_hp);
}
-#else
- av1_copy(cpi->td.mb.nmvjointcost, cc->nmvjointcost);
-#endif
-
- av1_copy(cpi->nmvcosts, cc->nmvcosts);
- av1_copy(cpi->nmvcosts_hp, cc->nmvcosts_hp);
av1_copy(cm->lf.last_ref_deltas, cc->last_ref_lf_deltas);
av1_copy(cm->lf.last_mode_deltas, cc->last_mode_lf_deltas);
@@ -795,14 +775,12 @@ static void alloc_util_frame_buffers(AV1_COMP *cpi) {
"Failed to allocate scaled last source buffer");
}
-static int alloc_context_buffers_ext(AV1_COMP *cpi) {
+static void alloc_context_buffers_ext(AV1_COMP *cpi) {
AV1_COMMON *cm = &cpi->common;
int mi_size = cm->mi_cols * cm->mi_rows;
- cpi->mbmi_ext_base = aom_calloc(mi_size, sizeof(*cpi->mbmi_ext_base));
- if (!cpi->mbmi_ext_base) return 1;
-
- return 0;
+ CHECK_MEM_ERROR(cm, cpi->mbmi_ext_base,
+ aom_calloc(mi_size, sizeof(*cpi->mbmi_ext_base)));
}
void av1_alloc_compressor_data(AV1_COMP *cpi) {
@@ -902,7 +880,11 @@ static void set_tile_info(AV1_COMP *cpi) {
#if CONFIG_DEPENDENT_HORZTILES
cm->dependent_horz_tiles = cpi->oxcf.dependent_horz_tiles;
+#if CONFIG_EXT_TILE
+ if (cm->tile_rows <= 1) cm->dependent_horz_tiles = 0;
+#else
if (cm->log2_tile_rows == 0) cm->dependent_horz_tiles = 0;
+#endif
#if CONFIG_TILE_GROUPS
if (cpi->oxcf.mtu == 0) {
cm->num_tg = cpi->oxcf.num_tile_groups;
@@ -1194,48 +1176,53 @@ MAKE_BFP_SAD8_WRAPPER(aom_highbd_sad4x4x8)
MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad4x4x4d)
#if CONFIG_EXT_INTER
-#define HIGHBD_MBFP(BT, MSDF, MVF, MSVF) \
- cpi->fn_ptr[BT].msdf = MSDF; \
- cpi->fn_ptr[BT].mvf = MVF; \
- cpi->fn_ptr[BT].msvf = MSVF;
-
-#define MAKE_MBFP_SAD_WRAPPER(fnname) \
- static unsigned int fnname##_bits8( \
- const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, \
- int ref_stride, const uint8_t *m, int m_stride) { \
- return fnname(src_ptr, source_stride, ref_ptr, ref_stride, m, m_stride); \
- } \
- static unsigned int fnname##_bits10( \
- const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, \
- int ref_stride, const uint8_t *m, int m_stride) { \
- return fnname(src_ptr, source_stride, ref_ptr, ref_stride, m, m_stride) >> \
- 2; \
- } \
- static unsigned int fnname##_bits12( \
- const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, \
- int ref_stride, const uint8_t *m, int m_stride) { \
- return fnname(src_ptr, source_stride, ref_ptr, ref_stride, m, m_stride) >> \
- 4; \
+#define HIGHBD_MBFP(BT, MCSDF, MCSVF) \
+ cpi->fn_ptr[BT].msdf = MCSDF; \
+ cpi->fn_ptr[BT].msvf = MCSVF;
+
+#define MAKE_MBFP_COMPOUND_SAD_WRAPPER(fnname) \
+ static unsigned int fnname##_bits8( \
+ const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, \
+ int ref_stride, const uint8_t *second_pred_ptr, const uint8_t *m, \
+ int m_stride, int invert_mask) { \
+ return fnname(src_ptr, source_stride, ref_ptr, ref_stride, \
+ second_pred_ptr, m, m_stride, invert_mask); \
+ } \
+ static unsigned int fnname##_bits10( \
+ const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, \
+ int ref_stride, const uint8_t *second_pred_ptr, const uint8_t *m, \
+ int m_stride, int invert_mask) { \
+ return fnname(src_ptr, source_stride, ref_ptr, ref_stride, \
+ second_pred_ptr, m, m_stride, invert_mask) >> \
+ 2; \
+ } \
+ static unsigned int fnname##_bits12( \
+ const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, \
+ int ref_stride, const uint8_t *second_pred_ptr, const uint8_t *m, \
+ int m_stride, int invert_mask) { \
+ return fnname(src_ptr, source_stride, ref_ptr, ref_stride, \
+ second_pred_ptr, m, m_stride, invert_mask) >> \
+ 4; \
}
#if CONFIG_EXT_PARTITION
-MAKE_MBFP_SAD_WRAPPER(aom_highbd_masked_sad128x128)
-MAKE_MBFP_SAD_WRAPPER(aom_highbd_masked_sad128x64)
-MAKE_MBFP_SAD_WRAPPER(aom_highbd_masked_sad64x128)
+MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad128x128)
+MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad128x64)
+MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad64x128)
#endif // CONFIG_EXT_PARTITION
-MAKE_MBFP_SAD_WRAPPER(aom_highbd_masked_sad64x64)
-MAKE_MBFP_SAD_WRAPPER(aom_highbd_masked_sad64x32)
-MAKE_MBFP_SAD_WRAPPER(aom_highbd_masked_sad32x64)
-MAKE_MBFP_SAD_WRAPPER(aom_highbd_masked_sad32x32)
-MAKE_MBFP_SAD_WRAPPER(aom_highbd_masked_sad32x16)
-MAKE_MBFP_SAD_WRAPPER(aom_highbd_masked_sad16x32)
-MAKE_MBFP_SAD_WRAPPER(aom_highbd_masked_sad16x16)
-MAKE_MBFP_SAD_WRAPPER(aom_highbd_masked_sad16x8)
-MAKE_MBFP_SAD_WRAPPER(aom_highbd_masked_sad8x16)
-MAKE_MBFP_SAD_WRAPPER(aom_highbd_masked_sad8x8)
-MAKE_MBFP_SAD_WRAPPER(aom_highbd_masked_sad8x4)
-MAKE_MBFP_SAD_WRAPPER(aom_highbd_masked_sad4x8)
-MAKE_MBFP_SAD_WRAPPER(aom_highbd_masked_sad4x4)
+MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad64x64)
+MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad64x32)
+MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad32x64)
+MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad32x32)
+MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad32x16)
+MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad16x32)
+MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad16x16)
+MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad16x8)
+MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad8x16)
+MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad8x8)
+MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad8x4)
+MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad4x8)
+MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad4x4)
#endif // CONFIG_EXT_INTER
#if CONFIG_MOTION_VAR
@@ -1401,54 +1388,38 @@ static void highbd_set_var_fns(AV1_COMP *const cpi) {
#if CONFIG_EXT_INTER
#if CONFIG_EXT_PARTITION
HIGHBD_MBFP(BLOCK_128X128, aom_highbd_masked_sad128x128_bits8,
- aom_highbd_masked_variance128x128,
- aom_highbd_masked_sub_pixel_variance128x128)
+ aom_highbd_8_masked_sub_pixel_variance128x128)
HIGHBD_MBFP(BLOCK_128X64, aom_highbd_masked_sad128x64_bits8,
- aom_highbd_masked_variance128x64,
- aom_highbd_masked_sub_pixel_variance128x64)
+ aom_highbd_8_masked_sub_pixel_variance128x64)
HIGHBD_MBFP(BLOCK_64X128, aom_highbd_masked_sad64x128_bits8,
- aom_highbd_masked_variance64x128,
- aom_highbd_masked_sub_pixel_variance64x128)
+ aom_highbd_8_masked_sub_pixel_variance64x128)
#endif // CONFIG_EXT_PARTITION
HIGHBD_MBFP(BLOCK_64X64, aom_highbd_masked_sad64x64_bits8,
- aom_highbd_masked_variance64x64,
- aom_highbd_masked_sub_pixel_variance64x64)
+ aom_highbd_8_masked_sub_pixel_variance64x64)
HIGHBD_MBFP(BLOCK_64X32, aom_highbd_masked_sad64x32_bits8,
- aom_highbd_masked_variance64x32,
- aom_highbd_masked_sub_pixel_variance64x32)
+ aom_highbd_8_masked_sub_pixel_variance64x32)
HIGHBD_MBFP(BLOCK_32X64, aom_highbd_masked_sad32x64_bits8,
- aom_highbd_masked_variance32x64,
- aom_highbd_masked_sub_pixel_variance32x64)
+ aom_highbd_8_masked_sub_pixel_variance32x64)
HIGHBD_MBFP(BLOCK_32X32, aom_highbd_masked_sad32x32_bits8,
- aom_highbd_masked_variance32x32,
- aom_highbd_masked_sub_pixel_variance32x32)
+ aom_highbd_8_masked_sub_pixel_variance32x32)
HIGHBD_MBFP(BLOCK_32X16, aom_highbd_masked_sad32x16_bits8,
- aom_highbd_masked_variance32x16,
- aom_highbd_masked_sub_pixel_variance32x16)
+ aom_highbd_8_masked_sub_pixel_variance32x16)
HIGHBD_MBFP(BLOCK_16X32, aom_highbd_masked_sad16x32_bits8,
- aom_highbd_masked_variance16x32,
- aom_highbd_masked_sub_pixel_variance16x32)
+ aom_highbd_8_masked_sub_pixel_variance16x32)
HIGHBD_MBFP(BLOCK_16X16, aom_highbd_masked_sad16x16_bits8,
- aom_highbd_masked_variance16x16,
- aom_highbd_masked_sub_pixel_variance16x16)
+ aom_highbd_8_masked_sub_pixel_variance16x16)
HIGHBD_MBFP(BLOCK_8X16, aom_highbd_masked_sad8x16_bits8,
- aom_highbd_masked_variance8x16,
- aom_highbd_masked_sub_pixel_variance8x16)
+ aom_highbd_8_masked_sub_pixel_variance8x16)
HIGHBD_MBFP(BLOCK_16X8, aom_highbd_masked_sad16x8_bits8,
- aom_highbd_masked_variance16x8,
- aom_highbd_masked_sub_pixel_variance16x8)
+ aom_highbd_8_masked_sub_pixel_variance16x8)
HIGHBD_MBFP(BLOCK_8X8, aom_highbd_masked_sad8x8_bits8,
- aom_highbd_masked_variance8x8,
- aom_highbd_masked_sub_pixel_variance8x8)
+ aom_highbd_8_masked_sub_pixel_variance8x8)
HIGHBD_MBFP(BLOCK_4X8, aom_highbd_masked_sad4x8_bits8,
- aom_highbd_masked_variance4x8,
- aom_highbd_masked_sub_pixel_variance4x8)
+ aom_highbd_8_masked_sub_pixel_variance4x8)
HIGHBD_MBFP(BLOCK_8X4, aom_highbd_masked_sad8x4_bits8,
- aom_highbd_masked_variance8x4,
- aom_highbd_masked_sub_pixel_variance8x4)
+ aom_highbd_8_masked_sub_pixel_variance8x4)
HIGHBD_MBFP(BLOCK_4X4, aom_highbd_masked_sad4x4_bits8,
- aom_highbd_masked_variance4x4,
- aom_highbd_masked_sub_pixel_variance4x4)
+ aom_highbd_8_masked_sub_pixel_variance4x4)
#endif // CONFIG_EXT_INTER
#if CONFIG_MOTION_VAR
#if CONFIG_EXT_PARTITION
@@ -1624,53 +1595,37 @@ static void highbd_set_var_fns(AV1_COMP *const cpi) {
#if CONFIG_EXT_INTER
#if CONFIG_EXT_PARTITION
HIGHBD_MBFP(BLOCK_128X128, aom_highbd_masked_sad128x128_bits10,
- aom_highbd_10_masked_variance128x128,
aom_highbd_10_masked_sub_pixel_variance128x128)
HIGHBD_MBFP(BLOCK_128X64, aom_highbd_masked_sad128x64_bits10,
- aom_highbd_10_masked_variance128x64,
aom_highbd_10_masked_sub_pixel_variance128x64)
HIGHBD_MBFP(BLOCK_64X128, aom_highbd_masked_sad64x128_bits10,
- aom_highbd_10_masked_variance64x128,
aom_highbd_10_masked_sub_pixel_variance64x128)
#endif // CONFIG_EXT_PARTITION
HIGHBD_MBFP(BLOCK_64X64, aom_highbd_masked_sad64x64_bits10,
- aom_highbd_10_masked_variance64x64,
aom_highbd_10_masked_sub_pixel_variance64x64)
HIGHBD_MBFP(BLOCK_64X32, aom_highbd_masked_sad64x32_bits10,
- aom_highbd_10_masked_variance64x32,
aom_highbd_10_masked_sub_pixel_variance64x32)
HIGHBD_MBFP(BLOCK_32X64, aom_highbd_masked_sad32x64_bits10,
- aom_highbd_10_masked_variance32x64,
aom_highbd_10_masked_sub_pixel_variance32x64)
HIGHBD_MBFP(BLOCK_32X32, aom_highbd_masked_sad32x32_bits10,
- aom_highbd_10_masked_variance32x32,
aom_highbd_10_masked_sub_pixel_variance32x32)
HIGHBD_MBFP(BLOCK_32X16, aom_highbd_masked_sad32x16_bits10,
- aom_highbd_10_masked_variance32x16,
aom_highbd_10_masked_sub_pixel_variance32x16)
HIGHBD_MBFP(BLOCK_16X32, aom_highbd_masked_sad16x32_bits10,
- aom_highbd_10_masked_variance16x32,
aom_highbd_10_masked_sub_pixel_variance16x32)
HIGHBD_MBFP(BLOCK_16X16, aom_highbd_masked_sad16x16_bits10,
- aom_highbd_10_masked_variance16x16,
aom_highbd_10_masked_sub_pixel_variance16x16)
HIGHBD_MBFP(BLOCK_8X16, aom_highbd_masked_sad8x16_bits10,
- aom_highbd_10_masked_variance8x16,
aom_highbd_10_masked_sub_pixel_variance8x16)
HIGHBD_MBFP(BLOCK_16X8, aom_highbd_masked_sad16x8_bits10,
- aom_highbd_10_masked_variance16x8,
aom_highbd_10_masked_sub_pixel_variance16x8)
HIGHBD_MBFP(BLOCK_8X8, aom_highbd_masked_sad8x8_bits10,
- aom_highbd_10_masked_variance8x8,
aom_highbd_10_masked_sub_pixel_variance8x8)
HIGHBD_MBFP(BLOCK_4X8, aom_highbd_masked_sad4x8_bits10,
- aom_highbd_10_masked_variance4x8,
aom_highbd_10_masked_sub_pixel_variance4x8)
HIGHBD_MBFP(BLOCK_8X4, aom_highbd_masked_sad8x4_bits10,
- aom_highbd_10_masked_variance8x4,
aom_highbd_10_masked_sub_pixel_variance8x4)
HIGHBD_MBFP(BLOCK_4X4, aom_highbd_masked_sad4x4_bits10,
- aom_highbd_10_masked_variance4x4,
aom_highbd_10_masked_sub_pixel_variance4x4)
#endif // CONFIG_EXT_INTER
#if CONFIG_MOTION_VAR
@@ -1847,53 +1802,37 @@ static void highbd_set_var_fns(AV1_COMP *const cpi) {
#if CONFIG_EXT_INTER
#if CONFIG_EXT_PARTITION
HIGHBD_MBFP(BLOCK_128X128, aom_highbd_masked_sad128x128_bits12,
- aom_highbd_12_masked_variance128x128,
aom_highbd_12_masked_sub_pixel_variance128x128)
HIGHBD_MBFP(BLOCK_128X64, aom_highbd_masked_sad128x64_bits12,
- aom_highbd_12_masked_variance128x64,
aom_highbd_12_masked_sub_pixel_variance128x64)
HIGHBD_MBFP(BLOCK_64X128, aom_highbd_masked_sad64x128_bits12,
- aom_highbd_12_masked_variance64x128,
aom_highbd_12_masked_sub_pixel_variance64x128)
#endif // CONFIG_EXT_PARTITION
HIGHBD_MBFP(BLOCK_64X64, aom_highbd_masked_sad64x64_bits12,
- aom_highbd_12_masked_variance64x64,
aom_highbd_12_masked_sub_pixel_variance64x64)
HIGHBD_MBFP(BLOCK_64X32, aom_highbd_masked_sad64x32_bits12,
- aom_highbd_12_masked_variance64x32,
aom_highbd_12_masked_sub_pixel_variance64x32)
HIGHBD_MBFP(BLOCK_32X64, aom_highbd_masked_sad32x64_bits12,
- aom_highbd_12_masked_variance32x64,
aom_highbd_12_masked_sub_pixel_variance32x64)
HIGHBD_MBFP(BLOCK_32X32, aom_highbd_masked_sad32x32_bits12,
- aom_highbd_12_masked_variance32x32,
aom_highbd_12_masked_sub_pixel_variance32x32)
HIGHBD_MBFP(BLOCK_32X16, aom_highbd_masked_sad32x16_bits12,
- aom_highbd_12_masked_variance32x16,
aom_highbd_12_masked_sub_pixel_variance32x16)
HIGHBD_MBFP(BLOCK_16X32, aom_highbd_masked_sad16x32_bits12,
- aom_highbd_12_masked_variance16x32,
aom_highbd_12_masked_sub_pixel_variance16x32)
HIGHBD_MBFP(BLOCK_16X16, aom_highbd_masked_sad16x16_bits12,
- aom_highbd_12_masked_variance16x16,
aom_highbd_12_masked_sub_pixel_variance16x16)
HIGHBD_MBFP(BLOCK_8X16, aom_highbd_masked_sad8x16_bits12,
- aom_highbd_12_masked_variance8x16,
aom_highbd_12_masked_sub_pixel_variance8x16)
HIGHBD_MBFP(BLOCK_16X8, aom_highbd_masked_sad16x8_bits12,
- aom_highbd_12_masked_variance16x8,
aom_highbd_12_masked_sub_pixel_variance16x8)
HIGHBD_MBFP(BLOCK_8X8, aom_highbd_masked_sad8x8_bits12,
- aom_highbd_12_masked_variance8x8,
aom_highbd_12_masked_sub_pixel_variance8x8)
HIGHBD_MBFP(BLOCK_4X8, aom_highbd_masked_sad4x8_bits12,
- aom_highbd_12_masked_variance4x8,
aom_highbd_12_masked_sub_pixel_variance4x8)
HIGHBD_MBFP(BLOCK_8X4, aom_highbd_masked_sad8x4_bits12,
- aom_highbd_12_masked_variance8x4,
aom_highbd_12_masked_sub_pixel_variance8x4)
HIGHBD_MBFP(BLOCK_4X4, aom_highbd_masked_sad4x4_bits12,
- aom_highbd_12_masked_variance4x4,
aom_highbd_12_masked_sub_pixel_variance4x4)
#endif // CONFIG_EXT_INTER
@@ -1979,6 +1918,18 @@ static void realloc_segmentation_maps(AV1_COMP *cpi) {
aom_calloc(cm->mi_rows * cm->mi_cols, 1));
}
+#if CONFIG_EXT_INTER
+void set_compound_tools(AV1_COMMON *cm) {
+ (void)cm;
+#if CONFIG_INTERINTRA
+ cm->allow_interintra_compound = 1;
+#endif // CONFIG_INTERINTRA
+#if CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT
+ cm->allow_masked_compound = 1;
+#endif // CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT
+}
+#endif // CONFIG_EXT_INTER
+
void av1_change_config(struct AV1_COMP *cpi, const AV1EncoderConfig *oxcf) {
AV1_COMMON *const cm = &cpi->common;
RATE_CONTROL *const rc = &cpi->rc;
@@ -1994,9 +1945,7 @@ void av1_change_config(struct AV1_COMP *cpi, const AV1EncoderConfig *oxcf) {
assert(cm->bit_depth > AOM_BITS_8);
cpi->oxcf = *oxcf;
-#if CONFIG_HIGHBITDEPTH
cpi->td.mb.e_mbd.bd = (int)cm->bit_depth;
-#endif // CONFIG_HIGHBITDEPTH
#if CONFIG_GLOBAL_MOTION
cpi->td.mb.e_mbd.global_motion = cm->global_motion;
#endif // CONFIG_GLOBAL_MOTION
@@ -2033,7 +1982,9 @@ void av1_change_config(struct AV1_COMP *cpi, const AV1EncoderConfig *oxcf) {
av1_setup_pc_tree(&cpi->common, &cpi->td);
}
#endif // CONFIG_PALETTE
-
+#if CONFIG_EXT_INTER
+ set_compound_tools(cm);
+#endif // CONFIG_EXT_INTER
av1_reset_segment_features(cm);
av1_set_high_precision_mv(cpi, 0);
@@ -2107,50 +2058,6 @@ void av1_change_config(struct AV1_COMP *cpi, const AV1EncoderConfig *oxcf) {
#endif // CONFIG_ANS && ANS_MAX_SYMBOLS
}
-#ifndef M_LOG2_E
-#define M_LOG2_E 0.693147180559945309417
-#endif
-#define log2f(x) (log(x) / (float)M_LOG2_E)
-
-#if !CONFIG_REF_MV
-static void cal_nmvjointsadcost(int *mvjointsadcost) {
- mvjointsadcost[0] = 600;
- mvjointsadcost[1] = 300;
- mvjointsadcost[2] = 300;
- mvjointsadcost[3] = 300;
-}
-#endif
-
-static void cal_nmvsadcosts(int *mvsadcost[2]) {
- int i = 1;
-
- mvsadcost[0][0] = 0;
- mvsadcost[1][0] = 0;
-
- do {
- double z = 256 * (2 * (log2f(8 * i) + .6));
- mvsadcost[0][i] = (int)z;
- mvsadcost[1][i] = (int)z;
- mvsadcost[0][-i] = (int)z;
- mvsadcost[1][-i] = (int)z;
- } while (++i <= MV_MAX);
-}
-
-static void cal_nmvsadcosts_hp(int *mvsadcost[2]) {
- int i = 1;
-
- mvsadcost[0][0] = 0;
- mvsadcost[1][0] = 0;
-
- do {
- double z = 256 * (2 * (log2f(8 * i) + .6));
- mvsadcost[0][i] = (int)z;
- mvsadcost[1][i] = (int)z;
- mvsadcost[0][-i] = (int)z;
- mvsadcost[1][-i] = (int)z;
- } while (++i <= MV_MAX);
-}
-
static INLINE void init_upsampled_ref_frame_bufs(AV1_COMP *cpi) {
int i;
@@ -2192,6 +2099,11 @@ AV1_COMP *av1_create_compressor(AV1EncoderConfig *oxcf,
cpi->resize_state = 0;
cpi->resize_avg_qp = 0;
cpi->resize_buffer_underflow = 0;
+ cpi->resize_scale_num = 16;
+ cpi->resize_scale_den = 16;
+ cpi->resize_next_scale_num = 16;
+ cpi->resize_next_scale_den = 16;
+
cpi->common.buffer_pool = pool;
init_config(cpi, oxcf);
@@ -2223,17 +2135,10 @@ AV1_COMP *av1_create_compressor(AV1EncoderConfig *oxcf,
realloc_segmentation_maps(cpi);
-#if CONFIG_REF_MV
for (i = 0; i < NMV_CONTEXTS; ++i) {
memset(cpi->nmv_costs, 0, sizeof(cpi->nmv_costs));
memset(cpi->nmv_costs_hp, 0, sizeof(cpi->nmv_costs_hp));
}
-#endif
-
- memset(cpi->nmvcosts, 0, sizeof(cpi->nmvcosts));
- memset(cpi->nmvcosts_hp, 0, sizeof(cpi->nmvcosts_hp));
- memset(cpi->nmvsadcosts, 0, sizeof(cpi->nmvsadcosts));
- memset(cpi->nmvsadcosts_hp, 0, sizeof(cpi->nmvsadcosts_hp));
for (i = 0; i < (sizeof(cpi->mbgraph_stats) / sizeof(cpi->mbgraph_stats[0]));
i++) {
@@ -2296,27 +2201,12 @@ AV1_COMP *av1_create_compressor(AV1EncoderConfig *oxcf,
cpi->first_time_stamp_ever = INT64_MAX;
-#if CONFIG_REF_MV
for (i = 0; i < NMV_CONTEXTS; ++i) {
cpi->td.mb.nmvcost[i][0] = &cpi->nmv_costs[i][0][MV_MAX];
cpi->td.mb.nmvcost[i][1] = &cpi->nmv_costs[i][1][MV_MAX];
cpi->td.mb.nmvcost_hp[i][0] = &cpi->nmv_costs_hp[i][0][MV_MAX];
cpi->td.mb.nmvcost_hp[i][1] = &cpi->nmv_costs_hp[i][1][MV_MAX];
}
-#else
- cal_nmvjointsadcost(cpi->td.mb.nmvjointsadcost);
- cpi->td.mb.nmvcost[0] = &cpi->nmvcosts[0][MV_MAX];
- cpi->td.mb.nmvcost[1] = &cpi->nmvcosts[1][MV_MAX];
- cpi->td.mb.nmvcost_hp[0] = &cpi->nmvcosts_hp[0][MV_MAX];
- cpi->td.mb.nmvcost_hp[1] = &cpi->nmvcosts_hp[1][MV_MAX];
-#endif
- cpi->td.mb.nmvsadcost[0] = &cpi->nmvsadcosts[0][MV_MAX];
- cpi->td.mb.nmvsadcost[1] = &cpi->nmvsadcosts[1][MV_MAX];
- cal_nmvsadcosts(cpi->td.mb.nmvsadcost);
-
- cpi->td.mb.nmvsadcost_hp[0] = &cpi->nmvsadcosts_hp[0][MV_MAX];
- cpi->td.mb.nmvsadcost_hp[1] = &cpi->nmvsadcosts_hp[1][MV_MAX];
- cal_nmvsadcosts_hp(cpi->td.mb.nmvsadcost_hp);
#ifdef OUTPUT_YUV_SKINMAP
yuv_skinmap_file = fopen("skinmap.yuv", "ab");
@@ -2363,17 +2253,36 @@ AV1_COMP *av1_create_compressor(AV1EncoderConfig *oxcf,
}
#endif
+#if CONFIG_MOTION_VAR
+#if CONFIG_HIGHBITDEPTH
+ int buf_scaler = 2;
+#else
+ int buf_scaler = 1;
+#endif
+ CHECK_MEM_ERROR(
+ cm, cpi->td.mb.above_pred_buf,
+ (uint8_t *)aom_memalign(16, buf_scaler * MAX_MB_PLANE * MAX_SB_SQUARE *
+ sizeof(*cpi->td.mb.above_pred_buf)));
+ CHECK_MEM_ERROR(
+ cm, cpi->td.mb.left_pred_buf,
+ (uint8_t *)aom_memalign(16, buf_scaler * MAX_MB_PLANE * MAX_SB_SQUARE *
+ sizeof(*cpi->td.mb.left_pred_buf)));
+
+ CHECK_MEM_ERROR(cm, cpi->td.mb.wsrc_buf,
+ (int32_t *)aom_memalign(
+ 16, MAX_SB_SQUARE * sizeof(*cpi->td.mb.wsrc_buf)));
+
+ CHECK_MEM_ERROR(cm, cpi->td.mb.mask_buf,
+ (int32_t *)aom_memalign(
+ 16, MAX_SB_SQUARE * sizeof(*cpi->td.mb.mask_buf)));
+
+#endif
+
init_upsampled_ref_frame_bufs(cpi);
av1_set_speed_features_framesize_independent(cpi);
av1_set_speed_features_framesize_dependent(cpi);
- // Allocate memory to store variances for a frame.
- CHECK_MEM_ERROR(cm, cpi->source_diff_var,
- aom_calloc(cm->MBs, sizeof(*cpi->source_diff_var)));
- cpi->source_var_thresh = 0;
- cpi->frames_till_next_var_check = 0;
-
#define BFP(BT, SDF, SDAF, VF, SVF, SVAF, SDX3F, SDX8F, SDX4DF) \
cpi->fn_ptr[BT].sdf = SDF; \
cpi->fn_ptr[BT].sdaf = SDAF; \
@@ -2499,45 +2408,29 @@ AV1_COMP *av1_create_compressor(AV1EncoderConfig *oxcf,
#endif // CONFIG_MOTION_VAR
#if CONFIG_EXT_INTER
-#define MBFP(BT, MSDF, MVF, MSVF) \
- cpi->fn_ptr[BT].msdf = MSDF; \
- cpi->fn_ptr[BT].mvf = MVF; \
- cpi->fn_ptr[BT].msvf = MSVF;
+#define MBFP(BT, MCSDF, MCSVF) \
+ cpi->fn_ptr[BT].msdf = MCSDF; \
+ cpi->fn_ptr[BT].msvf = MCSVF;
#if CONFIG_EXT_PARTITION
- MBFP(BLOCK_128X128, aom_masked_sad128x128, aom_masked_variance128x128,
+ MBFP(BLOCK_128X128, aom_masked_sad128x128,
aom_masked_sub_pixel_variance128x128)
- MBFP(BLOCK_128X64, aom_masked_sad128x64, aom_masked_variance128x64,
- aom_masked_sub_pixel_variance128x64)
- MBFP(BLOCK_64X128, aom_masked_sad64x128, aom_masked_variance64x128,
- aom_masked_sub_pixel_variance64x128)
+ MBFP(BLOCK_128X64, aom_masked_sad128x64, aom_masked_sub_pixel_variance128x64)
+ MBFP(BLOCK_64X128, aom_masked_sad64x128, aom_masked_sub_pixel_variance64x128)
#endif // CONFIG_EXT_PARTITION
- MBFP(BLOCK_64X64, aom_masked_sad64x64, aom_masked_variance64x64,
- aom_masked_sub_pixel_variance64x64)
- MBFP(BLOCK_64X32, aom_masked_sad64x32, aom_masked_variance64x32,
- aom_masked_sub_pixel_variance64x32)
- MBFP(BLOCK_32X64, aom_masked_sad32x64, aom_masked_variance32x64,
- aom_masked_sub_pixel_variance32x64)
- MBFP(BLOCK_32X32, aom_masked_sad32x32, aom_masked_variance32x32,
- aom_masked_sub_pixel_variance32x32)
- MBFP(BLOCK_32X16, aom_masked_sad32x16, aom_masked_variance32x16,
- aom_masked_sub_pixel_variance32x16)
- MBFP(BLOCK_16X32, aom_masked_sad16x32, aom_masked_variance16x32,
- aom_masked_sub_pixel_variance16x32)
- MBFP(BLOCK_16X16, aom_masked_sad16x16, aom_masked_variance16x16,
- aom_masked_sub_pixel_variance16x16)
- MBFP(BLOCK_16X8, aom_masked_sad16x8, aom_masked_variance16x8,
- aom_masked_sub_pixel_variance16x8)
- MBFP(BLOCK_8X16, aom_masked_sad8x16, aom_masked_variance8x16,
- aom_masked_sub_pixel_variance8x16)
- MBFP(BLOCK_8X8, aom_masked_sad8x8, aom_masked_variance8x8,
- aom_masked_sub_pixel_variance8x8)
- MBFP(BLOCK_4X8, aom_masked_sad4x8, aom_masked_variance4x8,
- aom_masked_sub_pixel_variance4x8)
- MBFP(BLOCK_8X4, aom_masked_sad8x4, aom_masked_variance8x4,
- aom_masked_sub_pixel_variance8x4)
- MBFP(BLOCK_4X4, aom_masked_sad4x4, aom_masked_variance4x4,
- aom_masked_sub_pixel_variance4x4)
+ MBFP(BLOCK_64X64, aom_masked_sad64x64, aom_masked_sub_pixel_variance64x64)
+ MBFP(BLOCK_64X32, aom_masked_sad64x32, aom_masked_sub_pixel_variance64x32)
+ MBFP(BLOCK_32X64, aom_masked_sad32x64, aom_masked_sub_pixel_variance32x64)
+ MBFP(BLOCK_32X32, aom_masked_sad32x32, aom_masked_sub_pixel_variance32x32)
+ MBFP(BLOCK_32X16, aom_masked_sad32x16, aom_masked_sub_pixel_variance32x16)
+ MBFP(BLOCK_16X32, aom_masked_sad16x32, aom_masked_sub_pixel_variance16x32)
+ MBFP(BLOCK_16X16, aom_masked_sad16x16, aom_masked_sub_pixel_variance16x16)
+ MBFP(BLOCK_16X8, aom_masked_sad16x8, aom_masked_sub_pixel_variance16x8)
+ MBFP(BLOCK_8X16, aom_masked_sad8x16, aom_masked_sub_pixel_variance8x16)
+ MBFP(BLOCK_8X8, aom_masked_sad8x8, aom_masked_sub_pixel_variance8x8)
+ MBFP(BLOCK_4X8, aom_masked_sad4x8, aom_masked_sub_pixel_variance4x8)
+ MBFP(BLOCK_8X4, aom_masked_sad8x4, aom_masked_sub_pixel_variance8x4)
+ MBFP(BLOCK_4X4, aom_masked_sad4x4, aom_masked_sub_pixel_variance4x4)
#endif // CONFIG_EXT_INTER
#if CONFIG_HIGHBITDEPTH
@@ -2555,6 +2448,9 @@ AV1_COMP *av1_create_compressor(AV1EncoderConfig *oxcf,
#endif
av1_loop_filter_init(cm);
+#if CONFIG_FRAME_SUPERRES
+ cm->superres_scale_numerator = SUPERRES_SCALE_DENOMINATOR;
+#endif // CONFIG_FRAME_SUPERRES
#if CONFIG_LOOP_RESTORATION
av1_loop_restoration_precal();
#endif // CONFIG_LOOP_RESTORATION
@@ -2671,11 +2567,16 @@ void av1_remove_compressor(AV1_COMP *cpi) {
if (t < cpi->num_workers - 1) {
#if CONFIG_PALETTE
if (cpi->common.allow_screen_content_tools)
- aom_free(thread_data->td->mb.palette_buffer);
+ aom_free(thread_data->td->palette_buffer);
#endif // CONFIG_PALETTE
+#if CONFIG_MOTION_VAR
+ aom_free(thread_data->td->above_pred_buf);
+ aom_free(thread_data->td->left_pred_buf);
+ aom_free(thread_data->td->wsrc_buf);
+ aom_free(thread_data->td->mask_buf);
+#endif // CONFIG_MOTION_VAR
aom_free(thread_data->td->counts);
av1_free_pc_tree(thread_data->td);
- av1_free_var_tree(thread_data->td);
aom_free(thread_data->td);
}
}
@@ -2935,48 +2836,6 @@ void aom_write_one_yuv_frame(AV1_COMMON *cm, YV12_BUFFER_CONFIG *s) {
#endif // OUTPUT_YUV_REC
#if CONFIG_HIGHBITDEPTH
-static void scale_and_extend_frame_nonnormative(const YV12_BUFFER_CONFIG *src,
- YV12_BUFFER_CONFIG *dst,
- int bd) {
-#else
-static void scale_and_extend_frame_nonnormative(const YV12_BUFFER_CONFIG *src,
- YV12_BUFFER_CONFIG *dst) {
-#endif // CONFIG_HIGHBITDEPTH
- // TODO(dkovalev): replace YV12_BUFFER_CONFIG with aom_image_t
- int i;
- const uint8_t *const srcs[3] = { src->y_buffer, src->u_buffer,
- src->v_buffer };
- const int src_strides[3] = { src->y_stride, src->uv_stride, src->uv_stride };
- const int src_widths[3] = { src->y_crop_width, src->uv_crop_width,
- src->uv_crop_width };
- const int src_heights[3] = { src->y_crop_height, src->uv_crop_height,
- src->uv_crop_height };
- uint8_t *const dsts[3] = { dst->y_buffer, dst->u_buffer, dst->v_buffer };
- const int dst_strides[3] = { dst->y_stride, dst->uv_stride, dst->uv_stride };
- const int dst_widths[3] = { dst->y_crop_width, dst->uv_crop_width,
- dst->uv_crop_width };
- const int dst_heights[3] = { dst->y_crop_height, dst->uv_crop_height,
- dst->uv_crop_height };
-
- for (i = 0; i < MAX_MB_PLANE; ++i) {
-#if CONFIG_HIGHBITDEPTH
- if (src->flags & YV12_FLAG_HIGHBITDEPTH) {
- av1_highbd_resize_plane(srcs[i], src_heights[i], src_widths[i],
- src_strides[i], dsts[i], dst_heights[i],
- dst_widths[i], dst_strides[i], bd);
- } else {
- av1_resize_plane(srcs[i], src_heights[i], src_widths[i], src_strides[i],
- dsts[i], dst_heights[i], dst_widths[i], dst_strides[i]);
- }
-#else
- av1_resize_plane(srcs[i], src_heights[i], src_widths[i], src_strides[i],
- dsts[i], dst_heights[i], dst_widths[i], dst_strides[i]);
-#endif // CONFIG_HIGHBITDEPTH
- }
- aom_extend_frame_borders(dst);
-}
-
-#if CONFIG_HIGHBITDEPTH
static void scale_and_extend_frame(const YV12_BUFFER_CONFIG *src,
YV12_BUFFER_CONFIG *dst, int planes,
int bd) {
@@ -3041,22 +2900,6 @@ static void scale_and_extend_frame(const YV12_BUFFER_CONFIG *src,
aom_extend_frame_borders(dst);
}
-static int scale_down(AV1_COMP *cpi, int q) {
- RATE_CONTROL *const rc = &cpi->rc;
- GF_GROUP *const gf_group = &cpi->twopass.gf_group;
- int scale = 0;
- assert(frame_is_kf_gf_arf(cpi));
-
- if (rc->frame_size_selector == UNSCALED &&
- q >= rc->rf_level_maxq[gf_group->rf_level[gf_group->index]]) {
- const int max_size_thresh =
- (int)(rate_thresh_mult[SCALE_STEP1] *
- AOMMAX(rc->this_frame_target, rc->avg_frame_bandwidth));
- scale = rc->projected_frame_size > max_size_thresh ? 1 : 0;
- }
- return scale;
-}
-
#if CONFIG_GLOBAL_MOTION
#define GM_RECODE_LOOP_NUM4X4_FACTOR 192
static int recode_loop_test_global_motion(AV1_COMP *cpi) {
@@ -3070,11 +2913,8 @@ static int recode_loop_test_global_motion(AV1_COMP *cpi) {
cpi->gmparams_cost[i]) {
set_default_warp_params(&cm->global_motion[i]);
cpi->gmparams_cost[i] = 0;
-#if CONFIG_REF_MV
recode = 1;
-#else
recode |= (rdc->global_motion_used[i] > 0);
-#endif
}
}
return recode;
@@ -3093,13 +2933,6 @@ static int recode_loop_test(AV1_COMP *cpi, int high_limit, int low_limit, int q,
if ((rc->projected_frame_size >= rc->max_frame_bandwidth) ||
(cpi->sf.recode_loop == ALLOW_RECODE) ||
(frame_is_kfgfarf && (cpi->sf.recode_loop == ALLOW_RECODE_KFARFGF))) {
- if (frame_is_kfgfarf && (oxcf->resize_mode == RESIZE_DYNAMIC) &&
- scale_down(cpi, q)) {
- // Code this group at a lower resolution.
- cpi->resize_pending = 1;
- return 1;
- }
-
// TODO(agrange) high_limit could be greater than the scale-down threshold.
if ((rc->projected_frame_size > high_limit && q < maxq) ||
(rc->projected_frame_size < low_limit && q > minq)) {
@@ -3863,6 +3696,9 @@ static void set_size_independent_vars(AV1_COMP *cpi) {
av1_set_rd_speed_thresholds(cpi);
av1_set_rd_speed_thresholds_sub8x8(cpi);
cpi->common.interp_filter = cpi->sf.default_interp_filter;
+#if CONFIG_EXT_INTER
+ if (!frame_is_intra_only(&cpi->common)) set_compound_tools(&cpi->common);
+#endif // CONFIG_EXT_INTER
}
static void set_size_dependent_vars(AV1_COMP *cpi, int *q, int *bottom_index,
@@ -3916,43 +3752,52 @@ static void set_restoration_tilesize(int width, int height,
}
#endif // CONFIG_LOOP_RESTORATION
-static void set_frame_size(AV1_COMP *cpi) {
- int ref_frame;
+static void set_scaled_size(AV1_COMP *cpi) {
AV1_COMMON *const cm = &cpi->common;
AV1EncoderConfig *const oxcf = &cpi->oxcf;
- MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
- if (oxcf->pass == 2 && oxcf->rc_mode == AOM_VBR &&
- ((oxcf->resize_mode == RESIZE_FIXED && cm->current_video_frame == 0) ||
- (oxcf->resize_mode == RESIZE_DYNAMIC && cpi->resize_pending))) {
- av1_calculate_coded_size(cpi, &oxcf->scaled_frame_width,
- &oxcf->scaled_frame_height);
-
- // There has been a change in frame size.
- av1_set_size_literal(cpi, oxcf->scaled_frame_width,
- oxcf->scaled_frame_height);
+ // TODO(afergs): Replace with call to av1_resize_pending? Could replace
+ // scaled_size_set as well.
+ // TODO(afergs): Realistically, if resize_pending is true, then the other
+ // conditions must already be satisfied.
+ // Try this first:
+ // av1_resize_pending &&
+ // (DYNAMIC && (1 Pass CBR || 2 Pass VBR)
+ // STATIC && FIRST_FRAME)
+ // Really, av1_resize_pending should just reflect the above.
+ // TODO(afergs): Allow fixed resizing in AOM_CBR mode?
+ // 2 Pass VBR: Resize if fixed resize and first frame, or dynamic resize and
+ // a resize is pending.
+ // 1 Pass CBR: Resize if dynamic resize and resize pending.
+ if ((oxcf->pass == 2 && oxcf->rc_mode == AOM_VBR &&
+ ((oxcf->resize_mode == RESIZE_FIXED && cm->current_video_frame == 0) ||
+ (oxcf->resize_mode == RESIZE_DYNAMIC && av1_resize_pending(cpi)))) ||
+ (oxcf->pass == 0 && oxcf->rc_mode == AOM_CBR &&
+ oxcf->resize_mode == RESIZE_DYNAMIC && av1_resize_pending(cpi))) {
+ // TODO(afergs): This feels hacky... Should it just set? Should
+ // av1_set_next_scaled_size be a library function?
+ av1_calculate_next_scaled_size(cpi, &oxcf->scaled_frame_width,
+ &oxcf->scaled_frame_height);
}
+}
- if (oxcf->pass == 0 && oxcf->rc_mode == AOM_CBR &&
- oxcf->resize_mode == RESIZE_DYNAMIC) {
- if (cpi->resize_pending == 1) {
- oxcf->scaled_frame_width =
- (cm->width * cpi->resize_scale_num) / cpi->resize_scale_den;
- oxcf->scaled_frame_height =
- (cm->height * cpi->resize_scale_num) / cpi->resize_scale_den;
- } else if (cpi->resize_pending == -1) {
- // Go back up to original size.
- oxcf->scaled_frame_width = oxcf->width;
- oxcf->scaled_frame_height = oxcf->height;
- }
- if (cpi->resize_pending != 0) {
- // There has been a change in frame size.
- av1_set_size_literal(cpi, oxcf->scaled_frame_width,
- oxcf->scaled_frame_height);
+static void set_frame_size(AV1_COMP *cpi, int width, int height) {
+ int ref_frame;
+ AV1_COMMON *const cm = &cpi->common;
+ AV1EncoderConfig *const oxcf = &cpi->oxcf;
+ MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
- // TODO(agrange) Scale cpi->max_mv_magnitude if frame-size has changed.
- set_mv_search_params(cpi);
- }
+ if (width != cm->width || height != cm->height) {
+ // There has been a change in the encoded frame size
+ av1_set_size_literal(cpi, width, height);
+
+ // TODO(agrange) Scale cpi->max_mv_magnitude if frame-size has changed.
+ // TODO(afergs): Make condition just (pass == 0) or (rc_mode == CBR) -
+ // UNLESS CBR starts allowing FIXED resizing. Then the resize
+ // mode will need to get checked too.
+ if (oxcf->pass == 0 && oxcf->rc_mode == AOM_CBR &&
+ oxcf->resize_mode == RESIZE_DYNAMIC)
+ set_mv_search_params(cpi); // TODO(afergs): Needed? Caller calls after...
}
#if !CONFIG_XIPHRC
@@ -4012,10 +3857,33 @@ static void set_frame_size(AV1_COMP *cpi) {
ref_buf->buf = NULL;
}
}
+#if CONFIG_INTRABC
+#if CONFIG_HIGHBITDEPTH
+ av1_setup_scale_factors_for_frame(&xd->sf_identity, cm->width, cm->height,
+ cm->width, cm->height,
+ cm->use_highbitdepth);
+#else
+ av1_setup_scale_factors_for_frame(&xd->sf_identity, cm->width, cm->height,
+ cm->width, cm->height);
+#endif // CONFIG_HIGHBITDEPTH
+#endif // CONFIG_INTRABC
set_ref_ptrs(cm, xd, LAST_FRAME, LAST_FRAME);
}
+static void setup_frame_size(AV1_COMP *cpi) {
+ set_scaled_size(cpi);
+#if CONFIG_FRAME_SUPERRES
+ int encode_width;
+ int encode_height;
+ av1_calculate_superres_size(cpi, &encode_width, &encode_height);
+ set_frame_size(cpi, encode_width, encode_height);
+#else
+ set_frame_size(cpi, cpi->oxcf.scaled_frame_width,
+ cpi->oxcf.scaled_frame_height);
+#endif // CONFIG_FRAME_SUPERRES
+}
+
static void reset_use_upsampled_references(AV1_COMP *cpi) {
MV_REFERENCE_FRAME ref_frame;
@@ -4039,7 +3907,15 @@ static void encode_without_recode_loop(AV1_COMP *cpi) {
aom_clear_system_state();
- set_frame_size(cpi);
+#if CONFIG_FRAME_SUPERRES
+ // TODO(afergs): Figure out when is actually a good time to do superres
+ cm->superres_scale_numerator = SUPERRES_SCALE_DENOMINATOR;
+ // (uint8_t)(rand() % 9 + SUPERRES_SCALE_NUMERATOR_MIN);
+ cpi->superres_pending = cpi->oxcf.superres_enabled && 0;
+#endif // CONFIG_FRAME_SUPERRES
+
+ setup_frame_size(cpi);
+ av1_resize_step(cpi);
// For 1 pass CBR under dynamic resize mode: use faster scaling for source.
// Only for 2x2 scaling for now.
@@ -4075,19 +3951,9 @@ static void encode_without_recode_loop(AV1_COMP *cpi) {
reset_use_upsampled_references(cpi);
av1_set_quantizer(cm, q);
- av1_set_variance_partition_thresholds(cpi, q);
-
setup_frame(cpi);
-
-#if CONFIG_SUBFRAME_PROB_UPDATE
- cm->do_subframe_update = cm->tile_cols == 1 && cm->tile_rows == 1;
- av1_copy(cm->starting_coef_probs, cm->fc->coef_probs);
- av1_copy(cpi->subframe_stats.enc_starting_coef_probs, cm->fc->coef_probs);
- cm->coef_probs_update_idx = 0;
- av1_copy(cpi->subframe_stats.coef_probs_buf[0], cm->fc->coef_probs);
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
-
suppress_active_map(cpi);
+
// Variance adaptive and in frame q adjustment experiments are mutually
// exclusive.
if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
@@ -4102,6 +3968,11 @@ static void encode_without_recode_loop(AV1_COMP *cpi) {
// transform / motion compensation build reconstruction frame
av1_encode_frame(cpi);
+#if CONFIG_FRAME_SUPERRES
+ // TODO(afergs): Upscale the frame to show
+ cpi->superres_pending = 0;
+#endif // CONFIG_FRAME_SUPERRES
+
// Update some stats from cyclic refresh, and check if we should not update
// golden reference, for 1 pass CBR.
if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ && cm->frame_type != KEY_FRAME &&
@@ -4136,9 +4007,13 @@ static void encode_with_recode_loop(AV1_COMP *cpi, size_t *size,
do {
aom_clear_system_state();
- set_frame_size(cpi);
+ setup_frame_size(cpi);
- if (loop_count == 0 || cpi->resize_pending != 0) {
+#if CONFIG_FRAME_SUPERRES
+ if (loop_count == 0 || av1_resize_pending(cpi) || cpi->superres_pending) {
+#else
+ if (loop_count == 0 || av1_resize_pending(cpi)) {
+#endif // CONFIG_FRAME_SUPERRES
set_size_dependent_vars(cpi, &q, &bottom_index, &top_index);
// cpi->sf.use_upsampled_references can be different from frame to frame.
@@ -4159,8 +4034,8 @@ static void encode_with_recode_loop(AV1_COMP *cpi, size_t *size,
undershoot_seen = 0;
#endif
- // Reconfiguration for change in frame size has concluded.
- cpi->resize_pending = 0;
+ // Advance resize to next state now that updates are done
+ av1_resize_step(cpi);
q_low = bottom_index;
q_high = top_index;
@@ -4208,26 +4083,6 @@ static void encode_with_recode_loop(AV1_COMP *cpi, size_t *size,
}
#endif // CONFIG_Q_ADAPT_PROBS
-#if CONFIG_SUBFRAME_PROB_UPDATE
- cm->do_subframe_update = cm->tile_cols == 1 && cm->tile_rows == 1;
- if (loop_count == 0 || frame_is_intra_only(cm) ||
- cm->error_resilient_mode) {
- av1_copy(cm->starting_coef_probs, cm->fc->coef_probs);
- av1_copy(cpi->subframe_stats.enc_starting_coef_probs, cm->fc->coef_probs);
- } else {
- if (cm->do_subframe_update) {
- av1_copy(cm->fc->coef_probs,
- cpi->subframe_stats.enc_starting_coef_probs);
- av1_copy(cm->starting_coef_probs,
- cpi->subframe_stats.enc_starting_coef_probs);
- av1_zero(cpi->subframe_stats.coef_counts_buf);
- av1_zero(cpi->subframe_stats.eob_counts_buf);
- }
- }
- cm->coef_probs_update_idx = 0;
- av1_copy(cpi->subframe_stats.coef_probs_buf[0], cm->fc->coef_probs);
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
-
// Variance adaptive and in frame q adjustment experiments are mutually
// exclusive.
if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
@@ -4318,23 +4173,9 @@ static void encode_with_recode_loop(AV1_COMP *cpi, size_t *size,
int last_q = q;
#if !CONFIG_XIPHRC
int retries = 0;
-#endif
- if (cpi->resize_pending == 1) {
- // Change in frame size so go back around the recode loop.
- cpi->rc.frame_size_selector =
- SCALE_STEP1 - cpi->rc.frame_size_selector;
- cpi->rc.next_frame_size_selector = cpi->rc.frame_size_selector;
+ // TODO(afergs): Replace removed recode when av1_resize_pending is true
-#if CONFIG_INTERNAL_STATS
- ++cpi->tot_recode_hits;
-#endif
- ++loop_count;
- loop = 1;
- continue;
- }
-
-#if !CONFIG_XIPHRC
// Frame size out of permitted range:
// Update correction factor & compute new Q to try...
// Frame is too large
@@ -4438,7 +4279,7 @@ static int get_ref_frame_flags(const AV1_COMP *cpi) {
const int last3_is_last =
map[cpi->lst_fb_idxes[2]] == map[cpi->lst_fb_idxes[0]];
const int gld_is_last = map[cpi->gld_fb_idx] == map[cpi->lst_fb_idxes[0]];
-#if CONFIG_LOWDELAY_COMPOUND
+#if CONFIG_ONE_SIDED_COMPOUND
const int alt_is_last = map[cpi->alt_fb_idx] == map[cpi->lst_fb_idxes[0]];
const int last3_is_last2 =
map[cpi->lst_fb_idxes[2]] == map[cpi->lst_fb_idxes[1]];
@@ -4491,7 +4332,7 @@ static int get_ref_frame_flags(const AV1_COMP *cpi) {
if (gld_is_last2 || gld_is_last3) flags &= ~AOM_GOLD_FLAG;
-#if CONFIG_LOWDELAY_COMPOUND // Changes LL & HL bitstream
+#if CONFIG_ONE_SIDED_COMPOUND // Changes LL & HL bitstream
/* Allow biprediction between two identical frames (e.g. bwd_is_last = 1) */
if (bwd_is_alt && (flags & AOM_BWD_FLAG)) flags &= ~AOM_BWD_FLAG;
#else
@@ -4522,36 +4363,6 @@ static void set_ext_overrides(AV1_COMP *cpi) {
}
}
-YV12_BUFFER_CONFIG *av1_scale_if_required_fast(AV1_COMMON *cm,
- YV12_BUFFER_CONFIG *unscaled,
- YV12_BUFFER_CONFIG *scaled) {
- if (cm->mi_cols * MI_SIZE != unscaled->y_width ||
- cm->mi_rows * MI_SIZE != unscaled->y_height) {
- // For 2x2 scaling down.
- aom_scale_frame(unscaled, scaled, unscaled->y_buffer, 9, 2, 1, 2, 1, 0);
- aom_extend_frame_borders(scaled);
- return scaled;
- } else {
- return unscaled;
- }
-}
-
-YV12_BUFFER_CONFIG *av1_scale_if_required(AV1_COMMON *cm,
- YV12_BUFFER_CONFIG *unscaled,
- YV12_BUFFER_CONFIG *scaled) {
- if (cm->mi_cols * MI_SIZE != unscaled->y_width ||
- cm->mi_rows * MI_SIZE != unscaled->y_height) {
-#if CONFIG_HIGHBITDEPTH
- scale_and_extend_frame_nonnormative(unscaled, scaled, (int)cm->bit_depth);
-#else
- scale_and_extend_frame_nonnormative(unscaled, scaled);
-#endif // CONFIG_HIGHBITDEPTH
- return scaled;
- } else {
- return unscaled;
- }
-}
-
static void set_arf_sign_bias(AV1_COMP *cpi) {
AV1_COMMON *const cm = &cpi->common;
int arf_sign_bias;
@@ -5014,9 +4825,6 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
av1_accumulate_frame_counts(&aggregate_fc, &cm->counts);
#endif // CONFIG_ENTROPY_STATS
if (cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
-#if CONFIG_SUBFRAME_PROB_UPDATE
- cm->partial_prob_update = 0;
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
av1_adapt_coef_probs(cm);
av1_adapt_intra_frame_probs(cm);
#if CONFIG_EC_ADAPT
@@ -5767,7 +5575,8 @@ int av1_get_compressed_data(AV1_COMP *cpi, unsigned int *frame_flags,
#else
av1_rc_get_second_pass_params(cpi);
} else if (oxcf->pass == 1) {
- set_frame_size(cpi);
+ setup_frame_size(cpi);
+ av1_resize_step(cpi);
}
#endif
@@ -5900,8 +5709,7 @@ int av1_set_internal_size(AV1_COMP *cpi, AOM_SCALING horiz_mode,
return 0;
}
-int av1_set_size_literal(AV1_COMP *cpi, unsigned int width,
- unsigned int height) {
+int av1_set_size_literal(AV1_COMP *cpi, int width, int height) {
AV1_COMMON *cm = &cpi->common;
#if CONFIG_HIGHBITDEPTH
check_initial_width(cpi, cm->use_highbitdepth, 1, 1);
@@ -5909,21 +5717,20 @@ int av1_set_size_literal(AV1_COMP *cpi, unsigned int width,
check_initial_width(cpi, 1, 1);
#endif // CONFIG_HIGHBITDEPTH
- if (width) {
- cm->width = width;
- if (cm->width > cpi->initial_width) {
- cm->width = cpi->initial_width;
- printf("Warning: Desired width too large, changed to %d\n", cm->width);
- }
+ if (width <= 0 || height <= 0) return 1;
+
+ cm->width = width;
+ if (cm->width > cpi->initial_width) {
+ cm->width = cpi->initial_width;
+ printf("Warning: Desired width too large, changed to %d\n", cm->width);
}
- if (height) {
- cm->height = height;
- if (cm->height > cpi->initial_height) {
- cm->height = cpi->initial_height;
- printf("Warning: Desired height too large, changed to %d\n", cm->height);
- }
+ cm->height = height;
+ if (cm->height > cpi->initial_height) {
+ cm->height = cpi->initial_height;
+ printf("Warning: Desired height too large, changed to %d\n", cm->height);
}
+
assert(cm->width <= cpi->initial_width);
assert(cm->height <= cpi->initial_height);
diff --git a/third_party/aom/av1/encoder/encoder.h b/third_party/aom/av1/encoder/encoder.h
index 4e7aef8fc..ee1257c2d 100644
--- a/third_party/aom/av1/encoder/encoder.h
+++ b/third_party/aom/av1/encoder/encoder.h
@@ -37,7 +37,6 @@
#include "av1/encoder/rd.h"
#include "av1/encoder/speed_features.h"
#include "av1/encoder/tokenize.h"
-#include "av1/encoder/variance_tree.h"
#if CONFIG_XIPHRC
#include "av1/encoder/ratectrl_xiph.h"
#endif
@@ -54,15 +53,9 @@ extern "C" {
#endif
typedef struct {
- int nmvjointcost[MV_JOINTS];
- int nmvcosts[2][MV_VALS];
- int nmvcosts_hp[2][MV_VALS];
-
-#if CONFIG_REF_MV
int nmv_vec_cost[NMV_CONTEXTS][MV_JOINTS];
int nmv_costs[NMV_CONTEXTS][2][MV_VALS];
int nmv_costs_hp[NMV_CONTEXTS][2][MV_VALS];
-#endif
// 0 = Intra, Last, GF, ARF
signed char last_ref_lf_deltas[TOTAL_REFS_PER_FRAME];
@@ -210,6 +203,11 @@ typedef struct AV1EncoderConfig {
int scaled_frame_width;
int scaled_frame_height;
+#if CONFIG_FRAME_SUPERRES
+ // Frame Super-Resolution size scaling
+ int superres_enabled;
+#endif // CONFIG_FRAME_SUPERRES
+
// Enable feature to reduce the frame quantization every x frames.
int frame_periodic_boost;
@@ -323,9 +321,16 @@ typedef struct ThreadData {
PICK_MODE_CONTEXT *leaf_tree;
PC_TREE *pc_tree;
PC_TREE *pc_root[MAX_MIB_SIZE_LOG2 - MIN_MIB_SIZE_LOG2 + 1];
+#if CONFIG_MOTION_VAR
+ int32_t *wsrc_buf;
+ int32_t *mask_buf;
+ uint8_t *above_pred_buf;
+ uint8_t *left_pred_buf;
+#endif
- VAR_TREE *var_tree;
- VAR_TREE *var_root[MAX_MIB_SIZE_LOG2 - MIN_MIB_SIZE_LOG2 + 1];
+#if CONFIG_PALETTE
+ PALETTE_BUFFER *palette_buffer;
+#endif // CONFIG_PALETTE
} ThreadData;
struct EncWorkerData;
@@ -350,16 +355,6 @@ typedef struct {
YV12_BUFFER_CONFIG buf;
} EncRefCntBuffer;
-#if CONFIG_SUBFRAME_PROB_UPDATE
-typedef struct SUBFRAME_STATS {
- av1_coeff_probs_model coef_probs_buf[COEF_PROBS_BUFS][TX_SIZES][PLANE_TYPES];
- av1_coeff_count coef_counts_buf[COEF_PROBS_BUFS][TX_SIZES][PLANE_TYPES];
- unsigned int eob_counts_buf[COEF_PROBS_BUFS][TX_SIZES][PLANE_TYPES][REF_TYPES]
- [COEF_BANDS][COEFF_CONTEXTS];
- av1_coeff_probs_model enc_starting_coef_probs[TX_SIZES][PLANE_TYPES];
-} SUBFRAME_STATS;
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
-
typedef struct TileBufferEnc {
uint8_t *data;
size_t size;
@@ -369,14 +364,7 @@ typedef struct AV1_COMP {
QUANTS quants;
ThreadData td;
MB_MODE_INFO_EXT *mbmi_ext_base;
- DECLARE_ALIGNED(16, int16_t, y_dequant[QINDEX_RANGE][8]); // 8: SIMD width
- DECLARE_ALIGNED(16, int16_t, uv_dequant[QINDEX_RANGE][8]); // 8: SIMD width
-#if CONFIG_NEW_QUANT
- DECLARE_ALIGNED(16, dequant_val_type_nuq,
- y_dequant_val_nuq[QUANT_PROFILES][QINDEX_RANGE][COEF_BANDS]);
- DECLARE_ALIGNED(16, dequant_val_type_nuq,
- uv_dequant_val_nuq[QUANT_PROFILES][QINDEX_RANGE][COEF_BANDS]);
-#endif // CONFIG_NEW_QUANT
+ Dequants dequants;
AV1_COMMON common;
AV1EncoderConfig oxcf;
struct lookahead_ctx *lookahead;
@@ -443,15 +431,8 @@ typedef struct AV1_COMP {
CODING_CONTEXT coding_context;
-#if CONFIG_REF_MV
int nmv_costs[NMV_CONTEXTS][2][MV_VALS];
int nmv_costs_hp[NMV_CONTEXTS][2][MV_VALS];
-#endif
-
- int nmvcosts[2][MV_VALS];
- int nmvcosts_hp[2][MV_VALS];
- int nmvsadcosts[2][MV_VALS];
- int nmvsadcosts_hp[2][MV_VALS];
int64_t last_time_stamp_seen;
int64_t last_end_time_stamp_seen;
@@ -543,29 +524,23 @@ typedef struct AV1_COMP {
// number of MBs in the current frame when the frame is
// scaled.
- // Store frame variance info in SOURCE_VAR_BASED_PARTITION search type.
- DIFF *source_diff_var;
- // The threshold used in SOURCE_VAR_BASED_PARTITION search type.
- unsigned int source_var_thresh;
- int frames_till_next_var_check;
-
int frame_flags;
search_site_config ss_cfg;
int mbmode_cost[BLOCK_SIZE_GROUPS][INTRA_MODES];
-#if CONFIG_REF_MV
int newmv_mode_cost[NEWMV_MODE_CONTEXTS][2];
int zeromv_mode_cost[ZEROMV_MODE_CONTEXTS][2];
int refmv_mode_cost[REFMV_MODE_CONTEXTS][2];
int drl_mode_cost0[DRL_MODE_CONTEXTS][2];
-#endif
unsigned int inter_mode_cost[INTER_MODE_CONTEXTS][INTER_MODES];
#if CONFIG_EXT_INTER
unsigned int inter_compound_mode_cost[INTER_MODE_CONTEXTS]
[INTER_COMPOUND_MODES];
+#if CONFIG_INTERINTRA
unsigned int interintra_mode_cost[BLOCK_SIZE_GROUPS][INTERINTRA_MODES];
+#endif // CONFIG_INTERINTRA
#endif // CONFIG_EXT_INTER
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
int motion_mode_cost[BLOCK_SIZES][MOTION_MODES];
@@ -625,24 +600,18 @@ typedef struct AV1_COMP {
TileBufferEnc tile_buffers[MAX_TILE_ROWS][MAX_TILE_COLS];
- int resize_pending;
int resize_state;
int resize_scale_num;
int resize_scale_den;
+ int resize_next_scale_num;
+ int resize_next_scale_den;
int resize_avg_qp;
int resize_buffer_underflow;
int resize_count;
- // VAR_BASED_PARTITION thresholds
- // 0 - threshold_128x128;
- // 1 - threshold_64x64;
- // 2 - threshold_32x32;
- // 3 - threshold_16x16;
- // 4 - threshold_8x8;
- int64_t vbp_thresholds[5];
- int64_t vbp_threshold_minmax;
- int64_t vbp_threshold_sad;
- BLOCK_SIZE vbp_bsize_min;
+#if CONFIG_FRAME_SUPERRES
+ int superres_pending;
+#endif // CONFIG_FRAME_SUPERRES
// VARIANCE_AQ segment map refresh
int vaq_refresh;
@@ -652,12 +621,6 @@ typedef struct AV1_COMP {
AVxWorker *workers;
struct EncWorkerData *tile_thr_data;
AV1LfSync lf_row_sync;
-#if CONFIG_SUBFRAME_PROB_UPDATE
- SUBFRAME_STATS subframe_stats;
- // TODO(yaowu): minimize the size of count buffers
- SUBFRAME_STATS wholeframe_stats;
- av1_coeff_stats branch_ct_buf[COEF_PROBS_BUFS][TX_SIZES][PLANE_TYPES];
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
#if CONFIG_ANS
struct BufAnsCoder buf_ans;
#endif
@@ -720,8 +683,8 @@ int av1_get_active_map(AV1_COMP *cpi, unsigned char *map, int rows, int cols);
int av1_set_internal_size(AV1_COMP *cpi, AOM_SCALING horiz_mode,
AOM_SCALING vert_mode);
-int av1_set_size_literal(AV1_COMP *cpi, unsigned int width,
- unsigned int height);
+// Returns 1 if the assigned width or height was <= 0.
+int av1_set_size_literal(AV1_COMP *cpi, int width, int height);
int av1_get_quantizer(struct AV1_COMP *cpi);
@@ -774,7 +737,7 @@ static INLINE const YV12_BUFFER_CONFIG *get_upsampled_ref(
return &cpi->upsampled_ref_bufs[buf_idx].buf;
}
-#if CONFIG_EXT_REFS
+#if CONFIG_EXT_REFS || CONFIG_TEMPMV_SIGNALING
static INLINE int enc_is_ref_frame_buf(AV1_COMP *cpi, RefCntBuffer *frame_buf) {
MV_REFERENCE_FRAME ref_frame;
AV1_COMMON *const cm = &cpi->common;
@@ -819,14 +782,6 @@ void av1_set_high_precision_mv(AV1_COMP *cpi, int allow_high_precision_mv);
void av1_set_temporal_mv_prediction(AV1_COMP *cpi, int allow_tempmv_prediction);
#endif
-YV12_BUFFER_CONFIG *av1_scale_if_required_fast(AV1_COMMON *cm,
- YV12_BUFFER_CONFIG *unscaled,
- YV12_BUFFER_CONFIG *scaled);
-
-YV12_BUFFER_CONFIG *av1_scale_if_required(AV1_COMMON *cm,
- YV12_BUFFER_CONFIG *unscaled,
- YV12_BUFFER_CONFIG *scaled);
-
void av1_apply_encoding_flags(AV1_COMP *cpi, aom_enc_frame_flags_t flags);
static INLINE int is_altref_enabled(const AV1_COMP *const cpi) {
@@ -876,6 +831,25 @@ static INLINE void uref_cnt_fb(EncRefCntBuffer *ubufs, int *uidx,
ubufs[new_uidx].ref_count++;
}
+// Returns 1 if a resize is pending and 0 otherwise.
+static INLINE int av1_resize_pending(const struct AV1_COMP *cpi) {
+ return cpi->resize_scale_num != cpi->resize_next_scale_num ||
+ cpi->resize_scale_den != cpi->resize_next_scale_den;
+}
+
+// Returns 1 if a frame is unscaled and 0 otherwise.
+static INLINE int av1_resize_unscaled(const struct AV1_COMP *cpi) {
+ return cpi->resize_scale_num == cpi->resize_scale_den;
+}
+
+// Moves resizing to the next state. This is just setting the numerator and
+// denominator to the next numerator and denominator, causing
+// av1_resize_pending to subsequently return false.
+static INLINE void av1_resize_step(struct AV1_COMP *cpi) {
+ cpi->resize_scale_num = cpi->resize_next_scale_num;
+ cpi->resize_scale_den = cpi->resize_next_scale_den;
+}
+
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/third_party/aom/av1/encoder/encodetxb.c b/third_party/aom/av1/encoder/encodetxb.c
index 3f71a4472..731642064 100644
--- a/third_party/aom/av1/encoder/encodetxb.c
+++ b/third_party/aom/av1/encoder/encodetxb.c
@@ -21,6 +21,8 @@
#include "av1/encoder/subexp.h"
#include "av1/encoder/tokenize.h"
+#define TEST_OPTIMIZE_TXB 0
+
void av1_alloc_txb_buf(AV1_COMP *cpi) {
#if 0
AV1_COMMON *cm = &cpi->common;
@@ -159,7 +161,7 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
}
// level is above 1.
- ctx = get_level_ctx(tcoeff, scan[c], bwl);
+ ctx = get_br_ctx(tcoeff, scan[c], bwl);
for (idx = 0; idx < COEFF_BASE_RANGE; ++idx) {
if (level == (idx + 1 + NUM_BASE_LEVELS)) {
aom_write(w, 1, cm->fc->coeff_lps[tx_size][plane_type][ctx]);
@@ -251,6 +253,32 @@ static INLINE void get_base_ctx_set(const tran_low_t *tcoeffs,
return;
}
+static INLINE int get_br_cost(tran_low_t abs_qc, int ctx,
+ const aom_prob *coeff_lps) {
+ const tran_low_t min_level = 1 + NUM_BASE_LEVELS;
+ const tran_low_t max_level = 1 + NUM_BASE_LEVELS + COEFF_BASE_RANGE;
+ if (abs_qc >= min_level) {
+ const int cost0 = av1_cost_bit(coeff_lps[ctx], 0);
+ const int cost1 = av1_cost_bit(coeff_lps[ctx], 1);
+ if (abs_qc >= max_level)
+ return COEFF_BASE_RANGE * cost0;
+ else
+ return (abs_qc - min_level) * cost0 + cost1;
+ } else {
+ return 0;
+ }
+}
+
+static INLINE int get_base_cost(tran_low_t abs_qc, int ctx,
+ aom_prob (*coeff_base)[COEFF_BASE_CONTEXTS],
+ int base_idx) {
+ const int level = base_idx + 1;
+ if (abs_qc < level)
+ return 0;
+ else
+ return av1_cost_bit(coeff_base[base_idx][ctx], abs_qc == level);
+}
+
int av1_cost_coeffs_txb(const AV1_COMP *const cpi, MACROBLOCK *x, int plane,
int block, TXB_CTX *txb_ctx) {
const AV1_COMMON *const cm = &cpi->common;
@@ -331,7 +359,7 @@ int av1_cost_coeffs_txb(const AV1_COMP *const cpi, MACROBLOCK *x, int plane,
int idx;
int ctx;
- ctx = get_level_ctx(qcoeff, scan[c], bwl);
+ ctx = get_br_ctx(qcoeff, scan[c], bwl);
for (idx = 0; idx < COEFF_BASE_RANGE; ++idx) {
if (level == (idx + 1 + NUM_BASE_LEVELS)) {
@@ -373,12 +401,1085 @@ int av1_cost_coeffs_txb(const AV1_COMP *const cpi, MACROBLOCK *x, int plane,
return cost;
}
-typedef struct TxbParams {
- const AV1_COMP *cpi;
- ThreadData *td;
- int rate;
-} TxbParams;
+static INLINE int has_base(tran_low_t qc, int base_idx) {
+ const int level = base_idx + 1;
+ return abs(qc) >= level;
+}
+
+static void gen_base_count_mag_arr(int (*base_count_arr)[MAX_TX_SQUARE],
+ int (*base_mag_arr)[2],
+ const tran_low_t *qcoeff, int stride,
+ int eob, const int16_t *scan) {
+ for (int c = 0; c < eob; ++c) {
+ const int coeff_idx = scan[c]; // raster order
+ if (!has_base(qcoeff[coeff_idx], 0)) continue;
+ const int row = coeff_idx / stride;
+ const int col = coeff_idx % stride;
+ int *mag = base_mag_arr[coeff_idx];
+ get_mag(mag, qcoeff, stride, row, col, base_ref_offset,
+ BASE_CONTEXT_POSITION_NUM);
+ for (int i = 0; i < NUM_BASE_LEVELS; ++i) {
+ if (!has_base(qcoeff[coeff_idx], i)) continue;
+ int *count = base_count_arr[i] + coeff_idx;
+ *count = get_level_count(qcoeff, stride, row, col, i, base_ref_offset,
+ BASE_CONTEXT_POSITION_NUM);
+ }
+ }
+}
+
+static void gen_nz_count_arr(int(*nz_count_arr), const tran_low_t *qcoeff,
+ int stride, int eob,
+ const SCAN_ORDER *scan_order) {
+ const int16_t *scan = scan_order->scan;
+ const int16_t *iscan = scan_order->iscan;
+ for (int c = 0; c < eob; ++c) {
+ const int coeff_idx = scan[c]; // raster order
+ const int row = coeff_idx / stride;
+ const int col = coeff_idx % stride;
+ nz_count_arr[coeff_idx] = get_nz_count(qcoeff, stride, row, col, iscan);
+ }
+}
+
+static void gen_nz_ctx_arr(int (*nz_ctx_arr)[2], int(*nz_count_arr),
+ const tran_low_t *qcoeff, int bwl, int eob,
+ const SCAN_ORDER *scan_order) {
+ const int16_t *scan = scan_order->scan;
+ const int16_t *iscan = scan_order->iscan;
+ for (int c = 0; c < eob; ++c) {
+ const int coeff_idx = scan[c]; // raster order
+ const int count = nz_count_arr[coeff_idx];
+ nz_ctx_arr[coeff_idx][0] =
+ get_nz_map_ctx_from_count(count, qcoeff, coeff_idx, bwl, iscan);
+ }
+}
+
+static void gen_base_ctx_arr(int (*base_ctx_arr)[MAX_TX_SQUARE][2],
+ int (*base_count_arr)[MAX_TX_SQUARE],
+ int (*base_mag_arr)[2], const tran_low_t *qcoeff,
+ int stride, int eob, const int16_t *scan) {
+ (void)qcoeff;
+ for (int i = 0; i < NUM_BASE_LEVELS; ++i) {
+ for (int c = 0; c < eob; ++c) {
+ const int coeff_idx = scan[c]; // raster order
+ if (!has_base(qcoeff[coeff_idx], i)) continue;
+ const int row = coeff_idx / stride;
+ const int col = coeff_idx % stride;
+ const int count = base_count_arr[i][coeff_idx];
+ const int *mag = base_mag_arr[coeff_idx];
+ const int level = i + 1;
+ base_ctx_arr[i][coeff_idx][0] =
+ get_base_ctx_from_count_mag(row, col, count, mag[0], level);
+ }
+ }
+}
+
+static INLINE int has_br(tran_low_t qc) {
+ return abs(qc) >= 1 + NUM_BASE_LEVELS;
+}
+
+static void gen_br_count_mag_arr(int *br_count_arr, int (*br_mag_arr)[2],
+ const tran_low_t *qcoeff, int stride, int eob,
+ const int16_t *scan) {
+ for (int c = 0; c < eob; ++c) {
+ const int coeff_idx = scan[c]; // raster order
+ if (!has_br(qcoeff[coeff_idx])) continue;
+ const int row = coeff_idx / stride;
+ const int col = coeff_idx % stride;
+ int *count = br_count_arr + coeff_idx;
+ int *mag = br_mag_arr[coeff_idx];
+ *count = get_level_count(qcoeff, stride, row, col, NUM_BASE_LEVELS,
+ br_ref_offset, BR_CONTEXT_POSITION_NUM);
+ get_mag(mag, qcoeff, stride, row, col, br_ref_offset,
+ BR_CONTEXT_POSITION_NUM);
+ }
+}
+
+static void gen_br_ctx_arr(int (*br_ctx_arr)[2], const int *br_count_arr,
+ int (*br_mag_arr)[2], const tran_low_t *qcoeff,
+ int stride, int eob, const int16_t *scan) {
+ (void)qcoeff;
+ for (int c = 0; c < eob; ++c) {
+ const int coeff_idx = scan[c]; // raster order
+ if (!has_br(qcoeff[coeff_idx])) continue;
+ const int row = coeff_idx / stride;
+ const int col = coeff_idx % stride;
+ const int count = br_count_arr[coeff_idx];
+ const int *mag = br_mag_arr[coeff_idx];
+ br_ctx_arr[coeff_idx][0] =
+ get_br_ctx_from_count_mag(row, col, count, mag[0]);
+ }
+}
+
+static INLINE int get_sign_bit_cost(tran_low_t qc, int coeff_idx,
+ const aom_prob *dc_sign_prob,
+ int dc_sign_ctx) {
+ const int sign = (qc < 0) ? 1 : 0;
+ // sign bit cost
+ if (coeff_idx == 0) {
+ return av1_cost_bit(dc_sign_prob[dc_sign_ctx], sign);
+ } else {
+ return av1_cost_bit(128, sign);
+ }
+}
+static INLINE int get_golomb_cost(int abs_qc) {
+ if (abs_qc >= 1 + NUM_BASE_LEVELS + COEFF_BASE_RANGE) {
+ // residual cost
+ int r = abs_qc - COEFF_BASE_RANGE - NUM_BASE_LEVELS;
+ int ri = r;
+ int length = 0;
+
+ while (ri) {
+ ri >>= 1;
+ ++length;
+ }
+
+ return av1_cost_literal(2 * length - 1);
+ } else {
+ return 0;
+ }
+}
+
+// TODO(angiebird): add static once this function is called
+void gen_txb_cache(TxbCache *txb_cache, TxbInfo *txb_info) {
+ const int16_t *scan = txb_info->scan_order->scan;
+ gen_nz_count_arr(txb_cache->nz_count_arr, txb_info->qcoeff, txb_info->stride,
+ txb_info->eob, txb_info->scan_order);
+ gen_nz_ctx_arr(txb_cache->nz_ctx_arr, txb_cache->nz_count_arr,
+ txb_info->qcoeff, txb_info->bwl, txb_info->eob,
+ txb_info->scan_order);
+ gen_base_count_mag_arr(txb_cache->base_count_arr, txb_cache->base_mag_arr,
+ txb_info->qcoeff, txb_info->stride, txb_info->eob,
+ scan);
+ gen_base_ctx_arr(txb_cache->base_ctx_arr, txb_cache->base_count_arr,
+ txb_cache->base_mag_arr, txb_info->qcoeff, txb_info->stride,
+ txb_info->eob, scan);
+ gen_br_count_mag_arr(txb_cache->br_count_arr, txb_cache->br_mag_arr,
+ txb_info->qcoeff, txb_info->stride, txb_info->eob, scan);
+ gen_br_ctx_arr(txb_cache->br_ctx_arr, txb_cache->br_count_arr,
+ txb_cache->br_mag_arr, txb_info->qcoeff, txb_info->stride,
+ txb_info->eob, scan);
+}
+
+static INLINE aom_prob get_level_prob(int level, int coeff_idx,
+ const TxbCache *txb_cache,
+ const TxbProbs *txb_probs) {
+ if (level == 0) {
+ const int ctx = txb_cache->nz_ctx_arr[coeff_idx][0];
+ return txb_probs->nz_map[ctx];
+ } else if (level >= 1 && level < 1 + NUM_BASE_LEVELS) {
+ const int idx = level - 1;
+ const int ctx = txb_cache->base_ctx_arr[idx][coeff_idx][0];
+ return txb_probs->coeff_base[idx][ctx];
+ } else if (level >= 1 + NUM_BASE_LEVELS &&
+ level < 1 + NUM_BASE_LEVELS + COEFF_BASE_RANGE) {
+ const int ctx = txb_cache->br_ctx_arr[coeff_idx][0];
+ return txb_probs->coeff_lps[ctx];
+ } else if (level >= 1 + NUM_BASE_LEVELS + COEFF_BASE_RANGE) {
+ printf("get_level_prob does not support golomb\n");
+ assert(0);
+ return 0;
+ } else {
+ assert(0);
+ return 0;
+ }
+}
+
+static INLINE tran_low_t get_lower_coeff(tran_low_t qc) {
+ if (qc == 0) {
+ return 0;
+ }
+ return qc > 0 ? qc - 1 : qc + 1;
+}
+
+static INLINE void update_mag_arr(int *mag_arr, int abs_qc) {
+ if (mag_arr[0] == abs_qc) {
+ mag_arr[1] -= 1;
+ assert(mag_arr[1] >= 0);
+ }
+}
+
+static INLINE int get_mag_from_mag_arr(const int *mag_arr) {
+ int mag;
+ if (mag_arr[1] > 0) {
+ mag = mag_arr[0];
+ } else if (mag_arr[0] > 0) {
+ mag = mag_arr[0] - 1;
+ } else {
+ // no neighbor
+ assert(mag_arr[0] == 0 && mag_arr[1] == 0);
+ mag = 0;
+ }
+ return mag;
+}
+
+static int neighbor_level_down_update(int *new_count, int *new_mag, int count,
+ const int *mag, int coeff_idx,
+ tran_low_t abs_nb_coeff, int nb_coeff_idx,
+ int level, const TxbInfo *txb_info) {
+ *new_count = count;
+ *new_mag = get_mag_from_mag_arr(mag);
+
+ int update = 0;
+ // check if br_count changes
+ if (abs_nb_coeff == level) {
+ update = 1;
+ *new_count -= 1;
+ assert(*new_count >= 0);
+ }
+ const int row = coeff_idx >> txb_info->bwl;
+ const int col = coeff_idx - (row << txb_info->bwl);
+ const int nb_row = nb_coeff_idx >> txb_info->bwl;
+ const int nb_col = nb_coeff_idx - (nb_row << txb_info->bwl);
+
+ // check if mag changes
+ if (nb_row >= row && nb_col >= col) {
+ if (abs_nb_coeff == mag[0]) {
+ assert(mag[1] > 0);
+ if (mag[1] == 1) {
+ // the nb is the only qc with max mag
+ *new_mag -= 1;
+ assert(*new_mag >= 0);
+ update = 1;
+ }
+ }
+ }
+ return update;
+}
+
+static int try_neighbor_level_down_br(int coeff_idx, int nb_coeff_idx,
+ const TxbCache *txb_cache,
+ const TxbProbs *txb_probs,
+ const TxbInfo *txb_info) {
+ const tran_low_t qc = txb_info->qcoeff[coeff_idx];
+ const tran_low_t abs_qc = abs(qc);
+ const int level = NUM_BASE_LEVELS + 1;
+ if (abs_qc < level) return 0;
+
+ const tran_low_t nb_coeff = txb_info->qcoeff[nb_coeff_idx];
+ const tran_low_t abs_nb_coeff = abs(nb_coeff);
+ const int count = txb_cache->br_count_arr[coeff_idx];
+ const int *mag = txb_cache->br_mag_arr[coeff_idx];
+ int new_count;
+ int new_mag;
+ const int update =
+ neighbor_level_down_update(&new_count, &new_mag, count, mag, coeff_idx,
+ abs_nb_coeff, nb_coeff_idx, level, txb_info);
+ if (update) {
+ const int row = coeff_idx >> txb_info->bwl;
+ const int col = coeff_idx - (row << txb_info->bwl);
+ const int ctx = txb_cache->br_ctx_arr[coeff_idx][0];
+ const int org_cost = get_br_cost(abs_qc, ctx, txb_probs->coeff_lps);
+
+ const int new_ctx = get_br_ctx_from_count_mag(row, col, new_count, new_mag);
+ const int new_cost = get_br_cost(abs_qc, new_ctx, txb_probs->coeff_lps);
+ const int cost_diff = -org_cost + new_cost;
+ return cost_diff;
+ } else {
+ return 0;
+ }
+}
+
+static int try_neighbor_level_down_base(int coeff_idx, int nb_coeff_idx,
+ const TxbCache *txb_cache,
+ const TxbProbs *txb_probs,
+ const TxbInfo *txb_info) {
+ const tran_low_t qc = txb_info->qcoeff[coeff_idx];
+ const tran_low_t abs_qc = abs(qc);
+
+ int cost_diff = 0;
+ for (int base_idx = 0; base_idx < NUM_BASE_LEVELS; ++base_idx) {
+ const int level = base_idx + 1;
+ if (abs_qc < level) continue;
+
+ const tran_low_t nb_coeff = txb_info->qcoeff[nb_coeff_idx];
+ const tran_low_t abs_nb_coeff = abs(nb_coeff);
+
+ const int count = txb_cache->base_count_arr[base_idx][coeff_idx];
+ const int *mag = txb_cache->base_mag_arr[coeff_idx];
+ int new_count;
+ int new_mag;
+ const int update =
+ neighbor_level_down_update(&new_count, &new_mag, count, mag, coeff_idx,
+ abs_nb_coeff, nb_coeff_idx, level, txb_info);
+ if (update) {
+ const int row = coeff_idx >> txb_info->bwl;
+ const int col = coeff_idx - (row << txb_info->bwl);
+ const int ctx = txb_cache->base_ctx_arr[base_idx][coeff_idx][0];
+ const int org_cost =
+ get_base_cost(abs_qc, ctx, txb_probs->coeff_base, base_idx);
+
+ const int new_ctx =
+ get_base_ctx_from_count_mag(row, col, new_count, new_mag, level);
+ const int new_cost =
+ get_base_cost(abs_qc, new_ctx, txb_probs->coeff_base, base_idx);
+ cost_diff += -org_cost + new_cost;
+ }
+ }
+ return cost_diff;
+}
+
+static int try_neighbor_level_down_nz(int coeff_idx, int nb_coeff_idx,
+ const TxbCache *txb_cache,
+ const TxbProbs *txb_probs,
+ TxbInfo *txb_info) {
+ // assume eob doesn't change
+ const tran_low_t qc = txb_info->qcoeff[coeff_idx];
+ const tran_low_t abs_qc = abs(qc);
+ const tran_low_t nb_coeff = txb_info->qcoeff[nb_coeff_idx];
+ const tran_low_t abs_nb_coeff = abs(nb_coeff);
+ if (abs_nb_coeff != 1) return 0;
+ const int16_t *iscan = txb_info->scan_order->iscan;
+ const int scan_idx = iscan[coeff_idx];
+ if (scan_idx == txb_info->seg_eob) return 0;
+ const int nb_scan_idx = iscan[nb_coeff_idx];
+ if (nb_scan_idx < scan_idx) {
+ const int count = txb_cache->nz_count_arr[coeff_idx];
+ assert(count > 0);
+ txb_info->qcoeff[nb_coeff_idx] = get_lower_coeff(nb_coeff);
+ const int new_ctx = get_nz_map_ctx_from_count(
+ count - 1, txb_info->qcoeff, coeff_idx, txb_info->bwl, iscan);
+ txb_info->qcoeff[nb_coeff_idx] = nb_coeff;
+ const int ctx = txb_cache->nz_ctx_arr[coeff_idx][0];
+ const int is_nz = abs_qc > 0;
+ const int org_cost = av1_cost_bit(txb_probs->nz_map[ctx], is_nz);
+ const int new_cost = av1_cost_bit(txb_probs->nz_map[new_ctx], is_nz);
+ const int cost_diff = new_cost - org_cost;
+ return cost_diff;
+ } else {
+ return 0;
+ }
+}
+
+static int try_self_level_down(tran_low_t *low_coeff, int coeff_idx,
+ const TxbCache *txb_cache,
+ const TxbProbs *txb_probs, TxbInfo *txb_info) {
+ const tran_low_t qc = txb_info->qcoeff[coeff_idx];
+ if (qc == 0) {
+ *low_coeff = 0;
+ return 0;
+ }
+ const tran_low_t abs_qc = abs(qc);
+ *low_coeff = get_lower_coeff(qc);
+ int cost_diff;
+ if (*low_coeff == 0) {
+ const int scan_idx = txb_info->scan_order->iscan[coeff_idx];
+ const aom_prob level_prob =
+ get_level_prob(abs_qc, coeff_idx, txb_cache, txb_probs);
+ const aom_prob low_level_prob =
+ get_level_prob(abs(*low_coeff), coeff_idx, txb_cache, txb_probs);
+ if (scan_idx < txb_info->seg_eob) {
+ // When level-0, we code the binary of abs_qc > level
+ // but when level-k k > 0 we code the binary of abs_qc == level
+ // That's why wee need this special treatment for level-0 map
+ // TODO(angiebird): make leve-0 consistent to other levels
+ cost_diff = -av1_cost_bit(level_prob, 1) +
+ av1_cost_bit(low_level_prob, 0) -
+ av1_cost_bit(low_level_prob, 1);
+ } else {
+ cost_diff = -av1_cost_bit(level_prob, 1);
+ }
+
+ if (scan_idx < txb_info->seg_eob) {
+ const int eob_ctx =
+ get_eob_ctx(txb_info->qcoeff, coeff_idx, txb_info->bwl);
+ cost_diff -= av1_cost_bit(txb_probs->eob_flag[eob_ctx],
+ scan_idx == (txb_info->eob - 1));
+ }
+
+ const int sign_cost = get_sign_bit_cost(
+ qc, coeff_idx, txb_probs->dc_sign_prob, txb_info->txb_ctx->dc_sign_ctx);
+ cost_diff -= sign_cost;
+ } else if (abs_qc < 1 + NUM_BASE_LEVELS + COEFF_BASE_RANGE) {
+ const aom_prob level_prob =
+ get_level_prob(abs_qc, coeff_idx, txb_cache, txb_probs);
+ const aom_prob low_level_prob =
+ get_level_prob(abs(*low_coeff), coeff_idx, txb_cache, txb_probs);
+ cost_diff = -av1_cost_bit(level_prob, 1) + av1_cost_bit(low_level_prob, 1) -
+ av1_cost_bit(low_level_prob, 0);
+ } else if (abs_qc == 1 + NUM_BASE_LEVELS + COEFF_BASE_RANGE) {
+ const aom_prob low_level_prob =
+ get_level_prob(abs(*low_coeff), coeff_idx, txb_cache, txb_probs);
+ cost_diff = -get_golomb_cost(abs_qc) + av1_cost_bit(low_level_prob, 1) -
+ av1_cost_bit(low_level_prob, 0);
+ } else {
+ assert(abs_qc > 1 + NUM_BASE_LEVELS + COEFF_BASE_RANGE);
+ const tran_low_t abs_low_coeff = abs(*low_coeff);
+ cost_diff = -get_golomb_cost(abs_qc) + get_golomb_cost(abs_low_coeff);
+ }
+ return cost_diff;
+}
+
+#define COST_MAP_SIZE 5
+#define COST_MAP_OFFSET 2
+
+static INLINE int check_nz_neighbor(tran_low_t qc) { return abs(qc) == 1; }
+
+static INLINE int check_base_neighbor(tran_low_t qc) {
+ return abs(qc) <= 1 + NUM_BASE_LEVELS;
+}
+
+static INLINE int check_br_neighbor(tran_low_t qc) {
+ return abs(qc) > BR_MAG_OFFSET;
+}
+
+// TODO(angiebird): add static to this function once it's called
+int try_level_down(int coeff_idx, const TxbCache *txb_cache,
+ const TxbProbs *txb_probs, TxbInfo *txb_info,
+ int (*cost_map)[COST_MAP_SIZE]) {
+ if (cost_map) {
+ for (int i = 0; i < COST_MAP_SIZE; ++i) av1_zero(cost_map[i]);
+ }
+
+ tran_low_t qc = txb_info->qcoeff[coeff_idx];
+ tran_low_t low_coeff;
+ if (qc == 0) return 0;
+ int accu_cost_diff = 0;
+
+ const int16_t *iscan = txb_info->scan_order->iscan;
+ const int eob = txb_info->eob;
+ const int scan_idx = iscan[coeff_idx];
+ if (scan_idx < eob) {
+ const int cost_diff = try_self_level_down(&low_coeff, coeff_idx, txb_cache,
+ txb_probs, txb_info);
+ if (cost_map)
+ cost_map[0 + COST_MAP_OFFSET][0 + COST_MAP_OFFSET] = cost_diff;
+ accu_cost_diff += cost_diff;
+ }
+
+ const int row = coeff_idx >> txb_info->bwl;
+ const int col = coeff_idx - (row << txb_info->bwl);
+ if (check_nz_neighbor(qc)) {
+ for (int i = 0; i < SIG_REF_OFFSET_NUM; ++i) {
+ const int nb_row = row - sig_ref_offset[i][0];
+ const int nb_col = col - sig_ref_offset[i][1];
+ const int nb_coeff_idx = nb_row * txb_info->stride + nb_col;
+ const int nb_scan_idx = iscan[nb_coeff_idx];
+ if (nb_scan_idx < eob && nb_row >= 0 && nb_col >= 0 &&
+ nb_row < txb_info->stride && nb_col < txb_info->stride) {
+ const int cost_diff = try_neighbor_level_down_nz(
+ nb_coeff_idx, coeff_idx, txb_cache, txb_probs, txb_info);
+ if (cost_map)
+ cost_map[nb_row - row + COST_MAP_OFFSET]
+ [nb_col - col + COST_MAP_OFFSET] += cost_diff;
+ accu_cost_diff += cost_diff;
+ }
+ }
+ }
+
+ if (check_base_neighbor(qc)) {
+ for (int i = 0; i < BASE_CONTEXT_POSITION_NUM; ++i) {
+ const int nb_row = row - base_ref_offset[i][0];
+ const int nb_col = col - base_ref_offset[i][1];
+ const int nb_coeff_idx = nb_row * txb_info->stride + nb_col;
+ const int nb_scan_idx = iscan[nb_coeff_idx];
+ if (nb_scan_idx < eob && nb_row >= 0 && nb_col >= 0 &&
+ nb_row < txb_info->stride && nb_col < txb_info->stride) {
+ const int cost_diff = try_neighbor_level_down_base(
+ nb_coeff_idx, coeff_idx, txb_cache, txb_probs, txb_info);
+ if (cost_map)
+ cost_map[nb_row - row + COST_MAP_OFFSET]
+ [nb_col - col + COST_MAP_OFFSET] += cost_diff;
+ accu_cost_diff += cost_diff;
+ }
+ }
+ }
+
+ if (check_br_neighbor(qc)) {
+ for (int i = 0; i < BR_CONTEXT_POSITION_NUM; ++i) {
+ const int nb_row = row - br_ref_offset[i][0];
+ const int nb_col = col - br_ref_offset[i][1];
+ const int nb_coeff_idx = nb_row * txb_info->stride + nb_col;
+ const int nb_scan_idx = iscan[nb_coeff_idx];
+ if (nb_scan_idx < eob && nb_row >= 0 && nb_col >= 0 &&
+ nb_row < txb_info->stride && nb_col < txb_info->stride) {
+ const int cost_diff = try_neighbor_level_down_br(
+ nb_coeff_idx, coeff_idx, txb_cache, txb_probs, txb_info);
+ if (cost_map)
+ cost_map[nb_row - row + COST_MAP_OFFSET]
+ [nb_col - col + COST_MAP_OFFSET] += cost_diff;
+ accu_cost_diff += cost_diff;
+ }
+ }
+ }
+
+ return accu_cost_diff;
+}
+
+static int get_low_coeff_cost(int coeff_idx, const TxbCache *txb_cache,
+ const TxbProbs *txb_probs,
+ const TxbInfo *txb_info) {
+ const tran_low_t qc = txb_info->qcoeff[coeff_idx];
+ const int abs_qc = abs(qc);
+ assert(abs_qc <= 1);
+ int cost = 0;
+ const int scan_idx = txb_info->scan_order->iscan[coeff_idx];
+ if (scan_idx < txb_info->seg_eob) {
+ const aom_prob level_prob =
+ get_level_prob(0, coeff_idx, txb_cache, txb_probs);
+ cost += av1_cost_bit(level_prob, qc != 0);
+ }
+
+ if (qc != 0) {
+ const int base_idx = 0;
+ const int ctx = txb_cache->base_ctx_arr[base_idx][coeff_idx][0];
+ cost += get_base_cost(abs_qc, ctx, txb_probs->coeff_base, base_idx);
+ if (scan_idx < txb_info->seg_eob) {
+ const int eob_ctx =
+ get_eob_ctx(txb_info->qcoeff, coeff_idx, txb_info->bwl);
+ cost += av1_cost_bit(txb_probs->eob_flag[eob_ctx],
+ scan_idx == (txb_info->eob - 1));
+ }
+ cost += get_sign_bit_cost(qc, coeff_idx, txb_probs->dc_sign_prob,
+ txb_info->txb_ctx->dc_sign_ctx);
+ }
+ return cost;
+}
+
+static INLINE void set_eob(TxbInfo *txb_info, int eob) {
+ txb_info->eob = eob;
+ txb_info->seg_eob = AOMMIN(eob, tx_size_2d[txb_info->tx_size] - 1);
+}
+
+// TODO(angiebird): add static to this function once it's called
+int try_change_eob(int *new_eob, int coeff_idx, const TxbCache *txb_cache,
+ const TxbProbs *txb_probs, TxbInfo *txb_info) {
+ assert(txb_info->eob > 0);
+ const tran_low_t qc = txb_info->qcoeff[coeff_idx];
+ const int abs_qc = abs(qc);
+ if (abs_qc != 1) {
+ *new_eob = -1;
+ return 0;
+ }
+ const int16_t *iscan = txb_info->scan_order->iscan;
+ const int16_t *scan = txb_info->scan_order->scan;
+ const int scan_idx = iscan[coeff_idx];
+ *new_eob = 0;
+ int cost_diff = 0;
+ cost_diff -= get_low_coeff_cost(coeff_idx, txb_cache, txb_probs, txb_info);
+ // int coeff_cost =
+ // get_coeff_cost(qc, scan_idx, txb_info, txb_probs);
+ // if (-cost_diff != coeff_cost) {
+ // printf("-cost_diff %d coeff_cost %d\n", -cost_diff, coeff_cost);
+ // get_low_coeff_cost(coeff_idx, txb_cache, txb_probs, txb_info);
+ // get_coeff_cost(qc, scan_idx, txb_info, txb_probs);
+ // }
+ for (int si = scan_idx - 1; si >= 0; --si) {
+ const int ci = scan[si];
+ if (txb_info->qcoeff[ci] != 0) {
+ *new_eob = si + 1;
+ break;
+ } else {
+ cost_diff -= get_low_coeff_cost(ci, txb_cache, txb_probs, txb_info);
+ }
+ }
+
+ const int org_eob = txb_info->eob;
+ set_eob(txb_info, *new_eob);
+ cost_diff += try_level_down(coeff_idx, txb_cache, txb_probs, txb_info, NULL);
+ set_eob(txb_info, org_eob);
+
+ if (*new_eob > 0) {
+ // Note that get_eob_ctx does NOT actually account for qcoeff, so we don't
+ // need to lower down the qcoeff here
+ const int eob_ctx =
+ get_eob_ctx(txb_info->qcoeff, scan[*new_eob - 1], txb_info->bwl);
+ cost_diff -= av1_cost_bit(txb_probs->eob_flag[eob_ctx], 0);
+ cost_diff += av1_cost_bit(txb_probs->eob_flag[eob_ctx], 1);
+ } else {
+ const int txb_skip_ctx = txb_info->txb_ctx->txb_skip_ctx;
+ cost_diff -= av1_cost_bit(txb_probs->txb_skip[txb_skip_ctx], 0);
+ cost_diff += av1_cost_bit(txb_probs->txb_skip[txb_skip_ctx], 1);
+ }
+ return cost_diff;
+}
+
+static INLINE tran_low_t qcoeff_to_dqcoeff(tran_low_t qc, int dqv, int shift) {
+ int sgn = qc < 0 ? -1 : 1;
+ return sgn * ((abs(qc) * dqv) >> shift);
+}
+
+// TODO(angiebird): add static to this function it's called
+void update_level_down(int coeff_idx, TxbCache *txb_cache, TxbInfo *txb_info) {
+ const tran_low_t qc = txb_info->qcoeff[coeff_idx];
+ const int abs_qc = abs(qc);
+ if (qc == 0) return;
+ const tran_low_t low_coeff = get_lower_coeff(qc);
+ txb_info->qcoeff[coeff_idx] = low_coeff;
+ const int dqv = txb_info->dequant[coeff_idx != 0];
+ txb_info->dqcoeff[coeff_idx] =
+ qcoeff_to_dqcoeff(low_coeff, dqv, txb_info->shift);
+
+ const int row = coeff_idx >> txb_info->bwl;
+ const int col = coeff_idx - (row << txb_info->bwl);
+ const int eob = txb_info->eob;
+ const int16_t *iscan = txb_info->scan_order->iscan;
+ for (int i = 0; i < SIG_REF_OFFSET_NUM; ++i) {
+ const int nb_row = row - sig_ref_offset[i][0];
+ const int nb_col = col - sig_ref_offset[i][1];
+ const int nb_coeff_idx = nb_row * txb_info->stride + nb_col;
+ const int nb_scan_idx = iscan[nb_coeff_idx];
+ if (nb_scan_idx < eob && nb_row >= 0 && nb_col >= 0 &&
+ nb_row < txb_info->stride && nb_col < txb_info->stride) {
+ const int scan_idx = iscan[coeff_idx];
+ if (scan_idx < nb_scan_idx) {
+ const int level = 1;
+ if (abs_qc == level) {
+ txb_cache->nz_count_arr[nb_coeff_idx] -= 1;
+ assert(txb_cache->nz_count_arr[nb_coeff_idx] >= 0);
+ }
+ const int count = txb_cache->nz_count_arr[nb_coeff_idx];
+ txb_cache->nz_ctx_arr[nb_coeff_idx][0] = get_nz_map_ctx_from_count(
+ count, txb_info->qcoeff, nb_coeff_idx, txb_info->bwl, iscan);
+ // int ref_ctx = get_nz_map_ctx2(txb_info->qcoeff, nb_coeff_idx,
+ // txb_info->bwl, iscan);
+ // if (ref_ctx != txb_cache->nz_ctx_arr[nb_coeff_idx][0])
+ // printf("nz ctx %d ref_ctx %d\n",
+ // txb_cache->nz_ctx_arr[nb_coeff_idx][0], ref_ctx);
+ }
+ }
+ }
+
+ for (int i = 0; i < BASE_CONTEXT_POSITION_NUM; ++i) {
+ const int nb_row = row - base_ref_offset[i][0];
+ const int nb_col = col - base_ref_offset[i][1];
+ const int nb_coeff_idx = nb_row * txb_info->stride + nb_col;
+ const tran_low_t nb_coeff = txb_info->qcoeff[nb_coeff_idx];
+ if (!has_base(nb_coeff, 0)) continue;
+ const int nb_scan_idx = iscan[nb_coeff_idx];
+ if (nb_scan_idx < eob && nb_row >= 0 && nb_col >= 0 &&
+ nb_row < txb_info->stride && nb_col < txb_info->stride) {
+ if (row >= nb_row && col >= nb_col)
+ update_mag_arr(txb_cache->base_mag_arr[nb_coeff_idx], abs_qc);
+ const int mag =
+ get_mag_from_mag_arr(txb_cache->base_mag_arr[nb_coeff_idx]);
+ for (int base_idx = 0; base_idx < NUM_BASE_LEVELS; ++base_idx) {
+ if (!has_base(nb_coeff, base_idx)) continue;
+ const int level = base_idx + 1;
+ if (abs_qc == level) {
+ txb_cache->base_count_arr[base_idx][nb_coeff_idx] -= 1;
+ assert(txb_cache->base_count_arr[base_idx][nb_coeff_idx] >= 0);
+ }
+ const int count = txb_cache->base_count_arr[base_idx][nb_coeff_idx];
+ txb_cache->base_ctx_arr[base_idx][nb_coeff_idx][0] =
+ get_base_ctx_from_count_mag(nb_row, nb_col, count, mag, level);
+ // int ref_ctx = get_base_ctx(txb_info->qcoeff, nb_coeff_idx,
+ // txb_info->bwl, level);
+ // if (ref_ctx != txb_cache->base_ctx_arr[base_idx][nb_coeff_idx][0]) {
+ // printf("base ctx %d ref_ctx %d\n",
+ // txb_cache->base_ctx_arr[base_idx][nb_coeff_idx][0], ref_ctx);
+ // }
+ }
+ }
+ }
+
+ for (int i = 0; i < BR_CONTEXT_POSITION_NUM; ++i) {
+ const int nb_row = row - br_ref_offset[i][0];
+ const int nb_col = col - br_ref_offset[i][1];
+ const int nb_coeff_idx = nb_row * txb_info->stride + nb_col;
+ const int nb_scan_idx = iscan[nb_coeff_idx];
+ const tran_low_t nb_coeff = txb_info->qcoeff[nb_coeff_idx];
+ if (!has_br(nb_coeff)) continue;
+ if (nb_scan_idx < eob && nb_row >= 0 && nb_col >= 0 &&
+ nb_row < txb_info->stride && nb_col < txb_info->stride) {
+ const int level = 1 + NUM_BASE_LEVELS;
+ if (abs_qc == level) {
+ txb_cache->br_count_arr[nb_coeff_idx] -= 1;
+ assert(txb_cache->br_count_arr[nb_coeff_idx] >= 0);
+ }
+ if (row >= nb_row && col >= nb_col)
+ update_mag_arr(txb_cache->br_mag_arr[nb_coeff_idx], abs_qc);
+ const int count = txb_cache->br_count_arr[nb_coeff_idx];
+ const int mag = get_mag_from_mag_arr(txb_cache->br_mag_arr[nb_coeff_idx]);
+ txb_cache->br_ctx_arr[nb_coeff_idx][0] =
+ get_br_ctx_from_count_mag(nb_row, nb_col, count, mag);
+ // int ref_ctx = get_level_ctx(txb_info->qcoeff, nb_coeff_idx,
+ // txb_info->bwl);
+ // if (ref_ctx != txb_cache->br_ctx_arr[nb_coeff_idx][0]) {
+ // printf("base ctx %d ref_ctx %d\n",
+ // txb_cache->br_ctx_arr[nb_coeff_idx][0], ref_ctx);
+ // }
+ }
+ }
+}
+
+static int get_coeff_cost(tran_low_t qc, int scan_idx, TxbInfo *txb_info,
+ const TxbProbs *txb_probs) {
+ const TXB_CTX *txb_ctx = txb_info->txb_ctx;
+ const int is_nz = (qc != 0);
+ const tran_low_t abs_qc = abs(qc);
+ int cost = 0;
+ const int16_t *scan = txb_info->scan_order->scan;
+ const int16_t *iscan = txb_info->scan_order->iscan;
+
+ if (scan_idx < txb_info->seg_eob) {
+ int coeff_ctx =
+ get_nz_map_ctx2(txb_info->qcoeff, scan[scan_idx], txb_info->bwl, iscan);
+ cost += av1_cost_bit(txb_probs->nz_map[coeff_ctx], is_nz);
+ }
+
+ if (is_nz) {
+ cost += get_sign_bit_cost(qc, scan_idx, txb_probs->dc_sign_prob,
+ txb_ctx->dc_sign_ctx);
+
+ int ctx_ls[NUM_BASE_LEVELS] = { 0 };
+ get_base_ctx_set(txb_info->qcoeff, scan[scan_idx], txb_info->bwl, ctx_ls);
+
+ int i;
+ for (i = 0; i < NUM_BASE_LEVELS; ++i) {
+ cost += get_base_cost(abs_qc, ctx_ls[i], txb_probs->coeff_base, i);
+ }
+
+ if (abs_qc > NUM_BASE_LEVELS) {
+ int ctx = get_br_ctx(txb_info->qcoeff, scan[scan_idx], txb_info->bwl);
+ cost += get_br_cost(abs_qc, ctx, txb_probs->coeff_lps);
+ cost += get_golomb_cost(abs_qc);
+ }
+
+ if (scan_idx < txb_info->seg_eob) {
+ int eob_ctx =
+ get_eob_ctx(txb_info->qcoeff, scan[scan_idx], txb_info->bwl);
+ cost += av1_cost_bit(txb_probs->eob_flag[eob_ctx],
+ scan_idx == (txb_info->eob - 1));
+ }
+ }
+ return cost;
+}
+
+#if TEST_OPTIMIZE_TXB
+#define ALL_REF_OFFSET_NUM 17
+static int all_ref_offset[ALL_REF_OFFSET_NUM][2] = {
+ { 0, 0 }, { -2, -1 }, { -2, 0 }, { -2, 1 }, { -1, -2 }, { -1, -1 },
+ { -1, 0 }, { -1, 1 }, { 0, -2 }, { 0, -1 }, { 1, -2 }, { 1, -1 },
+ { 1, 0 }, { 2, 0 }, { 0, 1 }, { 0, 2 }, { 1, 1 },
+};
+
+static int try_level_down_ref(int coeff_idx, const TxbProbs *txb_probs,
+ TxbInfo *txb_info,
+ int (*cost_map)[COST_MAP_SIZE]) {
+ if (cost_map) {
+ for (int i = 0; i < COST_MAP_SIZE; ++i) av1_zero(cost_map[i]);
+ }
+ tran_low_t qc = txb_info->qcoeff[coeff_idx];
+ if (qc == 0) return 0;
+ int row = coeff_idx >> txb_info->bwl;
+ int col = coeff_idx - (row << txb_info->bwl);
+ int org_cost = 0;
+ for (int i = 0; i < ALL_REF_OFFSET_NUM; ++i) {
+ int nb_row = row - all_ref_offset[i][0];
+ int nb_col = col - all_ref_offset[i][1];
+ int nb_coeff_idx = nb_row * txb_info->stride + nb_col;
+ int nb_scan_idx = txb_info->scan_order->iscan[nb_coeff_idx];
+ if (nb_scan_idx < txb_info->eob && nb_row >= 0 && nb_col >= 0 &&
+ nb_row < txb_info->stride && nb_col < txb_info->stride) {
+ tran_low_t nb_coeff = txb_info->qcoeff[nb_coeff_idx];
+ int cost = get_coeff_cost(nb_coeff, nb_scan_idx, txb_info, txb_probs);
+ if (cost_map)
+ cost_map[nb_row - row + COST_MAP_OFFSET]
+ [nb_col - col + COST_MAP_OFFSET] -= cost;
+ org_cost += cost;
+ }
+ }
+ txb_info->qcoeff[coeff_idx] = get_lower_coeff(qc);
+ int new_cost = 0;
+ for (int i = 0; i < ALL_REF_OFFSET_NUM; ++i) {
+ int nb_row = row - all_ref_offset[i][0];
+ int nb_col = col - all_ref_offset[i][1];
+ int nb_coeff_idx = nb_row * txb_info->stride + nb_col;
+ int nb_scan_idx = txb_info->scan_order->iscan[nb_coeff_idx];
+ if (nb_scan_idx < txb_info->eob && nb_row >= 0 && nb_col >= 0 &&
+ nb_row < txb_info->stride && nb_col < txb_info->stride) {
+ tran_low_t nb_coeff = txb_info->qcoeff[nb_coeff_idx];
+ int cost = get_coeff_cost(nb_coeff, nb_scan_idx, txb_info, txb_probs);
+ if (cost_map)
+ cost_map[nb_row - row + COST_MAP_OFFSET]
+ [nb_col - col + COST_MAP_OFFSET] += cost;
+ new_cost += cost;
+ }
+ }
+ txb_info->qcoeff[coeff_idx] = qc;
+ return new_cost - org_cost;
+}
+static void test_level_down(int coeff_idx, const TxbCache *txb_cache,
+ const TxbProbs *txb_probs, TxbInfo *txb_info) {
+ int cost_map[COST_MAP_SIZE][COST_MAP_SIZE];
+ int ref_cost_map[COST_MAP_SIZE][COST_MAP_SIZE];
+ const int cost_diff =
+ try_level_down(coeff_idx, txb_cache, txb_probs, txb_info, cost_map);
+ const int cost_diff_ref =
+ try_level_down_ref(coeff_idx, txb_probs, txb_info, ref_cost_map);
+ if (cost_diff != cost_diff_ref) {
+ printf("qc %d cost_diff %d cost_diff_ref %d\n", txb_info->qcoeff[coeff_idx],
+ cost_diff, cost_diff_ref);
+ for (int r = 0; r < COST_MAP_SIZE; ++r) {
+ for (int c = 0; c < COST_MAP_SIZE; ++c) {
+ printf("%d:%d ", cost_map[r][c], ref_cost_map[r][c]);
+ }
+ printf("\n");
+ }
+ }
+}
+#endif
+
+// TODO(angiebird): make this static once it's called
+int get_txb_cost(TxbInfo *txb_info, const TxbProbs *txb_probs) {
+ int cost = 0;
+ int txb_skip_ctx = txb_info->txb_ctx->txb_skip_ctx;
+ const int16_t *scan = txb_info->scan_order->scan;
+ if (txb_info->eob == 0) {
+ cost = av1_cost_bit(txb_probs->txb_skip[txb_skip_ctx], 1);
+ return cost;
+ }
+ cost = av1_cost_bit(txb_probs->txb_skip[txb_skip_ctx], 0);
+ for (int c = 0; c < txb_info->eob; ++c) {
+ tran_low_t qc = txb_info->qcoeff[scan[c]];
+ int coeff_cost = get_coeff_cost(qc, c, txb_info, txb_probs);
+ cost += coeff_cost;
+ }
+ return cost;
+}
+
+#if TEST_OPTIMIZE_TXB
+void test_try_change_eob(TxbInfo *txb_info, TxbProbs *txb_probs,
+ TxbCache *txb_cache) {
+ int eob = txb_info->eob;
+ const int16_t *scan = txb_info->scan_order->scan;
+ if (eob > 0) {
+ int last_si = eob - 1;
+ int last_ci = scan[last_si];
+ int last_coeff = txb_info->qcoeff[last_ci];
+ if (abs(last_coeff) == 1) {
+ int new_eob;
+ int cost_diff =
+ try_change_eob(&new_eob, last_ci, txb_cache, txb_probs, txb_info);
+ int org_eob = txb_info->eob;
+ int cost = get_txb_cost(txb_info, txb_probs);
+
+ txb_info->qcoeff[last_ci] = get_lower_coeff(last_coeff);
+ set_eob(txb_info, new_eob);
+ int new_cost = get_txb_cost(txb_info, txb_probs);
+ set_eob(txb_info, org_eob);
+ txb_info->qcoeff[last_ci] = last_coeff;
+
+ int ref_cost_diff = -cost + new_cost;
+ if (cost_diff != ref_cost_diff)
+ printf("org_eob %d new_eob %d cost_diff %d ref_cost_diff %d\n", org_eob,
+ new_eob, cost_diff, ref_cost_diff);
+ }
+ }
+}
+#endif
+
+static INLINE int64_t get_coeff_dist(tran_low_t tcoeff, tran_low_t dqcoeff,
+ int shift) {
+ const int64_t diff = (tcoeff - dqcoeff) * (1 << shift);
+ const int64_t error = diff * diff;
+ return error;
+}
+
+typedef struct LevelDownStats {
+ int update;
+ tran_low_t low_qc;
+ tran_low_t low_dqc;
+ int64_t rd_diff;
+ int cost_diff;
+ int64_t dist_diff;
+ int new_eob;
+} LevelDownStats;
+
+void try_level_down_facade(LevelDownStats *stats, int scan_idx,
+ const TxbCache *txb_cache, const TxbProbs *txb_probs,
+ TxbInfo *txb_info) {
+ const int16_t *scan = txb_info->scan_order->scan;
+ const int coeff_idx = scan[scan_idx];
+ const tran_low_t qc = txb_info->qcoeff[coeff_idx];
+ stats->new_eob = -1;
+ stats->update = 0;
+ if (qc == 0) {
+ return;
+ }
+
+ const tran_low_t tqc = txb_info->tcoeff[coeff_idx];
+ const int dqv = txb_info->dequant[coeff_idx != 0];
+
+ const tran_low_t dqc = qcoeff_to_dqcoeff(qc, dqv, txb_info->shift);
+ const int64_t dqc_dist = get_coeff_dist(tqc, dqc, txb_info->shift);
+
+ stats->low_qc = get_lower_coeff(qc);
+ stats->low_dqc = qcoeff_to_dqcoeff(stats->low_qc, dqv, txb_info->shift);
+ const int64_t low_dqc_dist =
+ get_coeff_dist(tqc, stats->low_dqc, txb_info->shift);
+
+ stats->dist_diff = -dqc_dist + low_dqc_dist;
+ stats->cost_diff = 0;
+ stats->new_eob = txb_info->eob;
+ if (scan_idx == txb_info->eob - 1 && abs(qc) == 1) {
+ stats->cost_diff = try_change_eob(&stats->new_eob, coeff_idx, txb_cache,
+ txb_probs, txb_info);
+ } else {
+ stats->cost_diff =
+ try_level_down(coeff_idx, txb_cache, txb_probs, txb_info, NULL);
+#if TEST_OPTIMIZE_TXB
+ test_level_down(coeff_idx, txb_cache, txb_probs, txb_info);
+#endif
+ }
+ stats->rd_diff = RDCOST(txb_info->rdmult, txb_info->rddiv, stats->cost_diff,
+ stats->dist_diff);
+ if (stats->rd_diff < 0) stats->update = 1;
+ return;
+}
+
+static int optimize_txb(TxbInfo *txb_info, const TxbProbs *txb_probs,
+ TxbCache *txb_cache, int dry_run) {
+ int update = 0;
+ if (txb_info->eob == 0) return update;
+ int cost_diff = 0;
+ int64_t dist_diff = 0;
+ int64_t rd_diff = 0;
+ const int max_eob = tx_size_2d[txb_info->tx_size];
+
+#if TEST_OPTIMIZE_TXB
+ int64_t sse;
+ int64_t org_dist =
+ av1_block_error_c(txb_info->tcoeff, txb_info->dqcoeff, max_eob, &sse) *
+ (1 << (2 * txb_info->shift));
+ int org_cost = get_txb_cost(txb_info, txb_probs);
+#endif
+
+ tran_low_t *org_qcoeff = txb_info->qcoeff;
+ tran_low_t *org_dqcoeff = txb_info->dqcoeff;
+
+ tran_low_t tmp_qcoeff[MAX_TX_SQUARE];
+ tran_low_t tmp_dqcoeff[MAX_TX_SQUARE];
+ const int org_eob = txb_info->eob;
+ if (dry_run) {
+ memcpy(tmp_qcoeff, org_qcoeff, sizeof(org_qcoeff[0]) * max_eob);
+ memcpy(tmp_dqcoeff, org_dqcoeff, sizeof(org_dqcoeff[0]) * max_eob);
+ txb_info->qcoeff = tmp_qcoeff;
+ txb_info->dqcoeff = tmp_dqcoeff;
+ }
+
+ const int16_t *scan = txb_info->scan_order->scan;
+
+ // forward optimize the nz_map
+ const int cur_eob = txb_info->eob;
+ for (int si = 0; si < cur_eob; ++si) {
+ const int coeff_idx = scan[si];
+ tran_low_t qc = txb_info->qcoeff[coeff_idx];
+ if (abs(qc) == 1) {
+ LevelDownStats stats;
+ try_level_down_facade(&stats, si, txb_cache, txb_probs, txb_info);
+ if (stats.update) {
+ update = 1;
+ cost_diff += stats.cost_diff;
+ dist_diff += stats.dist_diff;
+ rd_diff += stats.rd_diff;
+ update_level_down(coeff_idx, txb_cache, txb_info);
+ set_eob(txb_info, stats.new_eob);
+ }
+ }
+ }
+
+ // backward optimize the level-k map
+ for (int si = txb_info->eob - 1; si >= 0; --si) {
+ LevelDownStats stats;
+ try_level_down_facade(&stats, si, txb_cache, txb_probs, txb_info);
+ const int coeff_idx = scan[si];
+ if (stats.update) {
+#if TEST_OPTIMIZE_TXB
+// printf("si %d low_qc %d cost_diff %d dist_diff %ld rd_diff %ld eob %d new_eob
+// %d\n", si, stats.low_qc, stats.cost_diff, stats.dist_diff, stats.rd_diff,
+// txb_info->eob, stats.new_eob);
+#endif
+ update = 1;
+ cost_diff += stats.cost_diff;
+ dist_diff += stats.dist_diff;
+ rd_diff += stats.rd_diff;
+ update_level_down(coeff_idx, txb_cache, txb_info);
+ set_eob(txb_info, stats.new_eob);
+ }
+ if (si > txb_info->eob) si = txb_info->eob;
+ }
+#if TEST_OPTIMIZE_TXB
+ int64_t new_dist =
+ av1_block_error_c(txb_info->tcoeff, txb_info->dqcoeff, max_eob, &sse) *
+ (1 << (2 * txb_info->shift));
+ int new_cost = get_txb_cost(txb_info, txb_probs);
+ int64_t ref_dist_diff = new_dist - org_dist;
+ int ref_cost_diff = new_cost - org_cost;
+ if (cost_diff != ref_cost_diff || dist_diff != ref_dist_diff)
+ printf(
+ "overall rd_diff %ld\ncost_diff %d ref_cost_diff%d\ndist_diff %ld "
+ "ref_dist_diff %ld\neob %d new_eob %d\n\n",
+ rd_diff, cost_diff, ref_cost_diff, dist_diff, ref_dist_diff, org_eob,
+ txb_info->eob);
+#endif
+ if (dry_run) {
+ txb_info->qcoeff = org_qcoeff;
+ txb_info->dqcoeff = org_dqcoeff;
+ set_eob(txb_info, org_eob);
+ }
+ return update;
+}
+
+// These numbers are empirically obtained.
+static const int plane_rd_mult[REF_TYPES][PLANE_TYPES] = {
+#if CONFIG_EC_ADAPT
+ { 17, 13 }, { 16, 10 },
+#else
+ { 20, 12 }, { 16, 12 },
+#endif
+};
+
+int av1_optimize_txb(const AV1_COMMON *cm, MACROBLOCK *x, int plane, int block,
+ TX_SIZE tx_size, TXB_CTX *txb_ctx) {
+ MACROBLOCKD *const xd = &x->e_mbd;
+ const PLANE_TYPE plane_type = get_plane_type(plane);
+ const TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size);
+ const MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
+ const struct macroblock_plane *p = &x->plane[plane];
+ struct macroblockd_plane *pd = &xd->plane[plane];
+ const int eob = p->eobs[block];
+ tran_low_t *qcoeff = BLOCK_OFFSET(p->qcoeff, block);
+ tran_low_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
+ const tran_low_t *tcoeff = BLOCK_OFFSET(p->coeff, block);
+ const int16_t *dequant = pd->dequant;
+ const int seg_eob = AOMMIN(eob, tx_size_2d[tx_size] - 1);
+ const aom_prob *nz_map = xd->fc->nz_map[tx_size][plane_type];
+
+ const int bwl = b_width_log2_lookup[txsize_to_bsize[tx_size]] + 2;
+ const int stride = 1 << bwl;
+ aom_prob(*coeff_base)[COEFF_BASE_CONTEXTS] =
+ xd->fc->coeff_base[tx_size][plane_type];
+
+ const aom_prob *coeff_lps = xd->fc->coeff_lps[tx_size][plane_type];
+
+ const int is_inter = is_inter_block(mbmi);
+ const SCAN_ORDER *const scan_order =
+ get_scan(cm, tx_size, tx_type, is_inter_block(mbmi));
+
+ const TxbProbs txb_probs = { xd->fc->dc_sign[plane_type],
+ nz_map,
+ coeff_base,
+ coeff_lps,
+ xd->fc->eob_flag[tx_size][plane_type],
+ xd->fc->txb_skip[tx_size] };
+
+ const int shift = av1_get_tx_scale(tx_size);
+ const int64_t rdmult =
+ (x->rdmult * plane_rd_mult[is_inter][plane_type] + 2) >> 2;
+ const int64_t rddiv = x->rddiv;
+
+ TxbInfo txb_info = { qcoeff, dqcoeff, tcoeff, dequant, shift,
+ tx_size, bwl, stride, eob, seg_eob,
+ scan_order, txb_ctx, rdmult, rddiv };
+ TxbCache txb_cache;
+ gen_txb_cache(&txb_cache, &txb_info);
+
+ const int update = optimize_txb(&txb_info, &txb_probs, &txb_cache, 0);
+ if (update) p->eobs[block] = txb_info.eob;
+ return txb_info.eob;
+}
int av1_get_txb_entropy_context(const tran_low_t *qcoeff,
const SCAN_ORDER *scan_order, int eob) {
const int16_t *scan = scan_order->scan;
@@ -394,10 +1495,10 @@ int av1_get_txb_entropy_context(const tran_low_t *qcoeff,
return cul_level;
}
-static void update_txb_context(int plane, int block, int blk_row, int blk_col,
- BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
- void *arg) {
- TxbParams *const args = arg;
+void av1_update_txb_context_b(int plane, int block, int blk_row, int blk_col,
+ BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
+ void *arg) {
+ struct tokenize_b_args *const args = arg;
const AV1_COMP *cpi = args->cpi;
const AV1_COMMON *cm = &cpi->common;
ThreadData *const td = args->td;
@@ -418,10 +1519,10 @@ static void update_txb_context(int plane, int block, int blk_row, int blk_col,
av1_set_contexts(xd, pd, plane, tx_size, cul_level, blk_col, blk_row);
}
-static void update_and_record_txb_context(int plane, int block, int blk_row,
- int blk_col, BLOCK_SIZE plane_bsize,
- TX_SIZE tx_size, void *arg) {
- TxbParams *const args = arg;
+void av1_update_and_record_txb_context(int plane, int block, int blk_row,
+ int blk_col, BLOCK_SIZE plane_bsize,
+ TX_SIZE tx_size, void *arg) {
+ struct tokenize_b_args *const args = arg;
const AV1_COMP *cpi = args->cpi;
const AV1_COMMON *cm = &cpi->common;
ThreadData *const td = args->td;
@@ -529,7 +1630,7 @@ static void update_and_record_txb_context(int plane, int block, int blk_row,
}
// level is above 1.
- ctx = get_level_ctx(tcoeff, scan[c], bwl);
+ ctx = get_br_ctx(tcoeff, scan[c], bwl);
for (idx = 0; idx < COEFF_BASE_RANGE; ++idx) {
if (level == (idx + 1 + NUM_BASE_LEVELS)) {
++td->counts->coeff_lps[tx_size][plane_type][ctx][1];
@@ -568,23 +1669,23 @@ void av1_update_txb_context(const AV1_COMP *cpi, ThreadData *td,
const int ctx = av1_get_skip_context(xd);
const int skip_inc =
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP);
- struct TxbParams arg = { cpi, td, 0 };
+ struct tokenize_b_args arg = { cpi, td, NULL, 0 };
(void)rate;
(void)mi_row;
(void)mi_col;
if (mbmi->skip) {
if (!dry_run) td->counts->skip[ctx][1] += skip_inc;
- reset_skip_context(xd, bsize);
+ av1_reset_skip_context(xd, mi_row, mi_col, bsize);
return;
}
if (!dry_run) {
td->counts->skip[ctx][0] += skip_inc;
av1_foreach_transformed_block(xd, bsize, mi_row, mi_col,
- update_and_record_txb_context, &arg);
+ av1_update_and_record_txb_context, &arg);
} else if (dry_run == DRY_RUN_NORMAL) {
- av1_foreach_transformed_block(xd, bsize, mi_row, mi_col, update_txb_context,
- &arg);
+ av1_foreach_transformed_block(xd, bsize, mi_row, mi_col,
+ av1_update_txb_context_b, &arg);
} else {
printf("DRY_RUN_COSTCOEFFS is not supported yet\n");
assert(0);
@@ -749,8 +1850,7 @@ int64_t av1_search_txk_type(const AV1_COMP *cpi, MACROBLOCK *x, int plane,
av1_invalid_rd_stats(&this_rd_stats);
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
coeff_ctx, AV1_XFORM_QUANT_FP);
- if (x->plane[plane].eobs[block] && !xd->lossless[mbmi->segment_id])
- av1_optimize_b(cm, x, plane, block, tx_size, coeff_ctx);
+ av1_optimize_b(cm, x, plane, block, plane_bsize, tx_size, a, l);
av1_dist_block(cpi, x, plane, plane_bsize, block, blk_row, blk_col, tx_size,
&this_rd_stats.dist, &this_rd_stats.sse,
OUTPUT_HAS_PREDICTED_PIXELS);
@@ -771,8 +1871,7 @@ int64_t av1_search_txk_type(const AV1_COMP *cpi, MACROBLOCK *x, int plane,
// copy the best result in the above tx_type search for loop
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
coeff_ctx, AV1_XFORM_QUANT_FP);
- if (x->plane[plane].eobs[block] && !xd->lossless[mbmi->segment_id])
- av1_optimize_b(cm, x, plane, block, tx_size, coeff_ctx);
+ av1_optimize_b(cm, x, plane, block, plane_bsize, tx_size, a, l);
if (!is_inter_block(mbmi)) {
// intra mode needs decoded result such that the next transform block
// can use it for prediction.
diff --git a/third_party/aom/av1/encoder/encodetxb.h b/third_party/aom/av1/encoder/encodetxb.h
index 552d47b54..836033a54 100644
--- a/third_party/aom/av1/encoder/encodetxb.h
+++ b/third_party/aom/av1/encoder/encodetxb.h
@@ -22,6 +22,47 @@
#ifdef __cplusplus
extern "C" {
#endif
+
+typedef struct TxbInfo {
+ tran_low_t *qcoeff;
+ tran_low_t *dqcoeff;
+ const tran_low_t *tcoeff;
+ const int16_t *dequant;
+ int shift;
+ TX_SIZE tx_size;
+ int bwl;
+ int stride;
+ int eob;
+ int seg_eob;
+ const SCAN_ORDER *scan_order;
+ TXB_CTX *txb_ctx;
+ int64_t rdmult;
+ int64_t rddiv;
+} TxbInfo;
+
+typedef struct TxbCache {
+ int nz_count_arr[MAX_TX_SQUARE];
+ int nz_ctx_arr[MAX_TX_SQUARE][2];
+ int base_count_arr[NUM_BASE_LEVELS][MAX_TX_SQUARE];
+ int base_mag_arr[MAX_TX_SQUARE]
+ [2]; // [0]: max magnitude [1]: num of max magnitude
+ int base_ctx_arr[NUM_BASE_LEVELS][MAX_TX_SQUARE][2]; // [1]: not used
+
+ int br_count_arr[MAX_TX_SQUARE];
+ int br_mag_arr[MAX_TX_SQUARE]
+ [2]; // [0]: max magnitude [1]: num of max magnitude
+ int br_ctx_arr[MAX_TX_SQUARE][2]; // [1]: not used
+} TxbCache;
+
+typedef struct TxbProbs {
+ const aom_prob *dc_sign_prob;
+ const aom_prob *nz_map;
+ aom_prob (*coeff_base)[COEFF_BASE_CONTEXTS];
+ const aom_prob *coeff_lps;
+ const aom_prob *eob_flag;
+ const aom_prob *txb_skip;
+} TxbProbs;
+
void av1_alloc_txb_buf(AV1_COMP *cpi);
void av1_free_txb_buf(AV1_COMP *cpi);
int av1_cost_coeffs_txb(const AV1_COMP *const cpi, MACROBLOCK *x, int plane,
@@ -39,6 +80,14 @@ void av1_update_txb_context(const AV1_COMP *cpi, ThreadData *td,
const int mi_row, const int mi_col);
void av1_write_txb_probs(AV1_COMP *cpi, aom_writer *w);
+void av1_update_txb_context_b(int plane, int block, int blk_row, int blk_col,
+ BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
+ void *arg);
+
+void av1_update_and_record_txb_context(int plane, int block, int blk_row,
+ int blk_col, BLOCK_SIZE plane_bsize,
+ TX_SIZE tx_size, void *arg);
+
#if CONFIG_TXK_SEL
int64_t av1_search_txk_type(const AV1_COMP *cpi, MACROBLOCK *x, int plane,
int block, int blk_row, int blk_col,
@@ -46,6 +95,8 @@ int64_t av1_search_txk_type(const AV1_COMP *cpi, MACROBLOCK *x, int plane,
const ENTROPY_CONTEXT *a, const ENTROPY_CONTEXT *l,
int use_fast_coef_costing, RD_STATS *rd_stats);
#endif
+int av1_optimize_txb(const AV1_COMMON *cm, MACROBLOCK *x, int plane, int block,
+ TX_SIZE tx_size, TXB_CTX *txb_ctx);
#ifdef __cplusplus
}
#endif
diff --git a/third_party/aom/av1/encoder/ethread.c b/third_party/aom/av1/encoder/ethread.c
index 34f0b9566..7af5f78b6 100644
--- a/third_party/aom/av1/encoder/ethread.c
+++ b/third_party/aom/av1/encoder/ethread.c
@@ -93,14 +93,42 @@ void av1_encode_tiles_mt(AV1_COMP *cpi) {
thread_data->td->pc_tree = NULL;
av1_setup_pc_tree(cm, thread_data->td);
- // Set up variance tree if needed.
- if (cpi->sf.partition_search_type == VAR_BASED_PARTITION)
- av1_setup_var_tree(cm, thread_data->td);
-
+#if CONFIG_MOTION_VAR
+#if CONFIG_HIGHBITDEPTH
+ int buf_scaler = 2;
+#else
+ int buf_scaler = 1;
+#endif
+ CHECK_MEM_ERROR(cm, thread_data->td->above_pred_buf,
+ (uint8_t *)aom_memalign(
+ 16, buf_scaler * MAX_MB_PLANE * MAX_SB_SQUARE *
+ sizeof(*thread_data->td->above_pred_buf)));
+ CHECK_MEM_ERROR(cm, thread_data->td->left_pred_buf,
+ (uint8_t *)aom_memalign(
+ 16, buf_scaler * MAX_MB_PLANE * MAX_SB_SQUARE *
+ sizeof(*thread_data->td->left_pred_buf)));
+ CHECK_MEM_ERROR(
+ cm, thread_data->td->wsrc_buf,
+ (int32_t *)aom_memalign(
+ 16, MAX_SB_SQUARE * sizeof(*thread_data->td->wsrc_buf)));
+ CHECK_MEM_ERROR(
+ cm, thread_data->td->mask_buf,
+ (int32_t *)aom_memalign(
+ 16, MAX_SB_SQUARE * sizeof(*thread_data->td->mask_buf)));
+#endif
// Allocate frame counters in thread data.
CHECK_MEM_ERROR(cm, thread_data->td->counts,
aom_calloc(1, sizeof(*thread_data->td->counts)));
+#if CONFIG_PALETTE
+ // Allocate buffers used by palette coding mode.
+ if (cpi->common.allow_screen_content_tools) {
+ CHECK_MEM_ERROR(
+ cm, thread_data->td->palette_buffer,
+ aom_memalign(16, sizeof(*thread_data->td->palette_buffer)));
+ }
+#endif // CONFIG_PALETTE
+
// Create threads
if (!winterface->reset(worker))
aom_internal_error(&cm->error, AOM_CODEC_ERROR,
@@ -127,6 +155,12 @@ void av1_encode_tiles_mt(AV1_COMP *cpi) {
if (thread_data->td != &cpi->td) {
thread_data->td->mb = cpi->td.mb;
thread_data->td->rd_counts = cpi->td.rd_counts;
+#if CONFIG_MOTION_VAR
+ thread_data->td->mb.above_pred_buf = thread_data->td->above_pred_buf;
+ thread_data->td->mb.left_pred_buf = thread_data->td->left_pred_buf;
+ thread_data->td->mb.wsrc_buf = thread_data->td->wsrc_buf;
+ thread_data->td->mb.mask_buf = thread_data->td->mask_buf;
+#endif
}
if (thread_data->td->counts != &cpi->common.counts) {
memcpy(thread_data->td->counts, &cpi->common.counts,
@@ -134,12 +168,8 @@ void av1_encode_tiles_mt(AV1_COMP *cpi) {
}
#if CONFIG_PALETTE
- // Allocate buffers used by palette coding mode.
- if (cpi->common.allow_screen_content_tools && i < num_workers - 1) {
- MACROBLOCK *x = &thread_data->td->mb;
- CHECK_MEM_ERROR(cm, x->palette_buffer,
- aom_memalign(16, sizeof(*x->palette_buffer)));
- }
+ if (cpi->common.allow_screen_content_tools && i < num_workers - 1)
+ thread_data->td->mb.palette_buffer = thread_data->td->palette_buffer;
#endif // CONFIG_PALETTE
}
@@ -171,6 +201,9 @@ void av1_encode_tiles_mt(AV1_COMP *cpi) {
if (i < cpi->num_workers - 1) {
av1_accumulate_frame_counts(&cm->counts, thread_data->td->counts);
accumulate_rd_opt(&cpi->td, thread_data->td);
+#if CONFIG_VAR_TX
+ cpi->td.mb.txb_split_count += thread_data->td->mb.txb_split_count;
+#endif
}
}
}
diff --git a/third_party/aom/av1/encoder/firstpass.c b/third_party/aom/av1/encoder/firstpass.c
index e35a54ef2..7a0abba2d 100644
--- a/third_party/aom/av1/encoder/firstpass.c
+++ b/third_party/aom/av1/encoder/firstpass.c
@@ -568,16 +568,11 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) {
od_init_qm(x->daala_enc.state.qm, x->daala_enc.state.qm_inv,
x->daala_enc.qm == OD_HVS_QM ? OD_QM8_Q4_HVS : OD_QM8_Q4_FLAT);
-#if CONFIG_DAALA_EC
+#if !CONFIG_ANS
od_ec_enc_init(&x->daala_enc.w.ec, 65025);
-#else
-#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
-#endif
-
-#if CONFIG_DAALA_EC
od_ec_enc_reset(&x->daala_enc.w.ec);
#else
-#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
+#error "CONFIG_PVQ currently requires !CONFIG_ANS."
#endif
}
#endif
@@ -598,6 +593,7 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) {
av1_init_mv_probs(cm);
#if CONFIG_ADAPT_SCAN
av1_init_scan_order(cm);
+ av1_deliver_eob_threshold(cm, xd);
#endif
av1_convolve_init(cm);
#if CONFIG_PVQ
@@ -884,7 +880,7 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) {
xd->mi[0]->mbmi.tx_size = TX_4X4;
xd->mi[0]->mbmi.ref_frame[0] = LAST_FRAME;
xd->mi[0]->mbmi.ref_frame[1] = NONE_FRAME;
- av1_build_inter_predictors_sby(xd, mb_row * mb_scale,
+ av1_build_inter_predictors_sby(cm, xd, mb_row * mb_scale,
mb_col * mb_scale, NULL, bsize);
av1_encode_sby_pass1(cm, x, bsize);
sum_mvr += mv.row;
@@ -997,10 +993,10 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) {
}
#if CONFIG_PVQ
-#if CONFIG_DAALA_EC
+#if !CONFIG_ANS
od_ec_enc_clear(&x->daala_enc.w.ec);
#else
-#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
+#error "CONFIG_PVQ currently requires !CONFIG_ANS."
#endif
x->pvq_q->last_pos = x->pvq_q->curr_pos;
@@ -1235,28 +1231,26 @@ static void setup_rf_level_maxq(AV1_COMP *cpi) {
}
}
-void av1_init_subsampling(AV1_COMP *cpi) {
- const AV1_COMMON *const cm = &cpi->common;
- RATE_CONTROL *const rc = &cpi->rc;
- const int w = cm->width;
- const int h = cm->height;
- int i;
-
- for (i = 0; i < FRAME_SCALE_STEPS; ++i) {
- // Note: Frames with odd-sized dimensions may result from this scaling.
- rc->frame_width[i] = (w * 16) / frame_scale_factor[i];
- rc->frame_height[i] = (h * 16) / frame_scale_factor[i];
- }
-
- setup_rf_level_maxq(cpi);
+void av1_calculate_next_scaled_size(const AV1_COMP *cpi,
+ int *scaled_frame_width,
+ int *scaled_frame_height) {
+ *scaled_frame_width =
+ cpi->oxcf.width * cpi->resize_next_scale_num / cpi->resize_next_scale_den;
+ *scaled_frame_height = cpi->oxcf.height * cpi->resize_next_scale_num /
+ cpi->resize_next_scale_den;
}
-void av1_calculate_coded_size(AV1_COMP *cpi, int *scaled_frame_width,
- int *scaled_frame_height) {
- RATE_CONTROL *const rc = &cpi->rc;
- *scaled_frame_width = rc->frame_width[rc->frame_size_selector];
- *scaled_frame_height = rc->frame_height[rc->frame_size_selector];
+#if CONFIG_FRAME_SUPERRES
+void av1_calculate_superres_size(const AV1_COMP *cpi, int *encoded_width,
+ int *encoded_height) {
+ *encoded_width = cpi->oxcf.scaled_frame_width *
+ cpi->common.superres_scale_numerator /
+ SUPERRES_SCALE_DENOMINATOR;
+ *encoded_height = cpi->oxcf.scaled_frame_height *
+ cpi->common.superres_scale_numerator /
+ SUPERRES_SCALE_DENOMINATOR;
}
+#endif // CONFIG_FRAME_SUPERRES
void av1_init_second_pass(AV1_COMP *cpi) {
const AV1EncoderConfig *const oxcf = &cpi->oxcf;
@@ -1316,7 +1310,7 @@ void av1_init_second_pass(AV1_COMP *cpi) {
twopass->last_kfgroup_zeromotion_pct = 100;
if (oxcf->resize_mode != RESIZE_NONE) {
- av1_init_subsampling(cpi);
+ setup_rf_level_maxq(cpi);
}
}
@@ -2300,7 +2294,8 @@ static void define_gf_group(AV1_COMP *cpi, FIRSTPASS_STATS *this_frame) {
if (oxcf->resize_mode == RESIZE_DYNAMIC) {
// Default to starting GF groups at normal frame size.
- cpi->rc.next_frame_size_selector = UNSCALED;
+ // TODO(afergs): Make a function for this
+ cpi->resize_next_scale_num = cpi->resize_next_scale_den;
}
}
@@ -2646,7 +2641,8 @@ static void find_next_key_frame(AV1_COMP *cpi, FIRSTPASS_STATS *this_frame) {
if (oxcf->resize_mode == RESIZE_DYNAMIC) {
// Default to normal-sized frame on keyframes.
- cpi->rc.next_frame_size_selector = UNSCALED;
+ // TODO(afergs): Make a function for this
+ cpi->resize_next_scale_num = cpi->resize_next_scale_den;
}
}
diff --git a/third_party/aom/av1/encoder/firstpass.h b/third_party/aom/av1/encoder/firstpass.h
index db459cc22..43104454c 100644
--- a/third_party/aom/av1/encoder/firstpass.h
+++ b/third_party/aom/av1/encoder/firstpass.h
@@ -177,10 +177,17 @@ void av1_twopass_postencode_update(struct AV1_COMP *cpi);
// Post encode update of the rate control parameters for 2-pass
void av1_twopass_postencode_update(struct AV1_COMP *cpi);
-void av1_init_subsampling(struct AV1_COMP *cpi);
-
-void av1_calculate_coded_size(struct AV1_COMP *cpi, int *scaled_frame_width,
- int *scaled_frame_height);
+void av1_calculate_next_scaled_size(const struct AV1_COMP *cpi,
+ int *scaled_frame_width,
+ int *scaled_frame_height);
+
+#if CONFIG_FRAME_SUPERRES
+// This is the size after superress scaling, which could be 1:1.
+// Superres scaling happens after regular downscaling.
+// TODO(afergs): Limit overall reduction to 1/2 of the original size
+void av1_calculate_superres_size(const struct AV1_COMP *cpi, int *encoded_width,
+ int *encoded_height);
+#endif // CONFIG_FRAME_SUPERRES
#if CONFIG_EXT_REFS
static INLINE int get_number_of_extra_arfs(int interval, int arf_pending) {
diff --git a/third_party/aom/av1/encoder/global_motion.c b/third_party/aom/av1/encoder/global_motion.c
index 2a6204939..74cbc8ae7 100644
--- a/third_party/aom/av1/encoder/global_motion.c
+++ b/third_party/aom/av1/encoder/global_motion.c
@@ -124,14 +124,15 @@ static void force_wmtype(WarpedMotionParams *wm, TransformationType wmtype) {
wm->wmtype = wmtype;
}
-double refine_integerized_param(WarpedMotionParams *wm,
- TransformationType wmtype,
+int64_t refine_integerized_param(WarpedMotionParams *wm,
+ TransformationType wmtype,
#if CONFIG_HIGHBITDEPTH
- int use_hbd, int bd,
+ int use_hbd, int bd,
#endif // CONFIG_HIGHBITDEPTH
- uint8_t *ref, int r_width, int r_height,
- int r_stride, uint8_t *dst, int d_width,
- int d_height, int d_stride, int n_refinements) {
+ uint8_t *ref, int r_width, int r_height,
+ int r_stride, uint8_t *dst, int d_width,
+ int d_height, int d_stride,
+ int n_refinements) {
static const int max_trans_model_params[TRANS_TYPES] = {
0, 2, 4, 6, 8, 8, 8
};
@@ -139,22 +140,21 @@ double refine_integerized_param(WarpedMotionParams *wm,
int i = 0, p;
int n_params = max_trans_model_params[wmtype];
int32_t *param_mat = wm->wmmat;
- double step_error;
+ int64_t step_error, best_error;
int32_t step;
int32_t *param;
int32_t curr_param;
int32_t best_param;
- double best_error;
force_wmtype(wm, wmtype);
- best_error = av1_warp_erroradv(wm,
+ best_error = av1_warp_error(wm,
#if CONFIG_HIGHBITDEPTH
- use_hbd, bd,
+ use_hbd, bd,
#endif // CONFIG_HIGHBITDEPTH
- ref, r_width, r_height, r_stride,
- dst + border * d_stride + border, border,
- border, d_width - 2 * border,
- d_height - 2 * border, d_stride, 0, 0, 16, 16);
+ ref, r_width, r_height, r_stride,
+ dst + border * d_stride + border, border, border,
+ d_width - 2 * border, d_height - 2 * border,
+ d_stride, 0, 0, 16, 16);
step = 1 << (n_refinements + 1);
for (i = 0; i < n_refinements; i++, step >>= 1) {
for (p = 0; p < n_params; ++p) {
@@ -167,7 +167,7 @@ double refine_integerized_param(WarpedMotionParams *wm,
best_param = curr_param;
// look to the left
*param = add_param_offset(p, curr_param, -step);
- step_error = av1_warp_erroradv(
+ step_error = av1_warp_error(
wm,
#if CONFIG_HIGHBITDEPTH
use_hbd, bd,
@@ -183,7 +183,7 @@ double refine_integerized_param(WarpedMotionParams *wm,
// look to the right
*param = add_param_offset(p, curr_param, step);
- step_error = av1_warp_erroradv(
+ step_error = av1_warp_error(
wm,
#if CONFIG_HIGHBITDEPTH
use_hbd, bd,
@@ -202,7 +202,7 @@ double refine_integerized_param(WarpedMotionParams *wm,
// for the biggest step size
while (step_dir) {
*param = add_param_offset(p, best_param, step * step_dir);
- step_error = av1_warp_erroradv(
+ step_error = av1_warp_error(
wm,
#if CONFIG_HIGHBITDEPTH
use_hbd, bd,
diff --git a/third_party/aom/av1/encoder/global_motion.h b/third_party/aom/av1/encoder/global_motion.h
index 8fc757f38..38509df6a 100644
--- a/third_party/aom/av1/encoder/global_motion.h
+++ b/third_party/aom/av1/encoder/global_motion.h
@@ -26,14 +26,17 @@ void convert_model_to_params(const double *params, WarpedMotionParams *model);
int is_enough_erroradvantage(double erroradv, int params_cost);
-double refine_integerized_param(WarpedMotionParams *wm,
- TransformationType wmtype,
+// Returns the av1_warp_error between "dst" and the result of applying the
+// motion params that result from fine-tuning "wm" to "ref". Note that "wm" is
+// modified in place.
+int64_t refine_integerized_param(WarpedMotionParams *wm,
+ TransformationType wmtype,
#if CONFIG_HIGHBITDEPTH
- int use_hbd, int bd,
+ int use_hbd, int bd,
#endif // CONFIG_HIGHBITDEPTH
- uint8_t *ref, int r_width, int r_height,
- int r_stride, uint8_t *dst, int d_width,
- int d_height, int d_stride, int n_refinements);
+ uint8_t *ref, int r_width, int r_height,
+ int r_stride, uint8_t *dst, int d_width,
+ int d_height, int d_stride, int n_refinements);
/*
Computes "num_motions" candidate global motion parameters between two frames.
diff --git a/third_party/aom/av1/encoder/hybrid_fwd_txfm.c b/third_party/aom/av1/encoder/hybrid_fwd_txfm.c
index 4fd563163..c57deed84 100644
--- a/third_party/aom/av1/encoder/hybrid_fwd_txfm.c
+++ b/third_party/aom/av1/encoder/hybrid_fwd_txfm.c
@@ -16,7 +16,7 @@
#include "av1/common/idct.h"
#include "av1/encoder/hybrid_fwd_txfm.h"
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
static void fwd_txfm_2x2(const int16_t *src_diff, tran_low_t *coeff,
int diff_stride, TX_TYPE tx_type, int lossless) {
tran_high_t a1 = src_diff[0];
@@ -132,8 +132,38 @@ static void fwd_txfm_64x64(const int16_t *src_diff, tran_low_t *coeff,
}
#endif // CONFIG_TX64X64
+#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
+static void fwd_txfm_16x4(const int16_t *src_diff, tran_low_t *coeff,
+ int diff_stride, TX_TYPE tx_type,
+ FWD_TXFM_OPT fwd_txfm_opt) {
+ (void)fwd_txfm_opt;
+ av1_fht16x4(src_diff, coeff, diff_stride, tx_type);
+}
+
+static void fwd_txfm_4x16(const int16_t *src_diff, tran_low_t *coeff,
+ int diff_stride, TX_TYPE tx_type,
+ FWD_TXFM_OPT fwd_txfm_opt) {
+ (void)fwd_txfm_opt;
+ av1_fht4x16(src_diff, coeff, diff_stride, tx_type);
+}
+
+static void fwd_txfm_32x8(const int16_t *src_diff, tran_low_t *coeff,
+ int diff_stride, TX_TYPE tx_type,
+ FWD_TXFM_OPT fwd_txfm_opt) {
+ (void)fwd_txfm_opt;
+ av1_fht32x8(src_diff, coeff, diff_stride, tx_type);
+}
+
+static void fwd_txfm_8x32(const int16_t *src_diff, tran_low_t *coeff,
+ int diff_stride, TX_TYPE tx_type,
+ FWD_TXFM_OPT fwd_txfm_opt) {
+ (void)fwd_txfm_opt;
+ av1_fht8x32(src_diff, coeff, diff_stride, tx_type);
+}
+#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
+
#if CONFIG_HIGHBITDEPTH
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
static void highbd_fwd_txfm_2x2(const int16_t *src_diff, tran_low_t *coeff,
int diff_stride, TX_TYPE tx_type, int lossless,
const int bd) {
@@ -425,11 +455,25 @@ void av1_fwd_txfm(const int16_t *src_diff, tran_low_t *coeff, int diff_stride,
case TX_4X4:
fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type, lossless);
break;
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
case TX_2X2:
fwd_txfm_2x2(src_diff, coeff, diff_stride, tx_type, lossless);
break;
#endif
+#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
+ case TX_4X16:
+ fwd_txfm_4x16(src_diff, coeff, diff_stride, tx_type, fwd_txfm_opt);
+ break;
+ case TX_16X4:
+ fwd_txfm_16x4(src_diff, coeff, diff_stride, tx_type, fwd_txfm_opt);
+ break;
+ case TX_8X32:
+ fwd_txfm_8x32(src_diff, coeff, diff_stride, tx_type, fwd_txfm_opt);
+ break;
+ case TX_32X8:
+ fwd_txfm_32x8(src_diff, coeff, diff_stride, tx_type, fwd_txfm_opt);
+ break;
+#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
default: assert(0); break;
}
}
@@ -488,7 +532,7 @@ void av1_highbd_fwd_txfm(const int16_t *src_diff, tran_low_t *coeff,
case TX_4X4:
highbd_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type, lossless, bd);
break;
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
case TX_2X2:
highbd_fwd_txfm_2x2(src_diff, coeff, diff_stride, tx_type, lossless, bd);
break;
diff --git a/third_party/aom/av1/encoder/mathutils.h b/third_party/aom/av1/encoder/mathutils.h
new file mode 100644
index 000000000..23243dd9e
--- /dev/null
+++ b/third_party/aom/av1/encoder/mathutils.h
@@ -0,0 +1,354 @@
+/*
+ * 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.
+ */
+
+#include <memory.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+static const double TINY_NEAR_ZERO = 1.0E-16;
+
+// Solves Ax = b, where x and b are column vectors of size nx1 and A is nxn
+static INLINE int linsolve(int n, double *A, int stride, double *b, double *x) {
+ int i, j, k;
+ double c;
+ // Forward elimination
+ for (k = 0; k < n - 1; k++) {
+ // Bring the largest magitude to the diagonal position
+ for (i = n - 1; i > k; i--) {
+ if (fabs(A[(i - 1) * stride + k]) < fabs(A[i * stride + k])) {
+ for (j = 0; j < n; j++) {
+ c = A[i * stride + j];
+ A[i * stride + j] = A[(i - 1) * stride + j];
+ A[(i - 1) * stride + j] = c;
+ }
+ c = b[i];
+ b[i] = b[i - 1];
+ b[i - 1] = c;
+ }
+ }
+ for (i = k; i < n - 1; i++) {
+ if (fabs(A[k * stride + k]) < TINY_NEAR_ZERO) return 0;
+ c = A[(i + 1) * stride + k] / A[k * stride + k];
+ for (j = 0; j < n; j++) A[(i + 1) * stride + j] -= c * A[k * stride + j];
+ b[i + 1] -= c * b[k];
+ }
+ }
+ // Backward substitution
+ for (i = n - 1; i >= 0; i--) {
+ if (fabs(A[i * stride + i]) < TINY_NEAR_ZERO) return 0;
+ c = 0;
+ for (j = i + 1; j <= n - 1; j++) c += A[i * stride + j] * x[j];
+ x[i] = (b[i] - c) / A[i * stride + i];
+ }
+
+ return 1;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Least-squares
+// Solves for n-dim x in a least squares sense to minimize |Ax - b|^2
+// The solution is simply x = (A'A)^-1 A'b or simply the solution for
+// the system: A'A x = A'b
+static INLINE int least_squares(int n, double *A, int rows, int stride,
+ double *b, double *scratch, double *x) {
+ int i, j, k;
+ double *scratch_ = NULL;
+ double *AtA, *Atb;
+ if (!scratch) {
+ scratch_ = (double *)aom_malloc(sizeof(*scratch) * n * (n + 1));
+ scratch = scratch_;
+ }
+ AtA = scratch;
+ Atb = scratch + n * n;
+
+ for (i = 0; i < n; ++i) {
+ for (j = i; j < n; ++j) {
+ AtA[i * n + j] = 0.0;
+ for (k = 0; k < rows; ++k)
+ AtA[i * n + j] += A[k * stride + i] * A[k * stride + j];
+ AtA[j * n + i] = AtA[i * n + j];
+ }
+ Atb[i] = 0;
+ for (k = 0; k < rows; ++k) Atb[i] += A[k * stride + i] * b[k];
+ }
+ int ret = linsolve(n, AtA, n, Atb, x);
+ if (scratch_) aom_free(scratch_);
+ return ret;
+}
+
+// Matrix multiply
+static INLINE void multiply_mat(const double *m1, const double *m2, double *res,
+ const int m1_rows, const int inner_dim,
+ const int m2_cols) {
+ double sum;
+
+ int row, col, inner;
+ for (row = 0; row < m1_rows; ++row) {
+ for (col = 0; col < m2_cols; ++col) {
+ sum = 0;
+ for (inner = 0; inner < inner_dim; ++inner)
+ sum += m1[row * inner_dim + inner] * m2[inner * m2_cols + col];
+ *(res++) = sum;
+ }
+ }
+}
+
+//
+// The functions below are needed only for homography computation
+// Remove if the homography models are not used.
+//
+///////////////////////////////////////////////////////////////////////////////
+// svdcmp
+// Adopted from Numerical Recipes in C
+
+static INLINE double sign(double a, double b) {
+ return ((b) >= 0 ? fabs(a) : -fabs(a));
+}
+
+static INLINE double pythag(double a, double b) {
+ double ct;
+ const double absa = fabs(a);
+ const double absb = fabs(b);
+
+ if (absa > absb) {
+ ct = absb / absa;
+ return absa * sqrt(1.0 + ct * ct);
+ } else {
+ ct = absa / absb;
+ return (absb == 0) ? 0 : absb * sqrt(1.0 + ct * ct);
+ }
+}
+
+static INLINE int svdcmp(double **u, int m, int n, double w[], double **v) {
+ const int max_its = 30;
+ int flag, i, its, j, jj, k, l, nm;
+ double anorm, c, f, g, h, s, scale, x, y, z;
+ double *rv1 = (double *)aom_malloc(sizeof(*rv1) * (n + 1));
+ g = scale = anorm = 0.0;
+ for (i = 0; i < n; i++) {
+ l = i + 1;
+ rv1[i] = scale * g;
+ g = s = scale = 0.0;
+ if (i < m) {
+ for (k = i; k < m; k++) scale += fabs(u[k][i]);
+ if (scale != 0.) {
+ for (k = i; k < m; k++) {
+ u[k][i] /= scale;
+ s += u[k][i] * u[k][i];
+ }
+ f = u[i][i];
+ g = -sign(sqrt(s), f);
+ h = f * g - s;
+ u[i][i] = f - g;
+ for (j = l; j < n; j++) {
+ for (s = 0.0, k = i; k < m; k++) s += u[k][i] * u[k][j];
+ f = s / h;
+ for (k = i; k < m; k++) u[k][j] += f * u[k][i];
+ }
+ for (k = i; k < m; k++) u[k][i] *= scale;
+ }
+ }
+ w[i] = scale * g;
+ g = s = scale = 0.0;
+ if (i < m && i != n - 1) {
+ for (k = l; k < n; k++) scale += fabs(u[i][k]);
+ if (scale != 0.) {
+ for (k = l; k < n; k++) {
+ u[i][k] /= scale;
+ s += u[i][k] * u[i][k];
+ }
+ f = u[i][l];
+ g = -sign(sqrt(s), f);
+ h = f * g - s;
+ u[i][l] = f - g;
+ for (k = l; k < n; k++) rv1[k] = u[i][k] / h;
+ for (j = l; j < m; j++) {
+ for (s = 0.0, k = l; k < n; k++) s += u[j][k] * u[i][k];
+ for (k = l; k < n; k++) u[j][k] += s * rv1[k];
+ }
+ for (k = l; k < n; k++) u[i][k] *= scale;
+ }
+ }
+ anorm = fmax(anorm, (fabs(w[i]) + fabs(rv1[i])));
+ }
+
+ for (i = n - 1; i >= 0; i--) {
+ if (i < n - 1) {
+ if (g != 0.) {
+ for (j = l; j < n; j++) v[j][i] = (u[i][j] / u[i][l]) / g;
+ for (j = l; j < n; j++) {
+ for (s = 0.0, k = l; k < n; k++) s += u[i][k] * v[k][j];
+ for (k = l; k < n; k++) v[k][j] += s * v[k][i];
+ }
+ }
+ for (j = l; j < n; j++) v[i][j] = v[j][i] = 0.0;
+ }
+ v[i][i] = 1.0;
+ g = rv1[i];
+ l = i;
+ }
+ for (i = AOMMIN(m, n) - 1; i >= 0; i--) {
+ l = i + 1;
+ g = w[i];
+ for (j = l; j < n; j++) u[i][j] = 0.0;
+ if (g != 0.) {
+ g = 1.0 / g;
+ for (j = l; j < n; j++) {
+ for (s = 0.0, k = l; k < m; k++) s += u[k][i] * u[k][j];
+ f = (s / u[i][i]) * g;
+ for (k = i; k < m; k++) u[k][j] += f * u[k][i];
+ }
+ for (j = i; j < m; j++) u[j][i] *= g;
+ } else {
+ for (j = i; j < m; j++) u[j][i] = 0.0;
+ }
+ ++u[i][i];
+ }
+ for (k = n - 1; k >= 0; k--) {
+ for (its = 0; its < max_its; its++) {
+ flag = 1;
+ for (l = k; l >= 0; l--) {
+ nm = l - 1;
+ if ((double)(fabs(rv1[l]) + anorm) == anorm || nm < 0) {
+ flag = 0;
+ break;
+ }
+ if ((double)(fabs(w[nm]) + anorm) == anorm) break;
+ }
+ if (flag) {
+ c = 0.0;
+ s = 1.0;
+ for (i = l; i <= k; i++) {
+ f = s * rv1[i];
+ rv1[i] = c * rv1[i];
+ if ((double)(fabs(f) + anorm) == anorm) break;
+ g = w[i];
+ h = pythag(f, g);
+ w[i] = h;
+ h = 1.0 / h;
+ c = g * h;
+ s = -f * h;
+ for (j = 0; j < m; j++) {
+ y = u[j][nm];
+ z = u[j][i];
+ u[j][nm] = y * c + z * s;
+ u[j][i] = z * c - y * s;
+ }
+ }
+ }
+ z = w[k];
+ if (l == k) {
+ if (z < 0.0) {
+ w[k] = -z;
+ for (j = 0; j < n; j++) v[j][k] = -v[j][k];
+ }
+ break;
+ }
+ if (its == max_its - 1) {
+ aom_free(rv1);
+ return 1;
+ }
+ assert(k > 0);
+ x = w[l];
+ nm = k - 1;
+ y = w[nm];
+ g = rv1[nm];
+ h = rv1[k];
+ f = ((y - z) * (y + z) + (g - h) * (g + h)) / (2.0 * h * y);
+ g = pythag(f, 1.0);
+ f = ((x - z) * (x + z) + h * ((y / (f + sign(g, f))) - h)) / x;
+ c = s = 1.0;
+ for (j = l; j <= nm; j++) {
+ i = j + 1;
+ g = rv1[i];
+ y = w[i];
+ h = s * g;
+ g = c * g;
+ z = pythag(f, h);
+ rv1[j] = z;
+ c = f / z;
+ s = h / z;
+ f = x * c + g * s;
+ g = g * c - x * s;
+ h = y * s;
+ y *= c;
+ for (jj = 0; jj < n; jj++) {
+ x = v[jj][j];
+ z = v[jj][i];
+ v[jj][j] = x * c + z * s;
+ v[jj][i] = z * c - x * s;
+ }
+ z = pythag(f, h);
+ w[j] = z;
+ if (z != 0.) {
+ z = 1.0 / z;
+ c = f * z;
+ s = h * z;
+ }
+ f = c * g + s * y;
+ x = c * y - s * g;
+ for (jj = 0; jj < m; jj++) {
+ y = u[jj][j];
+ z = u[jj][i];
+ u[jj][j] = y * c + z * s;
+ u[jj][i] = z * c - y * s;
+ }
+ }
+ rv1[l] = 0.0;
+ rv1[k] = f;
+ w[k] = x;
+ }
+ }
+ aom_free(rv1);
+ return 0;
+}
+
+static INLINE int SVD(double *U, double *W, double *V, double *matx, int M,
+ int N) {
+ // Assumes allocation for U is MxN
+ double **nrU = (double **)aom_malloc((M) * sizeof(*nrU));
+ double **nrV = (double **)aom_malloc((N) * sizeof(*nrV));
+ int problem, i;
+
+ problem = !(nrU && nrV);
+ if (!problem) {
+ for (i = 0; i < M; i++) {
+ nrU[i] = &U[i * N];
+ }
+ for (i = 0; i < N; i++) {
+ nrV[i] = &V[i * N];
+ }
+ } else {
+ if (nrU) aom_free(nrU);
+ if (nrV) aom_free(nrV);
+ return 1;
+ }
+
+ /* copy from given matx into nrU */
+ for (i = 0; i < M; i++) {
+ memcpy(&(nrU[i][0]), matx + N * i, N * sizeof(*matx));
+ }
+
+ /* HERE IT IS: do SVD */
+ if (svdcmp(nrU, M, N, W, nrV)) {
+ aom_free(nrU);
+ aom_free(nrV);
+ return 1;
+ }
+
+ /* aom_free Numerical Recipes arrays */
+ aom_free(nrU);
+ aom_free(nrV);
+
+ return 0;
+}
diff --git a/third_party/aom/av1/encoder/mbgraph.c b/third_party/aom/av1/encoder/mbgraph.c
index 1296027dc..3f5daebcc 100644
--- a/third_party/aom/av1/encoder/mbgraph.c
+++ b/third_party/aom/av1/encoder/mbgraph.c
@@ -52,11 +52,14 @@ static unsigned int do_16x16_motion_iteration(AV1_COMP *cpi, const MV *ref_mv,
{
int distortion;
unsigned int sse;
- cpi->find_fractional_mv_step(x, ref_mv, cpi->common.allow_high_precision_mv,
- x->errorperbit, &v_fn_ptr, 0,
- mv_sf->subpel_iters_per_step,
- cond_cost_list(cpi, cost_list), NULL, NULL,
- &distortion, &sse, NULL, 0, 0, 0);
+ cpi->find_fractional_mv_step(
+ x, ref_mv, cpi->common.allow_high_precision_mv, x->errorperbit,
+ &v_fn_ptr, 0, mv_sf->subpel_iters_per_step,
+ cond_cost_list(cpi, cost_list), NULL, NULL, &distortion, &sse, NULL,
+#if CONFIG_EXT_INTER
+ NULL, 0, 0,
+#endif
+ 0, 0, 0);
}
#if CONFIG_EXT_INTER
@@ -71,7 +74,8 @@ static unsigned int do_16x16_motion_iteration(AV1_COMP *cpi, const MV *ref_mv,
xd->mi[0]->mbmi.ref_frame[1] = NONE_FRAME;
#endif // CONFIG_EXT_INTER
- av1_build_inter_predictors_sby(xd, mb_row, mb_col, NULL, BLOCK_16X16);
+ av1_build_inter_predictors_sby(&cpi->common, xd, mb_row, mb_col, NULL,
+ BLOCK_16X16);
/* restore UMV window */
x->mv_limits = tmp_mv_limits;
diff --git a/third_party/aom/av1/encoder/mcomp.c b/third_party/aom/av1/encoder/mcomp.c
index d069eefb0..52080ca0d 100644
--- a/third_party/aom/av1/encoder/mcomp.c
+++ b/third_party/aom/av1/encoder/mcomp.c
@@ -110,7 +110,7 @@ static int mvsad_err_cost(const MACROBLOCK *x, const MV *mv, const MV *ref,
int sad_per_bit) {
const MV diff = { (mv->row - ref->row) * 8, (mv->col - ref->col) * 8 };
return ROUND_POWER_OF_TWO(
- (unsigned)mv_cost(&diff, x->nmvjointsadcost, x->mvsadcost) * sad_per_bit,
+ (unsigned)mv_cost(&diff, x->nmvjointcost, x->mvcost) * sad_per_bit,
AV1_PROB_COST_SHIFT);
}
@@ -176,6 +176,7 @@ static INLINE const uint8_t *pre(const uint8_t *buf, int stride, int r, int c) {
}
/* checks if (r, c) has better score than previous best */
+#if CONFIG_EXT_INTER
#define CHECK_BETTER(v, r, c) \
if (c >= minc && c <= maxc && r >= minr && r <= maxr) { \
MV this_mv = { r, c }; \
@@ -183,6 +184,10 @@ static INLINE const uint8_t *pre(const uint8_t *buf, int stride, int r, int c) {
if (second_pred == NULL) \
thismse = vfp->svf(pre(y, y_stride, r, c), y_stride, sp(c), sp(r), \
src_address, src_stride, &sse); \
+ else if (mask) \
+ thismse = vfp->msvf(pre(y, y_stride, r, c), y_stride, sp(c), sp(r), \
+ src_address, src_stride, second_pred, mask, \
+ mask_stride, invert_mask, &sse); \
else \
thismse = vfp->svaf(pre(y, y_stride, r, c), y_stride, sp(c), sp(r), \
src_address, src_stride, &sse, second_pred); \
@@ -197,6 +202,29 @@ static INLINE const uint8_t *pre(const uint8_t *buf, int stride, int r, int c) {
} else { \
v = INT_MAX; \
}
+#else
+#define CHECK_BETTER(v, r, c) \
+ if (c >= minc && c <= maxc && r >= minr && r <= maxr) { \
+ MV this_mv = { r, c }; \
+ v = mv_err_cost(&this_mv, ref_mv, mvjcost, mvcost, error_per_bit); \
+ if (second_pred == NULL) \
+ thismse = vfp->svf(pre(y, y_stride, r, c), y_stride, sp(c), sp(r), \
+ src_address, src_stride, &sse); \
+ else \
+ thismse = vfp->svaf(pre(y, y_stride, r, c), y_stride, sp(c), sp(r), \
+ src_address, src_stride, &sse, second_pred); \
+ v += thismse; \
+ if (v < besterr) { \
+ besterr = v; \
+ br = r; \
+ bc = c; \
+ *distortion = thismse; \
+ *sse1 = sse; \
+ } \
+ } else { \
+ v = INT_MAX; \
+ }
+#endif // CONFIG_EXT_INTER
#define CHECK_BETTER0(v, r, c) CHECK_BETTER(v, r, c)
@@ -206,6 +234,26 @@ static INLINE const uint8_t *upre(const uint8_t *buf, int stride, int r,
}
/* checks if (r, c) has better score than previous best */
+#if CONFIG_EXT_INTER
+#define CHECK_BETTER1(v, r, c) \
+ if (c >= minc && c <= maxc && r >= minr && r <= maxr) { \
+ MV this_mv = { r, c }; \
+ thismse = upsampled_pref_error( \
+ xd, vfp, src_address, src_stride, upre(y, y_stride, r, c), y_stride, \
+ second_pred, mask, mask_stride, invert_mask, w, h, &sse); \
+ v = mv_err_cost(&this_mv, ref_mv, mvjcost, mvcost, error_per_bit); \
+ v += thismse; \
+ if (v < besterr) { \
+ besterr = v; \
+ br = r; \
+ bc = c; \
+ *distortion = thismse; \
+ *sse1 = sse; \
+ } \
+ } else { \
+ v = INT_MAX; \
+ }
+#else
#define CHECK_BETTER1(v, r, c) \
if (c >= minc && c <= maxc && r >= minr && r <= maxr) { \
MV this_mv = { r, c }; \
@@ -224,6 +272,7 @@ static INLINE const uint8_t *upre(const uint8_t *buf, int stride, int r,
} else { \
v = INT_MAX; \
}
+#endif // CONFIG_EXT_INTER
#define FIRST_LEVEL_CHECKS \
{ \
@@ -327,20 +376,36 @@ static unsigned int setup_center_error(
const MACROBLOCKD *xd, const MV *bestmv, const MV *ref_mv,
int error_per_bit, const aom_variance_fn_ptr_t *vfp,
const uint8_t *const src, const int src_stride, const uint8_t *const y,
- int y_stride, const uint8_t *second_pred, int w, int h, int offset,
- int *mvjcost, int *mvcost[2], unsigned int *sse1, int *distortion) {
+ int y_stride, const uint8_t *second_pred,
+#if CONFIG_EXT_INTER
+ const uint8_t *mask, int mask_stride, int invert_mask,
+#endif
+ int w, int h, int offset, int *mvjcost, int *mvcost[2], unsigned int *sse1,
+ int *distortion) {
unsigned int besterr;
#if CONFIG_HIGHBITDEPTH
if (second_pred != NULL) {
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
DECLARE_ALIGNED(16, uint16_t, comp_pred16[MAX_SB_SQUARE]);
- aom_highbd_comp_avg_pred(comp_pred16, second_pred, w, h, y + offset,
- y_stride);
+#if CONFIG_EXT_INTER
+ if (mask)
+ aom_highbd_comp_mask_pred(comp_pred16, second_pred, w, h, y + offset,
+ y_stride, mask, mask_stride, invert_mask);
+ else
+#endif
+ aom_highbd_comp_avg_pred(comp_pred16, second_pred, w, h, y + offset,
+ y_stride);
besterr =
vfp->vf(CONVERT_TO_BYTEPTR(comp_pred16), w, src, src_stride, sse1);
} else {
DECLARE_ALIGNED(16, uint8_t, comp_pred[MAX_SB_SQUARE]);
- aom_comp_avg_pred(comp_pred, second_pred, w, h, y + offset, y_stride);
+#if CONFIG_EXT_INTER
+ if (mask)
+ aom_comp_mask_pred(comp_pred, second_pred, w, h, y + offset, y_stride,
+ mask, mask_stride, invert_mask);
+ else
+#endif
+ aom_comp_avg_pred(comp_pred, second_pred, w, h, y + offset, y_stride);
besterr = vfp->vf(comp_pred, w, src, src_stride, sse1);
}
} else {
@@ -352,7 +417,13 @@ static unsigned int setup_center_error(
(void)xd;
if (second_pred != NULL) {
DECLARE_ALIGNED(16, uint8_t, comp_pred[MAX_SB_SQUARE]);
- aom_comp_avg_pred(comp_pred, second_pred, w, h, y + offset, y_stride);
+#if CONFIG_EXT_INTER
+ if (mask)
+ aom_comp_mask_pred(comp_pred, second_pred, w, h, y + offset, y_stride,
+ mask, mask_stride, invert_mask);
+ else
+#endif
+ aom_comp_avg_pred(comp_pred, second_pred, w, h, y + offset, y_stride);
besterr = vfp->vf(comp_pred, w, src, src_stride, sse1);
} else {
besterr = vfp->vf(y + offset, y_stride, src, src_stride, sse1);
@@ -391,12 +462,19 @@ int av1_find_best_sub_pixel_tree_pruned_evenmore(
MACROBLOCK *x, const MV *ref_mv, int allow_hp, int error_per_bit,
const aom_variance_fn_ptr_t *vfp, int forced_stop, int iters_per_step,
int *cost_list, int *mvjcost, int *mvcost[2], int *distortion,
- unsigned int *sse1, const uint8_t *second_pred, int w, int h,
- int use_upsampled_ref) {
+ unsigned int *sse1, const uint8_t *second_pred,
+#if CONFIG_EXT_INTER
+ const uint8_t *mask, int mask_stride, int invert_mask,
+#endif
+ int w, int h, int use_upsampled_ref) {
SETUP_SUBPEL_SEARCH;
- besterr = setup_center_error(
- xd, bestmv, ref_mv, error_per_bit, vfp, src_address, src_stride, y,
- y_stride, second_pred, w, h, offset, mvjcost, mvcost, sse1, distortion);
+ besterr =
+ setup_center_error(xd, bestmv, ref_mv, error_per_bit, vfp, src_address,
+ src_stride, y, y_stride, second_pred,
+#if CONFIG_EXT_INTER
+ mask, mask_stride, invert_mask,
+#endif
+ w, h, offset, mvjcost, mvcost, sse1, distortion);
(void)halfiters;
(void)quarteriters;
(void)eighthiters;
@@ -457,14 +535,21 @@ int av1_find_best_sub_pixel_tree_pruned_more(
MACROBLOCK *x, const MV *ref_mv, int allow_hp, int error_per_bit,
const aom_variance_fn_ptr_t *vfp, int forced_stop, int iters_per_step,
int *cost_list, int *mvjcost, int *mvcost[2], int *distortion,
- unsigned int *sse1, const uint8_t *second_pred, int w, int h,
- int use_upsampled_ref) {
+ unsigned int *sse1, const uint8_t *second_pred,
+#if CONFIG_EXT_INTER
+ const uint8_t *mask, int mask_stride, int invert_mask,
+#endif
+ int w, int h, int use_upsampled_ref) {
SETUP_SUBPEL_SEARCH;
(void)use_upsampled_ref;
- besterr = setup_center_error(
- xd, bestmv, ref_mv, error_per_bit, vfp, src_address, src_stride, y,
- y_stride, second_pred, w, h, offset, mvjcost, mvcost, sse1, distortion);
+ besterr =
+ setup_center_error(xd, bestmv, ref_mv, error_per_bit, vfp, src_address,
+ src_stride, y, y_stride, second_pred,
+#if CONFIG_EXT_INTER
+ mask, mask_stride, invert_mask,
+#endif
+ w, h, offset, mvjcost, mvcost, sse1, distortion);
if (cost_list && cost_list[0] != INT_MAX && cost_list[1] != INT_MAX &&
cost_list[2] != INT_MAX && cost_list[3] != INT_MAX &&
cost_list[4] != INT_MAX && is_cost_list_wellbehaved(cost_list)) {
@@ -519,14 +604,21 @@ int av1_find_best_sub_pixel_tree_pruned(
MACROBLOCK *x, const MV *ref_mv, int allow_hp, int error_per_bit,
const aom_variance_fn_ptr_t *vfp, int forced_stop, int iters_per_step,
int *cost_list, int *mvjcost, int *mvcost[2], int *distortion,
- unsigned int *sse1, const uint8_t *second_pred, int w, int h,
- int use_upsampled_ref) {
+ unsigned int *sse1, const uint8_t *second_pred,
+#if CONFIG_EXT_INTER
+ const uint8_t *mask, int mask_stride, int invert_mask,
+#endif
+ int w, int h, int use_upsampled_ref) {
SETUP_SUBPEL_SEARCH;
(void)use_upsampled_ref;
- besterr = setup_center_error(
- xd, bestmv, ref_mv, error_per_bit, vfp, src_address, src_stride, y,
- y_stride, second_pred, w, h, offset, mvjcost, mvcost, sse1, distortion);
+ besterr =
+ setup_center_error(xd, bestmv, ref_mv, error_per_bit, vfp, src_address,
+ src_stride, y, y_stride, second_pred,
+#if CONFIG_EXT_INTER
+ mask, mask_stride, invert_mask,
+#endif
+ w, h, offset, mvjcost, mvcost, sse1, distortion);
if (cost_list && cost_list[0] != INT_MAX && cost_list[1] != INT_MAX &&
cost_list[2] != INT_MAX && cost_list[3] != INT_MAX &&
cost_list[4] != INT_MAX) {
@@ -612,17 +704,29 @@ static int upsampled_pref_error(const MACROBLOCKD *xd,
const aom_variance_fn_ptr_t *vfp,
const uint8_t *const src, const int src_stride,
const uint8_t *const y, int y_stride,
- const uint8_t *second_pred, int w, int h,
- unsigned int *sse) {
+ const uint8_t *second_pred,
+#if CONFIG_EXT_INTER
+ const uint8_t *mask, int mask_stride,
+ int invert_mask,
+#endif
+ int w, int h, unsigned int *sse) {
unsigned int besterr;
#if CONFIG_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
DECLARE_ALIGNED(16, uint16_t, pred16[MAX_SB_SQUARE]);
- if (second_pred != NULL)
- aom_highbd_comp_avg_upsampled_pred(pred16, second_pred, w, h, y,
- y_stride);
- else
+ if (second_pred != NULL) {
+#if CONFIG_EXT_INTER
+ if (mask)
+ aom_highbd_comp_mask_upsampled_pred(pred16, second_pred, w, h, y,
+ y_stride, mask, mask_stride,
+ invert_mask);
+ else
+#endif
+ aom_highbd_comp_avg_upsampled_pred(pred16, second_pred, w, h, y,
+ y_stride);
+ } else {
aom_highbd_upsampled_pred(pred16, w, h, y, y_stride);
+ }
besterr = vfp->vf(CONVERT_TO_BYTEPTR(pred16), w, src, src_stride, sse);
} else {
@@ -631,10 +735,17 @@ static int upsampled_pref_error(const MACROBLOCKD *xd,
DECLARE_ALIGNED(16, uint8_t, pred[MAX_SB_SQUARE]);
(void)xd;
#endif // CONFIG_HIGHBITDEPTH
- if (second_pred != NULL)
- aom_comp_avg_upsampled_pred(pred, second_pred, w, h, y, y_stride);
- else
+ if (second_pred != NULL) {
+#if CONFIG_EXT_INTER
+ if (mask)
+ aom_comp_mask_upsampled_pred(pred, second_pred, w, h, y, y_stride, mask,
+ mask_stride, invert_mask);
+ else
+#endif
+ aom_comp_avg_upsampled_pred(pred, second_pred, w, h, y, y_stride);
+ } else {
aom_upsampled_pred(pred, w, h, y, y_stride);
+ }
besterr = vfp->vf(pred, w, src, src_stride, sse);
#if CONFIG_HIGHBITDEPTH
@@ -647,23 +758,32 @@ static unsigned int upsampled_setup_center_error(
const MACROBLOCKD *xd, const MV *bestmv, const MV *ref_mv,
int error_per_bit, const aom_variance_fn_ptr_t *vfp,
const uint8_t *const src, const int src_stride, const uint8_t *const y,
- int y_stride, const uint8_t *second_pred, int w, int h, int offset,
- int *mvjcost, int *mvcost[2], unsigned int *sse1, int *distortion) {
- unsigned int besterr = upsampled_pref_error(
- xd, vfp, src, src_stride, y + offset, y_stride, second_pred, w, h, sse1);
+ int y_stride, const uint8_t *second_pred,
+#if CONFIG_EXT_INTER
+ const uint8_t *mask, int mask_stride, int invert_mask,
+#endif
+ int w, int h, int offset, int *mvjcost, int *mvcost[2], unsigned int *sse1,
+ int *distortion) {
+ unsigned int besterr = upsampled_pref_error(xd, vfp, src, src_stride,
+ y + offset, y_stride, second_pred,
+#if CONFIG_EXT_INTER
+ mask, mask_stride, invert_mask,
+#endif
+ w, h, sse1);
*distortion = besterr;
besterr += mv_err_cost(bestmv, ref_mv, mvjcost, mvcost, error_per_bit);
return besterr;
}
-int av1_find_best_sub_pixel_tree(MACROBLOCK *x, const MV *ref_mv, int allow_hp,
- int error_per_bit,
- const aom_variance_fn_ptr_t *vfp,
- int forced_stop, int iters_per_step,
- int *cost_list, int *mvjcost, int *mvcost[2],
- int *distortion, unsigned int *sse1,
- const uint8_t *second_pred, int w, int h,
- int use_upsampled_ref) {
+int av1_find_best_sub_pixel_tree(
+ MACROBLOCK *x, const MV *ref_mv, int allow_hp, int error_per_bit,
+ const aom_variance_fn_ptr_t *vfp, int forced_stop, int iters_per_step,
+ int *cost_list, int *mvjcost, int *mvcost[2], int *distortion,
+ unsigned int *sse1, const uint8_t *second_pred,
+#if CONFIG_EXT_INTER
+ const uint8_t *mask, int mask_stride, int invert_mask,
+#endif
+ int w, int h, int use_upsampled_ref) {
const uint8_t *const src_address = x->plane[0].src.buf;
const int src_stride = x->plane[0].src.stride;
const MACROBLOCKD *xd = &x->e_mbd;
@@ -700,12 +820,19 @@ int av1_find_best_sub_pixel_tree(MACROBLOCK *x, const MV *ref_mv, int allow_hp,
if (use_upsampled_ref)
besterr = upsampled_setup_center_error(
xd, bestmv, ref_mv, error_per_bit, vfp, src_address, src_stride, y,
- y_stride, second_pred, w, h, (offset * 8), mvjcost, mvcost, sse1,
- distortion);
+ y_stride, second_pred,
+#if CONFIG_EXT_INTER
+ mask, mask_stride, invert_mask,
+#endif
+ w, h, (offset * 8), mvjcost, mvcost, sse1, distortion);
else
- besterr = setup_center_error(
- xd, bestmv, ref_mv, error_per_bit, vfp, src_address, src_stride, y,
- y_stride, second_pred, w, h, offset, mvjcost, mvcost, sse1, distortion);
+ besterr =
+ setup_center_error(xd, bestmv, ref_mv, error_per_bit, vfp, src_address,
+ src_stride, y, y_stride, second_pred,
+#if CONFIG_EXT_INTER
+ mask, mask_stride, invert_mask,
+#endif
+ w, h, offset, mvjcost, mvcost, sse1, distortion);
(void)cost_list; // to silence compiler warning
@@ -721,14 +848,23 @@ int av1_find_best_sub_pixel_tree(MACROBLOCK *x, const MV *ref_mv, int allow_hp,
const uint8_t *const pre_address = y + tr * y_stride + tc;
thismse = upsampled_pref_error(xd, vfp, src_address, src_stride,
- pre_address, y_stride, second_pred, w,
- h, &sse);
+ pre_address, y_stride, second_pred,
+#if CONFIG_EXT_INTER
+ mask, mask_stride, invert_mask,
+#endif
+ w, h, &sse);
} else {
const uint8_t *const pre_address =
y + (tr >> 3) * y_stride + (tc >> 3);
if (second_pred == NULL)
thismse = vfp->svf(pre_address, y_stride, sp(tc), sp(tr),
src_address, src_stride, &sse);
+#if CONFIG_EXT_INTER
+ else if (mask)
+ thismse = vfp->msvf(pre_address, y_stride, sp(tc), sp(tr),
+ src_address, src_stride, second_pred, mask,
+ mask_stride, invert_mask, &sse);
+#endif
else
thismse = vfp->svaf(pre_address, y_stride, sp(tc), sp(tr),
src_address, src_stride, &sse, second_pred);
@@ -760,15 +896,24 @@ int av1_find_best_sub_pixel_tree(MACROBLOCK *x, const MV *ref_mv, int allow_hp,
if (use_upsampled_ref) {
const uint8_t *const pre_address = y + tr * y_stride + tc;
- thismse =
- upsampled_pref_error(xd, vfp, src_address, src_stride, pre_address,
- y_stride, second_pred, w, h, &sse);
+ thismse = upsampled_pref_error(xd, vfp, src_address, src_stride,
+ pre_address, y_stride, second_pred,
+#if CONFIG_EXT_INTER
+ mask, mask_stride, invert_mask,
+#endif
+ w, h, &sse);
} else {
const uint8_t *const pre_address = y + (tr >> 3) * y_stride + (tc >> 3);
if (second_pred == NULL)
thismse = vfp->svf(pre_address, y_stride, sp(tc), sp(tr), src_address,
src_stride, &sse);
+#if CONFIG_EXT_INTER
+ else if (mask)
+ thismse = vfp->msvf(pre_address, y_stride, sp(tc), sp(tr),
+ src_address, src_stride, second_pred, mask,
+ mask_stride, invert_mask, &sse);
+#endif
else
thismse = vfp->svaf(pre_address, y_stride, sp(tc), sp(tr),
src_address, src_stride, &sse, second_pred);
@@ -822,6 +967,102 @@ int av1_find_best_sub_pixel_tree(MACROBLOCK *x, const MV *ref_mv, int allow_hp,
#undef PRE
#undef CHECK_BETTER
+#if CONFIG_WARPED_MOTION
+unsigned int av1_compute_motion_cost(const AV1_COMP *cpi, MACROBLOCK *const x,
+ BLOCK_SIZE bsize, int mi_row, int mi_col,
+ const MV *this_mv) {
+ const AV1_COMMON *const cm = &cpi->common;
+ MACROBLOCKD *xd = &x->e_mbd;
+ MODE_INFO *mi = xd->mi[0];
+ MB_MODE_INFO *mbmi = &mi->mbmi;
+ const uint8_t *const src = x->plane[0].src.buf;
+ const int src_stride = x->plane[0].src.stride;
+ uint8_t *const dst = xd->plane[0].dst.buf;
+ const int dst_stride = xd->plane[0].dst.stride;
+ const aom_variance_fn_ptr_t *vfp = &cpi->fn_ptr[bsize];
+ const MV ref_mv = x->mbmi_ext->ref_mvs[mbmi->ref_frame[0]][0].as_mv;
+ unsigned int mse;
+ unsigned int sse;
+
+ av1_build_inter_predictors_sby(cm, xd, mi_row, mi_col, NULL, bsize);
+ mse = vfp->vf(dst, dst_stride, src, src_stride, &sse);
+ mse +=
+ mv_err_cost(this_mv, &ref_mv, x->nmvjointcost, x->mvcost, x->errorperbit);
+ return mse;
+}
+
+// Refine MV in a small range
+unsigned int av1_refine_warped_mv(const AV1_COMP *cpi, MACROBLOCK *const x,
+ BLOCK_SIZE bsize, int mi_row, int mi_col,
+ int *pts, int *pts_inref) {
+ const AV1_COMMON *const cm = &cpi->common;
+ MACROBLOCKD *xd = &x->e_mbd;
+ MODE_INFO *mi = xd->mi[0];
+ MB_MODE_INFO *mbmi = &mi->mbmi;
+ const MV neighbors[8] = { { 0, -1 }, { 1, 0 }, { 0, 1 }, { -1, 0 },
+ { 0, -2 }, { 2, 0 }, { 0, 2 }, { -2, 0 } };
+ const MV ref_mv = x->mbmi_ext->ref_mvs[mbmi->ref_frame[0]][0].as_mv;
+ int16_t br = mbmi->mv[0].as_mv.row;
+ int16_t bc = mbmi->mv[0].as_mv.col;
+ int16_t *tr = &mbmi->mv[0].as_mv.row;
+ int16_t *tc = &mbmi->mv[0].as_mv.col;
+ WarpedMotionParams best_wm_params = mbmi->wm_params[0];
+ unsigned int bestmse;
+ int minc, maxc, minr, maxr;
+ const int start = cm->allow_high_precision_mv ? 0 : 4;
+ int ite;
+
+ av1_set_subpel_mv_search_range(&x->mv_limits, &minc, &maxc, &minr, &maxr,
+ &ref_mv);
+
+ // Calculate the center position's error
+ assert(bc >= minc && bc <= maxc && br >= minr && br <= maxr);
+ bestmse = av1_compute_motion_cost(cpi, x, bsize, mi_row, mi_col,
+ &mbmi->mv[0].as_mv);
+
+ // MV search
+ for (ite = 0; ite < 2; ++ite) {
+ int best_idx = -1;
+ int idx;
+
+ for (idx = start; idx < start + 4; ++idx) {
+ unsigned int thismse;
+
+ *tr = br + neighbors[idx].row;
+ *tc = bc + neighbors[idx].col;
+
+ if (*tc >= minc && *tc <= maxc && *tr >= minr && *tr <= maxr) {
+ MV this_mv = { *tr, *tc };
+ if (!find_projection(mbmi->num_proj_ref[0], pts, pts_inref, bsize, *tr,
+ *tc, &mbmi->wm_params[0], mi_row, mi_col)) {
+ thismse =
+ av1_compute_motion_cost(cpi, x, bsize, mi_row, mi_col, &this_mv);
+
+ if (thismse < bestmse) {
+ best_idx = idx;
+ best_wm_params = mbmi->wm_params[0];
+ bestmse = thismse;
+ }
+ }
+ }
+ }
+
+ if (best_idx == -1) break;
+
+ if (best_idx >= 0) {
+ br += neighbors[best_idx].row;
+ bc += neighbors[best_idx].col;
+ }
+ }
+
+ *tr = br;
+ *tc = bc;
+ mbmi->wm_params[0] = best_wm_params;
+
+ return bestmse;
+}
+#endif // CONFIG_WARPED_MOTION
+
static INLINE int check_bounds(const MvLimits *mv_limits, int row, int col,
int range) {
return ((row - range) >= mv_limits->row_min) &
@@ -1232,6 +1473,27 @@ int av1_get_mvpred_av_var(const MACROBLOCK *x, const MV *best_mv,
: 0);
}
+#if CONFIG_EXT_INTER
+int av1_get_mvpred_mask_var(const MACROBLOCK *x, const MV *best_mv,
+ const MV *center_mv, const uint8_t *second_pred,
+ const uint8_t *mask, int mask_stride,
+ int invert_mask, const aom_variance_fn_ptr_t *vfp,
+ int use_mvcost) {
+ const MACROBLOCKD *const xd = &x->e_mbd;
+ const struct buf_2d *const what = &x->plane[0].src;
+ const struct buf_2d *const in_what = &xd->plane[0].pre[0];
+ const MV mv = { best_mv->row * 8, best_mv->col * 8 };
+ unsigned int unused;
+
+ return vfp->msvf(what->buf, what->stride, 0, 0,
+ get_buf_from_mv(in_what, best_mv), in_what->stride,
+ second_pred, mask, mask_stride, invert_mask, &unused) +
+ (use_mvcost ? mv_err_cost(&mv, center_mv, x->nmvjointcost, x->mvcost,
+ x->errorperbit)
+ : 0);
+}
+#endif
+
int av1_hex_search(MACROBLOCK *x, MV *start_mv, int search_param,
int sad_per_bit, int do_init_search, int *cost_list,
const aom_variance_fn_ptr_t *vfp, int use_mvcost,
@@ -1685,17 +1947,12 @@ unsigned int av1_int_pro_motion_estimation(const AV1_COMP *cpi, MACROBLOCK *x,
DECLARE_ALIGNED(16, int16_t, src_hbuf[MAX_SB_SQUARE]);
DECLARE_ALIGNED(16, int16_t, src_vbuf[MAX_SB_SQUARE]);
int idx;
- const int bw = 4 << b_width_log2_lookup[bsize];
- const int bh = 4 << b_height_log2_lookup[bsize];
- const int search_width = bw << 1;
- const int search_height = bh << 1;
const int src_stride = x->plane[0].src.stride;
const int ref_stride = xd->plane[0].pre[0].stride;
uint8_t const *ref_buf, *src_buf;
MV *tmp_mv = &xd->mi[0]->mbmi.mv[0].as_mv;
unsigned int best_sad, tmp_sad, sad_arr[4];
MV this_mv;
- const int norm_factor = 3 + (bw >> 5);
const YV12_BUFFER_CONFIG *scaled_ref_frame =
av1_get_scaled_ref_frame(cpi, mbmi->ref_frame[0]);
@@ -1724,6 +1981,12 @@ unsigned int av1_int_pro_motion_estimation(const AV1_COMP *cpi, MACROBLOCK *x,
}
#endif
+ const int bw = 4 << b_width_log2_lookup[bsize];
+ const int bh = 4 << b_height_log2_lookup[bsize];
+ const int search_width = bw << 1;
+ const int search_height = bh << 1;
+ const int norm_factor = 3 + (bw >> 5);
+
// Set up prediction 1-D reference set
ref_buf = xd->plane[0].pre[0].buf - (bw >> 1);
for (idx = 0; idx < search_width; idx += 16) {
@@ -2195,9 +2458,13 @@ int av1_refining_search_sad(MACROBLOCK *x, MV *ref_mv, int error_per_bit,
}
// This function is called when we do joint motion search in comp_inter_inter
-// mode.
+// mode, or when searching for one component of an ext-inter compound mode.
int av1_refining_search_8p_c(MACROBLOCK *x, int error_per_bit, int search_range,
const aom_variance_fn_ptr_t *fn_ptr,
+#if CONFIG_EXT_INTER
+ const uint8_t *mask, int mask_stride,
+ int invert_mask,
+#endif
const MV *center_mv, const uint8_t *second_pred) {
const MV neighbors[8] = { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 },
{ -1, -1 }, { 1, -1 }, { -1, 1 }, { 1, 1 } };
@@ -2211,10 +2478,18 @@ int av1_refining_search_8p_c(MACROBLOCK *x, int error_per_bit, int search_range,
clamp_mv(best_mv, x->mv_limits.col_min, x->mv_limits.col_max,
x->mv_limits.row_min, x->mv_limits.row_max);
- best_sad =
- fn_ptr->sdaf(what->buf, what->stride, get_buf_from_mv(in_what, best_mv),
- in_what->stride, second_pred) +
- mvsad_err_cost(x, best_mv, &fcenter_mv, error_per_bit);
+#if CONFIG_EXT_INTER
+ if (mask)
+ best_sad = fn_ptr->msdf(what->buf, what->stride,
+ get_buf_from_mv(in_what, best_mv), in_what->stride,
+ second_pred, mask, mask_stride, invert_mask) +
+ mvsad_err_cost(x, best_mv, &fcenter_mv, error_per_bit);
+ else
+#endif
+ best_sad =
+ fn_ptr->sdaf(what->buf, what->stride, get_buf_from_mv(in_what, best_mv),
+ in_what->stride, second_pred) +
+ mvsad_err_cost(x, best_mv, &fcenter_mv, error_per_bit);
for (i = 0; i < search_range; ++i) {
int best_site = -1;
@@ -2224,9 +2499,17 @@ int av1_refining_search_8p_c(MACROBLOCK *x, int error_per_bit, int search_range,
best_mv->col + neighbors[j].col };
if (is_mv_in(&x->mv_limits, &mv)) {
- unsigned int sad =
- fn_ptr->sdaf(what->buf, what->stride, get_buf_from_mv(in_what, &mv),
- in_what->stride, second_pred);
+ unsigned int sad;
+#if CONFIG_EXT_INTER
+ if (mask)
+ sad = fn_ptr->msdf(what->buf, what->stride,
+ get_buf_from_mv(in_what, &mv), in_what->stride,
+ second_pred, mask, mask_stride, invert_mask);
+ else
+#endif
+ sad = fn_ptr->sdaf(what->buf, what->stride,
+ get_buf_from_mv(in_what, &mv), in_what->stride,
+ second_pred);
if (sad < best_sad) {
sad += mvsad_err_cost(x, &mv, &fcenter_mv, error_per_bit);
if (sad < best_sad) {
@@ -2337,612 +2620,20 @@ int av1_full_pixel_search(const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize,
return var;
}
-#if CONFIG_EXT_INTER
-/* returns subpixel variance error function */
-#define DIST(r, c) \
- vfp->msvf(pre(y, y_stride, r, c), y_stride, sp(c), sp(r), z, src_stride, \
- mask, mask_stride, &sse)
-
-/* checks if (r, c) has better score than previous best */
-
-#define MVC(r, c) \
- (mvcost \
- ? ((mvjcost[((r) != rr) * 2 + ((c) != rc)] + mvcost[0][((r)-rr)] + \
- mvcost[1][((c)-rc)]) * \
- error_per_bit + \
- 4096) >> \
- 13 \
- : 0)
-
-#define CHECK_BETTER(v, r, c) \
- if (c >= minc && c <= maxc && r >= minr && r <= maxr) { \
- thismse = (DIST(r, c)); \
- if ((v = MVC(r, c) + thismse) < besterr) { \
- besterr = v; \
- br = r; \
- bc = c; \
- *distortion = thismse; \
- *sse1 = sse; \
- } \
- } else { \
- v = INT_MAX; \
- }
-
-#undef CHECK_BETTER0
-#define CHECK_BETTER0(v, r, c) CHECK_BETTER(v, r, c)
-
-#undef CHECK_BETTER1
-#define CHECK_BETTER1(v, r, c) \
- if (c >= minc && c <= maxc && r >= minr && r <= maxr) { \
- thismse = upsampled_masked_pref_error(xd, mask, mask_stride, vfp, z, \
- src_stride, upre(y, y_stride, r, c), \
- y_stride, w, h, &sse); \
- if ((v = MVC(r, c) + thismse) < besterr) { \
- besterr = v; \
- br = r; \
- bc = c; \
- *distortion = thismse; \
- *sse1 = sse; \
- } \
- } else { \
- v = INT_MAX; \
- }
-
-int av1_find_best_masked_sub_pixel_tree(
- const MACROBLOCK *x, const uint8_t *mask, int mask_stride, MV *bestmv,
- const MV *ref_mv, int allow_hp, int error_per_bit,
- const aom_variance_fn_ptr_t *vfp, int forced_stop, int iters_per_step,
- int *mvjcost, int *mvcost[2], int *distortion, unsigned int *sse1,
- int is_second) {
- const uint8_t *const z = x->plane[0].src.buf;
- const int src_stride = x->plane[0].src.stride;
- const MACROBLOCKD *xd = &x->e_mbd;
- unsigned int besterr = INT_MAX;
- unsigned int sse;
- int thismse;
- unsigned int whichdir;
- unsigned int halfiters = iters_per_step;
- unsigned int quarteriters = iters_per_step;
- unsigned int eighthiters = iters_per_step;
-
- const int y_stride = xd->plane[0].pre[is_second].stride;
- const int offset = bestmv->row * y_stride + bestmv->col;
- const uint8_t *const y = xd->plane[0].pre[is_second].buf;
-
- int rr = ref_mv->row;
- int rc = ref_mv->col;
- int br = bestmv->row * 8;
- int bc = bestmv->col * 8;
- int hstep = 4;
- int tr = br;
- int tc = bc;
- int minc, maxc, minr, maxr;
-
- av1_set_subpel_mv_search_range(&x->mv_limits, &minc, &maxc, &minr, &maxr,
- ref_mv);
-
- // central mv
- bestmv->row *= 8;
- bestmv->col *= 8;
-
- // calculate central point error
- besterr =
- vfp->mvf(y + offset, y_stride, z, src_stride, mask, mask_stride, sse1);
- *distortion = besterr;
- besterr += mv_err_cost(bestmv, ref_mv, mvjcost, mvcost, error_per_bit);
-
- // 1/2 pel
- FIRST_LEVEL_CHECKS;
- if (halfiters > 1) {
- SECOND_LEVEL_CHECKS;
- }
- tr = br;
- tc = bc;
-
- // Note forced_stop: 0 - full, 1 - qtr only, 2 - half only
- if (forced_stop != 2) {
- hstep >>= 1;
- FIRST_LEVEL_CHECKS;
- if (quarteriters > 1) {
- SECOND_LEVEL_CHECKS;
- }
- tr = br;
- tc = bc;
- }
-
- if (allow_hp && forced_stop == 0) {
- hstep >>= 1;
- FIRST_LEVEL_CHECKS;
- if (eighthiters > 1) {
- SECOND_LEVEL_CHECKS;
- }
- tr = br;
- tc = bc;
- }
- // These lines insure static analysis doesn't warn that
- // tr and tc aren't used after the above point.
- (void)tr;
- (void)tc;
-
- bestmv->row = br;
- bestmv->col = bc;
-
- return besterr;
-}
-
-static unsigned int setup_masked_center_error(
- const uint8_t *mask, int mask_stride, const MV *bestmv, const MV *ref_mv,
- int error_per_bit, const aom_variance_fn_ptr_t *vfp,
- const uint8_t *const src, const int src_stride, const uint8_t *const y,
- int y_stride, int offset, int *mvjcost, int *mvcost[2], unsigned int *sse1,
- int *distortion) {
- unsigned int besterr;
- besterr =
- vfp->mvf(y + offset, y_stride, src, src_stride, mask, mask_stride, sse1);
- *distortion = besterr;
- besterr += mv_err_cost(bestmv, ref_mv, mvjcost, mvcost, error_per_bit);
- return besterr;
-}
-
-static int upsampled_masked_pref_error(const MACROBLOCKD *xd,
- const uint8_t *mask, int mask_stride,
- const aom_variance_fn_ptr_t *vfp,
- const uint8_t *const src,
- const int src_stride,
- const uint8_t *const y, int y_stride,
- int w, int h, unsigned int *sse) {
- unsigned int besterr;
-#if CONFIG_HIGHBITDEPTH
- if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
- DECLARE_ALIGNED(16, uint16_t, pred16[MAX_SB_SQUARE]);
- aom_highbd_upsampled_pred(pred16, w, h, y, y_stride);
-
- besterr = vfp->mvf(CONVERT_TO_BYTEPTR(pred16), w, src, src_stride, mask,
- mask_stride, sse);
- } else {
- DECLARE_ALIGNED(16, uint8_t, pred[MAX_SB_SQUARE]);
-#else
- DECLARE_ALIGNED(16, uint8_t, pred[MAX_SB_SQUARE]);
- (void)xd;
-#endif // CONFIG_HIGHBITDEPTH
- aom_upsampled_pred(pred, w, h, y, y_stride);
-
- besterr = vfp->mvf(pred, w, src, src_stride, mask, mask_stride, sse);
-#if CONFIG_HIGHBITDEPTH
- }
-#endif
- return besterr;
-}
-
-static unsigned int upsampled_setup_masked_center_error(
- const MACROBLOCKD *xd, const uint8_t *mask, int mask_stride,
- const MV *bestmv, const MV *ref_mv, int error_per_bit,
- const aom_variance_fn_ptr_t *vfp, const uint8_t *const src,
- const int src_stride, const uint8_t *const y, int y_stride, int w, int h,
- int offset, int *mvjcost, int *mvcost[2], unsigned int *sse1,
- int *distortion) {
- unsigned int besterr =
- upsampled_masked_pref_error(xd, mask, mask_stride, vfp, src, src_stride,
- y + offset, y_stride, w, h, sse1);
- *distortion = besterr;
- besterr += mv_err_cost(bestmv, ref_mv, mvjcost, mvcost, error_per_bit);
- return besterr;
-}
-
-int av1_find_best_masked_sub_pixel_tree_up(
- const AV1_COMP *cpi, MACROBLOCK *x, const uint8_t *mask, int mask_stride,
- int mi_row, int mi_col, MV *bestmv, const MV *ref_mv, int allow_hp,
- int error_per_bit, const aom_variance_fn_ptr_t *vfp, int forced_stop,
- int iters_per_step, int *mvjcost, int *mvcost[2], int *distortion,
- unsigned int *sse1, int is_second, int use_upsampled_ref) {
- const uint8_t *const z = x->plane[0].src.buf;
- const uint8_t *const src_address = z;
- const int src_stride = x->plane[0].src.stride;
- MACROBLOCKD *xd = &x->e_mbd;
- struct macroblockd_plane *const pd = &xd->plane[0];
- MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
- unsigned int besterr = INT_MAX;
- unsigned int sse;
- unsigned int thismse;
-
- int rr = ref_mv->row;
- int rc = ref_mv->col;
- int br = bestmv->row * 8;
- int bc = bestmv->col * 8;
- int hstep = 4;
- int iter;
- int round = 3 - forced_stop;
- int tr = br;
- int tc = bc;
- const MV *search_step = search_step_table;
- int idx, best_idx = -1;
- unsigned int cost_array[5];
- int kr, kc;
- const int w = block_size_wide[mbmi->sb_type];
- const int h = block_size_high[mbmi->sb_type];
- int offset;
- int y_stride;
- const uint8_t *y;
-
- const struct buf_2d backup_pred = pd->pre[is_second];
- int minc, maxc, minr, maxr;
-
- av1_set_subpel_mv_search_range(&x->mv_limits, &minc, &maxc, &minr, &maxr,
- ref_mv);
-
- if (use_upsampled_ref) {
- int ref = xd->mi[0]->mbmi.ref_frame[is_second];
- const YV12_BUFFER_CONFIG *upsampled_ref = get_upsampled_ref(cpi, ref);
- setup_pred_plane(&pd->pre[is_second], mbmi->sb_type,
- upsampled_ref->y_buffer, upsampled_ref->y_crop_width,
- upsampled_ref->y_crop_height, upsampled_ref->y_stride,
- (mi_row << 3), (mi_col << 3), NULL, pd->subsampling_x,
- pd->subsampling_y);
- }
- y = pd->pre[is_second].buf;
- y_stride = pd->pre[is_second].stride;
- offset = bestmv->row * y_stride + bestmv->col;
-
- if (!allow_hp)
- if (round == 3) round = 2;
-
- bestmv->row *= 8;
- bestmv->col *= 8;
-
- // use_upsampled_ref can be 0 or 1
- if (use_upsampled_ref)
- besterr = upsampled_setup_masked_center_error(
- xd, mask, mask_stride, bestmv, ref_mv, error_per_bit, vfp, z,
- src_stride, y, y_stride, w, h, (offset * 8), mvjcost, mvcost, sse1,
- distortion);
- else
- besterr = setup_masked_center_error(
- mask, mask_stride, bestmv, ref_mv, error_per_bit, vfp, z, src_stride, y,
- y_stride, offset, mvjcost, mvcost, sse1, distortion);
-
- for (iter = 0; iter < round; ++iter) {
- // Check vertical and horizontal sub-pixel positions.
- for (idx = 0; idx < 4; ++idx) {
- tr = br + search_step[idx].row;
- tc = bc + search_step[idx].col;
- if (tc >= minc && tc <= maxc && tr >= minr && tr <= maxr) {
- MV this_mv = { tr, tc };
-
- if (use_upsampled_ref) {
- const uint8_t *const pre_address = y + tr * y_stride + tc;
-
- thismse = upsampled_masked_pref_error(
- xd, mask, mask_stride, vfp, src_address, src_stride, pre_address,
- y_stride, w, h, &sse);
- } else {
- const uint8_t *const pre_address =
- y + (tr >> 3) * y_stride + (tc >> 3);
- thismse = vfp->msvf(pre_address, y_stride, sp(tc), sp(tr),
- src_address, src_stride, mask, mask_stride, &sse);
- }
-
- cost_array[idx] = thismse + mv_err_cost(&this_mv, ref_mv, mvjcost,
- mvcost, error_per_bit);
-
- if (cost_array[idx] < besterr) {
- best_idx = idx;
- besterr = cost_array[idx];
- *distortion = thismse;
- *sse1 = sse;
- }
- } else {
- cost_array[idx] = INT_MAX;
- }
- }
-
- // Check diagonal sub-pixel position
- kc = (cost_array[0] <= cost_array[1] ? -hstep : hstep);
- kr = (cost_array[2] <= cost_array[3] ? -hstep : hstep);
-
- tc = bc + kc;
- tr = br + kr;
- if (tc >= minc && tc <= maxc && tr >= minr && tr <= maxr) {
- MV this_mv = { tr, tc };
-
- if (use_upsampled_ref) {
- const uint8_t *const pre_address = y + tr * y_stride + tc;
-
- thismse = upsampled_masked_pref_error(
- xd, mask, mask_stride, vfp, src_address, src_stride, pre_address,
- y_stride, w, h, &sse);
- } else {
- const uint8_t *const pre_address = y + (tr >> 3) * y_stride + (tc >> 3);
-
- thismse = vfp->msvf(pre_address, y_stride, sp(tc), sp(tr), src_address,
- src_stride, mask, mask_stride, &sse);
- }
-
- cost_array[4] = thismse + mv_err_cost(&this_mv, ref_mv, mvjcost, mvcost,
- error_per_bit);
-
- if (cost_array[4] < besterr) {
- best_idx = 4;
- besterr = cost_array[4];
- *distortion = thismse;
- *sse1 = sse;
- }
- } else {
- cost_array[idx] = INT_MAX;
- }
-
- if (best_idx < 4 && best_idx >= 0) {
- br += search_step[best_idx].row;
- bc += search_step[best_idx].col;
- } else if (best_idx == 4) {
- br = tr;
- bc = tc;
- }
-
- if (iters_per_step > 1 && best_idx != -1) {
- if (use_upsampled_ref) {
- SECOND_LEVEL_CHECKS_BEST(1);
- } else {
- SECOND_LEVEL_CHECKS_BEST(0);
- }
- }
-
- tr = br;
- tc = bc;
-
- search_step += 4;
- hstep >>= 1;
- best_idx = -1;
- }
-
- // These lines insure static analysis doesn't warn that
- // tr and tc aren't used after the above point.
- (void)tr;
- (void)tc;
-
- bestmv->row = br;
- bestmv->col = bc;
-
- if (use_upsampled_ref) {
- pd->pre[is_second] = backup_pred;
- }
-
- return besterr;
-}
-
-#undef DIST
-#undef MVC
-#undef CHECK_BETTER
-
-static int get_masked_mvpred_var(const MACROBLOCK *x, const uint8_t *mask,
- int mask_stride, const MV *best_mv,
- const MV *center_mv,
- const aom_variance_fn_ptr_t *vfp,
- int use_mvcost, int is_second) {
- const MACROBLOCKD *const xd = &x->e_mbd;
- const struct buf_2d *const what = &x->plane[0].src;
- const struct buf_2d *const in_what = &xd->plane[0].pre[is_second];
- const MV mv = { best_mv->row * 8, best_mv->col * 8 };
- unsigned int unused;
-
- return vfp->mvf(what->buf, what->stride, get_buf_from_mv(in_what, best_mv),
- in_what->stride, mask, mask_stride, &unused) +
- (use_mvcost ? mv_err_cost(&mv, center_mv, x->nmvjointcost, x->mvcost,
- x->errorperbit)
- : 0);
-}
-
-int masked_refining_search_sad(const MACROBLOCK *x, const uint8_t *mask,
- int mask_stride, MV *ref_mv, int error_per_bit,
- int search_range,
- const aom_variance_fn_ptr_t *fn_ptr,
- const MV *center_mv, int is_second) {
- const MV neighbors[4] = { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };
- const MACROBLOCKD *const xd = &x->e_mbd;
- const struct buf_2d *const what = &x->plane[0].src;
- const struct buf_2d *const in_what = &xd->plane[0].pre[is_second];
- const MV fcenter_mv = { center_mv->row >> 3, center_mv->col >> 3 };
- unsigned int best_sad =
- fn_ptr->msdf(what->buf, what->stride, get_buf_from_mv(in_what, ref_mv),
- in_what->stride, mask, mask_stride) +
- mvsad_err_cost(x, ref_mv, &fcenter_mv, error_per_bit);
- int i, j;
-
- for (i = 0; i < search_range; i++) {
- int best_site = -1;
-
- for (j = 0; j < 4; j++) {
- const MV mv = { ref_mv->row + neighbors[j].row,
- ref_mv->col + neighbors[j].col };
- if (is_mv_in(&x->mv_limits, &mv)) {
- unsigned int sad =
- fn_ptr->msdf(what->buf, what->stride, get_buf_from_mv(in_what, &mv),
- in_what->stride, mask, mask_stride);
- if (sad < best_sad) {
- sad += mvsad_err_cost(x, &mv, &fcenter_mv, error_per_bit);
- if (sad < best_sad) {
- best_sad = sad;
- best_site = j;
- }
- }
- }
- }
-
- if (best_site == -1) {
- break;
- } else {
- ref_mv->row += neighbors[best_site].row;
- ref_mv->col += neighbors[best_site].col;
- }
- }
- return best_sad;
-}
-
-int masked_diamond_search_sad(const MACROBLOCK *x,
- const search_site_config *cfg,
- const uint8_t *mask, int mask_stride, MV *ref_mv,
- MV *best_mv, int search_param, int sad_per_bit,
- int *num00, const aom_variance_fn_ptr_t *fn_ptr,
- const MV *center_mv, int is_second) {
- const MACROBLOCKD *const xd = &x->e_mbd;
- const struct buf_2d *const what = &x->plane[0].src;
- const struct buf_2d *const in_what = &xd->plane[0].pre[is_second];
- // search_param determines the length of the initial step and hence the number
- // of iterations
- // 0 = initial step (MAX_FIRST_STEP) pel : 1 = (MAX_FIRST_STEP/2) pel, 2 =
- // (MAX_FIRST_STEP/4) pel... etc.
- const search_site *const ss = &cfg->ss[search_param * cfg->searches_per_step];
- const int tot_steps = (cfg->ss_count / cfg->searches_per_step) - search_param;
- const MV fcenter_mv = { center_mv->row >> 3, center_mv->col >> 3 };
- const uint8_t *best_address, *in_what_ref;
- int best_sad = INT_MAX;
- int best_site = 0;
- int last_site = 0;
- int i, j, step;
-
- clamp_mv(ref_mv, x->mv_limits.col_min, x->mv_limits.col_max,
- x->mv_limits.row_min, x->mv_limits.row_max);
- in_what_ref = get_buf_from_mv(in_what, ref_mv);
- best_address = in_what_ref;
- *num00 = 0;
- *best_mv = *ref_mv;
-
- // Check the starting position
- best_sad = fn_ptr->msdf(what->buf, what->stride, best_address,
- in_what->stride, mask, mask_stride) +
- mvsad_err_cost(x, best_mv, &fcenter_mv, sad_per_bit);
-
- i = 1;
-
- for (step = 0; step < tot_steps; step++) {
- for (j = 0; j < cfg->searches_per_step; j++) {
- const MV mv = { best_mv->row + ss[i].mv.row,
- best_mv->col + ss[i].mv.col };
- if (is_mv_in(&x->mv_limits, &mv)) {
- int sad =
- fn_ptr->msdf(what->buf, what->stride, best_address + ss[i].offset,
- in_what->stride, mask, mask_stride);
- if (sad < best_sad) {
- sad += mvsad_err_cost(x, &mv, &fcenter_mv, sad_per_bit);
- if (sad < best_sad) {
- best_sad = sad;
- best_site = i;
- }
- }
- }
-
- i++;
- }
-
- if (best_site != last_site) {
- best_mv->row += ss[best_site].mv.row;
- best_mv->col += ss[best_site].mv.col;
- best_address += ss[best_site].offset;
- last_site = best_site;
-#if defined(NEW_DIAMOND_SEARCH)
- while (1) {
- const MV this_mv = { best_mv->row + ss[best_site].mv.row,
- best_mv->col + ss[best_site].mv.col };
- if (is_mv_in(&x->mv_limits, &this_mv)) {
- int sad = fn_ptr->msdf(what->buf, what->stride,
- best_address + ss[best_site].offset,
- in_what->stride, mask, mask_stride);
- if (sad < best_sad) {
- sad += mvsad_err_cost(x, &this_mv, &fcenter_mv, sad_per_bit);
- if (sad < best_sad) {
- best_sad = sad;
- best_mv->row += ss[best_site].mv.row;
- best_mv->col += ss[best_site].mv.col;
- best_address += ss[best_site].offset;
- continue;
- }
- }
- }
- break;
- }
-#endif
- } else if (best_address == in_what_ref) {
- (*num00)++;
- }
- }
- return best_sad;
-}
-
-int av1_masked_full_pixel_diamond(const AV1_COMP *cpi, MACROBLOCK *x,
- const uint8_t *mask, int mask_stride,
- MV *mvp_full, int step_param, int sadpb,
- int further_steps, int do_refine,
- const aom_variance_fn_ptr_t *fn_ptr,
- const MV *ref_mv, MV *dst_mv, int is_second) {
- MV temp_mv;
- int thissme, n, num00 = 0;
- int bestsme = masked_diamond_search_sad(x, &cpi->ss_cfg, mask, mask_stride,
- mvp_full, &temp_mv, step_param, sadpb,
- &n, fn_ptr, ref_mv, is_second);
- if (bestsme < INT_MAX)
- bestsme = get_masked_mvpred_var(x, mask, mask_stride, &temp_mv, ref_mv,
- fn_ptr, 1, is_second);
- *dst_mv = temp_mv;
-
- // If there won't be more n-step search, check to see if refining search is
- // needed.
- if (n > further_steps) do_refine = 0;
-
- while (n < further_steps) {
- ++n;
-
- if (num00) {
- num00--;
- } else {
- thissme = masked_diamond_search_sad(
- x, &cpi->ss_cfg, mask, mask_stride, mvp_full, &temp_mv,
- step_param + n, sadpb, &num00, fn_ptr, ref_mv, is_second);
- if (thissme < INT_MAX)
- thissme = get_masked_mvpred_var(x, mask, mask_stride, &temp_mv, ref_mv,
- fn_ptr, 1, is_second);
-
- // check to see if refining search is needed.
- if (num00 > further_steps - n) do_refine = 0;
-
- if (thissme < bestsme) {
- bestsme = thissme;
- *dst_mv = temp_mv;
- }
- }
- }
-
- // final 1-away diamond refining search
- if (do_refine) {
- const int search_range = 8;
- MV best_mv = *dst_mv;
- thissme =
- masked_refining_search_sad(x, mask, mask_stride, &best_mv, sadpb,
- search_range, fn_ptr, ref_mv, is_second);
- if (thissme < INT_MAX)
- thissme = get_masked_mvpred_var(x, mask, mask_stride, &best_mv, ref_mv,
- fn_ptr, 1, is_second);
- if (thissme < bestsme) {
- bestsme = thissme;
- *dst_mv = best_mv;
- }
- }
- return bestsme;
-}
-#endif // CONFIG_EXT_INTER
-
#if CONFIG_MOTION_VAR
/* returns subpixel variance error function */
#define DIST(r, c) \
vfp->osvf(pre(y, y_stride, r, c), y_stride, sp(c), sp(r), z, mask, &sse)
/* checks if (r, c) has better score than previous best */
-#define MVC(r, c) \
- (mvcost \
- ? ((mvjcost[((r) != rr) * 2 + ((c) != rc)] + mvcost[0][((r)-rr)] + \
- mvcost[1][((c)-rc)]) * \
- error_per_bit + \
- 4096) >> \
- 13 \
- : 0)
+#define MVC(r, c) \
+ (unsigned int)(mvcost \
+ ? ((mvjcost[((r) != rr) * 2 + ((c) != rc)] + \
+ mvcost[0][((r)-rr)] + (int64_t)mvcost[1][((c)-rc)]) * \
+ error_per_bit + \
+ 4096) >> \
+ 13 \
+ : 0)
#define CHECK_BETTER(v, r, c) \
if (c >= minc && c <= maxc && r >= minr && r <= maxr) { \
@@ -3452,15 +3143,21 @@ int av1_obmc_full_pixel_diamond(const AV1_COMP *cpi, MACROBLOCK *x,
(void)thismse; \
(void)cost_list;
// Return the maximum MV.
-int av1_return_max_sub_pixel_mv(MACROBLOCK *x, const MV *ref_mv, int allow_hp,
- int error_per_bit,
- const aom_variance_fn_ptr_t *vfp,
- int forced_stop, int iters_per_step,
- int *cost_list, int *mvjcost, int *mvcost[2],
- int *distortion, unsigned int *sse1,
- const uint8_t *second_pred, int w, int h,
- int use_upsampled_ref) {
+int av1_return_max_sub_pixel_mv(
+ MACROBLOCK *x, const MV *ref_mv, int allow_hp, int error_per_bit,
+ const aom_variance_fn_ptr_t *vfp, int forced_stop, int iters_per_step,
+ int *cost_list, int *mvjcost, int *mvcost[2], int *distortion,
+ unsigned int *sse1, const uint8_t *second_pred,
+#if CONFIG_EXT_INTER
+ const uint8_t *mask, int mask_stride, int invert_mask,
+#endif
+ int w, int h, int use_upsampled_ref) {
COMMON_MV_TEST;
+#if CONFIG_EXT_INTER
+ (void)mask;
+ (void)mask_stride;
+ (void)invert_mask;
+#endif
(void)minr;
(void)minc;
bestmv->row = maxr;
@@ -3472,17 +3169,23 @@ int av1_return_max_sub_pixel_mv(MACROBLOCK *x, const MV *ref_mv, int allow_hp,
return besterr;
}
// Return the minimum MV.
-int av1_return_min_sub_pixel_mv(MACROBLOCK *x, const MV *ref_mv, int allow_hp,
- int error_per_bit,
- const aom_variance_fn_ptr_t *vfp,
- int forced_stop, int iters_per_step,
- int *cost_list, int *mvjcost, int *mvcost[2],
- int *distortion, unsigned int *sse1,
- const uint8_t *second_pred, int w, int h,
- int use_upsampled_ref) {
+int av1_return_min_sub_pixel_mv(
+ MACROBLOCK *x, const MV *ref_mv, int allow_hp, int error_per_bit,
+ const aom_variance_fn_ptr_t *vfp, int forced_stop, int iters_per_step,
+ int *cost_list, int *mvjcost, int *mvcost[2], int *distortion,
+ unsigned int *sse1, const uint8_t *second_pred,
+#if CONFIG_EXT_INTER
+ const uint8_t *mask, int mask_stride, int invert_mask,
+#endif
+ int w, int h, int use_upsampled_ref) {
COMMON_MV_TEST;
(void)maxr;
(void)maxc;
+#if CONFIG_EXT_INTER
+ (void)mask;
+ (void)mask_stride;
+ (void)invert_mask;
+#endif
bestmv->row = minr;
bestmv->col = minc;
besterr = 0;
diff --git a/third_party/aom/av1/encoder/mcomp.h b/third_party/aom/av1/encoder/mcomp.h
index 8465860ad..7e8b4b29d 100644
--- a/third_party/aom/av1/encoder/mcomp.h
+++ b/third_party/aom/av1/encoder/mcomp.h
@@ -58,6 +58,13 @@ int av1_get_mvpred_var(const MACROBLOCK *x, const MV *best_mv,
int av1_get_mvpred_av_var(const MACROBLOCK *x, const MV *best_mv,
const MV *center_mv, const uint8_t *second_pred,
const aom_variance_fn_ptr_t *vfp, int use_mvcost);
+#if CONFIG_EXT_INTER
+int av1_get_mvpred_mask_var(const MACROBLOCK *x, const MV *best_mv,
+ const MV *center_mv, const uint8_t *second_pred,
+ const uint8_t *mask, int mask_stride,
+ int invert_mask, const aom_variance_fn_ptr_t *vfp,
+ int use_mvcost);
+#endif
struct AV1_COMP;
struct SPEED_FEATURES;
@@ -91,8 +98,11 @@ typedef int(fractional_mv_step_fp)(
const aom_variance_fn_ptr_t *vfp,
int forced_stop, // 0 - full, 1 - qtr only, 2 - half only
int iters_per_step, int *cost_list, int *mvjcost, int *mvcost[2],
- int *distortion, unsigned int *sse1, const uint8_t *second_pred, int w,
- int h, int use_upsampled_ref);
+ int *distortion, unsigned int *sse1, const uint8_t *second_pred,
+#if CONFIG_EXT_INTER
+ const uint8_t *mask, int mask_stride, int invert_mask,
+#endif
+ int w, int h, int use_upsampled_ref);
extern fractional_mv_step_fp av1_find_best_sub_pixel_tree;
extern fractional_mv_step_fp av1_find_best_sub_pixel_tree_pruned;
@@ -113,6 +123,10 @@ typedef int (*av1_diamond_search_fn_t)(
int av1_refining_search_8p_c(MACROBLOCK *x, int error_per_bit, int search_range,
const aom_variance_fn_ptr_t *fn_ptr,
+#if CONFIG_EXT_INTER
+ const uint8_t *mask, int mask_stride,
+ int invert_mask,
+#endif
const MV *center_mv, const uint8_t *second_pred);
struct AV1_COMP;
@@ -122,27 +136,6 @@ int av1_full_pixel_search(const struct AV1_COMP *cpi, MACROBLOCK *x,
int error_per_bit, int *cost_list, const MV *ref_mv,
int var_max, int rd);
-#if CONFIG_EXT_INTER
-int av1_find_best_masked_sub_pixel_tree(
- const MACROBLOCK *x, const uint8_t *mask, int mask_stride, MV *bestmv,
- const MV *ref_mv, int allow_hp, int error_per_bit,
- const aom_variance_fn_ptr_t *vfp, int forced_stop, int iters_per_step,
- int *mvjcost, int *mvcost[2], int *distortion, unsigned int *sse1,
- int is_second);
-int av1_find_best_masked_sub_pixel_tree_up(
- const struct AV1_COMP *cpi, MACROBLOCK *x, const uint8_t *mask,
- int mask_stride, int mi_row, int mi_col, MV *bestmv, const MV *ref_mv,
- int allow_hp, int error_per_bit, const aom_variance_fn_ptr_t *vfp,
- int forced_stop, int iters_per_step, int *mvjcost, int *mvcost[2],
- int *distortion, unsigned int *sse1, int is_second, int use_upsampled_ref);
-int av1_masked_full_pixel_diamond(const struct AV1_COMP *cpi, MACROBLOCK *x,
- const uint8_t *mask, int mask_stride,
- MV *mvp_full, int step_param, int sadpb,
- int further_steps, int do_refine,
- const aom_variance_fn_ptr_t *fn_ptr,
- const MV *ref_mv, MV *dst_mv, int is_second);
-#endif // CONFIG_EXT_INTER
-
#if CONFIG_MOTION_VAR
int av1_obmc_full_pixel_diamond(const struct AV1_COMP *cpi, MACROBLOCK *x,
MV *mvp_full, int step_param, int sadpb,
@@ -160,4 +153,14 @@ int av1_find_best_obmc_sub_pixel_tree_up(
} // extern "C"
#endif
+#if CONFIG_WARPED_MOTION
+unsigned int av1_compute_motion_cost(const struct AV1_COMP *cpi,
+ MACROBLOCK *const x, BLOCK_SIZE bsize,
+ int mi_row, int mi_col, const MV *this_mv);
+unsigned int av1_refine_warped_mv(const struct AV1_COMP *cpi,
+ MACROBLOCK *const x, BLOCK_SIZE bsize,
+ int mi_row, int mi_col, int *pts,
+ int *pts_inref);
+#endif // CONFIG_WARPED_MOTION
+
#endif // AV1_ENCODER_MCOMP_H_
diff --git a/third_party/aom/av1/encoder/palette.c b/third_party/aom/av1/encoder/palette.c
index 355141de5..235964dde 100644
--- a/third_party/aom/av1/encoder/palette.c
+++ b/third_party/aom/av1/encoder/palette.c
@@ -167,31 +167,58 @@ int av1_count_colors(const uint8_t *src, int stride, int rows, int cols) {
}
#if CONFIG_PALETTE_DELTA_ENCODING
-int av1_get_palette_delta_bits_y(const PALETTE_MODE_INFO *const pmi,
- int bit_depth, int *min_bits) {
- const int n = pmi->palette_size[0];
- int max_d = 0, i;
- *min_bits = bit_depth - 3;
- for (i = 1; i < n; ++i) {
- const int delta = pmi->palette_colors[i] - pmi->palette_colors[i - 1];
- assert(delta > 0);
- if (delta > max_d) max_d = delta;
+static int delta_encode_cost(const int *colors, int num, int bit_depth,
+ int min_val) {
+ if (num <= 0) return 0;
+ int bits_cost = bit_depth;
+ if (num == 1) return bits_cost;
+ bits_cost += 2;
+ int max_delta = 0;
+ int deltas[PALETTE_MAX_SIZE];
+ const int min_bits = bit_depth - 3;
+ for (int i = 1; i < num; ++i) {
+ const int delta = colors[i] - colors[i - 1];
+ deltas[i - 1] = delta;
+ assert(delta >= min_val);
+ if (delta > max_delta) max_delta = delta;
+ }
+ int bits_per_delta = AOMMAX(av1_ceil_log2(max_delta + 1 - min_val), min_bits);
+ assert(bits_per_delta <= bit_depth);
+ int range = (1 << bit_depth) - colors[0] - min_val;
+ for (int i = 0; i < num - 1; ++i) {
+ bits_cost += bits_per_delta;
+ range -= deltas[i];
+ bits_per_delta = AOMMIN(bits_per_delta, av1_ceil_log2(range));
}
- return AOMMAX(av1_ceil_log2(max_d), *min_bits);
+ return bits_cost;
}
-int av1_get_palette_delta_bits_u(const PALETTE_MODE_INFO *const pmi,
- int bit_depth, int *min_bits) {
- const int n = pmi->palette_size[1];
- int max_d = 0, i;
- *min_bits = bit_depth - 3;
- for (i = 1; i < n; ++i) {
- const int delta = pmi->palette_colors[PALETTE_MAX_SIZE + i] -
- pmi->palette_colors[PALETTE_MAX_SIZE + i - 1];
- assert(delta >= 0);
- if (delta > max_d) max_d = delta;
+int av1_index_color_cache(const uint16_t *color_cache, int n_cache,
+ const uint16_t *colors, int n_colors,
+ uint8_t *cache_color_found, int *out_cache_colors) {
+ if (n_cache <= 0) {
+ for (int i = 0; i < n_colors; ++i) out_cache_colors[i] = colors[i];
+ return n_colors;
}
- return AOMMAX(av1_ceil_log2(max_d + 1), *min_bits);
+ memset(cache_color_found, 0, n_cache * sizeof(*cache_color_found));
+ int n_in_cache = 0;
+ int in_cache_flags[PALETTE_MAX_SIZE];
+ memset(in_cache_flags, 0, sizeof(in_cache_flags));
+ for (int i = 0; i < n_cache && n_in_cache < n_colors; ++i) {
+ for (int j = 0; j < n_colors; ++j) {
+ if (colors[j] == color_cache[i]) {
+ in_cache_flags[j] = 1;
+ cache_color_found[i] = 1;
+ ++n_in_cache;
+ break;
+ }
+ }
+ }
+ int j = 0;
+ for (int i = 0; i < n_colors; ++i)
+ if (!in_cache_flags[i]) out_cache_colors[j++] = colors[i];
+ assert(j == n_colors - n_in_cache);
+ return j;
}
int av1_get_palette_delta_bits_v(const PALETTE_MODE_INFO *const pmi,
@@ -199,10 +226,10 @@ int av1_get_palette_delta_bits_v(const PALETTE_MODE_INFO *const pmi,
int *min_bits) {
const int n = pmi->palette_size[1];
const int max_val = 1 << bit_depth;
- int max_d = 0, i;
+ int max_d = 0;
*min_bits = bit_depth - 4;
*zero_count = 0;
- for (i = 1; i < n; ++i) {
+ for (int i = 1; i < n; ++i) {
const int delta = pmi->palette_colors[2 * PALETTE_MAX_SIZE + i] -
pmi->palette_colors[2 * PALETTE_MAX_SIZE + i - 1];
const int v = abs(delta);
@@ -215,26 +242,42 @@ int av1_get_palette_delta_bits_v(const PALETTE_MODE_INFO *const pmi,
#endif // CONFIG_PALETTE_DELTA_ENCODING
int av1_palette_color_cost_y(const PALETTE_MODE_INFO *const pmi,
+#if CONFIG_PALETTE_DELTA_ENCODING
+ uint16_t *color_cache, int n_cache,
+#endif // CONFIG_PALETTE_DELTA_ENCODING
int bit_depth) {
const int n = pmi->palette_size[0];
#if CONFIG_PALETTE_DELTA_ENCODING
- int min_bits = 0;
- const int bits = av1_get_palette_delta_bits_y(pmi, bit_depth, &min_bits);
- return av1_cost_bit(128, 0) * (2 + bit_depth + bits * (n - 1));
+ int out_cache_colors[PALETTE_MAX_SIZE];
+ uint8_t cache_color_found[2 * PALETTE_MAX_SIZE];
+ const int n_out_cache =
+ av1_index_color_cache(color_cache, n_cache, pmi->palette_colors, n,
+ cache_color_found, out_cache_colors);
+ const int total_bits =
+ n_cache + delta_encode_cost(out_cache_colors, n_out_cache, bit_depth, 1);
+ return total_bits * av1_cost_bit(128, 0);
#else
return bit_depth * n * av1_cost_bit(128, 0);
#endif // CONFIG_PALETTE_DELTA_ENCODING
}
int av1_palette_color_cost_uv(const PALETTE_MODE_INFO *const pmi,
+#if CONFIG_PALETTE_DELTA_ENCODING
+ uint16_t *color_cache, int n_cache,
+#endif // CONFIG_PALETTE_DELTA_ENCODING
int bit_depth) {
const int n = pmi->palette_size[1];
#if CONFIG_PALETTE_DELTA_ENCODING
- int cost = 0;
+ int total_bits = 0;
// U channel palette color cost.
- int min_bits_u = 0;
- const int bits_u = av1_get_palette_delta_bits_u(pmi, bit_depth, &min_bits_u);
- cost += av1_cost_bit(128, 0) * (2 + bit_depth + bits_u * (n - 1));
+ int out_cache_colors[PALETTE_MAX_SIZE];
+ uint8_t cache_color_found[2 * PALETTE_MAX_SIZE];
+ const int n_out_cache = av1_index_color_cache(
+ color_cache, n_cache, pmi->palette_colors + PALETTE_MAX_SIZE, n,
+ cache_color_found, out_cache_colors);
+ total_bits +=
+ n_cache + delta_encode_cost(out_cache_colors, n_out_cache, bit_depth, 0);
+
// V channel palette color cost.
int zero_count = 0, min_bits_v = 0;
const int bits_v =
@@ -242,8 +285,8 @@ int av1_palette_color_cost_uv(const PALETTE_MODE_INFO *const pmi,
const int bits_using_delta =
2 + bit_depth + (bits_v + 1) * (n - 1) - zero_count;
const int bits_using_raw = bit_depth * n;
- cost += av1_cost_bit(128, 0) * (1 + AOMMIN(bits_using_delta, bits_using_raw));
- return cost;
+ total_bits += 1 + AOMMIN(bits_using_delta, bits_using_raw);
+ return total_bits * av1_cost_bit(128, 0);
#else
return 2 * bit_depth * n * av1_cost_bit(128, 0);
#endif // CONFIG_PALETTE_DELTA_ENCODING
diff --git a/third_party/aom/av1/encoder/palette.h b/third_party/aom/av1/encoder/palette.h
index 5403ac5e6..f5a3c1bdd 100644
--- a/third_party/aom/av1/encoder/palette.h
+++ b/third_party/aom/av1/encoder/palette.h
@@ -45,13 +45,12 @@ int av1_count_colors_highbd(const uint8_t *src8, int stride, int rows, int cols,
#endif // CONFIG_HIGHBITDEPTH
#if CONFIG_PALETTE_DELTA_ENCODING
-// Return the number of bits used to transmit each luma palette color delta.
-int av1_get_palette_delta_bits_y(const PALETTE_MODE_INFO *const pmi,
- int bit_depth, int *min_bits);
-
-// Return the number of bits used to transmit each U palette color delta.
-int av1_get_palette_delta_bits_u(const PALETTE_MODE_INFO *const pmi,
- int bit_depth, int *min_bits);
+// Given a color cache and a set of base colors, find if each cache color is
+// present in the base colors, record the binary results in "cache_color_found".
+// Record the colors that are not in the color cache in "out_cache_colors".
+int av1_index_color_cache(const uint16_t *color_cache, int n_cache,
+ const uint16_t *colors, int n_colors,
+ uint8_t *cache_color_found, int *out_cache_colors);
// Return the number of bits used to transmit each v palette color delta;
// assign zero_count with the number of deltas being 0.
@@ -60,10 +59,17 @@ int av1_get_palette_delta_bits_v(const PALETTE_MODE_INFO *const pmi,
#endif // CONFIG_PALETTE_DELTA_ENCODING
// Return the rate cost for transmitting luma palette color values.
-int av1_palette_color_cost_y(const PALETTE_MODE_INFO *const pmi, int bit_depth);
+int av1_palette_color_cost_y(const PALETTE_MODE_INFO *const pmi,
+#if CONFIG_PALETTE_DELTA_ENCODING
+ uint16_t *color_cache, int n_cache,
+#endif // CONFIG_PALETTE_DELTA_ENCODING
+ int bit_depth);
// Return the rate cost for transmitting chroma palette color values.
int av1_palette_color_cost_uv(const PALETTE_MODE_INFO *const pmi,
+#if CONFIG_PALETTE_DELTA_ENCODING
+ uint16_t *color_cache, int n_cache,
+#endif // CONFIG_PALETTE_DELTA_ENCODING
int bit_depth);
#ifdef __cplusplus
diff --git a/third_party/aom/av1/encoder/pickrst.c b/third_party/aom/av1/encoder/pickrst.c
index 21410e0af..4a446d24e 100644
--- a/third_party/aom/av1/encoder/pickrst.c
+++ b/third_party/aom/av1/encoder/pickrst.c
@@ -31,17 +31,18 @@
#include "av1/encoder/encoder.h"
#include "av1/encoder/picklpf.h"
#include "av1/encoder/pickrst.h"
+#include "av1/encoder/mathutils.h"
// When set to RESTORE_WIENER or RESTORE_SGRPROJ only those are allowed.
// When set to RESTORE_NONE (0) we allow switchable.
const RestorationType force_restore_type = RESTORE_NONE;
// Number of Wiener iterations
-#define NUM_WIENER_ITERS 10
+#define NUM_WIENER_ITERS 5
typedef double (*search_restore_type)(const YV12_BUFFER_CONFIG *src,
AV1_COMP *cpi, int partial_frame,
- RestorationInfo *info,
+ int plane, RestorationInfo *info,
RestorationType *rest_level,
double *best_tile_cost,
YV12_BUFFER_CONFIG *dst_frame);
@@ -216,6 +217,62 @@ static int64_t get_pixel_proj_error(uint8_t *src8, int width, int height,
return err;
}
+#define USE_SGRPROJ_REFINEMENT_SEARCH 1
+static int64_t finer_search_pixel_proj_error(
+ uint8_t *src8, int width, int height, int src_stride, uint8_t *dat8,
+ int dat_stride, int bit_depth, int32_t *flt1, int flt1_stride,
+ int32_t *flt2, int flt2_stride, int start_step, int *xqd) {
+ int64_t err = get_pixel_proj_error(src8, width, height, src_stride, dat8,
+ dat_stride, bit_depth, flt1, flt1_stride,
+ flt2, flt2_stride, xqd);
+ (void)start_step;
+#if USE_SGRPROJ_REFINEMENT_SEARCH
+ int64_t err2;
+ int tap_min[] = { SGRPROJ_PRJ_MIN0, SGRPROJ_PRJ_MIN1 };
+ int tap_max[] = { SGRPROJ_PRJ_MAX0, SGRPROJ_PRJ_MAX1 };
+ for (int s = start_step; s >= 1; s >>= 1) {
+ for (int p = 0; p < 2; ++p) {
+ int skip = 0;
+ do {
+ if (xqd[p] - s >= tap_min[p]) {
+ xqd[p] -= s;
+ err2 = get_pixel_proj_error(src8, width, height, src_stride, dat8,
+ dat_stride, bit_depth, flt1, flt1_stride,
+ flt2, flt2_stride, xqd);
+ if (err2 > err) {
+ xqd[p] += s;
+ } else {
+ err = err2;
+ skip = 1;
+ // At the highest step size continue moving in the same direction
+ if (s == start_step) continue;
+ }
+ }
+ break;
+ } while (1);
+ if (skip) break;
+ do {
+ if (xqd[p] + s <= tap_max[p]) {
+ xqd[p] += s;
+ err2 = get_pixel_proj_error(src8, width, height, src_stride, dat8,
+ dat_stride, bit_depth, flt1, flt1_stride,
+ flt2, flt2_stride, xqd);
+ if (err2 > err) {
+ xqd[p] -= s;
+ } else {
+ err = err2;
+ // At the highest step size continue moving in the same direction
+ if (s == start_step) continue;
+ }
+ }
+ break;
+ } while (1);
+ }
+ }
+#endif // USE_SGRPROJ_REFINEMENT_SEARCH
+ return err;
+}
+
static void get_proj_subspace(uint8_t *src8, int width, int height,
int src_stride, uint8_t *dat8, int dat_stride,
int bit_depth, int32_t *flt1, int flt1_stride,
@@ -329,12 +386,14 @@ static void search_selfguided_restoration(uint8_t *dat8, int width, int height,
#if CONFIG_HIGHBITDEPTH
}
#endif
+ aom_clear_system_state();
get_proj_subspace(src8, width, height, src_stride, dat8, dat_stride,
bit_depth, flt1, width, flt2, width, exq);
+ aom_clear_system_state();
encode_xq(exq, exqd);
- err =
- get_pixel_proj_error(src8, width, height, src_stride, dat8, dat_stride,
- bit_depth, flt1, width, flt2, width, exqd);
+ err = finer_search_pixel_proj_error(src8, width, height, src_stride, dat8,
+ dat_stride, bit_depth, flt1, width,
+ flt2, width, 2, exqd);
if (besterr == -1 || err < besterr) {
bestep = ep;
besterr = err;
@@ -362,8 +421,9 @@ static int count_sgrproj_bits(SgrprojInfo *sgrproj_info,
}
static double search_sgrproj(const YV12_BUFFER_CONFIG *src, AV1_COMP *cpi,
- int partial_frame, RestorationInfo *info,
- RestorationType *type, double *best_tile_cost,
+ int partial_frame, int plane,
+ RestorationInfo *info, RestorationType *type,
+ double *best_tile_cost,
YV12_BUFFER_CONFIG *dst_frame) {
SgrprojInfo *sgrproj_info = info->sgrproj_info;
double err, cost_norestore, cost_sgrproj;
@@ -374,44 +434,68 @@ static double search_sgrproj(const YV12_BUFFER_CONFIG *src, AV1_COMP *cpi,
RestorationInfo *rsi = &cpi->rst_search[0];
int tile_idx, tile_width, tile_height, nhtiles, nvtiles;
int h_start, h_end, v_start, v_end;
- // Allocate for the src buffer at high precision
- const int ntiles = av1_get_rest_ntiles(
- cm->width, cm->height, cm->rst_info[0].restoration_tilesize, &tile_width,
- &tile_height, &nhtiles, &nvtiles);
+ int width, height, src_stride, dgd_stride;
+ uint8_t *dgd_buffer, *src_buffer;
+ if (plane == AOM_PLANE_Y) {
+ width = cm->width;
+ height = cm->height;
+ src_buffer = src->y_buffer;
+ src_stride = src->y_stride;
+ dgd_buffer = dgd->y_buffer;
+ dgd_stride = dgd->y_stride;
+ assert(width == dgd->y_crop_width);
+ assert(height == dgd->y_crop_height);
+ assert(width == src->y_crop_width);
+ assert(height == src->y_crop_height);
+ } else {
+ width = src->uv_crop_width;
+ height = src->uv_crop_height;
+ src_stride = src->uv_stride;
+ dgd_stride = dgd->uv_stride;
+ src_buffer = plane == AOM_PLANE_U ? src->u_buffer : src->v_buffer;
+ dgd_buffer = plane == AOM_PLANE_U ? dgd->u_buffer : dgd->v_buffer;
+ assert(width == dgd->uv_crop_width);
+ assert(height == dgd->uv_crop_height);
+ }
+ const int ntiles =
+ av1_get_rest_ntiles(width, height, cm->rst_info[0].restoration_tilesize,
+ &tile_width, &tile_height, &nhtiles, &nvtiles);
SgrprojInfo ref_sgrproj_info;
set_default_sgrproj(&ref_sgrproj_info);
- rsi->frame_restoration_type = RESTORE_SGRPROJ;
+ rsi[plane].frame_restoration_type = RESTORE_SGRPROJ;
for (tile_idx = 0; tile_idx < ntiles; ++tile_idx) {
- rsi->restoration_type[tile_idx] = RESTORE_NONE;
+ rsi[plane].restoration_type[tile_idx] = RESTORE_NONE;
}
// Compute best Sgrproj filters for each tile
for (tile_idx = 0; tile_idx < ntiles; ++tile_idx) {
av1_get_rest_tile_limits(tile_idx, 0, 0, nhtiles, nvtiles, tile_width,
- tile_height, cm->width, cm->height, 0, 0, &h_start,
- &h_end, &v_start, &v_end);
+ tile_height, width, height, 0, 0, &h_start, &h_end,
+ &v_start, &v_end);
err = sse_restoration_tile(src, cm->frame_to_show, cm, h_start,
- h_end - h_start, v_start, v_end - v_start, 1);
+ h_end - h_start, v_start, v_end - v_start,
+ (1 << plane));
// #bits when a tile is not restored
bits = av1_cost_bit(RESTORE_NONE_SGRPROJ_PROB, 0);
cost_norestore = RDCOST_DBL(x->rdmult, x->rddiv, (bits >> 4), err);
best_tile_cost[tile_idx] = DBL_MAX;
search_selfguided_restoration(
- dgd->y_buffer + v_start * dgd->y_stride + h_start, h_end - h_start,
- v_end - v_start, dgd->y_stride,
- src->y_buffer + v_start * src->y_stride + h_start, src->y_stride,
+ dgd_buffer + v_start * dgd_stride + h_start, h_end - h_start,
+ v_end - v_start, dgd_stride,
+ src_buffer + v_start * src_stride + h_start, src_stride,
#if CONFIG_HIGHBITDEPTH
cm->bit_depth,
#else
8,
#endif // CONFIG_HIGHBITDEPTH
- &rsi->sgrproj_info[tile_idx].ep, rsi->sgrproj_info[tile_idx].xqd,
- cm->rst_internal.tmpbuf);
- rsi->restoration_type[tile_idx] = RESTORE_SGRPROJ;
- err = try_restoration_tile(src, cpi, rsi, 1, partial_frame, tile_idx, 0, 0,
- dst_frame);
- bits = count_sgrproj_bits(&rsi->sgrproj_info[tile_idx], &ref_sgrproj_info)
+ &rsi[plane].sgrproj_info[tile_idx].ep,
+ rsi[plane].sgrproj_info[tile_idx].xqd, cm->rst_internal.tmpbuf);
+ rsi[plane].restoration_type[tile_idx] = RESTORE_SGRPROJ;
+ err = try_restoration_tile(src, cpi, rsi, (1 << plane), partial_frame,
+ tile_idx, 0, 0, dst_frame);
+ bits = count_sgrproj_bits(&rsi[plane].sgrproj_info[tile_idx],
+ &ref_sgrproj_info)
<< AV1_PROB_COST_SHIFT;
bits += av1_cost_bit(RESTORE_NONE_SGRPROJ_PROB, 1);
cost_sgrproj = RDCOST_DBL(x->rdmult, x->rddiv, (bits >> 4), err);
@@ -419,35 +503,34 @@ static double search_sgrproj(const YV12_BUFFER_CONFIG *src, AV1_COMP *cpi,
type[tile_idx] = RESTORE_NONE;
} else {
type[tile_idx] = RESTORE_SGRPROJ;
- memcpy(&sgrproj_info[tile_idx], &rsi->sgrproj_info[tile_idx],
+ memcpy(&sgrproj_info[tile_idx], &rsi[plane].sgrproj_info[tile_idx],
sizeof(sgrproj_info[tile_idx]));
- bits = count_sgrproj_bits(&rsi->sgrproj_info[tile_idx], &ref_sgrproj_info)
- << AV1_PROB_COST_SHIFT;
memcpy(&ref_sgrproj_info, &sgrproj_info[tile_idx],
sizeof(ref_sgrproj_info));
best_tile_cost[tile_idx] = err;
}
- rsi->restoration_type[tile_idx] = RESTORE_NONE;
+ rsi[plane].restoration_type[tile_idx] = RESTORE_NONE;
}
// Cost for Sgrproj filtering
set_default_sgrproj(&ref_sgrproj_info);
- bits = frame_level_restore_bits[rsi->frame_restoration_type]
+ bits = frame_level_restore_bits[rsi[plane].frame_restoration_type]
<< AV1_PROB_COST_SHIFT;
for (tile_idx = 0; tile_idx < ntiles; ++tile_idx) {
bits +=
av1_cost_bit(RESTORE_NONE_SGRPROJ_PROB, type[tile_idx] != RESTORE_NONE);
- memcpy(&rsi->sgrproj_info[tile_idx], &sgrproj_info[tile_idx],
+ memcpy(&rsi[plane].sgrproj_info[tile_idx], &sgrproj_info[tile_idx],
sizeof(sgrproj_info[tile_idx]));
if (type[tile_idx] == RESTORE_SGRPROJ) {
- bits +=
- count_sgrproj_bits(&rsi->sgrproj_info[tile_idx], &ref_sgrproj_info)
- << AV1_PROB_COST_SHIFT;
- memcpy(&ref_sgrproj_info, &rsi->sgrproj_info[tile_idx],
+ bits += count_sgrproj_bits(&rsi[plane].sgrproj_info[tile_idx],
+ &ref_sgrproj_info)
+ << AV1_PROB_COST_SHIFT;
+ memcpy(&ref_sgrproj_info, &rsi[plane].sgrproj_info[tile_idx],
sizeof(ref_sgrproj_info));
}
- rsi->restoration_type[tile_idx] = type[tile_idx];
+ rsi[plane].restoration_type[tile_idx] = type[tile_idx];
}
- err = try_restoration_frame(src, cpi, rsi, 1, partial_frame, dst_frame);
+ err = try_restoration_frame(src, cpi, rsi, (1 << plane), partial_frame,
+ dst_frame);
cost_sgrproj = RDCOST_DBL(x->rdmult, x->rddiv, (bits >> 4), err);
return cost_sgrproj;
@@ -560,46 +643,6 @@ static void compute_stats_highbd(uint8_t *dgd8, uint8_t *src8, int h_start,
}
#endif // CONFIG_HIGHBITDEPTH
-// Solves Ax = b, where x and b are column vectors
-static int linsolve(int n, double *A, int stride, double *b, double *x) {
- int i, j, k;
- double c;
-
- aom_clear_system_state();
-
- // Forward elimination
- for (k = 0; k < n - 1; k++) {
- // Bring the largest magitude to the diagonal position
- for (i = n - 1; i > k; i--) {
- if (fabs(A[(i - 1) * stride + k]) < fabs(A[i * stride + k])) {
- for (j = 0; j < n; j++) {
- c = A[i * stride + j];
- A[i * stride + j] = A[(i - 1) * stride + j];
- A[(i - 1) * stride + j] = c;
- }
- c = b[i];
- b[i] = b[i - 1];
- b[i - 1] = c;
- }
- }
- for (i = k; i < n - 1; i++) {
- if (fabs(A[k * stride + k]) < 1e-10) return 0;
- c = A[(i + 1) * stride + k] / A[k * stride + k];
- for (j = 0; j < n; j++) A[(i + 1) * stride + j] -= c * A[k * stride + j];
- b[i + 1] -= c * b[k];
- }
- }
- // Backward substitution
- for (i = n - 1; i >= 0; i--) {
- if (fabs(A[i * stride + i]) < 1e-10) return 0;
- c = 0;
- for (j = i + 1; j <= n - 1; j++) c += A[i * stride + j] * x[j];
- x[i] = (b[i] - c) / A[i * stride + i];
- }
-
- return 1;
-}
-
static INLINE int wrap_index(int i) {
return (i >= WIENER_HALFWIN1 ? WIENER_WIN - 1 - i : i);
}
@@ -696,8 +739,10 @@ static void update_b_sep_sym(double **Mc, double **Hc, double *a, double *b) {
static int wiener_decompose_sep_sym(double *M, double *H, double *a,
double *b) {
- static const double init_filt[WIENER_WIN] = {
- 0.035623, -0.127154, 0.211436, 0.760190, 0.211436, -0.127154, 0.035623,
+ static const int init_filt[WIENER_WIN] = {
+ WIENER_FILT_TAP0_MIDV, WIENER_FILT_TAP1_MIDV, WIENER_FILT_TAP2_MIDV,
+ WIENER_FILT_TAP3_MIDV, WIENER_FILT_TAP2_MIDV, WIENER_FILT_TAP1_MIDV,
+ WIENER_FILT_TAP0_MIDV,
};
int i, j, iter;
double *Hc[WIENER_WIN2];
@@ -709,8 +754,9 @@ static int wiener_decompose_sep_sym(double *M, double *H, double *a,
H + i * WIENER_WIN * WIENER_WIN2 + j * WIENER_WIN;
}
}
- memcpy(a, init_filt, sizeof(*a) * WIENER_WIN);
- memcpy(b, init_filt, sizeof(*b) * WIENER_WIN);
+ for (i = 0; i < WIENER_WIN; i++) {
+ a[i] = b[i] = (double)init_filt[i] / WIENER_FILT_STEP;
+ }
iter = 1;
while (iter < NUM_WIENER_ITERS) {
@@ -812,158 +858,117 @@ static int count_wiener_bits(WienerInfo *wiener_info,
return bits;
}
-static double search_wiener_uv(const YV12_BUFFER_CONFIG *src, AV1_COMP *cpi,
- int partial_frame, int plane,
- RestorationInfo *info, RestorationType *type,
- YV12_BUFFER_CONFIG *dst_frame) {
- WienerInfo *wiener_info = info->wiener_info;
- AV1_COMMON *const cm = &cpi->common;
- RestorationInfo *rsi = cpi->rst_search;
- int64_t err;
- int bits;
- double cost_wiener, cost_norestore, cost_wiener_frame, cost_norestore_frame;
- MACROBLOCK *x = &cpi->td.mb;
- double M[WIENER_WIN2];
- double H[WIENER_WIN2 * WIENER_WIN2];
- double vfilterd[WIENER_WIN], hfilterd[WIENER_WIN];
- const YV12_BUFFER_CONFIG *dgd = cm->frame_to_show;
- const int width = src->uv_crop_width;
- const int height = src->uv_crop_height;
- const int src_stride = src->uv_stride;
- const int dgd_stride = dgd->uv_stride;
- double score;
- int tile_idx, tile_width, tile_height, nhtiles, nvtiles;
- int h_start, h_end, v_start, v_end;
- const int ntiles =
- av1_get_rest_ntiles(width, height, cm->rst_info[1].restoration_tilesize,
- &tile_width, &tile_height, &nhtiles, &nvtiles);
- WienerInfo ref_wiener_info;
- set_default_wiener(&ref_wiener_info);
- assert(width == dgd->uv_crop_width);
- assert(height == dgd->uv_crop_height);
-
- rsi[plane].frame_restoration_type = RESTORE_NONE;
- err = sse_restoration_frame(cm, src, cm->frame_to_show, (1 << plane));
- bits = 0;
- cost_norestore_frame = RDCOST_DBL(x->rdmult, x->rddiv, (bits >> 4), err);
-
- rsi[plane].frame_restoration_type = RESTORE_WIENER;
-
- for (tile_idx = 0; tile_idx < ntiles; ++tile_idx) {
- rsi[plane].restoration_type[tile_idx] = RESTORE_NONE;
- }
-
- // Compute best Wiener filters for each tile
- for (tile_idx = 0; tile_idx < ntiles; ++tile_idx) {
- av1_get_rest_tile_limits(tile_idx, 0, 0, nhtiles, nvtiles, tile_width,
- tile_height, width, height, 0, 0, &h_start, &h_end,
- &v_start, &v_end);
- err = sse_restoration_tile(src, cm->frame_to_show, cm, h_start,
- h_end - h_start, v_start, v_end - v_start,
- 1 << plane);
- // #bits when a tile is not restored
- bits = av1_cost_bit(RESTORE_NONE_WIENER_PROB, 0);
- cost_norestore = RDCOST_DBL(x->rdmult, x->rddiv, (bits >> 4), err);
- // best_tile_cost[tile_idx] = DBL_MAX;
-
- av1_get_rest_tile_limits(tile_idx, 0, 0, nhtiles, nvtiles, tile_width,
- tile_height, width, height, WIENER_HALFWIN,
- WIENER_HALFWIN, &h_start, &h_end, &v_start,
- &v_end);
- if (plane == AOM_PLANE_U) {
-#if CONFIG_HIGHBITDEPTH
- if (cm->use_highbitdepth)
- compute_stats_highbd(dgd->u_buffer, src->u_buffer, h_start, h_end,
- v_start, v_end, dgd_stride, src_stride, M, H);
- else
-#endif // CONFIG_HIGHBITDEPTH
- compute_stats(dgd->u_buffer, src->u_buffer, h_start, h_end, v_start,
- v_end, dgd_stride, src_stride, M, H);
- } else if (plane == AOM_PLANE_V) {
-#if CONFIG_HIGHBITDEPTH
- if (cm->use_highbitdepth)
- compute_stats_highbd(dgd->v_buffer, src->v_buffer, h_start, h_end,
- v_start, v_end, dgd_stride, src_stride, M, H);
- else
-#endif // CONFIG_HIGHBITDEPTH
- compute_stats(dgd->v_buffer, src->v_buffer, h_start, h_end, v_start,
- v_end, dgd_stride, src_stride, M, H);
- } else {
- assert(0);
- }
-
- type[tile_idx] = RESTORE_WIENER;
-
- if (!wiener_decompose_sep_sym(M, H, vfilterd, hfilterd)) {
- type[tile_idx] = RESTORE_NONE;
- continue;
- }
- quantize_sym_filter(vfilterd, rsi[plane].wiener_info[tile_idx].vfilter);
- quantize_sym_filter(hfilterd, rsi[plane].wiener_info[tile_idx].hfilter);
-
- // Filter score computes the value of the function x'*A*x - x'*b for the
- // learned filter and compares it against identity filer. If there is no
- // reduction in the function, the filter is reverted back to identity
- score = compute_score(M, H, rsi[plane].wiener_info[tile_idx].vfilter,
- rsi[plane].wiener_info[tile_idx].hfilter);
- if (score > 0.0) {
- type[tile_idx] = RESTORE_NONE;
- continue;
- }
-
- rsi[plane].restoration_type[tile_idx] = RESTORE_WIENER;
- err = try_restoration_tile(src, cpi, rsi, 1 << plane, partial_frame,
- tile_idx, 0, 0, dst_frame);
- bits =
- count_wiener_bits(&rsi[plane].wiener_info[tile_idx], &ref_wiener_info)
- << AV1_PROB_COST_SHIFT;
- // bits = WIENER_FILT_BITS << AV1_PROB_COST_SHIFT;
- bits += av1_cost_bit(RESTORE_NONE_WIENER_PROB, 1);
- cost_wiener = RDCOST_DBL(x->rdmult, x->rddiv, (bits >> 4), err);
- if (cost_wiener >= cost_norestore) {
- type[tile_idx] = RESTORE_NONE;
- } else {
- type[tile_idx] = RESTORE_WIENER;
- memcpy(&wiener_info[tile_idx], &rsi[plane].wiener_info[tile_idx],
- sizeof(wiener_info[tile_idx]));
- memcpy(&ref_wiener_info, &rsi[plane].wiener_info[tile_idx],
- sizeof(ref_wiener_info));
+#define USE_WIENER_REFINEMENT_SEARCH 1
+static int64_t finer_tile_search_wiener(const YV12_BUFFER_CONFIG *src,
+ AV1_COMP *cpi, RestorationInfo *rsi,
+ int start_step, int plane, int tile_idx,
+ int partial_frame,
+ YV12_BUFFER_CONFIG *dst_frame) {
+ int64_t err = try_restoration_tile(src, cpi, rsi, 1 << plane, partial_frame,
+ tile_idx, 0, 0, dst_frame);
+ (void)start_step;
+#if USE_WIENER_REFINEMENT_SEARCH
+ int64_t err2;
+ int tap_min[] = { WIENER_FILT_TAP0_MINV, WIENER_FILT_TAP1_MINV,
+ WIENER_FILT_TAP2_MINV };
+ int tap_max[] = { WIENER_FILT_TAP0_MAXV, WIENER_FILT_TAP1_MAXV,
+ WIENER_FILT_TAP2_MAXV };
+ // printf("err pre = %"PRId64"\n", err);
+ for (int s = start_step; s >= 1; s >>= 1) {
+ for (int p = 0; p < WIENER_HALFWIN; ++p) {
+ int skip = 0;
+ do {
+ if (rsi[plane].wiener_info[tile_idx].hfilter[p] - s >= tap_min[p]) {
+ rsi[plane].wiener_info[tile_idx].hfilter[p] -= s;
+ rsi[plane].wiener_info[tile_idx].hfilter[WIENER_WIN - p - 1] -= s;
+ rsi[plane].wiener_info[tile_idx].hfilter[WIENER_HALFWIN] += 2 * s;
+ err2 = try_restoration_tile(src, cpi, rsi, 1 << plane, partial_frame,
+ tile_idx, 0, 0, dst_frame);
+ if (err2 > err) {
+ rsi[plane].wiener_info[tile_idx].hfilter[p] += s;
+ rsi[plane].wiener_info[tile_idx].hfilter[WIENER_WIN - p - 1] += s;
+ rsi[plane].wiener_info[tile_idx].hfilter[WIENER_HALFWIN] -= 2 * s;
+ } else {
+ err = err2;
+ skip = 1;
+ // At the highest step size continue moving in the same direction
+ if (s == start_step) continue;
+ }
+ }
+ break;
+ } while (1);
+ if (skip) break;
+ do {
+ if (rsi[plane].wiener_info[tile_idx].hfilter[p] + s <= tap_max[p]) {
+ rsi[plane].wiener_info[tile_idx].hfilter[p] += s;
+ rsi[plane].wiener_info[tile_idx].hfilter[WIENER_WIN - p - 1] += s;
+ rsi[plane].wiener_info[tile_idx].hfilter[WIENER_HALFWIN] -= 2 * s;
+ err2 = try_restoration_tile(src, cpi, rsi, 1 << plane, partial_frame,
+ tile_idx, 0, 0, dst_frame);
+ if (err2 > err) {
+ rsi[plane].wiener_info[tile_idx].hfilter[p] -= s;
+ rsi[plane].wiener_info[tile_idx].hfilter[WIENER_WIN - p - 1] -= s;
+ rsi[plane].wiener_info[tile_idx].hfilter[WIENER_HALFWIN] += 2 * s;
+ } else {
+ err = err2;
+ // At the highest step size continue moving in the same direction
+ if (s == start_step) continue;
+ }
+ }
+ break;
+ } while (1);
}
- rsi[plane].restoration_type[tile_idx] = RESTORE_NONE;
- }
- // Cost for Wiener filtering
- set_default_wiener(&ref_wiener_info);
- bits = 0;
- for (tile_idx = 0; tile_idx < ntiles; ++tile_idx) {
- bits +=
- av1_cost_bit(RESTORE_NONE_WIENER_PROB, type[tile_idx] != RESTORE_NONE);
- memcpy(&rsi[plane].wiener_info[tile_idx], &wiener_info[tile_idx],
- sizeof(wiener_info[tile_idx]));
- if (type[tile_idx] == RESTORE_WIENER) {
- bits +=
- count_wiener_bits(&rsi[plane].wiener_info[tile_idx], &ref_wiener_info)
- << AV1_PROB_COST_SHIFT;
- memcpy(&ref_wiener_info, &rsi[plane].wiener_info[tile_idx],
- sizeof(ref_wiener_info));
+ for (int p = 0; p < WIENER_HALFWIN; ++p) {
+ int skip = 0;
+ do {
+ if (rsi[plane].wiener_info[tile_idx].vfilter[p] - s >= tap_min[p]) {
+ rsi[plane].wiener_info[tile_idx].vfilter[p] -= s;
+ rsi[plane].wiener_info[tile_idx].vfilter[WIENER_WIN - p - 1] -= s;
+ rsi[plane].wiener_info[tile_idx].vfilter[WIENER_HALFWIN] += 2 * s;
+ err2 = try_restoration_tile(src, cpi, rsi, 1 << plane, partial_frame,
+ tile_idx, 0, 0, dst_frame);
+ if (err2 > err) {
+ rsi[plane].wiener_info[tile_idx].vfilter[p] += s;
+ rsi[plane].wiener_info[tile_idx].vfilter[WIENER_WIN - p - 1] += s;
+ rsi[plane].wiener_info[tile_idx].vfilter[WIENER_HALFWIN] -= 2 * s;
+ } else {
+ err = err2;
+ skip = 1;
+ // At the highest step size continue moving in the same direction
+ if (s == start_step) continue;
+ }
+ }
+ break;
+ } while (1);
+ if (skip) break;
+ do {
+ if (rsi[plane].wiener_info[tile_idx].vfilter[p] + s <= tap_max[p]) {
+ rsi[plane].wiener_info[tile_idx].vfilter[p] += s;
+ rsi[plane].wiener_info[tile_idx].vfilter[WIENER_WIN - p - 1] += s;
+ rsi[plane].wiener_info[tile_idx].vfilter[WIENER_HALFWIN] -= 2 * s;
+ err2 = try_restoration_tile(src, cpi, rsi, 1 << plane, partial_frame,
+ tile_idx, 0, 0, dst_frame);
+ if (err2 > err) {
+ rsi[plane].wiener_info[tile_idx].vfilter[p] -= s;
+ rsi[plane].wiener_info[tile_idx].vfilter[WIENER_WIN - p - 1] -= s;
+ rsi[plane].wiener_info[tile_idx].vfilter[WIENER_HALFWIN] += 2 * s;
+ } else {
+ err = err2;
+ // At the highest step size continue moving in the same direction
+ if (s == start_step) continue;
+ }
+ }
+ break;
+ } while (1);
}
- rsi[plane].restoration_type[tile_idx] = type[tile_idx];
- }
- err = try_restoration_frame(src, cpi, rsi, 1 << plane, partial_frame,
- dst_frame);
- cost_wiener_frame = RDCOST_DBL(x->rdmult, x->rddiv, (bits >> 4), err);
-
- if (cost_wiener_frame < cost_norestore_frame) {
- info->frame_restoration_type = RESTORE_WIENER;
- } else {
- info->frame_restoration_type = RESTORE_NONE;
}
-
- return info->frame_restoration_type == RESTORE_WIENER ? cost_wiener_frame
- : cost_norestore_frame;
+// printf("err post = %"PRId64"\n", err);
+#endif // USE_WIENER_REFINEMENT_SEARCH
+ return err;
}
static double search_wiener(const YV12_BUFFER_CONFIG *src, AV1_COMP *cpi,
- int partial_frame, RestorationInfo *info,
+ int partial_frame, int plane, RestorationInfo *info,
RestorationType *type, double *best_tile_cost,
YV12_BUFFER_CONFIG *dst_frame) {
WienerInfo *wiener_info = info->wiener_info;
@@ -977,38 +982,52 @@ static double search_wiener(const YV12_BUFFER_CONFIG *src, AV1_COMP *cpi,
double H[WIENER_WIN2 * WIENER_WIN2];
double vfilterd[WIENER_WIN], hfilterd[WIENER_WIN];
const YV12_BUFFER_CONFIG *dgd = cm->frame_to_show;
- const int width = cm->width;
- const int height = cm->height;
- const int src_stride = src->y_stride;
- const int dgd_stride = dgd->y_stride;
+ int width, height, src_stride, dgd_stride;
+ uint8_t *dgd_buffer, *src_buffer;
+ if (plane == AOM_PLANE_Y) {
+ width = cm->width;
+ height = cm->height;
+ src_buffer = src->y_buffer;
+ src_stride = src->y_stride;
+ dgd_buffer = dgd->y_buffer;
+ dgd_stride = dgd->y_stride;
+ assert(width == dgd->y_crop_width);
+ assert(height == dgd->y_crop_height);
+ assert(width == src->y_crop_width);
+ assert(height == src->y_crop_height);
+ } else {
+ width = src->uv_crop_width;
+ height = src->uv_crop_height;
+ src_stride = src->uv_stride;
+ dgd_stride = dgd->uv_stride;
+ src_buffer = plane == AOM_PLANE_U ? src->u_buffer : src->v_buffer;
+ dgd_buffer = plane == AOM_PLANE_U ? dgd->u_buffer : dgd->v_buffer;
+ assert(width == dgd->uv_crop_width);
+ assert(height == dgd->uv_crop_height);
+ }
double score;
int tile_idx, tile_width, tile_height, nhtiles, nvtiles;
int h_start, h_end, v_start, v_end;
- const int ntiles =
- av1_get_rest_ntiles(width, height, cm->rst_info[0].restoration_tilesize,
- &tile_width, &tile_height, &nhtiles, &nvtiles);
+ const int ntiles = av1_get_rest_ntiles(
+ width, height, cm->rst_info[plane].restoration_tilesize, &tile_width,
+ &tile_height, &nhtiles, &nvtiles);
WienerInfo ref_wiener_info;
set_default_wiener(&ref_wiener_info);
- assert(width == dgd->y_crop_width);
- assert(height == dgd->y_crop_height);
- assert(width == src->y_crop_width);
- assert(height == src->y_crop_height);
-
- rsi->frame_restoration_type = RESTORE_WIENER;
+ rsi[plane].frame_restoration_type = RESTORE_WIENER;
for (tile_idx = 0; tile_idx < ntiles; ++tile_idx) {
- rsi->restoration_type[tile_idx] = RESTORE_NONE;
+ rsi[plane].restoration_type[tile_idx] = RESTORE_NONE;
}
// Construct a (WIENER_HALFWIN)-pixel border around the frame
#if CONFIG_HIGHBITDEPTH
if (cm->use_highbitdepth)
- extend_frame_highbd(CONVERT_TO_SHORTPTR(dgd->y_buffer), width, height,
+ extend_frame_highbd(CONVERT_TO_SHORTPTR(dgd_buffer), width, height,
dgd_stride);
else
#endif
- extend_frame(dgd->y_buffer, width, height, dgd_stride);
+ extend_frame(dgd_buffer, width, height, dgd_stride);
// Compute best Wiener filters for each tile
for (tile_idx = 0; tile_idx < ntiles; ++tile_idx) {
@@ -1016,7 +1035,8 @@ static double search_wiener(const YV12_BUFFER_CONFIG *src, AV1_COMP *cpi,
tile_height, width, height, 0, 0, &h_start, &h_end,
&v_start, &v_end);
err = sse_restoration_tile(src, cm->frame_to_show, cm, h_start,
- h_end - h_start, v_start, v_end - v_start, 1);
+ h_end - h_start, v_start, v_end - v_start,
+ (1 << plane));
// #bits when a tile is not restored
bits = av1_cost_bit(RESTORE_NONE_WIENER_PROB, 0);
cost_norestore = RDCOST_DBL(x->rdmult, x->rddiv, (bits >> 4), err);
@@ -1027,12 +1047,12 @@ static double search_wiener(const YV12_BUFFER_CONFIG *src, AV1_COMP *cpi,
&v_start, &v_end);
#if CONFIG_HIGHBITDEPTH
if (cm->use_highbitdepth)
- compute_stats_highbd(dgd->y_buffer, src->y_buffer, h_start, h_end,
- v_start, v_end, dgd_stride, src_stride, M, H);
+ compute_stats_highbd(dgd_buffer, src_buffer, h_start, h_end, v_start,
+ v_end, dgd_stride, src_stride, M, H);
else
#endif // CONFIG_HIGHBITDEPTH
- compute_stats(dgd->y_buffer, src->y_buffer, h_start, h_end, v_start,
- v_end, dgd_stride, src_stride, M, H);
+ compute_stats(dgd_buffer, src_buffer, h_start, h_end, v_start, v_end,
+ dgd_stride, src_stride, M, H);
type[tile_idx] = RESTORE_WIENER;
@@ -1040,108 +1060,129 @@ static double search_wiener(const YV12_BUFFER_CONFIG *src, AV1_COMP *cpi,
type[tile_idx] = RESTORE_NONE;
continue;
}
- quantize_sym_filter(vfilterd, rsi->wiener_info[tile_idx].vfilter);
- quantize_sym_filter(hfilterd, rsi->wiener_info[tile_idx].hfilter);
+ quantize_sym_filter(vfilterd, rsi[plane].wiener_info[tile_idx].vfilter);
+ quantize_sym_filter(hfilterd, rsi[plane].wiener_info[tile_idx].hfilter);
// Filter score computes the value of the function x'*A*x - x'*b for the
// learned filter and compares it against identity filer. If there is no
// reduction in the function, the filter is reverted back to identity
- score = compute_score(M, H, rsi->wiener_info[tile_idx].vfilter,
- rsi->wiener_info[tile_idx].hfilter);
+ score = compute_score(M, H, rsi[plane].wiener_info[tile_idx].vfilter,
+ rsi[plane].wiener_info[tile_idx].hfilter);
if (score > 0.0) {
type[tile_idx] = RESTORE_NONE;
continue;
}
+ aom_clear_system_state();
- rsi->restoration_type[tile_idx] = RESTORE_WIENER;
- err = try_restoration_tile(src, cpi, rsi, 1, partial_frame, tile_idx, 0, 0,
- dst_frame);
- bits = count_wiener_bits(&rsi->wiener_info[tile_idx], &ref_wiener_info)
- << AV1_PROB_COST_SHIFT;
+ rsi[plane].restoration_type[tile_idx] = RESTORE_WIENER;
+ err = finer_tile_search_wiener(src, cpi, rsi, 4, plane, tile_idx,
+ partial_frame, dst_frame);
+ bits =
+ count_wiener_bits(&rsi[plane].wiener_info[tile_idx], &ref_wiener_info)
+ << AV1_PROB_COST_SHIFT;
bits += av1_cost_bit(RESTORE_NONE_WIENER_PROB, 1);
cost_wiener = RDCOST_DBL(x->rdmult, x->rddiv, (bits >> 4), err);
if (cost_wiener >= cost_norestore) {
type[tile_idx] = RESTORE_NONE;
} else {
type[tile_idx] = RESTORE_WIENER;
- memcpy(&wiener_info[tile_idx], &rsi->wiener_info[tile_idx],
+ memcpy(&wiener_info[tile_idx], &rsi[plane].wiener_info[tile_idx],
sizeof(wiener_info[tile_idx]));
- memcpy(&ref_wiener_info, &rsi->wiener_info[tile_idx],
+ memcpy(&ref_wiener_info, &rsi[plane].wiener_info[tile_idx],
sizeof(ref_wiener_info));
- bits = count_wiener_bits(&wiener_info[tile_idx], &ref_wiener_info)
- << AV1_PROB_COST_SHIFT;
best_tile_cost[tile_idx] = err;
}
- rsi->restoration_type[tile_idx] = RESTORE_NONE;
+ rsi[plane].restoration_type[tile_idx] = RESTORE_NONE;
}
// Cost for Wiener filtering
set_default_wiener(&ref_wiener_info);
- bits = frame_level_restore_bits[rsi->frame_restoration_type]
+ bits = frame_level_restore_bits[rsi[plane].frame_restoration_type]
<< AV1_PROB_COST_SHIFT;
for (tile_idx = 0; tile_idx < ntiles; ++tile_idx) {
bits +=
av1_cost_bit(RESTORE_NONE_WIENER_PROB, type[tile_idx] != RESTORE_NONE);
- memcpy(&rsi->wiener_info[tile_idx], &wiener_info[tile_idx],
+ memcpy(&rsi[plane].wiener_info[tile_idx], &wiener_info[tile_idx],
sizeof(wiener_info[tile_idx]));
if (type[tile_idx] == RESTORE_WIENER) {
- bits += count_wiener_bits(&rsi->wiener_info[tile_idx], &ref_wiener_info)
- << AV1_PROB_COST_SHIFT;
- memcpy(&ref_wiener_info, &rsi->wiener_info[tile_idx],
+ bits +=
+ count_wiener_bits(&rsi[plane].wiener_info[tile_idx], &ref_wiener_info)
+ << AV1_PROB_COST_SHIFT;
+ memcpy(&ref_wiener_info, &rsi[plane].wiener_info[tile_idx],
sizeof(ref_wiener_info));
}
- rsi->restoration_type[tile_idx] = type[tile_idx];
+ rsi[plane].restoration_type[tile_idx] = type[tile_idx];
}
- err = try_restoration_frame(src, cpi, rsi, 1, partial_frame, dst_frame);
+ err = try_restoration_frame(src, cpi, rsi, 1 << plane, partial_frame,
+ dst_frame);
cost_wiener = RDCOST_DBL(x->rdmult, x->rddiv, (bits >> 4), err);
return cost_wiener;
}
static double search_norestore(const YV12_BUFFER_CONFIG *src, AV1_COMP *cpi,
- int partial_frame, RestorationInfo *info,
- RestorationType *type, double *best_tile_cost,
+ int partial_frame, int plane,
+ RestorationInfo *info, RestorationType *type,
+ double *best_tile_cost,
YV12_BUFFER_CONFIG *dst_frame) {
- double err, cost_norestore;
+ int64_t err;
+ double cost_norestore;
int bits;
MACROBLOCK *x = &cpi->td.mb;
AV1_COMMON *const cm = &cpi->common;
int tile_idx, tile_width, tile_height, nhtiles, nvtiles;
int h_start, h_end, v_start, v_end;
+ int width, height;
+ if (plane == AOM_PLANE_Y) {
+ width = cm->width;
+ height = cm->height;
+ } else {
+ width = src->uv_crop_width;
+ height = src->uv_crop_height;
+ }
const int ntiles = av1_get_rest_ntiles(
- cm->width, cm->height, cm->rst_info[0].restoration_tilesize, &tile_width,
+ width, height, cm->rst_info[plane].restoration_tilesize, &tile_width,
&tile_height, &nhtiles, &nvtiles);
(void)info;
(void)dst_frame;
(void)partial_frame;
+ info->frame_restoration_type = RESTORE_NONE;
for (tile_idx = 0; tile_idx < ntiles; ++tile_idx) {
av1_get_rest_tile_limits(tile_idx, 0, 0, nhtiles, nvtiles, tile_width,
- tile_height, cm->width, cm->height, 0, 0, &h_start,
- &h_end, &v_start, &v_end);
+ tile_height, width, height, 0, 0, &h_start, &h_end,
+ &v_start, &v_end);
err = sse_restoration_tile(src, cm->frame_to_show, cm, h_start,
- h_end - h_start, v_start, v_end - v_start, 1);
+ h_end - h_start, v_start, v_end - v_start,
+ 1 << plane);
type[tile_idx] = RESTORE_NONE;
best_tile_cost[tile_idx] = err;
}
// RD cost associated with no restoration
- err = sse_restoration_tile(src, cm->frame_to_show, cm, 0, cm->width, 0,
- cm->height, 1);
+ err = sse_restoration_frame(cm, src, cm->frame_to_show, (1 << plane));
bits = frame_level_restore_bits[RESTORE_NONE] << AV1_PROB_COST_SHIFT;
cost_norestore = RDCOST_DBL(x->rdmult, x->rddiv, (bits >> 4), err);
return cost_norestore;
}
static double search_switchable_restoration(
- AV1_COMP *cpi, int partial_frame, RestorationInfo *rsi,
+ AV1_COMP *cpi, int partial_frame, int plane, RestorationInfo *rsi,
double *tile_cost[RESTORE_SWITCHABLE_TYPES]) {
AV1_COMMON *const cm = &cpi->common;
MACROBLOCK *x = &cpi->td.mb;
double cost_switchable = 0;
int bits, tile_idx;
RestorationType r;
- const int ntiles = av1_get_rest_ntiles(cm->width, cm->height,
- cm->rst_info[0].restoration_tilesize,
- NULL, NULL, NULL, NULL);
+ int width, height;
+ if (plane == AOM_PLANE_Y) {
+ width = cm->width;
+ height = cm->height;
+ } else {
+ width = ROUND_POWER_OF_TWO(cm->width, cm->subsampling_x);
+ height = ROUND_POWER_OF_TWO(cm->height, cm->subsampling_y);
+ }
+ const int ntiles = av1_get_rest_ntiles(
+ width, height, cm->rst_info[plane].restoration_tilesize, NULL, NULL, NULL,
+ NULL);
SgrprojInfo ref_sgrproj_info;
set_default_sgrproj(&ref_sgrproj_info);
WienerInfo ref_wiener_info;
@@ -1203,57 +1244,60 @@ void av1_pick_filter_restoration(const YV12_BUFFER_CONFIG *src, AV1_COMP *cpi,
double best_cost_restore;
RestorationType r, best_restore;
- const int ntiles = av1_get_rest_ntiles(cm->width, cm->height,
- cm->rst_info[0].restoration_tilesize,
- NULL, NULL, NULL, NULL);
+ const int ntiles_y = av1_get_rest_ntiles(cm->width, cm->height,
+ cm->rst_info[0].restoration_tilesize,
+ NULL, NULL, NULL, NULL);
+ const int ntiles_uv = av1_get_rest_ntiles(
+ ROUND_POWER_OF_TWO(cm->width, cm->subsampling_x),
+ ROUND_POWER_OF_TWO(cm->height, cm->subsampling_y),
+ cm->rst_info[1].restoration_tilesize, NULL, NULL, NULL, NULL);
+ // Assume ntiles_uv is never larger that ntiles_y and so the same arrays work.
for (r = 0; r < RESTORE_SWITCHABLE_TYPES; r++) {
- tile_cost[r] = (double *)aom_malloc(sizeof(*tile_cost[0]) * ntiles);
+ tile_cost[r] = (double *)aom_malloc(sizeof(*tile_cost[0]) * ntiles_y);
restore_types[r] =
- (RestorationType *)aom_malloc(sizeof(*restore_types[0]) * ntiles);
- }
-
- for (r = 0; r < RESTORE_SWITCHABLE_TYPES; ++r) {
- if (force_restore_type != 0)
- if (r != RESTORE_NONE && r != force_restore_type) continue;
- cost_restore[r] = search_restore_fun[r](
- src, cpi, method == LPF_PICK_FROM_SUBIMAGE, &cm->rst_info[0],
- restore_types[r], tile_cost[r], &cpi->trial_frame_rst);
+ (RestorationType *)aom_malloc(sizeof(*restore_types[0]) * ntiles_y);
}
- cost_restore[RESTORE_SWITCHABLE] = search_switchable_restoration(
- cpi, method == LPF_PICK_FROM_SUBIMAGE, &cm->rst_info[0], tile_cost);
- best_cost_restore = DBL_MAX;
- best_restore = 0;
- for (r = 0; r < RESTORE_TYPES; ++r) {
+ for (int plane = AOM_PLANE_Y; plane <= AOM_PLANE_V; ++plane) {
+ for (r = 0; r < RESTORE_SWITCHABLE_TYPES; ++r) {
+ cost_restore[r] = DBL_MAX;
+ if (force_restore_type != 0)
+ if (r != RESTORE_NONE && r != force_restore_type) continue;
+ cost_restore[r] =
+ search_restore_fun[r](src, cpi, method == LPF_PICK_FROM_SUBIMAGE,
+ plane, &cm->rst_info[plane], restore_types[r],
+ tile_cost[r], &cpi->trial_frame_rst);
+ }
+ if (plane == AOM_PLANE_Y)
+ cost_restore[RESTORE_SWITCHABLE] =
+ search_switchable_restoration(cpi, method == LPF_PICK_FROM_SUBIMAGE,
+ plane, &cm->rst_info[plane], tile_cost);
+ else
+ cost_restore[RESTORE_SWITCHABLE] = DBL_MAX;
+ best_cost_restore = DBL_MAX;
+ best_restore = 0;
+ for (r = 0; r < RESTORE_TYPES; ++r) {
+ if (force_restore_type != 0)
+ if (r != RESTORE_NONE && r != force_restore_type) continue;
+ if (cost_restore[r] < best_cost_restore) {
+ best_restore = r;
+ best_cost_restore = cost_restore[r];
+ }
+ }
+ cm->rst_info[plane].frame_restoration_type = best_restore;
if (force_restore_type != 0)
- if (r != RESTORE_NONE && r != force_restore_type) continue;
- if (cost_restore[r] < best_cost_restore) {
- best_restore = r;
- best_cost_restore = cost_restore[r];
+ assert(best_restore == force_restore_type ||
+ best_restore == RESTORE_NONE);
+ if (best_restore != RESTORE_SWITCHABLE) {
+ const int nt = (plane == AOM_PLANE_Y ? ntiles_y : ntiles_uv);
+ memcpy(cm->rst_info[plane].restoration_type, restore_types[best_restore],
+ nt * sizeof(restore_types[best_restore][0]));
}
}
- cm->rst_info[0].frame_restoration_type = best_restore;
- if (force_restore_type != 0)
- assert(best_restore == force_restore_type || best_restore == RESTORE_NONE);
- if (best_restore != RESTORE_SWITCHABLE) {
- memcpy(cm->rst_info[0].restoration_type, restore_types[best_restore],
- ntiles * sizeof(restore_types[best_restore][0]));
- }
-
- // Color components
- search_wiener_uv(src, cpi, method == LPF_PICK_FROM_SUBIMAGE, AOM_PLANE_U,
- &cm->rst_info[AOM_PLANE_U],
- cm->rst_info[AOM_PLANE_U].restoration_type,
- &cpi->trial_frame_rst);
- search_wiener_uv(src, cpi, method == LPF_PICK_FROM_SUBIMAGE, AOM_PLANE_V,
- &cm->rst_info[AOM_PLANE_V],
- cm->rst_info[AOM_PLANE_V].restoration_type,
- &cpi->trial_frame_rst);
/*
- printf("Frame %d/%d restore types: %d %d %d\n",
- cm->current_video_frame, cm->show_frame,
- cm->rst_info[0].frame_restoration_type,
+ printf("Frame %d/%d restore types: %d %d %d\n", cm->current_video_frame,
+ cm->show_frame, cm->rst_info[0].frame_restoration_type,
cm->rst_info[1].frame_restoration_type,
cm->rst_info[2].frame_restoration_type);
printf("Frame %d/%d frame_restore_type %d : %f %f %f %f\n",
diff --git a/third_party/aom/av1/encoder/pvq_encoder.c b/third_party/aom/av1/encoder/pvq_encoder.c
index ab63f1b7d..9d5133012 100644
--- a/third_party/aom/av1/encoder/pvq_encoder.c
+++ b/third_party/aom/av1/encoder/pvq_encoder.c
@@ -247,23 +247,23 @@ static double od_pvq_rate(int qg, int icgr, int theta, int ts,
aom_writer w;
od_pvq_codeword_ctx cd;
int tell;
-#if CONFIG_DAALA_EC
+#if !CONFIG_ANS
od_ec_enc_init(&w.ec, 1000);
#else
-# error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
+# error "CONFIG_PVQ currently requires !CONFIG_ANS."
#endif
OD_COPY(&cd, &adapt->pvq.pvq_codeword_ctx, 1);
-#if CONFIG_DAALA_EC
+#if !CONFIG_ANS
tell = od_ec_enc_tell_frac(&w.ec);
#else
-# error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
+# error "CONFIG_PVQ currently requires !CONFIG_ANS."
#endif
aom_encode_pvq_codeword(&w, &cd, y0, n - (theta != -1), k);
-#if CONFIG_DAALA_EC
+#if !CONFIG_ANS
rate = (od_ec_enc_tell_frac(&w.ec)-tell)/8.;
od_ec_enc_clear(&w.ec);
#else
-# error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
+# error "CONFIG_PVQ currently requires !CONFIG_ANS."
#endif
}
if (qg > 0 && theta >= 0) {
@@ -847,22 +847,22 @@ PVQ_SKIP_TYPE od_pvq_encode(daala_enc_ctx *enc,
int tell2;
od_rollback_buffer dc_buf;
- dc_rate = -OD_LOG2((double)(skip_cdf[3] - skip_cdf[2])/
- (double)(skip_cdf[2] - skip_cdf[1]));
+ dc_rate = -OD_LOG2((double)(OD_ICDF(skip_cdf[3]) - OD_ICDF(skip_cdf[2]))/
+ (double)(OD_ICDF(skip_cdf[2]) - OD_ICDF(skip_cdf[1])));
dc_rate += 1;
-#if CONFIG_DAALA_EC
+#if !CONFIG_ANS
tell2 = od_ec_enc_tell_frac(&enc->w.ec);
#else
-#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
+#error "CONFIG_PVQ currently requires !CONFIG_ANS."
#endif
od_encode_checkpoint(enc, &dc_buf);
generic_encode(&enc->w, &enc->state.adapt->model_dc[pli],
n - 1, &enc->state.adapt->ex_dc[pli][bs][0], 2);
-#if CONFIG_DAALA_EC
+#if !CONFIG_ANS
tell2 = od_ec_enc_tell_frac(&enc->w.ec) - tell2;
#else
-#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
+#error "CONFIG_PVQ currently requires !CONFIG_ANS."
#endif
dc_rate += tell2/8.0;
od_encode_rollback(enc, &dc_buf);
@@ -871,10 +871,10 @@ PVQ_SKIP_TYPE od_pvq_encode(daala_enc_ctx *enc,
enc->pvq_norm_lambda);
}
}
-#if CONFIG_DAALA_EC
+#if !CONFIG_ANS
tell = od_ec_enc_tell_frac(&enc->w.ec);
#else
-#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
+#error "CONFIG_PVQ currently requires !CONFIG_ANS."
#endif
/* Code as if we're not skipping. */
aom_write_symbol(&enc->w, 2 + (out[0] != 0), skip_cdf, 4);
@@ -921,22 +921,22 @@ PVQ_SKIP_TYPE od_pvq_encode(daala_enc_ctx *enc,
}
if (encode_flip) cfl_encoded = 1;
}
-#if CONFIG_DAALA_EC
+#if !CONFIG_ANS
tell = od_ec_enc_tell_frac(&enc->w.ec) - tell;
#else
-#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
+#error "CONFIG_PVQ currently requires !CONFIG_ANS."
#endif
/* Account for the rate of skipping the AC, based on the same DC decision
we made when trying to not skip AC. */
{
double skip_rate;
if (out[0] != 0) {
- skip_rate = -OD_LOG2((skip_cdf[1] - skip_cdf[0])/
- (double)skip_cdf[3]);
+ skip_rate = -OD_LOG2((OD_ICDF(skip_cdf[1]) - OD_ICDF(skip_cdf[0]))/
+ (double)OD_ICDF(skip_cdf[3]));
}
else {
- skip_rate = -OD_LOG2(skip_cdf[0]/
- (double)skip_cdf[3]);
+ skip_rate = -OD_LOG2(OD_ICDF(skip_cdf[0])/
+ (double)OD_ICDF(skip_cdf[3]));
}
tell -= (int)floor(.5+8*skip_rate);
}
@@ -951,22 +951,22 @@ PVQ_SKIP_TYPE od_pvq_encode(daala_enc_ctx *enc,
int tell2;
od_rollback_buffer dc_buf;
- dc_rate = -OD_LOG2((double)(skip_cdf[1] - skip_cdf[0])/
- (double)skip_cdf[0]);
+ dc_rate = -OD_LOG2((double)(OD_ICDF(skip_cdf[1]) - OD_ICDF(skip_cdf[0]))/
+ (double)OD_ICDF(skip_cdf[0]));
dc_rate += 1;
-#if CONFIG_DAALA_EC
+#if !CONFIG_ANS
tell2 = od_ec_enc_tell_frac(&enc->w.ec);
#else
-#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
+#error "CONFIG_PVQ currently requires !CONFIG_ANS."
#endif
od_encode_checkpoint(enc, &dc_buf);
generic_encode(&enc->w, &enc->state.adapt->model_dc[pli],
n - 1, &enc->state.adapt->ex_dc[pli][bs][0], 2);
-#if CONFIG_DAALA_EC
+#if !CONFIG_ANS
tell2 = od_ec_enc_tell_frac(&enc->w.ec) - tell2;
#else
-#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
+#error "CONFIG_PVQ currently requires !CONFIG_ANS."
#endif
dc_rate += tell2/8.0;
od_encode_rollback(enc, &dc_buf);
diff --git a/third_party/aom/av1/encoder/ransac.c b/third_party/aom/av1/encoder/ransac.c
index 5d5dd7572..bbd2d179c 100644
--- a/third_party/aom/av1/encoder/ransac.c
+++ b/third_party/aom/av1/encoder/ransac.c
@@ -8,7 +8,6 @@
* 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.
*/
-#define _POSIX_C_SOURCE 200112L // rand_r()
#include <memory.h>
#include <math.h>
#include <time.h>
@@ -17,6 +16,7 @@
#include <assert.h>
#include "av1/encoder/ransac.h"
+#include "av1/encoder/mathutils.h"
#define MAX_MINPTS 4
#define MAX_DEGENERATE_ITER 10
@@ -133,309 +133,6 @@ static void project_points_double_homography(double *mat, double *points,
}
}
-///////////////////////////////////////////////////////////////////////////////
-// svdcmp
-// Adopted from Numerical Recipes in C
-
-static const double TINY_NEAR_ZERO = 1.0E-12;
-
-static INLINE double sign(double a, double b) {
- return ((b) >= 0 ? fabs(a) : -fabs(a));
-}
-
-static INLINE double pythag(double a, double b) {
- double ct;
- const double absa = fabs(a);
- const double absb = fabs(b);
-
- if (absa > absb) {
- ct = absb / absa;
- return absa * sqrt(1.0 + ct * ct);
- } else {
- ct = absa / absb;
- return (absb == 0) ? 0 : absb * sqrt(1.0 + ct * ct);
- }
-}
-
-static void multiply_mat(const double *m1, const double *m2, double *res,
- const int m1_rows, const int inner_dim,
- const int m2_cols) {
- double sum;
-
- int row, col, inner;
- for (row = 0; row < m1_rows; ++row) {
- for (col = 0; col < m2_cols; ++col) {
- sum = 0;
- for (inner = 0; inner < inner_dim; ++inner)
- sum += m1[row * inner_dim + inner] * m2[inner * m2_cols + col];
- *(res++) = sum;
- }
- }
-}
-
-static int svdcmp(double **u, int m, int n, double w[], double **v) {
- const int max_its = 30;
- int flag, i, its, j, jj, k, l, nm;
- double anorm, c, f, g, h, s, scale, x, y, z;
- double *rv1 = (double *)aom_malloc(sizeof(*rv1) * (n + 1));
- g = scale = anorm = 0.0;
- for (i = 0; i < n; i++) {
- l = i + 1;
- rv1[i] = scale * g;
- g = s = scale = 0.0;
- if (i < m) {
- for (k = i; k < m; k++) scale += fabs(u[k][i]);
- if (scale != 0.) {
- for (k = i; k < m; k++) {
- u[k][i] /= scale;
- s += u[k][i] * u[k][i];
- }
- f = u[i][i];
- g = -sign(sqrt(s), f);
- h = f * g - s;
- u[i][i] = f - g;
- for (j = l; j < n; j++) {
- for (s = 0.0, k = i; k < m; k++) s += u[k][i] * u[k][j];
- f = s / h;
- for (k = i; k < m; k++) u[k][j] += f * u[k][i];
- }
- for (k = i; k < m; k++) u[k][i] *= scale;
- }
- }
- w[i] = scale * g;
- g = s = scale = 0.0;
- if (i < m && i != n - 1) {
- for (k = l; k < n; k++) scale += fabs(u[i][k]);
- if (scale != 0.) {
- for (k = l; k < n; k++) {
- u[i][k] /= scale;
- s += u[i][k] * u[i][k];
- }
- f = u[i][l];
- g = -sign(sqrt(s), f);
- h = f * g - s;
- u[i][l] = f - g;
- for (k = l; k < n; k++) rv1[k] = u[i][k] / h;
- for (j = l; j < m; j++) {
- for (s = 0.0, k = l; k < n; k++) s += u[j][k] * u[i][k];
- for (k = l; k < n; k++) u[j][k] += s * rv1[k];
- }
- for (k = l; k < n; k++) u[i][k] *= scale;
- }
- }
- anorm = fmax(anorm, (fabs(w[i]) + fabs(rv1[i])));
- }
-
- for (i = n - 1; i >= 0; i--) {
- if (i < n - 1) {
- if (g != 0.) {
- for (j = l; j < n; j++) v[j][i] = (u[i][j] / u[i][l]) / g;
- for (j = l; j < n; j++) {
- for (s = 0.0, k = l; k < n; k++) s += u[i][k] * v[k][j];
- for (k = l; k < n; k++) v[k][j] += s * v[k][i];
- }
- }
- for (j = l; j < n; j++) v[i][j] = v[j][i] = 0.0;
- }
- v[i][i] = 1.0;
- g = rv1[i];
- l = i;
- }
- for (i = AOMMIN(m, n) - 1; i >= 0; i--) {
- l = i + 1;
- g = w[i];
- for (j = l; j < n; j++) u[i][j] = 0.0;
- if (g != 0.) {
- g = 1.0 / g;
- for (j = l; j < n; j++) {
- for (s = 0.0, k = l; k < m; k++) s += u[k][i] * u[k][j];
- f = (s / u[i][i]) * g;
- for (k = i; k < m; k++) u[k][j] += f * u[k][i];
- }
- for (j = i; j < m; j++) u[j][i] *= g;
- } else {
- for (j = i; j < m; j++) u[j][i] = 0.0;
- }
- ++u[i][i];
- }
- for (k = n - 1; k >= 0; k--) {
- for (its = 0; its < max_its; its++) {
- flag = 1;
- for (l = k; l >= 0; l--) {
- nm = l - 1;
- if ((double)(fabs(rv1[l]) + anorm) == anorm || nm < 0) {
- flag = 0;
- break;
- }
- if ((double)(fabs(w[nm]) + anorm) == anorm) break;
- }
- if (flag) {
- c = 0.0;
- s = 1.0;
- for (i = l; i <= k; i++) {
- f = s * rv1[i];
- rv1[i] = c * rv1[i];
- if ((double)(fabs(f) + anorm) == anorm) break;
- g = w[i];
- h = pythag(f, g);
- w[i] = h;
- h = 1.0 / h;
- c = g * h;
- s = -f * h;
- for (j = 0; j < m; j++) {
- y = u[j][nm];
- z = u[j][i];
- u[j][nm] = y * c + z * s;
- u[j][i] = z * c - y * s;
- }
- }
- }
- z = w[k];
- if (l == k) {
- if (z < 0.0) {
- w[k] = -z;
- for (j = 0; j < n; j++) v[j][k] = -v[j][k];
- }
- break;
- }
- if (its == max_its - 1) {
- aom_free(rv1);
- return 1;
- }
- assert(k > 0);
- x = w[l];
- nm = k - 1;
- y = w[nm];
- g = rv1[nm];
- h = rv1[k];
- f = ((y - z) * (y + z) + (g - h) * (g + h)) / (2.0 * h * y);
- g = pythag(f, 1.0);
- f = ((x - z) * (x + z) + h * ((y / (f + sign(g, f))) - h)) / x;
- c = s = 1.0;
- for (j = l; j <= nm; j++) {
- i = j + 1;
- g = rv1[i];
- y = w[i];
- h = s * g;
- g = c * g;
- z = pythag(f, h);
- rv1[j] = z;
- c = f / z;
- s = h / z;
- f = x * c + g * s;
- g = g * c - x * s;
- h = y * s;
- y *= c;
- for (jj = 0; jj < n; jj++) {
- x = v[jj][j];
- z = v[jj][i];
- v[jj][j] = x * c + z * s;
- v[jj][i] = z * c - x * s;
- }
- z = pythag(f, h);
- w[j] = z;
- if (z != 0.) {
- z = 1.0 / z;
- c = f * z;
- s = h * z;
- }
- f = c * g + s * y;
- x = c * y - s * g;
- for (jj = 0; jj < m; jj++) {
- y = u[jj][j];
- z = u[jj][i];
- u[jj][j] = y * c + z * s;
- u[jj][i] = z * c - y * s;
- }
- }
- rv1[l] = 0.0;
- rv1[k] = f;
- w[k] = x;
- }
- }
- aom_free(rv1);
- return 0;
-}
-
-static int SVD(double *U, double *W, double *V, double *matx, int M, int N) {
- // Assumes allocation for U is MxN
- double **nrU = (double **)aom_malloc((M) * sizeof(*nrU));
- double **nrV = (double **)aom_malloc((N) * sizeof(*nrV));
- int problem, i;
-
- problem = !(nrU && nrV);
- if (!problem) {
- for (i = 0; i < M; i++) {
- nrU[i] = &U[i * N];
- }
- for (i = 0; i < N; i++) {
- nrV[i] = &V[i * N];
- }
- } else {
- if (nrU) aom_free(nrU);
- if (nrV) aom_free(nrV);
- return 1;
- }
-
- /* copy from given matx into nrU */
- for (i = 0; i < M; i++) {
- memcpy(&(nrU[i][0]), matx + N * i, N * sizeof(*matx));
- }
-
- /* HERE IT IS: do SVD */
- if (svdcmp(nrU, M, N, W, nrV)) {
- aom_free(nrU);
- aom_free(nrV);
- return 1;
- }
-
- /* aom_free Numerical Recipes arrays */
- aom_free(nrU);
- aom_free(nrV);
-
- return 0;
-}
-
-int pseudo_inverse(double *inv, double *matx, const int M, const int N) {
- double ans;
- int i, j, k;
- double *const U = (double *)aom_malloc(M * N * sizeof(*matx));
- double *const W = (double *)aom_malloc(N * sizeof(*matx));
- double *const V = (double *)aom_malloc(N * N * sizeof(*matx));
-
- if (!(U && W && V)) {
- return 1;
- }
- if (SVD(U, W, V, matx, M, N)) {
- aom_free(U);
- aom_free(W);
- aom_free(V);
- return 1;
- }
- for (i = 0; i < N; i++) {
- if (fabs(W[i]) < TINY_NEAR_ZERO) {
- aom_free(U);
- aom_free(W);
- aom_free(V);
- return 1;
- }
- }
-
- for (i = 0; i < N; i++) {
- for (j = 0; j < M; j++) {
- ans = 0;
- for (k = 0; k < N; k++) {
- ans += V[k + N * i] * U[k + N * j] / W[k];
- }
- inv[j + M * i] = ans;
- }
- }
- aom_free(U);
- aom_free(W);
- aom_free(V);
- return 0;
-}
-
static void normalize_homography(double *pts, int n, double *T) {
double *p = pts;
double mean[2] = { 0, 0 };
@@ -597,7 +294,7 @@ static int find_translation(int np, double *pts1, double *pts2, double *mat) {
static int find_rotzoom(int np, double *pts1, double *pts2, double *mat) {
const int np2 = np * 2;
- double *a = (double *)aom_malloc(sizeof(*a) * np2 * 9);
+ double *a = (double *)aom_malloc(sizeof(*a) * (np2 * 5 + 20));
double *b = a + np2 * 4;
double *temp = b + np2;
int i;
@@ -625,11 +322,10 @@ static int find_rotzoom(int np, double *pts1, double *pts2, double *mat) {
b[2 * i] = dx;
b[2 * i + 1] = dy;
}
- if (pseudo_inverse(temp, a, np2, 4)) {
+ if (!least_squares(4, a, np2, 4, b, temp, mat)) {
aom_free(a);
return 1;
}
- multiply_mat(temp, b, mat, 4, np2, 1);
denormalize_rotzoom_reorder(mat, T1, T2);
aom_free(a);
return 0;
@@ -637,7 +333,7 @@ static int find_rotzoom(int np, double *pts1, double *pts2, double *mat) {
static int find_affine(int np, double *pts1, double *pts2, double *mat) {
const int np2 = np * 2;
- double *a = (double *)aom_malloc(sizeof(*a) * np2 * 13);
+ double *a = (double *)aom_malloc(sizeof(*a) * (np2 * 7 + 42));
double *b = a + np2 * 6;
double *temp = b + np2;
int i;
@@ -669,11 +365,10 @@ static int find_affine(int np, double *pts1, double *pts2, double *mat) {
b[2 * i] = dx;
b[2 * i + 1] = dy;
}
- if (pseudo_inverse(temp, a, np2, 6)) {
+ if (!least_squares(6, a, np2, 6, b, temp, mat)) {
aom_free(a);
return 1;
}
- multiply_mat(temp, b, mat, 6, np2, 1);
denormalize_affine_reorder(mat, T1, T2);
aom_free(a);
return 0;
@@ -890,16 +585,22 @@ static int find_homography(int np, double *pts1, double *pts2, double *mat) {
return 0;
}
+// Generate a random number in the range [0, 32768).
+static unsigned int lcg_rand16(unsigned int *state) {
+ *state = (unsigned int)(*state * 1103515245ULL + 12345);
+ return *state / 65536 % 32768;
+}
+
static int get_rand_indices(int npoints, int minpts, int *indices,
unsigned int *seed) {
int i, j;
- int ptr = rand_r(seed) % npoints;
+ int ptr = lcg_rand16(seed) % npoints;
if (minpts > npoints) return 0;
indices[0] = ptr;
ptr = (ptr == npoints - 1 ? 0 : ptr + 1);
i = 1;
while (i < minpts) {
- int index = rand_r(seed) % npoints;
+ int index = lcg_rand16(seed) % npoints;
while (index) {
ptr = (ptr == npoints - 1 ? 0 : ptr + 1);
for (j = 0; j < i; ++j) {
@@ -986,6 +687,9 @@ static int ransac(const int *matched_points, int npoints,
double *cnp1, *cnp2;
+ for (i = 0; i < num_desired_motions; ++i) {
+ num_inliers_by_motion[i] = 0;
+ }
if (npoints < minpts * MINPTS_MULTIPLIER || npoints == 0) {
return 1;
}
@@ -1072,7 +776,7 @@ static int ransac(const int *matched_points, int npoints,
if (current_motion.num_inliers >= worst_kept_motion->num_inliers &&
current_motion.num_inliers > 1) {
int temp;
- double fracinliers, pNoOutliers, mean_distance;
+ double fracinliers, pNoOutliers, mean_distance, dtemp;
mean_distance = sum_distance / ((double)current_motion.num_inliers);
current_motion.variance =
sum_distance_squared / ((double)current_motion.num_inliers - 1.0) -
@@ -1092,7 +796,10 @@ static int ransac(const int *matched_points, int npoints,
pNoOutliers = 1 - pow(fracinliers, minpts);
pNoOutliers = fmax(EPS, pNoOutliers);
pNoOutliers = fmin(1 - EPS, pNoOutliers);
- temp = (int)(log(1.0 - PROBABILITY_REQUIRED) / log(pNoOutliers));
+ dtemp = log(1.0 - PROBABILITY_REQUIRED) / log(pNoOutliers);
+ temp = (dtemp > (double)INT32_MAX)
+ ? INT32_MAX
+ : dtemp < (double)INT32_MIN ? INT32_MIN : (int)dtemp;
if (temp > 0 && temp < N) {
N = AOMMAX(temp, MIN_TRIALS);
diff --git a/third_party/aom/av1/encoder/ratectrl.c b/third_party/aom/av1/encoder/ratectrl.c
index 1f2ea3606..4552c674e 100644
--- a/third_party/aom/av1/encoder/ratectrl.c
+++ b/third_party/aom/av1/encoder/ratectrl.c
@@ -93,6 +93,11 @@ static int gf_low = 400;
static int kf_high = 5000;
static int kf_low = 400;
+double av1_resize_rate_factor(const AV1_COMP *cpi) {
+ return (double)(cpi->resize_scale_den * cpi->resize_scale_den) /
+ (cpi->resize_scale_num * cpi->resize_scale_num);
+}
+
// Functions to compute the active minq lookup table entries based on a
// formulaic approach to facilitate easier adjustment of the Q tables.
// The formulae were derived from computing a 3rd order polynomial best
@@ -384,7 +389,7 @@ static double get_rate_correction_factor(const AV1_COMP *cpi) {
else
rcf = rc->rate_correction_factors[INTER_NORMAL];
}
- rcf *= rcf_mult[rc->frame_size_selector];
+ rcf *= av1_resize_rate_factor(cpi);
return fclamp(rcf, MIN_BPB_FACTOR, MAX_BPB_FACTOR);
}
@@ -392,7 +397,7 @@ static void set_rate_correction_factor(AV1_COMP *cpi, double factor) {
RATE_CONTROL *const rc = &cpi->rc;
// Normalize RCF to account for the size-dependent scaling factor.
- factor /= rcf_mult[cpi->rc.frame_size_selector];
+ factor /= av1_resize_rate_factor(cpi);
factor = fclamp(factor, MIN_BPB_FACTOR, MAX_BPB_FACTOR);
@@ -1076,7 +1081,7 @@ static int rc_pick_q_and_bounds_two_pass(const AV1_COMP *cpi, int *bottom_index,
}
// Modify active_best_quality for downscaled normal frames.
- if (rc->frame_size_selector != UNSCALED && !frame_is_kf_gf_arf(cpi)) {
+ if (!av1_resize_unscaled(cpi) && !frame_is_kf_gf_arf(cpi)) {
int qdelta = av1_compute_qdelta_by_rate(
rc, cm->frame_type, active_best_quality, 2.0, cm->bit_depth);
active_best_quality =
@@ -1158,11 +1163,10 @@ void av1_rc_set_frame_target(AV1_COMP *cpi, int target) {
rc->this_frame_target = target;
- // Modify frame size target when down-scaling.
- if (cpi->oxcf.resize_mode == RESIZE_DYNAMIC &&
- rc->frame_size_selector != UNSCALED)
- rc->this_frame_target = (int)(rc->this_frame_target *
- rate_thresh_mult[rc->frame_size_selector]);
+ // Modify frame size target when down-scaled.
+ if (cpi->oxcf.resize_mode == RESIZE_DYNAMIC && !av1_resize_unscaled(cpi))
+ rc->this_frame_target =
+ (int)(rc->this_frame_target * av1_resize_rate_factor(cpi));
// Target rate per SB64 (including partial SB64s.
rc->sb64_target_rate = (int)((int64_t)rc->this_frame_target * 64 * 64) /
@@ -1225,7 +1229,6 @@ static void update_golden_frame_stats(AV1_COMP *cpi) {
void av1_rc_postencode_update(AV1_COMP *cpi, uint64_t bytes_used) {
const AV1_COMMON *const cm = &cpi->common;
- const AV1EncoderConfig *const oxcf = &cpi->oxcf;
RATE_CONTROL *const rc = &cpi->rc;
const int qindex = cm->base_qindex;
@@ -1317,13 +1320,6 @@ void av1_rc_postencode_update(AV1_COMP *cpi, uint64_t bytes_used) {
rc->frames_since_key++;
rc->frames_to_key--;
}
-
- // Trigger the resizing of the next frame if it is scaled.
- if (oxcf->pass != 0) {
- cpi->resize_pending =
- rc->next_frame_size_selector != rc->frame_size_selector;
- rc->frame_size_selector = rc->next_frame_size_selector;
- }
}
void av1_rc_postencode_update_drop_frame(AV1_COMP *cpi) {
@@ -1501,10 +1497,7 @@ void av1_rc_get_one_pass_cbr_params(AV1_COMP *cpi) {
target = calc_pframe_target_size_one_pass_cbr(cpi);
av1_rc_set_frame_target(cpi, target);
- if (cpi->oxcf.resize_mode == RESIZE_DYNAMIC)
- cpi->resize_pending = av1_resize_one_pass_cbr(cpi);
- else
- cpi->resize_pending = 0;
+ // TODO(afergs): Decide whether to scale up, down, or not at all
}
int av1_compute_qdelta(const RATE_CONTROL *rc, double qstart, double qtarget,
@@ -1670,90 +1663,3 @@ void av1_set_target_rate(AV1_COMP *cpi) {
vbr_rate_correction(cpi, &target_rate);
av1_rc_set_frame_target(cpi, target_rate);
}
-
-// Check if we should resize, based on average QP from past x frames.
-// Only allow for resize at most one scale down for now, scaling factor is 2.
-int av1_resize_one_pass_cbr(AV1_COMP *cpi) {
- const AV1_COMMON *const cm = &cpi->common;
- RATE_CONTROL *const rc = &cpi->rc;
- int resize_now = 0;
- cpi->resize_scale_num = 1;
- cpi->resize_scale_den = 1;
- // Don't resize on key frame; reset the counters on key frame.
- if (cm->frame_type == KEY_FRAME) {
- cpi->resize_avg_qp = 0;
- cpi->resize_count = 0;
- return 0;
- }
- // Resize based on average buffer underflow and QP over some window.
- // Ignore samples close to key frame, since QP is usually high after key.
- if (cpi->rc.frames_since_key > 2 * cpi->framerate) {
- const int window = (int)(5 * cpi->framerate);
- cpi->resize_avg_qp += cm->base_qindex;
- if (cpi->rc.buffer_level < (int)(30 * rc->optimal_buffer_level / 100))
- ++cpi->resize_buffer_underflow;
- ++cpi->resize_count;
- // Check for resize action every "window" frames.
- if (cpi->resize_count >= window) {
- int avg_qp = cpi->resize_avg_qp / cpi->resize_count;
- // Resize down if buffer level has underflowed sufficent amount in past
- // window, and we are at original resolution.
- // Resize back up if average QP is low, and we are currently in a resized
- // down state.
- if (cpi->resize_state == 0 &&
- cpi->resize_buffer_underflow > (cpi->resize_count >> 2)) {
- resize_now = 1;
- cpi->resize_state = 1;
- } else if (cpi->resize_state == 1 &&
- avg_qp < 40 * cpi->rc.worst_quality / 100) {
- resize_now = -1;
- cpi->resize_state = 0;
- }
- // Reset for next window measurement.
- cpi->resize_avg_qp = 0;
- cpi->resize_count = 0;
- cpi->resize_buffer_underflow = 0;
- }
- }
- // If decision is to resize, reset some quantities, and check is we should
- // reduce rate correction factor,
- if (resize_now != 0) {
- int target_bits_per_frame;
- int active_worst_quality;
- int qindex;
- int tot_scale_change;
- // For now, resize is by 1/2 x 1/2.
- cpi->resize_scale_num = 1;
- cpi->resize_scale_den = 2;
- tot_scale_change = (cpi->resize_scale_den * cpi->resize_scale_den) /
- (cpi->resize_scale_num * cpi->resize_scale_num);
- // Reset buffer level to optimal, update target size.
- rc->buffer_level = rc->optimal_buffer_level;
- rc->bits_off_target = rc->optimal_buffer_level;
- rc->this_frame_target = calc_pframe_target_size_one_pass_cbr(cpi);
- // Reset cyclic refresh parameters.
- if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ && cm->seg.enabled)
- av1_cyclic_refresh_reset_resize(cpi);
- // Get the projected qindex, based on the scaled target frame size (scaled
- // so target_bits_per_mb in av1_rc_regulate_q will be correct target).
- target_bits_per_frame = (resize_now == 1)
- ? rc->this_frame_target * tot_scale_change
- : rc->this_frame_target / tot_scale_change;
- active_worst_quality = calc_active_worst_quality_one_pass_cbr(cpi);
- qindex = av1_rc_regulate_q(cpi, target_bits_per_frame, rc->best_quality,
- active_worst_quality);
- // If resize is down, check if projected q index is close to worst_quality,
- // and if so, reduce the rate correction factor (since likely can afford
- // lower q for resized frame).
- if (resize_now == 1 && qindex > 90 * cpi->rc.worst_quality / 100) {
- rc->rate_correction_factors[INTER_NORMAL] *= 0.85;
- }
- // If resize is back up, check if projected q index is too much above the
- // current base_qindex, and if so, reduce the rate correction factor
- // (since prefer to keep q for resized frame at least close to previous q).
- if (resize_now == -1 && qindex > 130 * cm->base_qindex / 100) {
- rc->rate_correction_factors[INTER_NORMAL] *= 0.9;
- }
- }
- return resize_now;
-}
diff --git a/third_party/aom/av1/encoder/ratectrl.h b/third_party/aom/av1/encoder/ratectrl.h
index 93a9b4939..61bb0c224 100644
--- a/third_party/aom/av1/encoder/ratectrl.h
+++ b/third_party/aom/av1/encoder/ratectrl.h
@@ -49,27 +49,6 @@ typedef enum {
} RATE_FACTOR_LEVEL;
#endif // CONFIG_EXT_REFS
-// Internal frame scaling level.
-typedef enum {
- UNSCALED = 0, // Frame is unscaled.
- SCALE_STEP1 = 1, // First-level down-scaling.
- FRAME_SCALE_STEPS
-} FRAME_SCALE_LEVEL;
-
-// Frame dimensions multiplier wrt the native frame size, in 1/16ths,
-// specified for the scale-up case.
-// e.g. 24 => 16/24 = 2/3 of native size. The restriction to 1/16th is
-// intended to match the capabilities of the normative scaling filters,
-// giving precedence to the up-scaling accuracy.
-static const int frame_scale_factor[FRAME_SCALE_STEPS] = { 16, 24 };
-
-// Multiplier of the target rate to be used as threshold for triggering scaling.
-static const double rate_thresh_mult[FRAME_SCALE_STEPS] = { 1.0, 2.0 };
-
-// Scale dependent Rate Correction Factor multipliers. Compensates for the
-// greater number of bits per pixel generated in down-scaled frames.
-static const double rcf_mult[FRAME_SCALE_STEPS] = { 1.0, 2.0 };
-
typedef struct {
// Rate targetting variables
int base_frame_target; // A baseline frame target before adjustment
@@ -162,10 +141,6 @@ typedef struct {
int q_2_frame;
// Auto frame-scaling variables.
- FRAME_SCALE_LEVEL frame_size_selector;
- FRAME_SCALE_LEVEL next_frame_size_selector;
- int frame_width[FRAME_SCALE_STEPS];
- int frame_height[FRAME_SCALE_STEPS];
int rf_level_maxq[RATE_FACTOR_LEVELS];
} RATE_CONTROL;
@@ -214,6 +189,10 @@ int av1_rc_get_default_max_gf_interval(double framerate, int min_frame_rate);
void av1_rc_get_one_pass_vbr_params(struct AV1_COMP *cpi);
void av1_rc_get_one_pass_cbr_params(struct AV1_COMP *cpi);
+// How many times less pixels there are to encode given the current scaling.
+// Temporary replacement for rcf_mult and rate_thresh_mult.
+double av1_resize_rate_factor(const struct AV1_COMP *cpi);
+
// Post encode update of the rate control parameters based
// on bytes used
void av1_rc_postencode_update(struct AV1_COMP *cpi, uint64_t bytes_used);
diff --git a/third_party/aom/av1/encoder/rd.c b/third_party/aom/av1/encoder/rd.c
index f06e569e7..94c3bb96d 100644
--- a/third_party/aom/av1/encoder/rd.c
+++ b/third_party/aom/av1/encoder/rd.c
@@ -330,7 +330,6 @@ static void set_block_thresholds(const AV1_COMMON *cm, RD_OPT *rd) {
}
}
-#if CONFIG_REF_MV
void av1_set_mvcost(MACROBLOCK *x, MV_REFERENCE_FRAME ref_frame, int ref,
int ref_mv_idx) {
MB_MODE_INFO_EXT *mbmi_ext = x->mbmi_ext;
@@ -340,19 +339,14 @@ void av1_set_mvcost(MACROBLOCK *x, MV_REFERENCE_FRAME ref_frame, int ref,
(void)ref_frame;
x->mvcost = x->mv_cost_stack[nmv_ctx];
x->nmvjointcost = x->nmv_vec_cost[nmv_ctx];
- x->mvsadcost = x->mvcost;
- x->nmvjointsadcost = x->nmvjointcost;
}
-#endif
void av1_initialize_rd_consts(AV1_COMP *cpi) {
AV1_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &cpi->td.mb;
RD_OPT *const rd = &cpi->rd;
int i;
-#if CONFIG_REF_MV
int nmv_ctx;
-#endif
aom_clear_system_state();
@@ -363,7 +357,6 @@ void av1_initialize_rd_consts(AV1_COMP *cpi) {
set_block_thresholds(cm, rd);
-#if CONFIG_REF_MV
for (nmv_ctx = 0; nmv_ctx < NMV_CONTEXTS; ++nmv_ctx) {
av1_build_nmv_cost_table(
x->nmv_vec_cost[nmv_ctx],
@@ -373,19 +366,11 @@ void av1_initialize_rd_consts(AV1_COMP *cpi) {
}
x->mvcost = x->mv_cost_stack[0];
x->nmvjointcost = x->nmv_vec_cost[0];
- x->mvsadcost = x->mvcost;
- x->nmvjointsadcost = x->nmvjointcost;
-#else
- av1_build_nmv_cost_table(
- x->nmvjointcost, cm->allow_high_precision_mv ? x->nmvcost_hp : x->nmvcost,
- &cm->fc->nmvc, cm->allow_high_precision_mv);
-#endif
if (cpi->oxcf.pass != 1) {
av1_fill_token_costs(x->token_costs, cm->fc->coef_probs);
- if (cpi->sf.partition_search_type != VAR_BASED_PARTITION ||
- cm->frame_type == KEY_FRAME) {
+ if (cm->frame_type == KEY_FRAME) {
#if CONFIG_EXT_PARTITION_TYPES
for (i = 0; i < PARTITION_PLOFFSET; ++i)
av1_cost_tokens(cpi->partition_cost[i], cm->fc->partition_prob[i],
@@ -425,7 +410,6 @@ void av1_initialize_rd_consts(AV1_COMP *cpi) {
fill_mode_costs(cpi);
if (!frame_is_intra_only(cm)) {
-#if CONFIG_REF_MV
for (i = 0; i < NEWMV_MODE_CONTEXTS; ++i) {
cpi->newmv_mode_cost[i][0] = av1_cost_bit(cm->fc->newmv_prob[i], 0);
cpi->newmv_mode_cost[i][1] = av1_cost_bit(cm->fc->newmv_prob[i], 1);
@@ -445,20 +429,17 @@ void av1_initialize_rd_consts(AV1_COMP *cpi) {
cpi->drl_mode_cost0[i][0] = av1_cost_bit(cm->fc->drl_prob[i], 0);
cpi->drl_mode_cost0[i][1] = av1_cost_bit(cm->fc->drl_prob[i], 1);
}
-#else
- for (i = 0; i < INTER_MODE_CONTEXTS; ++i)
- av1_cost_tokens((int *)cpi->inter_mode_cost[i],
- cm->fc->inter_mode_probs[i], av1_inter_mode_tree);
-#endif // CONFIG_REF_MV
#if CONFIG_EXT_INTER
for (i = 0; i < INTER_MODE_CONTEXTS; ++i)
av1_cost_tokens((int *)cpi->inter_compound_mode_cost[i],
cm->fc->inter_compound_mode_probs[i],
av1_inter_compound_mode_tree);
+#if CONFIG_INTERINTRA
for (i = 0; i < BLOCK_SIZE_GROUPS; ++i)
av1_cost_tokens((int *)cpi->interintra_mode_cost[i],
cm->fc->interintra_mode_prob[i],
av1_interintra_mode_tree);
+#endif // CONFIG_INTERINTRA
#endif // CONFIG_EXT_INTER
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
for (i = BLOCK_8X8; i < BLOCK_SIZES; i++) {
@@ -575,9 +556,15 @@ static void get_entropy_contexts_plane(
const ENTROPY_CONTEXT *const above = pd->above_context;
const ENTROPY_CONTEXT *const left = pd->left_context;
+#if CONFIG_LV_MAP
+ memcpy(t_above, above, sizeof(ENTROPY_CONTEXT) * num_4x4_w);
+ memcpy(t_left, left, sizeof(ENTROPY_CONTEXT) * num_4x4_h);
+ return;
+#endif // CONFIG_LV_MAP
+
int i;
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
switch (tx_size) {
case TX_2X2:
memcpy(t_above, above, sizeof(ENTROPY_CONTEXT) * num_4x4_w);
@@ -609,6 +596,20 @@ static void get_entropy_contexts_plane(
t_left[i] =
!!(*(const uint64_t *)&left[i] | *(const uint64_t *)&left[i + 8]);
break;
+#if CONFIG_TX64X64
+ case TX_64X64:
+ for (i = 0; i < num_4x4_w; i += 32)
+ t_above[i] =
+ !!(*(const uint64_t *)&above[i] | *(const uint64_t *)&above[i + 8] |
+ *(const uint64_t *)&above[i + 16] |
+ *(const uint64_t *)&above[i + 24]);
+ for (i = 0; i < num_4x4_h; i += 32)
+ t_left[i] =
+ !!(*(const uint64_t *)&left[i] | *(const uint64_t *)&left[i + 8] |
+ *(const uint64_t *)&left[i + 16] |
+ *(const uint64_t *)&left[i + 24]);
+ break;
+#endif // CONFIG_TX64X64
case TX_4X8:
for (i = 0; i < num_4x4_w; i += 2)
t_above[i] = !!*(const uint16_t *)&above[i];
@@ -647,11 +648,39 @@ static void get_entropy_contexts_plane(
for (i = 0; i < num_4x4_h; i += 8)
t_left[i] = !!*(const uint64_t *)&left[i];
break;
+#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
+ case TX_4X16:
+ for (i = 0; i < num_4x4_w; i += 2)
+ t_above[i] = !!*(const uint16_t *)&above[i];
+ for (i = 0; i < num_4x4_h; i += 8)
+ t_left[i] = !!*(const uint64_t *)&left[i];
+ break;
+ case TX_16X4:
+ for (i = 0; i < num_4x4_w; i += 8)
+ t_above[i] = !!*(const uint64_t *)&above[i];
+ for (i = 0; i < num_4x4_h; i += 2)
+ t_left[i] = !!*(const uint16_t *)&left[i];
+ break;
+ case TX_8X32:
+ for (i = 0; i < num_4x4_w; i += 4)
+ t_above[i] = !!*(const uint32_t *)&above[i];
+ for (i = 0; i < num_4x4_h; i += 16)
+ t_left[i] =
+ !!(*(const uint64_t *)&left[i] | *(const uint64_t *)&left[i + 8]);
+ break;
+ case TX_32X8:
+ for (i = 0; i < num_4x4_w; i += 16)
+ t_above[i] =
+ !!(*(const uint64_t *)&above[i] | *(const uint64_t *)&above[i + 8]);
+ for (i = 0; i < num_4x4_h; i += 4)
+ t_left[i] = !!*(const uint32_t *)&left[i];
+ break;
+#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
default: assert(0 && "Invalid transform size."); break;
}
return;
-#endif
+#endif // CONFIG_CHROMA_2X2
switch (tx_size) {
case TX_4X4:
@@ -720,6 +749,30 @@ static void get_entropy_contexts_plane(
for (i = 0; i < num_4x4_h; i += 4)
t_left[i] = !!*(const uint32_t *)&left[i];
break;
+#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
+ case TX_4X16:
+ memcpy(t_above, above, sizeof(ENTROPY_CONTEXT) * num_4x4_w);
+ for (i = 0; i < num_4x4_h; i += 4)
+ t_left[i] = !!*(const uint32_t *)&left[i];
+ break;
+ case TX_16X4:
+ for (i = 0; i < num_4x4_w; i += 4)
+ t_above[i] = !!*(const uint32_t *)&above[i];
+ memcpy(t_left, left, sizeof(ENTROPY_CONTEXT) * num_4x4_h);
+ break;
+ case TX_8X32:
+ for (i = 0; i < num_4x4_w; i += 2)
+ t_above[i] = !!*(const uint16_t *)&above[i];
+ for (i = 0; i < num_4x4_h; i += 8)
+ t_left[i] = !!*(const uint64_t *)&left[i];
+ break;
+ case TX_32X8:
+ for (i = 0; i < num_4x4_w; i += 8)
+ t_above[i] = !!*(const uint64_t *)&above[i];
+ for (i = 0; i < num_4x4_h; i += 2)
+ t_left[i] = !!*(const uint16_t *)&left[i];
+ break;
+#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
default: assert(0 && "Invalid transform size."); break;
}
}
@@ -728,7 +781,12 @@ void av1_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size,
const struct macroblockd_plane *pd,
ENTROPY_CONTEXT t_above[2 * MAX_MIB_SIZE],
ENTROPY_CONTEXT t_left[2 * MAX_MIB_SIZE]) {
+#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
get_entropy_contexts_plane(plane_bsize, tx_size, pd, t_above, t_left);
}
@@ -740,27 +798,25 @@ void av1_mv_pred(const AV1_COMP *cpi, MACROBLOCK *x, uint8_t *ref_y_buffer,
int best_sad = INT_MAX;
int this_sad = INT_MAX;
int max_mv = 0;
- int near_same_nearest;
uint8_t *src_y_ptr = x->plane[0].src.buf;
uint8_t *ref_y_ptr;
- const int num_mv_refs =
- MAX_MV_REF_CANDIDATES +
- (cpi->sf.adaptive_motion_search && block_size < x->max_partition_size);
-
- MV pred_mv[3];
- pred_mv[0] = x->mbmi_ext->ref_mvs[ref_frame][0].as_mv;
- pred_mv[1] = x->mbmi_ext->ref_mvs[ref_frame][1].as_mv;
- pred_mv[2] = x->pred_mv[ref_frame];
+ MV pred_mv[MAX_MV_REF_CANDIDATES + 1];
+ int num_mv_refs = 0;
+
+ pred_mv[num_mv_refs++] = x->mbmi_ext->ref_mvs[ref_frame][0].as_mv;
+ if (x->mbmi_ext->ref_mvs[ref_frame][0].as_int !=
+ x->mbmi_ext->ref_mvs[ref_frame][1].as_int) {
+ pred_mv[num_mv_refs++] = x->mbmi_ext->ref_mvs[ref_frame][1].as_mv;
+ }
+ if (cpi->sf.adaptive_motion_search && block_size < x->max_partition_size)
+ pred_mv[num_mv_refs++] = x->pred_mv[ref_frame];
+
assert(num_mv_refs <= (int)(sizeof(pred_mv) / sizeof(pred_mv[0])));
- near_same_nearest = x->mbmi_ext->ref_mvs[ref_frame][0].as_int ==
- x->mbmi_ext->ref_mvs[ref_frame][1].as_int;
// Get the sad for each candidate reference mv.
for (i = 0; i < num_mv_refs; ++i) {
const MV *this_mv = &pred_mv[i];
int fp_row, fp_col;
-
- if (i == 1 && near_same_nearest) continue;
fp_row = (this_mv->row + 3 + (this_mv->row >= 0)) >> 3;
fp_col = (this_mv->col + 3 + (this_mv->col >= 0)) >> 3;
max_mv = AOMMAX(max_mv, AOMMAX(abs(this_mv->row), abs(this_mv->col)) >> 3);
@@ -959,8 +1015,6 @@ void av1_set_rd_speed_thresholds(AV1_COMP *cpi) {
#if CONFIG_EXT_INTER
- rd->thresh_mult[THR_COMP_NEAREST_NEARLA] += 1200;
- rd->thresh_mult[THR_COMP_NEAR_NEARESTLA] += 1200;
rd->thresh_mult[THR_COMP_NEAR_NEARLA] += 1200;
rd->thresh_mult[THR_COMP_NEAREST_NEWLA] += 1500;
rd->thresh_mult[THR_COMP_NEW_NEARESTLA] += 1500;
@@ -970,8 +1024,6 @@ void av1_set_rd_speed_thresholds(AV1_COMP *cpi) {
rd->thresh_mult[THR_COMP_ZERO_ZEROLA] += 2500;
#if CONFIG_EXT_REFS
- rd->thresh_mult[THR_COMP_NEAREST_NEARL2A] += 1200;
- rd->thresh_mult[THR_COMP_NEAR_NEARESTL2A] += 1200;
rd->thresh_mult[THR_COMP_NEAR_NEARL2A] += 1200;
rd->thresh_mult[THR_COMP_NEAREST_NEWL2A] += 1500;
rd->thresh_mult[THR_COMP_NEW_NEARESTL2A] += 1500;
@@ -980,8 +1032,6 @@ void av1_set_rd_speed_thresholds(AV1_COMP *cpi) {
rd->thresh_mult[THR_COMP_NEW_NEWL2A] += 2000;
rd->thresh_mult[THR_COMP_ZERO_ZEROL2A] += 2500;
- rd->thresh_mult[THR_COMP_NEAREST_NEARL3A] += 1200;
- rd->thresh_mult[THR_COMP_NEAR_NEARESTL3A] += 1200;
rd->thresh_mult[THR_COMP_NEAR_NEARL3A] += 1200;
rd->thresh_mult[THR_COMP_NEAREST_NEWL3A] += 1500;
rd->thresh_mult[THR_COMP_NEW_NEARESTL3A] += 1500;
@@ -991,8 +1041,6 @@ void av1_set_rd_speed_thresholds(AV1_COMP *cpi) {
rd->thresh_mult[THR_COMP_ZERO_ZEROL3A] += 2500;
#endif // CONFIG_EXT_REFS
- rd->thresh_mult[THR_COMP_NEAREST_NEARGA] += 1200;
- rd->thresh_mult[THR_COMP_NEAR_NEARESTGA] += 1200;
rd->thresh_mult[THR_COMP_NEAR_NEARGA] += 1200;
rd->thresh_mult[THR_COMP_NEAREST_NEWGA] += 1500;
rd->thresh_mult[THR_COMP_NEW_NEARESTGA] += 1500;
@@ -1002,8 +1050,6 @@ void av1_set_rd_speed_thresholds(AV1_COMP *cpi) {
rd->thresh_mult[THR_COMP_ZERO_ZEROGA] += 2500;
#if CONFIG_EXT_REFS
- rd->thresh_mult[THR_COMP_NEAREST_NEARLB] += 1200;
- rd->thresh_mult[THR_COMP_NEAR_NEARESTLB] += 1200;
rd->thresh_mult[THR_COMP_NEAR_NEARLB] += 1200;
rd->thresh_mult[THR_COMP_NEAREST_NEWLB] += 1500;
rd->thresh_mult[THR_COMP_NEW_NEARESTLB] += 1500;
@@ -1012,8 +1058,6 @@ void av1_set_rd_speed_thresholds(AV1_COMP *cpi) {
rd->thresh_mult[THR_COMP_NEW_NEWLB] += 2000;
rd->thresh_mult[THR_COMP_ZERO_ZEROLB] += 2500;
- rd->thresh_mult[THR_COMP_NEAREST_NEARL2B] += 1200;
- rd->thresh_mult[THR_COMP_NEAR_NEARESTL2B] += 1200;
rd->thresh_mult[THR_COMP_NEAR_NEARL2B] += 1200;
rd->thresh_mult[THR_COMP_NEAREST_NEWL2B] += 1500;
rd->thresh_mult[THR_COMP_NEW_NEARESTL2B] += 1500;
@@ -1022,8 +1066,6 @@ void av1_set_rd_speed_thresholds(AV1_COMP *cpi) {
rd->thresh_mult[THR_COMP_NEW_NEWL2B] += 2000;
rd->thresh_mult[THR_COMP_ZERO_ZEROL2B] += 2500;
- rd->thresh_mult[THR_COMP_NEAREST_NEARL3B] += 1200;
- rd->thresh_mult[THR_COMP_NEAR_NEARESTL3B] += 1200;
rd->thresh_mult[THR_COMP_NEAR_NEARL3B] += 1200;
rd->thresh_mult[THR_COMP_NEAREST_NEWL3B] += 1500;
rd->thresh_mult[THR_COMP_NEW_NEARESTL3B] += 1500;
@@ -1032,8 +1074,6 @@ void av1_set_rd_speed_thresholds(AV1_COMP *cpi) {
rd->thresh_mult[THR_COMP_NEW_NEWL3B] += 2000;
rd->thresh_mult[THR_COMP_ZERO_ZEROL3B] += 2500;
- rd->thresh_mult[THR_COMP_NEAREST_NEARGB] += 1200;
- rd->thresh_mult[THR_COMP_NEAR_NEARESTGB] += 1200;
rd->thresh_mult[THR_COMP_NEAR_NEARGB] += 1200;
rd->thresh_mult[THR_COMP_NEAREST_NEWGB] += 1500;
rd->thresh_mult[THR_COMP_NEW_NEARESTGB] += 1500;
diff --git a/third_party/aom/av1/encoder/rd.h b/third_party/aom/av1/encoder/rd.h
index c0ac1f7e7..5c3eee493 100644
--- a/third_party/aom/av1/encoder/rd.h
+++ b/third_party/aom/av1/encoder/rd.h
@@ -130,6 +130,10 @@ typedef enum {
#if CONFIG_ALT_INTRA
THR_SMOOTH,
+#if CONFIG_SMOOTH_HV
+ THR_SMOOTH_V,
+ THR_SMOOTH_H,
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
#if CONFIG_EXT_INTER
@@ -357,6 +361,9 @@ static INLINE void av1_init_rd_stats(RD_STATS *rd_stats) {
rd_stats->rdcost = 0;
rd_stats->sse = 0;
rd_stats->skip = 1;
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ rd_stats->dist_y = 0;
+#endif
#if CONFIG_RD_DEBUG
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
rd_stats->txb_coeff_cost[plane] = 0;
@@ -381,6 +388,9 @@ static INLINE void av1_invalid_rd_stats(RD_STATS *rd_stats) {
rd_stats->rdcost = INT64_MAX;
rd_stats->sse = INT64_MAX;
rd_stats->skip = 0;
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ rd_stats->dist_y = INT64_MAX;
+#endif
#if CONFIG_RD_DEBUG
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
rd_stats->txb_coeff_cost[plane] = INT_MAX;
@@ -405,6 +415,9 @@ static INLINE void av1_merge_rd_stats(RD_STATS *rd_stats_dst,
rd_stats_dst->dist += rd_stats_src->dist;
rd_stats_dst->sse += rd_stats_src->sse;
rd_stats_dst->skip &= rd_stats_src->skip;
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ rd_stats_dst->dist_y += rd_stats_src->dist_y;
+#endif
#if CONFIG_RD_DEBUG
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
rd_stats_dst->txb_coeff_cost[plane] += rd_stats_src->txb_coeff_cost[plane];
@@ -454,10 +467,8 @@ YV12_BUFFER_CONFIG *av1_get_scaled_ref_frame(const struct AV1_COMP *cpi,
void av1_init_me_luts(void);
-#if CONFIG_REF_MV
void av1_set_mvcost(MACROBLOCK *x, MV_REFERENCE_FRAME ref_frame, int ref,
int ref_mv_idx);
-#endif
void av1_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size,
const struct macroblockd_plane *pd,
diff --git a/third_party/aom/av1/encoder/rdopt.c b/third_party/aom/av1/encoder/rdopt.c
index a1096f782..2a537a06a 100644
--- a/third_party/aom/av1/encoder/rdopt.c
+++ b/third_party/aom/av1/encoder/rdopt.c
@@ -66,11 +66,18 @@
#endif // CONFIG_PVQ || CONFIG_DAALA_DIST
#if CONFIG_DUAL_FILTER
#define DUAL_FILTER_SET_SIZE (SWITCHABLE_FILTERS * SWITCHABLE_FILTERS)
+#if USE_EXTRA_FILTER
static const int filter_sets[DUAL_FILTER_SET_SIZE][2] = {
{ 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 }, { 1, 0 }, { 1, 1 },
{ 1, 2 }, { 1, 3 }, { 2, 0 }, { 2, 1 }, { 2, 2 }, { 2, 3 },
{ 3, 0 }, { 3, 1 }, { 3, 2 }, { 3, 3 },
};
+#else // USE_EXTRA_FILTER
+static const int filter_sets[DUAL_FILTER_SET_SIZE][2] = {
+ { 0, 0 }, { 0, 1 }, { 0, 2 }, { 1, 0 }, { 1, 1 },
+ { 1, 2 }, { 2, 0 }, { 2, 1 }, { 2, 2 },
+};
+#endif // USE_EXTRA_FILTER
#endif // CONFIG_DUAL_FILTER
#if CONFIG_EXT_REFS
@@ -217,11 +224,13 @@ static const MODE_DEFINITION av1_mode_order[MAX_MODES] = {
#if CONFIG_ALT_INTRA
{ SMOOTH_PRED, { INTRA_FRAME, NONE_FRAME } },
+#if CONFIG_SMOOTH_HV
+ { SMOOTH_V_PRED, { INTRA_FRAME, NONE_FRAME } },
+ { SMOOTH_H_PRED, { INTRA_FRAME, NONE_FRAME } },
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
#if CONFIG_EXT_INTER
- { NEAR_NEARESTMV, { LAST_FRAME, ALTREF_FRAME } },
- { NEAREST_NEARMV, { LAST_FRAME, ALTREF_FRAME } },
{ NEAR_NEARMV, { LAST_FRAME, ALTREF_FRAME } },
{ NEW_NEARESTMV, { LAST_FRAME, ALTREF_FRAME } },
{ NEAREST_NEWMV, { LAST_FRAME, ALTREF_FRAME } },
@@ -231,8 +240,6 @@ static const MODE_DEFINITION av1_mode_order[MAX_MODES] = {
{ ZERO_ZEROMV, { LAST_FRAME, ALTREF_FRAME } },
#if CONFIG_EXT_REFS
- { NEAR_NEARESTMV, { LAST2_FRAME, ALTREF_FRAME } },
- { NEAREST_NEARMV, { LAST2_FRAME, ALTREF_FRAME } },
{ NEAR_NEARMV, { LAST2_FRAME, ALTREF_FRAME } },
{ NEW_NEARESTMV, { LAST2_FRAME, ALTREF_FRAME } },
{ NEAREST_NEWMV, { LAST2_FRAME, ALTREF_FRAME } },
@@ -241,8 +248,6 @@ static const MODE_DEFINITION av1_mode_order[MAX_MODES] = {
{ NEW_NEWMV, { LAST2_FRAME, ALTREF_FRAME } },
{ ZERO_ZEROMV, { LAST2_FRAME, ALTREF_FRAME } },
- { NEAR_NEARESTMV, { LAST3_FRAME, ALTREF_FRAME } },
- { NEAREST_NEARMV, { LAST3_FRAME, ALTREF_FRAME } },
{ NEAR_NEARMV, { LAST3_FRAME, ALTREF_FRAME } },
{ NEW_NEARESTMV, { LAST3_FRAME, ALTREF_FRAME } },
{ NEAREST_NEWMV, { LAST3_FRAME, ALTREF_FRAME } },
@@ -252,8 +257,6 @@ static const MODE_DEFINITION av1_mode_order[MAX_MODES] = {
{ ZERO_ZEROMV, { LAST3_FRAME, ALTREF_FRAME } },
#endif // CONFIG_EXT_REFS
- { NEAR_NEARESTMV, { GOLDEN_FRAME, ALTREF_FRAME } },
- { NEAREST_NEARMV, { GOLDEN_FRAME, ALTREF_FRAME } },
{ NEAR_NEARMV, { GOLDEN_FRAME, ALTREF_FRAME } },
{ NEW_NEARESTMV, { GOLDEN_FRAME, ALTREF_FRAME } },
{ NEAREST_NEWMV, { GOLDEN_FRAME, ALTREF_FRAME } },
@@ -263,8 +266,6 @@ static const MODE_DEFINITION av1_mode_order[MAX_MODES] = {
{ ZERO_ZEROMV, { GOLDEN_FRAME, ALTREF_FRAME } },
#if CONFIG_EXT_REFS
- { NEAR_NEARESTMV, { LAST_FRAME, BWDREF_FRAME } },
- { NEAREST_NEARMV, { LAST_FRAME, BWDREF_FRAME } },
{ NEAR_NEARMV, { LAST_FRAME, BWDREF_FRAME } },
{ NEW_NEARESTMV, { LAST_FRAME, BWDREF_FRAME } },
{ NEAREST_NEWMV, { LAST_FRAME, BWDREF_FRAME } },
@@ -273,8 +274,6 @@ static const MODE_DEFINITION av1_mode_order[MAX_MODES] = {
{ NEW_NEWMV, { LAST_FRAME, BWDREF_FRAME } },
{ ZERO_ZEROMV, { LAST_FRAME, BWDREF_FRAME } },
- { NEAR_NEARESTMV, { LAST2_FRAME, BWDREF_FRAME } },
- { NEAREST_NEARMV, { LAST2_FRAME, BWDREF_FRAME } },
{ NEAR_NEARMV, { LAST2_FRAME, BWDREF_FRAME } },
{ NEW_NEARESTMV, { LAST2_FRAME, BWDREF_FRAME } },
{ NEAREST_NEWMV, { LAST2_FRAME, BWDREF_FRAME } },
@@ -283,8 +282,6 @@ static const MODE_DEFINITION av1_mode_order[MAX_MODES] = {
{ NEW_NEWMV, { LAST2_FRAME, BWDREF_FRAME } },
{ ZERO_ZEROMV, { LAST2_FRAME, BWDREF_FRAME } },
- { NEAR_NEARESTMV, { LAST3_FRAME, BWDREF_FRAME } },
- { NEAREST_NEARMV, { LAST3_FRAME, BWDREF_FRAME } },
{ NEAR_NEARMV, { LAST3_FRAME, BWDREF_FRAME } },
{ NEW_NEARESTMV, { LAST3_FRAME, BWDREF_FRAME } },
{ NEAREST_NEWMV, { LAST3_FRAME, BWDREF_FRAME } },
@@ -293,8 +290,6 @@ static const MODE_DEFINITION av1_mode_order[MAX_MODES] = {
{ NEW_NEWMV, { LAST3_FRAME, BWDREF_FRAME } },
{ ZERO_ZEROMV, { LAST3_FRAME, BWDREF_FRAME } },
- { NEAR_NEARESTMV, { GOLDEN_FRAME, BWDREF_FRAME } },
- { NEAREST_NEARMV, { GOLDEN_FRAME, BWDREF_FRAME } },
{ NEAR_NEARMV, { GOLDEN_FRAME, BWDREF_FRAME } },
{ NEW_NEARESTMV, { GOLDEN_FRAME, BWDREF_FRAME } },
{ NEAREST_NEWMV, { GOLDEN_FRAME, BWDREF_FRAME } },
@@ -390,28 +385,6 @@ static const MODE_DEFINITION av1_mode_order[MAX_MODES] = {
#endif // CONFIG_EXT_INTER
};
-static const REF_DEFINITION av1_ref_order[MAX_REFS] = {
- { { LAST_FRAME, NONE_FRAME } },
-#if CONFIG_EXT_REFS
- { { LAST2_FRAME, NONE_FRAME } }, { { LAST3_FRAME, NONE_FRAME } },
- { { BWDREF_FRAME, NONE_FRAME } },
-#endif // CONFIG_EXT_REFS
- { { GOLDEN_FRAME, NONE_FRAME } }, { { ALTREF_FRAME, NONE_FRAME } },
-
- { { LAST_FRAME, ALTREF_FRAME } },
-#if CONFIG_EXT_REFS
- { { LAST2_FRAME, ALTREF_FRAME } }, { { LAST3_FRAME, ALTREF_FRAME } },
-#endif // CONFIG_EXT_REFS
- { { GOLDEN_FRAME, ALTREF_FRAME } },
-
-#if CONFIG_EXT_REFS
- { { LAST_FRAME, BWDREF_FRAME } }, { { LAST2_FRAME, BWDREF_FRAME } },
- { { LAST3_FRAME, BWDREF_FRAME } }, { { GOLDEN_FRAME, BWDREF_FRAME } },
-#endif // CONFIG_EXT_REFS
-
- { { INTRA_FRAME, NONE_FRAME } },
-};
-
#if CONFIG_EXT_INTRA || CONFIG_FILTER_INTRA || CONFIG_PALETTE
static INLINE int write_uniform_cost(int n, int v) {
const int l = get_unsigned_bits(n);
@@ -430,22 +403,6 @@ static INLINE int write_uniform_cost(int n, int v) {
#define FAST_EXT_TX_CORR_MARGIN 0.5
#define FAST_EXT_TX_EDST_MARGIN 0.3
-static const TX_TYPE_1D vtx_tab[TX_TYPES] = {
- DCT_1D, ADST_1D, DCT_1D, ADST_1D,
-#if CONFIG_EXT_TX
- FLIPADST_1D, DCT_1D, FLIPADST_1D, ADST_1D, FLIPADST_1D, IDTX_1D,
- DCT_1D, IDTX_1D, ADST_1D, IDTX_1D, FLIPADST_1D, IDTX_1D,
-#endif // CONFIG_EXT_TX
-};
-
-static const TX_TYPE_1D htx_tab[TX_TYPES] = {
- DCT_1D, DCT_1D, ADST_1D, ADST_1D,
-#if CONFIG_EXT_TX
- DCT_1D, FLIPADST_1D, FLIPADST_1D, FLIPADST_1D, ADST_1D, IDTX_1D,
- IDTX_1D, DCT_1D, IDTX_1D, ADST_1D, IDTX_1D, FLIPADST_1D,
-#endif // CONFIG_EXT_TX
-};
-
#if CONFIG_DAALA_DIST
static int od_compute_var_4x4(od_coeff *x, int stride) {
int sum;
@@ -603,10 +560,9 @@ static double od_compute_dist(int qm, int activity_masking, od_coeff *x,
return sum;
}
-static int64_t av1_daala_dist(const uint8_t *src, int src_stride,
- const uint8_t *dst, int dst_stride, int bsw,
- int bsh, int qm, int use_activity_masking,
- int qindex) {
+int64_t av1_daala_dist(const uint8_t *src, int src_stride, const uint8_t *dst,
+ int dst_stride, int bsw, int bsh, int qm,
+ int use_activity_masking, int qindex) {
int i, j;
int64_t d;
DECLARE_ALIGNED(16, od_coeff, orig[MAX_TX_SQUARE]);
@@ -843,7 +799,7 @@ static int prune_one_for_sby(const AV1_COMP *cpi, BLOCK_SIZE bsize,
static int prune_tx_types(const AV1_COMP *cpi, BLOCK_SIZE bsize, MACROBLOCK *x,
const MACROBLOCKD *const xd, int tx_set) {
#if CONFIG_EXT_TX
- const int *tx_set_1D = ext_tx_used_inter_1D[tx_set];
+ const int *tx_set_1D = tx_set >= 0 ? ext_tx_used_inter_1D[tx_set] : NULL;
#else
const int tx_set_1D[TX_TYPES_1D] = { 0 };
#endif // CONFIG_EXT_TX
@@ -1100,13 +1056,10 @@ static int cost_coeffs(const AV1_COMMON *const cm, MACROBLOCK *x, int plane,
int c, cost;
const int16_t *scan = scan_order->scan;
const int16_t *nb = scan_order->neighbors;
-#if CONFIG_NEW_TOKENSET
const int ref = is_inter_block(mbmi);
aom_prob *blockz_probs =
cm->fc->blockzero_probs[txsize_sqr_map[tx_size]][type][ref];
-#endif // CONFIG_NEW_TOKENSET
-
#if CONFIG_HIGHBITDEPTH
const int cat6_bits = av1_get_cat6_extrabits_size(tx_size, xd->bd);
#else
@@ -1120,12 +1073,8 @@ static int cost_coeffs(const AV1_COMMON *const cm, MACROBLOCK *x, int plane,
(void)cm;
if (eob == 0) {
-#if CONFIG_NEW_TOKENSET
// single eob token
cost = av1_cost_bit(blockz_probs[pt], 0);
-#else
- cost = token_costs[0][0][pt][EOB_TOKEN];
-#endif // CONFIG_NEW_TOKENSET
} else {
if (use_fast_coef_costing) {
int band_left = *band_count++;
@@ -1134,11 +1083,7 @@ static int cost_coeffs(const AV1_COMMON *const cm, MACROBLOCK *x, int plane,
int v = qcoeff[0];
int16_t prev_t;
cost = av1_get_token_cost(v, &prev_t, cat6_bits);
-#if CONFIG_NEW_TOKENSET
cost += (*token_costs)[!prev_t][pt][prev_t];
-#else
- cost += (*token_costs)[0][pt][prev_t];
-#endif
token_cache[0] = av1_pt_energy_class[prev_t];
++token_costs;
@@ -1150,11 +1095,7 @@ static int cost_coeffs(const AV1_COMMON *const cm, MACROBLOCK *x, int plane,
v = qcoeff[rc];
cost += av1_get_token_cost(v, &t, cat6_bits);
-#if CONFIG_NEW_TOKENSET
cost += (*token_costs)[!t][!prev_t][t];
-#else
- cost += (*token_costs)[!prev_t][!prev_t][t];
-#endif
prev_t = t;
if (!--band_left) {
band_left = *band_count++;
@@ -1163,8 +1104,7 @@ static int cost_coeffs(const AV1_COMMON *const cm, MACROBLOCK *x, int plane,
}
// eob token
- if (band_left || CONFIG_NEW_TOKENSET)
- cost += (*token_costs)[0][!prev_t][EOB_TOKEN];
+ cost += (*token_costs)[0][!prev_t][EOB_TOKEN];
} else { // !use_fast_coef_costing
int band_left = *band_count++;
@@ -1172,23 +1112,12 @@ static int cost_coeffs(const AV1_COMMON *const cm, MACROBLOCK *x, int plane,
// dc token
int v = qcoeff[0];
int16_t tok;
-#if !CONFIG_NEW_TOKENSET
- unsigned int(*tok_cost_ptr)[COEFF_CONTEXTS][ENTROPY_TOKENS];
-#endif
cost = av1_get_token_cost(v, &tok, cat6_bits);
-#if CONFIG_NEW_TOKENSET
cost += (*token_costs)[!tok][pt][tok];
-#else
- cost += (*token_costs)[0][pt][tok];
-#endif
token_cache[0] = av1_pt_energy_class[tok];
++token_costs;
-#if !CONFIG_NEW_TOKENSET
- tok_cost_ptr = &((*token_costs)[!tok]);
-#endif
-
// ac tokens
for (c = 1; c < eob; c++) {
const int rc = scan[c];
@@ -1196,26 +1125,17 @@ static int cost_coeffs(const AV1_COMMON *const cm, MACROBLOCK *x, int plane,
v = qcoeff[rc];
cost += av1_get_token_cost(v, &tok, cat6_bits);
pt = get_coef_context(nb, token_cache, c);
-#if CONFIG_NEW_TOKENSET
cost += (*token_costs)[!tok][pt][tok];
-#else
- cost += (*tok_cost_ptr)[pt][tok];
-#endif
token_cache[rc] = av1_pt_energy_class[tok];
if (!--band_left) {
band_left = *band_count++;
++token_costs;
}
-#if !CONFIG_NEW_TOKENSET
- tok_cost_ptr = &((*token_costs)[!tok]);
-#endif
}
// eob token
- if (band_left || CONFIG_NEW_TOKENSET) {
- pt = get_coef_context(nb, token_cache, c);
- cost += (*token_costs)[0][pt][EOB_TOKEN];
- }
+ pt = get_coef_context(nb, token_cache, c);
+ cost += (*token_costs)[0][pt][EOB_TOKEN];
}
}
@@ -1262,7 +1182,9 @@ static void get_txb_dimensions(const MACROBLOCKD *xd, int plane,
BLOCK_SIZE plane_bsize, int blk_row, int blk_col,
BLOCK_SIZE tx_bsize, int *width, int *height,
int *visible_width, int *visible_height) {
+#if !(CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT)
assert(tx_bsize <= plane_bsize);
+#endif // !(CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT)
int txb_height = block_size_high[tx_bsize];
int txb_width = block_size_wide[tx_bsize];
const int block_height = block_size_high[plane_bsize];
@@ -1298,7 +1220,12 @@ static unsigned pixel_sse(const AV1_COMP *const cpi, const MACROBLOCKD *xd,
&txb_cols, &txb_rows, &visible_cols, &visible_rows);
assert(visible_rows > 0);
assert(visible_cols > 0);
+#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
+ if ((txb_rows == visible_rows && txb_cols == visible_cols) &&
+ tx_bsize < BLOCK_SIZES) {
+#else
if (txb_rows == visible_rows && txb_cols == visible_cols) {
+#endif
unsigned sse;
cpi->fn_ptr[tx_bsize].vf(src, src_stride, dst, dst_stride, &sse);
return sse;
@@ -1533,7 +1460,36 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
if (args->exit_early) return;
if (!is_inter_block(mbmi)) {
+#if CONFIG_CFL
+
+#if CONFIG_EC_ADAPT
+ FRAME_CONTEXT *const ec_ctx = xd->tile_ctx;
+#else
+ FRAME_CONTEXT *const ec_ctx = cm->fc;
+#endif // CONFIG_EC_ADAPT
+
+ av1_predict_intra_block_encoder_facade(x, ec_ctx, plane, block, blk_col,
+ blk_row, tx_size, plane_bsize);
+#else
av1_predict_intra_block_facade(xd, plane, block, blk_col, blk_row, tx_size);
+#endif
+#if CONFIG_DPCM_INTRA
+ const int block_raster_idx =
+ av1_block_index_to_raster_order(tx_size, block);
+ const PREDICTION_MODE mode =
+ (plane == 0) ? get_y_mode(xd->mi[0], block_raster_idx) : mbmi->uv_mode;
+ TX_TYPE tx_type = get_tx_type((plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV,
+ xd, block, tx_size);
+ if (av1_use_dpcm_intra(plane, mode, tx_type, mbmi)) {
+ int8_t skip;
+ av1_encode_block_intra_dpcm(cm, x, mode, plane, block, blk_row, blk_col,
+ plane_bsize, tx_size, tx_type, a, l, &skip);
+ av1_dist_block(args->cpi, x, plane, plane_bsize, block, blk_row, blk_col,
+ tx_size, &this_rd_stats.dist, &this_rd_stats.sse,
+ OUTPUT_HAS_DECODED_PIXELS);
+ goto CALCULATE_RD;
+ }
+#endif // CONFIG_DPCM_INTRA
av1_subtract_txb(x, plane, plane_bsize, blk_col, blk_row, tx_size);
}
@@ -1542,8 +1498,7 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
const int coeff_ctx = combine_entropy_contexts(*a, *l);
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
coeff_ctx, AV1_XFORM_QUANT_FP);
- if (x->plane[plane].eobs[block] && !xd->lossless[mbmi->segment_id])
- av1_optimize_b(cm, x, plane, block, tx_size, coeff_ctx);
+ av1_optimize_b(cm, x, plane, block, plane_bsize, tx_size, a, l);
if (!is_inter_block(mbmi)) {
struct macroblock_plane *const p = &x->plane[plane];
@@ -1566,6 +1521,9 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
cfl_store(xd->cfl, dst, dst_stride, blk_row, blk_col, tx_size);
}
#endif
+#if CONFIG_DPCM_INTRA
+CALCULATE_RD : {}
+#endif // CONFIG_DPCM_INTRA
rd = RDCOST(x->rdmult, x->rddiv, 0, this_rd_stats.dist);
if (args->this_rd + rd > args->best_rd) {
args->exit_early = 1;
@@ -1603,7 +1561,7 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
rd = AOMMIN(rd1, rd2);
#if CONFIG_DAALA_DIST
- if (plane == 0 &&
+ if (plane == 0 && plane_bsize >= BLOCK_8X8 &&
(tx_size == TX_4X4 || tx_size == TX_4X8 || tx_size == TX_8X4)) {
this_rd_stats.dist = 0;
this_rd_stats.sse = 0;
@@ -1641,6 +1599,9 @@ static void block_8x8_rd_txfm_daala_dist(int plane, int block, int blk_row,
int use_activity_masking = 0;
(void)tx_size;
+
+ assert(plane == 0);
+ assert(plane_bsize >= BLOCK_8X8);
#if CONFIG_PVQ
use_activity_masking = x->daala_enc.use_activity_masking;
#endif // CONFIG_PVQ
@@ -1700,10 +1661,15 @@ static void block_8x8_rd_txfm_daala_dist(int plane, int block, int blk_row,
{
const int max_blocks_wide = max_block_wide(xd, plane_bsize, plane);
+ 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 offset_h = tx_size_high_unit[TX_4X4];
// The rate of the current 8x8 block is the sum of four 4x4 blocks in it.
- this_rd_stats.rate = x->rate_4x4[block - max_blocks_wide - 1] +
- x->rate_4x4[block - max_blocks_wide] +
- x->rate_4x4[block - 1] + x->rate_4x4[block];
+ this_rd_stats.rate =
+ x->rate_4x4[block - max_blocks_wide * offset_h - step] +
+ x->rate_4x4[block - max_blocks_wide * offset_h] +
+ x->rate_4x4[block - step] + x->rate_4x4[block];
}
rd1 = RDCOST(x->rdmult, x->rddiv, this_rd_stats.rate, this_rd_stats.dist);
rd2 = RDCOST(x->rdmult, x->rddiv, 0, this_rd_stats.sse);
@@ -1740,10 +1706,10 @@ static void txfm_rd_in_plane(MACROBLOCK *x, const AV1_COMP *cpi,
av1_get_entropy_contexts(bsize, tx_size, pd, args.t_above, args.t_left);
#if CONFIG_DAALA_DIST
- if (plane == 0 &&
+ if (plane == 0 && bsize >= BLOCK_8X8 &&
(tx_size == TX_4X4 || tx_size == TX_4X8 || tx_size == TX_8X4))
- av1_foreach_8x8_transformed_block_in_plane(
- xd, bsize, plane, block_rd_txfm, block_8x8_rd_txfm_daala_dist, &args);
+ av1_foreach_8x8_transformed_block_in_yplane(
+ xd, bsize, block_rd_txfm, block_8x8_rd_txfm_daala_dist, &args);
else
#endif // CONFIG_DAALA_DIST
av1_foreach_transformed_block_in_plane(xd, bsize, plane, block_rd_txfm,
@@ -1812,7 +1778,12 @@ static int tx_size_cost(const AV1_COMP *const cpi, const MACROBLOCK *const x,
const TX_SIZE coded_tx_size = txsize_sqr_up_map[tx_size];
const int depth = tx_size_to_depth(coded_tx_size);
const int tx_size_ctx = get_tx_size_context(xd);
- const int r_tx_size = cpi->tx_size_cost[tx_size_cat][tx_size_ctx][depth];
+ int r_tx_size = cpi->tx_size_cost[tx_size_cat][tx_size_ctx][depth];
+#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
+ if (is_quarter_tx_allowed(xd, mbmi, is_inter) && tx_size != coded_tx_size)
+ r_tx_size += av1_cost_bit(cm->fc->quarter_tx_size_prob,
+ tx_size == quarter_txsize_lookup[bsize]);
+#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
return r_tx_size;
} else {
return 0;
@@ -1924,9 +1895,7 @@ static int skip_txfm_search(const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs,
// transforms should be considered for pruning
prune = prune_tx_types(cpi, bs, x, xd, -1);
-#if CONFIG_REF_MV
if (mbmi->ref_mv_idx > 0 && tx_type != DCT_DCT) return 1;
-#endif // CONFIG_REF_MV
if (FIXED_TX_TYPE && tx_type != get_default_tx_type(0, xd, 0, tx_size))
return 1;
if (!is_inter && x->use_default_intra_tx_type &&
@@ -1960,7 +1929,7 @@ static int skip_txfm_search(const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs,
return 0;
}
-#if CONFIG_EXT_INTER
+#if CONFIG_EXT_INTER && (CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT)
static int64_t estimate_yrd_for_sb(const AV1_COMP *const cpi, BLOCK_SIZE bs,
MACROBLOCK *x, int *r, int64_t *d, int *s,
int64_t *sse, int64_t ref_best_rd) {
@@ -1973,7 +1942,7 @@ static int64_t estimate_yrd_for_sb(const AV1_COMP *const cpi, BLOCK_SIZE bs,
*sse = rd_stats.sse;
return rd;
}
-#endif // CONFIG_EXT_INTER
+#endif // CONFIG_EXT_INTER && (CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT)
static void choose_largest_tx_size(const AV1_COMP *const cpi, MACROBLOCK *x,
RD_STATS *rd_stats, int64_t ref_best_rd,
@@ -2191,9 +2160,7 @@ static void choose_tx_size_type_from_rd(const AV1_COMP *const cpi,
#endif
TX_TYPE tx_type;
for (tx_type = tx_start; tx_type < tx_end; ++tx_type) {
-#if CONFIG_REF_MV
if (mbmi->ref_mv_idx > 0 && tx_type != DCT_DCT) continue;
-#endif // CONFIG_REF_MV
const TX_SIZE rect_tx_size = max_txsize_rect_lookup[bs];
RD_STATS this_rd_stats;
int ext_tx_set =
@@ -2219,6 +2186,56 @@ static void choose_tx_size_type_from_rd(const AV1_COMP *const cpi,
#endif // CONFIG_CB4X4 && !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4
}
}
+
+#if CONFIG_RECT_TX_EXT
+ // test 1:4/4:1 tx
+ int evaluate_quarter_tx = 0;
+ if (is_quarter_tx_allowed(xd, mbmi, is_inter)) {
+ if (tx_select) {
+ evaluate_quarter_tx = 1;
+ } else {
+ const TX_SIZE chosen_tx_size =
+ tx_size_from_tx_mode(bs, cm->tx_mode, is_inter);
+ evaluate_quarter_tx = chosen_tx_size == quarter_txsize_lookup[bs];
+ }
+ }
+ if (evaluate_quarter_tx) {
+ TX_TYPE tx_start = DCT_DCT;
+ TX_TYPE tx_end = TX_TYPES;
+#if CONFIG_TXK_SEL
+ // The tx_type becomes dummy when lv_map is on. The tx_type search will be
+ // performed in av1_search_txk_type()
+ tx_end = DCT_DCT + 1;
+#endif
+ TX_TYPE tx_type;
+ for (tx_type = tx_start; tx_type < tx_end; ++tx_type) {
+ if (mbmi->ref_mv_idx > 0 && tx_type != DCT_DCT) continue;
+ const TX_SIZE tx_size = quarter_txsize_lookup[bs];
+ RD_STATS this_rd_stats;
+ int ext_tx_set =
+ get_ext_tx_set(tx_size, bs, is_inter, cm->reduced_tx_set_used);
+ if ((is_inter && ext_tx_used_inter[ext_tx_set][tx_type]) ||
+ (!is_inter && ext_tx_used_intra[ext_tx_set][tx_type])) {
+ rd =
+ txfm_yrd(cpi, x, &this_rd_stats, ref_best_rd, bs, tx_type, tx_size);
+ if (rd < best_rd) {
+#if CONFIG_TXK_SEL
+ memcpy(best_txk_type, mbmi->txk_type,
+ sizeof(best_txk_type[0]) * num_blk);
+#endif
+ best_tx_type = tx_type;
+ best_tx_size = tx_size;
+ best_rd = rd;
+ *rd_stats = this_rd_stats;
+ }
+ }
+#if CONFIG_CB4X4 && !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4
+ const int is_inter = is_inter_block(mbmi);
+ if (mbmi->sb_type < BLOCK_8X8 && is_inter) break;
+#endif // CONFIG_CB4X4 && !USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4
+ }
+ }
+#endif // CONFIG_RECT_TX_EXT
#endif // CONFIG_EXT_TX && CONFIG_RECT_TX
if (tx_select) {
@@ -2334,6 +2351,7 @@ static int64_t intra_model_yrd(const AV1_COMP *const cpi, MACROBLOCK *const x,
BLOCK_SIZE bsize, int mode_cost) {
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
+ assert(!is_inter_block(mbmi));
RD_STATS this_rd_stats;
int row, col;
int64_t temp_sse, this_rd;
@@ -2348,7 +2366,21 @@ static int64_t intra_model_yrd(const AV1_COMP *const cpi, MACROBLOCK *const x,
int block = 0;
for (row = 0; row < max_blocks_high; row += stepr) {
for (col = 0; col < max_blocks_wide; col += stepc) {
+#if CONFIG_CFL
+ const struct macroblockd_plane *const pd = &xd->plane[0];
+ const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
+
+#if CONFIG_EC_ADAPT
+ FRAME_CONTEXT *const ec_ctx = xd->tile_ctx;
+#else
+ FRAME_CONTEXT *const ec_ctx = cpi->common.fc;
+#endif // CONFIG_EC_ADAPT
+
+ av1_predict_intra_block_encoder_facade(x, ec_ctx, 0, block, col, row,
+ tx_size, plane_bsize);
+#else
av1_predict_intra_block_facade(xd, 0, block, col, row, tx_size);
+#endif
block += step;
}
}
@@ -2403,6 +2435,28 @@ static void extend_palette_color_map(uint8_t *const color_map, int orig_width,
}
}
+#if CONFIG_PALETTE_DELTA_ENCODING
+// Bias toward using colors in the cache.
+// TODO(huisu): Try other schemes to improve compression.
+static void optimize_palette_colors(uint16_t *color_cache, int n_cache,
+ int n_colors, int stride,
+ float *centroids) {
+ if (n_cache <= 0) return;
+ for (int i = 0; i < n_colors * stride; i += stride) {
+ float min_diff = fabsf(centroids[i] - color_cache[0]);
+ int idx = 0;
+ for (int j = 1; j < n_cache; ++j) {
+ float this_diff = fabsf(centroids[i] - color_cache[j]);
+ if (this_diff < min_diff) {
+ min_diff = this_diff;
+ idx = j;
+ }
+ }
+ if (min_diff < 1.5) centroids[i] = color_cache[idx];
+ }
+}
+#endif // CONFIG_PALETTE_DELTA_ENCODING
+
static int rd_pick_palette_intra_sby(const AV1_COMP *const cpi, MACROBLOCK *x,
BLOCK_SIZE bsize, int palette_ctx,
int dc_mode_cost, MB_MODE_INFO *best_mbmi,
@@ -2414,6 +2468,7 @@ static int rd_pick_palette_intra_sby(const AV1_COMP *const cpi, MACROBLOCK *x,
MACROBLOCKD *const xd = &x->e_mbd;
MODE_INFO *const mic = xd->mi[0];
MB_MODE_INFO *const mbmi = &mic->mbmi;
+ assert(!is_inter_block(mbmi));
int this_rate, colors, n;
const int src_stride = x->plane[0].src.stride;
const uint8_t *const src = x->plane[0].src.buf;
@@ -2488,12 +2543,38 @@ static int rd_pick_palette_intra_sby(const AV1_COMP *const cpi, MACROBLOCK *x,
if (rows * cols > PALETTE_MAX_BLOCK_SIZE) return 0;
+#if CONFIG_PALETTE_DELTA_ENCODING
+ const MODE_INFO *above_mi = xd->above_mi;
+ const MODE_INFO *left_mi = xd->left_mi;
+ uint16_t color_cache[2 * PALETTE_MAX_SIZE];
+ const int n_cache =
+ av1_get_palette_cache(above_mi, left_mi, 0, color_cache);
+#endif // CONFIG_PALETTE_DELTA_ENCODING
+
for (n = colors > PALETTE_MAX_SIZE ? PALETTE_MAX_SIZE : colors; n >= 2;
--n) {
- for (i = 0; i < n; ++i)
- centroids[i] = lb + (2 * i + 1) * (ub - lb) / n / 2;
- av1_k_means(data, centroids, color_map, rows * cols, n, 1, max_itr);
- k = av1_remove_duplicates(centroids, n);
+ if (colors == PALETTE_MIN_SIZE) {
+ // Special case: These colors automatically become the centroids.
+ assert(colors == n);
+ assert(colors == 2);
+ centroids[0] = lb;
+ centroids[1] = ub;
+ k = 2;
+ } else {
+ for (i = 0; i < n; ++i) {
+ centroids[i] = lb + (2 * i + 1) * (ub - lb) / n / 2;
+ }
+ av1_k_means(data, centroids, color_map, rows * cols, n, 1, max_itr);
+#if CONFIG_PALETTE_DELTA_ENCODING
+ optimize_palette_colors(color_cache, n_cache, n, 1, centroids);
+#endif // CONFIG_PALETTE_DELTA_ENCODING
+ k = av1_remove_duplicates(centroids, n);
+ if (k < PALETTE_MIN_SIZE) {
+ // Too few unique colors to create a palette. And DC_PRED will work
+ // well for that case anyway. So skip.
+ continue;
+ }
+ }
#if CONFIG_HIGHBITDEPTH
if (cpi->common.use_highbitdepth)
@@ -2516,7 +2597,11 @@ static int rd_pick_palette_intra_sby(const AV1_COMP *const cpi, MACROBLOCK *x,
av1_cost_bit(
av1_default_palette_y_mode_prob[bsize - BLOCK_8X8][palette_ctx],
1);
- palette_mode_cost += av1_palette_color_cost_y(pmi, cpi->common.bit_depth);
+ palette_mode_cost += av1_palette_color_cost_y(pmi,
+#if CONFIG_PALETTE_DELTA_ENCODING
+ color_cache, n_cache,
+#endif // CONFIG_PALETTE_DELTA_ENCODING
+ cpi->common.bit_depth);
for (i = 0; i < rows; ++i) {
for (j = (i == 0 ? 1 : 0); j < cols; ++j) {
int color_idx;
@@ -2570,6 +2655,7 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode(
const AV1_COMMON *const cm = &cpi->common;
PREDICTION_MODE mode;
MACROBLOCKD *const xd = &x->e_mbd;
+ assert(!is_inter_block(&xd->mi[0]->mbmi));
int64_t best_rd = rd_thresh;
struct macroblock_plane *p = &x->plane[0];
struct macroblockd_plane *pd = &xd->plane[0];
@@ -2577,7 +2663,7 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode(
const int dst_stride = pd->dst.stride;
const uint8_t *src_init = &p->src.buf[row * 4 * src_stride + col * 4];
uint8_t *dst_init = &pd->dst.buf[row * 4 * dst_stride + col * 4];
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
// TODO(jingning): This is a temporal change. The whole function should be
// out when cb4x4 is enabled.
ENTROPY_CONTEXT ta[4], tempa[4];
@@ -2585,7 +2671,7 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode(
#else
ENTROPY_CONTEXT ta[2], tempa[2];
ENTROPY_CONTEXT tl[2], templ[2];
-#endif // CONFIG_CB4X4
+#endif // CONFIG_CHROMA_2X2
const int pred_width_in_4x4_blocks = num_4x4_blocks_wide_lookup[bsize];
const int pred_height_in_4x4_blocks = num_4x4_blocks_high_lookup[bsize];
@@ -2738,7 +2824,8 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode(
#if !CONFIG_PVQ
av1_xform_quant(cm, x, 0, block, row + idy, col + idx, BLOCK_8X8,
tx_size, coeff_ctx, AV1_XFORM_QUANT_FP);
- av1_optimize_b(cm, x, 0, block, tx_size, coeff_ctx);
+ av1_optimize_b(cm, x, 0, block, BLOCK_8X8, tx_size, tempa + idx,
+ templ + idy);
ratey += av1_cost_coeffs(cpi, x, 0, block, tx_size, scan_order,
tempa + idx, templ + idy,
cpi->sf.use_fast_coef_costing);
@@ -2897,9 +2984,8 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode(
#endif // CONFIG_CB4X4
BLOCK_8X8, tx_size, coeff_ctx, xform_quant);
- if (!is_lossless) {
- av1_optimize_b(cm, x, 0, block, tx_size, coeff_ctx);
- }
+ av1_optimize_b(cm, x, 0, block, BLOCK_8X8, tx_size, tempa + idx,
+ templ + idy);
ratey +=
av1_cost_coeffs(cpi, x, 0, block, tx_size, scan_order, tempa + idx,
@@ -3013,6 +3099,7 @@ static int64_t rd_pick_intra_sub_8x8_y_mode(const AV1_COMP *const cpi,
const MODE_INFO *above_mi = xd->above_mi;
const MODE_INFO *left_mi = xd->left_mi;
MB_MODE_INFO *const mbmi = &mic->mbmi;
+ assert(!is_inter_block(mbmi));
const BLOCK_SIZE bsize = mbmi->sb_type;
const int pred_width_in_4x4_blocks = num_4x4_blocks_wide_lookup[bsize];
const int pred_height_in_4x4_blocks = num_4x4_blocks_high_lookup[bsize];
@@ -3220,6 +3307,7 @@ static int64_t calc_rd_given_intra_angle(
RD_STATS tokenonly_rd_stats;
int64_t this_rd, this_model_rd;
MB_MODE_INFO *mbmi = &x->e_mbd.mi[0]->mbmi;
+ assert(!is_inter_block(mbmi));
mbmi->angle_delta[0] = angle_delta;
this_model_rd = intra_model_yrd(cpi, x, bsize, mode_cost);
@@ -3261,6 +3349,7 @@ static int64_t rd_pick_intra_angle_sby(const AV1_COMP *const cpi, MACROBLOCK *x,
MACROBLOCKD *const xd = &x->e_mbd;
MODE_INFO *const mic = xd->mi[0];
MB_MODE_INFO *mbmi = &mic->mbmi;
+ assert(!is_inter_block(mbmi));
int i, angle_delta, best_angle_delta = 0;
int first_try = 1;
#if CONFIG_INTRA_INTERP
@@ -3393,32 +3482,40 @@ static const uint8_t gradient_to_angle_bin[2][7][16] = {
},
};
+/* clang-format off */
static const uint8_t mode_to_angle_bin[INTRA_MODES] = {
0, 2, 6, 0, 4, 3, 5, 7, 1, 0,
+#if CONFIG_ALT_INTRA
+ 0,
+#endif // CONFIG_ALT_INTRA
};
+/* clang-format on */
static void angle_estimation(const uint8_t *src, int src_stride, int rows,
- int cols, uint8_t *directional_mode_skip_mask) {
- int i, r, c, index, dx, dy, temp, sn, remd, quot;
+ int cols, BLOCK_SIZE bsize,
+ uint8_t *directional_mode_skip_mask) {
+ memset(directional_mode_skip_mask, 0,
+ INTRA_MODES * sizeof(*directional_mode_skip_mask));
+ // Sub-8x8 blocks do not use extra directions.
+ if (bsize < BLOCK_8X8) return;
uint64_t hist[DIRECTIONAL_MODES];
- uint64_t hist_sum = 0;
-
memset(hist, 0, DIRECTIONAL_MODES * sizeof(hist[0]));
src += src_stride;
+ int r, c, dx, dy;
for (r = 1; r < rows; ++r) {
for (c = 1; c < cols; ++c) {
dx = src[c] - src[c - 1];
dy = src[c] - src[c - src_stride];
- temp = dx * dx + dy * dy;
+ int index;
+ const int temp = dx * dx + dy * dy;
if (dy == 0) {
index = 2;
} else {
- sn = (dx > 0) ^ (dy > 0);
+ const int sn = (dx > 0) ^ (dy > 0);
dx = abs(dx);
dy = abs(dy);
- remd = dx % dy;
- quot = dx / dy;
- remd = remd * 16 / dy;
+ const int remd = (dx % dy) * 16 / dy;
+ const int quot = dx / dy;
index = gradient_to_angle_bin[sn][AOMMIN(quot, 6)][AOMMIN(remd, 15)];
}
hist[index] += temp;
@@ -3426,9 +3523,11 @@ static void angle_estimation(const uint8_t *src, int src_stride, int rows,
src += src_stride;
}
+ int i;
+ uint64_t hist_sum = 0;
for (i = 0; i < DIRECTIONAL_MODES; ++i) hist_sum += hist[i];
for (i = 0; i < INTRA_MODES; ++i) {
- if (i != DC_PRED && i != TM_PRED) {
+ if (av1_is_directional_mode(i, bsize)) {
const uint8_t angle_bin = mode_to_angle_bin[i];
uint64_t score = 2 * hist[angle_bin];
int weight = 2;
@@ -3448,29 +3547,31 @@ static void angle_estimation(const uint8_t *src, int src_stride, int rows,
#if CONFIG_HIGHBITDEPTH
static void highbd_angle_estimation(const uint8_t *src8, int src_stride,
- int rows, int cols,
+ int rows, int cols, BLOCK_SIZE bsize,
uint8_t *directional_mode_skip_mask) {
- int i, r, c, index, dx, dy, temp, sn, remd, quot;
- uint64_t hist[DIRECTIONAL_MODES];
- uint64_t hist_sum = 0;
+ memset(directional_mode_skip_mask, 0,
+ INTRA_MODES * sizeof(*directional_mode_skip_mask));
+ // Sub-8x8 blocks do not use extra directions.
+ if (bsize < BLOCK_8X8) return;
uint16_t *src = CONVERT_TO_SHORTPTR(src8);
-
+ uint64_t hist[DIRECTIONAL_MODES];
memset(hist, 0, DIRECTIONAL_MODES * sizeof(hist[0]));
src += src_stride;
+ int r, c, dx, dy;
for (r = 1; r < rows; ++r) {
for (c = 1; c < cols; ++c) {
dx = src[c] - src[c - 1];
dy = src[c] - src[c - src_stride];
- temp = dx * dx + dy * dy;
+ int index;
+ const int temp = dx * dx + dy * dy;
if (dy == 0) {
index = 2;
} else {
- sn = (dx > 0) ^ (dy > 0);
+ const int sn = (dx > 0) ^ (dy > 0);
dx = abs(dx);
dy = abs(dy);
- remd = dx % dy;
- quot = dx / dy;
- remd = remd * 16 / dy;
+ const int remd = (dx % dy) * 16 / dy;
+ const int quot = dx / dy;
index = gradient_to_angle_bin[sn][AOMMIN(quot, 6)][AOMMIN(remd, 15)];
}
hist[index] += temp;
@@ -3478,9 +3579,11 @@ static void highbd_angle_estimation(const uint8_t *src8, int src_stride,
src += src_stride;
}
+ int i;
+ uint64_t hist_sum = 0;
for (i = 0; i < DIRECTIONAL_MODES; ++i) hist_sum += hist[i];
for (i = 0; i < INTRA_MODES; ++i) {
- if (i != DC_PRED && i != TM_PRED) {
+ if (av1_is_directional_mode(i, bsize)) {
const uint8_t angle_bin = mode_to_angle_bin[i];
uint64_t score = 2 * hist[angle_bin];
int weight = 2;
@@ -3509,6 +3612,7 @@ static int64_t rd_pick_intra_sby_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
MACROBLOCKD *const xd = &x->e_mbd;
MODE_INFO *const mic = xd->mi[0];
MB_MODE_INFO *const mbmi = &mic->mbmi;
+ assert(!is_inter_block(mbmi));
MB_MODE_INFO best_mbmi = *mbmi;
int64_t best_model_rd = INT64_MAX;
#if CONFIG_EXT_INTRA
@@ -3552,15 +3656,14 @@ static int64_t rd_pick_intra_sby_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
#if CONFIG_EXT_INTRA
mbmi->angle_delta[0] = 0;
- memset(directional_mode_skip_mask, 0,
- sizeof(directional_mode_skip_mask[0]) * INTRA_MODES);
#if CONFIG_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
- highbd_angle_estimation(src, src_stride, rows, cols,
+ highbd_angle_estimation(src, src_stride, rows, cols, bsize,
directional_mode_skip_mask);
else
#endif // CONFIG_HIGHBITDEPTH
- angle_estimation(src, src_stride, rows, cols, directional_mode_skip_mask);
+ angle_estimation(src, src_stride, rows, cols, bsize,
+ directional_mode_skip_mask);
#endif // CONFIG_EXT_INTRA
#if CONFIG_FILTER_INTRA
mbmi->filter_intra_mode_info.use_filter_intra_mode[0] = 0;
@@ -3833,7 +3936,7 @@ void av1_tx_block_rd_b(const AV1_COMP *cpi, MACROBLOCK *x, TX_SIZE tx_size,
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
coeff_ctx, AV1_XFORM_QUANT_FP);
- av1_optimize_b(cm, x, plane, block, tx_size, coeff_ctx);
+ av1_optimize_b(cm, x, plane, block, plane_bsize, tx_size, a, l);
// TODO(any): Use av1_dist_block to compute distortion
#if CONFIG_HIGHBITDEPTH
@@ -3936,9 +4039,8 @@ static void select_tx_block(const AV1_COMP *cpi, MACROBLOCK *x, int blk_row,
ENTROPY_CONTEXT *pta = ta + blk_col;
ENTROPY_CONTEXT *ptl = tl + blk_row;
int coeff_ctx, i;
- int ctx =
- txfm_partition_context(tx_above + (blk_col >> 1),
- tx_left + (blk_row >> 1), mbmi->sb_type, tx_size);
+ int ctx = txfm_partition_context(tx_above + blk_col, tx_left + blk_row,
+ mbmi->sb_type, tx_size);
int64_t sum_rd = INT64_MAX;
int tmp_eob = 0;
int zero_blk_rate;
@@ -4042,8 +4144,8 @@ static void select_tx_block(const AV1_COMP *cpi, MACROBLOCK *x, int blk_row,
int idx, idy;
for (i = 0; i < tx_size_wide_unit[tx_size]; ++i) pta[i] = !(tmp_eob == 0);
for (i = 0; i < tx_size_high_unit[tx_size]; ++i) ptl[i] = !(tmp_eob == 0);
- txfm_partition_update(tx_above + (blk_col >> 1), tx_left + (blk_row >> 1),
- tx_size, tx_size);
+ txfm_partition_update(tx_above + blk_col, tx_left + blk_row, tx_size,
+ tx_size);
inter_tx_size[0][0] = tx_size;
for (idy = 0; idy < tx_size_high_unit[tx_size] / 2; ++idy)
for (idx = 0; idx < tx_size_wide_unit[tx_size] / 2; ++idx)
@@ -4082,17 +4184,15 @@ static void inter_block_yrd(const AV1_COMP *cpi, MACROBLOCK *x,
int step = tx_size_wide_unit[max_tx_size] * tx_size_high_unit[max_tx_size];
ENTROPY_CONTEXT ctxa[2 * MAX_MIB_SIZE];
ENTROPY_CONTEXT ctxl[2 * MAX_MIB_SIZE];
- TXFM_CONTEXT tx_above[MAX_MIB_SIZE];
- TXFM_CONTEXT tx_left[MAX_MIB_SIZE];
+ TXFM_CONTEXT tx_above[MAX_MIB_SIZE * 2];
+ TXFM_CONTEXT tx_left[MAX_MIB_SIZE * 2];
RD_STATS pn_rd_stats;
av1_init_rd_stats(&pn_rd_stats);
av1_get_entropy_contexts(bsize, 0, pd, ctxa, ctxl);
- memcpy(tx_above, xd->above_txfm_context,
- sizeof(TXFM_CONTEXT) * (mi_width >> 1));
- memcpy(tx_left, xd->left_txfm_context,
- sizeof(TXFM_CONTEXT) * (mi_height >> 1));
+ memcpy(tx_above, xd->above_txfm_context, sizeof(TXFM_CONTEXT) * mi_width);
+ memcpy(tx_left, xd->left_txfm_context, sizeof(TXFM_CONTEXT) * mi_height);
for (idy = 0; idy < mi_height; idy += bh) {
for (idx = 0; idx < mi_width; idx += bw) {
@@ -4137,8 +4237,8 @@ static int64_t select_tx_size_fix_type(const AV1_COMP *cpi, MACROBLOCK *x,
const int max_blocks_wide = max_block_wide(xd, bsize, 0);
mbmi->tx_type = tx_type;
- mbmi->min_tx_size = TX_SIZES_ALL;
inter_block_yrd(cpi, x, rd_stats, bsize, ref_best_rd, rd_stats_stack);
+ mbmi->min_tx_size = get_min_tx_size(mbmi->inter_tx_size[0][0]);
if (rd_stats->rate == INT_MAX) return INT64_MAX;
@@ -4350,7 +4450,8 @@ static int inter_block_uvrd(const AV1_COMP *cpi, MACROBLOCK *x,
#if CONFIG_CB4X4 && !CONFIG_CHROMA_2X2
if (x->skip_chroma_rd) return is_cost_valid;
- bsize = AOMMAX(BLOCK_8X8, bsize);
+ bsize = scale_chroma_bsize(mbmi->sb_type, xd->plane[1].subsampling_x,
+ xd->plane[1].subsampling_y);
#endif // CONFIG_CB4X4 && !CONFIG_CHROMA_2X2
#if CONFIG_EXT_TX && CONFIG_RECT_TX
@@ -4426,6 +4527,7 @@ static void rd_pick_palette_intra_sbuv(const AV1_COMP *const cpi, MACROBLOCK *x,
int *skippable) {
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
+ assert(!is_inter_block(mbmi));
PALETTE_MODE_INFO *const pmi = &mbmi->palette_mode_info;
const BLOCK_SIZE bsize = mbmi->sb_type;
int this_rate;
@@ -4460,6 +4562,13 @@ static void rd_pick_palette_intra_sbuv(const AV1_COMP *const cpi, MACROBLOCK *x,
}
#endif // CONFIG_HIGHBITDEPTH
+#if CONFIG_PALETTE_DELTA_ENCODING
+ const MODE_INFO *above_mi = xd->above_mi;
+ const MODE_INFO *left_mi = xd->left_mi;
+ uint16_t color_cache[2 * PALETTE_MAX_SIZE];
+ const int n_cache = av1_get_palette_cache(above_mi, left_mi, 1, color_cache);
+#endif // CONFIG_PALETTE_DELTA_ENCODING
+
colors = colors_u > colors_v ? colors_u : colors_v;
if (colors > 1 && colors <= 64) {
int r, c, n, i, j;
@@ -4524,6 +4633,7 @@ static void rd_pick_palette_intra_sbuv(const AV1_COMP *const cpi, MACROBLOCK *x,
}
av1_k_means(data, centroids, color_map, rows * cols, n, 2, max_itr);
#if CONFIG_PALETTE_DELTA_ENCODING
+ optimize_palette_colors(color_cache, n_cache, n, 2, centroids);
// Sort the U channel colors in ascending order.
for (i = 0; i < 2 * (n - 1); i += 2) {
int min_idx = i;
@@ -4563,7 +4673,11 @@ static void rd_pick_palette_intra_sbuv(const AV1_COMP *const cpi, MACROBLOCK *x,
write_uniform_cost(n, color_map[0]) +
av1_cost_bit(
av1_default_palette_uv_mode_prob[pmi->palette_size[0] > 0], 1);
- this_rate += av1_palette_color_cost_uv(pmi, cpi->common.bit_depth);
+ this_rate += av1_palette_color_cost_uv(pmi,
+#if CONFIG_PALETTE_DELTA_ENCODING
+ color_cache, n_cache,
+#endif // CONFIG_PALETTE_DELTA_ENCODING
+ cpi->common.bit_depth);
for (i = 0; i < rows; ++i) {
for (j = (i == 0 ? 1 : 0); j < cols; ++j) {
int color_idx;
@@ -4660,6 +4774,7 @@ static int64_t pick_intra_angle_routine_sbuv(
int rate_overhead, int64_t best_rd_in, int *rate, RD_STATS *rd_stats,
int *best_angle_delta, int64_t *best_rd) {
MB_MODE_INFO *mbmi = &x->e_mbd.mi[0]->mbmi;
+ assert(!is_inter_block(mbmi));
int this_rate;
int64_t this_rd;
RD_STATS tokenonly_rd_stats;
@@ -4687,6 +4802,7 @@ static int rd_pick_intra_angle_sbuv(const AV1_COMP *const cpi, MACROBLOCK *x,
RD_STATS *rd_stats) {
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
+ assert(!is_inter_block(mbmi));
int i, angle_delta, best_angle_delta = 0;
int64_t this_rd, best_rd_in, rd_cost[2 * (MAX_ANGLE_DELTA + 2)];
@@ -4736,12 +4852,23 @@ static int rd_pick_intra_angle_sbuv(const AV1_COMP *const cpi, MACROBLOCK *x,
}
#endif // CONFIG_EXT_INTRA
+static void init_sbuv_mode(MB_MODE_INFO *const mbmi) {
+ mbmi->uv_mode = DC_PRED;
+#if CONFIG_PALETTE
+ mbmi->palette_mode_info.palette_size[1] = 0;
+#endif // CONFIG_PALETTE
+#if CONFIG_FILTER_INTRA
+ mbmi->filter_intra_mode_info.use_filter_intra_mode[1] = 0;
+#endif // CONFIG_FILTER_INTRA
+}
+
static int64_t rd_pick_intra_sbuv_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
int *rate, int *rate_tokenonly,
int64_t *distortion, int *skippable,
BLOCK_SIZE bsize, TX_SIZE max_tx_size) {
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
+ assert(!is_inter_block(mbmi));
MB_MODE_INFO best_mbmi = *mbmi;
PREDICTION_MODE mode;
int64_t best_rd = INT64_MAX, this_rd;
@@ -4756,12 +4883,6 @@ static int64_t rd_pick_intra_sbuv_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
uint8_t *best_palette_color_map = NULL;
#endif // CONFIG_PALETTE
-#if CONFIG_FILTER_INTRA
- mbmi->filter_intra_mode_info.use_filter_intra_mode[1] = 0;
-#endif // CONFIG_FILTER_INTRA
-#if CONFIG_PALETTE
- pmi->palette_size[1] = 0;
-#endif // CONFIG_PALETTE
for (mode = DC_PRED; mode <= TM_PRED; ++mode) {
#if CONFIG_EXT_INTRA
const int is_directional_mode =
@@ -4858,12 +4979,12 @@ static void choose_intra_uv_mode(const AV1_COMP *const cpi, MACROBLOCK *const x,
// Use an estimated rd for uv_intra based on DC_PRED if the
// appropriate speed flag is set.
(void)ctx;
+ init_sbuv_mode(&x->e_mbd.mi[0]->mbmi);
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
rd_pick_intra_sbuv_mode(cpi, x, rate_uv, rate_uv_tokenonly, dist_uv, skip_uv,
bsize, max_tx_size);
#else
- max_tx_size = AOMMAX(max_tx_size, TX_4X4);
if (x->skip_chroma_rd) {
*rate_uv = 0;
*rate_uv_tokenonly = 0;
@@ -4893,7 +5014,6 @@ static int cost_mv_ref(const AV1_COMP *const cpi, PREDICTION_MODE mode,
}
#endif
-#if CONFIG_REF_MV
int mode_cost = 0;
int16_t mode_ctx = mode_context & NEWMV_CTX_MASK;
int16_t is_all_zero_mv = mode_context & (1 << ALL_ZERO_FLAG_OFFSET);
@@ -4924,13 +5044,9 @@ static int cost_mv_ref(const AV1_COMP *const cpi, PREDICTION_MODE mode,
return mode_cost;
}
}
-#else
- assert(is_inter_mode(mode));
- return cpi->inter_mode_cost[mode_context][INTER_OFFSET(mode)];
-#endif // CONFIG_REF_MV
}
-#if CONFIG_EXT_INTER
+#if CONFIG_EXT_INTER && (CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT)
static int get_interinter_compound_type_bits(BLOCK_SIZE bsize,
COMPOUND_TYPE comp_type) {
(void)bsize;
@@ -4945,304 +5061,7 @@ static int get_interinter_compound_type_bits(BLOCK_SIZE bsize,
default: assert(0); return 0;
}
}
-#endif // CONFIG_EXT_INTER
-
-static int set_and_cost_bmi_mvs(
- const AV1_COMP *const cpi, MACROBLOCK *x, MACROBLOCKD *xd, int i,
- PREDICTION_MODE mode, int_mv this_mv[2],
- int_mv frame_mv[MB_MODE_COUNT][TOTAL_REFS_PER_FRAME],
- int_mv seg_mvs[TOTAL_REFS_PER_FRAME],
-#if CONFIG_EXT_INTER
- int_mv compound_seg_newmvs[2],
-#endif // CONFIG_EXT_INTER
- int_mv *best_ref_mv[2], const int *mvjcost, int *mvcost[2], int mi_row,
- int mi_col) {
- MODE_INFO *const mic = xd->mi[0];
- const MB_MODE_INFO *const mbmi = &mic->mbmi;
- const MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext;
- int thismvcost = 0;
- int idx, idy;
- const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[mbmi->sb_type];
- const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[mbmi->sb_type];
- const int is_compound = has_second_ref(mbmi);
- int mode_ctx;
- (void)mi_row;
- (void)mi_col;
-
- switch (mode) {
- case NEWMV: this_mv[0].as_int = seg_mvs[mbmi->ref_frame[0]].as_int;
-#if CONFIG_EXT_INTER
- if (!cpi->common.allow_high_precision_mv)
- lower_mv_precision(&this_mv[0].as_mv, 0);
-#endif // CONFIG_EXT_INTER
-
-#if CONFIG_REF_MV
- for (idx = 0; idx < 1 + is_compound; ++idx) {
- this_mv[idx] = seg_mvs[mbmi->ref_frame[idx]];
- av1_set_mvcost(x, mbmi->ref_frame[idx], idx, mbmi->ref_mv_idx);
- thismvcost +=
- av1_mv_bit_cost(&this_mv[idx].as_mv, &best_ref_mv[idx]->as_mv,
- x->nmvjointcost, x->mvcost, MV_COST_WEIGHT_SUB);
- }
- (void)mvjcost;
- (void)mvcost;
-#else
- thismvcost += av1_mv_bit_cost(&this_mv[0].as_mv, &best_ref_mv[0]->as_mv,
- mvjcost, mvcost, MV_COST_WEIGHT_SUB);
-#if !CONFIG_EXT_INTER
- if (is_compound) {
- this_mv[1].as_int = seg_mvs[mbmi->ref_frame[1]].as_int;
- thismvcost += av1_mv_bit_cost(&this_mv[1].as_mv, &best_ref_mv[1]->as_mv,
- mvjcost, mvcost, MV_COST_WEIGHT_SUB);
- }
-#endif // !CONFIG_EXT_INTER
-#endif // CONFIG_REF_MV
- break;
- case NEARMV:
- case NEARESTMV:
- this_mv[0].as_int = frame_mv[mode][mbmi->ref_frame[0]].as_int;
- if (is_compound)
- this_mv[1].as_int = frame_mv[mode][mbmi->ref_frame[1]].as_int;
- break;
- case ZEROMV: {
- int ref;
- for (ref = 0; ref < 1 + is_compound; ++ref) {
-#if CONFIG_GLOBAL_MOTION
- this_mv[ref].as_int =
- gm_get_motion_vector(
- &cpi->common.global_motion[mbmi->ref_frame[ref]],
- cpi->common.allow_high_precision_mv, mbmi->sb_type, mi_col,
- mi_row, i)
- .as_int;
-#else
- this_mv[ref].as_int = 0;
-#endif // CONFIG_GLOBAL_MOTION
- }
- break;
- }
-#if CONFIG_EXT_INTER
- case NEW_NEWMV:
- if (compound_seg_newmvs[0].as_int == INVALID_MV ||
- compound_seg_newmvs[1].as_int == INVALID_MV) {
- this_mv[0].as_int = seg_mvs[mbmi->ref_frame[0]].as_int;
- this_mv[1].as_int = seg_mvs[mbmi->ref_frame[1]].as_int;
- } else {
- this_mv[0].as_int = compound_seg_newmvs[0].as_int;
- this_mv[1].as_int = compound_seg_newmvs[1].as_int;
- }
- if (!cpi->common.allow_high_precision_mv)
- lower_mv_precision(&this_mv[0].as_mv, 0);
- if (!cpi->common.allow_high_precision_mv)
- lower_mv_precision(&this_mv[1].as_mv, 0);
-#if CONFIG_REF_MV
- av1_set_mvcost(x, mbmi->ref_frame[0], 0, mbmi->ref_mv_idx);
-#endif
- thismvcost += av1_mv_bit_cost(&this_mv[0].as_mv, &best_ref_mv[0]->as_mv,
- mvjcost, mvcost, MV_COST_WEIGHT_SUB);
-#if CONFIG_REF_MV
- av1_set_mvcost(x, mbmi->ref_frame[1], 1, mbmi->ref_mv_idx);
-#endif
- thismvcost += av1_mv_bit_cost(&this_mv[1].as_mv, &best_ref_mv[1]->as_mv,
- mvjcost, mvcost, MV_COST_WEIGHT_SUB);
- break;
- case NEW_NEARMV:
- case NEW_NEARESTMV:
- this_mv[0].as_int = seg_mvs[mbmi->ref_frame[0]].as_int;
- if (!cpi->common.allow_high_precision_mv)
- lower_mv_precision(&this_mv[0].as_mv, 0);
-#if CONFIG_REF_MV
- av1_set_mvcost(x, mbmi->ref_frame[0], 0, mbmi->ref_mv_idx);
-#endif
- thismvcost += av1_mv_bit_cost(&this_mv[0].as_mv, &best_ref_mv[0]->as_mv,
- mvjcost, mvcost, MV_COST_WEIGHT_SUB);
- this_mv[1].as_int = frame_mv[mode][mbmi->ref_frame[1]].as_int;
- break;
- case NEAR_NEWMV:
- case NEAREST_NEWMV:
- this_mv[0].as_int = frame_mv[mode][mbmi->ref_frame[0]].as_int;
- this_mv[1].as_int = seg_mvs[mbmi->ref_frame[1]].as_int;
- if (!cpi->common.allow_high_precision_mv)
- lower_mv_precision(&this_mv[1].as_mv, 0);
-#if CONFIG_REF_MV
- av1_set_mvcost(x, mbmi->ref_frame[1], 1, mbmi->ref_mv_idx);
-#endif
- thismvcost += av1_mv_bit_cost(&this_mv[1].as_mv, &best_ref_mv[1]->as_mv,
- mvjcost, mvcost, MV_COST_WEIGHT_SUB);
- break;
- case NEAREST_NEARMV:
- case NEAR_NEARESTMV:
- case NEAREST_NEARESTMV:
- case NEAR_NEARMV:
- this_mv[0].as_int = frame_mv[mode][mbmi->ref_frame[0]].as_int;
- this_mv[1].as_int = frame_mv[mode][mbmi->ref_frame[1]].as_int;
- break;
- case ZERO_ZEROMV:
-#if CONFIG_GLOBAL_MOTION
- this_mv[0].as_int =
- gm_get_motion_vector(&cpi->common.global_motion[mbmi->ref_frame[0]],
- cpi->common.allow_high_precision_mv,
- mbmi->sb_type, mi_col, mi_row, i)
- .as_int;
- this_mv[1].as_int =
- gm_get_motion_vector(&cpi->common.global_motion[mbmi->ref_frame[1]],
- cpi->common.allow_high_precision_mv,
- mbmi->sb_type, mi_col, mi_row, i)
- .as_int;
-#else
- this_mv[0].as_int = 0;
- this_mv[1].as_int = 0;
-#endif // CONFIG_GLOBAL_MOTION
- break;
-#endif // CONFIG_EXT_INTER
- default: break;
- }
-
- mic->bmi[i].as_mv[0].as_int = this_mv[0].as_int;
- if (is_compound) mic->bmi[i].as_mv[1].as_int = this_mv[1].as_int;
-
- mic->bmi[i].as_mode = mode;
-
-#if CONFIG_REF_MV
- if (mode == NEWMV) {
- mic->bmi[i].pred_mv[0].as_int =
- mbmi_ext->ref_mvs[mbmi->ref_frame[0]][0].as_int;
- if (is_compound)
- mic->bmi[i].pred_mv[1].as_int =
- mbmi_ext->ref_mvs[mbmi->ref_frame[1]][0].as_int;
- } else {
- mic->bmi[i].pred_mv[0].as_int = this_mv[0].as_int;
- if (is_compound) mic->bmi[i].pred_mv[1].as_int = this_mv[1].as_int;
- }
-#endif // CONFIG_REF_MV
-
- for (idy = 0; idy < num_4x4_blocks_high; ++idy)
- for (idx = 0; idx < num_4x4_blocks_wide; ++idx)
- memmove(&mic->bmi[i + idy * 2 + idx], &mic->bmi[i], sizeof(mic->bmi[i]));
-
-#if CONFIG_REF_MV
-#if CONFIG_EXT_INTER
- if (is_compound)
- mode_ctx = mbmi_ext->compound_mode_context[mbmi->ref_frame[0]];
- else
-#endif // CONFIG_EXT_INTER
- mode_ctx = av1_mode_context_analyzer(mbmi_ext->mode_context,
- mbmi->ref_frame, mbmi->sb_type, i);
-#else // CONFIG_REF_MV
- mode_ctx = mbmi_ext->mode_context[mbmi->ref_frame[0]];
-#endif // CONFIG_REF_MV
- return cost_mv_ref(cpi, mode, mode_ctx) + thismvcost;
-}
-
-static int64_t encode_inter_mb_segment_sub8x8(
- const AV1_COMP *const cpi, MACROBLOCK *x, int64_t best_yrd, int i,
- int *labelyrate, int64_t *distortion, int64_t *sse, ENTROPY_CONTEXT *ta,
- ENTROPY_CONTEXT *tl, int ir, int ic, int mi_row, int mi_col) {
- const AV1_COMMON *const cm = &cpi->common;
- MACROBLOCKD *xd = &x->e_mbd;
- struct macroblockd_plane *const pd = &xd->plane[0];
- struct macroblock_plane *const p = &x->plane[0];
- MODE_INFO *const mi = xd->mi[0];
- const BLOCK_SIZE plane_bsize = get_plane_block_size(mi->mbmi.sb_type, pd);
- const int txb_width = max_block_wide(xd, plane_bsize, 0);
- const int txb_height = max_block_high(xd, plane_bsize, 0);
- const int width = block_size_wide[plane_bsize];
- const int height = block_size_high[plane_bsize];
- int idx, idy;
- const uint8_t *const src =
- &p->src.buf[av1_raster_block_offset(BLOCK_8X8, i, p->src.stride)];
- uint8_t *const dst =
- &pd->dst.buf[av1_raster_block_offset(BLOCK_8X8, i, pd->dst.stride)];
- int64_t thisdistortion = 0, thissse = 0;
- int thisrate = 0;
- TX_SIZE tx_size = mi->mbmi.tx_size;
- TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, i, tx_size);
- const int num_4x4_w = tx_size_wide_unit[tx_size];
- const int num_4x4_h = tx_size_high_unit[tx_size];
-#if !CONFIG_PVQ
- const SCAN_ORDER *scan_order = get_scan(cm, tx_size, tx_type, 1);
-#else
- (void)cpi;
- (void)ta;
- (void)tl;
- (void)tx_type;
-#endif // !CONFIG_PVQ
-
-#if CONFIG_EXT_TX && CONFIG_RECT_TX
- assert(IMPLIES(xd->lossless[mi->mbmi.segment_id], tx_size == TX_4X4));
- assert(IMPLIES(!xd->lossless[mi->mbmi.segment_id],
- tx_size == max_txsize_rect_lookup[mi->mbmi.sb_type]));
-#else
- assert(tx_size == TX_4X4);
-#endif // CONFIG_EXT_TX && CONFIG_RECT_TX
-
- assert(tx_type == DCT_DCT);
-
- av1_build_inter_predictor_sub8x8(xd, 0, i, ir, ic, mi_row, mi_col);
-
-#if CONFIG_HIGHBITDEPTH
- if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
- aom_highbd_subtract_block(
- height, width, av1_raster_block_offset_int16(BLOCK_8X8, i, p->src_diff),
- 8, src, p->src.stride, dst, pd->dst.stride, xd->bd);
- } else {
- aom_subtract_block(height, width,
- av1_raster_block_offset_int16(BLOCK_8X8, i, p->src_diff),
- 8, src, p->src.stride, dst, pd->dst.stride);
- }
-#else
- aom_subtract_block(height, width,
- av1_raster_block_offset_int16(BLOCK_8X8, i, p->src_diff),
- 8, src, p->src.stride, dst, pd->dst.stride);
-#endif // CONFIG_HIGHBITDEPTH
-
- for (idy = 0; idy < txb_height; idy += num_4x4_h) {
- for (idx = 0; idx < txb_width; idx += num_4x4_w) {
- int64_t dist, ssz, rd, rd1, rd2;
- int coeff_ctx;
- const int k = i + (idy * 2 + idx);
- const int block = av1_raster_order_to_block_index(tx_size, k);
- assert(IMPLIES(tx_size == TX_4X8 || tx_size == TX_8X4,
- idx == 0 && idy == 0));
- coeff_ctx = combine_entropy_contexts(*(ta + (k & 1)), *(tl + (k >> 1)));
- av1_xform_quant(cm, x, 0, block, idy + (i >> 1), idx + (i & 0x01),
- BLOCK_8X8, tx_size, coeff_ctx, AV1_XFORM_QUANT_FP);
- if (xd->lossless[xd->mi[0]->mbmi.segment_id] == 0)
- av1_optimize_b(cm, x, 0, block, tx_size, coeff_ctx);
- av1_dist_block(cpi, x, 0, BLOCK_8X8, block, idy + (i >> 1),
- idx + (i & 0x1), tx_size, &dist, &ssz,
- OUTPUT_HAS_PREDICTED_PIXELS);
- thisdistortion += dist;
- thissse += ssz;
-#if !CONFIG_PVQ
- thisrate +=
- av1_cost_coeffs(cpi, x, 0, block, tx_size, scan_order, (ta + (k & 1)),
- (tl + (k >> 1)), cpi->sf.use_fast_coef_costing);
- *(ta + (k & 1)) = !(p->eobs[block] == 0);
- *(tl + (k >> 1)) = !(p->eobs[block] == 0);
-#else
- thisrate += x->rate;
-#endif // !CONFIG_PVQ
-#if CONFIG_EXT_TX
- if (tx_size == TX_8X4) {
- *(ta + (k & 1) + 1) = *(ta + (k & 1));
- }
- if (tx_size == TX_4X8) {
- *(tl + (k >> 1) + 1) = *(tl + (k >> 1));
- }
-#endif // CONFIG_EXT_TX
- rd1 = RDCOST(x->rdmult, x->rddiv, thisrate, thisdistortion);
- rd2 = RDCOST(x->rdmult, x->rddiv, 0, thissse);
- rd = AOMMIN(rd1, rd2);
- if (rd >= best_yrd) return INT64_MAX;
- }
- }
-
- *distortion = thisdistortion;
- *labelyrate = thisrate;
- *sse = thissse;
-
- return RDCOST(x->rdmult, x->rddiv, *labelyrate, *distortion);
-}
+#endif // CONFIG_EXT_INTER && (CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT)
typedef struct {
int eobs;
@@ -5252,20 +5071,18 @@ typedef struct {
int64_t bsse;
int64_t brdcost;
int_mv mvs[2];
-#if CONFIG_REF_MV
int_mv pred_mv[2];
-#endif // CONFIG_REF_MV
#if CONFIG_EXT_INTER
int_mv ref_mv[2];
#endif // CONFIG_EXT_INTER
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
ENTROPY_CONTEXT ta[4];
ENTROPY_CONTEXT tl[4];
#else
ENTROPY_CONTEXT ta[2];
ENTROPY_CONTEXT tl[2];
-#endif // CONFIG_CB4X4
+#endif // CONFIG_CHROMA_2X2
} SEG_RDSTAT;
typedef struct {
@@ -5293,37 +5110,13 @@ static INLINE int mv_check_bounds(const MvLimits *mv_limits, const MV *mv) {
(mv->col >> 3) > mv_limits->col_max;
}
-static INLINE void mi_buf_shift(MACROBLOCK *x, int i) {
- MB_MODE_INFO *const mbmi = &x->e_mbd.mi[0]->mbmi;
- struct macroblock_plane *const p = &x->plane[0];
- struct macroblockd_plane *const pd = &x->e_mbd.plane[0];
-
- p->src.buf =
- &p->src.buf[av1_raster_block_offset(BLOCK_8X8, i, p->src.stride)];
- assert(((intptr_t)pd->pre[0].buf & 0x7) == 0);
- pd->pre[0].buf =
- &pd->pre[0].buf[av1_raster_block_offset(BLOCK_8X8, i, pd->pre[0].stride)];
- if (has_second_ref(mbmi))
- pd->pre[1].buf =
- &pd->pre[1]
- .buf[av1_raster_block_offset(BLOCK_8X8, i, pd->pre[1].stride)];
-}
-
-static INLINE void mi_buf_restore(MACROBLOCK *x, struct buf_2d orig_src,
- struct buf_2d orig_pre[2]) {
- MB_MODE_INFO *mbmi = &x->e_mbd.mi[0]->mbmi;
- x->plane[0].src = orig_src;
- x->e_mbd.plane[0].pre[0] = orig_pre[0];
- if (has_second_ref(mbmi)) x->e_mbd.plane[0].pre[1] = orig_pre[1];
-}
-
// Check if NEARESTMV/NEARMV/ZEROMV is the cheapest way encode zero motion.
// TODO(aconverse): Find out if this is still productive then clean up or remove
static int check_best_zero_mv(
const AV1_COMP *const cpi, const int16_t mode_context[TOTAL_REFS_PER_FRAME],
-#if CONFIG_REF_MV && CONFIG_EXT_INTER
+#if CONFIG_EXT_INTER
const int16_t compound_mode_context[TOTAL_REFS_PER_FRAME],
-#endif // CONFIG_REF_MV && CONFIG_EXT_INTER
+#endif // CONFIG_EXT_INTER
int_mv frame_mv[MB_MODE_COUNT][TOTAL_REFS_PER_FRAME], int this_mode,
const MV_REFERENCE_FRAME ref_frames[2], const BLOCK_SIZE bsize, int block,
int mi_row, int mi_col) {
@@ -5355,21 +5148,12 @@ static int check_best_zero_mv(
frame_mv[this_mode][ref_frames[0]].as_int == zeromv[0].as_int &&
(ref_frames[1] <= INTRA_FRAME ||
frame_mv[this_mode][ref_frames[1]].as_int == zeromv[1].as_int)) {
-#if CONFIG_REF_MV
int16_t rfc =
av1_mode_context_analyzer(mode_context, ref_frames, bsize, block);
-#else
- int16_t rfc = mode_context[ref_frames[0]];
-#endif // CONFIG_REF_MV
int c1 = cost_mv_ref(cpi, NEARMV, rfc);
int c2 = cost_mv_ref(cpi, NEARESTMV, rfc);
int c3 = cost_mv_ref(cpi, ZEROMV, rfc);
-#if !CONFIG_REF_MV
- (void)bsize;
- (void)block;
-#endif // !CONFIG_REF_MV
-
if (this_mode == NEARMV) {
if (c1 > c3) return 0;
} else if (this_mode == NEARESTMV) {
@@ -5390,40 +5174,25 @@ static int check_best_zero_mv(
}
}
#if CONFIG_EXT_INTER
- else if ((this_mode == NEAREST_NEARESTMV || this_mode == NEAREST_NEARMV ||
- this_mode == NEAR_NEARESTMV || this_mode == NEAR_NEARMV ||
+ else if ((this_mode == NEAREST_NEARESTMV || this_mode == NEAR_NEARMV ||
this_mode == ZERO_ZEROMV) &&
frame_mv[this_mode][ref_frames[0]].as_int == zeromv[0].as_int &&
frame_mv[this_mode][ref_frames[1]].as_int == zeromv[1].as_int) {
-#if CONFIG_REF_MV
int16_t rfc = compound_mode_context[ref_frames[0]];
-#else
- int16_t rfc = mode_context[ref_frames[0]];
-#endif // CONFIG_REF_MV
- int c1 = cost_mv_ref(cpi, NEAREST_NEARMV, rfc);
int c2 = cost_mv_ref(cpi, NEAREST_NEARESTMV, rfc);
int c3 = cost_mv_ref(cpi, ZERO_ZEROMV, rfc);
- int c4 = cost_mv_ref(cpi, NEAR_NEARESTMV, rfc);
int c5 = cost_mv_ref(cpi, NEAR_NEARMV, rfc);
- if (this_mode == NEAREST_NEARMV) {
- if (c1 > c3) return 0;
- } else if (this_mode == NEAREST_NEARESTMV) {
+ if (this_mode == NEAREST_NEARESTMV) {
if (c2 > c3) return 0;
- } else if (this_mode == NEAR_NEARESTMV) {
- if (c4 > c3) return 0;
} else if (this_mode == NEAR_NEARMV) {
if (c5 > c3) return 0;
} else {
assert(this_mode == ZERO_ZEROMV);
if ((c3 >= c2 && frame_mv[NEAREST_NEARESTMV][ref_frames[0]].as_int == 0 &&
frame_mv[NEAREST_NEARESTMV][ref_frames[1]].as_int == 0) ||
- (c3 >= c1 && frame_mv[NEAREST_NEARMV][ref_frames[0]].as_int == 0 &&
- frame_mv[NEAREST_NEARMV][ref_frames[1]].as_int == 0) ||
(c3 >= c5 && frame_mv[NEAR_NEARMV][ref_frames[0]].as_int == 0 &&
- frame_mv[NEAR_NEARMV][ref_frames[1]].as_int == 0) ||
- (c3 >= c4 && frame_mv[NEAR_NEARESTMV][ref_frames[0]].as_int == 0 &&
- frame_mv[NEAR_NEARESTMV][ref_frames[1]].as_int == 0))
+ frame_mv[NEAR_NEARMV][ref_frames[1]].as_int == 0))
return 0;
}
}
@@ -5435,7 +5204,8 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
BLOCK_SIZE bsize, int_mv *frame_mv, int mi_row,
int mi_col,
#if CONFIG_EXT_INTER
- int_mv *ref_mv_sub8x8[2],
+ int_mv *ref_mv_sub8x8[2], const uint8_t *mask,
+ int mask_stride,
#endif // CONFIG_EXT_INTER
int *rate_mv, const int block) {
const AV1_COMMON *const cm = &cpi->common;
@@ -5596,17 +5366,26 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
best_mv->col >>= 3;
best_mv->row >>= 3;
-#if CONFIG_REF_MV
av1_set_mvcost(x, refs[id], id, mbmi->ref_mv_idx);
-#endif // CONFIG_REF_MV
// Small-range full-pixel motion search.
bestsme =
av1_refining_search_8p_c(x, sadpb, search_range, &cpi->fn_ptr[bsize],
+#if CONFIG_EXT_INTER
+ mask, mask_stride, id,
+#endif
&ref_mv[id].as_mv, second_pred);
- if (bestsme < INT_MAX)
- bestsme = av1_get_mvpred_av_var(x, best_mv, &ref_mv[id].as_mv,
- second_pred, &cpi->fn_ptr[bsize], 1);
+ if (bestsme < INT_MAX) {
+#if CONFIG_EXT_INTER
+ if (mask)
+ bestsme = av1_get_mvpred_mask_var(x, best_mv, &ref_mv[id].as_mv,
+ second_pred, mask, mask_stride, id,
+ &cpi->fn_ptr[bsize], 1);
+ else
+#endif
+ bestsme = av1_get_mvpred_av_var(x, best_mv, &ref_mv[id].as_mv,
+ second_pred, &cpi->fn_ptr[bsize], 1);
+ }
x->mv_limits = tmp_mv_limits;
@@ -5639,7 +5418,11 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
x, &ref_mv[id].as_mv, cpi->common.allow_high_precision_mv,
x->errorperbit, &cpi->fn_ptr[bsize], 0,
cpi->sf.mv.subpel_iters_per_step, NULL, x->nmvjointcost, x->mvcost,
- &dis, &sse, second_pred, pw, ph, 1);
+ &dis, &sse, second_pred,
+#if CONFIG_EXT_INTER
+ mask, mask_stride, id,
+#endif
+ pw, ph, 1);
// Restore the reference frames.
pd->pre[0] = backup_pred;
@@ -5649,7 +5432,11 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
x, &ref_mv[id].as_mv, cpi->common.allow_high_precision_mv,
x->errorperbit, &cpi->fn_ptr[bsize], 0,
cpi->sf.mv.subpel_iters_per_step, NULL, x->nmvjointcost, x->mvcost,
- &dis, &sse, second_pred, pw, ph, 0);
+ &dis, &sse, second_pred,
+#if CONFIG_EXT_INTER
+ mask, mask_stride, id,
+#endif
+ pw, ph, 0);
}
}
@@ -5673,9 +5460,7 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
for (i = 0; i < MAX_MB_PLANE; i++)
xd->plane[i].pre[ref] = backup_yv12[ref][i];
}
-#if CONFIG_REF_MV
av1_set_mvcost(x, refs[ref], ref, mbmi->ref_mv_idx);
-#endif // CONFIG_REF_MV
#if CONFIG_EXT_INTER && !CONFIG_CB4X4
if (bsize >= BLOCK_8X8)
#endif // CONFIG_EXT_INTER && !CONFIG_CB4X4
@@ -5691,947 +5476,6 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
}
}
-#if CONFIG_REF_MV && !CONFIG_EXT_INTER
-static void update_mv_search_and_seg_mvs(
- int *const run_mv_search, int_mv *const seg_mvs, int has_second_rf,
- const MV_REFERENCE_FRAME *const ref_frame,
- const SEG_RDSTAT *const ref_rdstat, int_mv *const bsi_ref_mv[2]) {
- if (has_second_rf) {
- if (seg_mvs[ref_frame[0]].as_int == ref_rdstat->mvs[0].as_int &&
- ref_rdstat->mvs[0].as_int != INVALID_MV)
- if (bsi_ref_mv[0]->as_int == ref_rdstat->pred_mv[0].as_int)
- --*run_mv_search;
-
- if (seg_mvs[ref_frame[1]].as_int == ref_rdstat->mvs[1].as_int &&
- ref_rdstat->mvs[1].as_int != INVALID_MV)
- if (bsi_ref_mv[1]->as_int == ref_rdstat->pred_mv[1].as_int)
- --*run_mv_search;
- } else {
- if (bsi_ref_mv[0]->as_int == ref_rdstat->pred_mv[0].as_int &&
- ref_rdstat->mvs[0].as_int != INVALID_MV) {
- *run_mv_search = 0;
- seg_mvs[ref_frame[0]].as_int = ref_rdstat->mvs[0].as_int;
- }
- }
-}
-#endif // CONFIG_REF_MV && !CONFIG_EXT_INTER
-
-static int64_t rd_pick_inter_best_sub8x8_mode(
- const AV1_COMP *const cpi, MACROBLOCK *x, int_mv *best_ref_mv,
- int_mv *second_best_ref_mv, int64_t best_rd, int *returntotrate,
- int *returnyrate, int64_t *returndistortion, int *skippable, int64_t *psse,
- int mvthresh, int_mv seg_mvs[4][TOTAL_REFS_PER_FRAME],
-#if CONFIG_EXT_INTER
- int_mv compound_seg_newmvs[4][2],
-#endif // CONFIG_EXT_INTER
- BEST_SEG_INFO *bsi_buf, int filter_idx, int mi_row, int mi_col) {
- BEST_SEG_INFO *bsi = bsi_buf + filter_idx;
-#if CONFIG_REF_MV
- int_mv tmp_ref_mv[2];
-#endif // CONFIG_REF_MV
- MACROBLOCKD *xd = &x->e_mbd;
- MODE_INFO *mi = xd->mi[0];
- MB_MODE_INFO *mbmi = &mi->mbmi;
- int mode_idx;
- int k, br = 0, idx, idy;
- int64_t bd = 0, block_sse = 0;
- PREDICTION_MODE this_mode;
- const AV1_COMMON *cm = &cpi->common;
- struct macroblock_plane *const p = &x->plane[0];
- struct macroblockd_plane *const pd = &xd->plane[0];
- const int label_count = 4;
- int64_t this_segment_rd = 0;
- int label_mv_thresh;
- int segmentyrate = 0;
- const BLOCK_SIZE bsize = mbmi->sb_type;
- const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize];
- const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[bsize];
-#if CONFIG_CB4X4
- ENTROPY_CONTEXT t_above[4], t_left[4];
-#else
- ENTROPY_CONTEXT t_above[2], t_left[2];
-#endif // CONFIG_CB4X4
- int subpelmv = 1, have_ref = 0;
- const int has_second_rf = has_second_ref(mbmi);
- const int inter_mode_mask = cpi->sf.inter_mode_mask[bsize];
- MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext;
-#if CONFIG_PVQ
- od_rollback_buffer pre_buf;
-
- od_encode_checkpoint(&x->daala_enc, &pre_buf);
-#endif // CONFIG_PVQ
-#if CONFIG_EXT_TX && CONFIG_RECT_TX
- mbmi->tx_size =
- xd->lossless[mbmi->segment_id] ? TX_4X4 : max_txsize_rect_lookup[bsize];
-#else
- mbmi->tx_size = TX_4X4;
-#endif // CONFIG_EXT_TX && CONFIG_RECT_TX
-
- av1_zero(*bsi);
-
- bsi->segment_rd = best_rd;
- bsi->ref_mv[0] = best_ref_mv;
- bsi->ref_mv[1] = second_best_ref_mv;
- bsi->mvp.as_int = best_ref_mv->as_int;
- bsi->mvthresh = mvthresh;
-
- for (idx = 0; idx < 4; ++idx) bsi->modes[idx] = ZEROMV;
-
-#if CONFIG_REF_MV
- for (idx = 0; idx < 4; ++idx) {
- for (k = NEARESTMV; k <= NEWMV; ++k) {
- bsi->rdstat[idx][INTER_OFFSET(k)].pred_mv[0].as_int = INVALID_MV;
- bsi->rdstat[idx][INTER_OFFSET(k)].pred_mv[1].as_int = INVALID_MV;
-
- bsi->rdstat[idx][INTER_OFFSET(k)].mvs[0].as_int = INVALID_MV;
- bsi->rdstat[idx][INTER_OFFSET(k)].mvs[1].as_int = INVALID_MV;
- }
- }
-#endif // CONFIG_REF_MV
-
- memcpy(t_above, pd->above_context, sizeof(t_above));
- memcpy(t_left, pd->left_context, sizeof(t_left));
-
- // 64 makes this threshold really big effectively
- // making it so that we very rarely check mvs on
- // segments. setting this to 1 would make mv thresh
- // roughly equal to what it is for macroblocks
- label_mv_thresh = 1 * bsi->mvthresh / label_count;
-
- // Segmentation method overheads
- for (idy = 0; idy < 2; idy += num_4x4_blocks_high) {
- for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) {
- // TODO(jingning,rbultje): rewrite the rate-distortion optimization
- // loop for 4x4/4x8/8x4 block coding. to be replaced with new rd loop
- int_mv mode_mv[MB_MODE_COUNT][2];
- int_mv frame_mv[MB_MODE_COUNT][TOTAL_REFS_PER_FRAME];
- PREDICTION_MODE mode_selected = ZEROMV;
- int64_t new_best_rd = INT64_MAX;
- const int index = idy * 2 + idx;
- int ref;
-#if CONFIG_REF_MV
- CANDIDATE_MV ref_mv_stack[2][MAX_REF_MV_STACK_SIZE];
- uint8_t ref_mv_count[2];
-#endif // CONFIG_REF_MV
-#if CONFIG_EXT_INTER
- int_mv ref_mvs_sub8x8[2][2];
-#endif // CONFIG_EXT_INTER
-#if CONFIG_PVQ
- od_rollback_buffer idx_buf, post_buf;
- od_encode_checkpoint(&x->daala_enc, &idx_buf);
- od_encode_checkpoint(&x->daala_enc, &post_buf);
-#endif // CONFIG_PVQ
-
- for (ref = 0; ref < 1 + has_second_rf; ++ref) {
- const MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref];
-#if CONFIG_EXT_INTER
- int_mv mv_ref_list[MAX_MV_REF_CANDIDATES];
- av1_update_mv_context(cm, xd, mi, frame, mv_ref_list, index, mi_row,
- mi_col, NULL);
-#endif // CONFIG_EXT_INTER
-#if CONFIG_GLOBAL_MOTION
- frame_mv[ZEROMV][frame].as_int =
- gm_get_motion_vector(&cm->global_motion[frame],
- cm->allow_high_precision_mv, mbmi->sb_type,
- mi_col, mi_row, index)
- .as_int;
-#else // CONFIG_GLOBAL_MOTION
- frame_mv[ZEROMV][frame].as_int = 0;
-#endif // CONFIG_GLOBAL_MOTION
- av1_append_sub8x8_mvs_for_idx(cm, xd, index, ref, mi_row, mi_col,
-#if CONFIG_REF_MV
- ref_mv_stack[ref], &ref_mv_count[ref],
-#endif // CONFIG_REF_MV
-#if CONFIG_EXT_INTER
- mv_ref_list,
-#endif // CONFIG_EXT_INTER
- &frame_mv[NEARESTMV][frame],
- &frame_mv[NEARMV][frame]);
-
-#if CONFIG_REF_MV
- tmp_ref_mv[ref] = frame_mv[NEARESTMV][mbmi->ref_frame[ref]];
- lower_mv_precision(&tmp_ref_mv[ref].as_mv, cm->allow_high_precision_mv);
- bsi->ref_mv[ref] = &tmp_ref_mv[ref];
- mbmi_ext->ref_mvs[frame][0] = tmp_ref_mv[ref];
-#endif // CONFIG_REF_MV
-
-#if CONFIG_EXT_INTER
- mv_ref_list[0].as_int = frame_mv[NEARESTMV][frame].as_int;
- mv_ref_list[1].as_int = frame_mv[NEARMV][frame].as_int;
- av1_find_best_ref_mvs(cm->allow_high_precision_mv, mv_ref_list,
- &ref_mvs_sub8x8[0][ref], &ref_mvs_sub8x8[1][ref]);
-
- if (has_second_rf) {
-#if CONFIG_GLOBAL_MOTION
- frame_mv[ZERO_ZEROMV][frame].as_int =
- gm_get_motion_vector(&cm->global_motion[frame],
- cm->allow_high_precision_mv, mbmi->sb_type,
- mi_col, mi_row, index)
- .as_int;
-#else
- frame_mv[ZERO_ZEROMV][frame].as_int = 0;
-#endif // CONFIG_GLOBAL_MOTION
- frame_mv[NEAREST_NEARESTMV][frame].as_int =
- frame_mv[NEARESTMV][frame].as_int;
-
- if (ref == 0) {
- frame_mv[NEAREST_NEARMV][frame].as_int =
- frame_mv[NEARESTMV][frame].as_int;
- frame_mv[NEAR_NEARESTMV][frame].as_int =
- frame_mv[NEARMV][frame].as_int;
- frame_mv[NEAREST_NEWMV][frame].as_int =
- frame_mv[NEARESTMV][frame].as_int;
- frame_mv[NEAR_NEWMV][frame].as_int = frame_mv[NEARMV][frame].as_int;
- frame_mv[NEAR_NEARMV][frame].as_int =
- frame_mv[NEARMV][frame].as_int;
- } else if (ref == 1) {
- frame_mv[NEAREST_NEARMV][frame].as_int =
- frame_mv[NEARMV][frame].as_int;
- frame_mv[NEAR_NEARESTMV][frame].as_int =
- frame_mv[NEARESTMV][frame].as_int;
- frame_mv[NEW_NEARESTMV][frame].as_int =
- frame_mv[NEARESTMV][frame].as_int;
- frame_mv[NEW_NEARMV][frame].as_int = frame_mv[NEARMV][frame].as_int;
- frame_mv[NEAR_NEARMV][frame].as_int =
- frame_mv[NEARMV][frame].as_int;
- }
- }
-#endif // CONFIG_EXT_INTER
- }
-
-// search for the best motion vector on this segment
-#if CONFIG_EXT_INTER
- for (this_mode = (has_second_rf ? NEAREST_NEARESTMV : NEARESTMV);
- this_mode <= (has_second_rf ? NEW_NEWMV : NEWMV); ++this_mode)
-#else
- for (this_mode = NEARESTMV; this_mode <= NEWMV; ++this_mode)
-#endif // CONFIG_EXT_INTER
- {
- const struct buf_2d orig_src = x->plane[0].src;
- struct buf_2d orig_pre[2];
- // This flag controls if the motion estimation will kick off. When it
- // is set to a non-zero value, the encoder will force motion estimation.
- int run_mv_search = 0;
-
- mode_idx = INTER_OFFSET(this_mode);
-#if CONFIG_EXT_INTER
- for (ref = 0; ref < 1 + has_second_rf; ++ref)
- bsi->ref_mv[ref]->as_int = ref_mvs_sub8x8[0][ref].as_int;
-#endif // CONFIG_EXT_INTER
- bsi->rdstat[index][mode_idx].brdcost = INT64_MAX;
- if (!(inter_mode_mask & (1 << this_mode))) continue;
-
-#if CONFIG_REF_MV
- run_mv_search = 2;
-#if !CONFIG_EXT_INTER
- if (filter_idx > 0 && this_mode == NEWMV) {
- const BEST_SEG_INFO *ref_bsi = bsi_buf;
- const SEG_RDSTAT *ref_rdstat = &ref_bsi->rdstat[index][mode_idx];
-
- update_mv_search_and_seg_mvs(&run_mv_search, seg_mvs[index],
- has_second_rf, mbmi->ref_frame,
- ref_rdstat, bsi->ref_mv);
-
- if (run_mv_search != 0 && filter_idx > 1) {
- ref_bsi = bsi_buf + 1;
- ref_rdstat = &ref_bsi->rdstat[index][mode_idx];
- run_mv_search = 2;
- update_mv_search_and_seg_mvs(&run_mv_search, seg_mvs[index],
- has_second_rf, mbmi->ref_frame,
- ref_rdstat, bsi->ref_mv);
- }
- }
-#endif // !CONFIG_EXT_INTER
-#endif // CONFIG_REF_MV
-
-#if CONFIG_GLOBAL_MOTION
- if (cm->global_motion[mbmi->ref_frame[0]].wmtype == IDENTITY &&
- (!has_second_rf ||
- cm->global_motion[mbmi->ref_frame[1]].wmtype == IDENTITY))
-#endif // CONFIG_GLOBAL_MOTION
-
- if (!check_best_zero_mv(cpi, mbmi_ext->mode_context,
-#if CONFIG_REF_MV && CONFIG_EXT_INTER
- mbmi_ext->compound_mode_context,
-#endif // CONFIG_REF_MV && CONFIG_EXT_INTER
- frame_mv, this_mode, mbmi->ref_frame, bsize,
- index, mi_row, mi_col))
- continue;
-
- memcpy(orig_pre, pd->pre, sizeof(orig_pre));
- memcpy(bsi->rdstat[index][mode_idx].ta, t_above,
- sizeof(bsi->rdstat[index][mode_idx].ta));
- memcpy(bsi->rdstat[index][mode_idx].tl, t_left,
- sizeof(bsi->rdstat[index][mode_idx].tl));
-#if CONFIG_PVQ
- od_encode_rollback(&x->daala_enc, &idx_buf);
-#endif // CONFIG_PVQ
-
- // motion search for newmv (single predictor case only)
- if (!has_second_rf &&
-#if CONFIG_EXT_INTER
- have_newmv_in_inter_mode(this_mode) &&
- (seg_mvs[index][mbmi->ref_frame[0]].as_int == INVALID_MV)
-#else
- this_mode == NEWMV &&
- (seg_mvs[index][mbmi->ref_frame[0]].as_int == INVALID_MV ||
- run_mv_search)
-#endif // CONFIG_EXT_INTER
- ) {
- int step_param = 0;
- int bestsme = INT_MAX;
- int sadpb = x->sadperbit4;
- MV mvp_full;
- int max_mv;
- int cost_list[5];
- MvLimits tmp_mv_limits = x->mv_limits;
-
- /* Is the best so far sufficiently good that we cant justify doing
- * and new motion search. */
- if (new_best_rd < label_mv_thresh) break;
-
-#if CONFIG_EXT_INTER
- bsi->mvp.as_int = bsi->ref_mv[0]->as_int;
-#else
-// use previous block's result as next block's MV predictor.
-#if !CONFIG_REF_MV
- if (index > 0) {
- bsi->mvp.as_int = mi->bmi[index - 1].as_mv[0].as_int;
- if (index == 2)
- bsi->mvp.as_int = mi->bmi[index - 2].as_mv[0].as_int;
- }
-#endif // !CONFIG_REF_MV
-#endif // CONFIG_EXT_INTER
- max_mv = (index == 0) ? (int)x->max_mv_context[mbmi->ref_frame[0]]
- : AOMMAX(abs(bsi->mvp.as_mv.row),
- abs(bsi->mvp.as_mv.col)) >>
- 3;
-
- if (cpi->sf.mv.auto_mv_step_size && cm->show_frame) {
- // Take wtd average of the step_params based on the last frame's
- // max mv magnitude and the best ref mvs of the current block for
- // the given reference.
- step_param =
- (av1_init_search_range(max_mv) + cpi->mv_step_param) / 2;
- } else {
- step_param = cpi->mv_step_param;
- }
-
-#if CONFIG_REF_MV
- mvp_full.row = bsi->ref_mv[0]->as_mv.row >> 3;
- mvp_full.col = bsi->ref_mv[0]->as_mv.col >> 3;
-#else
- mvp_full.row = bsi->mvp.as_mv.row >> 3;
- mvp_full.col = bsi->mvp.as_mv.col >> 3;
-#endif // CONFIG_REF_MV
-
- if (cpi->sf.adaptive_motion_search) {
- mvp_full.row = x->pred_mv[mbmi->ref_frame[0]].row >> 3;
- mvp_full.col = x->pred_mv[mbmi->ref_frame[0]].col >> 3;
- step_param = AOMMAX(step_param, 8);
- }
-
- // adjust src pointer for this block
- mi_buf_shift(x, index);
-
- av1_set_mv_search_range(&x->mv_limits, &bsi->ref_mv[0]->as_mv);
-
- x->best_mv.as_int = x->second_best_mv.as_int = INVALID_MV;
-
-#if CONFIG_REF_MV
- av1_set_mvcost(x, mbmi->ref_frame[0], 0, mbmi->ref_mv_idx);
-#endif // CONFIG_REF_MV
- bestsme = av1_full_pixel_search(
- cpi, x, bsize, &mvp_full, step_param, sadpb,
- cpi->sf.mv.subpel_search_method != SUBPEL_TREE ? cost_list : NULL,
- &bsi->ref_mv[0]->as_mv, INT_MAX, 1);
-
- x->mv_limits = tmp_mv_limits;
-
- if (bestsme < INT_MAX) {
- int distortion;
- if (cpi->sf.use_upsampled_references) {
- int best_mv_var;
- const int try_second =
- x->second_best_mv.as_int != INVALID_MV &&
- x->second_best_mv.as_int != x->best_mv.as_int;
- const int pw = block_size_wide[bsize];
- const int ph = block_size_high[bsize];
- // Use up-sampled reference frames.
- struct buf_2d backup_pred = pd->pre[0];
- const YV12_BUFFER_CONFIG *upsampled_ref =
- get_upsampled_ref(cpi, mbmi->ref_frame[0]);
-
- // Set pred for Y plane
- setup_pred_plane(
- &pd->pre[0], bsize, upsampled_ref->y_buffer,
- upsampled_ref->y_crop_width, upsampled_ref->y_crop_height,
- upsampled_ref->y_stride, (mi_row << 3), (mi_col << 3), NULL,
- pd->subsampling_x, pd->subsampling_y);
-
- // adjust pred pointer for this block
- pd->pre[0].buf =
- &pd->pre[0].buf[(av1_raster_block_offset(BLOCK_8X8, index,
- pd->pre[0].stride))
- << 3];
-
- best_mv_var = cpi->find_fractional_mv_step(
- x, &bsi->ref_mv[0]->as_mv, cm->allow_high_precision_mv,
- x->errorperbit, &cpi->fn_ptr[bsize],
- cpi->sf.mv.subpel_force_stop,
- cpi->sf.mv.subpel_iters_per_step,
- cond_cost_list(cpi, cost_list), x->nmvjointcost, x->mvcost,
- &distortion, &x->pred_sse[mbmi->ref_frame[0]], NULL, pw, ph,
- 1);
-
- if (try_second) {
- int this_var;
- MV best_mv = x->best_mv.as_mv;
- const MV ref_mv = bsi->ref_mv[0]->as_mv;
- const int minc =
- AOMMAX(x->mv_limits.col_min * 8, ref_mv.col - MV_MAX);
- const int maxc =
- AOMMIN(x->mv_limits.col_max * 8, ref_mv.col + MV_MAX);
- const int minr =
- AOMMAX(x->mv_limits.row_min * 8, ref_mv.row - MV_MAX);
- const int maxr =
- AOMMIN(x->mv_limits.row_max * 8, ref_mv.row + MV_MAX);
-
- x->best_mv = x->second_best_mv;
- if (x->best_mv.as_mv.row * 8 <= maxr &&
- x->best_mv.as_mv.row * 8 >= minr &&
- x->best_mv.as_mv.col * 8 <= maxc &&
- x->best_mv.as_mv.col * 8 >= minc) {
- this_var = cpi->find_fractional_mv_step(
- x, &bsi->ref_mv[0]->as_mv, cm->allow_high_precision_mv,
- x->errorperbit, &cpi->fn_ptr[bsize],
- cpi->sf.mv.subpel_force_stop,
- cpi->sf.mv.subpel_iters_per_step,
- cond_cost_list(cpi, cost_list), x->nmvjointcost,
- x->mvcost, &distortion, &x->pred_sse[mbmi->ref_frame[0]],
- NULL, pw, ph, 1);
- if (this_var < best_mv_var) best_mv = x->best_mv.as_mv;
- x->best_mv.as_mv = best_mv;
- }
- }
-
- // Restore the reference frames.
- pd->pre[0] = backup_pred;
- } else {
- cpi->find_fractional_mv_step(
- x, &bsi->ref_mv[0]->as_mv, cm->allow_high_precision_mv,
- x->errorperbit, &cpi->fn_ptr[bsize],
- cpi->sf.mv.subpel_force_stop,
- cpi->sf.mv.subpel_iters_per_step,
- cond_cost_list(cpi, cost_list), x->nmvjointcost, x->mvcost,
- &distortion, &x->pred_sse[mbmi->ref_frame[0]], NULL, 0, 0, 0);
- }
-
-// save motion search result for use in compound prediction
-#if CONFIG_EXT_INTER
- seg_mvs[index][mbmi->ref_frame[0]].as_mv = x->best_mv.as_mv;
-#else
- seg_mvs[index][mbmi->ref_frame[0]].as_mv = x->best_mv.as_mv;
-#endif // CONFIG_EXT_INTER
- }
-
- if (cpi->sf.adaptive_motion_search)
- x->pred_mv[mbmi->ref_frame[0]] = x->best_mv.as_mv;
-
-#if CONFIG_EXT_INTER
- mode_mv[this_mode][0] = x->best_mv;
-#else
- mode_mv[NEWMV][0] = x->best_mv;
-#endif // CONFIG_EXT_INTER
-
- // restore src pointers
- mi_buf_restore(x, orig_src, orig_pre);
- }
-
- if (has_second_rf) {
-#if CONFIG_EXT_INTER
- if (seg_mvs[index][mbmi->ref_frame[1]].as_int == INVALID_MV ||
- seg_mvs[index][mbmi->ref_frame[0]].as_int == INVALID_MV)
-#else
- if (seg_mvs[index][mbmi->ref_frame[1]].as_int == INVALID_MV ||
- seg_mvs[index][mbmi->ref_frame[0]].as_int == INVALID_MV)
-#endif // CONFIG_EXT_INTER
- continue;
- }
-
-#if CONFIG_DUAL_FILTER
- (void)run_mv_search;
-#endif // CONFIG_DUAL_FILTER
-
- if (has_second_rf &&
-#if CONFIG_EXT_INTER
- this_mode == NEW_NEWMV &&
-#else
- this_mode == NEWMV &&
-#endif // CONFIG_EXT_INTER
-#if CONFIG_DUAL_FILTER
- (mbmi->interp_filter[0] == EIGHTTAP_REGULAR || run_mv_search))
-#else
- (mbmi->interp_filter == EIGHTTAP_REGULAR || run_mv_search))
-#endif // CONFIG_DUAL_FILTER
- {
- // adjust src pointers
- mi_buf_shift(x, index);
- if (cpi->sf.comp_inter_joint_search_thresh <= bsize) {
- int rate_mv;
- frame_mv[this_mode][mbmi->ref_frame[0]].as_int =
- seg_mvs[index][mbmi->ref_frame[0]].as_int;
- frame_mv[this_mode][mbmi->ref_frame[1]].as_int =
- seg_mvs[index][mbmi->ref_frame[1]].as_int;
- joint_motion_search(cpi, x, bsize, frame_mv[this_mode], mi_row,
- mi_col,
-#if CONFIG_EXT_INTER
- bsi->ref_mv,
-#endif // CONFIG_EXT_INTER
- &rate_mv, index);
-#if CONFIG_EXT_INTER
- compound_seg_newmvs[index][0].as_int =
- frame_mv[this_mode][mbmi->ref_frame[0]].as_int;
- compound_seg_newmvs[index][1].as_int =
- frame_mv[this_mode][mbmi->ref_frame[1]].as_int;
-#else
- seg_mvs[index][mbmi->ref_frame[0]].as_int =
- frame_mv[this_mode][mbmi->ref_frame[0]].as_int;
- seg_mvs[index][mbmi->ref_frame[1]].as_int =
- frame_mv[this_mode][mbmi->ref_frame[1]].as_int;
-#endif // CONFIG_EXT_INTER
- }
- // restore src pointers
- mi_buf_restore(x, orig_src, orig_pre);
- }
-
- bsi->rdstat[index][mode_idx].brate = set_and_cost_bmi_mvs(
- cpi, x, xd, index, this_mode, mode_mv[this_mode], frame_mv,
- seg_mvs[index],
-#if CONFIG_EXT_INTER
- compound_seg_newmvs[index],
-#endif // CONFIG_EXT_INTER
- bsi->ref_mv, x->nmvjointcost, x->mvcost, mi_row, mi_col);
-
- for (ref = 0; ref < 1 + has_second_rf; ++ref) {
- bsi->rdstat[index][mode_idx].mvs[ref].as_int =
- mode_mv[this_mode][ref].as_int;
- if (num_4x4_blocks_wide > 1)
- bsi->rdstat[index + 1][mode_idx].mvs[ref].as_int =
- mode_mv[this_mode][ref].as_int;
- if (num_4x4_blocks_high > 1)
- bsi->rdstat[index + 2][mode_idx].mvs[ref].as_int =
- mode_mv[this_mode][ref].as_int;
-#if CONFIG_REF_MV
- bsi->rdstat[index][mode_idx].pred_mv[ref].as_int =
- mi->bmi[index].pred_mv[ref].as_int;
- if (num_4x4_blocks_wide > 1)
- bsi->rdstat[index + 1][mode_idx].pred_mv[ref].as_int =
- mi->bmi[index].pred_mv[ref].as_int;
- if (num_4x4_blocks_high > 1)
- bsi->rdstat[index + 2][mode_idx].pred_mv[ref].as_int =
- mi->bmi[index].pred_mv[ref].as_int;
-#endif // CONFIG_REF_MV
-#if CONFIG_EXT_INTER
- bsi->rdstat[index][mode_idx].ref_mv[ref].as_int =
- bsi->ref_mv[ref]->as_int;
- if (num_4x4_blocks_wide > 1)
- bsi->rdstat[index + 1][mode_idx].ref_mv[ref].as_int =
- bsi->ref_mv[ref]->as_int;
- if (num_4x4_blocks_high > 1)
- bsi->rdstat[index + 2][mode_idx].ref_mv[ref].as_int =
- bsi->ref_mv[ref]->as_int;
-#endif // CONFIG_EXT_INTER
- }
-
- // Trap vectors that reach beyond the UMV borders
- if (mv_check_bounds(&x->mv_limits, &mode_mv[this_mode][0].as_mv) ||
- (has_second_rf &&
- mv_check_bounds(&x->mv_limits, &mode_mv[this_mode][1].as_mv)))
- continue;
-
- if (filter_idx > 0) {
- BEST_SEG_INFO *ref_bsi = bsi_buf;
- subpelmv = 0;
- have_ref = 1;
-
- for (ref = 0; ref < 1 + has_second_rf; ++ref) {
- subpelmv |= mv_has_subpel(&mode_mv[this_mode][ref].as_mv);
-#if CONFIG_EXT_INTER
- if (have_newmv_in_inter_mode(this_mode))
- have_ref &=
- ((mode_mv[this_mode][ref].as_int ==
- ref_bsi->rdstat[index][mode_idx].mvs[ref].as_int) &&
- (bsi->ref_mv[ref]->as_int ==
- ref_bsi->rdstat[index][mode_idx].ref_mv[ref].as_int));
- else
-#endif // CONFIG_EXT_INTER
- have_ref &= mode_mv[this_mode][ref].as_int ==
- ref_bsi->rdstat[index][mode_idx].mvs[ref].as_int;
- }
-
- have_ref &= ref_bsi->rdstat[index][mode_idx].brate > 0;
-
- if (filter_idx > 1 && !subpelmv && !have_ref) {
- ref_bsi = bsi_buf + 1;
- have_ref = 1;
- for (ref = 0; ref < 1 + has_second_rf; ++ref)
-#if CONFIG_EXT_INTER
- if (have_newmv_in_inter_mode(this_mode))
- have_ref &=
- ((mode_mv[this_mode][ref].as_int ==
- ref_bsi->rdstat[index][mode_idx].mvs[ref].as_int) &&
- (bsi->ref_mv[ref]->as_int ==
- ref_bsi->rdstat[index][mode_idx].ref_mv[ref].as_int));
- else
-#endif // CONFIG_EXT_INTER
- have_ref &= mode_mv[this_mode][ref].as_int ==
- ref_bsi->rdstat[index][mode_idx].mvs[ref].as_int;
-
- have_ref &= ref_bsi->rdstat[index][mode_idx].brate > 0;
- }
-
- if (!subpelmv && have_ref &&
- ref_bsi->rdstat[index][mode_idx].brdcost < INT64_MAX) {
-#if CONFIG_REF_MV
- bsi->rdstat[index][mode_idx].byrate =
- ref_bsi->rdstat[index][mode_idx].byrate;
- bsi->rdstat[index][mode_idx].bdist =
- ref_bsi->rdstat[index][mode_idx].bdist;
- bsi->rdstat[index][mode_idx].bsse =
- ref_bsi->rdstat[index][mode_idx].bsse;
- bsi->rdstat[index][mode_idx].brate +=
- ref_bsi->rdstat[index][mode_idx].byrate;
- bsi->rdstat[index][mode_idx].eobs =
- ref_bsi->rdstat[index][mode_idx].eobs;
-
- bsi->rdstat[index][mode_idx].brdcost =
- RDCOST(x->rdmult, x->rddiv, bsi->rdstat[index][mode_idx].brate,
- bsi->rdstat[index][mode_idx].bdist);
-
- memcpy(bsi->rdstat[index][mode_idx].ta,
- ref_bsi->rdstat[index][mode_idx].ta,
- sizeof(bsi->rdstat[index][mode_idx].ta));
- memcpy(bsi->rdstat[index][mode_idx].tl,
- ref_bsi->rdstat[index][mode_idx].tl,
- sizeof(bsi->rdstat[index][mode_idx].tl));
-#else
- memcpy(&bsi->rdstat[index][mode_idx],
- &ref_bsi->rdstat[index][mode_idx], sizeof(SEG_RDSTAT));
-#endif // CONFIG_REF_MV
- if (num_4x4_blocks_wide > 1)
- bsi->rdstat[index + 1][mode_idx].eobs =
- ref_bsi->rdstat[index + 1][mode_idx].eobs;
- if (num_4x4_blocks_high > 1)
- bsi->rdstat[index + 2][mode_idx].eobs =
- ref_bsi->rdstat[index + 2][mode_idx].eobs;
-
- if (bsi->rdstat[index][mode_idx].brdcost < new_best_rd) {
-#if CONFIG_REF_MV
- // If the NEWMV mode is using the same motion vector as the
- // NEARESTMV mode, skip the rest rate-distortion calculations
- // and use the inferred motion vector modes.
- if (this_mode == NEWMV) {
- if (has_second_rf) {
- if (bsi->rdstat[index][mode_idx].mvs[0].as_int ==
- bsi->ref_mv[0]->as_int &&
- bsi->rdstat[index][mode_idx].mvs[1].as_int ==
- bsi->ref_mv[1]->as_int)
- continue;
- } else {
- if (bsi->rdstat[index][mode_idx].mvs[0].as_int ==
- bsi->ref_mv[0]->as_int)
- continue;
- }
- }
-#endif // CONFIG_REF_MV
- mode_selected = this_mode;
- new_best_rd = bsi->rdstat[index][mode_idx].brdcost;
-#if CONFIG_PVQ
- od_encode_checkpoint(&x->daala_enc, &post_buf);
-#endif // CONFIG_PVQ
- }
- continue;
- }
- }
-
- bsi->rdstat[index][mode_idx].brdcost = encode_inter_mb_segment_sub8x8(
- cpi, x, bsi->segment_rd - this_segment_rd, index,
- &bsi->rdstat[index][mode_idx].byrate,
- &bsi->rdstat[index][mode_idx].bdist,
- &bsi->rdstat[index][mode_idx].bsse, bsi->rdstat[index][mode_idx].ta,
- bsi->rdstat[index][mode_idx].tl, idy, idx, mi_row, mi_col);
-
- if (bsi->rdstat[index][mode_idx].brdcost < INT64_MAX) {
- bsi->rdstat[index][mode_idx].brdcost += RDCOST(
- x->rdmult, x->rddiv, bsi->rdstat[index][mode_idx].brate, 0);
- bsi->rdstat[index][mode_idx].brate +=
- bsi->rdstat[index][mode_idx].byrate;
- bsi->rdstat[index][mode_idx].eobs = p->eobs[index];
- if (num_4x4_blocks_wide > 1)
- bsi->rdstat[index + 1][mode_idx].eobs = p->eobs[index + 1];
- if (num_4x4_blocks_high > 1)
- bsi->rdstat[index + 2][mode_idx].eobs = p->eobs[index + 2];
- }
-
- if (bsi->rdstat[index][mode_idx].brdcost < new_best_rd) {
-#if CONFIG_REF_MV
- // If the NEWMV mode is using the same motion vector as the
- // NEARESTMV mode, skip the rest rate-distortion calculations
- // and use the inferred motion vector modes.
- if (this_mode == NEWMV) {
- if (has_second_rf) {
- if (bsi->rdstat[index][mode_idx].mvs[0].as_int ==
- bsi->ref_mv[0]->as_int &&
- bsi->rdstat[index][mode_idx].mvs[1].as_int ==
- bsi->ref_mv[1]->as_int)
- continue;
- } else {
- if (bsi->rdstat[index][mode_idx].mvs[0].as_int ==
- bsi->ref_mv[0]->as_int)
- continue;
- }
- }
-#endif // CONFIG_REF_MV
- mode_selected = this_mode;
- new_best_rd = bsi->rdstat[index][mode_idx].brdcost;
-
-#if CONFIG_PVQ
- od_encode_checkpoint(&x->daala_enc, &post_buf);
-#endif // CONFIG_PVQ
- }
- } /*for each 4x4 mode*/
-
- if (new_best_rd == INT64_MAX) {
- int iy, midx;
- for (iy = index + 1; iy < 4; ++iy)
-#if CONFIG_EXT_INTER
- for (midx = 0; midx < INTER_MODES + INTER_COMPOUND_MODES; ++midx)
-#else
- for (midx = 0; midx < INTER_MODES; ++midx)
-#endif // CONFIG_EXT_INTER
- bsi->rdstat[iy][midx].brdcost = INT64_MAX;
- bsi->segment_rd = INT64_MAX;
-#if CONFIG_PVQ
- od_encode_rollback(&x->daala_enc, &pre_buf);
-#endif // CONFIG_PVQ
- return INT64_MAX;
- }
-
- mode_idx = INTER_OFFSET(mode_selected);
- memcpy(t_above, bsi->rdstat[index][mode_idx].ta, sizeof(t_above));
- memcpy(t_left, bsi->rdstat[index][mode_idx].tl, sizeof(t_left));
-#if CONFIG_PVQ
- od_encode_rollback(&x->daala_enc, &post_buf);
-#endif // CONFIG_PVQ
-
-#if CONFIG_EXT_INTER
- bsi->ref_mv[0]->as_int = bsi->rdstat[index][mode_idx].ref_mv[0].as_int;
- if (has_second_rf)
- bsi->ref_mv[1]->as_int = bsi->rdstat[index][mode_idx].ref_mv[1].as_int;
-#endif // CONFIG_EXT_INTER
- set_and_cost_bmi_mvs(cpi, x, xd, index, mode_selected,
- mode_mv[mode_selected], frame_mv, seg_mvs[index],
-#if CONFIG_EXT_INTER
- compound_seg_newmvs[index],
-#endif // CONFIG_EXT_INTER
- bsi->ref_mv, x->nmvjointcost, x->mvcost, mi_row,
- mi_col);
-
- br += bsi->rdstat[index][mode_idx].brate;
- bd += bsi->rdstat[index][mode_idx].bdist;
- block_sse += bsi->rdstat[index][mode_idx].bsse;
- segmentyrate += bsi->rdstat[index][mode_idx].byrate;
- this_segment_rd += bsi->rdstat[index][mode_idx].brdcost;
-
- if (this_segment_rd > bsi->segment_rd) {
- int iy, midx;
- for (iy = index + 1; iy < 4; ++iy)
-#if CONFIG_EXT_INTER
- for (midx = 0; midx < INTER_MODES + INTER_COMPOUND_MODES; ++midx)
-#else
- for (midx = 0; midx < INTER_MODES; ++midx)
-#endif // CONFIG_EXT_INTER
- bsi->rdstat[iy][midx].brdcost = INT64_MAX;
- bsi->segment_rd = INT64_MAX;
-#if CONFIG_PVQ
- od_encode_rollback(&x->daala_enc, &pre_buf);
-#endif // CONFIG_PVQ
- return INT64_MAX;
- }
- }
- } /* for each label */
-#if CONFIG_PVQ
- od_encode_rollback(&x->daala_enc, &pre_buf);
-#endif // CONFIG_PVQ
-
- bsi->r = br;
- bsi->d = bd;
- bsi->segment_yrate = segmentyrate;
- bsi->segment_rd = this_segment_rd;
- bsi->sse = block_sse;
-
- // update the coding decisions
- for (k = 0; k < 4; ++k) bsi->modes[k] = mi->bmi[k].as_mode;
-
-#if CONFIG_DAALA_DIST
- // Compute prediction (i.e. skip) and decoded distortion by daala-distortion.
- {
- const int src_stride = p->src.stride;
- const int dst_stride = pd->dst.stride;
- uint8_t *src = p->src.buf;
- uint8_t *dst = pd->dst.buf;
- const BLOCK_SIZE plane_bsize = get_plane_block_size(mi->mbmi.sb_type, pd);
- const int use_activity_masking = 0;
- const int qm = OD_HVS_QM;
- const int bsw = block_size_wide[plane_bsize];
- const int bsh = block_size_high[plane_bsize];
- int64_t rd1, rd2;
- int64_t daala_sse, daala_dist;
- TX_SIZE tx_size = mbmi->tx_size;
-
-#if CONFIG_HIGHBITDEPTH
- uint8_t *recon_8x8;
- DECLARE_ALIGNED(16, uint16_t, recon16[8 * 8]);
-
- if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
- recon_8x8 = CONVERT_TO_BYTEPTR(recon16);
- else
- recon_8x8 = (uint8_t *)recon16;
-#else
- DECLARE_ALIGNED(16, uint8_t, recon_8x8[8 * 8]);
-#endif // CONFIG_HIGHBITDEPTH
-
-#if CONFIG_PVQ
- use_activity_masking = x->daala_enc.use_activity_masking;
-#endif // CONFIG_PVQ
-
- // For each of sub8x8 prediction block in a 8x8 block
- for (idy = 0; idy < 2; idy += num_4x4_blocks_high) {
- for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) {
- int i = idy * 2 + idx;
- const uint8_t *const src_sub8x8 =
- src + av1_raster_block_offset(BLOCK_8X8, i, p->src.stride);
- uint8_t *const dst_sub8x8 =
- dst + av1_raster_block_offset(BLOCK_8X8, i, pd->dst.stride);
- uint8_t *recon_sub8x8 = recon_8x8 + (idy * 8 + idx) * 4;
- const int txb_width = max_block_wide(xd, plane_bsize, 0);
- const int txb_height = max_block_high(xd, plane_bsize, 0);
- int idx_, idy_;
-
- av1_build_inter_predictor_sub8x8(xd, 0, i, idy, idx, mi_row, mi_col);
-#if CONFIG_HIGHBITDEPTH
- if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
- aom_highbd_subtract_block(
- height, width,
- av1_raster_block_offset_int16(BLOCK_8X8, i, p->src_diff), 8,
- src_sub8x8, p->src.stride, dst_sub8x8, pd->dst.stride, xd->bd);
- } else {
- aom_subtract_block(
- height, width,
- av1_raster_block_offset_int16(BLOCK_8X8, i, p->src_diff), 8,
- src_sub8x8, p->src.stride, dst_sub8x8, pd->dst.stride);
- }
-#else
- aom_subtract_block(
- bsh, bsw, av1_raster_block_offset_int16(BLOCK_8X8, i, p->src_diff),
- 8, src_sub8x8, p->src.stride, dst_sub8x8, pd->dst.stride);
-#endif // CONFIG_HIGHBITDEPTH
-
-#if CONFIG_HIGHBITDEPTH
- if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
- aom_highbd_convolve_copy(dst_sub8x8, dst_stride, recon_sub8x8, 8,
- NULL, 0, NULL, 0, bsw, bsh, xd->bd);
- } else {
-#endif // CONFIG_HIGHBITDEPTH
- aom_convolve_copy(dst_sub8x8, dst_stride, recon_sub8x8, 8, NULL, 0,
- NULL, 0, bsw, bsh);
-#if CONFIG_HIGHBITDEPTH
- }
-#endif // CONFIG_HIGHBITDEPTH
-
- // To get decoded pixels, do 4x4 xform and quant for each 4x4 block
- // in a sub8x8 prediction block. In case remaining parts of
- // sub8x8 inter mode rdo assume pd->dst stores predicted pixels,
- // use local buffer to store decoded pixels.
- for (idy_ = 0; idy_ < txb_height; idy_++) {
- for (idx_ = 0; idx_ < txb_width; idx_++) {
- int coeff_ctx = 0;
- const tran_low_t *dqcoeff;
- uint16_t eob;
- const PLANE_TYPE plane_type = PLANE_TYPE_Y;
- uint8_t *recon_4x4 = recon_sub8x8 + (idy_ * 8 + idx_) * 4;
- const int block_raster_idx = (idy + idy_) * 2 + (idx + idx_);
- const int block =
- av1_raster_order_to_block_index(tx_size, block_raster_idx);
- TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size);
-
- dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
- av1_xform_quant(cm, x, 0, block, idy + idy_, idx + idx_, BLOCK_8X8,
- tx_size, coeff_ctx, AV1_XFORM_QUANT_FP);
- if (xd->lossless[xd->mi[0]->mbmi.segment_id] == 0)
- av1_optimize_b(cm, x, 0, block, tx_size, coeff_ctx);
-
- eob = p->eobs[block];
- av1_inverse_transform_block(xd, dqcoeff, tx_type, tx_size,
- recon_4x4, 8, eob);
- }
- }
- }
- }
- // Compute daala-distortion for a 8x8 block
- daala_sse = av1_daala_dist(src, src_stride, pd->dst.buf, dst_stride, 8, 8,
- qm, use_activity_masking, x->qindex)
- << 4;
-
- daala_dist = av1_daala_dist(src, src_stride, recon_8x8, 8, 8, 8, qm,
- use_activity_masking, x->qindex)
- << 4;
-
- bsi->sse = daala_sse;
- bsi->d = daala_dist;
-
- rd1 = RDCOST(x->rdmult, x->rddiv, bsi->r, bsi->d);
- rd2 = RDCOST(x->rdmult, x->rddiv, 0, bsi->sse);
- bsi->segment_rd = AOMMIN(rd1, rd2);
- }
-#endif // CONFIG_DAALA_DIST
-
- if (bsi->segment_rd > best_rd) return INT64_MAX;
- /* set it to the best */
- for (idx = 0; idx < 4; idx++) {
- mode_idx = INTER_OFFSET(bsi->modes[idx]);
- mi->bmi[idx].as_mv[0].as_int = bsi->rdstat[idx][mode_idx].mvs[0].as_int;
- if (has_second_ref(mbmi))
- mi->bmi[idx].as_mv[1].as_int = bsi->rdstat[idx][mode_idx].mvs[1].as_int;
-#if CONFIG_REF_MV
- mi->bmi[idx].pred_mv[0] = bsi->rdstat[idx][mode_idx].pred_mv[0];
- if (has_second_ref(mbmi))
- mi->bmi[idx].pred_mv[1] = bsi->rdstat[idx][mode_idx].pred_mv[1];
-#endif // CONFIG_REF_MV
-#if CONFIG_EXT_INTER
- mi->bmi[idx].ref_mv[0].as_int = bsi->rdstat[idx][mode_idx].ref_mv[0].as_int;
- if (has_second_rf)
- mi->bmi[idx].ref_mv[1].as_int =
- bsi->rdstat[idx][mode_idx].ref_mv[1].as_int;
-#endif // CONFIG_EXT_INTER
- x->plane[0].eobs[idx] = bsi->rdstat[idx][mode_idx].eobs;
- mi->bmi[idx].as_mode = bsi->modes[idx];
- }
-
- /*
- * used to set mbmi->mv.as_int
- */
- *returntotrate = bsi->r;
- *returndistortion = bsi->d;
- *returnyrate = bsi->segment_yrate;
- *skippable = av1_is_skippable_in_plane(x, BLOCK_8X8, 0);
- *psse = bsi->sse;
- mbmi->mode = bsi->modes[3];
-
- return bsi->segment_rd;
-}
-
static void estimate_ref_frame_costs(const AV1_COMMON *cm,
const MACROBLOCKD *xd, int segment_id,
unsigned int *ref_costs_single,
@@ -6808,15 +5652,13 @@ static void setup_buffer_inter(
av1_setup_pred_block(xd, yv12_mb[ref_frame], yv12, mi_row, mi_col, sf, sf);
// Gets an initial list of candidate vectors from neighbours and orders them
- av1_find_mv_refs(
- cm, xd, mi, ref_frame,
-#if CONFIG_REF_MV
- &mbmi_ext->ref_mv_count[ref_frame], mbmi_ext->ref_mv_stack[ref_frame],
+ av1_find_mv_refs(cm, xd, mi, ref_frame, &mbmi_ext->ref_mv_count[ref_frame],
+ mbmi_ext->ref_mv_stack[ref_frame],
#if CONFIG_EXT_INTER
- mbmi_ext->compound_mode_context,
+ mbmi_ext->compound_mode_context,
#endif // CONFIG_EXT_INTER
-#endif // CONFIG_REF_MV
- candidates, mi_row, mi_col, NULL, NULL, mbmi_ext->mode_context);
+ candidates, mi_row, mi_col, NULL, NULL,
+ mbmi_ext->mode_context);
// Candidate refinement carried out at encoder and decoder
av1_find_best_ref_mvs(cm->allow_high_precision_mv, candidates,
@@ -6882,9 +5724,7 @@ static void single_motion_search(const AV1_COMP *const cpi, MACROBLOCK *x,
av1_set_mv_search_range(&x->mv_limits, &ref_mv);
-#if CONFIG_REF_MV
av1_set_mvcost(x, ref, ref_idx, mbmi->ref_mv_idx);
-#endif // CONFIG_REF_MV
// Work out the size of the first step in the mv step search.
// 0 here is maximum length first step. 1 is AOMMAX >> 1 etc.
@@ -6996,8 +5836,11 @@ static void single_motion_search(const AV1_COMP *const cpi, MACROBLOCK *x,
x, &ref_mv, cm->allow_high_precision_mv, x->errorperbit,
&cpi->fn_ptr[bsize], cpi->sf.mv.subpel_force_stop,
cpi->sf.mv.subpel_iters_per_step, cond_cost_list(cpi, cost_list),
- x->nmvjointcost, x->mvcost, &dis, &x->pred_sse[ref], NULL, pw, ph,
- 1);
+ x->nmvjointcost, x->mvcost, &dis, &x->pred_sse[ref], NULL,
+#if CONFIG_EXT_INTER
+ NULL, 0, 0,
+#endif
+ pw, ph, 1);
if (try_second) {
const int minc =
@@ -7021,7 +5864,11 @@ static void single_motion_search(const AV1_COMP *const cpi, MACROBLOCK *x,
&cpi->fn_ptr[bsize], cpi->sf.mv.subpel_force_stop,
cpi->sf.mv.subpel_iters_per_step,
cond_cost_list(cpi, cost_list), x->nmvjointcost, x->mvcost,
- &dis, &x->pred_sse[ref], NULL, pw, ph, 1);
+ &dis, &x->pred_sse[ref], NULL,
+#if CONFIG_EXT_INTER
+ NULL, 0, 0,
+#endif
+ pw, ph, 1);
if (this_var < best_mv_var) best_mv = x->best_mv.as_mv;
x->best_mv.as_mv = best_mv;
}
@@ -7034,8 +5881,11 @@ static void single_motion_search(const AV1_COMP *const cpi, MACROBLOCK *x,
x, &ref_mv, cm->allow_high_precision_mv, x->errorperbit,
&cpi->fn_ptr[bsize], cpi->sf.mv.subpel_force_stop,
cpi->sf.mv.subpel_iters_per_step, cond_cost_list(cpi, cost_list),
- x->nmvjointcost, x->mvcost, &dis, &x->pred_sse[ref], NULL, 0, 0,
- 0);
+ x->nmvjointcost, x->mvcost, &dis, &x->pred_sse[ref], NULL,
+#if CONFIG_EXT_INTER
+ NULL, 0, 0,
+#endif
+ 0, 0, 0);
}
#if CONFIG_MOTION_VAR
break;
@@ -7077,131 +5927,287 @@ static INLINE void restore_dst_buf(MACROBLOCKD *xd, BUFFER_SET dst) {
}
#if CONFIG_EXT_INTER
-#if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
-static void do_masked_motion_search(const AV1_COMP *const cpi, MACROBLOCK *x,
- const uint8_t *mask, int mask_stride,
- BLOCK_SIZE bsize, int mi_row, int mi_col,
- int_mv *tmp_mv, int *rate_mv, int ref_idx) {
+static void build_second_inter_pred(const AV1_COMP *cpi, MACROBLOCK *x,
+ BLOCK_SIZE bsize, const MV *other_mv,
+ int mi_row, int mi_col, const int block,
+ int ref_idx, uint8_t *second_pred) {
+ const AV1_COMMON *const cm = &cpi->common;
+ const int pw = block_size_wide[bsize];
+ const int ph = block_size_high[bsize];
MACROBLOCKD *xd = &x->e_mbd;
- const AV1_COMMON *cm = &cpi->common;
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
- struct buf_2d backup_yv12[MAX_MB_PLANE] = { { 0, 0, 0, 0, 0 } };
- int bestsme = INT_MAX;
- int step_param;
- int sadpb = x->sadperbit16;
- MV mvp_full;
- int ref = mbmi->ref_frame[ref_idx];
- MV ref_mv = x->mbmi_ext->ref_mvs[ref][0].as_mv;
-
- MvLimits tmp_mv_limits = x->mv_limits;
-
- const YV12_BUFFER_CONFIG *scaled_ref_frame =
- av1_get_scaled_ref_frame(cpi, ref);
- int i;
+ const int other_ref = mbmi->ref_frame[!ref_idx];
+#if CONFIG_DUAL_FILTER
+ InterpFilter interp_filter[2] = {
+ (ref_idx == 0) ? mbmi->interp_filter[2] : mbmi->interp_filter[0],
+ (ref_idx == 0) ? mbmi->interp_filter[3] : mbmi->interp_filter[1]
+ };
+#else
+ const InterpFilter interp_filter = mbmi->interp_filter;
+#endif // CONFIG_DUAL_FILTER
+ struct scale_factors sf;
+#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
+ struct macroblockd_plane *const pd = &xd->plane[0];
+ // ic and ir are the 4x4 coordiantes of the sub8x8 at index "block"
+ const int ic = block & 1;
+ const int ir = (block - ic) >> 1;
+ const int p_col = ((mi_col * MI_SIZE) >> pd->subsampling_x) + 4 * ic;
+ const int p_row = ((mi_row * MI_SIZE) >> pd->subsampling_y) + 4 * ir;
+#if CONFIG_GLOBAL_MOTION
+ WarpedMotionParams *const wm = &xd->global_motion[other_ref];
+ int is_global = is_global_mv_block(xd->mi[0], block, wm->wmtype);
+#endif // CONFIG_GLOBAL_MOTION
+#else
+ (void)block;
+#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
- MV pred_mv[3];
- pred_mv[0] = x->mbmi_ext->ref_mvs[ref][0].as_mv;
- pred_mv[1] = x->mbmi_ext->ref_mvs[ref][1].as_mv;
- pred_mv[2] = x->pred_mv[ref];
+ // This function should only ever be called for compound modes
+ assert(has_second_ref(mbmi));
-#if CONFIG_REF_MV
- av1_set_mvcost(x, ref, ref_idx, mbmi->ref_mv_idx);
-#endif // CONFIG_REF_MV
+ struct buf_2d backup_yv12[MAX_MB_PLANE];
+ const YV12_BUFFER_CONFIG *const scaled_ref_frame =
+ av1_get_scaled_ref_frame(cpi, other_ref);
if (scaled_ref_frame) {
+ int i;
// Swap out the reference frame for a version that's been scaled to
// match the resolution of the current frame, allowing the existing
// motion search code to be used without additional modifications.
for (i = 0; i < MAX_MB_PLANE; i++)
- backup_yv12[i] = xd->plane[i].pre[ref_idx];
-
- av1_setup_pre_planes(xd, ref_idx, scaled_ref_frame, mi_row, mi_col, NULL);
+ backup_yv12[i] = xd->plane[i].pre[!ref_idx];
+ av1_setup_pre_planes(xd, !ref_idx, scaled_ref_frame, mi_row, mi_col, NULL);
}
- av1_set_mv_search_range(&x->mv_limits, &ref_mv);
+// Since we have scaled the reference frames to match the size of the current
+// frame we must use a unit scaling factor during mode selection.
+#if CONFIG_HIGHBITDEPTH
+ av1_setup_scale_factors_for_frame(&sf, cm->width, cm->height, cm->width,
+ cm->height, cm->use_highbitdepth);
+#else
+ av1_setup_scale_factors_for_frame(&sf, cm->width, cm->height, cm->width,
+ cm->height);
+#endif // CONFIG_HIGHBITDEPTH
- // Work out the size of the first step in the mv step search.
- // 0 here is maximum length first step. 1 is MAX >> 1 etc.
- if (cpi->sf.mv.auto_mv_step_size && cm->show_frame) {
- // Take wtd average of the step_params based on the last frame's
- // max mv magnitude and that based on the best ref mvs of the current
- // block for the given reference.
- step_param =
- (av1_init_search_range(x->max_mv_context[ref]) + cpi->mv_step_param) /
- 2;
+ struct buf_2d ref_yv12;
+
+ const int plane = 0;
+ ConvolveParams conv_params = get_conv_params(0, plane);
+#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
+ WarpTypesAllowed warp_types;
+#if CONFIG_GLOBAL_MOTION
+ warp_types.global_warp_allowed = is_global;
+#endif // CONFIG_GLOBAL_MOTION
+#if CONFIG_WARPED_MOTION
+ warp_types.local_warp_allowed = mbmi->motion_mode == WARPED_CAUSAL;
+#endif // CONFIG_WARPED_MOTION
+#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
+
+ // Initialized here because of compiler problem in Visual Studio.
+ ref_yv12 = xd->plane[plane].pre[!ref_idx];
+
+// Get the prediction block from the 'other' reference frame.
+#if CONFIG_HIGHBITDEPTH
+ if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
+ av1_highbd_build_inter_predictor(
+ ref_yv12.buf, ref_yv12.stride, second_pred, pw, other_mv, &sf, pw, ph,
+ 0, interp_filter,
+#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
+ &warp_types, p_col, p_row,
+#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
+ plane, MV_PRECISION_Q3, mi_col * MI_SIZE, mi_row * MI_SIZE, xd);
} else {
- step_param = cpi->mv_step_param;
+#endif // CONFIG_HIGHBITDEPTH
+ av1_build_inter_predictor(
+ ref_yv12.buf, ref_yv12.stride, second_pred, pw, other_mv, &sf, pw, ph,
+ &conv_params, interp_filter,
+#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
+ &warp_types, p_col, p_row, plane, !ref_idx,
+#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
+ MV_PRECISION_Q3, mi_col * MI_SIZE, mi_row * MI_SIZE, xd);
+#if CONFIG_HIGHBITDEPTH
}
+#endif // CONFIG_HIGHBITDEPTH
- // TODO(debargha): is show_frame needed here?
- if (cpi->sf.adaptive_motion_search && bsize < cm->sb_size && cm->show_frame) {
- int boffset =
- 2 * (b_width_log2_lookup[cm->sb_size] -
- AOMMIN(b_height_log2_lookup[bsize], b_width_log2_lookup[bsize]));
- step_param = AOMMAX(step_param, boffset);
+ if (scaled_ref_frame) {
+ // Restore the prediction frame pointers to their unscaled versions.
+ int i;
+ for (i = 0; i < MAX_MB_PLANE; i++)
+ xd->plane[i].pre[!ref_idx] = backup_yv12[i];
}
+}
- if (cpi->sf.adaptive_motion_search) {
- int bwl = b_width_log2_lookup[bsize];
- int bhl = b_height_log2_lookup[bsize];
- int tlevel = x->pred_mv_sad[ref] >> (bwl + bhl + 4);
+// Search for the best mv for one component of a compound,
+// given that the other component is fixed.
+static void compound_single_motion_search(
+ const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, MV *this_mv,
+ int mi_row, int mi_col, const uint8_t *second_pred, const uint8_t *mask,
+ int mask_stride, int *rate_mv, const int block, int ref_idx) {
+ const int pw = block_size_wide[bsize];
+ const int ph = block_size_high[bsize];
+ MACROBLOCKD *xd = &x->e_mbd;
+ MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
+ const int ref = mbmi->ref_frame[ref_idx];
+ int_mv ref_mv = x->mbmi_ext->ref_mvs[ref][0];
+ struct macroblockd_plane *const pd = &xd->plane[0];
- if (tlevel < 5) step_param += 2;
+ struct buf_2d backup_yv12[MAX_MB_PLANE];
+ const YV12_BUFFER_CONFIG *const scaled_ref_frame =
+ av1_get_scaled_ref_frame(cpi, ref);
- // prev_mv_sad is not setup for dynamically scaled frames.
- if (cpi->oxcf.resize_mode != RESIZE_DYNAMIC) {
- for (i = LAST_FRAME; i <= ALTREF_FRAME && cm->show_frame; ++i) {
- if ((x->pred_mv_sad[ref] >> 3) > x->pred_mv_sad[i]) {
- x->pred_mv[ref].row = 0;
- x->pred_mv[ref].col = 0;
- tmp_mv->as_int = INVALID_MV;
+ // Check that this is either an interinter or an interintra block
+ assert(has_second_ref(mbmi) ||
+ (ref_idx == 0 && mbmi->ref_frame[1] == INTRA_FRAME));
- if (scaled_ref_frame) {
- int j;
- for (j = 0; j < MAX_MB_PLANE; ++j)
- xd->plane[j].pre[ref_idx] = backup_yv12[j];
- }
- return;
- }
- }
- }
+ if (scaled_ref_frame) {
+ int i;
+ // Swap out the reference frame for a version that's been scaled to
+ // match the resolution of the current frame, allowing the existing
+ // motion search code to be used without additional modifications.
+ for (i = 0; i < MAX_MB_PLANE; i++)
+ backup_yv12[i] = xd->plane[i].pre[ref_idx];
+ av1_setup_pre_planes(xd, ref_idx, scaled_ref_frame, mi_row, mi_col, NULL);
}
- mvp_full = pred_mv[x->mv_best_ref_index[ref]];
+ struct buf_2d orig_yv12;
+ int bestsme = INT_MAX;
+ int sadpb = x->sadperbit16;
+ MV *const best_mv = &x->best_mv.as_mv;
+ int search_range = 3;
+
+ MvLimits tmp_mv_limits = x->mv_limits;
- mvp_full.col >>= 3;
- mvp_full.row >>= 3;
+ // Initialized here because of compiler problem in Visual Studio.
+ if (ref_idx) {
+ orig_yv12 = pd->pre[0];
+ pd->pre[0] = pd->pre[ref_idx];
+ }
- bestsme = av1_masked_full_pixel_diamond(
- cpi, x, mask, mask_stride, &mvp_full, step_param, sadpb,
- MAX_MVSEARCH_STEPS - 1 - step_param, 1, &cpi->fn_ptr[bsize], &ref_mv,
- &tmp_mv->as_mv, ref_idx);
+ // Do compound motion search on the current reference frame.
+ av1_set_mv_search_range(&x->mv_limits, &ref_mv.as_mv);
+
+ // Use the mv result from the single mode as mv predictor.
+ *best_mv = *this_mv;
+
+ best_mv->col >>= 3;
+ best_mv->row >>= 3;
+
+ av1_set_mvcost(x, ref, ref_idx, mbmi->ref_mv_idx);
+
+ // Small-range full-pixel motion search.
+ bestsme = av1_refining_search_8p_c(x, sadpb, search_range,
+ &cpi->fn_ptr[bsize], mask, mask_stride,
+ ref_idx, &ref_mv.as_mv, second_pred);
+ if (bestsme < INT_MAX) {
+ if (mask)
+ bestsme =
+ av1_get_mvpred_mask_var(x, best_mv, &ref_mv.as_mv, second_pred, mask,
+ mask_stride, ref_idx, &cpi->fn_ptr[bsize], 1);
+ else
+ bestsme = av1_get_mvpred_av_var(x, best_mv, &ref_mv.as_mv, second_pred,
+ &cpi->fn_ptr[bsize], 1);
+ }
x->mv_limits = tmp_mv_limits;
if (bestsme < INT_MAX) {
int dis; /* TODO: use dis in distortion calculation later. */
- av1_find_best_masked_sub_pixel_tree_up(
- cpi, x, mask, mask_stride, mi_row, mi_col, &tmp_mv->as_mv, &ref_mv,
- cm->allow_high_precision_mv, x->errorperbit, &cpi->fn_ptr[bsize],
- cpi->sf.mv.subpel_force_stop, cpi->sf.mv.subpel_iters_per_step,
- x->nmvjointcost, x->mvcost, &dis, &x->pred_sse[ref], ref_idx,
- cpi->sf.use_upsampled_references);
- }
- *rate_mv = av1_mv_bit_cost(&tmp_mv->as_mv, &ref_mv, x->nmvjointcost,
- x->mvcost, MV_COST_WEIGHT);
+ unsigned int sse;
+ if (cpi->sf.use_upsampled_references) {
+ // Use up-sampled reference frames.
+ struct buf_2d backup_pred = pd->pre[0];
+ const YV12_BUFFER_CONFIG *upsampled_ref = get_upsampled_ref(cpi, ref);
+
+ // Set pred for Y plane
+ setup_pred_plane(&pd->pre[0], bsize, upsampled_ref->y_buffer,
+ upsampled_ref->y_crop_width,
+ upsampled_ref->y_crop_height, upsampled_ref->y_stride,
+ (mi_row << 3), (mi_col << 3), NULL, pd->subsampling_x,
+ pd->subsampling_y);
+
+// If bsize < BLOCK_8X8, adjust pred pointer for this block
+#if !CONFIG_CB4X4
+ if (bsize < BLOCK_8X8)
+ pd->pre[0].buf =
+ &pd->pre[0].buf[(av1_raster_block_offset(BLOCK_8X8, block,
+ pd->pre[0].stride))
+ << 3];
+#endif // !CONFIG_CB4X4
+
+ bestsme = cpi->find_fractional_mv_step(
+ x, &ref_mv.as_mv, cpi->common.allow_high_precision_mv, x->errorperbit,
+ &cpi->fn_ptr[bsize], 0, cpi->sf.mv.subpel_iters_per_step, NULL,
+ x->nmvjointcost, x->mvcost, &dis, &sse, second_pred, mask,
+ mask_stride, ref_idx, pw, ph, 1);
+
+ // Restore the reference frames.
+ pd->pre[0] = backup_pred;
+ } else {
+ (void)block;
+ bestsme = cpi->find_fractional_mv_step(
+ x, &ref_mv.as_mv, cpi->common.allow_high_precision_mv, x->errorperbit,
+ &cpi->fn_ptr[bsize], 0, cpi->sf.mv.subpel_iters_per_step, NULL,
+ x->nmvjointcost, x->mvcost, &dis, &sse, second_pred, mask,
+ mask_stride, ref_idx, pw, ph, 0);
+ }
+ }
+
+ // Restore the pointer to the first (possibly scaled) prediction buffer.
+ if (ref_idx) pd->pre[0] = orig_yv12;
+
+ if (bestsme < INT_MAX) *this_mv = *best_mv;
- if (cpi->sf.adaptive_motion_search && cm->show_frame)
- x->pred_mv[ref] = tmp_mv->as_mv;
+ *rate_mv = 0;
if (scaled_ref_frame) {
+ // Restore the prediction frame pointers to their unscaled versions.
+ int i;
for (i = 0; i < MAX_MB_PLANE; i++)
xd->plane[i].pre[ref_idx] = backup_yv12[i];
}
+
+ av1_set_mvcost(x, ref, ref_idx, mbmi->ref_mv_idx);
+ *rate_mv += av1_mv_bit_cost(this_mv, &ref_mv.as_mv, x->nmvjointcost,
+ x->mvcost, MV_COST_WEIGHT);
}
+// Wrapper for compound_single_motion_search, for the common case
+// where the second prediction is also an inter mode.
+static void compound_single_motion_search_interinter(
+ const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, int_mv *frame_mv,
+ int mi_row, int mi_col, const uint8_t *mask, int mask_stride, int *rate_mv,
+ const int block, int ref_idx) {
+ MACROBLOCKD *xd = &x->e_mbd;
+ MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
+
+ // This function should only ever be called for compound modes
+ assert(has_second_ref(mbmi));
+
+// Prediction buffer from second frame.
+#if CONFIG_HIGHBITDEPTH
+ DECLARE_ALIGNED(16, uint16_t, second_pred_alloc_16[MAX_SB_SQUARE]);
+ uint8_t *second_pred;
+ if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
+ second_pred = CONVERT_TO_BYTEPTR(second_pred_alloc_16);
+ else
+ second_pred = (uint8_t *)second_pred_alloc_16;
+#else
+ DECLARE_ALIGNED(16, uint8_t, second_pred[MAX_SB_SQUARE]);
+#endif // CONFIG_HIGHBITDEPTH
+
+ MV *this_mv = &frame_mv[mbmi->ref_frame[ref_idx]].as_mv;
+ const MV *other_mv = &frame_mv[mbmi->ref_frame[!ref_idx]].as_mv;
+
+ build_second_inter_pred(cpi, x, bsize, other_mv, mi_row, mi_col, block,
+ ref_idx, second_pred);
+
+ compound_single_motion_search(cpi, x, bsize, this_mv, mi_row, mi_col,
+ second_pred, mask, mask_stride, rate_mv, block,
+ ref_idx);
+}
+
+#if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
static void do_masked_motion_search_indexed(
- const AV1_COMP *const cpi, MACROBLOCK *x,
+ const AV1_COMP *const cpi, MACROBLOCK *x, const int_mv *const cur_mv,
const INTERINTER_COMPOUND_DATA *const comp_data, BLOCK_SIZE bsize,
int mi_row, int mi_col, int_mv *tmp_mv, int *rate_mv, int which) {
// NOTE: which values: 0 - 0 only, 1 - 1 only, 2 - both
@@ -7213,23 +6219,22 @@ static void do_masked_motion_search_indexed(
mask = av1_get_compound_type_mask(comp_data, sb_type);
- if (which == 0 || which == 2)
- do_masked_motion_search(cpi, x, mask, mask_stride, bsize, mi_row, mi_col,
- &tmp_mv[0], &rate_mv[0], 0);
-
- if (which == 1 || which == 2) {
-// get the negative mask
-#if CONFIG_COMPOUND_SEGMENT
- uint8_t inv_mask_buf[2 * MAX_SB_SQUARE];
- const int h = block_size_high[bsize];
- mask = av1_get_compound_type_mask_inverse(
- comp_data, inv_mask_buf, h, mask_stride, mask_stride, sb_type);
-#else
- mask = av1_get_compound_type_mask_inverse(comp_data, sb_type);
-#endif // CONFIG_COMPOUND_SEGMENT
- do_masked_motion_search(cpi, x, mask, mask_stride, bsize, mi_row, mi_col,
- &tmp_mv[1], &rate_mv[1], 1);
- }
+ int_mv frame_mv[TOTAL_REFS_PER_FRAME];
+ MV_REFERENCE_FRAME rf[2] = { mbmi->ref_frame[0], mbmi->ref_frame[1] };
+ assert(bsize >= BLOCK_8X8 || CONFIG_CB4X4);
+
+ frame_mv[rf[0]].as_int = cur_mv[0].as_int;
+ frame_mv[rf[1]].as_int = cur_mv[1].as_int;
+ if (which == 0 || which == 1) {
+ compound_single_motion_search_interinter(cpi, x, bsize, frame_mv, mi_row,
+ mi_col, mask, mask_stride, rate_mv,
+ 0, which);
+ } else if (which == 2) {
+ joint_motion_search(cpi, x, bsize, frame_mv, mi_row, mi_col, NULL, mask,
+ mask_stride, rate_mv, 0);
+ }
+ tmp_mv[0].as_int = frame_mv[rf[0]].as_int;
+ tmp_mv[1].as_int = frame_mv[rf[1]].as_int;
}
#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
#endif // CONFIG_EXT_INTER
@@ -7275,7 +6280,7 @@ static int estimate_wedge_sign(const AV1_COMP *cpi, const MACROBLOCK *x,
const int f_index = bsize - BLOCK_8X8;
const int bw = block_size_wide[bsize];
const int bh = block_size_high[bsize];
- uint32_t esq[2][4], var;
+ uint32_t esq[2][4];
int64_t tl, br;
#if CONFIG_HIGHBITDEPTH
@@ -7285,23 +6290,22 @@ static int estimate_wedge_sign(const AV1_COMP *cpi, const MACROBLOCK *x,
}
#endif // CONFIG_HIGHBITDEPTH
- var = cpi->fn_ptr[f_index].vf(src, src_stride, pred0, stride0, &esq[0][0]);
- var = cpi->fn_ptr[f_index].vf(src + bw / 2, src_stride, pred0 + bw / 2,
- stride0, &esq[0][1]);
- var = cpi->fn_ptr[f_index].vf(src + bh / 2 * src_stride, src_stride,
- pred0 + bh / 2 * stride0, stride0, &esq[0][2]);
- var = cpi->fn_ptr[f_index].vf(src + bh / 2 * src_stride + bw / 2, src_stride,
- pred0 + bh / 2 * stride0 + bw / 2, stride0,
- &esq[0][3]);
- var = cpi->fn_ptr[f_index].vf(src, src_stride, pred1, stride1, &esq[1][0]);
- var = cpi->fn_ptr[f_index].vf(src + bw / 2, src_stride, pred1 + bw / 2,
- stride1, &esq[1][1]);
- var = cpi->fn_ptr[f_index].vf(src + bh / 2 * src_stride, src_stride,
- pred1 + bh / 2 * stride1, stride0, &esq[1][2]);
- var = cpi->fn_ptr[f_index].vf(src + bh / 2 * src_stride + bw / 2, src_stride,
- pred1 + bh / 2 * stride1 + bw / 2, stride0,
- &esq[1][3]);
- (void)var;
+ cpi->fn_ptr[f_index].vf(src, src_stride, pred0, stride0, &esq[0][0]);
+ cpi->fn_ptr[f_index].vf(src + bw / 2, src_stride, pred0 + bw / 2, stride0,
+ &esq[0][1]);
+ cpi->fn_ptr[f_index].vf(src + bh / 2 * src_stride, src_stride,
+ pred0 + bh / 2 * stride0, stride0, &esq[0][2]);
+ cpi->fn_ptr[f_index].vf(src + bh / 2 * src_stride + bw / 2, src_stride,
+ pred0 + bh / 2 * stride0 + bw / 2, stride0,
+ &esq[0][3]);
+ cpi->fn_ptr[f_index].vf(src, src_stride, pred1, stride1, &esq[1][0]);
+ cpi->fn_ptr[f_index].vf(src + bw / 2, src_stride, pred1 + bw / 2, stride1,
+ &esq[1][1]);
+ cpi->fn_ptr[f_index].vf(src + bh / 2 * src_stride, src_stride,
+ pred1 + bh / 2 * stride1, stride0, &esq[1][2]);
+ cpi->fn_ptr[f_index].vf(src + bh / 2 * src_stride + bw / 2, src_stride,
+ pred1 + bh / 2 * stride1 + bw / 2, stride0,
+ &esq[1][3]);
tl = (int64_t)(esq[0][0] + esq[0][1] + esq[0][2]) -
(int64_t)(esq[1][0] + esq[1][1] + esq[1][2]);
@@ -7353,16 +6357,6 @@ static InterpFilter predict_interp_filter(
single_filter[NEARESTMV][refs[1]])
best_filter = single_filter[NEARESTMV][refs[0]];
break;
- case NEAREST_NEARMV:
- if (single_filter[NEARESTMV][refs[0]] ==
- single_filter[NEARMV][refs[1]])
- best_filter = single_filter[NEARESTMV][refs[0]];
- break;
- case NEAR_NEARESTMV:
- if (single_filter[NEARMV][refs[0]] ==
- single_filter[NEARESTMV][refs[1]])
- best_filter = single_filter[NEARMV][refs[0]];
- break;
case NEAR_NEARMV:
if (single_filter[NEARMV][refs[0]] == single_filter[NEARMV][refs[1]])
best_filter = single_filter[NEARMV][refs[0]];
@@ -7575,6 +6569,7 @@ static int64_t pick_interinter_wedge(const AV1_COMP *const cpi,
int wedge_sign = 0;
assert(is_interinter_compound_used(COMPOUND_WEDGE, bsize));
+ assert(cpi->common.allow_masked_compound);
if (cpi->sf.fast_wedge_sign_estimate) {
wedge_sign = estimate_wedge_sign(cpi, x, bsize, p0, bw, p1, bw);
@@ -7688,6 +6683,7 @@ static int64_t pick_interintra_wedge(const AV1_COMP *const cpi,
int wedge_index = -1;
assert(is_interintra_wedge_used(bsize));
+ assert(cpi->common.allow_interintra_compound);
rd = pick_wedge_fixed_sign(cpi, x, bsize, p0, p1, 0, &wedge_index);
@@ -7715,15 +6711,13 @@ static int64_t pick_interinter_mask(const AV1_COMP *const cpi, MACROBLOCK *x,
}
}
-static int interinter_compound_motion_search(const AV1_COMP *const cpi,
- MACROBLOCK *x,
- const BLOCK_SIZE bsize,
- const int this_mode, int mi_row,
- int mi_col) {
+static int interinter_compound_motion_search(
+ const AV1_COMP *const cpi, MACROBLOCK *x, const int_mv *const cur_mv,
+ const BLOCK_SIZE bsize, const int this_mode, int mi_row, int mi_col) {
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
int_mv tmp_mv[2];
- int rate_mvs[2], tmp_rate_mv = 0;
+ int tmp_rate_mv = 0;
const INTERINTER_COMPOUND_DATA compound_data = {
#if CONFIG_WEDGE
mbmi->wedge_index,
@@ -7736,20 +6730,17 @@ static int interinter_compound_motion_search(const AV1_COMP *const cpi,
mbmi->interinter_compound_type
};
if (this_mode == NEW_NEWMV) {
- do_masked_motion_search_indexed(cpi, x, &compound_data, bsize, mi_row,
- mi_col, tmp_mv, rate_mvs, 2);
- tmp_rate_mv = rate_mvs[0] + rate_mvs[1];
+ do_masked_motion_search_indexed(cpi, x, cur_mv, &compound_data, bsize,
+ mi_row, mi_col, tmp_mv, &tmp_rate_mv, 2);
mbmi->mv[0].as_int = tmp_mv[0].as_int;
mbmi->mv[1].as_int = tmp_mv[1].as_int;
} else if (this_mode == NEW_NEARESTMV || this_mode == NEW_NEARMV) {
- do_masked_motion_search_indexed(cpi, x, &compound_data, bsize, mi_row,
- mi_col, tmp_mv, rate_mvs, 0);
- tmp_rate_mv = rate_mvs[0];
+ do_masked_motion_search_indexed(cpi, x, cur_mv, &compound_data, bsize,
+ mi_row, mi_col, tmp_mv, &tmp_rate_mv, 0);
mbmi->mv[0].as_int = tmp_mv[0].as_int;
} else if (this_mode == NEAREST_NEWMV || this_mode == NEAR_NEWMV) {
- do_masked_motion_search_indexed(cpi, x, &compound_data, bsize, mi_row,
- mi_col, tmp_mv, rate_mvs, 1);
- tmp_rate_mv = rate_mvs[1];
+ do_masked_motion_search_indexed(cpi, x, cur_mv, &compound_data, bsize,
+ mi_row, mi_col, tmp_mv, &tmp_rate_mv, 1);
mbmi->mv[1].as_int = tmp_mv[1].as_int;
}
return tmp_rate_mv;
@@ -7760,6 +6751,7 @@ static int64_t build_and_cost_compound_type(
const BLOCK_SIZE bsize, const int this_mode, int rs2, int rate_mv,
BUFFER_SET *ctx, int *out_rate_mv, uint8_t **preds0, uint8_t **preds1,
int *strides, int mi_row, int mi_col) {
+ const AV1_COMMON *const cm = &cpi->common;
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
int rate_sum;
@@ -7775,9 +6767,9 @@ static int64_t build_and_cost_compound_type(
if (have_newmv_in_inter_mode(this_mode) &&
use_masked_motion_search(compound_type)) {
- *out_rate_mv = interinter_compound_motion_search(cpi, x, bsize, this_mode,
- mi_row, mi_col);
- av1_build_inter_predictors_sby(xd, mi_row, mi_col, ctx, bsize);
+ *out_rate_mv = interinter_compound_motion_search(cpi, x, cur_mv, bsize,
+ this_mode, mi_row, mi_col);
+ av1_build_inter_predictors_sby(cm, xd, mi_row, mi_col, ctx, bsize);
model_rd_for_sb(cpi, bsize, x, xd, 0, 0, &rate_sum, &dist_sum,
&tmp_skip_txfm_sb, &tmp_skip_sse_sb);
rd = RDCOST(x->rdmult, x->rddiv, rs2 + *out_rate_mv + rate_sum, dist_sum);
@@ -7830,9 +6822,6 @@ typedef struct {
// Pointer to array of motion vectors to use for each ref and their rates
// Should point to first of 2 arrays in 2D array
int *single_newmv_rate;
- // Pointers costs of compound inter-intra and inter-inter predictions
- int *compmode_interintra_cost;
- int *compmode_interinter_cost;
// Pointer to array of predicted rate-distortion
// Should point to first of 2 arrays in 2D array
int64_t (*modelled_rd)[TOTAL_REFS_PER_FRAME];
@@ -7872,14 +6861,12 @@ static int64_t handle_newmv(const AV1_COMP *const cpi, MACROBLOCK *const x,
frame_mv[refs[1]].as_int = single_newmv[refs[1]].as_int;
if (cpi->sf.comp_inter_joint_search_thresh <= bsize) {
- joint_motion_search(cpi, x, bsize, frame_mv, mi_row, mi_col, NULL,
- rate_mv, 0);
+ joint_motion_search(cpi, x, bsize, frame_mv, mi_row, mi_col, NULL, NULL,
+ 0, rate_mv, 0);
} else {
*rate_mv = 0;
for (i = 0; i < 2; ++i) {
-#if CONFIG_REF_MV
av1_set_mvcost(x, refs[i], i, mbmi->ref_mv_idx);
-#endif // CONFIG_REF_MV
*rate_mv += av1_mv_bit_cost(
&frame_mv[refs[i]].as_mv, &mbmi_ext->ref_mvs[refs[i]][0].as_mv,
x->nmvjointcost, x->mvcost, MV_COST_WEIGHT);
@@ -7887,21 +6874,31 @@ static int64_t handle_newmv(const AV1_COMP *const cpi, MACROBLOCK *const x,
}
} else if (this_mode == NEAREST_NEWMV || this_mode == NEAR_NEWMV) {
frame_mv[refs[1]].as_int = single_newmv[refs[1]].as_int;
-#if CONFIG_REF_MV
- av1_set_mvcost(x, refs[1], 1, mbmi->ref_mv_idx);
-#endif // CONFIG_REF_MV
- *rate_mv = av1_mv_bit_cost(&frame_mv[refs[1]].as_mv,
- &mbmi_ext->ref_mvs[refs[1]][0].as_mv,
- x->nmvjointcost, x->mvcost, MV_COST_WEIGHT);
+ if (cpi->sf.comp_inter_joint_search_thresh <= bsize) {
+ frame_mv[refs[0]].as_int =
+ mode_mv[compound_ref0_mode(this_mode)][refs[0]].as_int;
+ compound_single_motion_search_interinter(
+ cpi, x, bsize, frame_mv, mi_row, mi_col, NULL, 0, rate_mv, 0, 1);
+ } else {
+ av1_set_mvcost(x, refs[1], 1, mbmi->ref_mv_idx);
+ *rate_mv = av1_mv_bit_cost(&frame_mv[refs[1]].as_mv,
+ &mbmi_ext->ref_mvs[refs[1]][0].as_mv,
+ x->nmvjointcost, x->mvcost, MV_COST_WEIGHT);
+ }
} else {
assert(this_mode == NEW_NEARESTMV || this_mode == NEW_NEARMV);
frame_mv[refs[0]].as_int = single_newmv[refs[0]].as_int;
-#if CONFIG_REF_MV
- av1_set_mvcost(x, refs[0], 0, mbmi->ref_mv_idx);
-#endif // CONFIG_REF_MV
- *rate_mv = av1_mv_bit_cost(&frame_mv[refs[0]].as_mv,
- &mbmi_ext->ref_mvs[refs[0]][0].as_mv,
- x->nmvjointcost, x->mvcost, MV_COST_WEIGHT);
+ if (cpi->sf.comp_inter_joint_search_thresh <= bsize) {
+ frame_mv[refs[1]].as_int =
+ mode_mv[compound_ref1_mode(this_mode)][refs[1]].as_int;
+ compound_single_motion_search_interinter(
+ cpi, x, bsize, frame_mv, mi_row, mi_col, NULL, 0, rate_mv, 0, 0);
+ } else {
+ av1_set_mvcost(x, refs[0], 0, mbmi->ref_mv_idx);
+ *rate_mv = av1_mv_bit_cost(&frame_mv[refs[0]].as_mv,
+ &mbmi_ext->ref_mvs[refs[0]][0].as_mv,
+ x->nmvjointcost, x->mvcost, MV_COST_WEIGHT);
+ }
}
#else
// Initialize mv using single prediction mode result.
@@ -7913,9 +6910,7 @@ static int64_t handle_newmv(const AV1_COMP *const cpi, MACROBLOCK *const x,
} else {
*rate_mv = 0;
for (i = 0; i < 2; ++i) {
-#if CONFIG_REF_MV
av1_set_mvcost(x, refs[i], i, mbmi->ref_mv_idx);
-#endif // CONFIG_REF_MV
*rate_mv += av1_mv_bit_cost(&frame_mv[refs[i]].as_mv,
&mbmi_ext->ref_mvs[refs[i]][0].as_mv,
x->nmvjointcost, x->mvcost, MV_COST_WEIGHT);
@@ -7986,7 +6981,7 @@ int64_t interpolation_filter_search(
set_default_interp_filters(mbmi, assign_filter);
*switchable_rate = av1_get_switchable_rate(cpi, xd);
- av1_build_inter_predictors_sb(xd, mi_row, mi_col, orig_dst, bsize);
+ av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, orig_dst, bsize);
model_rd_for_sb(cpi, bsize, x, xd, 0, MAX_MB_PLANE - 1, &tmp_rate, &tmp_dist,
skip_txfm_sb, skip_sse_sb);
*rd = RDCOST(x->rdmult, x->rddiv, *switchable_rate + tmp_rate, tmp_dist);
@@ -8022,7 +7017,7 @@ int64_t interpolation_filter_search(
mbmi->interp_filter = (InterpFilter)i;
#endif // CONFIG_DUAL_FILTER
tmp_rs = av1_get_switchable_rate(cpi, xd);
- av1_build_inter_predictors_sb(xd, mi_row, mi_col, orig_dst, bsize);
+ av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, orig_dst, bsize);
model_rd_for_sb(cpi, bsize, x, xd, 0, MAX_MB_PLANE - 1, &tmp_rate,
&tmp_dist, &tmp_skip_sb, &tmp_skip_sse);
tmp_rd = RDCOST(x->rdmult, x->rddiv, tmp_rs + tmp_rate, tmp_dist);
@@ -8077,6 +7072,7 @@ static int64_t motion_mode_rd(
int mi_col, HandleInterModeArgs *const args, const int64_t ref_best_rd,
const int *refs, int rate_mv,
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
+ int_mv *const single_newmv,
#if CONFIG_EXT_INTER
int rate2_bmc_nocoeff, MB_MODE_INFO *best_bmc_mbmi,
#if CONFIG_MOTION_VAR
@@ -8183,10 +7179,10 @@ static int64_t motion_mode_rd(
if (!has_subpel_mv_component(xd->mi[0], xd, 1))
mbmi->interp_filter[1] = EIGHTTAP_REGULAR;
#endif // CONFIG_DUAL_FILTER
- av1_build_inter_predictors_sb(xd, mi_row, mi_col, orig_dst, bsize);
+ av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, orig_dst, bsize);
#if CONFIG_EXT_INTER
} else {
- av1_build_inter_predictors_sb(xd, mi_row, mi_col, orig_dst, bsize);
+ av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, orig_dst, bsize);
#endif // CONFIG_EXT_INTER
}
av1_build_obmc_inter_prediction(
@@ -8214,10 +7210,55 @@ static int64_t motion_mode_rd(
: cm->interp_filter;
#endif // CONFIG_DUAL_FILTER
- if (find_projection(mbmi->num_proj_ref[0], pts, pts_inref, bsize,
- mbmi->mv[0].as_mv.row, mbmi->mv[0].as_mv.col,
- &mbmi->wm_params[0], mi_row, mi_col) == 0) {
- av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL, bsize);
+ if (!find_projection(mbmi->num_proj_ref[0], pts, pts_inref, bsize,
+ mbmi->mv[0].as_mv.row, mbmi->mv[0].as_mv.col,
+ &mbmi->wm_params[0], mi_row, mi_col)) {
+ // Refine MV for NEWMV mode
+ if (!is_comp_pred && have_newmv_in_inter_mode(this_mode)) {
+ int tmp_rate_mv = 0;
+ const int_mv mv0 = mbmi->mv[0];
+ WarpedMotionParams wm_params0 = mbmi->wm_params[0];
+
+ // Refine MV in a small range.
+ av1_refine_warped_mv(cpi, x, bsize, mi_row, mi_col, pts, pts_inref);
+
+ // Keep the refined MV and WM parameters.
+ if (mv0.as_int != mbmi->mv[0].as_int) {
+ const int ref = refs[0];
+ const MV ref_mv = x->mbmi_ext->ref_mvs[ref][0].as_mv;
+
+ tmp_rate_mv =
+ av1_mv_bit_cost(&mbmi->mv[0].as_mv, &ref_mv, x->nmvjointcost,
+ x->mvcost, MV_COST_WEIGHT);
+
+ if (cpi->sf.adaptive_motion_search)
+ x->pred_mv[ref] = mbmi->mv[0].as_mv;
+
+ single_newmv[ref] = mbmi->mv[0];
+
+ if (discount_newmv_test(cpi, this_mode, mbmi->mv[0], mode_mv,
+ refs[0])) {
+ tmp_rate_mv = AOMMAX((tmp_rate_mv / NEW_MV_DISCOUNT_FACTOR), 1);
+ }
+#if CONFIG_EXT_INTER
+ tmp_rate2 = rate2_bmc_nocoeff - rate_mv_bmc + tmp_rate_mv;
+#else
+ tmp_rate2 = rate2_nocoeff - rate_mv + tmp_rate_mv;
+#endif // CONFIG_EXT_INTER
+#if CONFIG_DUAL_FILTER
+ if (!has_subpel_mv_component(xd->mi[0], xd, 0))
+ mbmi->interp_filter[0] = EIGHTTAP_REGULAR;
+ if (!has_subpel_mv_component(xd->mi[0], xd, 1))
+ mbmi->interp_filter[1] = EIGHTTAP_REGULAR;
+#endif // CONFIG_DUAL_FILTER
+ } else {
+ // Restore the old MV and WM parameters.
+ mbmi->mv[0] = mv0;
+ mbmi->wm_params[0] = wm_params0;
+ }
+ }
+
+ av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, bsize);
model_rd_for_sb(cpi, bsize, x, xd, 0, MAX_MB_PLANE - 1, &tmp_rate,
&tmp_dist, skip_txfm_sb, skip_sse_sb);
} else {
@@ -8446,16 +7487,16 @@ static int64_t handle_inter_mode(
int rate_mv = 0;
#if CONFIG_EXT_INTER
int pred_exists = 1;
+#if CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT
const int bw = block_size_wide[bsize];
+#endif // ONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT
int_mv single_newmv[TOTAL_REFS_PER_FRAME];
#if CONFIG_INTERINTRA
const unsigned int *const interintra_mode_cost =
cpi->interintra_mode_cost[size_group_lookup[bsize]];
#endif // CONFIG_INTERINTRA
const int is_comp_interintra_pred = (mbmi->ref_frame[1] == INTRA_FRAME);
-#if CONFIG_REF_MV
uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame);
-#endif // CONFIG_REF_MV
#else
int_mv *const single_newmv = args->single_newmv;
#endif // CONFIG_EXT_INTER
@@ -8484,10 +7525,19 @@ static int64_t handle_inter_mode(
int16_t mode_ctx;
#if CONFIG_EXT_INTER
- *args->compmode_interintra_cost = 0;
+#if CONFIG_INTERINTRA
+ int compmode_interintra_cost = 0;
mbmi->use_wedge_interintra = 0;
- *args->compmode_interinter_cost = 0;
+#endif
+#if CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT
+ int compmode_interinter_cost = 0;
mbmi->interinter_compound_type = COMPOUND_AVERAGE;
+#endif
+
+#if CONFIG_INTERINTRA
+ if (!cm->allow_interintra_compound && is_comp_interintra_pred)
+ return INT64_MAX;
+#endif // CONFIG_INTERINTRA
// is_comp_interintra_pred implies !is_comp_pred
assert(!is_comp_interintra_pred || (!is_comp_pred));
@@ -8495,7 +7545,6 @@ static int64_t handle_inter_mode(
assert(!is_comp_interintra_pred || is_interintra_allowed(mbmi));
#endif // CONFIG_EXT_INTER
-#if CONFIG_REF_MV
#if CONFIG_EXT_INTER
if (is_comp_pred)
mode_ctx = mbmi_ext->compound_mode_context[refs[0]];
@@ -8503,9 +7552,6 @@ static int64_t handle_inter_mode(
#endif // CONFIG_EXT_INTER
mode_ctx = av1_mode_context_analyzer(mbmi_ext->mode_context,
mbmi->ref_frame, bsize, -1);
-#else // CONFIG_REF_MV
- mode_ctx = mbmi_ext->mode_context[refs[0]];
-#endif // CONFIG_REF_MV
#if CONFIG_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
@@ -8545,7 +7591,6 @@ static int64_t handle_inter_mode(
mbmi->mv[i].as_int = cur_mv[i].as_int;
}
-#if CONFIG_REF_MV
#if CONFIG_EXT_INTER
if (this_mode == NEAREST_NEARESTMV)
#else
@@ -8569,7 +7614,7 @@ static int64_t handle_inter_mode(
#if CONFIG_EXT_INTER
if (mbmi_ext->ref_mv_count[ref_frame_type] > 0) {
- if (this_mode == NEAREST_NEWMV || this_mode == NEAREST_NEARMV) {
+ if (this_mode == NEAREST_NEWMV) {
cur_mv[0] = mbmi_ext->ref_mv_stack[ref_frame_type][0].this_mv;
lower_mv_precision(&cur_mv[0].as_mv, cm->allow_high_precision_mv);
@@ -8578,7 +7623,7 @@ static int64_t handle_inter_mode(
mbmi->mv[0].as_int = cur_mv[0].as_int;
}
- if (this_mode == NEW_NEARESTMV || this_mode == NEAR_NEARESTMV) {
+ if (this_mode == NEW_NEARESTMV) {
cur_mv[1] = mbmi_ext->ref_mv_stack[ref_frame_type][0].comp_mv;
lower_mv_precision(&cur_mv[1].as_mv, cm->allow_high_precision_mv);
@@ -8590,8 +7635,7 @@ static int64_t handle_inter_mode(
if (mbmi_ext->ref_mv_count[ref_frame_type] > 1) {
int ref_mv_idx = mbmi->ref_mv_idx + 1;
- if (this_mode == NEAR_NEWMV || this_mode == NEAR_NEARESTMV ||
- this_mode == NEAR_NEARMV) {
+ if (this_mode == NEAR_NEWMV || this_mode == NEAR_NEARMV) {
cur_mv[0] = mbmi_ext->ref_mv_stack[ref_frame_type][ref_mv_idx].this_mv;
lower_mv_precision(&cur_mv[0].as_mv, cm->allow_high_precision_mv);
@@ -8600,8 +7644,7 @@ static int64_t handle_inter_mode(
mbmi->mv[0].as_int = cur_mv[0].as_int;
}
- if (this_mode == NEW_NEARMV || this_mode == NEAREST_NEARMV ||
- this_mode == NEAR_NEARMV) {
+ if (this_mode == NEW_NEARMV || this_mode == NEAR_NEARMV) {
cur_mv[1] = mbmi_ext->ref_mv_stack[ref_frame_type][ref_mv_idx].comp_mv;
lower_mv_precision(&cur_mv[1].as_mv, cm->allow_high_precision_mv);
@@ -8626,7 +7669,6 @@ static int64_t handle_inter_mode(
}
}
#endif // CONFIG_EXT_INTER
-#endif // CONFIG_REF_MV
// do first prediction into the destination buffer. Do the next
// prediction into a temporary buffer. Then keep track of which one
@@ -8659,7 +7701,7 @@ static int64_t handle_inter_mode(
#else
rd_stats->rate += AOMMIN(cost_mv_ref(cpi, this_mode, mode_ctx),
cost_mv_ref(cpi, NEARESTMV, mode_ctx));
-#endif // CONFIG_REF_MV && CONFIG_EXT_INTER
+#endif // CONFIG_EXT_INTER
} else {
rd_stats->rate += cost_mv_ref(cpi, this_mode, mode_ctx);
}
@@ -8688,6 +7730,7 @@ static int64_t handle_inter_mode(
#endif // CONFIG_MOTION_VAR
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
+#if CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT
if (is_comp_pred) {
int rate_sum, rs2;
int64_t dist_sum;
@@ -8705,6 +7748,9 @@ static int64_t handle_inter_mode(
int strides[1] = { bw };
int tmp_rate_mv;
int masked_compound_used = is_any_masked_compound_used(bsize);
+#if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
+ masked_compound_used = masked_compound_used && cm->allow_masked_compound;
+#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
COMPOUND_TYPE cur_type;
best_mv[0].as_int = cur_mv[0].as_int;
@@ -8714,8 +7760,6 @@ static int64_t handle_inter_mode(
uint8_t tmp_mask_buf[2 * MAX_SB_SQUARE];
best_compound_data.seg_mask = tmp_mask_buf;
#endif // CONFIG_COMPOUND_SEGMENT
- av1_cost_tokens(compound_type_cost, cm->fc->compound_type_prob[bsize],
- av1_compound_type_tree);
if (masked_compound_used) {
av1_cost_tokens(compound_type_cost, cm->fc->compound_type_prob[bsize],
@@ -8728,6 +7772,7 @@ static int64_t handle_inter_mode(
}
for (cur_type = COMPOUND_AVERAGE; cur_type < COMPOUND_TYPES; cur_type++) {
+ if (cur_type != COMPOUND_AVERAGE && !masked_compound_used) break;
if (!is_interinter_compound_used(cur_type, bsize)) break;
tmp_rate_mv = rate_mv;
best_rd_cur = INT64_MAX;
@@ -8740,7 +7785,8 @@ static int64_t handle_inter_mode(
switch (cur_type) {
case COMPOUND_AVERAGE:
- av1_build_inter_predictors_sby(xd, mi_row, mi_col, &orig_dst, bsize);
+ av1_build_inter_predictors_sby(cm, xd, mi_row, mi_col, &orig_dst,
+ bsize);
av1_subtract_plane(x, bsize, 0);
rd = estimate_yrd_for_sb(cpi, bsize, x, &rate_sum, &dist_sum,
&tmp_skip_txfm_sb, &tmp_skip_sse_sb,
@@ -8830,13 +7876,14 @@ static int64_t handle_inter_mode(
pred_exists = 0;
- *args->compmode_interinter_cost =
+ compmode_interinter_cost =
av1_cost_literal(get_interinter_compound_type_bits(
bsize, mbmi->interinter_compound_type)) +
(masked_compound_used
? compound_type_cost[mbmi->interinter_compound_type]
: 0);
}
+#endif // CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT
#if CONFIG_INTERINTRA
if (is_comp_interintra_pred) {
@@ -8863,7 +7910,7 @@ static int64_t handle_inter_mode(
xd->plane[j].dst.buf = tmp_buf + j * MAX_SB_SQUARE;
xd->plane[j].dst.stride = bw;
}
- av1_build_inter_predictors_sby(xd, mi_row, mi_col, &orig_dst, bsize);
+ av1_build_inter_predictors_sby(cm, xd, mi_row, mi_col, &orig_dst, bsize);
restore_dst_buf(xd, orig_dst);
mbmi->ref_frame[1] = INTRA_FRAME;
mbmi->use_wedge_interintra = 0;
@@ -8876,7 +7923,8 @@ static int64_t handle_inter_mode(
av1_combine_interintra(xd, bsize, 0, tmp_buf, bw, intrapred, bw);
model_rd_for_sb(cpi, bsize, x, xd, 0, 0, &rate_sum, &dist_sum,
&tmp_skip_txfm_sb, &tmp_skip_sse_sb);
- rd = RDCOST(x->rdmult, x->rddiv, rs + tmp_rate_mv + rate_sum, dist_sum);
+ rd =
+ RDCOST(x->rdmult, x->rddiv, tmp_rate_mv + rate_sum + rmode, dist_sum);
if (rd < best_interintra_rd) {
best_interintra_rd = rd;
best_interintra_mode = mbmi->interintra_mode;
@@ -8907,7 +7955,7 @@ static int64_t handle_inter_mode(
if (rd != INT64_MAX)
rd = RDCOST(x->rdmult, x->rddiv, rmode + rate_mv + rwedge + rate_sum,
dist_sum);
- best_interintra_rd_nowedge = rd;
+ best_interintra_rd_nowedge = best_interintra_rd;
// Disable wedge search if source variance is small
if (x->source_variance > cpi->sf.disable_wedge_search_var_thresh) {
@@ -8926,17 +7974,18 @@ static int64_t handle_inter_mode(
// get negative of mask
const uint8_t *mask = av1_get_contiguous_soft_mask(
mbmi->interintra_wedge_index, 1, bsize);
- do_masked_motion_search(cpi, x, mask, bw, bsize, mi_row, mi_col,
- &tmp_mv, &tmp_rate_mv, 0);
+ tmp_mv.as_int = x->mbmi_ext->ref_mvs[refs[0]][0].as_int;
+ compound_single_motion_search(cpi, x, bsize, &tmp_mv.as_mv, mi_row,
+ mi_col, intrapred, mask, bw,
+ &tmp_rate_mv, 0, 0);
mbmi->mv[0].as_int = tmp_mv.as_int;
- av1_build_inter_predictors_sby(xd, mi_row, mi_col, &orig_dst, bsize);
+ av1_build_inter_predictors_sby(cm, xd, mi_row, mi_col, &orig_dst,
+ bsize);
model_rd_for_sb(cpi, bsize, x, xd, 0, 0, &rate_sum, &dist_sum,
&tmp_skip_txfm_sb, &tmp_skip_sse_sb);
rd = RDCOST(x->rdmult, x->rddiv,
rmode + tmp_rate_mv + rwedge + rate_sum, dist_sum);
- if (rd < best_interintra_rd_wedge) {
- best_interintra_rd_wedge = rd;
- } else {
+ if (rd >= best_interintra_rd_wedge) {
tmp_mv.as_int = cur_mv[0].as_int;
tmp_rate_mv = rate_mv;
}
@@ -8956,37 +8005,33 @@ static int64_t handle_inter_mode(
best_interintra_rd_wedge = rd;
if (best_interintra_rd_wedge < best_interintra_rd_nowedge) {
mbmi->use_wedge_interintra = 1;
- best_interintra_rd = best_interintra_rd_wedge;
mbmi->mv[0].as_int = tmp_mv.as_int;
rd_stats->rate += tmp_rate_mv - rate_mv;
rate_mv = tmp_rate_mv;
} else {
mbmi->use_wedge_interintra = 0;
- best_interintra_rd = best_interintra_rd_nowedge;
mbmi->mv[0].as_int = cur_mv[0].as_int;
}
} else {
mbmi->use_wedge_interintra = 0;
- best_interintra_rd = best_interintra_rd_nowedge;
}
}
#endif // CONFIG_WEDGE
pred_exists = 0;
- *args->compmode_interintra_cost =
- av1_cost_bit(cm->fc->interintra_prob[size_group_lookup[bsize]], 1);
- *args->compmode_interintra_cost +=
+ compmode_interintra_cost =
+ av1_cost_bit(cm->fc->interintra_prob[size_group_lookup[bsize]], 1) +
interintra_mode_cost[mbmi->interintra_mode];
if (is_interintra_wedge_used(bsize)) {
- *args->compmode_interintra_cost += av1_cost_bit(
+ compmode_interintra_cost += av1_cost_bit(
cm->fc->wedge_interintra_prob[bsize], mbmi->use_wedge_interintra);
if (mbmi->use_wedge_interintra) {
- *args->compmode_interintra_cost +=
+ compmode_interintra_cost +=
av1_cost_literal(get_interintra_wedge_bits(bsize));
}
}
} else if (is_interintra_allowed(mbmi)) {
- *args->compmode_interintra_cost =
+ compmode_interintra_cost =
av1_cost_bit(cm->fc->interintra_prob[size_group_lookup[bsize]], 0);
}
#endif // CONFIG_INTERINTRA
@@ -8994,7 +8039,7 @@ static int64_t handle_inter_mode(
if (pred_exists == 0) {
int tmp_rate;
int64_t tmp_dist;
- av1_build_inter_predictors_sb(xd, mi_row, mi_col, &orig_dst, bsize);
+ av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, &orig_dst, bsize);
model_rd_for_sb(cpi, bsize, x, xd, 0, MAX_MB_PLANE - 1, &tmp_rate,
&tmp_dist, &skip_txfm_sb, &skip_sse_sb);
rd = RDCOST(x->rdmult, x->rddiv, rs + tmp_rate, tmp_dist);
@@ -9034,10 +8079,23 @@ static int64_t handle_inter_mode(
}
}
+#if CONFIG_EXT_INTER
+#if CONFIG_INTERINTRA
+ rd_stats->rate += compmode_interintra_cost;
+#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
+ rate2_bmc_nocoeff += compmode_interintra_cost;
+#endif
+#endif
+#if CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT
+ rd_stats->rate += compmode_interinter_cost;
+#endif
+#endif
+
ret_val = motion_mode_rd(cpi, x, bsize, rd_stats, rd_stats_y, rd_stats_uv,
disable_skip, mode_mv, mi_row, mi_col, args,
ref_best_rd, refs, rate_mv,
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
+ single_newmv,
#if CONFIG_EXT_INTER
rate2_bmc_nocoeff, &best_bmc_mbmi,
#if CONFIG_MOTION_VAR
@@ -9060,34 +8118,36 @@ static int64_t rd_pick_intrabc_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x,
MACROBLOCKD *const xd = &x->e_mbd;
const TileInfo *tile = &xd->tile;
+#if CONFIG_EC_ADAPT
+ FRAME_CONTEXT *const ec_ctx = xd->tile_ctx;
+#else
+ FRAME_CONTEXT *const ec_ctx = cm->fc;
+#endif // CONFIG_EC_ADAPT
MODE_INFO *const mi = xd->mi[0];
const int mi_row = -xd->mb_to_top_edge / (8 * MI_SIZE);
const int mi_col = -xd->mb_to_left_edge / (8 * MI_SIZE);
const int w = block_size_wide[bsize];
const int h = block_size_high[bsize];
const int sb_row = mi_row / MAX_MIB_SIZE;
+ const int sb_col = mi_col / MAX_MIB_SIZE;
- int_mv dv_ref;
- av1_find_ref_dv(&dv_ref, mi_row, mi_col);
-
- const MvLimits tmp_mv_limits = x->mv_limits;
+ MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext;
+ MV_REFERENCE_FRAME ref_frame = INTRA_FRAME;
+ int_mv *const candidates = x->mbmi_ext->ref_mvs[ref_frame];
+ av1_find_mv_refs(cm, xd, mi, ref_frame, &mbmi_ext->ref_mv_count[ref_frame],
+ mbmi_ext->ref_mv_stack[ref_frame],
+#if CONFIG_EXT_INTER
+ mbmi_ext->compound_mode_context,
+#endif // CONFIG_EXT_INTER
+ candidates, mi_row, mi_col, NULL, NULL,
+ mbmi_ext->mode_context);
- // TODO(aconverse@google.com): Handle same row DV.
- x->mv_limits.col_min = (tile->mi_col_start - mi_col) * MI_SIZE;
- x->mv_limits.col_max = (tile->mi_col_end - mi_col) * MI_SIZE - w;
- x->mv_limits.row_min = (tile->mi_row_start - mi_row) * MI_SIZE;
- x->mv_limits.row_max = (sb_row * MAX_MIB_SIZE - mi_row) * MI_SIZE - h;
- assert(x->mv_limits.col_min >= tmp_mv_limits.col_min);
- assert(x->mv_limits.col_max <= tmp_mv_limits.col_max);
- assert(x->mv_limits.row_min >= tmp_mv_limits.row_min);
- assert(x->mv_limits.row_max <= tmp_mv_limits.row_max);
- av1_set_mv_search_range(&x->mv_limits, &dv_ref.as_mv);
+ int_mv nearestmv, nearmv;
+ av1_find_best_ref_mvs(0, candidates, &nearestmv, &nearmv);
- if (x->mv_limits.col_max < x->mv_limits.col_min ||
- x->mv_limits.row_max < x->mv_limits.row_min) {
- x->mv_limits = tmp_mv_limits;
- return INT64_MAX;
- }
+ int_mv dv_ref = nearestmv.as_int == 0 ? nearmv : nearestmv;
+ if (dv_ref.as_int == 0) av1_find_ref_dv(&dv_ref, mi_row, mi_col);
+ mbmi_ext->ref_mvs[INTRA_FRAME][0] = dv_ref;
struct buf_2d yv12_mb[MAX_MB_PLANE];
av1_setup_pred_block(xd, yv12_mb, xd->cur_buf, mi_row, mi_col, NULL, NULL);
@@ -9095,86 +8155,140 @@ static int64_t rd_pick_intrabc_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x,
xd->plane[i].pre[0] = yv12_mb[i];
}
- int step_param = cpi->mv_step_param;
- MV mvp_full = dv_ref.as_mv;
- mvp_full.col >>= 3;
- mvp_full.row >>= 3;
- int sadpb = x->sadperbit16;
- int cost_list[5];
- int bestsme = av1_full_pixel_search(cpi, x, bsize, &mvp_full, step_param,
- sadpb, cond_cost_list(cpi, cost_list),
- &dv_ref.as_mv, INT_MAX, 1);
+ enum IntrabcMotionDirection {
+ IBC_MOTION_ABOVE,
+ IBC_MOTION_LEFT,
+ IBC_MOTION_DIRECTIONS
+ };
- x->mv_limits = tmp_mv_limits;
- if (bestsme == INT_MAX) return INT64_MAX;
- mvp_full = x->best_mv.as_mv;
- MV dv = {.row = mvp_full.row * 8, .col = mvp_full.col * 8 };
- if (mv_check_bounds(&x->mv_limits, &dv)) return INT64_MAX;
- if (!is_dv_valid(dv, tile, mi_row, mi_col, bsize)) return INT64_MAX;
MB_MODE_INFO *mbmi = &mi->mbmi;
MB_MODE_INFO best_mbmi = *mbmi;
RD_STATS best_rdcost = *rd_cost;
int best_skip = x->skip;
+
+ for (enum IntrabcMotionDirection dir = IBC_MOTION_ABOVE;
+ dir < IBC_MOTION_DIRECTIONS; ++dir) {
+ const MvLimits tmp_mv_limits = x->mv_limits;
+ switch (dir) {
+ case IBC_MOTION_ABOVE:
+ x->mv_limits.col_min = (tile->mi_col_start - mi_col) * MI_SIZE;
+ x->mv_limits.col_max = (tile->mi_col_end - mi_col) * MI_SIZE - w;
+ x->mv_limits.row_min = (tile->mi_row_start - mi_row) * MI_SIZE;
+ x->mv_limits.row_max = (sb_row * MAX_MIB_SIZE - mi_row) * MI_SIZE - h;
+ break;
+ case IBC_MOTION_LEFT:
+ x->mv_limits.col_min = (tile->mi_col_start - mi_col) * MI_SIZE;
+ x->mv_limits.col_max = (sb_col * MAX_MIB_SIZE - mi_col) * MI_SIZE - w;
+ // TODO(aconverse@google.com): Minimize the overlap between above and
+ // left areas.
+ x->mv_limits.row_min = (tile->mi_row_start - mi_row) * MI_SIZE;
+ int bottom_coded_mi_edge =
+ AOMMIN((sb_row + 1) * MAX_MIB_SIZE, tile->mi_row_end);
+ x->mv_limits.row_max = (bottom_coded_mi_edge - mi_row) * MI_SIZE - h;
+ break;
+ default: assert(0);
+ }
+ assert(x->mv_limits.col_min >= tmp_mv_limits.col_min);
+ assert(x->mv_limits.col_max <= tmp_mv_limits.col_max);
+ assert(x->mv_limits.row_min >= tmp_mv_limits.row_min);
+ assert(x->mv_limits.row_max <= tmp_mv_limits.row_max);
+ av1_set_mv_search_range(&x->mv_limits, &dv_ref.as_mv);
+
+ if (x->mv_limits.col_max < x->mv_limits.col_min ||
+ x->mv_limits.row_max < x->mv_limits.row_min) {
+ x->mv_limits = tmp_mv_limits;
+ continue;
+ }
+
+ int step_param = cpi->mv_step_param;
+ MV mvp_full = dv_ref.as_mv;
+ mvp_full.col >>= 3;
+ mvp_full.row >>= 3;
+ int sadpb = x->sadperbit16;
+ int cost_list[5];
+ int bestsme = av1_full_pixel_search(cpi, x, bsize, &mvp_full, step_param,
+ sadpb, cond_cost_list(cpi, cost_list),
+ &dv_ref.as_mv, INT_MAX, 1);
+
+ x->mv_limits = tmp_mv_limits;
+ if (bestsme == INT_MAX) continue;
+ mvp_full = x->best_mv.as_mv;
+ MV dv = {.row = mvp_full.row * 8, .col = mvp_full.col * 8 };
+ if (mv_check_bounds(&x->mv_limits, &dv)) continue;
+ if (!is_dv_valid(dv, tile, mi_row, mi_col, bsize)) continue;
+
#if CONFIG_PALETTE
- memset(&mbmi->palette_mode_info, 0, sizeof(mbmi->palette_mode_info));
+ memset(&mbmi->palette_mode_info, 0, sizeof(mbmi->palette_mode_info));
#endif
- mbmi->use_intrabc = 1;
- mbmi->mode = DC_PRED;
- mbmi->uv_mode = DC_PRED;
- mbmi->mv[0].as_mv = dv;
+ mbmi->use_intrabc = 1;
+ mbmi->mode = DC_PRED;
+ mbmi->uv_mode = DC_PRED;
+ mbmi->mv[0].as_mv = dv;
#if CONFIG_DUAL_FILTER
- for (int idx = 0; idx < 4; ++idx) mbmi->interp_filter[idx] = BILINEAR;
+ for (int idx = 0; idx < 4; ++idx) mbmi->interp_filter[idx] = BILINEAR;
#else
- mbmi->interp_filter = BILINEAR;
+ mbmi->interp_filter = BILINEAR;
#endif
- mbmi->skip = 0;
- x->skip = 0;
- av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL, bsize);
-
- int rate_mv = av1_mv_bit_cost(&dv, &dv_ref.as_mv, x->nmvjointcost, x->mvcost,
- MV_COST_WEIGHT);
- const PREDICTION_MODE A = av1_above_block_mode(mi, xd->above_mi, 0);
- const PREDICTION_MODE L = av1_left_block_mode(mi, xd->left_mi, 0);
- const int rate_mode =
- cpi->y_mode_costs[A][L][DC_PRED] + av1_cost_bit(INTRABC_PROB, 1);
-
- RD_STATS rd_stats, rd_stats_uv;
- av1_subtract_plane(x, bsize, 0);
- super_block_yrd(cpi, x, &rd_stats, bsize, INT64_MAX);
- super_block_uvrd(cpi, x, &rd_stats_uv, bsize, INT64_MAX);
- av1_merge_rd_stats(&rd_stats, &rd_stats_uv);
+ mbmi->skip = 0;
+ x->skip = 0;
+ av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, bsize);
+
+ int rate_mv = av1_mv_bit_cost(&dv, &dv_ref.as_mv, x->nmvjointcost,
+ x->mvcost, MV_COST_WEIGHT);
+ const PREDICTION_MODE A = av1_above_block_mode(mi, xd->above_mi, 0);
+ const PREDICTION_MODE L = av1_left_block_mode(mi, xd->left_mi, 0);
+ const int rate_mode = cpi->y_mode_costs[A][L][DC_PRED] +
+ av1_cost_bit(ec_ctx->intrabc_prob, 1);
+
+ RD_STATS rd_stats, rd_stats_uv;
+ av1_subtract_plane(x, bsize, 0);
+ super_block_yrd(cpi, x, &rd_stats, bsize, INT64_MAX);
+ super_block_uvrd(cpi, x, &rd_stats_uv, bsize, INT64_MAX);
+ av1_merge_rd_stats(&rd_stats, &rd_stats_uv);
#if CONFIG_RD_DEBUG
- mbmi->rd_stats = rd_stats;
+ mbmi->rd_stats = rd_stats;
#endif
- const aom_prob skip_prob = av1_get_skip_prob(cm, xd);
-
- RD_STATS rdc_noskip;
- av1_init_rd_stats(&rdc_noskip);
- rdc_noskip.rate =
- rate_mode + rate_mv + rd_stats.rate + av1_cost_bit(skip_prob, 0);
- rdc_noskip.dist = rd_stats.dist;
- rdc_noskip.rdcost =
- RDCOST(x->rdmult, x->rddiv, rdc_noskip.rate, rdc_noskip.dist);
- if (rdc_noskip.rdcost < best_rd) {
- best_rd = rdc_noskip.rdcost;
- best_mbmi = *mbmi;
- best_skip = x->skip;
- best_rdcost = rdc_noskip;
- }
+#if CONFIG_VAR_TX
+ // TODO(aconverse@google.com): Evaluate allowing VAR TX on intrabc blocks
+ const int width = block_size_wide[bsize] >> tx_size_wide_log2[0];
+ const int height = block_size_high[bsize] >> tx_size_high_log2[0];
+ int idx, idy;
+ for (idy = 0; idy < height; ++idy)
+ for (idx = 0; idx < width; ++idx)
+ mbmi->inter_tx_size[idy >> 1][idx >> 1] = mbmi->tx_size;
+ mbmi->min_tx_size = get_min_tx_size(mbmi->tx_size);
+#endif // CONFIG_VAR_TX
- x->skip = 1;
- mbmi->skip = 1;
- RD_STATS rdc_skip;
- av1_init_rd_stats(&rdc_skip);
- rdc_skip.rate = rate_mode + rate_mv + av1_cost_bit(skip_prob, 1);
- rdc_skip.dist = rd_stats.sse;
- rdc_skip.rdcost = RDCOST(x->rdmult, x->rddiv, rdc_skip.rate, rdc_skip.dist);
- if (rdc_skip.rdcost < best_rd) {
- best_rd = rdc_skip.rdcost;
- best_mbmi = *mbmi;
- best_skip = x->skip;
- best_rdcost = rdc_skip;
+ const aom_prob skip_prob = av1_get_skip_prob(cm, xd);
+
+ RD_STATS rdc_noskip;
+ av1_init_rd_stats(&rdc_noskip);
+ rdc_noskip.rate =
+ rate_mode + rate_mv + rd_stats.rate + av1_cost_bit(skip_prob, 0);
+ rdc_noskip.dist = rd_stats.dist;
+ rdc_noskip.rdcost =
+ RDCOST(x->rdmult, x->rddiv, rdc_noskip.rate, rdc_noskip.dist);
+ if (rdc_noskip.rdcost < best_rd) {
+ best_rd = rdc_noskip.rdcost;
+ best_mbmi = *mbmi;
+ best_skip = x->skip;
+ best_rdcost = rdc_noskip;
+ }
+
+ x->skip = 1;
+ mbmi->skip = 1;
+ RD_STATS rdc_skip;
+ av1_init_rd_stats(&rdc_skip);
+ rdc_skip.rate = rate_mode + rate_mv + av1_cost_bit(skip_prob, 1);
+ rdc_skip.dist = rd_stats.sse;
+ rdc_skip.rdcost = RDCOST(x->rdmult, x->rddiv, rdc_skip.rate, rdc_skip.dist);
+ if (rdc_skip.rdcost < best_rd) {
+ best_rd = rdc_skip.rdcost;
+ best_mbmi = *mbmi;
+ best_skip = x->skip;
+ best_rdcost = rdc_skip;
+ }
}
*mbmi = best_mbmi;
*rd_cost = best_rdcost;
@@ -9200,6 +8314,7 @@ void av1_rd_pick_intra_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x,
xd->mi[0]->mbmi.ref_frame[1] = NONE_FRAME;
#if CONFIG_INTRABC
xd->mi[0]->mbmi.use_intrabc = 0;
+ xd->mi[0]->mbmi.mv[0].as_int = 0;
#endif // CONFIG_INTRABC
const int64_t intra_yrd =
@@ -9212,11 +8327,8 @@ void av1_rd_pick_intra_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x,
if (intra_yrd < best_rd) {
max_uv_tx_size = uv_txsize_lookup[bsize][xd->mi[0]->mbmi.tx_size]
[pd[1].subsampling_x][pd[1].subsampling_y];
-
+ init_sbuv_mode(&xd->mi[0]->mbmi);
#if CONFIG_CB4X4
-#if !CONFIG_CHROMA_2X2
- max_uv_tx_size = AOMMAX(max_uv_tx_size, TX_4X4);
-#endif // !CONFIG_CHROMA_2X2
if (!x->skip_chroma_rd)
rd_pick_intra_sbuv_mode(cpi, x, &rate_uv, &rate_uv_tokenonly, &dist_uv,
&uv_skip, bsize, max_uv_tx_size);
@@ -9235,6 +8347,9 @@ void av1_rd_pick_intra_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x,
rd_cost->dist = dist_y + dist_uv;
}
rd_cost->rdcost = RDCOST(x->rdmult, x->rddiv, rd_cost->rate, rd_cost->dist);
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ rd_cost->dist_y = dist_y;
+#endif
} else {
rd_cost->rate = INT_MAX;
}
@@ -9602,10 +8717,8 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
int64_t best_pred_diff[REFERENCE_MODES];
int64_t best_pred_rd[REFERENCE_MODES];
MB_MODE_INFO best_mbmode;
-#if CONFIG_REF_MV
int rate_skip0 = av1_cost_bit(av1_get_skip_prob(cm, xd), 0);
int rate_skip1 = av1_cost_bit(av1_get_skip_prob(cm, xd), 1);
-#endif // CONFIG_REF_MV
int best_mode_skippable = 0;
int midx, best_mode_index = -1;
unsigned int ref_costs_single[TOTAL_REFS_PER_FRAME];
@@ -9635,13 +8748,11 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
const int *const intra_mode_cost = cpi->mbmode_cost[size_group_lookup[bsize]];
int best_skip2 = 0;
uint8_t ref_frame_skip_mask[2] = { 0 };
-#if CONFIG_EXT_INTER
uint32_t mode_skip_mask[TOTAL_REFS_PER_FRAME] = { 0 };
+#if CONFIG_EXT_INTER && CONFIG_INTERINTRA
MV_REFERENCE_FRAME best_single_inter_ref = LAST_FRAME;
int64_t best_single_inter_rd = INT64_MAX;
-#else
- uint16_t mode_skip_mask[TOTAL_REFS_PER_FRAME] = { 0 };
-#endif // CONFIG_EXT_INTER
+#endif // CONFIG_EXT_INTER && CONFIG_INTERINTRA
int mode_skip_start = sf->mode_skip_start + 1;
const int *const rd_threshes = rd_opt->threshes[segment_id][bsize];
const int *const rd_thresh_freq_fact = tile_data->thresh_freq_fact[bsize];
@@ -9663,8 +8774,6 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
NULL,
NULL,
NULL,
- NULL,
- NULL,
#else // CONFIG_EXT_INTER
NULL,
#endif // CONFIG_EXT_INTER
@@ -9681,15 +8790,6 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
const MODE_INFO *left_mi = xd->left_mi;
#endif // CONFIG_PALETTE
#if CONFIG_MOTION_VAR
-#if CONFIG_HIGHBITDEPTH
- DECLARE_ALIGNED(16, uint8_t, tmp_buf1[2 * MAX_MB_PLANE * MAX_SB_SQUARE]);
- DECLARE_ALIGNED(16, uint8_t, tmp_buf2[2 * MAX_MB_PLANE * MAX_SB_SQUARE]);
-#else
- DECLARE_ALIGNED(16, uint8_t, tmp_buf1[MAX_MB_PLANE * MAX_SB_SQUARE]);
- DECLARE_ALIGNED(16, uint8_t, tmp_buf2[MAX_MB_PLANE * MAX_SB_SQUARE]);
-#endif // CONFIG_HIGHBITDEPTH
- DECLARE_ALIGNED(16, int32_t, weighted_src_buf[MAX_SB_SQUARE]);
- DECLARE_ALIGNED(16, int32_t, mask2d_buf[MAX_SB_SQUARE]);
int dst_width1[MAX_MB_PLANE] = { MAX_SB_SIZE, MAX_SB_SIZE, MAX_SB_SIZE };
int dst_width2[MAX_MB_PLANE] = { MAX_SB_SIZE, MAX_SB_SIZE, MAX_SB_SIZE };
int dst_height1[MAX_MB_PLANE] = { MAX_SB_SIZE, MAX_SB_SIZE, MAX_SB_SIZE };
@@ -9698,22 +8798,24 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
#if CONFIG_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
int len = sizeof(uint16_t);
- args.above_pred_buf[0] = CONVERT_TO_BYTEPTR(tmp_buf1);
- args.above_pred_buf[1] = CONVERT_TO_BYTEPTR(tmp_buf1 + MAX_SB_SQUARE * len);
+ args.above_pred_buf[0] = CONVERT_TO_BYTEPTR(x->above_pred_buf);
+ args.above_pred_buf[1] =
+ CONVERT_TO_BYTEPTR(x->above_pred_buf + MAX_SB_SQUARE * len);
args.above_pred_buf[2] =
- CONVERT_TO_BYTEPTR(tmp_buf1 + 2 * MAX_SB_SQUARE * len);
- args.left_pred_buf[0] = CONVERT_TO_BYTEPTR(tmp_buf2);
- args.left_pred_buf[1] = CONVERT_TO_BYTEPTR(tmp_buf2 + MAX_SB_SQUARE * len);
+ CONVERT_TO_BYTEPTR(x->above_pred_buf + 2 * MAX_SB_SQUARE * len);
+ args.left_pred_buf[0] = CONVERT_TO_BYTEPTR(x->left_pred_buf);
+ args.left_pred_buf[1] =
+ CONVERT_TO_BYTEPTR(x->left_pred_buf + MAX_SB_SQUARE * len);
args.left_pred_buf[2] =
- CONVERT_TO_BYTEPTR(tmp_buf2 + 2 * MAX_SB_SQUARE * len);
+ CONVERT_TO_BYTEPTR(x->left_pred_buf + 2 * MAX_SB_SQUARE * len);
} else {
#endif // CONFIG_HIGHBITDEPTH
- args.above_pred_buf[0] = tmp_buf1;
- args.above_pred_buf[1] = tmp_buf1 + MAX_SB_SQUARE;
- args.above_pred_buf[2] = tmp_buf1 + 2 * MAX_SB_SQUARE;
- args.left_pred_buf[0] = tmp_buf2;
- args.left_pred_buf[1] = tmp_buf2 + MAX_SB_SQUARE;
- args.left_pred_buf[2] = tmp_buf2 + 2 * MAX_SB_SQUARE;
+ args.above_pred_buf[0] = x->above_pred_buf;
+ args.above_pred_buf[1] = x->above_pred_buf + MAX_SB_SQUARE;
+ args.above_pred_buf[2] = x->above_pred_buf + 2 * MAX_SB_SQUARE;
+ args.left_pred_buf[0] = x->left_pred_buf;
+ args.left_pred_buf[1] = x->left_pred_buf + MAX_SB_SQUARE;
+ args.left_pred_buf[2] = x->left_pred_buf + 2 * MAX_SB_SQUARE;
#if CONFIG_HIGHBITDEPTH
}
#endif // CONFIG_HIGHBITDEPTH
@@ -9731,11 +8833,6 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
}
#endif // CONFIG_PALETTE
-#if CONFIG_EXT_INTRA
- memset(directional_mode_skip_mask, 0,
- sizeof(directional_mode_skip_mask[0]) * INTRA_MODES);
-#endif // CONFIG_EXT_INTRA
-
estimate_ref_frame_costs(cm, xd, segment_id, ref_costs_single, ref_costs_comp,
&comp_mode_p);
@@ -9756,9 +8853,9 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
x->pred_mv_sad[ref_frame] = INT_MAX;
x->mbmi_ext->mode_context[ref_frame] = 0;
-#if CONFIG_REF_MV && CONFIG_EXT_INTER
+#if CONFIG_EXT_INTER
x->mbmi_ext->compound_mode_context[ref_frame] = 0;
-#endif // CONFIG_REF_MV && CONFIG_EXT_INTER
+#endif // CONFIG_EXT_INTER
if (cpi->ref_frame_flags & flag_list[ref_frame]) {
assert(get_ref_frame_buffer(cpi, ref_frame) != NULL);
setup_buffer_inter(cpi, x, ref_frame, bsize, mi_row, mi_col,
@@ -9788,7 +8885,6 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
#endif // CONFIG_EXT_INTER
}
-#if CONFIG_REF_MV
for (; ref_frame < MODE_CTX_REF_FRAMES; ++ref_frame) {
MODE_INFO *const mi = xd->mi[0];
int_mv *const candidates = x->mbmi_ext->ref_mvs[ref_frame];
@@ -9813,10 +8909,10 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
mbmi_ext->mode_context[ref_frame] &= ~(1 << ALL_ZERO_FLAG_OFFSET);
}
}
-#endif // CONFIG_REF_MV
#if CONFIG_MOTION_VAR
av1_count_overlappable_neighbors(cm, xd, mi_row, mi_col);
+
if (check_num_overlappable_neighbors(mbmi) &&
is_motion_variation_allowed_bsize(bsize)) {
av1_build_prediction_by_above_preds(cm, xd, mi_row, mi_col,
@@ -9827,8 +8923,6 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
dst_height2, args.left_pred_stride);
av1_setup_dst_planes(xd->plane, bsize, get_frame_new_buffer(cm), mi_row,
mi_col);
- x->mask_buf = mask2d_buf;
- x->wsrc_buf = weighted_src_buf;
calc_target_weighted_pred(cm, x, xd, mi_row, mi_col, args.above_pred_buf[0],
args.above_pred_stride[0], args.left_pred_buf[0],
args.left_pred_stride[0]);
@@ -9904,10 +8998,6 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
#if CONFIG_EXT_INTER
if (frame_mv[NEAREST_NEARESTMV][ALTREF_FRAME].as_int != zeromv.as_int)
mode_skip_mask[ALTREF_FRAME] |= (1 << NEAREST_NEARESTMV);
- if (frame_mv[NEAREST_NEARMV][ALTREF_FRAME].as_int != zeromv.as_int)
- mode_skip_mask[ALTREF_FRAME] |= (1 << NEAREST_NEARMV);
- if (frame_mv[NEAR_NEARESTMV][ALTREF_FRAME].as_int != zeromv.as_int)
- mode_skip_mask[ALTREF_FRAME] |= (1 << NEAR_NEARESTMV);
if (frame_mv[NEAR_NEARMV][ALTREF_FRAME].as_int != zeromv.as_int)
mode_skip_mask[ALTREF_FRAME] |= (1 << NEAR_NEARMV);
#endif // CONFIG_EXT_INTER
@@ -9931,7 +9021,7 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
if (sf->adaptive_mode_search) {
if (cm->show_frame && !cpi->rc.is_src_frame_alt_ref &&
cpi->rc.frames_since_golden >= 3)
- if (x->pred_mv_sad[GOLDEN_FRAME] > (x->pred_mv_sad[LAST_FRAME] << 1))
+ if ((x->pred_mv_sad[GOLDEN_FRAME] >> 1) > x->pred_mv_sad[LAST_FRAME])
mode_skip_mask[GOLDEN_FRAME] |= INTER_ALL;
}
@@ -9985,18 +9075,16 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
int64_t this_rd = INT64_MAX;
int disable_skip = 0;
int compmode_cost = 0;
-#if CONFIG_EXT_INTER
- int compmode_interintra_cost = 0;
- int compmode_interinter_cost = 0;
-#endif // CONFIG_EXT_INTER
int rate2 = 0, rate_y = 0, rate_uv = 0;
int64_t distortion2 = 0, distortion_y = 0, distortion_uv = 0;
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ int64_t distortion2_y = 0;
+ int64_t total_sse_y = INT64_MAX;
+#endif
int skippable = 0;
int this_skip2 = 0;
int64_t total_sse = INT64_MAX;
-#if CONFIG_REF_MV
uint8_t ref_frame_type;
-#endif // CONFIG_REF_MV
#if CONFIG_PVQ
od_encode_rollback(&x->daala_enc, &pre_buf);
#endif // CONFIG_PVQ
@@ -10004,9 +9092,7 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
this_mode = av1_mode_order[mode_index].mode;
ref_frame = av1_mode_order[mode_index].ref_frame[0];
second_ref_frame = av1_mode_order[mode_index].ref_frame[1];
-#if CONFIG_REF_MV
mbmi->ref_mv_idx = 0;
-#endif // CONFIG_REF_MV
#if CONFIG_EXT_INTER
if (ref_frame > INTRA_FRAME && second_ref_frame == INTRA_FRAME) {
@@ -10079,7 +9165,7 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
// This is only used in motion vector unit test.
if (cpi->oxcf.motion_vector_unit_test && ref_frame == INTRA_FRAME) continue;
-#if CONFIG_LOWDELAY_COMPOUND // Changes LL bitstream
+#if CONFIG_ONE_SIDED_COMPOUND // Changes LL bitstream
#if CONFIG_EXT_REFS
if (cpi->oxcf.pass == 0) {
// Complexity-compression trade-offs
@@ -10144,9 +9230,9 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
#endif // CONFIG_GLOBAL_MOTION
const MV_REFERENCE_FRAME ref_frames[2] = { ref_frame, second_ref_frame };
if (!check_best_zero_mv(cpi, mbmi_ext->mode_context,
-#if CONFIG_REF_MV && CONFIG_EXT_INTER
+#if CONFIG_EXT_INTER
mbmi_ext->compound_mode_context,
-#endif // CONFIG_REF_MV && CONFIG_EXT_INTER
+#endif // CONFIG_EXT_INTER
frame_mv, this_mode, ref_frames, bsize, -1,
mi_row, mi_col))
continue;
@@ -10181,9 +9267,9 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
if (comp_pred) xd->plane[i].pre[1] = yv12_mb[second_ref_frame][i];
}
-#if CONFIG_EXT_INTER
+#if CONFIG_EXT_INTER && CONFIG_INTERINTRA
mbmi->interintra_mode = (INTERINTRA_MODE)(II_DC_PRED - 1);
-#endif // CONFIG_EXT_INTER
+#endif // CONFIG_EXT_INTER && CONFIG_INTERINTRA
if (ref_frame == INTRA_FRAME) {
RD_STATS rd_stats_y;
@@ -10199,11 +9285,11 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
const uint8_t *src = x->plane[0].src.buf;
#if CONFIG_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
- highbd_angle_estimation(src, src_stride, rows, cols,
+ highbd_angle_estimation(src, src_stride, rows, cols, bsize,
directional_mode_skip_mask);
else
#endif // CONFIG_HIGHBITDEPTH
- angle_estimation(src, src_stride, rows, cols,
+ angle_estimation(src, src_stride, rows, cols, bsize,
directional_mode_skip_mask);
angle_stats_ready = 1;
}
@@ -10336,18 +9422,19 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
if (mbmi->mode != DC_PRED && mbmi->mode != TM_PRED)
rate2 += intra_cost_penalty;
distortion2 = distortion_y + distortion_uv;
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ if (bsize < BLOCK_8X8) distortion2_y = distortion_y;
+#endif
} else {
-#if CONFIG_REF_MV
int_mv backup_ref_mv[2];
#if !SUB8X8_COMP_REF
- if (bsize < BLOCK_8X8 && mbmi->ref_frame[1] > INTRA_FRAME) continue;
+ if (bsize == BLOCK_4X4 && mbmi->ref_frame[1] > INTRA_FRAME) continue;
#endif // !SUB8X8_COMP_REF
backup_ref_mv[0] = mbmi_ext->ref_mvs[ref_frame][0];
if (comp_pred) backup_ref_mv[1] = mbmi_ext->ref_mvs[second_ref_frame][0];
-#endif // CONFIG_REF_MV
-#if CONFIG_EXT_INTER
+#if CONFIG_EXT_INTER && CONFIG_INTERINTRA
if (second_ref_frame == INTRA_FRAME) {
if (best_single_inter_ref != ref_frame) continue;
mbmi->interintra_mode = intra_to_interintra_mode[best_intra_mode];
@@ -10365,8 +9452,7 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
mbmi->filter_intra_mode_info.use_filter_intra_mode[1] = 0;
#endif // CONFIG_FILTER_INTRA
}
-#endif // CONFIG_EXT_INTER
-#if CONFIG_REF_MV
+#endif // CONFIG_EXT_INTER && CONFIG_INTERINTRA
mbmi->ref_mv_idx = 0;
ref_frame_type = av1_ref_frame_type(mbmi->ref_frame);
@@ -10411,7 +9497,6 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
#if CONFIG_EXT_INTER
}
#endif // CONFIG_EXT_INTER
-#endif // CONFIG_REF_MV
{
RD_STATS rd_stats, rd_stats_y, rd_stats_uv;
av1_init_rd_stats(&rd_stats);
@@ -10421,18 +9506,11 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
args.single_newmv = single_newmv;
#if CONFIG_EXT_INTER
args.single_newmv_rate = single_newmv_rate;
- args.compmode_interintra_cost = &compmode_interintra_cost;
- args.compmode_interinter_cost = &compmode_interinter_cost;
args.modelled_rd = modelled_rd;
#endif // CONFIG_EXT_INTER
this_rd = handle_inter_mode(cpi, x, bsize, &rd_stats, &rd_stats_y,
&rd_stats_uv, &disable_skip, frame_mv,
mi_row, mi_col, &args, best_rd);
-// Prevent pointers from escaping local scope
-#if CONFIG_EXT_INTER
- args.compmode_interintra_cost = NULL;
- args.compmode_interinter_cost = NULL;
-#endif // CONFIG_EXT_INTER
rate2 = rd_stats.rate;
skippable = rd_stats.skip;
@@ -10440,9 +9518,11 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
total_sse = rd_stats.sse;
rate_y = rd_stats_y.rate;
rate_uv = rd_stats_uv.rate;
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ if (bsize < BLOCK_8X8) distortion2_y = rd_stats_y.dist;
+#endif
}
-#if CONFIG_REF_MV
// TODO(jingning): This needs some refactoring to improve code quality
// and reduce redundant steps.
#if CONFIG_EXT_INTER
@@ -10505,10 +9585,6 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
int ref;
int_mv cur_mv;
RD_STATS tmp_rd_stats, tmp_rd_stats_y, tmp_rd_stats_uv;
-#if CONFIG_EXT_INTER
- int tmp_compmode_interintra_cost = 0;
- int tmp_compmode_interinter_cost = 0;
-#endif // CONFIG_EXT_INTER
av1_invalid_rd_stats(&tmp_rd_stats);
x->skip = 0;
@@ -10586,8 +9662,6 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
args.single_newmv = dummy_single_newmv;
#if CONFIG_EXT_INTER
args.single_newmv_rate = dummy_single_newmv_rate;
- args.compmode_interintra_cost = &tmp_compmode_interintra_cost;
- args.compmode_interinter_cost = &tmp_compmode_interinter_cost;
args.modelled_rd = NULL;
#endif // CONFIG_EXT_INTER
tmp_alt_rd = handle_inter_mode(
@@ -10597,8 +9671,6 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
args.single_newmv = NULL;
#if CONFIG_EXT_INTER
args.single_newmv_rate = NULL;
- args.compmode_interintra_cost = NULL;
- args.compmode_interinter_cost = NULL;
#endif // CONFIG_EXT_INTER
}
@@ -10658,15 +9730,17 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
tmp_ref_rd = tmp_alt_rd;
backup_mbmi = *mbmi;
backup_skip = x->skip;
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ if (bsize < BLOCK_8X8) {
+ total_sse_y = tmp_rd_stats_y.sse;
+ distortion2_y = tmp_rd_stats_y.dist;
+ }
+#endif
#if CONFIG_VAR_TX
for (i = 0; i < MAX_MB_PLANE; ++i)
memcpy(x->blk_skip_drl[i], x->blk_skip[i],
sizeof(uint8_t) * ctx->num_4x4_blk);
#endif // CONFIG_VAR_TX
-#if CONFIG_EXT_INTER
- compmode_interintra_cost = tmp_compmode_interintra_cost;
- compmode_interinter_cost = tmp_compmode_interinter_cost;
-#endif // CONFIG_EXT_INTER
} else {
*mbmi = backup_mbmi;
x->skip = backup_skip;
@@ -10684,29 +9758,19 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
}
mbmi_ext->ref_mvs[ref_frame][0] = backup_ref_mv[0];
if (comp_pred) mbmi_ext->ref_mvs[second_ref_frame][0] = backup_ref_mv[1];
-#endif // CONFIG_REF_MV
if (this_rd == INT64_MAX) continue;
#if SUB8X8_COMP_REF
compmode_cost = av1_cost_bit(comp_mode_p, comp_pred);
#else
- if (mbmi->sb_type >= BLOCK_8X8)
+ if (mbmi->sb_type != BLOCK_4X4)
compmode_cost = av1_cost_bit(comp_mode_p, comp_pred);
#endif // SUB8X8_COMP_REF
if (cm->reference_mode == REFERENCE_MODE_SELECT) rate2 += compmode_cost;
}
-#if CONFIG_EXT_INTER
- rate2 += compmode_interintra_cost;
- if (cm->reference_mode != SINGLE_REFERENCE && comp_pred)
-#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
- if (mbmi->motion_mode == SIMPLE_TRANSLATION)
-#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
- rate2 += compmode_interinter_cost;
-#endif // CONFIG_EXT_INTER
-
// Estimate the reference frame signaling cost and add it
// to the rolling cost variable.
if (comp_pred) {
@@ -10731,14 +9795,9 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
// Cost the skip mb case
rate2 += av1_cost_bit(av1_get_skip_prob(cm, xd), 1);
} else if (ref_frame != INTRA_FRAME && !xd->lossless[mbmi->segment_id]) {
-#if CONFIG_REF_MV
if (RDCOST(x->rdmult, x->rddiv, rate_y + rate_uv + rate_skip0,
distortion2) <
RDCOST(x->rdmult, x->rddiv, rate_skip1, total_sse)) {
-#else
- if (RDCOST(x->rdmult, x->rddiv, rate_y + rate_uv, distortion2) <
- RDCOST(x->rdmult, x->rddiv, 0, total_sse)) {
-#endif // CONFIG_REF_MV
// Add in the cost of the no skip flag.
rate2 += av1_cost_bit(av1_get_skip_prob(cm, xd), 0);
} else {
@@ -10750,6 +9809,9 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
this_skip2 = 1;
rate_y = 0;
rate_uv = 0;
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ if (bsize < BLOCK_8X8) distortion2_y = total_sse_y;
+#endif
}
} else {
// Add in the cost of the no skip flag.
@@ -10775,13 +9837,13 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
best_intra_rd = this_rd;
best_intra_mode = mbmi->mode;
}
-#if CONFIG_EXT_INTER
+#if CONFIG_EXT_INTER && CONFIG_INTERINTRA
} else if (second_ref_frame == NONE_FRAME) {
if (this_rd < best_single_inter_rd) {
best_single_inter_rd = this_rd;
best_single_inter_ref = mbmi->ref_frame[0];
}
-#endif // CONFIG_EXT_INTER
+#endif // CONFIG_EXT_INTER && CONFIG_INTERINTRA
}
if (!disable_skip && ref_frame == INTRA_FRAME) {
@@ -10839,7 +9901,9 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
best_rate_y = rate_y + av1_cost_bit(av1_get_skip_prob(cm, xd),
this_skip2 || skippable);
best_rate_uv = rate_uv;
-
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ if (bsize < BLOCK_8X8) rd_cost->dist_y = distortion2_y;
+#endif
#if CONFIG_VAR_TX
for (i = 0; i < MAX_MB_PLANE; ++i)
memcpy(ctx->blk_skip[i], x->blk_skip[i],
@@ -10900,7 +9964,7 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
}
if (is_inter_mode(mbmi->mode)) {
- av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL, bsize);
+ av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, bsize);
#if CONFIG_MOTION_VAR
if (mbmi->motion_mode == OBMC_CAUSAL) {
av1_build_obmc_inter_prediction(
@@ -10967,6 +10031,9 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
rd_cost->rate +=
(rd_stats_y.rate + rd_stats_uv.rate - best_rate_y - best_rate_uv);
rd_cost->dist = rd_stats_y.dist + rd_stats_uv.dist;
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ if (bsize < BLOCK_8X8) rd_cost->dist_y = rd_stats_y.dist;
+#endif
rd_cost->rdcost =
RDCOST(x->rdmult, x->rddiv, rd_cost->rate, rd_cost->dist);
best_skip2 = skip_blk;
@@ -11111,9 +10178,7 @@ PALETTE_EXIT:
best_mbmode.ref_frame[1] };
int comp_pred_mode = refs[1] > INTRA_FRAME;
int_mv zeromv[2];
-#if CONFIG_REF_MV
const uint8_t rf_type = av1_ref_frame_type(best_mbmode.ref_frame);
-#endif // CONFIG_REF_MV
#if CONFIG_GLOBAL_MOTION
zeromv[0].as_int = gm_get_motion_vector(&cm->global_motion[refs[0]],
cm->allow_high_precision_mv, bsize,
@@ -11129,7 +10194,6 @@ PALETTE_EXIT:
zeromv[0].as_int = 0;
zeromv[1].as_int = 0;
#endif // CONFIG_GLOBAL_MOTION
-#if CONFIG_REF_MV
if (!comp_pred_mode) {
int ref_set = (mbmi_ext->ref_mv_count[rf_type] >= 2)
? AOMMIN(2, mbmi_ext->ref_mv_count[rf_type] - 2)
@@ -11196,17 +10260,9 @@ PALETTE_EXIT:
nearmv[0] = mbmi_ext->ref_mv_stack[rf_type][i + 1].this_mv;
nearmv[1] = mbmi_ext->ref_mv_stack[rf_type][i + 1].comp_mv;
- // Try switching to the NEAR_NEAREST type modes first
- if (nearestmv[0].as_int == best_mbmode.mv[0].as_int &&
+ // Try switching to the NEAR_NEARMV mode
+ if (nearmv[0].as_int == best_mbmode.mv[0].as_int &&
nearmv[1].as_int == best_mbmode.mv[1].as_int) {
- best_mbmode.mode = NEAREST_NEARMV;
- best_mbmode.ref_mv_idx = i;
- } else if (nearmv[0].as_int == best_mbmode.mv[0].as_int &&
- nearestmv[1].as_int == best_mbmode.mv[1].as_int) {
- best_mbmode.mode = NEAR_NEARESTMV;
- best_mbmode.ref_mv_idx = i;
- } else if (nearmv[0].as_int == best_mbmode.mv[0].as_int &&
- nearmv[1].as_int == best_mbmode.mv[1].as_int) {
best_mbmode.mode = NEAR_NEARMV;
best_mbmode.ref_mv_idx = i;
}
@@ -11225,72 +10281,8 @@ PALETTE_EXIT:
}
#endif // CONFIG_EXT_INTER
}
-#else
-#if CONFIG_EXT_INTER
- if (!comp_pred_mode) {
-#endif // CONFIG_EXT_INTER
- if (frame_mv[NEARESTMV][refs[0]].as_int == best_mbmode.mv[0].as_int &&
- ((comp_pred_mode &&
- frame_mv[NEARESTMV][refs[1]].as_int == best_mbmode.mv[1].as_int) ||
- !comp_pred_mode))
- best_mbmode.mode = NEARESTMV;
- else if (frame_mv[NEARMV][refs[0]].as_int == best_mbmode.mv[0].as_int &&
- ((comp_pred_mode &&
- frame_mv[NEARMV][refs[1]].as_int ==
- best_mbmode.mv[1].as_int) ||
- !comp_pred_mode))
- best_mbmode.mode = NEARMV;
- else if (best_mbmode.mv[0].as_int == zeromv[0].as_int &&
- ((comp_pred_mode &&
- best_mbmode.mv[1].as_int == zeromv[1].as_int) ||
- !comp_pred_mode))
- best_mbmode.mode = ZEROMV;
-#if CONFIG_EXT_INTER
- } else {
-#if CONFIG_GLOBAL_MOTION
- zeromv[0].as_int = gm_get_motion_vector(&cm->global_motion[refs[0]],
- cm->allow_high_precision_mv,
- bsize, mi_col, mi_row, 0)
- .as_int;
- zeromv[1].as_int = comp_pred_mode
- ? gm_get_motion_vector(&cm->global_motion[refs[1]],
- cm->allow_high_precision_mv,
- bsize, mi_col, mi_row, 0)
- .as_int
- : 0;
-#else
- zeromv[0].as_int = 0;
- zeromv[1].as_int = 0;
-#endif // CONFIG_GLOBAL_MOTION
- if (frame_mv[NEAREST_NEARESTMV][refs[0]].as_int ==
- best_mbmode.mv[0].as_int &&
- frame_mv[NEAREST_NEARESTMV][refs[1]].as_int ==
- best_mbmode.mv[1].as_int)
- best_mbmode.mode = NEAREST_NEARESTMV;
- else if (frame_mv[NEAREST_NEARMV][refs[0]].as_int ==
- best_mbmode.mv[0].as_int &&
- frame_mv[NEAREST_NEARMV][refs[1]].as_int ==
- best_mbmode.mv[1].as_int)
- best_mbmode.mode = NEAREST_NEARMV;
- else if (frame_mv[NEAR_NEARESTMV][refs[0]].as_int ==
- best_mbmode.mv[0].as_int &&
- frame_mv[NEAR_NEARESTMV][refs[1]].as_int ==
- best_mbmode.mv[1].as_int)
- best_mbmode.mode = NEAR_NEARESTMV;
- else if (frame_mv[NEAR_NEARMV][refs[0]].as_int ==
- best_mbmode.mv[0].as_int &&
- frame_mv[NEAR_NEARMV][refs[1]].as_int ==
- best_mbmode.mv[1].as_int)
- best_mbmode.mode = NEAR_NEARMV;
- else if (best_mbmode.mv[0].as_int == zeromv[0].as_int &&
- best_mbmode.mv[1].as_int == zeromv[1].as_int)
- best_mbmode.mode = ZERO_ZEROMV;
- }
-#endif // CONFIG_EXT_INTER
-#endif // CONFIG_REF_MV
}
-#if CONFIG_REF_MV
// Make sure that the ref_mv_idx is only nonzero when we're
// using a mode which can support ref_mv_idx
if (best_mbmode.ref_mv_idx != 0 &&
@@ -11339,7 +10331,6 @@ PALETTE_EXIT:
}
}
}
-#endif // CONFIG_REF_MV
if (best_mode_index < 0 || best_rd >= best_rd_so_far) {
rd_cost->rate = INT_MAX;
@@ -11412,14 +10403,12 @@ PALETTE_EXIT:
}
#endif // CONFIG_GLOBAL_MOTION
-#if CONFIG_REF_MV
for (i = 0; i < 1 + has_second_ref(mbmi); ++i) {
if (mbmi->mode != NEWMV)
mbmi->pred_mv[i].as_int = mbmi->mv[i].as_int;
else
mbmi->pred_mv[i].as_int = mbmi_ext->ref_mvs[mbmi->ref_frame[i]][0].as_int;
}
-#endif // CONFIG_REF_MV
for (i = 0; i < REFERENCE_MODES; ++i) {
if (best_pred_rd[i] == INT64_MAX)
@@ -11502,10 +10491,8 @@ void av1_rd_pick_inter_mode_sb_seg_skip(const AV1_COMP *cpi,
mbmi->tx_size = max_txsize_lookup[bsize];
x->skip = 1;
-#if CONFIG_REF_MV
mbmi->ref_mv_idx = 0;
mbmi->pred_mv[0].as_int = 0;
-#endif // CONFIG_REF_MV
mbmi->motion_mode = SIMPLE_TRANSLATION;
#if CONFIG_MOTION_VAR
@@ -11566,7 +10553,9 @@ void av1_rd_pick_inter_mode_sb_seg_skip(const AV1_COMP *cpi,
rd_cost->rate = rate2;
rd_cost->dist = distortion2;
rd_cost->rdcost = this_rd;
-
+#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ if (bsize < BLOCK_8X8) rd_cost->dist_y = distortion2;
+#endif
if (this_rd >= best_rd_so_far) {
rd_cost->rate = INT_MAX;
rd_cost->rdcost = INT64_MAX;
@@ -11589,791 +10578,6 @@ void av1_rd_pick_inter_mode_sb_seg_skip(const AV1_COMP *cpi,
store_coding_context(x, ctx, THR_ZEROMV, best_pred_diff, 0);
}
-void av1_rd_pick_inter_mode_sub8x8(const struct AV1_COMP *cpi,
- TileDataEnc *tile_data, struct macroblock *x,
- int mi_row, int mi_col,
- struct RD_STATS *rd_cost,
-#if CONFIG_SUPERTX
- int *returnrate_nocoef,
-#endif // CONFIG_SUPERTX
- BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx,
- int64_t best_rd_so_far) {
- const AV1_COMMON *const cm = &cpi->common;
- const RD_OPT *const rd_opt = &cpi->rd;
- const SPEED_FEATURES *const sf = &cpi->sf;
- MACROBLOCKD *const xd = &x->e_mbd;
- MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
- const struct segmentation *const seg = &cm->seg;
- MV_REFERENCE_FRAME ref_frame, second_ref_frame;
- unsigned char segment_id = mbmi->segment_id;
- int comp_pred, i;
- int_mv frame_mv[MB_MODE_COUNT][TOTAL_REFS_PER_FRAME];
- struct buf_2d yv12_mb[TOTAL_REFS_PER_FRAME][MAX_MB_PLANE];
- static const int flag_list[TOTAL_REFS_PER_FRAME] = {
- 0,
- AOM_LAST_FLAG,
-#if CONFIG_EXT_REFS
- AOM_LAST2_FLAG,
- AOM_LAST3_FLAG,
-#endif // CONFIG_EXT_REFS
- AOM_GOLD_FLAG,
-#if CONFIG_EXT_REFS
- AOM_BWD_FLAG,
-#endif // CONFIG_EXT_REFS
- AOM_ALT_FLAG
- };
- int64_t best_rd = best_rd_so_far;
- int64_t best_yrd = best_rd_so_far; // FIXME(rbultje) more precise
- int64_t best_pred_diff[REFERENCE_MODES];
- int64_t best_pred_rd[REFERENCE_MODES];
- MB_MODE_INFO best_mbmode;
- int ref_index, best_ref_index = 0;
- unsigned int ref_costs_single[TOTAL_REFS_PER_FRAME];
- unsigned int ref_costs_comp[TOTAL_REFS_PER_FRAME];
- aom_prob comp_mode_p;
-#if CONFIG_DUAL_FILTER
- InterpFilter tmp_best_filter[4] = { 0 };
-#else
- InterpFilter tmp_best_filter = SWITCHABLE;
-#endif // CONFIG_DUAL_FILTER
- int rate_uv_intra, rate_uv_tokenonly = INT_MAX;
- int64_t dist_uv = INT64_MAX;
- int skip_uv;
- PREDICTION_MODE mode_uv = DC_PRED;
- const int intra_cost_penalty = av1_get_intra_cost_penalty(
- cm->base_qindex, cm->y_dc_delta_q, cm->bit_depth);
- int_mv seg_mvs[4][TOTAL_REFS_PER_FRAME];
- b_mode_info best_bmodes[4];
- int best_skip2 = 0;
- int ref_frame_skip_mask[2] = { 0 };
- int internal_active_edge =
- av1_active_edge_sb(cpi, mi_row, mi_col) && av1_internal_image_edge(cpi);
-#if CONFIG_PVQ
- od_rollback_buffer pre_buf;
-
- od_encode_checkpoint(&x->daala_enc, &pre_buf);
-#endif // CONFIG_PVQ
-
-#if CONFIG_SUPERTX
- best_rd_so_far = INT64_MAX;
- best_rd = best_rd_so_far;
- best_yrd = best_rd_so_far;
-#endif // CONFIG_SUPERTX
- av1_zero(best_mbmode);
-
-#if CONFIG_FILTER_INTRA
- mbmi->filter_intra_mode_info.use_filter_intra_mode[0] = 0;
- mbmi->filter_intra_mode_info.use_filter_intra_mode[1] = 0;
-#endif // CONFIG_FILTER_INTRA
- mbmi->motion_mode = SIMPLE_TRANSLATION;
-#if CONFIG_EXT_INTER
- mbmi->interinter_compound_type = COMPOUND_AVERAGE;
- mbmi->use_wedge_interintra = 0;
-#endif // CONFIG_EXT_INTER
-#if CONFIG_WARPED_MOTION
- mbmi->num_proj_ref[0] = 0;
- mbmi->num_proj_ref[1] = 0;
-#endif // CONFIG_WARPED_MOTION
-
- for (i = 0; i < 4; i++) {
- int j;
- for (j = 0; j < TOTAL_REFS_PER_FRAME; j++)
- seg_mvs[i][j].as_int = INVALID_MV;
- }
-
- estimate_ref_frame_costs(cm, xd, segment_id, ref_costs_single, ref_costs_comp,
- &comp_mode_p);
-
- for (i = 0; i < REFERENCE_MODES; ++i) best_pred_rd[i] = INT64_MAX;
- rate_uv_intra = INT_MAX;
-
- rd_cost->rate = INT_MAX;
-#if CONFIG_SUPERTX
- *returnrate_nocoef = INT_MAX;
-#endif // CONFIG_SUPERTX
-
- for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ref_frame++) {
- x->mbmi_ext->mode_context[ref_frame] = 0;
-#if CONFIG_REF_MV && CONFIG_EXT_INTER
- x->mbmi_ext->compound_mode_context[ref_frame] = 0;
-#endif // CONFIG_REF_MV && CONFIG_EXT_INTER
- if (cpi->ref_frame_flags & flag_list[ref_frame]) {
- setup_buffer_inter(cpi, x, ref_frame, bsize, mi_row, mi_col,
- frame_mv[NEARESTMV], frame_mv[NEARMV], yv12_mb);
- } else {
- ref_frame_skip_mask[0] |= (1 << ref_frame);
- ref_frame_skip_mask[1] |= SECOND_REF_FRAME_MASK;
- }
- frame_mv[NEWMV][ref_frame].as_int = INVALID_MV;
-#if CONFIG_EXT_INTER
-#endif // CONFIG_EXT_INTER
- frame_mv[ZEROMV][ref_frame].as_int = 0;
- }
-
-#if CONFIG_PALETTE
- mbmi->palette_mode_info.palette_size[0] = 0;
- mbmi->palette_mode_info.palette_size[1] = 0;
-#endif // CONFIG_PALETTE
-
- for (ref_index = 0; ref_index < MAX_REFS; ++ref_index) {
- int mode_excluded = 0;
- int64_t this_rd = INT64_MAX;
- int disable_skip = 0;
- int compmode_cost = 0;
- int rate2 = 0, rate_y = 0, rate_uv = 0;
- int64_t distortion2 = 0, distortion_y = 0, distortion_uv = 0;
- int skippable = 0;
- int this_skip2 = 0;
- int64_t total_sse = INT_MAX;
-
-#if CONFIG_PVQ
- od_encode_rollback(&x->daala_enc, &pre_buf);
-#endif // CONFIG_PVQ
-
- ref_frame = av1_ref_order[ref_index].ref_frame[0];
- second_ref_frame = av1_ref_order[ref_index].ref_frame[1];
-
-#if CONFIG_REF_MV
- mbmi->ref_mv_idx = 0;
-#endif // CONFIG_REF_MV
-
- // Look at the reference frame of the best mode so far and set the
- // skip mask to look at a subset of the remaining modes.
- if (ref_index > 2 && sf->mode_skip_start < MAX_MODES) {
- if (ref_index == 3) {
- switch (best_mbmode.ref_frame[0]) {
- case INTRA_FRAME: break;
- case LAST_FRAME:
- ref_frame_skip_mask[0] |= (1 << GOLDEN_FRAME) |
-#if CONFIG_EXT_REFS
- (1 << LAST2_FRAME) | (1 << LAST3_FRAME) |
- (1 << BWDREF_FRAME) |
-#endif // CONFIG_EXT_REFS
- (1 << ALTREF_FRAME);
- ref_frame_skip_mask[1] |= SECOND_REF_FRAME_MASK;
- break;
-#if CONFIG_EXT_REFS
- case LAST2_FRAME:
- ref_frame_skip_mask[0] |= (1 << LAST_FRAME) | (1 << LAST3_FRAME) |
- (1 << GOLDEN_FRAME) |
- (1 << BWDREF_FRAME) | (1 << ALTREF_FRAME);
- ref_frame_skip_mask[1] |= SECOND_REF_FRAME_MASK;
- break;
- case LAST3_FRAME:
- ref_frame_skip_mask[0] |= (1 << LAST_FRAME) | (1 << LAST2_FRAME) |
- (1 << GOLDEN_FRAME) |
- (1 << BWDREF_FRAME) | (1 << ALTREF_FRAME);
- ref_frame_skip_mask[1] |= SECOND_REF_FRAME_MASK;
- break;
-#endif // CONFIG_EXT_REFS
- case GOLDEN_FRAME:
- ref_frame_skip_mask[0] |= (1 << LAST_FRAME) |
-#if CONFIG_EXT_REFS
- (1 << LAST2_FRAME) | (1 << LAST3_FRAME) |
- (1 << BWDREF_FRAME) |
-#endif // CONFIG_EXT_REFS
- (1 << ALTREF_FRAME);
- ref_frame_skip_mask[1] |= SECOND_REF_FRAME_MASK;
- break;
-#if CONFIG_EXT_REFS
- case BWDREF_FRAME:
- ref_frame_skip_mask[0] |= (1 << LAST_FRAME) | (1 << LAST2_FRAME) |
- (1 << LAST3_FRAME) | (1 << GOLDEN_FRAME) |
- (1 << ALTREF_FRAME);
- ref_frame_skip_mask[1] |= (1 << ALTREF_FRAME) | 0x01;
- break;
-#endif // CONFIG_EXT_REFS
- case ALTREF_FRAME:
- ref_frame_skip_mask[0] |= (1 << LAST_FRAME) |
-#if CONFIG_EXT_REFS
- (1 << LAST2_FRAME) | (1 << LAST3_FRAME) |
- (1 << BWDREF_FRAME) |
-#endif // CONFIG_EXT_REFS
- (1 << GOLDEN_FRAME);
-#if CONFIG_EXT_REFS
- ref_frame_skip_mask[1] |= (1 << BWDREF_FRAME) | 0x01;
-#endif // CONFIG_EXT_REFS
- break;
- case NONE_FRAME:
- case TOTAL_REFS_PER_FRAME:
- assert(0 && "Invalid Reference frame");
- break;
- }
- }
- }
-
- if ((ref_frame_skip_mask[0] & (1 << ref_frame)) &&
- (ref_frame_skip_mask[1] & (1 << AOMMAX(0, second_ref_frame))))
- continue;
-
- // Test best rd so far against threshold for trying this mode.
- if (!internal_active_edge &&
- rd_less_than_thresh(best_rd,
- rd_opt->threshes[segment_id][bsize][ref_index],
- tile_data->thresh_freq_fact[bsize][ref_index]))
- continue;
-
- // This is only used in motion vector unit test.
- if (cpi->oxcf.motion_vector_unit_test && ref_frame == INTRA_FRAME) continue;
-
-#if CONFIG_LOWDELAY_COMPOUND // Changes LL bitstream
-#if CONFIG_EXT_REFS
- if (cpi->oxcf.pass == 0) {
- // Complexity-compression trade-offs
- // if (ref_frame == ALTREF_FRAME) continue;
- // if (ref_frame == BWDREF_FRAME) continue;
- if (second_ref_frame == ALTREF_FRAME) continue;
- // if (second_ref_frame == BWDREF_FRAME) continue;
- }
-#endif
-#endif
- comp_pred = second_ref_frame > INTRA_FRAME;
- if (comp_pred) {
- if (!cpi->allow_comp_inter_inter) continue;
- if (!(cpi->ref_frame_flags & flag_list[second_ref_frame])) continue;
- // Do not allow compound prediction if the segment level reference frame
- // feature is in use as in this case there can only be one reference.
- if (segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME)) continue;
-
- if ((sf->mode_search_skip_flags & FLAG_SKIP_COMP_BESTINTRA) &&
- best_mbmode.ref_frame[0] == INTRA_FRAME)
- continue;
- }
-
- // TODO(jingning, jkoleszar): scaling reference frame not supported for
- // sub8x8 blocks.
- if (ref_frame > INTRA_FRAME &&
- av1_is_scaled(&cm->frame_refs[ref_frame - 1].sf))
- continue;
-
- if (second_ref_frame > INTRA_FRAME &&
- av1_is_scaled(&cm->frame_refs[second_ref_frame - 1].sf))
- continue;
-
- if (comp_pred)
- mode_excluded = cm->reference_mode == SINGLE_REFERENCE;
- else if (ref_frame != INTRA_FRAME)
- mode_excluded = cm->reference_mode == COMPOUND_REFERENCE;
-
- // If the segment reference frame feature is enabled....
- // then do nothing if the current ref frame is not allowed..
- if (segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME) &&
- get_segdata(seg, segment_id, SEG_LVL_REF_FRAME) != (int)ref_frame) {
- continue;
- // Disable this drop out case if the ref frame
- // segment level feature is enabled for this segment. This is to
- // prevent the possibility that we end up unable to pick any mode.
- } else if (!segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME)) {
- // Only consider ZEROMV/ALTREF_FRAME for alt ref frame,
- // unless ARNR filtering is enabled in which case we want
- // an unfiltered alternative. We allow near/nearest as well
- // because they may result in zero-zero MVs but be cheaper.
- if (cpi->rc.is_src_frame_alt_ref && (cpi->oxcf.arnr_max_frames == 0))
- continue;
- }
-
- mbmi->tx_size = TX_4X4;
- mbmi->uv_mode = DC_PRED;
- mbmi->ref_frame[0] = ref_frame;
- mbmi->ref_frame[1] = second_ref_frame;
-// Evaluate all sub-pel filters irrespective of whether we can use
-// them for this frame.
-#if CONFIG_DUAL_FILTER
- for (i = 0; i < 4; ++i)
- mbmi->interp_filter[i] = cm->interp_filter == SWITCHABLE
- ? EIGHTTAP_REGULAR
- : cm->interp_filter;
-#else
- mbmi->interp_filter =
- cm->interp_filter == SWITCHABLE ? EIGHTTAP_REGULAR : cm->interp_filter;
-#endif // CONFIG_DUAL_FILTER
- x->skip = 0;
- set_ref_ptrs(cm, xd, ref_frame, second_ref_frame);
-
- // Select prediction reference frames.
- for (i = 0; i < MAX_MB_PLANE; i++) {
- xd->plane[i].pre[0] = yv12_mb[ref_frame][i];
- if (comp_pred) xd->plane[i].pre[1] = yv12_mb[second_ref_frame][i];
- }
-
-#if CONFIG_VAR_TX
- mbmi->inter_tx_size[0][0] = mbmi->tx_size;
- mbmi->min_tx_size = get_min_tx_size(mbmi->tx_size);
-#endif // CONFIG_VAR_TX
-
- if (ref_frame == INTRA_FRAME) {
- int rate;
- if (rd_pick_intra_sub_8x8_y_mode(cpi, x, &rate, &rate_y, &distortion_y,
- NULL, best_rd) >= best_rd)
- continue;
- rate2 += rate;
- rate2 += intra_cost_penalty;
- distortion2 += distortion_y;
-
- if (rate_uv_intra == INT_MAX) {
- choose_intra_uv_mode(cpi, x, ctx, bsize, TX_4X4, &rate_uv_intra,
- &rate_uv_tokenonly, &dist_uv, &skip_uv, &mode_uv);
- }
- rate2 += rate_uv_intra;
- rate_uv = rate_uv_tokenonly;
- distortion2 += dist_uv;
- distortion_uv = dist_uv;
- mbmi->uv_mode = mode_uv;
- } else {
- int rate;
- int64_t distortion;
- int64_t this_rd_thresh;
- int64_t tmp_rd, tmp_best_rd = INT64_MAX, tmp_best_rdu = INT64_MAX;
- int tmp_best_rate = INT_MAX, tmp_best_ratey = INT_MAX;
- int64_t tmp_best_distortion = INT_MAX, tmp_best_sse, uv_sse;
- int tmp_best_skippable = 0;
- int switchable_filter_index;
- int_mv *second_ref =
- comp_pred ? &x->mbmi_ext->ref_mvs[second_ref_frame][0] : NULL;
- b_mode_info tmp_best_bmodes[16]; // Should this be 4 ?
- MB_MODE_INFO tmp_best_mbmode;
-#if CONFIG_DUAL_FILTER
- BEST_SEG_INFO bsi[DUAL_FILTER_SET_SIZE];
-#else
- BEST_SEG_INFO bsi[SWITCHABLE_FILTERS];
-#endif // CONFIG_DUAL_FILTER
- int pred_exists = 0;
- int uv_skippable;
-#if CONFIG_EXT_INTER
- int_mv compound_seg_newmvs[4][2];
- for (i = 0; i < 4; i++) {
- compound_seg_newmvs[i][0].as_int = INVALID_MV;
- compound_seg_newmvs[i][1].as_int = INVALID_MV;
- }
-#endif // CONFIG_EXT_INTER
-
- this_rd_thresh = (ref_frame == LAST_FRAME)
- ? rd_opt->threshes[segment_id][bsize][THR_LAST]
- : rd_opt->threshes[segment_id][bsize][THR_ALTR];
-#if CONFIG_EXT_REFS
- this_rd_thresh = (ref_frame == LAST2_FRAME)
- ? rd_opt->threshes[segment_id][bsize][THR_LAST2]
- : this_rd_thresh;
- this_rd_thresh = (ref_frame == LAST3_FRAME)
- ? rd_opt->threshes[segment_id][bsize][THR_LAST3]
- : this_rd_thresh;
- this_rd_thresh = (ref_frame == BWDREF_FRAME)
- ? rd_opt->threshes[segment_id][bsize][THR_BWDR]
- : this_rd_thresh;
-#endif // CONFIG_EXT_REFS
- this_rd_thresh = (ref_frame == GOLDEN_FRAME)
- ? rd_opt->threshes[segment_id][bsize][THR_GOLD]
- : this_rd_thresh;
-
- // TODO(any): Add search of the tx_type to improve rd performance at the
- // expense of speed.
- mbmi->tx_type = DCT_DCT;
-
- if (cm->interp_filter != BILINEAR) {
-#if CONFIG_DUAL_FILTER
- tmp_best_filter[0] = EIGHTTAP_REGULAR;
- tmp_best_filter[1] = EIGHTTAP_REGULAR;
- tmp_best_filter[2] = EIGHTTAP_REGULAR;
- tmp_best_filter[3] = EIGHTTAP_REGULAR;
-#else
- tmp_best_filter = EIGHTTAP_REGULAR;
-#endif // CONFIG_DUAL_FILTER
- if (x->source_variance < sf->disable_filter_search_var_thresh) {
-#if CONFIG_DUAL_FILTER
- tmp_best_filter[0] = EIGHTTAP_REGULAR;
-#else
- tmp_best_filter = EIGHTTAP_REGULAR;
-#endif // CONFIG_DUAL_FILTER
- } else if (sf->adaptive_pred_interp_filter == 1 &&
- ctx->pred_interp_filter < SWITCHABLE) {
-#if CONFIG_DUAL_FILTER
- tmp_best_filter[0] = ctx->pred_interp_filter;
-#else
- tmp_best_filter = ctx->pred_interp_filter;
-#endif // CONFIG_DUAL_FILTER
- } else if (sf->adaptive_pred_interp_filter == 2) {
-#if CONFIG_DUAL_FILTER
- tmp_best_filter[0] = ctx->pred_interp_filter < SWITCHABLE
- ? ctx->pred_interp_filter
- : 0;
-#else
- tmp_best_filter = ctx->pred_interp_filter < SWITCHABLE
- ? ctx->pred_interp_filter
- : 0;
-#endif // CONFIG_DUAL_FILTER
- } else {
-#if CONFIG_DUAL_FILTER
- const int filter_set_size = DUAL_FILTER_SET_SIZE;
-#else
- const int filter_set_size = SWITCHABLE_FILTERS;
-#endif // CONFIG_DUAL_FILTER
- for (switchable_filter_index = 0;
- switchable_filter_index < filter_set_size;
- ++switchable_filter_index) {
- int newbest, rs;
- int64_t rs_rd;
- MB_MODE_INFO_EXT *mbmi_ext = x->mbmi_ext;
-#if CONFIG_DUAL_FILTER
- mbmi->interp_filter[0] = filter_sets[switchable_filter_index][0];
- mbmi->interp_filter[1] = filter_sets[switchable_filter_index][1];
- mbmi->interp_filter[2] = filter_sets[switchable_filter_index][0];
- mbmi->interp_filter[3] = filter_sets[switchable_filter_index][1];
-#else
- mbmi->interp_filter = switchable_filter_index;
-#endif // CONFIG_DUAL_FILTER
- tmp_rd = rd_pick_inter_best_sub8x8_mode(
- cpi, x, &mbmi_ext->ref_mvs[ref_frame][0], second_ref, best_yrd,
- &rate, &rate_y, &distortion, &skippable, &total_sse,
- (int)this_rd_thresh, seg_mvs,
-#if CONFIG_EXT_INTER
- compound_seg_newmvs,
-#endif // CONFIG_EXT_INTER
- bsi, switchable_filter_index, mi_row, mi_col);
- if (tmp_rd == INT64_MAX) continue;
- rs = av1_get_switchable_rate(cpi, xd);
- rs_rd = RDCOST(x->rdmult, x->rddiv, rs, 0);
- if (cm->interp_filter == SWITCHABLE) tmp_rd += rs_rd;
-
- newbest = (tmp_rd < tmp_best_rd);
- if (newbest) {
-#if CONFIG_DUAL_FILTER
- tmp_best_filter[0] = mbmi->interp_filter[0];
- tmp_best_filter[1] = mbmi->interp_filter[1];
- tmp_best_filter[2] = mbmi->interp_filter[2];
- tmp_best_filter[3] = mbmi->interp_filter[3];
-#else
- tmp_best_filter = mbmi->interp_filter;
-#endif // CONFIG_DUAL_FILTER
- tmp_best_rd = tmp_rd;
- }
- if ((newbest && cm->interp_filter == SWITCHABLE) ||
- (
-#if CONFIG_DUAL_FILTER
- mbmi->interp_filter[0] == cm->interp_filter
-#else
- mbmi->interp_filter == cm->interp_filter
-#endif // CONFIG_DUAL_FILTER
- && cm->interp_filter != SWITCHABLE)) {
- tmp_best_rdu = tmp_rd;
- tmp_best_rate = rate;
- tmp_best_ratey = rate_y;
- tmp_best_distortion = distortion;
- tmp_best_sse = total_sse;
- tmp_best_skippable = skippable;
- tmp_best_mbmode = *mbmi;
- for (i = 0; i < 4; i++) {
- tmp_best_bmodes[i] = xd->mi[0]->bmi[i];
- }
- pred_exists = 1;
- }
- } // switchable_filter_index loop
- }
- }
-
- if (tmp_best_rdu == INT64_MAX && pred_exists) continue;
-
-#if CONFIG_DUAL_FILTER
- mbmi->interp_filter[0] =
- (cm->interp_filter == SWITCHABLE ? tmp_best_filter[0]
- : cm->interp_filter);
- mbmi->interp_filter[1] =
- (cm->interp_filter == SWITCHABLE ? tmp_best_filter[1]
- : cm->interp_filter);
- mbmi->interp_filter[2] =
- (cm->interp_filter == SWITCHABLE ? tmp_best_filter[2]
- : cm->interp_filter);
- mbmi->interp_filter[3] =
- (cm->interp_filter == SWITCHABLE ? tmp_best_filter[3]
- : cm->interp_filter);
-#else
- mbmi->interp_filter =
- (cm->interp_filter == SWITCHABLE ? tmp_best_filter
- : cm->interp_filter);
-#endif // CONFIG_DUAL_FILTER
-
- if (!pred_exists) {
- // Handles the special case when a filter that is not in the
- // switchable list (bilinear) is indicated at the frame level
- tmp_rd = rd_pick_inter_best_sub8x8_mode(
- cpi, x, &x->mbmi_ext->ref_mvs[ref_frame][0], second_ref, best_yrd,
- &rate, &rate_y, &distortion, &skippable, &total_sse,
- (int)this_rd_thresh, seg_mvs,
-#if CONFIG_EXT_INTER
- compound_seg_newmvs,
-#endif // CONFIG_EXT_INTER
- bsi, 0, mi_row, mi_col);
- if (tmp_rd == INT64_MAX) continue;
- } else {
- total_sse = tmp_best_sse;
- rate = tmp_best_rate;
- rate_y = tmp_best_ratey;
- distortion = tmp_best_distortion;
- skippable = tmp_best_skippable;
- *mbmi = tmp_best_mbmode;
- for (i = 0; i < 4; i++) xd->mi[0]->bmi[i] = tmp_best_bmodes[i];
- }
- // Add in the cost of the transform type
- if (!xd->lossless[mbmi->segment_id]) {
- int rate_tx_type = 0;
-#if CONFIG_EXT_TX
- if (get_ext_tx_types(mbmi->tx_size, bsize, 1, cm->reduced_tx_set_used) >
- 1) {
- const int eset =
- get_ext_tx_set(mbmi->tx_size, bsize, 1, cm->reduced_tx_set_used);
- rate_tx_type =
- cpi->inter_tx_type_costs[eset][mbmi->tx_size][mbmi->tx_type];
- }
-#else
- if (mbmi->tx_size < TX_32X32) {
- rate_tx_type = cpi->inter_tx_type_costs[mbmi->tx_size][mbmi->tx_type];
- }
-#endif // CONFIG_EXT_TX
- rate += rate_tx_type;
- rate_y += rate_tx_type;
- }
-
- rate2 += rate;
- distortion2 += distortion;
-
- if (cm->interp_filter == SWITCHABLE)
- rate2 += av1_get_switchable_rate(cpi, xd);
-
- if (!mode_excluded)
- mode_excluded = comp_pred ? cm->reference_mode == SINGLE_REFERENCE
- : cm->reference_mode == COMPOUND_REFERENCE;
-
- compmode_cost = av1_cost_bit(comp_mode_p, comp_pred);
-
- tmp_best_rdu =
- best_rd - AOMMIN(RDCOST(x->rdmult, x->rddiv, rate2, distortion2),
- RDCOST(x->rdmult, x->rddiv, 0, total_sse));
-
- if (tmp_best_rdu > 0) {
- // If even the 'Y' rd value of split is higher than best so far
- // then dont bother looking at UV
- int is_cost_valid_uv;
- RD_STATS rd_stats_uv;
- av1_build_inter_predictors_sbuv(&x->e_mbd, mi_row, mi_col, NULL,
- BLOCK_8X8);
-#if CONFIG_VAR_TX
- is_cost_valid_uv =
- inter_block_uvrd(cpi, x, &rd_stats_uv, BLOCK_8X8, tmp_best_rdu);
-#else
- is_cost_valid_uv =
- super_block_uvrd(cpi, x, &rd_stats_uv, BLOCK_8X8, tmp_best_rdu);
-#endif // CONFIG_VAR_TX
- rate_uv = rd_stats_uv.rate;
- distortion_uv = rd_stats_uv.dist;
- uv_skippable = rd_stats_uv.skip;
- uv_sse = rd_stats_uv.sse;
-
- if (!is_cost_valid_uv) continue;
- rate2 += rate_uv;
- distortion2 += distortion_uv;
- skippable = skippable && uv_skippable;
- total_sse += uv_sse;
- } else {
- continue;
- }
- }
-
- if (cm->reference_mode == REFERENCE_MODE_SELECT) rate2 += compmode_cost;
-
- // Estimate the reference frame signaling cost and add it
- // to the rolling cost variable.
- if (second_ref_frame > INTRA_FRAME) {
- rate2 += ref_costs_comp[ref_frame];
-#if CONFIG_EXT_REFS
- rate2 += ref_costs_comp[second_ref_frame];
-#endif // CONFIG_EXT_REFS
- } else {
- rate2 += ref_costs_single[ref_frame];
- }
-
- if (!disable_skip) {
- // Skip is never coded at the segment level for sub8x8 blocks and instead
- // always coded in the bitstream at the mode info level.
-
- if (ref_frame != INTRA_FRAME && !xd->lossless[mbmi->segment_id]) {
- if (RDCOST(x->rdmult, x->rddiv, rate_y + rate_uv, distortion2) <
- RDCOST(x->rdmult, x->rddiv, 0, total_sse)) {
- // Add in the cost of the no skip flag.
- rate2 += av1_cost_bit(av1_get_skip_prob(cm, xd), 0);
- } else {
- // FIXME(rbultje) make this work for splitmv also
- rate2 += av1_cost_bit(av1_get_skip_prob(cm, xd), 1);
- distortion2 = total_sse;
- assert(total_sse >= 0);
- rate2 -= (rate_y + rate_uv);
- rate_y = 0;
- rate_uv = 0;
- this_skip2 = 1;
- }
- } else {
- // Add in the cost of the no skip flag.
- rate2 += av1_cost_bit(av1_get_skip_prob(cm, xd), 0);
- }
-
- // Calculate the final RD estimate for this mode.
- this_rd = RDCOST(x->rdmult, x->rddiv, rate2, distortion2);
- }
-
- if (!disable_skip && ref_frame == INTRA_FRAME) {
- for (i = 0; i < REFERENCE_MODES; ++i)
- best_pred_rd[i] = AOMMIN(best_pred_rd[i], this_rd);
- }
-
- // Did this mode help.. i.e. is it the new best mode
- if (this_rd < best_rd || x->skip) {
- if (!mode_excluded) {
- // Note index of best mode so far
- best_ref_index = ref_index;
-
- if (ref_frame == INTRA_FRAME) {
- /* required for left and above block mv */
- mbmi->mv[0].as_int = 0;
- }
-
- rd_cost->rate = rate2;
-#if CONFIG_SUPERTX
- *returnrate_nocoef = rate2 - rate_y - rate_uv;
- if (!disable_skip)
- *returnrate_nocoef -=
- av1_cost_bit(av1_get_skip_prob(cm, xd), this_skip2);
- *returnrate_nocoef -= av1_cost_bit(av1_get_intra_inter_prob(cm, xd),
- mbmi->ref_frame[0] != INTRA_FRAME);
- assert(*returnrate_nocoef > 0);
-#endif // CONFIG_SUPERTX
- rd_cost->dist = distortion2;
- rd_cost->rdcost = this_rd;
- best_rd = this_rd;
- best_yrd =
- best_rd - RDCOST(x->rdmult, x->rddiv, rate_uv, distortion_uv);
- best_mbmode = *mbmi;
- best_skip2 = this_skip2;
-
-#if CONFIG_VAR_TX
- for (i = 0; i < MAX_MB_PLANE; ++i)
- memset(ctx->blk_skip[i], 0, sizeof(uint8_t) * ctx->num_4x4_blk);
-#endif // CONFIG_VAR_TX
-
- for (i = 0; i < 4; i++) best_bmodes[i] = xd->mi[0]->bmi[i];
- }
- }
-
- /* keep record of best compound/single-only prediction */
- if (!disable_skip && ref_frame != INTRA_FRAME) {
- int64_t single_rd, hybrid_rd, single_rate, hybrid_rate;
-
- if (cm->reference_mode == REFERENCE_MODE_SELECT) {
- single_rate = rate2 - compmode_cost;
- hybrid_rate = rate2;
- } else {
- single_rate = rate2;
- hybrid_rate = rate2 + compmode_cost;
- }
-
- single_rd = RDCOST(x->rdmult, x->rddiv, single_rate, distortion2);
- hybrid_rd = RDCOST(x->rdmult, x->rddiv, hybrid_rate, distortion2);
-
- if (!comp_pred && single_rd < best_pred_rd[SINGLE_REFERENCE])
- best_pred_rd[SINGLE_REFERENCE] = single_rd;
- else if (comp_pred && single_rd < best_pred_rd[COMPOUND_REFERENCE])
- best_pred_rd[COMPOUND_REFERENCE] = single_rd;
-
- if (hybrid_rd < best_pred_rd[REFERENCE_MODE_SELECT])
- best_pred_rd[REFERENCE_MODE_SELECT] = hybrid_rd;
- }
-
- if (x->skip && !comp_pred) break;
- }
-
- if (best_rd >= best_rd_so_far) {
- rd_cost->rate = INT_MAX;
- rd_cost->rdcost = INT64_MAX;
-#if CONFIG_SUPERTX
- *returnrate_nocoef = INT_MAX;
-#endif // CONFIG_SUPERTX
- return;
- }
-
- if (best_rd == INT64_MAX) {
- rd_cost->rate = INT_MAX;
- rd_cost->dist = INT64_MAX;
- rd_cost->rdcost = INT64_MAX;
-#if CONFIG_SUPERTX
- *returnrate_nocoef = INT_MAX;
-#endif // CONFIG_SUPERTX
- return;
- }
-
-#if CONFIG_DUAL_FILTER
- assert((cm->interp_filter == SWITCHABLE) ||
- (cm->interp_filter == best_mbmode.interp_filter[0]) ||
- !is_inter_block(&best_mbmode));
-#else
- assert((cm->interp_filter == SWITCHABLE) ||
- (cm->interp_filter == best_mbmode.interp_filter) ||
- !is_inter_block(&best_mbmode));
-#endif // CONFIG_DUAL_FILTER
-
- av1_update_rd_thresh_fact(cm, tile_data->thresh_freq_fact,
- sf->adaptive_rd_thresh, bsize, best_ref_index);
-
- // macroblock modes
- *mbmi = best_mbmode;
-#if CONFIG_VAR_TX
- mbmi->inter_tx_size[0][0] = mbmi->tx_size;
-#endif // CONFIG_VAR_TX
-
- x->skip |= best_skip2;
- if (!is_inter_block(&best_mbmode)) {
- for (i = 0; i < 4; i++) xd->mi[0]->bmi[i].as_mode = best_bmodes[i].as_mode;
- } else {
- for (i = 0; i < 4; ++i)
- memcpy(&xd->mi[0]->bmi[i], &best_bmodes[i], sizeof(b_mode_info));
-
-#if CONFIG_REF_MV
- mbmi->pred_mv[0].as_int = xd->mi[0]->bmi[3].pred_mv[0].as_int;
- mbmi->pred_mv[1].as_int = xd->mi[0]->bmi[3].pred_mv[1].as_int;
-#endif // CONFIG_REF_MV
- mbmi->mv[0].as_int = xd->mi[0]->bmi[3].as_mv[0].as_int;
- mbmi->mv[1].as_int = xd->mi[0]->bmi[3].as_mv[1].as_int;
- }
-
-// Note: this section is needed since the mode may have been forced to ZEROMV
-#if CONFIG_GLOBAL_MOTION
- if (mbmi->mode == ZEROMV
-#if CONFIG_EXT_INTER
- || mbmi->mode == ZERO_ZEROMV
-#endif // CONFIG_EXT_INTER
- ) {
- if (is_nontrans_global_motion(xd)) {
-#if CONFIG_DUAL_FILTER
- mbmi->interp_filter[0] = cm->interp_filter == SWITCHABLE
- ? EIGHTTAP_REGULAR
- : cm->interp_filter;
- mbmi->interp_filter[1] = cm->interp_filter == SWITCHABLE
- ? EIGHTTAP_REGULAR
- : cm->interp_filter;
-#else
- mbmi->interp_filter = cm->interp_filter == SWITCHABLE ? EIGHTTAP_REGULAR
- : cm->interp_filter;
-#endif // CONFIG_DUAL_FILTER
- }
- }
-#endif // CONFIG_GLOBAL_MOTION
-
- for (i = 0; i < REFERENCE_MODES; ++i) {
- if (best_pred_rd[i] == INT64_MAX)
- best_pred_diff[i] = INT_MIN;
- else
- best_pred_diff[i] = best_rd - best_pred_rd[i];
- }
-
- store_coding_context(x, ctx, best_ref_index, best_pred_diff, 0);
-}
-
#if CONFIG_MOTION_VAR
// This function has a structure similar to av1_build_obmc_inter_prediction
//
@@ -12454,9 +10658,14 @@ static void calc_target_weighted_pred(const AV1_COMMON *cm, const MACROBLOCK *x,
i = 0;
do { // for each mi in the above row
const int mi_col_offset = i;
- const MB_MODE_INFO *const above_mbmi =
+ const MB_MODE_INFO *above_mbmi =
&xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
- const BLOCK_SIZE a_bsize = above_mbmi->sb_type;
+#if CONFIG_CHROMA_SUB8X8
+ if (above_mbmi->sb_type < BLOCK_8X8)
+ above_mbmi =
+ &xd->mi[mi_col_offset + 1 + mi_row_offset * xd->mi_stride]->mbmi;
+#endif
+ const BLOCK_SIZE a_bsize = AOMMAX(above_mbmi->sb_type, BLOCK_8X8);
const int mi_step = AOMMIN(xd->n8_w, mi_size_wide[a_bsize]);
const int neighbor_bw = mi_step * MI_SIZE;
@@ -12528,9 +10737,15 @@ static void calc_target_weighted_pred(const AV1_COMMON *cm, const MACROBLOCK *x,
i = 0;
do { // for each mi in the left column
const int mi_row_offset = i;
- const MB_MODE_INFO *const left_mbmi =
+ MB_MODE_INFO *left_mbmi =
&xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
- const BLOCK_SIZE l_bsize = left_mbmi->sb_type;
+
+#if CONFIG_CHROMA_SUB8X8
+ if (left_mbmi->sb_type < BLOCK_8X8)
+ left_mbmi =
+ &xd->mi[mi_col_offset + (mi_row_offset + 1) * xd->mi_stride]->mbmi;
+#endif
+ const BLOCK_SIZE l_bsize = AOMMAX(left_mbmi->sb_type, BLOCK_8X8);
const int mi_step = AOMMIN(xd->n8_h, mi_size_high[l_bsize]);
const int neighbor_bh = mi_step * MI_SIZE;
@@ -12636,7 +10851,7 @@ void av1_check_ncobmc_rd(const struct AV1_COMP *cpi, struct macroblock *x,
av1_setup_dst_planes(x->e_mbd.plane, bsize,
get_frame_new_buffer(&cpi->common), mi_row, mi_col);
- av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL, bsize);
+ av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, bsize);
av1_subtract_plane(x, bsize, 0);
super_block_yrd(cpi, x, &rd_stats_y, bsize, INT64_MAX);
diff --git a/third_party/aom/av1/encoder/rdopt.h b/third_party/aom/av1/encoder/rdopt.h
index a7053b289..e5d778fe5 100644
--- a/third_party/aom/av1/encoder/rdopt.h
+++ b/third_party/aom/av1/encoder/rdopt.h
@@ -62,6 +62,12 @@ void av1_dist_block(const AV1_COMP *cpi, MACROBLOCK *x, int plane,
TX_SIZE tx_size, int64_t *out_dist, int64_t *out_sse,
OUTPUT_STATUS output_status);
+#if CONFIG_DAALA_DIST
+int64_t av1_daala_dist(const uint8_t *src, int src_stride, const uint8_t *dst,
+ int dst_stride, int bsw, int bsh, int qm,
+ int use_activity_masking, int qindex);
+#endif
+
#if !CONFIG_PVQ || CONFIG_VAR_TX
int av1_cost_coeffs(const AV1_COMP *const cpi, MACROBLOCK *x, int plane,
int block, TX_SIZE tx_size, const SCAN_ORDER *scan_order,
@@ -101,16 +107,6 @@ int av1_active_h_edge(const struct AV1_COMP *cpi, int mi_row, int mi_step);
int av1_active_v_edge(const struct AV1_COMP *cpi, int mi_col, int mi_step);
int av1_active_edge_sb(const struct AV1_COMP *cpi, int mi_row, int mi_col);
-void av1_rd_pick_inter_mode_sub8x8(const struct AV1_COMP *cpi,
- struct TileDataEnc *tile_data,
- struct macroblock *x, int mi_row, int mi_col,
- struct RD_STATS *rd_cost,
-#if CONFIG_SUPERTX
- int *returnrate_nocoef,
-#endif // CONFIG_SUPERTX
- BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx,
- int64_t best_rd_so_far);
-
#if CONFIG_MOTION_VAR && CONFIG_NCOBMC
void av1_check_ncobmc_rd(const struct AV1_COMP *cpi, struct macroblock *x,
int mi_row, int mi_col);
diff --git a/third_party/aom/av1/encoder/speed_features.c b/third_party/aom/av1/encoder/speed_features.c
index 20c96761b..e2275a54f 100644
--- a/third_party/aom/av1/encoder/speed_features.c
+++ b/third_party/aom/av1/encoder/speed_features.c
@@ -139,8 +139,10 @@ static void set_good_speed_feature_framesize_dependent(AV1_COMP *cpi,
}
}
-static void set_good_speed_feature(AV1_COMP *cpi, AV1_COMMON *cm,
- SPEED_FEATURES *sf, int speed) {
+static void set_good_speed_features_framesize_independent(AV1_COMP *cpi,
+ SPEED_FEATURES *sf,
+ int speed) {
+ AV1_COMMON *const cm = &cpi->common;
const int boosted = frame_is_boosted(cpi);
if (speed >= 1) {
@@ -205,6 +207,9 @@ static void set_good_speed_feature(AV1_COMP *cpi, AV1_COMMON *cm,
#if CONFIG_EXT_TX
sf->tx_type_search.prune_mode = PRUNE_TWO;
#endif
+#if CONFIG_GLOBAL_MOTION
+ sf->gm_search_type = GM_DISABLE_SEARCH;
+#endif // CONFIG_GLOBAL_MOTION
}
if (speed >= 4) {
@@ -286,6 +291,12 @@ static void set_good_speed_feature(AV1_COMP *cpi, AV1_COMMON *cm,
sf->coeff_prob_appx_step = 4;
sf->mode_search_skip_flags |= FLAG_SKIP_INTRA_DIRMISMATCH;
}
+ if (speed >= 8) {
+ sf->mv.search_method = FAST_DIAMOND;
+ sf->mv.fullpel_search_step_param = 10;
+ sf->mv.subpel_force_stop = 2;
+ sf->lpf_pick = LPF_PICK_MINIMAL_LPF;
+ }
}
void av1_set_speed_features_framesize_dependent(AV1_COMP *cpi) {
@@ -339,12 +350,13 @@ void av1_set_speed_features_framesize_dependent(AV1_COMP *cpi) {
}
void av1_set_speed_features_framesize_independent(AV1_COMP *cpi) {
- SPEED_FEATURES *const sf = &cpi->sf;
AV1_COMMON *const cm = &cpi->common;
+ SPEED_FEATURES *const sf = &cpi->sf;
MACROBLOCK *const x = &cpi->td.mb;
const AV1EncoderConfig *const oxcf = &cpi->oxcf;
int i;
+ (void)cm;
// best quality defaults
sf->frame_parameter_update = 1;
sf->mv.search_method = NSTEP;
@@ -418,13 +430,16 @@ void av1_set_speed_features_framesize_independent(AV1_COMP *cpi) {
// Set this at the appropriate speed levels
sf->use_transform_domain_distortion = 0;
+#if CONFIG_GLOBAL_MOTION
+ sf->gm_search_type = GM_FULL_SEARCH;
+#endif // CONFIG_GLOBAL_MOTION
if (oxcf->mode == GOOD
#if CONFIG_XIPHRC
|| oxcf->pass == 1
#endif
)
- set_good_speed_feature(cpi, cm, sf, oxcf->speed);
+ set_good_speed_features_framesize_independent(cpi, sf, oxcf->speed);
// sf->partition_search_breakout_dist_thr is set assuming max 64x64
// blocks. Normalise this if the blocks are bigger.
diff --git a/third_party/aom/av1/encoder/speed_features.h b/third_party/aom/av1/encoder/speed_features.h
index af54a1a9a..5710d77c7 100644
--- a/third_party/aom/av1/encoder/speed_features.h
+++ b/third_party/aom/av1/encoder/speed_features.h
@@ -24,6 +24,9 @@ enum {
(1 << D207_PRED) | (1 << D63_PRED) |
#if CONFIG_ALT_INTRA
(1 << SMOOTH_PRED) |
+#if CONFIG_SMOOTH_HV
+ (1 << SMOOTH_V_PRED) | (1 << SMOOTH_H_PRED) |
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
(1 << TM_PRED),
INTRA_DC = (1 << DC_PRED),
@@ -36,37 +39,33 @@ enum {
#if CONFIG_EXT_INTER
enum {
INTER_ALL = (1 << NEARESTMV) | (1 << NEARMV) | (1 << ZEROMV) | (1 << NEWMV) |
- (1 << NEAREST_NEARESTMV) | (1 << NEAR_NEARMV) |
- (1 << NEAREST_NEARMV) | (1 << NEAR_NEARESTMV) | (1 << NEW_NEWMV) |
+ (1 << NEAREST_NEARESTMV) | (1 << NEAR_NEARMV) | (1 << NEW_NEWMV) |
(1 << NEAREST_NEWMV) | (1 << NEAR_NEWMV) | (1 << NEW_NEARMV) |
(1 << NEW_NEARESTMV) | (1 << ZERO_ZEROMV),
INTER_NEAREST = (1 << NEARESTMV) | (1 << NEAREST_NEARESTMV) |
- (1 << NEAREST_NEARMV) | (1 << NEAR_NEARESTMV) |
(1 << NEW_NEARESTMV) | (1 << NEAREST_NEWMV),
INTER_NEAREST_NEW = (1 << NEARESTMV) | (1 << NEWMV) |
(1 << NEAREST_NEARESTMV) | (1 << NEW_NEWMV) |
- (1 << NEAR_NEARESTMV) | (1 << NEAREST_NEARMV) |
(1 << NEW_NEARESTMV) | (1 << NEAREST_NEWMV) |
(1 << NEW_NEARMV) | (1 << NEAR_NEWMV),
INTER_NEAREST_ZERO = (1 << NEARESTMV) | (1 << ZEROMV) |
(1 << NEAREST_NEARESTMV) | (1 << ZERO_ZEROMV) |
- (1 << NEAREST_NEARMV) | (1 << NEAR_NEARESTMV) |
(1 << NEAREST_NEWMV) | (1 << NEW_NEARESTMV),
- INTER_NEAREST_NEW_ZERO =
- (1 << NEARESTMV) | (1 << ZEROMV) | (1 << NEWMV) |
- (1 << NEAREST_NEARESTMV) | (1 << ZERO_ZEROMV) | (1 << NEW_NEWMV) |
- (1 << NEAREST_NEARMV) | (1 << NEAR_NEARESTMV) | (1 << NEW_NEARESTMV) |
- (1 << NEAREST_NEWMV) | (1 << NEW_NEARMV) | (1 << NEAR_NEWMV),
- INTER_NEAREST_NEAR_NEW =
- (1 << NEARESTMV) | (1 << NEARMV) | (1 << NEWMV) |
- (1 << NEAREST_NEARESTMV) | (1 << NEW_NEWMV) | (1 << NEAREST_NEARMV) |
- (1 << NEAR_NEARESTMV) | (1 << NEW_NEARESTMV) | (1 << NEAREST_NEWMV) |
- (1 << NEW_NEARMV) | (1 << NEAR_NEWMV) | (1 << NEAR_NEARMV),
- INTER_NEAREST_NEAR_ZERO =
- (1 << NEARESTMV) | (1 << NEARMV) | (1 << ZEROMV) |
- (1 << NEAREST_NEARESTMV) | (1 << ZERO_ZEROMV) | (1 << NEAREST_NEARMV) |
- (1 << NEAR_NEARESTMV) | (1 << NEAREST_NEWMV) | (1 << NEW_NEARESTMV) |
- (1 << NEW_NEARMV) | (1 << NEAR_NEWMV) | (1 << NEAR_NEARMV),
+ INTER_NEAREST_NEW_ZERO = (1 << NEARESTMV) | (1 << ZEROMV) | (1 << NEWMV) |
+ (1 << NEAREST_NEARESTMV) | (1 << ZERO_ZEROMV) |
+ (1 << NEW_NEWMV) | (1 << NEW_NEARESTMV) |
+ (1 << NEAREST_NEWMV) | (1 << NEW_NEARMV) |
+ (1 << NEAR_NEWMV),
+ INTER_NEAREST_NEAR_NEW = (1 << NEARESTMV) | (1 << NEARMV) | (1 << NEWMV) |
+ (1 << NEAREST_NEARESTMV) | (1 << NEW_NEWMV) |
+ (1 << NEW_NEARESTMV) | (1 << NEAREST_NEWMV) |
+ (1 << NEW_NEARMV) | (1 << NEAR_NEWMV) |
+ (1 << NEAR_NEARMV),
+ INTER_NEAREST_NEAR_ZERO = (1 << NEARESTMV) | (1 << NEARMV) | (1 << ZEROMV) |
+ (1 << NEAREST_NEARESTMV) | (1 << ZERO_ZEROMV) |
+ (1 << NEAREST_NEWMV) | (1 << NEW_NEARESTMV) |
+ (1 << NEW_NEARMV) | (1 << NEAR_NEWMV) |
+ (1 << NEAR_NEARMV),
};
#else
enum {
@@ -196,14 +195,7 @@ typedef enum {
// Always use a fixed size partition
FIXED_PARTITION,
- REFERENCE_PARTITION,
-
- // Use an arbitrary partitioning scheme based on source variance within
- // a 64X64 SB
- VAR_BASED_PARTITION,
-
- // Use non-fixed partitions based on source variance
- SOURCE_VAR_BASED_PARTITION
+ REFERENCE_PARTITION
} PARTITION_SEARCH_TYPE;
typedef enum {
@@ -251,6 +243,14 @@ typedef struct MESH_PATTERN {
int interval;
} MESH_PATTERN;
+#if CONFIG_GLOBAL_MOTION
+typedef enum {
+ GM_FULL_SEARCH,
+ GM_REDUCED_REF_SEARCH,
+ GM_DISABLE_SEARCH
+} GM_SEARCH_TYPE;
+#endif // CONFIG_GLOBAL_MOTION
+
typedef struct SPEED_FEATURES {
MV_SPEED_FEATURES mv;
@@ -432,7 +432,7 @@ typedef struct SPEED_FEATURES {
// TODO(aconverse): Fold this into one of the other many mode skips
BLOCK_SIZE max_intra_bsize;
- // The frequency that we check if SOURCE_VAR_BASED_PARTITION or
+ // The frequency that we check if
// FIXED_PARTITION search type should be used.
int search_type_check_frequency;
@@ -470,6 +470,10 @@ typedef struct SPEED_FEATURES {
// Whether to compute distortion in the image domain (slower but
// more accurate), or in the transform domain (faster but less acurate).
int use_transform_domain_distortion;
+
+#if CONFIG_GLOBAL_MOTION
+ GM_SEARCH_TYPE gm_search_type;
+#endif // CONFIG_GLOBAL_MOTION
} SPEED_FEATURES;
struct AV1_COMP;
diff --git a/third_party/aom/av1/encoder/subexp.c b/third_party/aom/av1/encoder/subexp.c
index 8960d3341..6a8ba12d8 100644
--- a/third_party/aom/av1/encoder/subexp.c
+++ b/third_party/aom/av1/encoder/subexp.c
@@ -179,83 +179,6 @@ int av1_prob_diff_update_savings_search_model(const unsigned int *ct,
return bestsavings;
}
-#if CONFIG_SUBFRAME_PROB_UPDATE
-static int get_cost(unsigned int ct[][2], aom_prob p, int n) {
- int i, p0 = p;
- unsigned int total_ct[2] = { 0, 0 };
- int cost = 0;
-
- for (i = 0; i <= n; ++i) {
- cost += cost_branch256(ct[i], p);
- total_ct[0] += ct[i][0];
- total_ct[1] += ct[i][1];
- if (i < n)
- p = av1_merge_probs(p0, total_ct, COEF_COUNT_SAT, COEF_MAX_UPDATE_FACTOR);
- }
- return cost;
-}
-
-int av1_prob_update_search_subframe(unsigned int ct[][2], aom_prob oldp,
- aom_prob *bestp, aom_prob upd, int n) {
- const int old_b = get_cost(ct, oldp, n);
- int bestsavings = 0;
- const int upd_cost = av1_cost_one(upd) - av1_cost_zero(upd);
- aom_prob newp, bestnewp = oldp;
- const int step = *bestp > oldp ? -1 : 1;
-
- for (newp = *bestp; newp != oldp; newp += step) {
- const int new_b = get_cost(ct, newp, n);
- const int update_b = prob_diff_update_cost(newp, oldp) + upd_cost;
- const int savings = old_b - new_b - update_b;
- if (savings > bestsavings) {
- bestsavings = savings;
- bestnewp = newp;
- }
- }
- *bestp = bestnewp;
- return bestsavings;
-}
-
-int av1_prob_update_search_model_subframe(
- unsigned int ct[ENTROPY_NODES][COEF_PROBS_BUFS][2], const aom_prob *oldp,
- aom_prob *bestp, aom_prob upd, int stepsize, int n) {
- int i, old_b, new_b, update_b, savings, bestsavings;
- int newp;
- const int step_sign = *bestp > oldp[PIVOT_NODE] ? -1 : 1;
- const int step = stepsize * step_sign;
- const int upd_cost = av1_cost_one(upd) - av1_cost_zero(upd);
- aom_prob bestnewp, newplist[ENTROPY_NODES], oldplist[ENTROPY_NODES];
- av1_model_to_full_probs(oldp, oldplist);
- memcpy(newplist, oldp, sizeof(aom_prob) * UNCONSTRAINED_NODES);
- for (i = UNCONSTRAINED_NODES, old_b = 0; i < ENTROPY_NODES; ++i)
- old_b += get_cost(ct[i], oldplist[i], n);
- old_b += get_cost(ct[PIVOT_NODE], oldplist[PIVOT_NODE], n);
-
- bestsavings = 0;
- bestnewp = oldp[PIVOT_NODE];
-
- assert(stepsize > 0);
-
- for (newp = *bestp; (newp - oldp[PIVOT_NODE]) * step_sign < 0; newp += step) {
- if (newp < 1 || newp > 255) continue;
- newplist[PIVOT_NODE] = newp;
- av1_model_to_full_probs(newplist, newplist);
- for (i = UNCONSTRAINED_NODES, new_b = 0; i < ENTROPY_NODES; ++i)
- new_b += get_cost(ct[i], newplist[i], n);
- new_b += get_cost(ct[PIVOT_NODE], newplist[PIVOT_NODE], n);
- update_b = prob_diff_update_cost(newp, oldp[PIVOT_NODE]) + upd_cost;
- savings = old_b - new_b - update_b;
- if (savings > bestsavings) {
- bestsavings = savings;
- bestnewp = newp;
- }
- }
-
- *bestp = bestnewp;
- return bestsavings;
-}
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
-
void av1_cond_prob_diff_update(aom_writer *w, aom_prob *oldp,
const unsigned int ct[2], int probwt) {
const aom_prob upd = DIFF_UPDATE_PROB;
diff --git a/third_party/aom/av1/encoder/subexp.h b/third_party/aom/av1/encoder/subexp.h
index 049265cb8..580edabdb 100644
--- a/third_party/aom/av1/encoder/subexp.h
+++ b/third_party/aom/av1/encoder/subexp.h
@@ -35,13 +35,6 @@ int av1_prob_diff_update_savings_search_model(const unsigned int *ct,
int av1_cond_prob_diff_update_savings(aom_prob *oldp, const unsigned int ct[2],
int probwt);
-#if CONFIG_SUBFRAME_PROB_UPDATE
-int av1_prob_update_search_subframe(unsigned int ct[][2], aom_prob oldp,
- aom_prob *bestp, aom_prob upd, int n);
-int av1_prob_update_search_model_subframe(
- unsigned int ct[ENTROPY_NODES][COEF_PROBS_BUFS][2], const aom_prob *oldp,
- aom_prob *bestp, aom_prob upd, int stepsize, int n);
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/third_party/aom/av1/encoder/temporal_filter.c b/third_party/aom/av1/encoder/temporal_filter.c
index de962fe84..1ed1ebdb2 100644
--- a/third_party/aom/av1/encoder/temporal_filter.c
+++ b/third_party/aom/av1/encoder/temporal_filter.c
@@ -281,14 +281,10 @@ static int temporal_filter_find_matching_mb_c(AV1_COMP *cpi,
av1_set_mv_search_range(&x->mv_limits, &best_ref_mv1);
-#if CONFIG_REF_MV
x->mvcost = x->mv_cost_stack[0];
x->nmvjointcost = x->nmv_vec_cost[0];
- x->mvsadcost = x->mvcost;
- x->nmvjointsadcost = x->nmvjointcost;
-#endif
- // Ignore mv costing by sending NULL pointer instead of cost arrays
+ // Use mv costing from x->mvcost directly
av1_hex_search(x, &best_ref_mv1_full, step_param, sadpb, 1,
cond_cost_list(cpi, cost_list), &cpi->fn_ptr[BLOCK_16X16], 0,
&best_ref_mv1);
@@ -299,8 +295,11 @@ static int temporal_filter_find_matching_mb_c(AV1_COMP *cpi,
bestsme = cpi->find_fractional_mv_step(
x, &best_ref_mv1, cpi->common.allow_high_precision_mv, x->errorperbit,
&cpi->fn_ptr[BLOCK_16X16], 0, mv_sf->subpel_iters_per_step,
- cond_cost_list(cpi, cost_list), NULL, NULL, &distortion, &sse, NULL, 0, 0,
- 0);
+ cond_cost_list(cpi, cost_list), NULL, NULL, &distortion, &sse, NULL,
+#if CONFIG_EXT_INTER
+ NULL, 0, 0,
+#endif
+ 0, 0, 0);
x->e_mbd.mi[0]->bmi[0].as_mv[0] = x->best_mv;
diff --git a/third_party/aom/av1/encoder/tokenize.c b/third_party/aom/av1/encoder/tokenize.c
index f48493bf8..18d2cd958 100644
--- a/third_party/aom/av1/encoder/tokenize.c
+++ b/third_party/aom/av1/encoder/tokenize.c
@@ -23,6 +23,9 @@
#include "av1/encoder/cost.h"
#include "av1/encoder/encoder.h"
+#if CONFIG_LV_MAP
+#include "av1/encoder/encodetxb.c"
+#endif
#include "av1/encoder/rdopt.h"
#include "av1/encoder/tokenize.h"
@@ -261,20 +264,6 @@ const av1_extra_bit av1_extra_bits[ENTROPY_TOKENS] = {
};
#endif
-#if !CONFIG_EC_MULTISYMBOL
-const struct av1_token av1_coef_encodings[ENTROPY_TOKENS] = {
- { 2, 2 }, { 6, 3 }, { 28, 5 }, { 58, 6 }, { 59, 6 }, { 60, 6 },
- { 61, 6 }, { 124, 7 }, { 125, 7 }, { 126, 7 }, { 127, 7 }, { 0, 1 }
-};
-#endif // !CONFIG_EC_MULTISYMBOL
-
-struct tokenize_b_args {
- const AV1_COMP *cpi;
- ThreadData *td;
- TOKENEXTRA **tp;
- int this_rate;
-};
-
#if !CONFIG_PVQ || CONFIG_VAR_TX
static void cost_coeffs_b(int plane, int block, int blk_row, int blk_col,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size, void *arg) {
@@ -314,7 +303,6 @@ static void set_entropy_context_b(int plane, int block, int blk_row,
blk_row);
}
-#if CONFIG_NEW_TOKENSET
static INLINE void add_token(TOKENEXTRA **t,
aom_cdf_prob (*tail_cdf)[CDF_SIZE(ENTROPY_TOKENS)],
aom_cdf_prob (*head_cdf)[CDF_SIZE(ENTROPY_TOKENS)],
@@ -328,25 +316,6 @@ static INLINE void add_token(TOKENEXTRA **t,
(*t)->first_val = first_val;
(*t)++;
}
-
-#else // CONFIG_NEW_TOKENSET
-static INLINE void add_token(
- TOKENEXTRA **t, const aom_prob *context_tree,
-#if CONFIG_EC_MULTISYMBOL
- aom_cdf_prob (*token_cdf)[CDF_SIZE(ENTROPY_TOKENS)],
-#endif // CONFIG_EC_MULTISYMBOL
- int32_t extra, uint8_t token, uint8_t skip_eob_node, unsigned int *counts) {
- (*t)->token = token;
- (*t)->extra = extra;
- (*t)->context_tree = context_tree;
-#if CONFIG_EC_MULTISYMBOL
- (*t)->token_cdf = token_cdf;
-#endif // CONFIG_EC_MULTISYMBOL
- (*t)->skip_eob_node = skip_eob_node;
- (*t)++;
- ++counts[token];
-}
-#endif // CONFIG_NEW_TOKENSET
#endif // !CONFIG_PVQ || CONFIG_VAR_TX
#if CONFIG_PALETTE
@@ -471,22 +440,11 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
const int ref = is_inter_block(mbmi);
unsigned int(*const counts)[COEFF_CONTEXTS][ENTROPY_TOKENS] =
td->rd_counts.coef_counts[txsize_sqr_map[tx_size]][type][ref];
-#if !CONFIG_NEW_TOKENSET
-#if CONFIG_SUBFRAME_PROB_UPDATE
- const aom_prob(*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
- cpi->subframe_stats.coef_probs_buf[cpi->common.coef_probs_update_idx]
- [txsize_sqr_map[tx_size]][type][ref];
-#else
- aom_prob(*const coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
- cpi->common.fc->coef_probs[txsize_sqr_map[tx_size]][type][ref];
-#endif // CONFIG_SUBFRAME_PROB_UPDATE
-#endif // !CONFIG_NEW_TOKENSET
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
-#elif CONFIG_EC_MULTISYMBOL
+#else
FRAME_CONTEXT *ec_ctx = cpi->common.fc;
#endif
-#if CONFIG_NEW_TOKENSET
aom_cdf_prob(
*const coef_head_cdfs)[COEFF_CONTEXTS][CDF_SIZE(ENTROPY_TOKENS)] =
ec_ctx->coef_head_cdfs[txsize_sqr_map[tx_size]][type][ref];
@@ -497,13 +455,6 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
td->counts->blockz_count[txsize_sqr_map[tx_size]][type][ref];
int eob_val;
int first_val = 1;
-#else
-#if CONFIG_EC_MULTISYMBOL
- aom_cdf_prob(*const coef_cdfs)[COEFF_CONTEXTS][CDF_SIZE(ENTROPY_TOKENS)] =
- ec_ctx->coef_cdfs[txsize_sqr_map[tx_size]][type][ref];
-#endif
- int skip_eob = 0;
-#endif
const int seg_eob = get_tx_eob(&cpi->common.seg, segment_id, tx_size);
unsigned int(*const eob_branch)[COEFF_CONTEXTS] =
td->counts->eob_branch[txsize_sqr_map[tx_size]][type][ref];
@@ -517,7 +468,6 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
nb = scan_order->neighbors;
c = 0;
-#if CONFIG_NEW_TOKENSET
if (eob == 0)
add_token(&t, &coef_tail_cdfs[band[c]][pt], &coef_head_cdfs[band[c]][pt], 1,
1, 0, BLOCK_Z_TOKEN);
@@ -553,33 +503,6 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
++c;
pt = get_coef_context(nb, token_cache, AOMMIN(c, eob - 1));
}
-#else
- while (c < eob) {
- const int v = qcoeff[scan[c]];
- eob_branch[band[c]][pt] += !skip_eob;
-
- av1_get_token_extra(v, &token, &extra);
-
- add_token(&t, coef_probs[band[c]][pt],
-#if CONFIG_EC_MULTISYMBOL
- &coef_cdfs[band[c]][pt],
-#endif
- extra, (uint8_t)token, (uint8_t)skip_eob, counts[band[c]][pt]);
-
- token_cache[scan[c]] = av1_pt_energy_class[token];
- ++c;
- pt = get_coef_context(nb, token_cache, c);
- skip_eob = (token == ZERO_TOKEN);
- }
- if (c < seg_eob) {
- add_token(&t, coef_probs[band[c]][pt],
-#if CONFIG_EC_MULTISYMBOL
- NULL,
-#endif
- 0, EOB_TOKEN, 0, counts[band[c]][pt]);
- ++eob_branch[band[c]][pt];
- }
-#endif // CONFIG_NEW_TOKENSET
#if CONFIG_COEF_INTERLEAVE
t->token = EOSB_TOKEN;
@@ -651,6 +574,18 @@ void tokenize_vartx(ThreadData *td, TOKENEXTRA **t, RUN_TYPE dry_run,
if (tx_size == plane_tx_size) {
plane_bsize = get_plane_block_size(mbmi->sb_type, pd);
+#if CONFIG_LV_MAP
+ if (!dry_run) {
+ av1_update_and_record_txb_context(plane, block, blk_row, blk_col,
+ plane_bsize, tx_size, arg);
+ } else if (dry_run == DRY_RUN_NORMAL) {
+ av1_update_txb_context_b(plane, block, blk_row, blk_col, plane_bsize,
+ tx_size, arg);
+ } else {
+ printf("DRY_RUN_COSTCOEFFS is not supported yet\n");
+ assert(0);
+ }
+#else
if (!dry_run)
tokenize_b(plane, block, blk_row, blk_col, plane_bsize, tx_size, arg);
else if (dry_run == DRY_RUN_NORMAL)
@@ -658,6 +593,7 @@ void tokenize_vartx(ThreadData *td, TOKENEXTRA **t, RUN_TYPE dry_run,
tx_size, arg);
else if (dry_run == DRY_RUN_COSTCOEFFS)
cost_coeffs_b(plane, block, blk_row, blk_col, plane_bsize, tx_size, arg);
+#endif
} else {
// Half the block size in transform block unit.
const TX_SIZE sub_txs = sub_tx_size_map[tx_size];
@@ -688,7 +624,11 @@ void av1_tokenize_sb_vartx(const AV1_COMP *cpi, ThreadData *td, TOKENEXTRA **t,
MACROBLOCK *const x = &td->mb;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
+#if CONFIG_LV_MAP
+ (void)t;
+#else
TOKENEXTRA *t_backup = *t;
+#endif
const int ctx = av1_get_skip_context(xd);
const int skip_inc =
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP);
@@ -698,22 +638,25 @@ void av1_tokenize_sb_vartx(const AV1_COMP *cpi, ThreadData *td, TOKENEXTRA **t,
if (mbmi->skip) {
if (!dry_run) td->counts->skip[ctx][1] += skip_inc;
- reset_skip_context(xd, bsize);
+ av1_reset_skip_context(xd, mi_row, mi_col, bsize);
+#if !CONFIG_LV_MAP
if (dry_run) *t = t_backup;
+#endif
return;
}
- if (!dry_run)
- td->counts->skip[ctx][0] += skip_inc;
+ if (!dry_run) td->counts->skip[ctx][0] += skip_inc;
+#if !CONFIG_LV_MAP
else
*t = t_backup;
+#endif
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)) {
-#if !CONFIG_PVQ
+#if !CONFIG_PVQ || !CONFIG_LV_MAP
if (!dry_run) {
(*t)->token = EOSB_TOKEN;
(*t)++;
@@ -746,10 +689,12 @@ void av1_tokenize_sb_vartx(const AV1_COMP *cpi, ThreadData *td, TOKENEXTRA **t,
}
}
+#if !CONFIG_LV_MAP
if (!dry_run) {
(*t)->token = EOSB_TOKEN;
(*t)++;
}
+#endif
}
if (rate) *rate += arg.this_rate;
}
@@ -768,7 +713,7 @@ void av1_tokenize_sb(const AV1_COMP *cpi, ThreadData *td, TOKENEXTRA **t,
struct tokenize_b_args arg = { cpi, td, t, 0 };
if (mbmi->skip) {
if (!dry_run) td->counts->skip[ctx][1] += skip_inc;
- reset_skip_context(xd, bsize);
+ av1_reset_skip_context(xd, mi_row, mi_col, bsize);
return;
}
@@ -843,8 +788,8 @@ void av1_tokenize_sb(const AV1_COMP *cpi, ThreadData *td, TOKENEXTRA **t,
#if CONFIG_SUPERTX
void av1_tokenize_sb_supertx(const AV1_COMP *cpi, ThreadData *td,
- TOKENEXTRA **t, RUN_TYPE dry_run, BLOCK_SIZE bsize,
- int *rate) {
+ TOKENEXTRA **t, RUN_TYPE dry_run, int mi_row,
+ int mi_col, BLOCK_SIZE bsize, int *rate) {
const AV1_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &td->mb.e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
@@ -855,7 +800,7 @@ void av1_tokenize_sb_supertx(const AV1_COMP *cpi, ThreadData *td,
struct tokenize_b_args arg = { cpi, td, t, 0 };
if (mbmi->skip) {
if (!dry_run) td->counts->skip[ctx][1] += skip_inc;
- reset_skip_context(xd, bsize);
+ av1_reset_skip_context(xd, mi_row, mi_col, bsize);
if (dry_run) *t = t_backup;
return;
}
diff --git a/third_party/aom/av1/encoder/tokenize.h b/third_party/aom/av1/encoder/tokenize.h
index 3928111d6..cbfa3cd91 100644
--- a/third_party/aom/av1/encoder/tokenize.h
+++ b/third_party/aom/av1/encoder/tokenize.h
@@ -35,14 +35,10 @@ typedef struct {
} TOKENVALUE;
typedef struct {
-#if CONFIG_NEW_TOKENSET
aom_cdf_prob (*tail_cdf)[CDF_SIZE(ENTROPY_TOKENS)];
aom_cdf_prob (*head_cdf)[CDF_SIZE(ENTROPY_TOKENS)];
int eob_val;
int first_val;
-#elif CONFIG_EC_MULTISYMBOL
- aom_cdf_prob (*token_cdf)[CDF_SIZE(ENTROPY_TOKENS)];
-#endif
const aom_prob *context_tree;
EXTRABIT extra;
uint8_t token;
@@ -51,15 +47,19 @@ typedef struct {
extern const aom_tree_index av1_coef_tree[];
extern const aom_tree_index av1_coef_con_tree[];
-#if !CONFIG_EC_MULTISYMBOL
-extern const struct av1_token av1_coef_encodings[];
-#endif // !CONFIG_EC_MULTISYMBOL
int av1_is_skippable_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
struct AV1_COMP;
struct ThreadData;
+struct tokenize_b_args {
+ const struct AV1_COMP *cpi;
+ struct ThreadData *td;
+ TOKENEXTRA **tp;
+ int this_rate;
+};
+
typedef enum {
OUTPUT_ENABLED = 0,
DRY_RUN_NORMAL,
@@ -85,8 +85,8 @@ void av1_tokenize_sb(const struct AV1_COMP *cpi, struct ThreadData *td,
int *rate, const int mi_row, const int mi_col);
#if CONFIG_SUPERTX
void av1_tokenize_sb_supertx(const struct AV1_COMP *cpi, struct ThreadData *td,
- TOKENEXTRA **t, RUN_TYPE dry_run, BLOCK_SIZE bsize,
- int *rate);
+ TOKENEXTRA **t, RUN_TYPE dry_run, int mi_row,
+ int mi_col, BLOCK_SIZE bsize, int *rate);
#endif
extern const int16_t *av1_dct_value_cost_ptr;
diff --git a/third_party/aom/av1/encoder/variance_tree.c b/third_party/aom/av1/encoder/variance_tree.c
deleted file mode 100644
index 9384cd78e..000000000
--- a/third_party/aom/av1/encoder/variance_tree.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved
- *
- * This source code is subject to the terms of the BSD 2 Clause License and
- * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
- * was not distributed with this source code in the LICENSE file, you can
- * obtain it at www.aomedia.org/license/software. If the Alliance for Open
- * Media Patent License 1.0 was not distributed with this source code in the
- * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
- */
-
-#include "av1/encoder/variance_tree.h"
-#include "av1/encoder/encoder.h"
-
-void av1_setup_var_tree(struct AV1Common *cm, ThreadData *td) {
- int i, j;
-#if CONFIG_EXT_PARTITION
- const int leaf_nodes = 1024;
- const int tree_nodes = 1024 + 256 + 64 + 16 + 4 + 1;
-#else
- const int leaf_nodes = 256;
- const int tree_nodes = 256 + 64 + 16 + 4 + 1;
-#endif // CONFIG_EXT_PARTITION
- int index = 0;
- VAR_TREE *this_var;
- int nodes;
-
- aom_free(td->var_tree);
- CHECK_MEM_ERROR(cm, td->var_tree,
- aom_calloc(tree_nodes, sizeof(*td->var_tree)));
-
- this_var = &td->var_tree[0];
-
- // Sets up all the leaf nodes in the tree.
- for (index = 0; index < leaf_nodes; ++index) {
- VAR_TREE *const leaf = &td->var_tree[index];
- leaf->split[0] = NULL;
- }
-
- // Each node has 4 leaf nodes, fill in the child pointers
- // from leafs to the root.
- for (nodes = leaf_nodes >> 2; nodes > 0; nodes >>= 2) {
- for (i = 0; i < nodes; ++i, ++index) {
- VAR_TREE *const node = &td->var_tree[index];
- for (j = 0; j < 4; j++) node->split[j] = this_var++;
- }
- }
-
- // Set up the root node for the largest superblock size
- i = MAX_MIB_SIZE_LOG2 - MIN_MIB_SIZE_LOG2;
- td->var_root[i] = &td->var_tree[tree_nodes - 1];
- // Set up the root nodes for the rest of the possible superblock sizes
- while (--i >= 0) {
- td->var_root[i] = td->var_root[i + 1]->split[0];
- }
-}
-
-void av1_free_var_tree(ThreadData *td) {
- aom_free(td->var_tree);
- td->var_tree = NULL;
-}
diff --git a/third_party/aom/av1/encoder/variance_tree.h b/third_party/aom/av1/encoder/variance_tree.h
deleted file mode 100644
index a9f27302e..000000000
--- a/third_party/aom/av1/encoder/variance_tree.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved
- *
- * This source code is subject to the terms of the BSD 2 Clause License and
- * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
- * was not distributed with this source code in the LICENSE file, you can
- * obtain it at www.aomedia.org/license/software. If the Alliance for Open
- * Media Patent License 1.0 was not distributed with this source code in the
- * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
- */
-
-#ifndef AV1_ENCODER_VARIANCE_TREE_H_
-#define AV1_ENCODER_VARIANCE_TREE_H_
-
-#include <assert.h>
-
-#include "./aom_config.h"
-
-#include "aom/aom_integer.h"
-
-#include "av1/common/enums.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct AV1Common;
-struct ThreadData;
-
-typedef struct {
- int64_t sum_square_error;
- int64_t sum_error;
- int log2_count;
- int variance;
-} VAR;
-
-typedef struct {
- VAR none;
- VAR horz[2];
- VAR vert[2];
-} partition_variance;
-
-typedef struct VAR_TREE {
- int force_split;
- partition_variance variances;
- struct VAR_TREE *split[4];
- BLOCK_SIZE bsize;
- const uint8_t *src;
- const uint8_t *ref;
- int src_stride;
- int ref_stride;
- int width;
- int height;
-#if CONFIG_HIGHBITDEPTH
- int highbd;
-#endif // CONFIG_HIGHBITDEPTH
-} VAR_TREE;
-
-void av1_setup_var_tree(struct AV1Common *cm, struct ThreadData *td);
-void av1_free_var_tree(struct ThreadData *td);
-
-// Set variance values given sum square error, sum error, count.
-static INLINE void fill_variance(int64_t s2, int64_t s, int c, VAR *v) {
- v->sum_square_error = s2;
- v->sum_error = s;
- v->log2_count = c;
- v->variance =
- (int)(256 * (v->sum_square_error -
- ((v->sum_error * v->sum_error) >> v->log2_count)) >>
- v->log2_count);
-}
-
-static INLINE void sum_2_variances(const VAR *a, const VAR *b, VAR *r) {
- assert(a->log2_count == b->log2_count);
- fill_variance(a->sum_square_error + b->sum_square_error,
- a->sum_error + b->sum_error, a->log2_count + 1, r);
-}
-
-static INLINE void fill_variance_node(VAR_TREE *vt) {
- sum_2_variances(&vt->split[0]->variances.none, &vt->split[1]->variances.none,
- &vt->variances.horz[0]);
- sum_2_variances(&vt->split[2]->variances.none, &vt->split[3]->variances.none,
- &vt->variances.horz[1]);
- sum_2_variances(&vt->split[0]->variances.none, &vt->split[2]->variances.none,
- &vt->variances.vert[0]);
- sum_2_variances(&vt->split[1]->variances.none, &vt->split[3]->variances.none,
- &vt->variances.vert[1]);
- sum_2_variances(&vt->variances.vert[0], &vt->variances.vert[1],
- &vt->variances.none);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif /* AV1_ENCODER_VARIANCE_TREE_H_ */
diff --git a/third_party/aom/av1/encoder/x86/av1_quantize_sse2.c b/third_party/aom/av1/encoder/x86/av1_quantize_sse2.c
index f9c95b6cb..190317389 100644
--- a/third_party/aom/av1/encoder/x86/av1_quantize_sse2.c
+++ b/third_party/aom/av1/encoder/x86/av1_quantize_sse2.c
@@ -15,13 +15,65 @@
#include "./av1_rtcd.h"
#include "aom/aom_integer.h"
-void av1_quantize_fp_sse2(const int16_t *coeff_ptr, intptr_t n_coeffs,
+static INLINE void read_coeff(const tran_low_t *coeff, intptr_t offset,
+ __m128i *c0, __m128i *c1) {
+ const tran_low_t *addr = coeff + offset;
+#if CONFIG_HIGHBITDEPTH
+ const __m128i x0 = _mm_load_si128((const __m128i *)addr);
+ const __m128i x1 = _mm_load_si128((const __m128i *)addr + 1);
+ const __m128i x2 = _mm_load_si128((const __m128i *)addr + 2);
+ const __m128i x3 = _mm_load_si128((const __m128i *)addr + 3);
+ *c0 = _mm_packs_epi32(x0, x1);
+ *c1 = _mm_packs_epi32(x2, x3);
+#else
+ *c0 = _mm_load_si128((const __m128i *)addr);
+ *c1 = _mm_load_si128((const __m128i *)addr + 1);
+#endif
+}
+
+static INLINE void write_qcoeff(const __m128i *qc0, const __m128i *qc1,
+ tran_low_t *qcoeff, intptr_t offset) {
+ tran_low_t *addr = qcoeff + offset;
+#if CONFIG_HIGHBITDEPTH
+ const __m128i zero = _mm_setzero_si128();
+ __m128i sign_bits = _mm_cmplt_epi16(*qc0, zero);
+ __m128i y0 = _mm_unpacklo_epi16(*qc0, sign_bits);
+ __m128i y1 = _mm_unpackhi_epi16(*qc0, sign_bits);
+ _mm_store_si128((__m128i *)addr, y0);
+ _mm_store_si128((__m128i *)addr + 1, y1);
+
+ sign_bits = _mm_cmplt_epi16(*qc1, zero);
+ y0 = _mm_unpacklo_epi16(*qc1, sign_bits);
+ y1 = _mm_unpackhi_epi16(*qc1, sign_bits);
+ _mm_store_si128((__m128i *)addr + 2, y0);
+ _mm_store_si128((__m128i *)addr + 3, y1);
+#else
+ _mm_store_si128((__m128i *)addr, *qc0);
+ _mm_store_si128((__m128i *)addr + 1, *qc1);
+#endif
+}
+
+static INLINE void write_zero(tran_low_t *qcoeff, intptr_t offset) {
+ const __m128i zero = _mm_setzero_si128();
+ tran_low_t *addr = qcoeff + offset;
+#if CONFIG_HIGHBITDEPTH
+ _mm_store_si128((__m128i *)addr, zero);
+ _mm_store_si128((__m128i *)addr + 1, zero);
+ _mm_store_si128((__m128i *)addr + 2, zero);
+ _mm_store_si128((__m128i *)addr + 3, zero);
+#else
+ _mm_store_si128((__m128i *)addr, zero);
+ _mm_store_si128((__m128i *)addr + 1, zero);
+#endif
+}
+
+void av1_quantize_fp_sse2(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, int16_t *qcoeff_ptr,
- int16_t *dqcoeff_ptr, const int16_t *dequant_ptr,
- uint16_t *eob_ptr, const int16_t *scan_ptr,
- const int16_t *iscan_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_ptr, const int16_t *iscan_ptr) {
__m128i zero;
__m128i thr;
int16_t nzflag;
@@ -54,8 +106,7 @@ void av1_quantize_fp_sse2(const int16_t *coeff_ptr, intptr_t n_coeffs,
__m128i qcoeff0, qcoeff1;
__m128i qtmp0, qtmp1;
// Do DC and first 15 AC
- coeff0 = _mm_load_si128((const __m128i *)(coeff_ptr + n_coeffs));
- coeff1 = _mm_load_si128((const __m128i *)(coeff_ptr + n_coeffs) + 1);
+ read_coeff(coeff_ptr, n_coeffs, &coeff0, &coeff1);
// Poor man's sign extract
coeff0_sign = _mm_srai_epi16(coeff0, 15);
@@ -78,15 +129,13 @@ void av1_quantize_fp_sse2(const int16_t *coeff_ptr, intptr_t n_coeffs,
qcoeff0 = _mm_sub_epi16(qcoeff0, coeff0_sign);
qcoeff1 = _mm_sub_epi16(qcoeff1, coeff1_sign);
- _mm_store_si128((__m128i *)(qcoeff_ptr + n_coeffs), qcoeff0);
- _mm_store_si128((__m128i *)(qcoeff_ptr + n_coeffs) + 1, qcoeff1);
+ write_qcoeff(&qcoeff0, &qcoeff1, qcoeff_ptr, n_coeffs);
coeff0 = _mm_mullo_epi16(qcoeff0, dequant);
dequant = _mm_unpackhi_epi64(dequant, dequant);
coeff1 = _mm_mullo_epi16(qcoeff1, dequant);
- _mm_store_si128((__m128i *)(dqcoeff_ptr + n_coeffs), coeff0);
- _mm_store_si128((__m128i *)(dqcoeff_ptr + n_coeffs) + 1, coeff1);
+ write_qcoeff(&coeff0, &coeff1, dqcoeff_ptr, n_coeffs);
}
{
@@ -121,8 +170,7 @@ void av1_quantize_fp_sse2(const int16_t *coeff_ptr, intptr_t n_coeffs,
__m128i qcoeff0, qcoeff1;
__m128i qtmp0, qtmp1;
- coeff0 = _mm_load_si128((const __m128i *)(coeff_ptr + n_coeffs));
- coeff1 = _mm_load_si128((const __m128i *)(coeff_ptr + n_coeffs) + 1);
+ read_coeff(coeff_ptr, n_coeffs, &coeff0, &coeff1);
// Poor man's sign extract
coeff0_sign = _mm_srai_epi16(coeff0, 15);
@@ -147,20 +195,15 @@ void av1_quantize_fp_sse2(const int16_t *coeff_ptr, intptr_t n_coeffs,
qcoeff0 = _mm_sub_epi16(qcoeff0, coeff0_sign);
qcoeff1 = _mm_sub_epi16(qcoeff1, coeff1_sign);
- _mm_store_si128((__m128i *)(qcoeff_ptr + n_coeffs), qcoeff0);
- _mm_store_si128((__m128i *)(qcoeff_ptr + n_coeffs) + 1, qcoeff1);
+ write_qcoeff(&qcoeff0, &qcoeff1, qcoeff_ptr, n_coeffs);
coeff0 = _mm_mullo_epi16(qcoeff0, dequant);
coeff1 = _mm_mullo_epi16(qcoeff1, dequant);
- _mm_store_si128((__m128i *)(dqcoeff_ptr + n_coeffs), coeff0);
- _mm_store_si128((__m128i *)(dqcoeff_ptr + n_coeffs) + 1, coeff1);
+ write_qcoeff(&coeff0, &coeff1, dqcoeff_ptr, n_coeffs);
} else {
- _mm_store_si128((__m128i *)(qcoeff_ptr + n_coeffs), zero);
- _mm_store_si128((__m128i *)(qcoeff_ptr + n_coeffs) + 1, zero);
-
- _mm_store_si128((__m128i *)(dqcoeff_ptr + n_coeffs), zero);
- _mm_store_si128((__m128i *)(dqcoeff_ptr + n_coeffs) + 1, zero);
+ write_zero(qcoeff_ptr, n_coeffs);
+ write_zero(dqcoeff_ptr, n_coeffs);
}
}
@@ -200,10 +243,8 @@ void av1_quantize_fp_sse2(const int16_t *coeff_ptr, intptr_t n_coeffs,
}
} else {
do {
- _mm_store_si128((__m128i *)(dqcoeff_ptr + n_coeffs), zero);
- _mm_store_si128((__m128i *)(dqcoeff_ptr + n_coeffs) + 1, zero);
- _mm_store_si128((__m128i *)(qcoeff_ptr + n_coeffs), zero);
- _mm_store_si128((__m128i *)(qcoeff_ptr + n_coeffs) + 1, zero);
+ write_zero(dqcoeff_ptr, n_coeffs);
+ write_zero(qcoeff_ptr, n_coeffs);
n_coeffs += 8 * 2;
} while (n_coeffs < 0);
*eob_ptr = 0;
diff --git a/third_party/aom/av1/encoder/x86/corner_match_sse4.c b/third_party/aom/av1/encoder/x86/corner_match_sse4.c
new file mode 100644
index 000000000..179da0d28
--- /dev/null
+++ b/third_party/aom/av1/encoder/x86/corner_match_sse4.c
@@ -0,0 +1,91 @@
+#include <stdlib.h>
+#include <memory.h>
+#include <math.h>
+#include <assert.h>
+
+#include <smmintrin.h>
+
+#include "./av1_rtcd.h"
+#include "aom_ports/mem.h"
+#include "av1/encoder/corner_match.h"
+
+DECLARE_ALIGNED(16, static const uint8_t, byte_mask[16]) = {
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0
+};
+#if MATCH_SZ != 13
+#error "Need to change byte_mask in corner_match_sse4.c if MATCH_SZ != 13"
+#endif
+
+/* Compute corr(im1, im2) * MATCH_SZ * stddev(im1), where the
+ correlation/standard deviation are taken over MATCH_SZ by MATCH_SZ windows
+ of each image, centered at (x1, y1) and (x2, y2) respectively.
+*/
+double compute_cross_correlation_sse4_1(unsigned char *im1, int stride1, int x1,
+ int y1, unsigned char *im2, int stride2,
+ int x2, int y2) {
+ int i;
+ // 2 16-bit partial sums in lanes 0, 4 (== 2 32-bit partial sums in lanes 0,
+ // 2)
+ __m128i sum1_vec = _mm_setzero_si128();
+ __m128i sum2_vec = _mm_setzero_si128();
+ // 4 32-bit partial sums of squares
+ __m128i sumsq2_vec = _mm_setzero_si128();
+ __m128i cross_vec = _mm_setzero_si128();
+
+ const __m128i mask = _mm_load_si128((__m128i *)byte_mask);
+ const __m128i zero = _mm_setzero_si128();
+
+ im1 += (y1 - MATCH_SZ_BY2) * stride1 + (x1 - MATCH_SZ_BY2);
+ im2 += (y2 - MATCH_SZ_BY2) * stride2 + (x2 - MATCH_SZ_BY2);
+
+ for (i = 0; i < MATCH_SZ; ++i) {
+ const __m128i v1 =
+ _mm_and_si128(_mm_loadu_si128((__m128i *)&im1[i * stride1]), mask);
+ const __m128i v2 =
+ _mm_and_si128(_mm_loadu_si128((__m128i *)&im2[i * stride2]), mask);
+
+ // Using the 'sad' intrinsic here is a bit faster than adding
+ // v1_l + v1_r and v2_l + v2_r, plus it avoids the need for a 16->32 bit
+ // conversion step later, for a net speedup of ~10%
+ sum1_vec = _mm_add_epi16(sum1_vec, _mm_sad_epu8(v1, zero));
+ sum2_vec = _mm_add_epi16(sum2_vec, _mm_sad_epu8(v2, zero));
+
+ const __m128i v1_l = _mm_cvtepu8_epi16(v1);
+ const __m128i v1_r = _mm_cvtepu8_epi16(_mm_srli_si128(v1, 8));
+ const __m128i v2_l = _mm_cvtepu8_epi16(v2);
+ const __m128i v2_r = _mm_cvtepu8_epi16(_mm_srli_si128(v2, 8));
+
+ sumsq2_vec = _mm_add_epi32(
+ sumsq2_vec,
+ _mm_add_epi32(_mm_madd_epi16(v2_l, v2_l), _mm_madd_epi16(v2_r, v2_r)));
+ cross_vec = _mm_add_epi32(
+ cross_vec,
+ _mm_add_epi32(_mm_madd_epi16(v1_l, v2_l), _mm_madd_epi16(v1_r, v2_r)));
+ }
+
+ // Now we can treat the four registers (sum1_vec, sum2_vec, sumsq2_vec,
+ // cross_vec)
+ // as holding 4 32-bit elements each, which we want to sum horizontally.
+ // We do this by transposing and then summing vertically.
+ __m128i tmp_0 = _mm_unpacklo_epi32(sum1_vec, sum2_vec);
+ __m128i tmp_1 = _mm_unpackhi_epi32(sum1_vec, sum2_vec);
+ __m128i tmp_2 = _mm_unpacklo_epi32(sumsq2_vec, cross_vec);
+ __m128i tmp_3 = _mm_unpackhi_epi32(sumsq2_vec, cross_vec);
+
+ __m128i tmp_4 = _mm_unpacklo_epi64(tmp_0, tmp_2);
+ __m128i tmp_5 = _mm_unpackhi_epi64(tmp_0, tmp_2);
+ __m128i tmp_6 = _mm_unpacklo_epi64(tmp_1, tmp_3);
+ __m128i tmp_7 = _mm_unpackhi_epi64(tmp_1, tmp_3);
+
+ __m128i res =
+ _mm_add_epi32(_mm_add_epi32(tmp_4, tmp_5), _mm_add_epi32(tmp_6, tmp_7));
+
+ int sum1 = _mm_extract_epi32(res, 0);
+ int sum2 = _mm_extract_epi32(res, 1);
+ int sumsq2 = _mm_extract_epi32(res, 2);
+ int cross = _mm_extract_epi32(res, 3);
+
+ int var2 = sumsq2 * MATCH_SZ_SQ - sum2 * sum2;
+ int cov = cross * MATCH_SZ_SQ - sum1 * sum2;
+ return cov / sqrt((double)var2);
+}
diff --git a/third_party/aom/av1/encoder/x86/highbd_fwd_txfm_sse4.c b/third_party/aom/av1/encoder/x86/highbd_fwd_txfm_sse4.c
index f201a29aa..b56eed518 100644
--- a/third_party/aom/av1/encoder/x86/highbd_fwd_txfm_sse4.c
+++ b/third_party/aom/av1/encoder/x86/highbd_fwd_txfm_sse4.c
@@ -13,7 +13,7 @@
#include "./av1_rtcd.h"
#include "./aom_config.h"
-#include "av1/common/av1_fwd_txfm2d_cfg.h"
+#include "av1/common/av1_fwd_txfm1d_cfg.h"
#include "av1/common/av1_txfm.h"
#include "av1/common/x86/highbd_txfm_utility_sse4.h"
#include "aom_dsp/txfm_common.h"
@@ -58,7 +58,7 @@ static INLINE void load_buffer_4x4(const int16_t *input, __m128i *in,
// shift[1] is used in txfm_func_col()
// shift[2] is used in txfm_func_row()
static void fdct4x4_sse4_1(__m128i *in, int bit) {
- const int32_t *cospi = cospi_arr[bit - cos_bit_min];
+ const int32_t *cospi = cospi_arr(bit);
const __m128i cospi32 = _mm_set1_epi32(cospi[32]);
const __m128i cospi48 = _mm_set1_epi32(cospi[48]);
const __m128i cospi16 = _mm_set1_epi32(cospi[16]);
@@ -133,7 +133,7 @@ void av1_highbd_fht4x4_sse4_1(const int16_t *input, tran_low_t *output,
}
static void fadst4x4_sse4_1(__m128i *in, int bit) {
- const int32_t *cospi = cospi_arr[bit - cos_bit_min];
+ const int32_t *cospi = cospi_arr(bit);
const __m128i cospi8 = _mm_set1_epi32(cospi[8]);
const __m128i cospi56 = _mm_set1_epi32(cospi[56]);
const __m128i cospi40 = _mm_set1_epi32(cospi[40]);
@@ -209,71 +209,81 @@ static void fadst4x4_sse4_1(__m128i *in, int bit) {
void av1_fwd_txfm2d_4x4_sse4_1(const int16_t *input, int32_t *coeff,
int input_stride, int tx_type, int bd) {
__m128i in[4];
- const TXFM_2D_CFG *cfg = NULL;
+ const TXFM_1D_CFG *row_cfg = NULL;
+ const TXFM_1D_CFG *col_cfg = NULL;
switch (tx_type) {
case DCT_DCT:
- cfg = &fwd_txfm_2d_cfg_dct_dct_4;
- load_buffer_4x4(input, in, input_stride, 0, 0, cfg->shift[0]);
- fdct4x4_sse4_1(in, cfg->cos_bit_col[2]);
- fdct4x4_sse4_1(in, cfg->cos_bit_row[2]);
+ row_cfg = &fwd_txfm_1d_row_cfg_dct_4;
+ col_cfg = &fwd_txfm_1d_col_cfg_dct_4;
+ load_buffer_4x4(input, in, input_stride, 0, 0, row_cfg->shift[0]);
+ fdct4x4_sse4_1(in, col_cfg->cos_bit[2]);
+ fdct4x4_sse4_1(in, row_cfg->cos_bit[2]);
write_buffer_4x4(in, coeff);
break;
case ADST_DCT:
- cfg = &fwd_txfm_2d_cfg_adst_dct_4;
- load_buffer_4x4(input, in, input_stride, 0, 0, cfg->shift[0]);
- fadst4x4_sse4_1(in, cfg->cos_bit_col[2]);
- fdct4x4_sse4_1(in, cfg->cos_bit_row[2]);
+ row_cfg = &fwd_txfm_1d_row_cfg_dct_4;
+ col_cfg = &fwd_txfm_1d_col_cfg_adst_4;
+ load_buffer_4x4(input, in, input_stride, 0, 0, row_cfg->shift[0]);
+ fadst4x4_sse4_1(in, col_cfg->cos_bit[2]);
+ fdct4x4_sse4_1(in, row_cfg->cos_bit[2]);
write_buffer_4x4(in, coeff);
break;
case DCT_ADST:
- cfg = &fwd_txfm_2d_cfg_dct_adst_4;
- load_buffer_4x4(input, in, input_stride, 0, 0, cfg->shift[0]);
- fdct4x4_sse4_1(in, cfg->cos_bit_col[2]);
- fadst4x4_sse4_1(in, cfg->cos_bit_row[2]);
+ row_cfg = &fwd_txfm_1d_row_cfg_adst_4;
+ col_cfg = &fwd_txfm_1d_col_cfg_dct_4;
+ load_buffer_4x4(input, in, input_stride, 0, 0, row_cfg->shift[0]);
+ fdct4x4_sse4_1(in, col_cfg->cos_bit[2]);
+ fadst4x4_sse4_1(in, row_cfg->cos_bit[2]);
write_buffer_4x4(in, coeff);
break;
case ADST_ADST:
- cfg = &fwd_txfm_2d_cfg_adst_adst_4;
- load_buffer_4x4(input, in, input_stride, 0, 0, cfg->shift[0]);
- fadst4x4_sse4_1(in, cfg->cos_bit_col[2]);
- fadst4x4_sse4_1(in, cfg->cos_bit_row[2]);
+ row_cfg = &fwd_txfm_1d_row_cfg_adst_4;
+ col_cfg = &fwd_txfm_1d_col_cfg_adst_4;
+ load_buffer_4x4(input, in, input_stride, 0, 0, row_cfg->shift[0]);
+ fadst4x4_sse4_1(in, col_cfg->cos_bit[2]);
+ fadst4x4_sse4_1(in, row_cfg->cos_bit[2]);
write_buffer_4x4(in, coeff);
break;
#if CONFIG_EXT_TX
case FLIPADST_DCT:
- cfg = &fwd_txfm_2d_cfg_adst_dct_4;
- load_buffer_4x4(input, in, input_stride, 1, 0, cfg->shift[0]);
- fadst4x4_sse4_1(in, cfg->cos_bit_col[2]);
- fdct4x4_sse4_1(in, cfg->cos_bit_row[2]);
+ row_cfg = &fwd_txfm_1d_row_cfg_dct_4;
+ col_cfg = &fwd_txfm_1d_col_cfg_adst_4;
+ load_buffer_4x4(input, in, input_stride, 1, 0, row_cfg->shift[0]);
+ fadst4x4_sse4_1(in, col_cfg->cos_bit[2]);
+ fdct4x4_sse4_1(in, row_cfg->cos_bit[2]);
write_buffer_4x4(in, coeff);
break;
case DCT_FLIPADST:
- cfg = &fwd_txfm_2d_cfg_dct_adst_4;
- load_buffer_4x4(input, in, input_stride, 0, 1, cfg->shift[0]);
- fdct4x4_sse4_1(in, cfg->cos_bit_col[2]);
- fadst4x4_sse4_1(in, cfg->cos_bit_row[2]);
+ row_cfg = &fwd_txfm_1d_row_cfg_adst_4;
+ col_cfg = &fwd_txfm_1d_col_cfg_dct_4;
+ load_buffer_4x4(input, in, input_stride, 0, 1, row_cfg->shift[0]);
+ fdct4x4_sse4_1(in, col_cfg->cos_bit[2]);
+ fadst4x4_sse4_1(in, row_cfg->cos_bit[2]);
write_buffer_4x4(in, coeff);
break;
case FLIPADST_FLIPADST:
- cfg = &fwd_txfm_2d_cfg_adst_adst_4;
- load_buffer_4x4(input, in, input_stride, 1, 1, cfg->shift[0]);
- fadst4x4_sse4_1(in, cfg->cos_bit_col[2]);
- fadst4x4_sse4_1(in, cfg->cos_bit_row[2]);
+ row_cfg = &fwd_txfm_1d_row_cfg_adst_4;
+ col_cfg = &fwd_txfm_1d_col_cfg_adst_4;
+ load_buffer_4x4(input, in, input_stride, 1, 1, row_cfg->shift[0]);
+ fadst4x4_sse4_1(in, col_cfg->cos_bit[2]);
+ fadst4x4_sse4_1(in, row_cfg->cos_bit[2]);
write_buffer_4x4(in, coeff);
break;
case ADST_FLIPADST:
- cfg = &fwd_txfm_2d_cfg_adst_adst_4;
- load_buffer_4x4(input, in, input_stride, 0, 1, cfg->shift[0]);
- fadst4x4_sse4_1(in, cfg->cos_bit_col[2]);
- fadst4x4_sse4_1(in, cfg->cos_bit_row[2]);
+ row_cfg = &fwd_txfm_1d_row_cfg_adst_4;
+ col_cfg = &fwd_txfm_1d_col_cfg_adst_4;
+ load_buffer_4x4(input, in, input_stride, 0, 1, row_cfg->shift[0]);
+ fadst4x4_sse4_1(in, col_cfg->cos_bit[2]);
+ fadst4x4_sse4_1(in, row_cfg->cos_bit[2]);
write_buffer_4x4(in, coeff);
break;
case FLIPADST_ADST:
- cfg = &fwd_txfm_2d_cfg_adst_adst_4;
- load_buffer_4x4(input, in, input_stride, 1, 0, cfg->shift[0]);
- fadst4x4_sse4_1(in, cfg->cos_bit_col[2]);
- fadst4x4_sse4_1(in, cfg->cos_bit_row[2]);
+ row_cfg = &fwd_txfm_1d_row_cfg_adst_4;
+ col_cfg = &fwd_txfm_1d_col_cfg_adst_4;
+ load_buffer_4x4(input, in, input_stride, 1, 0, row_cfg->shift[0]);
+ fadst4x4_sse4_1(in, col_cfg->cos_bit[2]);
+ fadst4x4_sse4_1(in, row_cfg->cos_bit[2]);
write_buffer_4x4(in, coeff);
break;
#endif
@@ -429,7 +439,7 @@ static INLINE void write_buffer_8x8(const __m128i *res, tran_low_t *output) {
}
static void fdct8x8_sse4_1(__m128i *in, __m128i *out, int bit) {
- const int32_t *cospi = cospi_arr[bit - cos_bit_min];
+ const int32_t *cospi = cospi_arr(bit);
const __m128i cospi32 = _mm_set1_epi32(cospi[32]);
const __m128i cospim32 = _mm_set1_epi32(-cospi[32]);
const __m128i cospi48 = _mm_set1_epi32(cospi[48]);
@@ -625,7 +635,7 @@ static void fdct8x8_sse4_1(__m128i *in, __m128i *out, int bit) {
}
static void fadst8x8_sse4_1(__m128i *in, __m128i *out, int bit) {
- const int32_t *cospi = cospi_arr[bit - cos_bit_min];
+ const int32_t *cospi = cospi_arr(bit);
const __m128i cospi4 = _mm_set1_epi32(cospi[4]);
const __m128i cospi60 = _mm_set1_epi32(cospi[60]);
const __m128i cospi20 = _mm_set1_epi32(cospi[20]);
@@ -930,97 +940,107 @@ static void fadst8x8_sse4_1(__m128i *in, __m128i *out, int bit) {
void av1_fwd_txfm2d_8x8_sse4_1(const int16_t *input, int32_t *coeff, int stride,
int tx_type, int bd) {
__m128i in[16], out[16];
- const TXFM_2D_CFG *cfg = NULL;
+ const TXFM_1D_CFG *row_cfg = NULL;
+ const TXFM_1D_CFG *col_cfg = NULL;
switch (tx_type) {
case DCT_DCT:
- cfg = &fwd_txfm_2d_cfg_dct_dct_8;
- load_buffer_8x8(input, in, stride, 0, 0, cfg->shift[0]);
- fdct8x8_sse4_1(in, out, cfg->cos_bit_col[2]);
- col_txfm_8x8_rounding(out, -cfg->shift[1]);
+ row_cfg = &fwd_txfm_1d_row_cfg_dct_8;
+ col_cfg = &fwd_txfm_1d_col_cfg_dct_8;
+ load_buffer_8x8(input, in, stride, 0, 0, row_cfg->shift[0]);
+ fdct8x8_sse4_1(in, out, col_cfg->cos_bit[2]);
+ col_txfm_8x8_rounding(out, -row_cfg->shift[1]);
transpose_8x8(out, in);
- fdct8x8_sse4_1(in, out, cfg->cos_bit_row[2]);
+ fdct8x8_sse4_1(in, out, row_cfg->cos_bit[2]);
transpose_8x8(out, in);
write_buffer_8x8(in, coeff);
break;
case ADST_DCT:
- cfg = &fwd_txfm_2d_cfg_adst_dct_8;
- load_buffer_8x8(input, in, stride, 0, 0, cfg->shift[0]);
- fadst8x8_sse4_1(in, out, cfg->cos_bit_col[2]);
- col_txfm_8x8_rounding(out, -cfg->shift[1]);
+ row_cfg = &fwd_txfm_1d_row_cfg_dct_8;
+ col_cfg = &fwd_txfm_1d_col_cfg_adst_8;
+ load_buffer_8x8(input, in, stride, 0, 0, row_cfg->shift[0]);
+ fadst8x8_sse4_1(in, out, col_cfg->cos_bit[2]);
+ col_txfm_8x8_rounding(out, -row_cfg->shift[1]);
transpose_8x8(out, in);
- fdct8x8_sse4_1(in, out, cfg->cos_bit_row[2]);
+ fdct8x8_sse4_1(in, out, row_cfg->cos_bit[2]);
transpose_8x8(out, in);
write_buffer_8x8(in, coeff);
break;
case DCT_ADST:
- cfg = &fwd_txfm_2d_cfg_dct_adst_8;
- load_buffer_8x8(input, in, stride, 0, 0, cfg->shift[0]);
- fdct8x8_sse4_1(in, out, cfg->cos_bit_col[2]);
- col_txfm_8x8_rounding(out, -cfg->shift[1]);
+ row_cfg = &fwd_txfm_1d_row_cfg_adst_8;
+ col_cfg = &fwd_txfm_1d_col_cfg_dct_8;
+ load_buffer_8x8(input, in, stride, 0, 0, row_cfg->shift[0]);
+ fdct8x8_sse4_1(in, out, col_cfg->cos_bit[2]);
+ col_txfm_8x8_rounding(out, -row_cfg->shift[1]);
transpose_8x8(out, in);
- fadst8x8_sse4_1(in, out, cfg->cos_bit_row[2]);
+ fadst8x8_sse4_1(in, out, row_cfg->cos_bit[2]);
transpose_8x8(out, in);
write_buffer_8x8(in, coeff);
break;
case ADST_ADST:
- cfg = &fwd_txfm_2d_cfg_adst_adst_8;
- load_buffer_8x8(input, in, stride, 0, 0, cfg->shift[0]);
- fadst8x8_sse4_1(in, out, cfg->cos_bit_col[2]);
- col_txfm_8x8_rounding(out, -cfg->shift[1]);
+ row_cfg = &fwd_txfm_1d_row_cfg_adst_8;
+ col_cfg = &fwd_txfm_1d_col_cfg_adst_8;
+ load_buffer_8x8(input, in, stride, 0, 0, row_cfg->shift[0]);
+ fadst8x8_sse4_1(in, out, col_cfg->cos_bit[2]);
+ col_txfm_8x8_rounding(out, -row_cfg->shift[1]);
transpose_8x8(out, in);
- fadst8x8_sse4_1(in, out, cfg->cos_bit_row[2]);
+ fadst8x8_sse4_1(in, out, row_cfg->cos_bit[2]);
transpose_8x8(out, in);
write_buffer_8x8(in, coeff);
break;
#if CONFIG_EXT_TX
case FLIPADST_DCT:
- cfg = &fwd_txfm_2d_cfg_adst_dct_8;
- load_buffer_8x8(input, in, stride, 1, 0, cfg->shift[0]);
- fadst8x8_sse4_1(in, out, cfg->cos_bit_col[2]);
- col_txfm_8x8_rounding(out, -cfg->shift[1]);
+ row_cfg = &fwd_txfm_1d_row_cfg_dct_8;
+ col_cfg = &fwd_txfm_1d_col_cfg_adst_8;
+ load_buffer_8x8(input, in, stride, 1, 0, row_cfg->shift[0]);
+ fadst8x8_sse4_1(in, out, col_cfg->cos_bit[2]);
+ col_txfm_8x8_rounding(out, -row_cfg->shift[1]);
transpose_8x8(out, in);
- fdct8x8_sse4_1(in, out, cfg->cos_bit_row[2]);
+ fdct8x8_sse4_1(in, out, row_cfg->cos_bit[2]);
transpose_8x8(out, in);
write_buffer_8x8(in, coeff);
break;
case DCT_FLIPADST:
- cfg = &fwd_txfm_2d_cfg_dct_adst_8;
- load_buffer_8x8(input, in, stride, 0, 1, cfg->shift[0]);
- fdct8x8_sse4_1(in, out, cfg->cos_bit_col[2]);
- col_txfm_8x8_rounding(out, -cfg->shift[1]);
+ row_cfg = &fwd_txfm_1d_row_cfg_adst_8;
+ col_cfg = &fwd_txfm_1d_col_cfg_dct_8;
+ load_buffer_8x8(input, in, stride, 0, 1, row_cfg->shift[0]);
+ fdct8x8_sse4_1(in, out, col_cfg->cos_bit[2]);
+ col_txfm_8x8_rounding(out, -row_cfg->shift[1]);
transpose_8x8(out, in);
- fadst8x8_sse4_1(in, out, cfg->cos_bit_row[2]);
+ fadst8x8_sse4_1(in, out, row_cfg->cos_bit[2]);
transpose_8x8(out, in);
write_buffer_8x8(in, coeff);
break;
case FLIPADST_FLIPADST:
- cfg = &fwd_txfm_2d_cfg_adst_adst_8;
- load_buffer_8x8(input, in, stride, 1, 1, cfg->shift[0]);
- fadst8x8_sse4_1(in, out, cfg->cos_bit_col[2]);
- col_txfm_8x8_rounding(out, -cfg->shift[1]);
+ row_cfg = &fwd_txfm_1d_row_cfg_adst_8;
+ col_cfg = &fwd_txfm_1d_col_cfg_adst_8;
+ load_buffer_8x8(input, in, stride, 1, 1, row_cfg->shift[0]);
+ fadst8x8_sse4_1(in, out, col_cfg->cos_bit[2]);
+ col_txfm_8x8_rounding(out, -row_cfg->shift[1]);
transpose_8x8(out, in);
- fadst8x8_sse4_1(in, out, cfg->cos_bit_row[2]);
+ fadst8x8_sse4_1(in, out, row_cfg->cos_bit[2]);
transpose_8x8(out, in);
write_buffer_8x8(in, coeff);
break;
case ADST_FLIPADST:
- cfg = &fwd_txfm_2d_cfg_adst_adst_8;
- load_buffer_8x8(input, in, stride, 0, 1, cfg->shift[0]);
- fadst8x8_sse4_1(in, out, cfg->cos_bit_col[2]);
- col_txfm_8x8_rounding(out, -cfg->shift[1]);
+ row_cfg = &fwd_txfm_1d_row_cfg_adst_8;
+ col_cfg = &fwd_txfm_1d_col_cfg_adst_8;
+ load_buffer_8x8(input, in, stride, 0, 1, row_cfg->shift[0]);
+ fadst8x8_sse4_1(in, out, col_cfg->cos_bit[2]);
+ col_txfm_8x8_rounding(out, -row_cfg->shift[1]);
transpose_8x8(out, in);
- fadst8x8_sse4_1(in, out, cfg->cos_bit_row[2]);
+ fadst8x8_sse4_1(in, out, row_cfg->cos_bit[2]);
transpose_8x8(out, in);
write_buffer_8x8(in, coeff);
break;
case FLIPADST_ADST:
- cfg = &fwd_txfm_2d_cfg_adst_adst_8;
- load_buffer_8x8(input, in, stride, 1, 0, cfg->shift[0]);
- fadst8x8_sse4_1(in, out, cfg->cos_bit_col[2]);
- col_txfm_8x8_rounding(out, -cfg->shift[1]);
+ row_cfg = &fwd_txfm_1d_row_cfg_adst_8;
+ col_cfg = &fwd_txfm_1d_col_cfg_adst_8;
+ load_buffer_8x8(input, in, stride, 1, 0, row_cfg->shift[0]);
+ fadst8x8_sse4_1(in, out, col_cfg->cos_bit[2]);
+ col_txfm_8x8_rounding(out, -row_cfg->shift[1]);
transpose_8x8(out, in);
- fadst8x8_sse4_1(in, out, cfg->cos_bit_row[2]);
+ fadst8x8_sse4_1(in, out, row_cfg->cos_bit[2]);
transpose_8x8(out, in);
write_buffer_8x8(in, coeff);
break;
@@ -1107,7 +1127,7 @@ static INLINE void load_buffer_16x16(const int16_t *input, __m128i *out,
}
static void fdct16x16_sse4_1(__m128i *in, __m128i *out, int bit) {
- const int32_t *cospi = cospi_arr[bit - cos_bit_min];
+ const int32_t *cospi = cospi_arr(bit);
const __m128i cospi32 = _mm_set1_epi32(cospi[32]);
const __m128i cospim32 = _mm_set1_epi32(-cospi[32]);
const __m128i cospi48 = _mm_set1_epi32(cospi[48]);
@@ -1393,7 +1413,7 @@ static void fdct16x16_sse4_1(__m128i *in, __m128i *out, int bit) {
}
static void fadst16x16_sse4_1(__m128i *in, __m128i *out, int bit) {
- const int32_t *cospi = cospi_arr[bit - cos_bit_min];
+ const int32_t *cospi = cospi_arr(bit);
const __m128i cospi2 = _mm_set1_epi32(cospi[2]);
const __m128i cospi62 = _mm_set1_epi32(cospi[62]);
const __m128i cospi10 = _mm_set1_epi32(cospi[10]);
@@ -1794,97 +1814,107 @@ static void write_buffer_16x16(const __m128i *in, tran_low_t *output) {
void av1_fwd_txfm2d_16x16_sse4_1(const int16_t *input, int32_t *coeff,
int stride, int tx_type, int bd) {
__m128i in[64], out[64];
- const TXFM_2D_CFG *cfg = NULL;
+ const TXFM_1D_CFG *row_cfg = NULL;
+ const TXFM_1D_CFG *col_cfg = NULL;
switch (tx_type) {
case DCT_DCT:
- cfg = &fwd_txfm_2d_cfg_dct_dct_16;
- load_buffer_16x16(input, in, stride, 0, 0, cfg->shift[0]);
- fdct16x16_sse4_1(in, out, cfg->cos_bit_col[0]);
- col_txfm_16x16_rounding(out, -cfg->shift[1]);
+ row_cfg = &fwd_txfm_1d_row_cfg_dct_16;
+ col_cfg = &fwd_txfm_1d_col_cfg_dct_16;
+ load_buffer_16x16(input, in, stride, 0, 0, row_cfg->shift[0]);
+ fdct16x16_sse4_1(in, out, col_cfg->cos_bit[0]);
+ col_txfm_16x16_rounding(out, -row_cfg->shift[1]);
transpose_16x16(out, in);
- fdct16x16_sse4_1(in, out, cfg->cos_bit_row[0]);
+ fdct16x16_sse4_1(in, out, row_cfg->cos_bit[0]);
transpose_16x16(out, in);
write_buffer_16x16(in, coeff);
break;
case ADST_DCT:
- cfg = &fwd_txfm_2d_cfg_adst_dct_16;
- load_buffer_16x16(input, in, stride, 0, 0, cfg->shift[0]);
- fadst16x16_sse4_1(in, out, cfg->cos_bit_col[0]);
- col_txfm_16x16_rounding(out, -cfg->shift[1]);
+ row_cfg = &fwd_txfm_1d_row_cfg_dct_16;
+ col_cfg = &fwd_txfm_1d_col_cfg_adst_16;
+ load_buffer_16x16(input, in, stride, 0, 0, row_cfg->shift[0]);
+ fadst16x16_sse4_1(in, out, col_cfg->cos_bit[0]);
+ col_txfm_16x16_rounding(out, -row_cfg->shift[1]);
transpose_16x16(out, in);
- fdct16x16_sse4_1(in, out, cfg->cos_bit_row[0]);
+ fdct16x16_sse4_1(in, out, row_cfg->cos_bit[0]);
transpose_16x16(out, in);
write_buffer_16x16(in, coeff);
break;
case DCT_ADST:
- cfg = &fwd_txfm_2d_cfg_dct_adst_16;
- load_buffer_16x16(input, in, stride, 0, 0, cfg->shift[0]);
- fdct16x16_sse4_1(in, out, cfg->cos_bit_col[0]);
- col_txfm_16x16_rounding(out, -cfg->shift[1]);
+ row_cfg = &fwd_txfm_1d_row_cfg_adst_16;
+ col_cfg = &fwd_txfm_1d_col_cfg_dct_16;
+ load_buffer_16x16(input, in, stride, 0, 0, row_cfg->shift[0]);
+ fdct16x16_sse4_1(in, out, col_cfg->cos_bit[0]);
+ col_txfm_16x16_rounding(out, -row_cfg->shift[1]);
transpose_16x16(out, in);
- fadst16x16_sse4_1(in, out, cfg->cos_bit_row[0]);
+ fadst16x16_sse4_1(in, out, row_cfg->cos_bit[0]);
transpose_16x16(out, in);
write_buffer_16x16(in, coeff);
break;
case ADST_ADST:
- cfg = &fwd_txfm_2d_cfg_adst_adst_16;
- load_buffer_16x16(input, in, stride, 0, 0, cfg->shift[0]);
- fadst16x16_sse4_1(in, out, cfg->cos_bit_col[0]);
- col_txfm_16x16_rounding(out, -cfg->shift[1]);
+ row_cfg = &fwd_txfm_1d_row_cfg_adst_16;
+ col_cfg = &fwd_txfm_1d_col_cfg_adst_16;
+ load_buffer_16x16(input, in, stride, 0, 0, row_cfg->shift[0]);
+ fadst16x16_sse4_1(in, out, col_cfg->cos_bit[0]);
+ col_txfm_16x16_rounding(out, -row_cfg->shift[1]);
transpose_16x16(out, in);
- fadst16x16_sse4_1(in, out, cfg->cos_bit_row[0]);
+ fadst16x16_sse4_1(in, out, row_cfg->cos_bit[0]);
transpose_16x16(out, in);
write_buffer_16x16(in, coeff);
break;
#if CONFIG_EXT_TX
case FLIPADST_DCT:
- cfg = &fwd_txfm_2d_cfg_adst_dct_16;
- load_buffer_16x16(input, in, stride, 1, 0, cfg->shift[0]);
- fadst16x16_sse4_1(in, out, cfg->cos_bit_col[0]);
- col_txfm_16x16_rounding(out, -cfg->shift[1]);
+ row_cfg = &fwd_txfm_1d_row_cfg_dct_16;
+ col_cfg = &fwd_txfm_1d_col_cfg_adst_16;
+ load_buffer_16x16(input, in, stride, 1, 0, row_cfg->shift[0]);
+ fadst16x16_sse4_1(in, out, col_cfg->cos_bit[0]);
+ col_txfm_16x16_rounding(out, -row_cfg->shift[1]);
transpose_16x16(out, in);
- fdct16x16_sse4_1(in, out, cfg->cos_bit_row[0]);
+ fdct16x16_sse4_1(in, out, row_cfg->cos_bit[0]);
transpose_16x16(out, in);
write_buffer_16x16(in, coeff);
break;
case DCT_FLIPADST:
- cfg = &fwd_txfm_2d_cfg_dct_adst_16;
- load_buffer_16x16(input, in, stride, 0, 1, cfg->shift[0]);
- fdct16x16_sse4_1(in, out, cfg->cos_bit_col[0]);
- col_txfm_16x16_rounding(out, -cfg->shift[1]);
+ row_cfg = &fwd_txfm_1d_row_cfg_adst_16;
+ col_cfg = &fwd_txfm_1d_col_cfg_dct_16;
+ load_buffer_16x16(input, in, stride, 0, 1, row_cfg->shift[0]);
+ fdct16x16_sse4_1(in, out, col_cfg->cos_bit[0]);
+ col_txfm_16x16_rounding(out, -row_cfg->shift[1]);
transpose_16x16(out, in);
- fadst16x16_sse4_1(in, out, cfg->cos_bit_row[0]);
+ fadst16x16_sse4_1(in, out, row_cfg->cos_bit[0]);
transpose_16x16(out, in);
write_buffer_16x16(in, coeff);
break;
case FLIPADST_FLIPADST:
- cfg = &fwd_txfm_2d_cfg_adst_adst_16;
- load_buffer_16x16(input, in, stride, 1, 1, cfg->shift[0]);
- fadst16x16_sse4_1(in, out, cfg->cos_bit_col[0]);
- col_txfm_16x16_rounding(out, -cfg->shift[1]);
+ row_cfg = &fwd_txfm_1d_row_cfg_adst_16;
+ col_cfg = &fwd_txfm_1d_col_cfg_adst_16;
+ load_buffer_16x16(input, in, stride, 1, 1, row_cfg->shift[0]);
+ fadst16x16_sse4_1(in, out, col_cfg->cos_bit[0]);
+ col_txfm_16x16_rounding(out, -row_cfg->shift[1]);
transpose_16x16(out, in);
- fadst16x16_sse4_1(in, out, cfg->cos_bit_row[0]);
+ fadst16x16_sse4_1(in, out, row_cfg->cos_bit[0]);
transpose_16x16(out, in);
write_buffer_16x16(in, coeff);
break;
case ADST_FLIPADST:
- cfg = &fwd_txfm_2d_cfg_adst_adst_16;
- load_buffer_16x16(input, in, stride, 0, 1, cfg->shift[0]);
- fadst16x16_sse4_1(in, out, cfg->cos_bit_col[0]);
- col_txfm_16x16_rounding(out, -cfg->shift[1]);
+ row_cfg = &fwd_txfm_1d_row_cfg_adst_16;
+ col_cfg = &fwd_txfm_1d_col_cfg_adst_16;
+ load_buffer_16x16(input, in, stride, 0, 1, row_cfg->shift[0]);
+ fadst16x16_sse4_1(in, out, col_cfg->cos_bit[0]);
+ col_txfm_16x16_rounding(out, -row_cfg->shift[1]);
transpose_16x16(out, in);
- fadst16x16_sse4_1(in, out, cfg->cos_bit_row[0]);
+ fadst16x16_sse4_1(in, out, row_cfg->cos_bit[0]);
transpose_16x16(out, in);
write_buffer_16x16(in, coeff);
break;
case FLIPADST_ADST:
- cfg = &fwd_txfm_2d_cfg_adst_adst_16;
- load_buffer_16x16(input, in, stride, 1, 0, cfg->shift[0]);
- fadst16x16_sse4_1(in, out, cfg->cos_bit_col[0]);
- col_txfm_16x16_rounding(out, -cfg->shift[1]);
+ row_cfg = &fwd_txfm_1d_row_cfg_adst_16;
+ col_cfg = &fwd_txfm_1d_col_cfg_adst_16;
+ load_buffer_16x16(input, in, stride, 1, 0, row_cfg->shift[0]);
+ fadst16x16_sse4_1(in, out, col_cfg->cos_bit[0]);
+ col_txfm_16x16_rounding(out, -row_cfg->shift[1]);
transpose_16x16(out, in);
- fadst16x16_sse4_1(in, out, cfg->cos_bit_row[0]);
+ fadst16x16_sse4_1(in, out, row_cfg->cos_bit[0]);
transpose_16x16(out, in);
write_buffer_16x16(in, coeff);
break;
diff --git a/third_party/aom/av1/encoder/x86/hybrid_fwd_txfm_avx2.c b/third_party/aom/av1/encoder/x86/hybrid_fwd_txfm_avx2.c
index 198e4e4c4..8495ad1aa 100644
--- a/third_party/aom/av1/encoder/x86/hybrid_fwd_txfm_avx2.c
+++ b/third_party/aom/av1/encoder/x86/hybrid_fwd_txfm_avx2.c
@@ -269,8 +269,8 @@ static void fdct16_avx2(__m256i *in) {
x0 = _mm256_unpacklo_epi16(v0, v1);
x1 = _mm256_unpackhi_epi16(v0, v1);
- t0 = butter_fly(x0, x1, cospi_p16_p16);
- t1 = butter_fly(x0, x1, cospi_p16_m16);
+ t0 = butter_fly(&x0, &x1, &cospi_p16_p16);
+ t1 = butter_fly(&x0, &x1, &cospi_p16_m16);
// 4, 12
v0 = _mm256_sub_epi16(s1, s2);
@@ -279,8 +279,8 @@ static void fdct16_avx2(__m256i *in) {
x0 = _mm256_unpacklo_epi16(v0, v1);
x1 = _mm256_unpackhi_epi16(v0, v1);
- t2 = butter_fly(x0, x1, cospi_p24_p08);
- t3 = butter_fly(x0, x1, cospi_m08_p24);
+ t2 = butter_fly(&x0, &x1, &cospi_p24_p08);
+ t3 = butter_fly(&x0, &x1, &cospi_m08_p24);
// 2, 6, 10, 14
s0 = _mm256_sub_epi16(u3, u4);
@@ -294,8 +294,8 @@ static void fdct16_avx2(__m256i *in) {
x0 = _mm256_unpacklo_epi16(s2, s1);
x1 = _mm256_unpackhi_epi16(s2, s1);
- v2 = butter_fly(x0, x1, cospi_p16_p16); // output[5]
- v1 = butter_fly(x0, x1, cospi_p16_m16); // output[6]
+ v2 = butter_fly(&x0, &x1, &cospi_p16_p16); // output[5]
+ v1 = butter_fly(&x0, &x1, &cospi_p16_m16); // output[6]
s0 = _mm256_add_epi16(v0, v1); // step[4]
s1 = _mm256_sub_epi16(v0, v1); // step[5]
@@ -306,14 +306,14 @@ static void fdct16_avx2(__m256i *in) {
x0 = _mm256_unpacklo_epi16(s0, s3);
x1 = _mm256_unpackhi_epi16(s0, s3);
- t4 = butter_fly(x0, x1, cospi_p28_p04);
- t5 = butter_fly(x0, x1, cospi_m04_p28);
+ t4 = butter_fly(&x0, &x1, &cospi_p28_p04);
+ t5 = butter_fly(&x0, &x1, &cospi_m04_p28);
// 10, 6
x0 = _mm256_unpacklo_epi16(s1, s2);
x1 = _mm256_unpackhi_epi16(s1, s2);
- t6 = butter_fly(x0, x1, cospi_p12_p20);
- t7 = butter_fly(x0, x1, cospi_m20_p12);
+ t6 = butter_fly(&x0, &x1, &cospi_p12_p20);
+ t7 = butter_fly(&x0, &x1, &cospi_m20_p12);
// 1, 3, 5, 7, 9, 11, 13, 15
s0 = _mm256_sub_epi16(in[7], in[8]); // step[8]
@@ -337,14 +337,14 @@ static void fdct16_avx2(__m256i *in) {
x0 = _mm256_unpacklo_epi16(u5, u2);
x1 = _mm256_unpackhi_epi16(u5, u2);
- s2 = butter_fly(x0, x1, cospi_p16_p16); // step[13]
- s5 = butter_fly(x0, x1, cospi_p16_m16); // step[10]
+ s2 = butter_fly(&x0, &x1, &cospi_p16_p16); // step[13]
+ s5 = butter_fly(&x0, &x1, &cospi_p16_m16); // step[10]
x0 = _mm256_unpacklo_epi16(u4, u3);
x1 = _mm256_unpackhi_epi16(u4, u3);
- s3 = butter_fly(x0, x1, cospi_p16_p16); // step[12]
- s4 = butter_fly(x0, x1, cospi_p16_m16); // step[11]
+ s3 = butter_fly(&x0, &x1, &cospi_p16_p16); // step[12]
+ s4 = butter_fly(&x0, &x1, &cospi_p16_m16); // step[11]
u0 = _mm256_add_epi16(s0, s4); // output[8]
u1 = _mm256_add_epi16(s1, s5);
@@ -364,14 +364,14 @@ static void fdct16_avx2(__m256i *in) {
x0 = _mm256_unpacklo_epi16(u1, u6);
x1 = _mm256_unpackhi_epi16(u1, u6);
- s1 = butter_fly(x0, x1, cospi_m08_p24);
- s6 = butter_fly(x0, x1, cospi_p24_p08);
+ s1 = butter_fly(&x0, &x1, &cospi_m08_p24);
+ s6 = butter_fly(&x0, &x1, &cospi_p24_p08);
x0 = _mm256_unpacklo_epi16(u2, u5);
x1 = _mm256_unpackhi_epi16(u2, u5);
- s2 = butter_fly(x0, x1, cospi_m24_m08);
- s5 = butter_fly(x0, x1, cospi_m08_p24);
+ s2 = butter_fly(&x0, &x1, &cospi_m24_m08);
+ s5 = butter_fly(&x0, &x1, &cospi_m08_p24);
// stage 5
u0 = _mm256_add_epi16(s0, s1);
@@ -386,23 +386,23 @@ static void fdct16_avx2(__m256i *in) {
// stage 6
x0 = _mm256_unpacklo_epi16(u0, u7);
x1 = _mm256_unpackhi_epi16(u0, u7);
- in[1] = butter_fly(x0, x1, cospi_p30_p02);
- in[15] = butter_fly(x0, x1, cospi_m02_p30);
+ in[1] = butter_fly(&x0, &x1, &cospi_p30_p02);
+ in[15] = butter_fly(&x0, &x1, &cospi_m02_p30);
x0 = _mm256_unpacklo_epi16(u1, u6);
x1 = _mm256_unpackhi_epi16(u1, u6);
- in[9] = butter_fly(x0, x1, cospi_p14_p18);
- in[7] = butter_fly(x0, x1, cospi_m18_p14);
+ in[9] = butter_fly(&x0, &x1, &cospi_p14_p18);
+ in[7] = butter_fly(&x0, &x1, &cospi_m18_p14);
x0 = _mm256_unpacklo_epi16(u2, u5);
x1 = _mm256_unpackhi_epi16(u2, u5);
- in[5] = butter_fly(x0, x1, cospi_p22_p10);
- in[11] = butter_fly(x0, x1, cospi_m10_p22);
+ in[5] = butter_fly(&x0, &x1, &cospi_p22_p10);
+ in[11] = butter_fly(&x0, &x1, &cospi_m10_p22);
x0 = _mm256_unpacklo_epi16(u3, u4);
x1 = _mm256_unpackhi_epi16(u3, u4);
- in[13] = butter_fly(x0, x1, cospi_p06_p26);
- in[3] = butter_fly(x0, x1, cospi_m26_p06);
+ in[13] = butter_fly(&x0, &x1, &cospi_p06_p26);
+ in[3] = butter_fly(&x0, &x1, &cospi_m26_p06);
}
void fadst16_avx2(__m256i *in) {
@@ -953,7 +953,9 @@ void fadst16_avx2(__m256i *in) {
}
#if CONFIG_EXT_TX
-static void fidtx16_avx2(__m256i *in) { txfm_scaling16_avx2(Sqrt2, in); }
+static void fidtx16_avx2(__m256i *in) {
+ txfm_scaling16_avx2((int16_t)Sqrt2, in);
+}
#endif
void av1_fht16x16_avx2(const int16_t *input, tran_low_t *output, int stride,
@@ -964,28 +966,28 @@ void av1_fht16x16_avx2(const int16_t *input, tran_low_t *output, int stride,
case DCT_DCT:
load_buffer_16x16(input, stride, 0, 0, in);
fdct16_avx2(in);
- mm256_transpose_16x16(in);
+ mm256_transpose_16x16(in, in);
right_shift_16x16(in);
fdct16_avx2(in);
break;
case ADST_DCT:
load_buffer_16x16(input, stride, 0, 0, in);
fadst16_avx2(in);
- mm256_transpose_16x16(in);
+ mm256_transpose_16x16(in, in);
right_shift_16x16(in);
fdct16_avx2(in);
break;
case DCT_ADST:
load_buffer_16x16(input, stride, 0, 0, in);
fdct16_avx2(in);
- mm256_transpose_16x16(in);
+ mm256_transpose_16x16(in, in);
right_shift_16x16(in);
fadst16_avx2(in);
break;
case ADST_ADST:
load_buffer_16x16(input, stride, 0, 0, in);
fadst16_avx2(in);
- mm256_transpose_16x16(in);
+ mm256_transpose_16x16(in, in);
right_shift_16x16(in);
fadst16_avx2(in);
break;
@@ -993,91 +995,91 @@ void av1_fht16x16_avx2(const int16_t *input, tran_low_t *output, int stride,
case FLIPADST_DCT:
load_buffer_16x16(input, stride, 1, 0, in);
fadst16_avx2(in);
- mm256_transpose_16x16(in);
+ mm256_transpose_16x16(in, in);
right_shift_16x16(in);
fdct16_avx2(in);
break;
case DCT_FLIPADST:
load_buffer_16x16(input, stride, 0, 1, in);
fdct16_avx2(in);
- mm256_transpose_16x16(in);
+ mm256_transpose_16x16(in, in);
right_shift_16x16(in);
fadst16_avx2(in);
break;
case FLIPADST_FLIPADST:
load_buffer_16x16(input, stride, 1, 1, in);
fadst16_avx2(in);
- mm256_transpose_16x16(in);
+ mm256_transpose_16x16(in, in);
right_shift_16x16(in);
fadst16_avx2(in);
break;
case ADST_FLIPADST:
load_buffer_16x16(input, stride, 0, 1, in);
fadst16_avx2(in);
- mm256_transpose_16x16(in);
+ mm256_transpose_16x16(in, in);
right_shift_16x16(in);
fadst16_avx2(in);
break;
case FLIPADST_ADST:
load_buffer_16x16(input, stride, 1, 0, in);
fadst16_avx2(in);
- mm256_transpose_16x16(in);
+ mm256_transpose_16x16(in, in);
right_shift_16x16(in);
fadst16_avx2(in);
break;
case IDTX:
load_buffer_16x16(input, stride, 0, 0, in);
fidtx16_avx2(in);
- mm256_transpose_16x16(in);
+ mm256_transpose_16x16(in, in);
right_shift_16x16(in);
fidtx16_avx2(in);
break;
case V_DCT:
load_buffer_16x16(input, stride, 0, 0, in);
fdct16_avx2(in);
- mm256_transpose_16x16(in);
+ mm256_transpose_16x16(in, in);
right_shift_16x16(in);
fidtx16_avx2(in);
break;
case H_DCT:
load_buffer_16x16(input, stride, 0, 0, in);
fidtx16_avx2(in);
- mm256_transpose_16x16(in);
+ mm256_transpose_16x16(in, in);
right_shift_16x16(in);
fdct16_avx2(in);
break;
case V_ADST:
load_buffer_16x16(input, stride, 0, 0, in);
fadst16_avx2(in);
- mm256_transpose_16x16(in);
+ mm256_transpose_16x16(in, in);
right_shift_16x16(in);
fidtx16_avx2(in);
break;
case H_ADST:
load_buffer_16x16(input, stride, 0, 0, in);
fidtx16_avx2(in);
- mm256_transpose_16x16(in);
+ mm256_transpose_16x16(in, in);
right_shift_16x16(in);
fadst16_avx2(in);
break;
case V_FLIPADST:
load_buffer_16x16(input, stride, 1, 0, in);
fadst16_avx2(in);
- mm256_transpose_16x16(in);
+ mm256_transpose_16x16(in, in);
right_shift_16x16(in);
fidtx16_avx2(in);
break;
case H_FLIPADST:
load_buffer_16x16(input, stride, 0, 1, in);
fidtx16_avx2(in);
- mm256_transpose_16x16(in);
+ mm256_transpose_16x16(in, in);
right_shift_16x16(in);
fadst16_avx2(in);
break;
#endif // CONFIG_EXT_TX
default: assert(0); break;
}
- mm256_transpose_16x16(in);
+ mm256_transpose_16x16(in, in);
write_buffer_16x16(in, output);
_mm256_zeroupper();
}
@@ -1110,10 +1112,10 @@ static void mm256_vectors_swap(__m256i *a0, __m256i *a1, const int size) {
}
static void mm256_transpose_32x32(__m256i *in0, __m256i *in1) {
- mm256_transpose_16x16(in0);
- mm256_transpose_16x16(&in0[16]);
- mm256_transpose_16x16(in1);
- mm256_transpose_16x16(&in1[16]);
+ mm256_transpose_16x16(in0, in0);
+ mm256_transpose_16x16(&in0[16], &in0[16]);
+ mm256_transpose_16x16(in1, in1);
+ mm256_transpose_16x16(&in1[16], &in1[16]);
mm256_vectors_swap(&in0[16], in1, 16);
}
@@ -1247,23 +1249,23 @@ static void fdct16_odd_avx2(__m256i *in) {
u0 = _mm256_unpacklo_epi16(in[4], in[11]);
u1 = _mm256_unpackhi_epi16(in[4], in[11]);
- y4 = butter_fly(u0, u1, cospi_m16_p16);
- y11 = butter_fly(u0, u1, cospi_p16_p16);
+ y4 = butter_fly(&u0, &u1, &cospi_m16_p16);
+ y11 = butter_fly(&u0, &u1, &cospi_p16_p16);
u0 = _mm256_unpacklo_epi16(in[5], in[10]);
u1 = _mm256_unpackhi_epi16(in[5], in[10]);
- y5 = butter_fly(u0, u1, cospi_m16_p16);
- y10 = butter_fly(u0, u1, cospi_p16_p16);
+ y5 = butter_fly(&u0, &u1, &cospi_m16_p16);
+ y10 = butter_fly(&u0, &u1, &cospi_p16_p16);
u0 = _mm256_unpacklo_epi16(in[6], in[9]);
u1 = _mm256_unpackhi_epi16(in[6], in[9]);
- y6 = butter_fly(u0, u1, cospi_m16_p16);
- y9 = butter_fly(u0, u1, cospi_p16_p16);
+ y6 = butter_fly(&u0, &u1, &cospi_m16_p16);
+ y9 = butter_fly(&u0, &u1, &cospi_p16_p16);
u0 = _mm256_unpacklo_epi16(in[7], in[8]);
u1 = _mm256_unpackhi_epi16(in[7], in[8]);
- y7 = butter_fly(u0, u1, cospi_m16_p16);
- y8 = butter_fly(u0, u1, cospi_p16_p16);
+ y7 = butter_fly(&u0, &u1, &cospi_m16_p16);
+ y8 = butter_fly(&u0, &u1, &cospi_p16_p16);
y12 = in[12];
y13 = in[13];
@@ -1300,23 +1302,23 @@ static void fdct16_odd_avx2(__m256i *in) {
u0 = _mm256_unpacklo_epi16(x2, x13);
u1 = _mm256_unpackhi_epi16(x2, x13);
- y2 = butter_fly(u0, u1, cospi_m08_p24);
- y13 = butter_fly(u0, u1, cospi_p24_p08);
+ y2 = butter_fly(&u0, &u1, &cospi_m08_p24);
+ y13 = butter_fly(&u0, &u1, &cospi_p24_p08);
u0 = _mm256_unpacklo_epi16(x3, x12);
u1 = _mm256_unpackhi_epi16(x3, x12);
- y3 = butter_fly(u0, u1, cospi_m08_p24);
- y12 = butter_fly(u0, u1, cospi_p24_p08);
+ y3 = butter_fly(&u0, &u1, &cospi_m08_p24);
+ y12 = butter_fly(&u0, &u1, &cospi_p24_p08);
u0 = _mm256_unpacklo_epi16(x4, x11);
u1 = _mm256_unpackhi_epi16(x4, x11);
- y4 = butter_fly(u0, u1, cospi_m24_m08);
- y11 = butter_fly(u0, u1, cospi_m08_p24);
+ y4 = butter_fly(&u0, &u1, &cospi_m24_m08);
+ y11 = butter_fly(&u0, &u1, &cospi_m08_p24);
u0 = _mm256_unpacklo_epi16(x5, x10);
u1 = _mm256_unpackhi_epi16(x5, x10);
- y5 = butter_fly(u0, u1, cospi_m24_m08);
- y10 = butter_fly(u0, u1, cospi_m08_p24);
+ y5 = butter_fly(&u0, &u1, &cospi_m24_m08);
+ y10 = butter_fly(&u0, &u1, &cospi_m08_p24);
// stage 5
x0 = _mm256_add_epi16(y0, y3);
@@ -1349,23 +1351,23 @@ static void fdct16_odd_avx2(__m256i *in) {
u0 = _mm256_unpacklo_epi16(x1, x14);
u1 = _mm256_unpackhi_epi16(x1, x14);
- y1 = butter_fly(u0, u1, cospi_m04_p28);
- y14 = butter_fly(u0, u1, cospi_p28_p04);
+ y1 = butter_fly(&u0, &u1, &cospi_m04_p28);
+ y14 = butter_fly(&u0, &u1, &cospi_p28_p04);
u0 = _mm256_unpacklo_epi16(x2, x13);
u1 = _mm256_unpackhi_epi16(x2, x13);
- y2 = butter_fly(u0, u1, cospi_m28_m04);
- y13 = butter_fly(u0, u1, cospi_m04_p28);
+ y2 = butter_fly(&u0, &u1, &cospi_m28_m04);
+ y13 = butter_fly(&u0, &u1, &cospi_m04_p28);
u0 = _mm256_unpacklo_epi16(x5, x10);
u1 = _mm256_unpackhi_epi16(x5, x10);
- y5 = butter_fly(u0, u1, cospi_m20_p12);
- y10 = butter_fly(u0, u1, cospi_p12_p20);
+ y5 = butter_fly(&u0, &u1, &cospi_m20_p12);
+ y10 = butter_fly(&u0, &u1, &cospi_p12_p20);
u0 = _mm256_unpacklo_epi16(x6, x9);
u1 = _mm256_unpackhi_epi16(x6, x9);
- y6 = butter_fly(u0, u1, cospi_m12_m20);
- y9 = butter_fly(u0, u1, cospi_m20_p12);
+ y6 = butter_fly(&u0, &u1, &cospi_m12_m20);
+ y9 = butter_fly(&u0, &u1, &cospi_m20_p12);
// stage 7
x0 = _mm256_add_epi16(y0, y1);
@@ -1389,43 +1391,43 @@ static void fdct16_odd_avx2(__m256i *in) {
// stage 8
u0 = _mm256_unpacklo_epi16(x0, x15);
u1 = _mm256_unpackhi_epi16(x0, x15);
- in[0] = butter_fly(u0, u1, cospi_p31_p01);
- in[15] = butter_fly(u0, u1, cospi_m01_p31);
+ in[0] = butter_fly(&u0, &u1, &cospi_p31_p01);
+ in[15] = butter_fly(&u0, &u1, &cospi_m01_p31);
u0 = _mm256_unpacklo_epi16(x1, x14);
u1 = _mm256_unpackhi_epi16(x1, x14);
- in[1] = butter_fly(u0, u1, cospi_p15_p17);
- in[14] = butter_fly(u0, u1, cospi_m17_p15);
+ in[1] = butter_fly(&u0, &u1, &cospi_p15_p17);
+ in[14] = butter_fly(&u0, &u1, &cospi_m17_p15);
u0 = _mm256_unpacklo_epi16(x2, x13);
u1 = _mm256_unpackhi_epi16(x2, x13);
- in[2] = butter_fly(u0, u1, cospi_p23_p09);
- in[13] = butter_fly(u0, u1, cospi_m09_p23);
+ in[2] = butter_fly(&u0, &u1, &cospi_p23_p09);
+ in[13] = butter_fly(&u0, &u1, &cospi_m09_p23);
u0 = _mm256_unpacklo_epi16(x3, x12);
u1 = _mm256_unpackhi_epi16(x3, x12);
- in[3] = butter_fly(u0, u1, cospi_p07_p25);
- in[12] = butter_fly(u0, u1, cospi_m25_p07);
+ in[3] = butter_fly(&u0, &u1, &cospi_p07_p25);
+ in[12] = butter_fly(&u0, &u1, &cospi_m25_p07);
u0 = _mm256_unpacklo_epi16(x4, x11);
u1 = _mm256_unpackhi_epi16(x4, x11);
- in[4] = butter_fly(u0, u1, cospi_p27_p05);
- in[11] = butter_fly(u0, u1, cospi_m05_p27);
+ in[4] = butter_fly(&u0, &u1, &cospi_p27_p05);
+ in[11] = butter_fly(&u0, &u1, &cospi_m05_p27);
u0 = _mm256_unpacklo_epi16(x5, x10);
u1 = _mm256_unpackhi_epi16(x5, x10);
- in[5] = butter_fly(u0, u1, cospi_p11_p21);
- in[10] = butter_fly(u0, u1, cospi_m21_p11);
+ in[5] = butter_fly(&u0, &u1, &cospi_p11_p21);
+ in[10] = butter_fly(&u0, &u1, &cospi_m21_p11);
u0 = _mm256_unpacklo_epi16(x6, x9);
u1 = _mm256_unpackhi_epi16(x6, x9);
- in[6] = butter_fly(u0, u1, cospi_p19_p13);
- in[9] = butter_fly(u0, u1, cospi_m13_p19);
+ in[6] = butter_fly(&u0, &u1, &cospi_p19_p13);
+ in[9] = butter_fly(&u0, &u1, &cospi_m13_p19);
u0 = _mm256_unpacklo_epi16(x7, x8);
u1 = _mm256_unpackhi_epi16(x7, x8);
- in[7] = butter_fly(u0, u1, cospi_p03_p29);
- in[8] = butter_fly(u0, u1, cospi_m29_p03);
+ in[7] = butter_fly(&u0, &u1, &cospi_p03_p29);
+ in[8] = butter_fly(&u0, &u1, &cospi_m29_p03);
}
static void fdct32_avx2(__m256i *in0, __m256i *in1) {
@@ -1464,7 +1466,7 @@ static INLINE void write_buffer_32x32(const __m256i *in0, const __m256i *in1,
static void fhalfright32_16col_avx2(__m256i *in) {
int i = 0;
const __m256i zero = _mm256_setzero_si256();
- const __m256i sqrt2 = _mm256_set1_epi16(Sqrt2);
+ const __m256i sqrt2 = _mm256_set1_epi16((int16_t)Sqrt2);
const __m256i dct_rounding = _mm256_set1_epi32(DCT_CONST_ROUNDING);
__m256i x0, x1;
diff --git a/third_party/aom/build/cmake/aom_config_defaults.cmake b/third_party/aom/build/cmake/aom_config_defaults.cmake
index 5c2bc5801..cd6b5ab48 100644
--- a/third_party/aom/build/cmake/aom_config_defaults.cmake
+++ b/third_party/aom/build/cmake/aom_config_defaults.cmake
@@ -20,7 +20,6 @@ set(ARCH_MIPS 0 CACHE BOOL "Enables MIPS architecture.")
set(ARCH_X86 0 CACHE BOOL "Enables X86 architecture.")
set(ARCH_X86_64 0 CACHE BOOL "Enables X86_64 architecture.")
set(HAVE_EDSP 0 CACHE BOOL "Enables EDSP optimizations.")
-set(HAVE_MEDIA 0 CACHE BOOL "Enables MEDIA optimizations.")
set(HAVE_NEON 0 CACHE BOOL "Enables NEON intrinsics optimizations.")
set(HAVE_NEON_ASM 0 CACHE BOOL "Enables NEON assembly optimizations.")
set(HAVE_MIPS32 0 CACHE BOOL "Enables MIPS32 optimizations.")
@@ -42,7 +41,6 @@ set(HAVE_UNISTD_H 0 CACHE BOOL "Internal flag, unistd.h present for target.")
set(HAVE_WXWIDGETS 0 CACHE BOOL "WxWidgets present.")
set(CONFIG_DEPENDENCY_TRACKING 1 CACHE BOOL "Internal flag.")
set(CONFIG_EXTERNAL_BUILD 0 CACHE BOOL "Internal flag.")
-set(CONFIG_INSTALL_DOCS 0 CACHE BOOL "Internal flag.")
set(CONFIG_INSTALL_BINS 0 CACHE BOOL "Internal flag.")
set(CONFIG_INSTALL_LIBS 0 CACHE BOOL "Internal flag.")
set(CONFIG_INSTALL_SRCS 0 CACHE BOOL "Internal flag.")
@@ -63,8 +61,6 @@ set(CONFIG_INTERNAL_STATS 0 CACHE BOOL "Internal flag.")
set(CONFIG_AV1_ENCODER 1 CACHE BOOL "Enable AV1 encoder.")
set(CONFIG_AV1_DECODER 1 CACHE BOOL "Enable AV1 decoder.")
set(CONFIG_AV1 1 CACHE BOOL "Internal flag.")
-set(CONFIG_ENCODERS 1 CACHE BOOL "Enable encoding.")
-set(CONFIG_DECODERS 1 CACHE BOOL "Enable decoding.")
set(CONFIG_STATIC_MSVCRT 0 CACHE BOOL "Internal flag.")
set(CONFIG_SPATIAL_RESAMPLING 1 CACHE BOOL "Internal flag.")
set(CONFIG_REALTIME_ONLY 0 CACHE BOOL "Internal flag.")
@@ -84,70 +80,67 @@ set(CONFIG_DECODE_PERF_TESTS 0 CACHE BOOL "Internal flag.")
set(CONFIG_ENCODE_PERF_TESTS 0 CACHE BOOL "Internal flag.")
set(CONFIG_COEFFICIENT_RANGE_CHECKING 0 CACHE BOOL "Internal flag.")
set(CONFIG_LOWBITDEPTH 1 CACHE BOOL "Internal flag.")
-set(CONFIG_HIGHBITDEPTH 0 CACHE BOOL "Internal flag.")
+set(CONFIG_HIGHBITDEPTH 1 CACHE BOOL "Internal flag.")
set(CONFIG_EXPERIMENTAL 0 CACHE BOOL "Internal flag.")
set(CONFIG_SIZE_LIMIT 0 CACHE BOOL "Internal flag.")
-set(CONFIG_AOM_QM 0 CACHE BOOL "Internal flag.")
set(CONFIG_FP_MB_STATS 0 CACHE BOOL "Internal flag.")
set(CONFIG_CDEF 1 CACHE BOOL "Internal flag.")
-set(CONFIG_VAR_TX 0 CACHE BOOL "Internal flag.")
+set(CONFIG_VAR_TX 1 CACHE BOOL "Internal flag.")
set(CONFIG_RECT_TX 1 CACHE BOOL "Internal flag.")
-set(CONFIG_REF_MV 1 CACHE BOOL "Internal flag.")
+set(CONFIG_RECT_TX_EXT 0 CACHE BOOL "Internal flag.")
set(CONFIG_TPL_MV 0 CACHE BOOL "Internal flag.")
set(CONFIG_DUAL_FILTER 1 CACHE BOOL "Internal flag.")
set(CONFIG_CONVOLVE_ROUND 0 CACHE BOOL "Internal flag.")
set(CONFIG_COMPOUND_ROUND 0 CACHE BOOL "Internal flag.")
-set(CONFIG_EXT_TX 0 CACHE BOOL "Internal flag.")
+set(CONFIG_EXT_TX 1 CACHE BOOL "Internal flag.")
+set(CONFIG_DPCM_INTRA 0 CACHE BOOL "Internal flag.")
set(CONFIG_TX64X64 0 CACHE BOOL "Internal flag.")
-set(CONFIG_SUB8X8_MC 0 CACHE BOOL "Internal flag.")
set(CONFIG_EXT_INTRA 1 CACHE BOOL "Internal flag.")
set(CONFIG_INTRA_INTERP 0 CACHE BOOL "Internal flag.")
set(CONFIG_FILTER_INTRA 0 CACHE BOOL "Internal flag.")
+set(CONFIG_INTRA_EDGE 0 CACHE BOOL "Internal flag.")
set(CONFIG_INTRABC 0 CACHE BOOL "Internal flag.")
set(CONFIG_EXT_INTER 0 CACHE BOOL "Internal flag.")
set(CONFIG_INTERINTRA 0 CACHE BOOL "Internal flag.")
set(CONFIG_WEDGE 0 CACHE BOOL "Internal flag.")
set(CONFIG_COMPOUND_SEGMENT 0 CACHE BOOL "Internal flag.")
set(CONFIG_EXT_REFS 1 CACHE BOOL "Internal flag.")
-set(CONFIG_GLOBAL_MOTION 0 CACHE BOOL "Internal flag.")
+set(CONFIG_GLOBAL_MOTION 1 CACHE BOOL "Internal flag.")
set(CONFIG_NEW_QUANT 0 CACHE BOOL "Internal flag.")
set(CONFIG_SUPERTX 0 CACHE BOOL "Internal flag.")
set(CONFIG_ANS 0 CACHE BOOL "Internal flag.")
-set(CONFIG_EC_MULTISYMBOL 1 CACHE BOOL "Internal flag.")
-set(CONFIG_NEW_TOKENSET 1 CACHE BOOL "Internal flag.")
set(CONFIG_LOOP_RESTORATION 0 CACHE BOOL "Internal flag.")
set(CONFIG_EXT_PARTITION 0 CACHE BOOL "Internal flag.")
set(CONFIG_EXT_PARTITION_TYPES 0 CACHE BOOL "Internal flag.")
set(CONFIG_UNPOISON_PARTITION_CTX 0 CACHE BOOL "Internal flag.")
set(CONFIG_EXT_TILE 0 CACHE BOOL "Internal flag.")
-set(CONFIG_MOTION_VAR 0 CACHE BOOL "Internal flag.")
+set(CONFIG_MOTION_VAR 1 CACHE BOOL "Internal flag.")
set(CONFIG_NCOBMC 0 CACHE BOOL "Internal flag.")
-set(CONFIG_WARPED_MOTION 0 CACHE BOOL "Internal flag.")
+set(CONFIG_WARPED_MOTION 1 CACHE BOOL "Internal flag.")
set(CONFIG_Q_ADAPT_PROBS 0 CACHE BOOL "Internal flag.")
-set(CONFIG_SUBFRAME_PROB_UPDATE 0 CACHE BOOL "Internal flag.")
set(CONFIG_BITSTREAM_DEBUG 0 CACHE BOOL "Internal flag.")
set(CONFIG_ALT_INTRA 1 CACHE BOOL "Internal flag.")
set(CONFIG_PALETTE 1 CACHE BOOL "Internal flag.")
set(CONFIG_PALETTE_DELTA_ENCODING 0 CACHE BOOL "Internal flag.")
-set(CONFIG_DAALA_EC 1 CACHE BOOL "Internal flag.")
set(CONFIG_RAWBITS 0 CACHE BOOL "Internal flag.")
-set(CONFIG_EC_SMALLMUL 0 CACHE BOOL "Internal flag.")
+set(CONFIG_EC_SMALLMUL 1 CACHE BOOL "Internal flag.")
set(CONFIG_PVQ 0 CACHE BOOL "Internal flag.")
set(CONFIG_CFL 0 CACHE BOOL "Internal flag.")
set(CONFIG_XIPHRC 0 CACHE BOOL "Internal flag.")
set(CONFIG_CB4X4 1 CACHE BOOL "Internal flag.")
set(CONFIG_CHROMA_2X2 0 CACHE BOOL "Internal flag.")
+set(CONFIG_CHROMA_SUB8X8 1 CACHE BOOL "Internal flag.")
set(CONFIG_FRAME_SIZE 0 CACHE BOOL "Internal flag.")
set(CONFIG_DELTA_Q 1 CACHE BOOL "Internal flag.")
-set(CONFIG_EXT_DELTA_Q 0 CACHE BOOL "Internal flag.")
+set(CONFIG_EXT_DELTA_Q 1 CACHE BOOL "Internal flag.")
set(CONFIG_ADAPT_SCAN 0 CACHE BOOL "Internal flag.")
set(CONFIG_FILTER_7BIT 1 CACHE BOOL "Internal flag.")
set(CONFIG_PARALLEL_DEBLOCKING 0 CACHE BOOL "Internal flag.")
set(CONFIG_PARALLEL_DEBLOCKING_15TAP 0 CACHE BOOL "Internal flag.")
-set(CONFIG_LOOPFILTERING_ACROSS_TILES 0 CACHE BOOL "Internal flag.")
+set(CONFIG_LOOPFILTERING_ACROSS_TILES 1 CACHE BOOL "Internal flag.")
set(CONFIG_TILE_GROUPS 1 CACHE BOOL "Internal flag.")
set(CONFIG_EC_ADAPT 1 CACHE BOOL "Internal flag.")
-set(CONFIG_TEMPMV_SIGNALING 0 CACHE BOOL "Internal flag.")
+set(CONFIG_TEMPMV_SIGNALING 1 CACHE BOOL "Internal flag.")
set(CONFIG_RD_DEBUG 0 CACHE BOOL "Internal flag.")
set(CONFIG_REFERENCE_BUFFER 1 CACHE BOOL "Internal flag.")
set(CONFIG_COEF_INTERLEAVE 0 CACHE BOOL "Internal flag.")
@@ -164,4 +157,8 @@ set(CONFIG_MV_COMPRESS 1 CACHE BOOL "Internal flag.")
set(CONFIG_FRAME_SUPERRES 0 CACHE BOOL "Internal flag.")
set(CONFIG_NEW_MULTISYMBOL 0 CACHE BOOL "Internal flag.")
set(CONFIG_COMPOUND_SINGLEREF 0 CACHE BOOL "Internal flag.")
+set(CONFIG_AOM_QM 0 CACHE BOOL "Internal flag.")
+set(CONFIG_ONE_SIDED_COMPOUND 1 CACHE BOOL "Internal flag.")
+set(CONFIG_SMOOTH_HV 0 CACHE BOOL "Internal flag.")
+set(CONFIG_VAR_REFS 0 CACHE BOOL "Internal flag.")
set(CONFIG_ANALYZER 0 CACHE BOOL "Internal flag.")
diff --git a/third_party/aom/build/cmake/aom_configure.cmake b/third_party/aom/build/cmake/aom_configure.cmake
index 3c9402d0b..0fa2cce0e 100644
--- a/third_party/aom/build/cmake/aom_configure.cmake
+++ b/third_party/aom/build/cmake/aom_configure.cmake
@@ -8,6 +8,9 @@
## Media Patent License 1.0 was not distributed with this source code in the
## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
##
+if (NOT AOM_BUILD_CMAKE_AOM_CONFIGURE_CMAKE_)
+set(AOM_BUILD_CMAKE_AOM_CONFIGURE_CMAKE_ 1)
+
include(FindGit)
include(FindPerl)
include(FindThreads)
@@ -89,7 +92,13 @@ endif ()
if ("${AOM_TARGET_CPU}" STREQUAL "x86" OR "${AOM_TARGET_CPU}" STREQUAL "x86_64")
# TODO(tomfinegan): Support nasm at least as well as the existing build
# system.
- find_program(AS_EXECUTABLE yasm $ENV{YASM_PATH})
+ if (ENABLE_NASM)
+ find_program(AS_EXECUTABLE nasm $ENV{NASM_PATH})
+ set(AOM_AS_FLAGS ${AOM_AS_FLAGS} -Ox)
+ else ()
+ find_program(AS_EXECUTABLE yasm $ENV{YASM_PATH})
+ endif ()
+
if (NOT AS_EXECUTABLE)
message(FATAL_ERROR "Unable to find yasm. To build without optimizations, "
"add -DAOM_TARGET_CPU=generic to your cmake command line.")
@@ -115,6 +124,30 @@ endif ()
include("${AOM_ROOT}/build/cmake/cpu.cmake")
+if (ENABLE_CCACHE)
+ find_program(CCACHE "ccache")
+ if (NOT "${CCACHE}" STREQUAL "")
+ set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE}")
+ set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE}")
+ else ()
+ message("--- Cannot find ccache, ENABLE_CCACHE ignored.")
+ endif ()
+endif ()
+
+if (ENABLE_DISTCC)
+ find_program(DISTCC "distcc")
+ if (NOT "${DISTCC}" STREQUAL "")
+ set(CMAKE_C_COMPILER_LAUNCHER "${DISTCC}")
+ set(CMAKE_CXX_COMPILER_LAUNCHER "${DISTCC}")
+ else ()
+ message("--- Cannot find distcc, ENABLE_DISTCC ignored.")
+ endif ()
+endif ()
+
+if (NOT CONFIG_AV1_DECODER AND NOT CONFIG_AV1_ENCODER)
+ message(FATAL_ERROR "Decoder and encoder disabled, nothing to build.")
+endif ()
+
# Test compiler flags.
if (MSVC)
add_compiler_flag_if_supported("/W3")
@@ -191,11 +224,6 @@ if (CONFIG_ANALYZER)
endif ()
endif ()
-if (CONFIG_ANS AND CONFIG_DAALA_EC)
- message(FATAL_ERROR
- "CONFIG_ANS and CONFIG_DAALA_EC cannot be enabled together.")
-endif ()
-
if (NOT MSVC)
aom_push_var(CMAKE_REQUIRED_LIBRARIES "m")
aom_check_c_compiles("fenv_check"
@@ -207,6 +235,13 @@ if (NOT MSVC)
aom_pop_var(CMAKE_REQUIRED_LIBRARIES)
endif()
+set(AOM_LIB_LINK_TYPE PUBLIC)
+if (EMSCRIPTEN)
+ # Avoid CMake generation time errors resulting from collisions with the form
+ # of target_link_libraries() used by Emscripten.cmake.
+ unset(AOM_LIB_LINK_TYPE)
+endif ()
+
# Generate aom_config templates.
set(aom_config_asm_template "${AOM_CONFIG_DIR}/aom_config.asm.cmake")
set(aom_config_h_template "${AOM_CONFIG_DIR}/aom_config.h.cmake")
@@ -244,9 +279,9 @@ find_package(Perl)
if (NOT PERL_FOUND)
message(FATAL_ERROR "Perl is required to build libaom.")
endif ()
-configure_file(
- "${AOM_ROOT}/build/cmake/rtcd_config.cmake"
- "${AOM_CONFIG_DIR}/${AOM_TARGET_CPU}_rtcd_config.rtcd")
+
+configure_file("${AOM_CONFIG_DIR}/rtcd_config.cmake"
+ "${AOM_CONFIG_DIR}/${AOM_TARGET_CPU}_rtcd_config.rtcd")
set(AOM_RTCD_CONFIG_FILE_LIST
"${AOM_ROOT}/aom_dsp/aom_dsp_rtcd_defs.pl"
@@ -304,3 +339,37 @@ execute_process(
COMMAND ${PERL_EXECUTABLE} "${AOM_ROOT}/build/cmake/aom_version.pl"
--version_data=${AOM_GIT_DESCRIPTION}
--version_filename=${AOM_CONFIG_DIR}/aom_version.h)
+
+# Generate aom.pc (pkg-config file).
+if (NOT MSVC)
+ # Extract the version string from aom_version.h
+ file(STRINGS "${AOM_CONFIG_DIR}/aom_version.h" aom_version
+ REGEX "VERSION_STRING_NOSP")
+ string(REPLACE "#define VERSION_STRING_NOSP \"v" "" aom_version
+ "${aom_version}")
+ string(REPLACE "\"" "" aom_version "${aom_version}")
+
+ # Write pkg-config info.
+ set(prefix "${CMAKE_INSTALL_PREFIX}")
+ set(pkgconfig_file "${AOM_CONFIG_DIR}/aom.pc")
+ string(TOLOWER ${CMAKE_PROJECT_NAME} pkg_name)
+ file(WRITE "${pkgconfig_file}" "# libaom pkg-config.\n")
+ file(APPEND "${pkgconfig_file}" "prefix=${prefix}\n")
+ file(APPEND "${pkgconfig_file}" "exec_prefix=${prefix}/bin\n")
+ file(APPEND "${pkgconfig_file}" "libdir=${prefix}/lib\n")
+ file(APPEND "${pkgconfig_file}" "includedir=${prefix}/include\n\n")
+ file(APPEND "${pkgconfig_file}" "Name: ${pkg_name}\n")
+ file(APPEND "${pkgconfig_file}" "Description: AV1 codec library.\n")
+ file(APPEND "${pkgconfig_file}" "Version: ${aom_version}\n")
+ file(APPEND "${pkgconfig_file}" "Requires:\n")
+ file(APPEND "${pkgconfig_file}" "Conflicts:\n")
+ file(APPEND "${pkgconfig_file}" "Libs: -L${prefix}/lib -l${pkg_name} -lm\n")
+ if (CONFIG_MULTITHREAD AND HAVE_PTHREAD_H)
+ file(APPEND "${pkgconfig_file}" "Libs.private: -lm -lpthread\n")
+ else ()
+ file(APPEND "${pkgconfig_file}" "Libs.private: -lm\n")
+ endif ()
+ file(APPEND "${pkgconfig_file}" "Cflags: -I${prefix}/include\n")
+endif ()
+
+endif () # AOM_BUILD_CMAKE_AOM_CONFIGURE_CMAKE_
diff --git a/third_party/aom/build/cmake/aom_optimization.cmake b/third_party/aom/build/cmake/aom_optimization.cmake
index e2b0ba07e..5a3865281 100644
--- a/third_party/aom/build/cmake/aom_optimization.cmake
+++ b/third_party/aom/build/cmake/aom_optimization.cmake
@@ -75,7 +75,8 @@ function (get_asm_obj_format out_format)
set(objformat "macho64")
elseif ("${AOM_TARGET_SYSTEM}" STREQUAL "Linux")
set(objformat "elf64")
- elseif ("${AOM_TARGET_SYSTEM}" STREQUAL "Windows")
+ elseif ("${AOM_TARGET_SYSTEM}" STREQUAL "MSYS" OR
+ "${AOM_TARGET_SYSTEM}" STREQUAL "Windows")
set(objformat "win64")
else ()
message(FATAL_ERROR "Unknown obj format: ${AOM_TARGET_SYSTEM}")
@@ -85,7 +86,8 @@ function (get_asm_obj_format out_format)
set(objformat "macho32")
elseif ("${AOM_TARGET_SYSTEM}" STREQUAL "Linux")
set(objformat "elf32")
- elseif ("${AOM_TARGET_SYSTEM}" STREQUAL "Windows")
+ elseif ("${AOM_TARGET_SYSTEM}" STREQUAL "MSYS" OR
+ "${AOM_TARGET_SYSTEM}" STREQUAL "Windows")
set(objformat "win32")
else ()
message(FATAL_ERROR "Unknown obj format: ${AOM_TARGET_SYSTEM}")
@@ -120,7 +122,7 @@ function (add_asm_library lib_name asm_sources dependent_target)
add_custom_command(OUTPUT "${asm_object}"
COMMAND ${AS_EXECUTABLE}
ARGS ${AOM_AS_FLAGS}
- -I${AOM_ROOT} -I${AOM_CONFIG_DIR}
+ -I${AOM_ROOT}/ -I${AOM_CONFIG_DIR}/
-o "${asm_object}" "${asm_source}"
DEPENDS "${asm_source}"
COMMENT "Building ASM object ${asm_object}"
@@ -141,7 +143,7 @@ function (add_asm_library lib_name asm_sources dependent_target)
"void ${lib_name}_dummy_function(void) {}\n")
target_sources(${lib_name} PUBLIC ${dummy_c_file})
- target_link_libraries(${dependent_target} PRIVATE ${lib_name})
+ target_link_libraries(${dependent_target} ${AOM_LIB_LINK_TYPE} ${lib_name})
# Add the new lib target to the global list of aom library targets.
list(APPEND AOM_LIB_TARGETS ${lib_name})
diff --git a/third_party/aom/build/cmake/compiler_flags.cmake b/third_party/aom/build/cmake/compiler_flags.cmake
index beb217abc..c9fc69b92 100644
--- a/third_party/aom/build/cmake/compiler_flags.cmake
+++ b/third_party/aom/build/cmake/compiler_flags.cmake
@@ -8,6 +8,9 @@
## Media Patent License 1.0 was not distributed with this source code in the
## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
##
+if (NOT AOM_BUILD_CMAKE_COMPILER_FLAGS_CMAKE_)
+set(AOM_BUILD_CMAKE_COMPILER_FLAGS_CMAKE_ 1)
+
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
@@ -216,3 +219,5 @@ function (append_exe_linker_flag flag)
"" FORCE)
endif ()
endfunction ()
+
+endif () # AOM_BUILD_CMAKE_COMPILER_FLAGS_CMAKE_
diff --git a/third_party/aom/build/cmake/compiler_tests.cmake b/third_party/aom/build/cmake/compiler_tests.cmake
index e763597a2..89f0bc12c 100644
--- a/third_party/aom/build/cmake/compiler_tests.cmake
+++ b/third_party/aom/build/cmake/compiler_tests.cmake
@@ -8,6 +8,9 @@
## Media Patent License 1.0 was not distributed with this source code in the
## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
##
+if (NOT AOM_BUILD_CMAKE_COMPILER_TESTS_CMAKE_)
+set(AOM_BUILD_CMAKE_COMPILER_TESTS_CMAKE_ 1)
+
include(CheckCSourceCompiles)
include(CheckCXXSourceCompiles)
@@ -131,3 +134,5 @@ function (aom_get_inline result)
set(${result} "__inline" PARENT_SCOPE)
endif ()
endfunction ()
+
+endif () # AOM_BUILD_CMAKE_COMPILER_TESTS_CMAKE_
diff --git a/third_party/aom/build/cmake/dist.cmake b/third_party/aom/build/cmake/dist.cmake
new file mode 100644
index 000000000..0de68a44d
--- /dev/null
+++ b/third_party/aom/build/cmake/dist.cmake
@@ -0,0 +1,51 @@
+##
+## 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.
+##
+cmake_minimum_required(VERSION 3.5)
+
+# Converts spaces in $in_string to semicolons and writes the output to
+# $out_string. In CMake's eyes this converts the input string to a list.
+function (listify_string in_string out_string)
+ string(REPLACE " " ";" ${out_string} ${in_string})
+ set(${out_string} "${${out_string}}" PARENT_SCOPE)
+endfunction ()
+
+set(REQUIRED_ARGS "AOM_ROOT" "AOM_CONFIG_DIR" "AOM_DIST_DIR" "AOM_DIST_EXAMPLES"
+ "AOM_DIST_APPS" "AOM_DIST_INCLUDES" "AOM_DIST_LIBS" "ENABLE_DOCS")
+
+foreach (arg ${REQUIRED_ARGS})
+ if ("${${arg}}" STREQUAL "")
+ message(FATAL_ERROR "${arg} must not be empty.")
+ endif ()
+endforeach ()
+
+if (ENABLE_DOCS)
+ file(INSTALL "${AOM_CONFIG_DIR}/docs" DESTINATION "${AOM_DIST_DIR}")
+endif ()
+
+listify_string("${AOM_DIST_EXAMPLES}" "AOM_DIST_EXAMPLES")
+foreach (example ${AOM_DIST_EXAMPLES})
+ file(INSTALL "${example}" DESTINATION "${AOM_DIST_DIR}/bin/examples")
+endforeach ()
+
+listify_string("${AOM_DIST_APPS}" "AOM_DIST_APPS")
+foreach (app ${AOM_DIST_APPS})
+ file(INSTALL "${app}" DESTINATION "${AOM_DIST_DIR}/bin")
+endforeach ()
+
+listify_string("${AOM_DIST_INCLUDES}" "AOM_DIST_INCLUDES")
+foreach (inc ${AOM_DIST_INCLUDES})
+ file(INSTALL "${inc}" DESTINATION "${AOM_DIST_DIR}/include/aom")
+endforeach ()
+
+listify_string("${AOM_DIST_LIBS}" "AOM_DIST_LIBS")
+foreach (lib ${AOM_DIST_LIBS})
+ file(INSTALL "${lib}" DESTINATION "${AOM_DIST_DIR}/lib")
+endforeach ()
diff --git a/third_party/aom/build/cmake/generate_aom_config_templates.cmake b/third_party/aom/build/cmake/generate_aom_config_templates.cmake
index aea4253bb..effa456fc 100644
--- a/third_party/aom/build/cmake/generate_aom_config_templates.cmake
+++ b/third_party/aom/build/cmake/generate_aom_config_templates.cmake
@@ -37,6 +37,18 @@ set(h_file_header_block
\#ifndef AOM_CONFIG_H_
\#define AOM_CONFIG_H_
")
+set(cmake_file_header_block
+"##
+## Copyright (c) ${year}, 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.
+##
+")
# Terminates cmake execution when $var_name is an empty string, or the variable
# name it contains does not expand to an existing directory.
@@ -82,3 +94,13 @@ foreach(cache_var ${cmake_cache_vars})
endif ()
endforeach ()
+set(aom_rtcd_config_template "${AOM_CONFIG_DIR}/rtcd_config.cmake")
+file(WRITE "${aom_rtcd_config_template}" ${cmake_file_header_block})
+foreach(cache_var ${cmake_cache_vars})
+ if (NOT "${cache_var}" MATCHES
+ "AOM_CONFIG_DIR\|AOM_ROOT\|^CMAKE_\|INLINE\|RESTRICT")
+ file(APPEND "${aom_rtcd_config_template}"
+ "${cache_var}=\${RTCD_${cache_var}}\n")
+ endif ()
+endforeach ()
+
diff --git a/third_party/aom/build/cmake/msvc_runtime.cmake b/third_party/aom/build/cmake/msvc_runtime.cmake
index 0327217b4..3da5f7df6 100644
--- a/third_party/aom/build/cmake/msvc_runtime.cmake
+++ b/third_party/aom/build/cmake/msvc_runtime.cmake
@@ -8,6 +8,8 @@
## Media Patent License 1.0 was not distributed with this source code in the
## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
##
+if (NOT AOM_BUILD_CMAKE_MSVC_RUNTIME_CMAKE_)
+set(AOM_BUILD_CMAKE_MSVC_RUNTIME_CMAKE_ 1)
if (MSVC)
# CMake defaults to producing code linked to the DLL MSVC runtime. That will
@@ -24,3 +26,5 @@ if (MSVC)
endforeach (flag_var)
endif ()
endif ()
+
+endif () # AOM_BUILD_CMAKE_MSVC_RUNTIME_CMAKE_
diff --git a/third_party/aom/build/cmake/rtcd_config.cmake b/third_party/aom/build/cmake/rtcd_config.cmake
deleted file mode 100644
index cdea3452a..000000000
--- a/third_party/aom/build/cmake/rtcd_config.cmake
+++ /dev/null
@@ -1,137 +0,0 @@
-##
-## 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.
-##
-ARCH_ARM=${RTCD_ARCH_ARM}
-ARCH_MIPS=${RTCD_ARCH_MIPS}
-ARCH_X86=${RTCD_ARCH_X86}
-ARCH_X86_64=${RTCD_ARCH_X86_64}
-HAVE_NEON=${RTCD_HAVE_NEON}
-HAVE_NEON_ASM=${RTCD_HAVE_NEON_ASM}
-HAVE_MIPS32=${RTCD_HAVE_MIPS32}
-HAVE_DSPR2=${RTCD_HAVE_DSPR2}
-HAVE_MSA=${RTCD_HAVE_MSA}
-HAVE_MIPS64=${RTCD_HAVE_MIPS64}
-HAVE_MMX=${RTCD_HAVE_MMX}
-HAVE_SSE=${RTCD_HAVE_SSE}
-HAVE_SSE2=${RTCD_HAVE_SSE2}
-HAVE_SSE3=${RTCD_HAVE_SSE3}
-HAVE_SSSE3=${RTCD_HAVE_SSSE3}
-HAVE_SSE4_1=${RTCD_HAVE_SSE4_1}
-HAVE_AVX=${RTCD_HAVE_AVX}
-HAVE_AVX2=${RTCD_HAVE_AVX2}
-CONFIG_ACCOUNTING=${RTCD_CONFIG_ACCOUNTING}
-CONFIG_INSPECTION=${RTCD_CONFIG_INSPECTION}
-CONFIG_ADAPT_SCAN=${RTCD_CONFIG_ADAPT_SCAN}
-CONFIG_ALT_INTRA=${RTCD_CONFIG_ALT_INTRA}
-CONFIG_ANS=${RTCD_CONFIG_ANS}
-CONFIG_HIGHBITDEPTH=${RTCD_CONFIG_HIGHBITDEPTH}
-CONFIG_AOM_QM=${RTCD_CONFIG_AOM_QM}
-CONFIG_AV1=${RTCD_CONFIG_AV1}
-CONFIG_AV1_DECODER=${RTCD_CONFIG_AV1_DECODER}
-CONFIG_AV1_ENCODER=${RTCD_CONFIG_AV1_ENCODER}
-CONFIG_BIG_ENDIAN=${RTCD_CONFIG_BIG_ENDIAN}
-CONFIG_BITSTREAM_DEBUG=${RTCD_CONFIG_BITSTREAM_DEBUG}
-CONFIG_CB4X4=${RTCD_CONFIG_CB4X4}
-CONFIG_CDEF=${RTCD_CONFIG_CDEF}
-CONFIG_CHROMA_2X2=${RTCD_CONFIG_CHROMA_2X2}
-CONFIG_CODEC_SRCS=${RTCD_CONFIG_CODEC_SRCS}
-CONFIG_COEFFICIENT_RANGE_CHECKING=${RTCD_CONFIG_COEFFICIENT_RANGE_CHECKING}
-CONFIG_COEF_INTERLEAVE=${RTCD_CONFIG_COEF_INTERLEAVE}
-CONFIG_COMPOUND_SEGMENT=${RTCD_CONFIG_COMPOUND_SEGMENT}
-CONFIG_CONVOLVE_ROUND=${RTCD_CONFIG_CONVOLVE_ROUND}
-CONFIG_DAALA_DIST=${RTCD_CONFIG_DAALA_DIST}
-CONFIG_DAALA_EC=${RTCD_CONFIG_DAALA_EC}
-CONFIG_DEBUG=${RTCD_CONFIG_DEBUG}
-CONFIG_DEBUG_LIBS=${RTCD_CONFIG_DEBUG_LIBS}
-CONFIG_DECODERS=${RTCD_CONFIG_DECODERS}
-CONFIG_DECODE_PERF_TESTS=${RTCD_CONFIG_DECODE_PERF_TESTS}
-CONFIG_DELTA_Q=${RTCD_CONFIG_DELTA_Q}
-CONFIG_DEPENDENCY_TRACKING=${RTCD_CONFIG_DEPENDENCY_TRACKING}
-CONFIG_DEPENDENT_HORZTILES=${RTCD_CONFIG_DEPENDENT_HORZTILES}
-CONFIG_DUAL_FILTER=${RTCD_CONFIG_DUAL_FILTER}
-CONFIG_EC_ADAPT=${RTCD_CONFIG_EC_ADAPT}
-CONFIG_EC_MULTISYMBOL=${RTCD_CONFIG_EC_MULTISYMBOL}
-CONFIG_ENCODERS=${RTCD_CONFIG_ENCODERS}
-CONFIG_ENCODE_PERF_TESTS=${RTCD_CONFIG_ENCODE_PERF_TESTS}
-CONFIG_ENTROPY_STATS=${RTCD_CONFIG_ENTROPY_STATS}
-CONFIG_ERROR_CONCEALMENT=${RTCD_CONFIG_ERROR_CONCEALMENT}
-CONFIG_EXPERIMENTAL=${RTCD_CONFIG_EXPERIMENTAL}
-CONFIG_EXTERNAL_BUILD=${RTCD_CONFIG_EXTERNAL_BUILD}
-CONFIG_EXT_INTER=${RTCD_CONFIG_EXT_INTER}
-CONFIG_EXT_INTRA=${RTCD_CONFIG_EXT_INTRA}
-CONFIG_EXT_PARTITION=${RTCD_CONFIG_EXT_PARTITION}
-CONFIG_EXT_PARTITION_TYPES=${RTCD_CONFIG_EXT_PARTITION_TYPES}
-CONFIG_EXT_REFS=${RTCD_CONFIG_EXT_REFS}
-CONFIG_EXT_TILE=${RTCD_CONFIG_EXT_TILE}
-CONFIG_EXT_TX=${RTCD_CONFIG_EXT_TX}
-CONFIG_FILTER_7BIT=${RTCD_CONFIG_FILTER_7BIT}
-CONFIG_FILTER_INTRA=${RTCD_CONFIG_FILTER_INTRA}
-CONFIG_FP_MB_STATS=${RTCD_CONFIG_FP_MB_STATS}
-CONFIG_FRAME_SIZE=${RTCD_CONFIG_FRAME_SIZE}
-CONFIG_GCC=${RTCD_CONFIG_GCC}
-CONFIG_GCOV=${RTCD_CONFIG_GCOV}
-CONFIG_GLOBAL_MOTION=${RTCD_CONFIG_GLOBAL_MOTION}
-CONFIG_GPROF=${RTCD_CONFIG_GPROF}
-CONFIG_INSTALL_BINS=${RTCD_CONFIG_INSTALL_BINS}
-CONFIG_INSTALL_DOCS=${RTCD_CONFIG_INSTALL_DOCS}
-CONFIG_INSTALL_LIBS=${RTCD_CONFIG_INSTALL_LIBS}
-CONFIG_INSTALL_SRCS=${RTCD_CONFIG_INSTALL_SRCS}
-CONFIG_INTERNAL_STATS=${RTCD_CONFIG_INTERNAL_STATS}
-CONFIG_INTRA_INTERP=${RTCD_CONFIG_INTRA_INTERP}
-CONFIG_LIBYUV=${RTCD_CONFIG_LIBYUV}
-CONFIG_LOOPFILTERING_ACROSS_TILES=${RTCD_CONFIG_LOOPFILTERING_ACROSS_TILES}
-CONFIG_LOOP_RESTORATION=${RTCD_CONFIG_LOOP_RESTORATION}
-CONFIG_LOWBITDEPTH=${RTCD_CONFIG_LOWBITDEPTH}
-CONFIG_LV_MAP=${RTCD_CONFIG_LV_MAP}
-CONFIG_MASKED_TX=${RTCD_CONFIG_MASKED_TX}
-CONFIG_MOTION_VAR=${RTCD_CONFIG_MOTION_VAR}
-CONFIG_MSVS=${RTCD_CONFIG_MSVS}
-CONFIG_MULTITHREAD=${RTCD_CONFIG_MULTITHREAD}
-CONFIG_MV_COMPRESS=${RTCD_CONFIG_MV_COMPRESS}
-CONFIG_NCOBMC=${RTCD_CONFIG_NCOBMC}
-CONFIG_NEW_QUANT=${RTCD_CONFIG_NEW_QUANT}
-CONFIG_NEW_TOKENSET=${RTCD_CONFIG_NEW_TOKENSET}
-CONFIG_ONTHEFLY_BITPACKING=${RTCD_CONFIG_ONTHEFLY_BITPACKING}
-CONFIG_OS_SUPPORT=${RTCD_CONFIG_OS_SUPPORT}
-CONFIG_PALETTE=${RTCD_CONFIG_PALETTE}
-CONFIG_PALETTE_THROUGHPUT=${RTCD_CONFIG_PALETTE_THROUGHPUT}
-CONFIG_PARALLEL_DEBLOCKING=${RTCD_CONFIG_PARALLEL_DEBLOCKING}
-CONFIG_PIC=${RTCD_CONFIG_PIC}
-CONFIG_POSTPROC=${RTCD_CONFIG_POSTPROC}
-CONFIG_POSTPROC_VISUALIZER=${RTCD_CONFIG_POSTPROC_VISUALIZER}
-CONFIG_PVQ=${RTCD_CONFIG_PVQ}
-CONFIG_RAWBITS=${RTCD_CONFIG_RAWBITS}
-CONFIG_RD_DEBUG=${RTCD_CONFIG_RD_DEBUG}
-CONFIG_REALTIME_ONLY=${RTCD_CONFIG_REALTIME_ONLY}
-CONFIG_RECT_TX=${RTCD_CONFIG_RECT_TX}
-CONFIG_REFERENCE_BUFFER=${RTCD_CONFIG_REFERENCE_BUFFER}
-CONFIG_REF_ADAPT=${RTCD_CONFIG_REF_ADAPT}
-CONFIG_REF_MV=${RTCD_CONFIG_REF_MV}
-CONFIG_RUNTIME_CPU_DETECT=${RTCD_CONFIG_RUNTIME_CPU_DETECT}
-CONFIG_RVCT=${RTCD_CONFIG_RVCT}
-CONFIG_SHARED=${RTCD_CONFIG_SHARED}
-CONFIG_SIZE_LIMIT=${RTCD_CONFIG_SIZE_LIMIT}
-CONFIG_SMALL=${RTCD_CONFIG_SMALL}
-CONFIG_SPATIAL_RESAMPLING=${RTCD_CONFIG_SPATIAL_RESAMPLING}
-CONFIG_STATIC=${RTCD_CONFIG_STATIC}
-CONFIG_STATIC_MSVCRT=${RTCD_CONFIG_STATIC_MSVCRT}
-CONFIG_SUB8X8_MC=${RTCD_CONFIG_SUB8X8_MC}
-CONFIG_SUPERTX=${RTCD_CONFIG_SUPERTX}
-CONFIG_TEMPMV_SIGNALING=${RTCD_CONFIG_TEMPMV_SIGNALING}
-CONFIG_TILE_GROUPS=${RTCD_CONFIG_TILE_GROUPS}
-CONFIG_TPL_MV=${RTCD_CONFIG_TPL_MV}
-CONFIG_TRIPRED=${RTCD_CONFIG_TRIPRED}
-CONFIG_TX64X64=${RTCD_CONFIG_TX64X64}
-CONFIG_UNIT_TESTS=${RTCD_CONFIG_UNIT_TESTS}
-CONFIG_UNPOISON_PARTITION_CTX=${RTCD_CONFIG_UNPOISON_PARTITION_CTX}
-CONFIG_VAR_TX=${RTCD_CONFIG_VAR_TX}
-CONFIG_WARPED_MOTION=${RTCD_CONFIG_WARPED_MOTION}
-CONFIG_WEBM_IO=${RTCD_CONFIG_WEBM_IO}
-CONFIG_XIPHRC=${RTCD_CONFIG_XIPHRC}
diff --git a/third_party/aom/build/cmake/toolchains/armv7-ios.cmake b/third_party/aom/build/cmake/toolchains/armv7-ios.cmake
index bcd37a06d..71ac4067c 100644
--- a/third_party/aom/build/cmake/toolchains/armv7-ios.cmake
+++ b/third_party/aom/build/cmake/toolchains/armv7-ios.cmake
@@ -27,8 +27,4 @@ set(AOM_NEON_INTRIN_FLAG "")
# No runtime cpu detect for armv7s-ios.
set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE BOOL "")
-# RTCD generation requires --disable-media for armv7s-ios.
-set(AOM_RTCD_FLAGS ${AOM_RTCD_FLAGS} --disable-media)
-string(STRIP AOM_RTCD_FLAGS ${AOM_RTCD_FLAGS})
-
endif () # AOM_BUILD_CMAKE_TOOLCHAINS_ARMV7_IOS_CMAKE_
diff --git a/third_party/aom/build/cmake/toolchains/armv7s-ios.cmake b/third_party/aom/build/cmake/toolchains/armv7s-ios.cmake
index 08a0a37ee..99e1dc39c 100644
--- a/third_party/aom/build/cmake/toolchains/armv7s-ios.cmake
+++ b/third_party/aom/build/cmake/toolchains/armv7s-ios.cmake
@@ -27,8 +27,4 @@ set(AOM_NEON_INTRIN_FLAG "")
# No runtime cpu detect for armv7s-ios.
set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE BOOL "")
-# RTCD generation requires --disable-media for armv7s-ios.
-set(AOM_RTCD_FLAGS ${AOM_RTCD_FLAGS} --disable-media)
-string(STRIP AOM_RTCD_FLAGS ${AOM_RTCD_FLAGS})
-
endif () # AOM_BUILD_CMAKE_TOOLCHAINS_ARMV7S_IOS_CMAKE_
diff --git a/third_party/aom/build/make/Android.mk b/third_party/aom/build/make/Android.mk
index 6757b1f59..e50faef92 100644
--- a/third_party/aom/build/make/Android.mk
+++ b/third_party/aom/build/make/Android.mk
@@ -43,10 +43,6 @@
# Configuring with --disable-runtime-cpu-detect --disable-neon \
# --disable-neon-asm
# will remove any NEON dependency.
-
-# To change to building armeabi, run ./libaom/configure again, but with
-# --target=armv6-android-gcc and modify the Application.mk file to
-# set APP_ABI := armeabi
#
# Running ndk-build will build libaom and include it in your project.
#
@@ -61,9 +57,6 @@ ASM_CNV_PATH := $(LOCAL_PATH)/$(ASM_CNV_PATH_LOCAL)
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
include $(CONFIG_DIR)libs-armv7-android-gcc.mk
LOCAL_ARM_MODE := arm
-else ifeq ($(TARGET_ARCH_ABI),armeabi)
- include $(CONFIG_DIR)libs-armv6-android-gcc.mk
- LOCAL_ARM_MODE := arm
else ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
include $(CONFIG_DIR)libs-armv8-android-gcc.mk
LOCAL_ARM_MODE := arm
diff --git a/third_party/aom/build/make/configure.sh b/third_party/aom/build/make/configure.sh
index 4ece17aee..b18173b82 100644
--- a/third_party/aom/build/make/configure.sh
+++ b/third_party/aom/build/make/configure.sh
@@ -687,9 +687,6 @@ process_common_toolchain() {
aarch64*)
tgt_isa=arm64
;;
- armv6*)
- tgt_isa=armv6
- ;;
armv7*-hardfloat* | armv7*-gnueabihf | arm-*-gnueabihf)
tgt_isa=armv7
float_abi=hard
@@ -898,37 +895,6 @@ process_common_toolchain() {
if disabled neon && enabled neon_asm; then
die "Disabling neon while keeping neon-asm is not supported"
fi
- case ${toolchain} in
- # Apple iOS SDKs no longer support armv6 as of the version 9
- # release (coincides with release of Xcode 7). Only enable media
- # when using earlier SDK releases.
- *-darwin*)
- if [ "$(show_darwin_sdk_major_version iphoneos)" -lt 9 ]; then
- soft_enable media
- else
- soft_disable media
- RTCD_OPTIONS="${RTCD_OPTIONS}--disable-media "
- fi
- ;;
- *)
- soft_enable media
- ;;
- esac
- ;;
- armv6)
- case ${toolchain} in
- *-darwin*)
- if [ "$(show_darwin_sdk_major_version iphoneos)" -lt 9 ]; then
- soft_enable media
- else
- die "Your iOS SDK does not support armv6."
- fi
- ;;
- *)
- soft_enable media
- ;;
- esac
- ;;
esac
asm_conversion_cmd="cat"
diff --git a/third_party/aom/build/make/rtcd.pl b/third_party/aom/build/make/rtcd.pl
index 354ae5176..7add5a036 100755
--- a/third_party/aom/build/make/rtcd.pl
+++ b/third_party/aom/build/make/rtcd.pl
@@ -382,12 +382,8 @@ if ($opts{arch} eq 'x86') {
}
close CONFIG_FILE;
mips;
-} elsif ($opts{arch} eq 'armv6') {
- @ALL_ARCHS = filter(qw/media/);
- arm;
} elsif ($opts{arch} =~ /armv7\w?/) {
- @ALL_ARCHS = filter(qw/media neon_asm neon/);
- @REQUIRES = filter(keys %required ? keys %required : qw/media/);
+ @ALL_ARCHS = filter(qw/neon_asm neon/);
&require(@REQUIRES);
arm;
} elsif ($opts{arch} eq 'armv8' || $opts{arch} eq 'arm64' ) {
diff --git a/third_party/aom/build/make/version.sh b/third_party/aom/build/make/version.sh
index c0eef9f58..2a7090e4d 100755
--- a/third_party/aom/build/make/version.sh
+++ b/third_party/aom/build/make/version.sh
@@ -28,13 +28,14 @@ if [ -e "${source_path}/.git" ]; then
# Source Path is a git working copy. Check for local modifications.
# Note that git submodules may have a file as .git, not a directory.
export GIT_DIR="${source_path}/.git"
- git_version_id=`git describe --match=v[0-9]* 2>/dev/null`
+ git_version_id=$(git describe --match=v[0-9]* 2>/dev/null)
fi
changelog_version=""
for p in "${source_path}" "${source_path}/.."; do
if [ -z "$git_version_id" -a -f "${p}/CHANGELOG" ]; then
- changelog_version=`head -n1 "${p}/CHANGELOG" | awk '{print $2}'`
+ changelog_version=$(grep -m 1 " v[0-9]" "${p}/CHANGELOG" \
+ | awk '{print $2}')
changelog_version="${changelog_version}"
break
fi
diff --git a/third_party/aom/configure b/third_party/aom/configure
index 83ec996ce..7e9c62178 100755
--- a/third_party/aom/configure
+++ b/third_party/aom/configure
@@ -94,9 +94,6 @@ EOF
# alphabetically by architecture, generic-gnu last.
all_platforms="${all_platforms} arm64-darwin-gcc"
all_platforms="${all_platforms} arm64-linux-gcc"
-all_platforms="${all_platforms} armv6-linux-rvct"
-all_platforms="${all_platforms} armv6-linux-gcc"
-all_platforms="${all_platforms} armv6-none-rvct"
all_platforms="${all_platforms} armv7-android-gcc" #neon Cortex-A8
all_platforms="${all_platforms} armv7-darwin-gcc" #neon Cortex-A8
all_platforms="${all_platforms} armv7-linux-rvct" #neon Cortex-A8
@@ -197,6 +194,7 @@ enable_feature dependency_tracking
enable_feature spatial_resampling
enable_feature multithread
enable_feature os_support
+enable_feature highbitdepth
CODECS="
av1_encoder
@@ -223,8 +221,6 @@ ARCH_EXT_LIST_X86="
avx2
"
ARCH_EXT_LIST="
- edsp
- media
neon
neon_asm
@@ -248,17 +244,18 @@ EXPERIMENT_LIST="
cdef
var_tx
rect_tx
- ref_mv
+ rect_tx_ext
tpl_mv
dual_filter
convolve_round
compound_round
ext_tx
+ dpcm_intra
tx64x64
- sub8x8_mc
ext_intra
intra_interp
filter_intra
+ intra_edge
intrabc
ext_inter
interintra
@@ -269,8 +266,6 @@ EXPERIMENT_LIST="
new_quant
supertx
ans
- ec_multisymbol
- new_tokenset
loop_restoration
ext_partition
ext_partition_types
@@ -280,12 +275,10 @@ EXPERIMENT_LIST="
ncobmc
warped_motion
q_adapt_probs
- subframe_prob_update
bitstream_debug
alt_intra
palette
palette_delta_encoding
- daala_ec
rawbits
ec_smallmul
pvq
@@ -322,7 +315,9 @@ EXPERIMENT_LIST="
new_multisymbol
compound_singleref
aom_qm
- lowdelay_compound
+ one_sided_compound
+ smooth_hv
+ var_refs
"
CONFIG_LIST="
dependency_tracking
@@ -349,8 +344,6 @@ CONFIG_LIST="
internal_stats
${CODECS}
${CODEC_FAMILIES}
- encoders
- decoders
static_msvcrt
spatial_resampling
realtime_only
@@ -476,17 +469,17 @@ post_process_cmdline() {
done
# Enable adopted experiments by default
- soft_enable ref_mv
soft_enable cb4x4
+ soft_enable chroma_sub8x8
soft_enable filter_7bit
soft_enable reference_buffer
soft_enable delta_q
soft_enable tile_groups
soft_enable rect_tx
soft_enable global_motion
+ soft_enable ext_tx
soft_enable cdef
soft_enable ec_adapt
- soft_enable new_tokenset
soft_enable ext_intra
soft_enable mv_compress
soft_enable ext_refs
@@ -494,6 +487,14 @@ post_process_cmdline() {
soft_enable motion_var
soft_enable warped_motion
soft_enable ext_delta_q
+ soft_enable loopfiltering_across_tiles
+ soft_enable ec_smallmul
+ soft_enable var_tx
+ soft_enable one_sided_compound
+ soft_enable ext_inter
+ soft_enable wedge
+ soft_enable compound_segment
+ soft_enable interintra
# Backwards/jenkins compatibility with --enable-aom-highbitdepth
enabled aom_highbitdepth && enable_feature highbitdepth
@@ -501,29 +502,38 @@ post_process_cmdline() {
# Enable low-bitdepth pixel pipeline by default
soft_enable lowbitdepth
- ! enabled ans && soft_enable daala_ec
- soft_enable ec_multisymbol
soft_enable palette
soft_enable alt_intra
soft_enable palette_throughput
+ soft_enable tempmv_signaling
# Fix up experiment dependencies
enabled pvq && enable_feature ec_adapt
- enabled ec_adapt && enable_feature ec_multisymbol
- enabled new_tokenset && enable_feature ec_multisymbol
- enabled new_multisymbol && enable_feature ec_multisymbol
- enabled ec_multisymbol && ! enabled ans && soft_enable daala_ec
- enabled ec_multisymbol && ! enabled daala_ec && soft_enable ans
+ enabled pvq && disable_feature chroma_sub8x8
+ enabled pvq && disable_feature cb4x4
+ enabled pvq && disable_feature rect_tx
+ enabled pvq && disable_feature ext_tx
+ enabled pvq && disable_feature var_tx
enabled palette_throughput && soft_enable palette
enabled ext_delta_q && soft_enable delta_q
enabled txk_sel && soft_enable lv_map
enabled compound_round && soft_enable convolve_round
- if enabled rawbits && ! enabled daala_ec; then
- log_echo "rawbits requires daala_ec, so disabling rawbits"
+ enabled smooth_hv && soft_enable alt_intra
+ enabled intra_edge && enable_feature ext_intra
+ enabled chroma_2x2 && disable_feature chroma_sub8x8
+ enabled dpcm_intra && enable_feature ext_tx
+ enabled chroma_sub8x8 && enable_feature cb4x4
+
+ if ! enabled delta_q && enabled ext_delta_q; then
+ log_echo "ext_delta_q requires delta_q, so disabling ext_delta_q"
+ disable_feature ext_delta_q
+ fi
+ if enabled rawbits && enabled ans; then
+ log_echo "rawbits requires not ans, so disabling rawbits"
disable_feature rawbits
fi
- if enabled ec_smallmul && ! enabled daala_ec; then
- log_echo "ec_smallmul requires daala_ec, so disabling ec_smallmul"
+ if enabled ec_smallmul && enabled ans; then
+ log_echo "ec_smallmul requires not ans, so disabling ec_smallmul"
disable_feature ec_smallmul
fi
if enabled ext_tile; then
@@ -541,6 +551,11 @@ post_process_cmdline() {
soft_enable accounting
soft_enable inspection
fi
+ if enabled parallel_deblocking_15tap && ! enabled parallel_deblocking; then
+ log_echo "parallel_deblocking_15tap dependes on parallel_deblocking, so"
+ log_echo "enabling parallel_deblocking"
+ soft_enable parallel_deblocking
+ fi
}
process_targets() {
diff --git a/third_party/aom/docs.cmake b/third_party/aom/docs.cmake
new file mode 100644
index 000000000..d6c5c26c9
--- /dev/null
+++ b/third_party/aom/docs.cmake
@@ -0,0 +1,228 @@
+##
+## 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.
+##
+if (NOT AOM_DOCS_CMAKE_)
+set(AOM_DOCS_CMAKE_ 1)
+
+cmake_minimum_required(VERSION 3.5)
+
+set(AOM_DOXYFILE "${AOM_CONFIG_DIR}/doxyfile")
+set(AOM_DOXYGEN_CONFIG_TEMPLATE "libs.doxy_template")
+set(AOM_DOXYGEN_OUTPUT_DIR "${AOM_CONFIG_DIR}/dox")
+set(AOM_DOXYGEN_SECTIONS "av1")
+
+set(AOM_DOXYGEN_SOURCES
+ "${AOM_ROOT}/aom/aom.h"
+ "${AOM_ROOT}/aom/aom_codec.h"
+ "${AOM_ROOT}/aom/aom_frame_buffer.h"
+ "${AOM_ROOT}/aom/aom_image.h"
+ "${AOM_ROOT}/aom/aom_integer.h"
+ "${AOM_ROOT}/keywords.dox"
+ "${AOM_ROOT}/mainpage.dox"
+ "${AOM_ROOT}/usage.dox")
+
+if (CONFIG_AV1_DECODER)
+ set(AOM_DOXYGEN_EXAMPLE_SOURCES
+ ${AOM_DOXYGEN_EXAMPLE_SOURCES}
+ "${AOM_ROOT}/aomdec.c"
+ "${AOM_ROOT}/examples/decode_to_md5.c"
+ "${AOM_ROOT}/examples/decode_with_drops.c"
+ "${AOM_ROOT}/examples/simple_decoder.c")
+
+ set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS
+ ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
+ "Full featured decoder."
+ "Frame by frame MD5 checksum."
+ "Drops frames while decoding."
+ "Simplified decoder loop.")
+
+ set(AOM_DOXYGEN_SECTIONS ${AOM_DOXYGEN_SECTIONS} "av1_decoder decoder")
+
+ set(AOM_DOXYGEN_SOURCES
+ ${AOM_DOXYGEN_SOURCES}
+ "${AOM_ROOT}/aom/aom_decoder.h"
+ "${AOM_ROOT}/aom/aomdx.h"
+ "${AOM_ROOT}/usage_dx.dox")
+
+ if (CONFIG_ANALYZER)
+ set(AOM_DOXYGEN_EXAMPLE_SOURCES
+ ${AOM_DOXYGEN_EXAMPLE_SOURCES}
+ "${AOM_ROOT}examples/analyzer.cc")
+
+ set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS
+ ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
+ "Bitstream analyzer.")
+ endif ()
+
+ if (CONFIG_INSPECTION)
+ set(AOM_DOXYGEN_EXAMPLE_SOURCES
+ ${AOM_DOXYGEN_EXAMPLE_SOURCES}
+ "${AOM_ROOT}/examples/inspect.c")
+
+ set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS
+ ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
+ "Bitstream inspector.")
+ endif ()
+endif ()
+
+if (CONFIG_AV1_ENCODER)
+ set(AOM_DOXYGEN_EXAMPLE_SOURCES
+ ${AOM_DOXYGEN_EXAMPLE_SOURCES}
+ "${AOM_ROOT}/aomenc.c"
+ "${AOM_ROOT}/examples/lossless_encoder.c"
+ "${AOM_ROOT}/examples/set_maps.c"
+ "${AOM_ROOT}/examples/simple_encoder.c"
+ "${AOM_ROOT}/examples/twopass_encoder.c")
+
+ set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS
+ ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
+ "Full featured encoder."
+ "Simplified lossless encoder."
+ "Set active and ROI maps."
+ "Simplified encoder loop."
+ "Two-pass encoder loop.")
+
+ set(AOM_DOXYGEN_SECTIONS ${AOM_DOXYGEN_SECTIONS} "av1_encoder encoder")
+
+ set(AOM_DOXYGEN_SOURCES
+ ${AOM_DOXYGEN_SOURCES}
+ "${AOM_ROOT}/aom/aomcx.h"
+ "${AOM_ROOT}/aom/aom_encoder.h"
+ "${AOM_ROOT}/usage_cx.dox")
+endif ()
+
+if (CONFIG_AV1_DECODER AND CONFIG_AV1_ENCODER)
+ set(AOM_DOXYGEN_EXAMPLE_SOURCES
+ ${AOM_DOXYGEN_EXAMPLE_SOURCES}
+ "${AOM_ROOT}/examples/aom_cx_set_ref.c")
+
+ set(AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS
+ ${AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS}
+ "Set encoder reference frame.")
+endif ()
+
+# Iterates over list named by $list_name and appends each item to $AOM_DOXYFILE
+# as values assigned to $var_name with no line breaks between list items.
+# Appends a new line after the entire config variable is expanded.
+function (write_cmake_list_to_doxygen_config_var var_name list_name)
+ unset(output_string)
+ foreach (list_item ${${list_name}})
+ set(output_string "${output_string} ${list_item} ")
+ endforeach ()
+ string(STRIP "${output_string}" output_string)
+ file(APPEND "${AOM_DOXYFILE}" "${var_name} += ${output_string}\n")
+endfunction ()
+
+function (get_name file_path name_var)
+ get_filename_component(file_basename ${file_path} NAME)
+ get_filename_component(${name_var} ${file_basename} NAME_WE)
+ set(${name_var} ${${name_var}} PARENT_SCOPE)
+endfunction ()
+
+function (setup_documentation_targets)
+ # Sanity check: the lengths of these lists must match.
+ list(LENGTH AOM_DOXYGEN_EXAMPLE_SOURCES num_sources)
+ list(LENGTH AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS num_descs)
+ if (NOT ${num_sources} EQUAL ${num_descs})
+ message(FATAL_ERROR "Unqeual example and description totals.")
+ endif ()
+
+ # Take the list of examples and produce example_basename.dox for each file in
+ # the list.
+ file(MAKE_DIRECTORY "${AOM_DOXYGEN_OUTPUT_DIR}")
+ foreach (example_file ${AOM_DOXYGEN_EXAMPLE_SOURCES})
+ unset(example_basename)
+ get_name("${example_file}" "example_name")
+ set(example_dox "${AOM_DOXYGEN_OUTPUT_DIR}/${example_name}.dox")
+ set(dox_string "/*!\\page example_${example_name} ${example_name}\n")
+ set(dox_string "${dox_string} \\includelineno ${example_file}\n*/\n")
+ file(WRITE "${example_dox}" ${dox_string})
+ set(AOM_DOXYGEN_SOURCES ${AOM_DOXYGEN_SOURCES} "${example_dox}")
+ endforeach ()
+
+ # Generate samples.dox, an index page that refers to the example_basename.dox
+ # files that were just created.
+ set(samples_header
+"
+/*!\\page samples Sample Code
+This SDK includes a number of sample applications. Each sample documents a
+feature of the SDK in both prose and the associated C code. The following
+samples are included:
+")
+
+ set(utils_desc
+"
+In addition, the SDK contains a number of utilities. Since these utilities are
+built upon the concepts described in the sample code listed above, they are not
+documented in pieces like the samples are. Their source is included here for
+reference. The following utilities are included:
+")
+
+ # Write the description for the samples section.
+ set(samples_dox "${AOM_CONFIG_DIR}/samples.dox")
+ file(WRITE "${samples_dox}" "${samples_header}\n")
+
+ # Iterate over $AOM_DOXYGEN_EXAMPLE_SOURCES and
+ # $AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS and massage example names as required by
+ # AV1's doxygen setup.
+ math(EXPR max_example_index "${num_sources} - 1")
+ foreach (NUM RANGE ${max_example_index})
+ list(GET AOM_DOXYGEN_EXAMPLE_SOURCES ${NUM} ex_name)
+ get_name("${ex_name}" "ex_name")
+
+ # AV1's doxygen lists aomdec and aomenc as utils apart from the examples.
+ # Save the indexes for another pass.
+ if ("${ex_name}" MATCHES "aomdec\|aomenc")
+ set(util_indexes "${util_indexes}" "${NUM}")
+ continue()
+ endif ()
+ list(GET AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${NUM} ex_desc)
+ file(APPEND "${samples_dox}" " - \\subpage example_${ex_name} ${ex_desc}\n")
+ endforeach ()
+
+ # Write the description and index for the utils.
+ file(APPEND "${samples_dox}" "${utils_desc}\n")
+ foreach (util_index ${util_indexes})
+ list(GET AOM_DOXYGEN_EXAMPLE_SOURCES ${util_index} ex_name)
+ get_name("${ex_name}" "ex_name")
+ list(GET AOM_DOXYGEN_EXAMPLE_DESCRIPTIONS ${util_index} ex_desc)
+ file(APPEND "${samples_dox}" " - \\subpage example_${ex_name} ${ex_desc}\n")
+ endforeach ()
+ file(APPEND "${samples_dox}" "*/")
+
+ # Add $samples_dox to the doxygen inputs.
+ get_filename_component(samples_dox ${samples_dox} NAME)
+ set(AOM_DOXYGEN_SOURCES ${AOM_DOXYGEN_SOURCES} ${samples_dox})
+
+ # Generate libaom's doxyfile.
+ file(COPY "${AOM_ROOT}/${AOM_DOXYGEN_CONFIG_TEMPLATE}"
+ DESTINATION "${AOM_CONFIG_DIR}")
+ file(RENAME
+ "${AOM_CONFIG_DIR}/${AOM_DOXYGEN_CONFIG_TEMPLATE}" "${AOM_DOXYFILE}")
+ file(APPEND "${AOM_DOXYFILE}"
+ "EXAMPLE_PATH += ${AOM_ROOT} ${AOM_ROOT}/examples\n")
+ file(APPEND
+ "${AOM_DOXYFILE}" "INCLUDE_PATH += ${AOM_CONFIG_DIR} ${AOM_ROOT}\n")
+ file(APPEND "${AOM_DOXYFILE}"
+ "STRIP_FROM_PATH += ${AOM_ROOT} ${AOM_CONFIG_DIR}\n")
+ write_cmake_list_to_doxygen_config_var("INPUT" "AOM_DOXYGEN_SOURCES")
+ write_cmake_list_to_doxygen_config_var("ENABLED_SECTIONS"
+ "AOM_DOXYGEN_SECTIONS")
+
+ # Add the doxygen generation rule.
+ add_custom_target(docs ALL
+ COMMAND "${DOXYGEN_EXECUTABLE}" "${AOM_DOXYFILE}"
+ DEPENDS "${AOM_DOXYFILE}" ${AOM_DOXYGEN_SOURCES}
+ ${AOM_DOXYGEN_EXAMPLE_SOURCES}
+ SOURCES "${AOM_DOXYFILE}" ${AOM_DOXYGEN_SOURCES}
+ ${AOM_DOXYGEN_EXAMPLE_SOURCES})
+endfunction ()
+
+endif () # AOM_DOCS_CMAKE_
diff --git a/third_party/aom/examples.mk b/third_party/aom/examples.mk
index 95206924e..2aa4c3592 100644
--- a/third_party/aom/examples.mk
+++ b/third_party/aom/examples.mk
@@ -64,7 +64,7 @@ endif
# List of examples to build. UTILS are tools meant for distribution
# while EXAMPLES demonstrate specific portions of the API.
-UTILS-$(CONFIG_DECODERS) += aomdec.c
+UTILS-$(CONFIG_AV1_DECODER) += aomdec.c
aomdec.SRCS += md5_utils.c md5_utils.h
aomdec.SRCS += aom_ports/mem_ops.h
aomdec.SRCS += aom_ports/mem_ops_aligned.h
@@ -86,7 +86,7 @@ ifeq ($(CONFIG_WEBM_IO),yes)
endif
aomdec.GUID = BA5FE66F-38DD-E034-F542-B1578C5FB950
aomdec.DESCRIPTION = Full featured decoder
-UTILS-$(CONFIG_ENCODERS) += aomenc.c
+UTILS-$(CONFIG_AV1_ENCODER) += aomenc.c
aomenc.SRCS += args.c args.h y4minput.c y4minput.h aomenc.h
aomenc.SRCS += ivfdec.c ivfdec.h
aomenc.SRCS += ivfenc.c ivfenc.h
@@ -112,7 +112,7 @@ aomenc.GUID = 548DEC74-7A15-4B2B-AFC3-AA102E7C25C1
aomenc.DESCRIPTION = Full featured encoder
ifeq ($(CONFIG_ANALYZER),yes)
- EXAMPLES-$(CONFIG_DECODERS) += analyzer.cc
+ EXAMPLES-$(CONFIG_AV1_DECODER) += analyzer.cc
analyzer.GUID = 83827a8c-e3c3-4b19-8832-0cfc206c4496
analyzer.SRCS += ivfdec.h ivfdec.c
analyzer.SRCS += av1/decoder/inspection.h
@@ -123,20 +123,20 @@ ifeq ($(CONFIG_ANALYZER),yes)
endif
ifeq ($(CONFIG_INSPECTION),yes)
-EXAMPLES-$(CONFIG_DECODERS) += inspect.c
-inspect.GUID = FA46A420-3356-441F-B0FD-60AA1345C181
-inspect.SRCS += ivfdec.h ivfdec.c
-inspect.SRCS += args.c args.h
-inspect.SRCS += tools_common.h tools_common.c
-inspect.SRCS += video_common.h
-inspect.SRCS += video_reader.h video_reader.c
-inspect.SRCS += aom_ports/mem_ops.h
-inspect.SRCS += aom_ports/mem_ops_aligned.h
-inspect.SRCS += aom_ports/msvc.h
-inspect.DESCRIPTION = Dump inspection data
+EXAMPLES-$(CONFIG_AV1_DECODER) += inspect.c
+inspect.GUID = FA46A420-3356-441F-B0FD-60AA1345C181
+inspect.SRCS += ivfdec.h ivfdec.c
+inspect.SRCS += args.c args.h
+inspect.SRCS += tools_common.h tools_common.c
+inspect.SRCS += video_common.h
+inspect.SRCS += video_reader.h video_reader.c
+inspect.SRCS += aom_ports/mem_ops.h
+inspect.SRCS += aom_ports/mem_ops_aligned.h
+inspect.SRCS += aom_ports/msvc.h
+inspect.DESCRIPTION = Dump inspection data
endif
-EXAMPLES-$(CONFIG_DECODERS) += simple_decoder.c
+EXAMPLES-$(CONFIG_AV1_DECODER) += simple_decoder.c
simple_decoder.GUID = D3BBF1E9-2427-450D-BBFF-B2843C1D44CC
simple_decoder.SRCS += ivfdec.h ivfdec.c
simple_decoder.SRCS += tools_common.h tools_common.c
@@ -146,7 +146,7 @@ simple_decoder.SRCS += aom_ports/mem_ops.h
simple_decoder.SRCS += aom_ports/mem_ops_aligned.h
simple_decoder.SRCS += aom_ports/msvc.h
simple_decoder.DESCRIPTION = Simplified decoder loop
-EXAMPLES-$(CONFIG_DECODERS) += decode_to_md5.c
+EXAMPLES-$(CONFIG_AV1_DECODER) += decode_to_md5.c
decode_to_md5.SRCS += md5_utils.h md5_utils.c
decode_to_md5.SRCS += ivfdec.h ivfdec.c
decode_to_md5.SRCS += tools_common.h tools_common.c
@@ -157,7 +157,7 @@ decode_to_md5.SRCS += aom_ports/mem_ops_aligned.h
decode_to_md5.SRCS += aom_ports/msvc.h
decode_to_md5.GUID = 59120B9B-2735-4BFE-B022-146CA340FE42
decode_to_md5.DESCRIPTION = Frame by frame MD5 checksum
-EXAMPLES-$(CONFIG_ENCODERS) += simple_encoder.c
+EXAMPLES-$(CONFIG_AV1_ENCODER) += simple_encoder.c
simple_encoder.SRCS += ivfenc.h ivfenc.c
simple_encoder.SRCS += tools_common.h tools_common.c
simple_encoder.SRCS += video_common.h
@@ -173,7 +173,7 @@ lossless_encoder.SRCS += video_writer.h video_writer.c
lossless_encoder.SRCS += aom_ports/msvc.h
lossless_encoder.GUID = B63C7C88-5348-46DC-A5A6-CC151EF93366
lossless_encoder.DESCRIPTION = Simplified lossless encoder
-EXAMPLES-$(CONFIG_ENCODERS) += twopass_encoder.c
+EXAMPLES-$(CONFIG_AV1_ENCODER) += twopass_encoder.c
twopass_encoder.SRCS += ivfenc.h ivfenc.c
twopass_encoder.SRCS += tools_common.h tools_common.c
twopass_encoder.SRCS += video_common.h
@@ -181,7 +181,7 @@ twopass_encoder.SRCS += video_writer.h video_writer.c
twopass_encoder.SRCS += aom_ports/msvc.h
twopass_encoder.GUID = 73494FA6-4AF9-4763-8FBB-265C92402FD8
twopass_encoder.DESCRIPTION = Two-pass encoder loop
-EXAMPLES-$(CONFIG_DECODERS) += decode_with_drops.c
+EXAMPLES-$(CONFIG_AV1_DECODER) += decode_with_drops.c
decode_with_drops.SRCS += ivfdec.h ivfdec.c
decode_with_drops.SRCS += tools_common.h tools_common.c
decode_with_drops.SRCS += video_common.h
@@ -191,7 +191,7 @@ decode_with_drops.SRCS += aom_ports/mem_ops_aligned.h
decode_with_drops.SRCS += aom_ports/msvc.h
decode_with_drops.GUID = CE5C53C4-8DDA-438A-86ED-0DDD3CDB8D26
decode_with_drops.DESCRIPTION = Drops frames while decoding
-EXAMPLES-$(CONFIG_ENCODERS) += set_maps.c
+EXAMPLES-$(CONFIG_AV1_ENCODER) += set_maps.c
set_maps.SRCS += ivfenc.h ivfenc.c
set_maps.SRCS += tools_common.h tools_common.c
set_maps.SRCS += video_common.h
@@ -199,9 +199,9 @@ set_maps.SRCS += video_writer.h video_writer.c
set_maps.SRCS += aom_ports/msvc.h
set_maps.GUID = ECB2D24D-98B8-4015-A465-A4AF3DCC145F
set_maps.DESCRIPTION = Set active and ROI maps
-ifeq ($(CONFIG_ENCODERS),yes)
-ifeq ($(CONFIG_DECODERS),yes)
-EXAMPLES-$(CONFIG_ENCODERS) += aom_cx_set_ref.c
+ifeq ($(CONFIG_AV1_ENCODER),yes)
+ifeq ($(CONFIG_AV1_DECODER),yes)
+EXAMPLES-$(CONFIG_AV1_ENCODER) += aom_cx_set_ref.c
aom_cx_set_ref.SRCS += ivfenc.h ivfenc.c
aom_cx_set_ref.SRCS += tools_common.h tools_common.c
aom_cx_set_ref.SRCS += examples/encoder_util.h
diff --git a/third_party/aom/examples/inspect.c b/third_party/aom/examples/inspect.c
index 345c0884d..294e478af 100644
--- a/third_party/aom/examples/inspect.c
+++ b/third_party/aom/examples/inspect.c
@@ -27,17 +27,17 @@
#endif
#include "aom/aom_decoder.h"
+#include "./aom_config.h"
+#if CONFIG_ACCOUNTING
+#include "../av1/decoder/accounting.h"
+#endif
+#include "../av1/decoder/inspection.h"
#include "aom/aomdx.h"
#include "../tools_common.h"
#include "../video_reader.h"
-#include "./aom_config.h"
// #include "av1/av1_dx_iface.c"
#include "../av1/common/onyxc_int.h"
-#if CONFIG_ACCOUNTING
-#include "../av1/decoder/accounting.h"
-#endif
-#include "../av1/decoder/inspection.h"
#include "../video_common.h"
@@ -56,7 +56,8 @@ typedef enum {
REFERENCE_FRAME_LAYER = 1 << 8,
MOTION_VECTORS_LAYER = 1 << 9,
UV_MODE_LAYER = 1 << 10,
- ALL_LAYERS = (1 << 11) - 1
+ CFL_LAYER = 1 << 11,
+ ALL_LAYERS = (1 << 12) - 1
} LayerType;
static LayerType layers = 0;
@@ -86,6 +87,10 @@ static const arg_def_t dump_skip_arg = ARG_DEF("s", "skip", 0, "Dump Skip");
static const arg_def_t dump_filter_arg =
ARG_DEF("f", "filter", 0, "Dump Filter");
static const arg_def_t dump_cdef_arg = ARG_DEF("c", "cdef", 0, "Dump CDEF");
+#if CONFIG_CFL
+static const arg_def_t dump_cfl_arg =
+ ARG_DEF("cfl", "chroma_from_luma", 0, "Dump Chroma from Luma Alphas");
+#endif
static const arg_def_t dump_reference_frame_arg =
ARG_DEF("r", "referenceFrame", 0, "Dump Reference Frame");
static const arg_def_t usage_arg = ARG_DEF("h", "help", 0, "Help");
@@ -106,6 +111,9 @@ static const arg_def_t *main_args[] = { &limit_arg,
#if CONFIG_CDEF
&dump_cdef_arg,
#endif
+#if CONFIG_CFL
+ &dump_cfl_arg,
+#endif
&dump_reference_frame_arg,
&dump_motion_vectors_arg,
&usage_arg,
@@ -145,7 +153,7 @@ const map_entry block_size_map[] = {
};
const map_entry tx_size_map[] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
ENUM(TX_2X2),
#endif
ENUM(TX_4X4), ENUM(TX_8X8), ENUM(TX_16X16), ENUM(TX_32X32),
@@ -177,28 +185,39 @@ const map_entry tx_type_map[] = { ENUM(DCT_DCT),
#endif
LAST_ENUM };
-const map_entry prediction_mode_map[] = {
- ENUM(DC_PRED), ENUM(V_PRED),
- ENUM(H_PRED), ENUM(D45_PRED),
- ENUM(D135_PRED), ENUM(D117_PRED),
- ENUM(D153_PRED), ENUM(D207_PRED),
- ENUM(D63_PRED),
+const map_entry prediction_mode_map[] = { ENUM(DC_PRED),
+ ENUM(V_PRED),
+ ENUM(H_PRED),
+ ENUM(D45_PRED),
+ ENUM(D135_PRED),
+ ENUM(D117_PRED),
+ ENUM(D153_PRED),
+ ENUM(D207_PRED),
+ ENUM(D63_PRED),
#if CONFIG_ALT_INTRA
- ENUM(SMOOTH_PRED),
-#endif
- ENUM(TM_PRED), ENUM(NEARESTMV),
- ENUM(NEARMV), ENUM(ZEROMV),
- ENUM(NEWMV),
+ ENUM(SMOOTH_PRED),
+#if CONFIG_SMOOTH_HV
+ ENUM(SMOOTH_V_PRED),
+ ENUM(SMOOTH_H_PRED),
+#endif // CONFIG_SMOOTH_HV
+#endif // CONFIG_ALT_INTRA
+ ENUM(TM_PRED),
+ ENUM(NEARESTMV),
+ ENUM(NEARMV),
+ ENUM(ZEROMV),
+ ENUM(NEWMV),
#if CONFIG_EXT_INTER
- ENUM(NEWFROMNEARMV), ENUM(NEAREST_NEARESTMV),
- ENUM(NEAREST_NEARMV), ENUM(NEAR_NEARESTMV),
- ENUM(NEAR_NEARMV), ENUM(NEAREST_NEWMV),
- ENUM(NEW_NEARESTMV), ENUM(NEAR_NEWMV),
- ENUM(NEW_NEARMV), ENUM(ZERO_ZEROMV),
- ENUM(NEW_NEWMV),
+ ENUM(NEAREST_NEARESTMV),
+ ENUM(NEAR_NEARMV),
+ ENUM(NEAREST_NEWMV),
+ ENUM(NEW_NEARESTMV),
+ ENUM(NEAR_NEWMV),
+ ENUM(NEW_NEARMV),
+ ENUM(ZERO_ZEROMV),
+ ENUM(NEW_NEWMV),
#endif
- ENUM(INTRA_INVALID), LAST_ENUM
-};
+ ENUM(INTRA_INVALID),
+ LAST_ENUM };
#define NO_SKIP 0
#define SKIP 1
@@ -489,6 +508,14 @@ void inspect(void *pbi, void *data) {
offsetof(insp_mi_data, cdef_strength));
}
#endif
+#if CONFIG_CFL
+ if (layers & CFL_LAYER) {
+ buf += put_block_info(buf, NULL, "cfl_alpha_idx",
+ offsetof(insp_mi_data, cfl_alpha_idx));
+ buf += put_block_info(buf, NULL, "cfl_alpha_sign",
+ offsetof(insp_mi_data, cfl_alpha_sign));
+ }
+#endif
if (layers & MOTION_VECTORS_LAYER) {
buf += put_motion_vectors(buf);
}
@@ -621,6 +648,10 @@ static void parse_args(char **argv) {
else if (arg_match(&arg, &dump_cdef_arg, argi))
layers |= CDEF_LAYER;
#endif
+#if CONFIG_CFL
+ else if (arg_match(&arg, &dump_cfl_arg, argi))
+ layers |= CFL_LAYER;
+#endif
else if (arg_match(&arg, &dump_reference_frame_arg, argi))
layers |= REFERENCE_FRAME_LAYER;
else if (arg_match(&arg, &dump_motion_vectors_arg, argi))
diff --git a/third_party/aom/examples/set_maps.c b/third_party/aom/examples/set_maps.c
index e88cd426f..3a54e5f96 100644
--- a/third_party/aom/examples/set_maps.c
+++ b/third_party/aom/examples/set_maps.c
@@ -123,7 +123,7 @@ int main(int argc, char **argv) {
aom_codec_ctx_t codec;
aom_codec_enc_cfg_t cfg;
int frame_count = 0;
- const int limit = 30;
+ const int limit = 15;
aom_image_t raw;
aom_codec_err_t res;
AvxVideoInfo info;
@@ -184,9 +184,9 @@ int main(int argc, char **argv) {
while (aom_img_read(&raw, infile) && frame_count < limit) {
++frame_count;
- if (frame_count == 11) {
+ if (frame_count == 5) {
set_active_map(&cfg, &codec);
- } else if (frame_count == 22) {
+ } else if (frame_count == 11) {
unset_active_map(&cfg, &codec);
}
diff --git a/third_party/aom/libs.doxy_template b/third_party/aom/libs.doxy_template
index 23400b429..c522e21d3 100644
--- a/third_party/aom/libs.doxy_template
+++ b/third_party/aom/libs.doxy_template
@@ -927,41 +927,6 @@ MAN_EXTENSION = .3
MAN_LINKS = YES
#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
# configuration options for the auto_gen Definitions output
#---------------------------------------------------------------------------
diff --git a/third_party/aom/libs.mk b/third_party/aom/libs.mk
index 4f2e5cab5..b3ab8ab77 100644
--- a/third_party/aom/libs.mk
+++ b/third_party/aom/libs.mk
@@ -69,7 +69,7 @@ ifeq ($(CONFIG_AV1_ENCODER),yes)
INSTALL-LIBS-yes += include/aom/aom.h include/aom/aomcx.h
INSTALL_MAPS += include/aom/% $(SRC_PATH_BARE)/$(AV1_PREFIX)/%
CODEC_DOC_SRCS += aom/aom.h aom/aomcx.h
- CODEC_DOC_SECTIONS += av1 av1_encoder
+ CODEC_DOC_SECTIONS += av1 av1_encoder encoder
endif
ifeq ($(CONFIG_AV1_DECODER),yes)
@@ -81,20 +81,12 @@ ifeq ($(CONFIG_AV1_DECODER),yes)
INSTALL-LIBS-yes += include/aom/aom.h include/aom/aomdx.h
INSTALL_MAPS += include/aom/% $(SRC_PATH_BARE)/$(AV1_PREFIX)/%
CODEC_DOC_SRCS += aom/aom.h aom/aomdx.h
- CODEC_DOC_SECTIONS += av1 av1_decoder
+ CODEC_DOC_SECTIONS += av1 av1_decoder decoder
endif
AV1_PREFIX=av1/
$(BUILD_PFX)$(AV1_PREFIX)%.c.o: CFLAGS += -Wextra
-ifeq ($(CONFIG_ENCODERS),yes)
- CODEC_DOC_SECTIONS += encoder
-endif
-ifeq ($(CONFIG_DECODERS),yes)
- CODEC_DOC_SECTIONS += decoder
-endif
-
-
ifeq ($(CONFIG_MSVS),yes)
CODEC_LIB=$(if $(CONFIG_STATIC_MSVCRT),aommt,aommd)
GTEST_LIB=$(if $(CONFIG_STATIC_MSVCRT),gtestmt,gtestmd)
@@ -126,15 +118,15 @@ ifeq ($(ARCH_X86)$(ARCH_X86_64),yes)
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += third_party/x86inc/x86inc.asm
endif
CODEC_EXPORTS-yes += aom/exports_com
-CODEC_EXPORTS-$(CONFIG_ENCODERS) += aom/exports_enc
-CODEC_EXPORTS-$(CONFIG_DECODERS) += aom/exports_dec
+CODEC_EXPORTS-$(CONFIG_AV1_ENCODER) += aom/exports_enc
+CODEC_EXPORTS-$(CONFIG_AV1_DECODER) += aom/exports_dec
INSTALL-LIBS-yes += include/aom/aom_codec.h
INSTALL-LIBS-yes += include/aom/aom_frame_buffer.h
INSTALL-LIBS-yes += include/aom/aom_image.h
INSTALL-LIBS-yes += include/aom/aom_integer.h
-INSTALL-LIBS-$(CONFIG_DECODERS) += include/aom/aom_decoder.h
-INSTALL-LIBS-$(CONFIG_ENCODERS) += include/aom/aom_encoder.h
+INSTALL-LIBS-$(CONFIG_AV1_DECODER) += include/aom/aom_decoder.h
+INSTALL-LIBS-$(CONFIG_AV1_ENCODER) += include/aom/aom_encoder.h
ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
ifeq ($(CONFIG_MSVS),yes)
INSTALL-LIBS-yes += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB).lib)
diff --git a/third_party/aom/test/altref_test.cc b/third_party/aom/test/altref_test.cc
index 6dd8b5186..28b400121 100644
--- a/third_party/aom/test/altref_test.cc
+++ b/third_party/aom/test/altref_test.cc
@@ -92,6 +92,6 @@ TEST_P(AltRefForcedKeyTestLarge, ForcedFrameIsKey) {
AV1_INSTANTIATE_TEST_CASE(AltRefForcedKeyTestLarge,
::testing::Values(::libaom_test::kOnePassGood),
- ::testing::Range(0, 9));
+ ::testing::Values(2, 5));
} // namespace
diff --git a/third_party/aom/test/aq_segment_test.cc b/third_party/aom/test/aq_segment_test.cc
index 5dc93ec79..b01f140a0 100644
--- a/third_party/aom/test/aq_segment_test.cc
+++ b/third_party/aom/test/aq_segment_test.cc
@@ -98,7 +98,7 @@ TEST_P(AqSegmentTest, TestNoMisMatchAQ4) {
aq_mode_ = 4;
::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- 30, 1, 0, 100);
+ 30, 1, 0, 15);
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
@@ -112,7 +112,7 @@ TEST_P(AqSegmentTest, TestNoMisMatchExtDeltaQ) {
aq_mode_ = 0;
deltaq_mode_ = 2;
::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- 30, 1, 0, 100);
+ 30, 1, 0, 15);
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
diff --git a/third_party/aom/test/av1_convolve_optimz_test.cc b/third_party/aom/test/av1_convolve_optimz_test.cc
index fd0f6dbce..c32f4cb95 100644
--- a/third_party/aom/test/av1_convolve_optimz_test.cc
+++ b/third_party/aom/test/av1_convolve_optimz_test.cc
@@ -218,7 +218,7 @@ const BlockDimension kBlockDim[] = {
};
// 10/12-tap filters
-const InterpFilter kFilter[] = { FILTER_REGULAR_UV, BILINEAR, MULTITAP_SHARP };
+const InterpFilter kFilter[] = { EIGHTTAP_REGULAR, BILINEAR, MULTITAP_SHARP };
const int kSubpelQ4[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
diff --git a/third_party/aom/test/av1_convolve_test.cc b/third_party/aom/test/av1_convolve_test.cc
index 02ac8e7bb..9ea662381 100644
--- a/third_party/aom/test/av1_convolve_test.cc
+++ b/third_party/aom/test/av1_convolve_test.cc
@@ -262,6 +262,7 @@ INSTANTIATE_TEST_CASE_P(
::testing::ValuesIn(filter_ls)));
#if CONFIG_HIGHBITDEPTH
+#ifndef __clang_analyzer__
TEST(AV1ConvolveTest, av1_highbd_convolve) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
#if CONFIG_DUAL_FILTER
@@ -322,6 +323,7 @@ TEST(AV1ConvolveTest, av1_highbd_convolve) {
}
}
}
+#endif
TEST(AV1ConvolveTest, av1_highbd_convolve_avg) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
diff --git a/third_party/aom/test/fht32x32_test.cc b/third_party/aom/test/av1_fht32x32_test.cc
index 56ac597c0..cdd915337 100644
--- a/third_party/aom/test/fht32x32_test.cc
+++ b/third_party/aom/test/av1_fht32x32_test.cc
@@ -49,7 +49,7 @@ void highbd_fht32x32_ref(const int16_t *in, int32_t *out, int stride,
}
#endif // CONFIG_HIGHBITDEPTH
-#if HAVE_AVX2
+#if HAVE_SSE2 || HAVE_AVX2
void dummy_inv_txfm(const tran_low_t *in, uint8_t *out, int stride,
int tx_type) {
(void)in;
diff --git a/third_party/aom/test/av1_fht64x64_test.cc b/third_party/aom/test/av1_fht64x64_test.cc
new file mode 100644
index 000000000..cde1d0ca3
--- /dev/null
+++ b/third_party/aom/test/av1_fht64x64_test.cc
@@ -0,0 +1,108 @@
+/*
+ * 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.
+ */
+
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
+
+#include "./av1_rtcd.h"
+
+#include "aom_ports/mem.h"
+#include "test/acm_random.h"
+#include "test/clear_system_state.h"
+#include "test/register_state_check.h"
+#include "test/transform_test_base.h"
+#include "test/util.h"
+
+#if CONFIG_TX64X64
+
+using libaom_test::ACMRandom;
+
+namespace {
+typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride,
+ int tx_type);
+using std::tr1::tuple;
+using libaom_test::FhtFunc;
+typedef tuple<FhtFunc, IhtFunc, int, aom_bit_depth_t, int> Ht64x64Param;
+
+void fht64x64_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) {
+ av1_fht64x64_c(in, out, stride, tx_type);
+}
+
+void iht64x64_ref(const tran_low_t *in, uint8_t *dest, int stride,
+ int tx_type) {
+ av1_iht64x64_4096_add_c(in, dest, stride, tx_type);
+}
+
+class AV1Trans64x64HT : public libaom_test::TransformTestBase,
+ public ::testing::TestWithParam<Ht64x64Param> {
+ public:
+ virtual ~AV1Trans64x64HT() {}
+
+ virtual void SetUp() {
+ fwd_txfm_ = GET_PARAM(0);
+ inv_txfm_ = GET_PARAM(1);
+ tx_type_ = GET_PARAM(2);
+ pitch_ = 64;
+ height_ = 64;
+ fwd_txfm_ref = fht64x64_ref;
+ inv_txfm_ref = iht64x64_ref;
+ bit_depth_ = GET_PARAM(3);
+ mask_ = (1 << bit_depth_) - 1;
+ num_coeffs_ = GET_PARAM(4);
+ }
+ virtual void TearDown() { libaom_test::ClearSystemState(); }
+
+ protected:
+ void RunFwdTxfm(const int16_t *in, tran_low_t *out, int stride) {
+ fwd_txfm_(in, out, stride, tx_type_);
+ }
+
+ void RunInvTxfm(const tran_low_t *out, uint8_t *dst, int stride) {
+ inv_txfm_(out, dst, stride, tx_type_);
+ }
+
+ FhtFunc fwd_txfm_;
+ IhtFunc inv_txfm_;
+};
+
+TEST_P(AV1Trans64x64HT, AccuracyCheck) { RunAccuracyCheck(4, 0.2); }
+TEST_P(AV1Trans64x64HT, CoeffCheck) { RunCoeffCheck(); }
+TEST_P(AV1Trans64x64HT, MemCheck) { RunMemCheck(); }
+TEST_P(AV1Trans64x64HT, InvCoeffCheck) { RunInvCoeffCheck(); }
+TEST_P(AV1Trans64x64HT, InvAccuracyCheck) { RunInvAccuracyCheck(4); }
+
+using std::tr1::make_tuple;
+
+const Ht64x64Param kArrayHt64x64Param_c[] = {
+ make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 0, AOM_BITS_8, 4096),
+ make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 1, AOM_BITS_8, 4096),
+ make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 2, AOM_BITS_8, 4096),
+ make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 3, AOM_BITS_8, 4096),
+#if CONFIG_EXT_TX
+ make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 4, AOM_BITS_8, 4096),
+ make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 5, AOM_BITS_8, 4096),
+ make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 6, AOM_BITS_8, 4096),
+ make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 7, AOM_BITS_8, 4096),
+ make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 8, AOM_BITS_8, 4096),
+ make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 9, AOM_BITS_8, 4096),
+ make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 10, AOM_BITS_8, 4096),
+ make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 11, AOM_BITS_8, 4096),
+ make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 12, AOM_BITS_8, 4096),
+ make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 13, AOM_BITS_8, 4096),
+ make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 14, AOM_BITS_8, 4096),
+ make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 15, AOM_BITS_8, 4096)
+#endif // CONFIG_EXT_TX
+};
+INSTANTIATE_TEST_CASE_P(C, AV1Trans64x64HT,
+ ::testing::ValuesIn(kArrayHt64x64Param_c));
+
+} // namespace
+
+#endif // CONFIG_TX64X64
diff --git a/third_party/aom/test/av1_fwd_txfm1d_test.cc b/third_party/aom/test/av1_fwd_txfm1d_test.cc
index a9b3f8e40..511e057fa 100644
--- a/third_party/aom/test/av1_fwd_txfm1d_test.cc
+++ b/third_party/aom/test/av1_fwd_txfm1d_test.cc
@@ -56,10 +56,10 @@ TEST(av1_fwd_txfm1d, get_max_bit) {
EXPECT_EQ(max_bit, 3);
}
-TEST(av1_fwd_txfm1d, cospi_arr) {
+TEST(av1_fwd_txfm1d, cospi_arr_data) {
for (int i = 0; i < 7; i++) {
for (int j = 0; j < 64; j++) {
- EXPECT_EQ(cospi_arr[i][j],
+ EXPECT_EQ(cospi_arr_data[i][j],
(int32_t)round(cos(M_PI * j / 128) * (1 << (cos_bit_min + i))));
}
}
diff --git a/third_party/aom/test/av1_fwd_txfm2d_test.cc b/third_party/aom/test/av1_fwd_txfm2d_test.cc
index 25cf5ad53..af3c8ff44 100644
--- a/third_party/aom/test/av1_fwd_txfm2d_test.cc
+++ b/third_party/aom/test/av1_fwd_txfm2d_test.cc
@@ -41,9 +41,11 @@ class AV1FwdTxfm2d : public ::testing::TestWithParam<AV1FwdTxfm2dParam> {
count_ = 500;
TXFM_2D_FLIP_CFG fwd_txfm_flip_cfg =
av1_get_fwd_txfm_cfg(tx_type_, tx_size_);
- const TXFM_2D_CFG *fwd_txfm_cfg = fwd_txfm_flip_cfg.cfg;
- int amplify_bit = fwd_txfm_cfg->shift[0] + fwd_txfm_cfg->shift[1] +
- fwd_txfm_cfg->shift[2];
+ // TODO(sarahparker) this test will need to be updated when these
+ // functions are extended to support rectangular transforms
+ int amplify_bit = fwd_txfm_flip_cfg.row_cfg->shift[0] +
+ fwd_txfm_flip_cfg.row_cfg->shift[1] +
+ fwd_txfm_flip_cfg.row_cfg->shift[2];
ud_flip_ = fwd_txfm_flip_cfg.ud_flip;
lr_flip_ = fwd_txfm_flip_cfg.lr_flip;
amplify_factor_ =
diff --git a/third_party/aom/test/av1_inv_txfm2d_test.cc b/third_party/aom/test/av1_inv_txfm2d_test.cc
index bb2743af1..89ae34b01 100644
--- a/third_party/aom/test/av1_inv_txfm2d_test.cc
+++ b/third_party/aom/test/av1_inv_txfm2d_test.cc
@@ -17,7 +17,7 @@
#include "test/acm_random.h"
#include "test/util.h"
#include "test/av1_txfm_test.h"
-#include "av1/common/av1_inv_txfm2d_cfg.h"
+#include "av1/common/av1_inv_txfm1d_cfg.h"
using libaom_test::ACMRandom;
using libaom_test::input_base;
diff --git a/third_party/aom/test/av1_quantize_test.cc b/third_party/aom/test/av1_quantize_test.cc
index b5d1531f5..239b041b2 100644
--- a/third_party/aom/test/av1_quantize_test.cc
+++ b/third_party/aom/test/av1_quantize_test.cc
@@ -196,16 +196,18 @@ TEST_P(AV1QuantizeTest, EobVerify) { RunEobTest(); }
#if HAVE_SSE4_1
#if !CONFIG_AOM_QM
-INSTANTIATE_TEST_CASE_P(
- SSE4_1, AV1QuantizeTest,
- ::testing::Values(QuantizeFuncParams(&av1_highbd_quantize_fp_sse4_1,
- &av1_highbd_quantize_fp_c, 16),
- QuantizeFuncParams(&av1_highbd_quantize_fp_sse4_1,
- &av1_highbd_quantize_fp_c, 64),
- QuantizeFuncParams(&av1_highbd_quantize_fp_sse4_1,
- &av1_highbd_quantize_fp_c, 256),
- QuantizeFuncParams(&av1_highbd_quantize_fp_sse4_1,
- &av1_highbd_quantize_fp_c, 1024)));
+const QuantizeFuncParams qfps[4] = {
+ QuantizeFuncParams(av1_highbd_quantize_fp_sse4_1, &av1_highbd_quantize_fp_c,
+ 16),
+ QuantizeFuncParams(&av1_highbd_quantize_fp_sse4_1, &av1_highbd_quantize_fp_c,
+ 64),
+ QuantizeFuncParams(&av1_highbd_quantize_fp_sse4_1, &av1_highbd_quantize_fp_c,
+ 256),
+ QuantizeFuncParams(&av1_highbd_quantize_fp_sse4_1, &av1_highbd_quantize_fp_c,
+ 1024),
+};
+
+INSTANTIATE_TEST_CASE_P(SSE4_1, AV1QuantizeTest, ::testing::ValuesIn(qfps));
#endif // !CONFIG_AOM_QM
#endif // HAVE_SSE4_1
} // namespace
diff --git a/third_party/aom/test/av1_txfm_test.h b/third_party/aom/test/av1_txfm_test.h
index 70f971d09..d46f0bba7 100644
--- a/third_party/aom/test/av1_txfm_test.h
+++ b/third_party/aom/test/av1_txfm_test.h
@@ -79,7 +79,7 @@ static const int input_base = (1 << bd);
#if CONFIG_HIGHBITDEPTH
#if CONFIG_AV1_ENCODER
static const Fwd_Txfm2d_Func fwd_txfm_func_ls[TX_SIZES] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
NULL,
#endif
av1_fwd_txfm2d_4x4_c, av1_fwd_txfm2d_8x8_c, av1_fwd_txfm2d_16x16_c,
@@ -88,7 +88,7 @@ static const Fwd_Txfm2d_Func fwd_txfm_func_ls[TX_SIZES] = {
#endif
static const Inv_Txfm2d_Func inv_txfm_func_ls[TX_SIZES] = {
-#if CONFIG_CB4X4
+#if CONFIG_CHROMA_2X2
NULL,
#endif
av1_inv_txfm2d_add_4x4_c, av1_inv_txfm2d_add_8x8_c,
diff --git a/third_party/aom/test/avg_test.cc b/third_party/aom/test/avg_test.cc
index b040f6a34..e83a75c1c 100644
--- a/third_party/aom/test/avg_test.cc
+++ b/third_party/aom/test/avg_test.cc
@@ -53,21 +53,6 @@ class AverageTestBase : public ::testing::Test {
rnd_.Reset(ACMRandom::DeterministicSeed());
}
- // Sum Pixels
- static unsigned int ReferenceAverage8x8(const uint8_t *source, int pitch) {
- unsigned int average = 0;
- for (int h = 0; h < 8; ++h)
- for (int w = 0; w < 8; ++w) average += source[h * pitch + w];
- return ((average + 32) >> 6);
- }
-
- static unsigned int ReferenceAverage4x4(const uint8_t *source, int pitch) {
- unsigned int average = 0;
- for (int h = 0; h < 4; ++h)
- for (int w = 0; w < 4; ++w) average += source[h * pitch + w];
- return ((average + 8) >> 4);
- }
-
void FillConstant(uint8_t fill_constant) {
for (int i = 0; i < width_ * height_; ++i) {
source_data_[i] = fill_constant;
@@ -86,35 +71,6 @@ class AverageTestBase : public ::testing::Test {
ACMRandom rnd_;
};
-typedef unsigned int (*AverageFunction)(const uint8_t *s, int pitch);
-
-typedef std::tr1::tuple<int, int, int, int, AverageFunction> AvgFunc;
-
-class AverageTest : public AverageTestBase,
- public ::testing::WithParamInterface<AvgFunc> {
- public:
- AverageTest() : AverageTestBase(GET_PARAM(0), GET_PARAM(1)) {}
-
- protected:
- void CheckAverages() {
- const int block_size = GET_PARAM(3);
- unsigned int expected = 0;
- if (block_size == 8) {
- expected =
- ReferenceAverage8x8(source_data_ + GET_PARAM(2), source_stride_);
- } else if (block_size == 4) {
- expected =
- ReferenceAverage4x4(source_data_ + GET_PARAM(2), source_stride_);
- }
-
- ASM_REGISTER_STATE_CHECK(
- GET_PARAM(4)(source_data_ + GET_PARAM(2), source_stride_));
- unsigned int actual =
- GET_PARAM(4)(source_data_ + GET_PARAM(2), source_stride_);
-
- EXPECT_EQ(expected, actual);
- }
-};
typedef void (*IntProRowFunc)(int16_t hbuf[16], uint8_t const *ref,
const int ref_stride, const int height);
@@ -229,25 +185,6 @@ class SatdTest : public ::testing::Test,
uint8_t *AverageTestBase::source_data_ = NULL;
-TEST_P(AverageTest, MinValue) {
- FillConstant(0);
- CheckAverages();
-}
-
-TEST_P(AverageTest, MaxValue) {
- FillConstant(255);
- CheckAverages();
-}
-
-TEST_P(AverageTest, Random) {
- // The reference frame, but not the source frame, may be unaligned for
- // certain types of searches.
- for (int i = 0; i < 1000; i++) {
- FillRandom();
- CheckAverages();
- }
-}
-
TEST_P(IntProRowTest, MinValue) {
FillConstant(0);
RunComparison();
@@ -309,11 +246,6 @@ TEST_P(SatdTest, Random) {
using std::tr1::make_tuple;
-INSTANTIATE_TEST_CASE_P(
- C, AverageTest,
- ::testing::Values(make_tuple(16, 16, 1, 8, &aom_avg_8x8_c),
- make_tuple(16, 16, 1, 4, &aom_avg_4x4_c)));
-
INSTANTIATE_TEST_CASE_P(C, SatdTest,
::testing::Values(make_tuple(16, &aom_satd_c),
make_tuple(64, &aom_satd_c),
@@ -322,15 +254,6 @@ INSTANTIATE_TEST_CASE_P(C, SatdTest,
#if HAVE_SSE2
INSTANTIATE_TEST_CASE_P(
- SSE2, AverageTest,
- ::testing::Values(make_tuple(16, 16, 0, 8, &aom_avg_8x8_sse2),
- make_tuple(16, 16, 5, 8, &aom_avg_8x8_sse2),
- make_tuple(32, 32, 15, 8, &aom_avg_8x8_sse2),
- make_tuple(16, 16, 0, 4, &aom_avg_4x4_sse2),
- make_tuple(16, 16, 5, 4, &aom_avg_4x4_sse2),
- make_tuple(32, 32, 15, 4, &aom_avg_4x4_sse2)));
-
-INSTANTIATE_TEST_CASE_P(
SSE2, IntProRowTest,
::testing::Values(make_tuple(16, &aom_int_pro_row_sse2, &aom_int_pro_row_c),
make_tuple(32, &aom_int_pro_row_sse2, &aom_int_pro_row_c),
@@ -353,15 +276,6 @@ INSTANTIATE_TEST_CASE_P(SSE2, SatdTest,
#if HAVE_NEON
INSTANTIATE_TEST_CASE_P(
- NEON, AverageTest,
- ::testing::Values(make_tuple(16, 16, 0, 8, &aom_avg_8x8_neon),
- make_tuple(16, 16, 5, 8, &aom_avg_8x8_neon),
- make_tuple(32, 32, 15, 8, &aom_avg_8x8_neon),
- make_tuple(16, 16, 0, 4, &aom_avg_4x4_neon),
- make_tuple(16, 16, 5, 4, &aom_avg_4x4_neon),
- make_tuple(32, 32, 15, 4, &aom_avg_4x4_neon)));
-
-INSTANTIATE_TEST_CASE_P(
NEON, IntProRowTest,
::testing::Values(make_tuple(16, &aom_int_pro_row_neon, &aom_int_pro_row_c),
make_tuple(32, &aom_int_pro_row_neon, &aom_int_pro_row_c),
@@ -382,15 +296,4 @@ INSTANTIATE_TEST_CASE_P(NEON, SatdTest,
make_tuple(1024, &aom_satd_neon)));
#endif
-#if HAVE_MSA
-INSTANTIATE_TEST_CASE_P(
- MSA, AverageTest,
- ::testing::Values(make_tuple(16, 16, 0, 8, &aom_avg_8x8_msa),
- make_tuple(16, 16, 5, 8, &aom_avg_8x8_msa),
- make_tuple(32, 32, 15, 8, &aom_avg_8x8_msa),
- make_tuple(16, 16, 0, 4, &aom_avg_4x4_msa),
- make_tuple(16, 16, 5, 4, &aom_avg_4x4_msa),
- make_tuple(32, 32, 15, 4, &aom_avg_4x4_msa)));
-#endif
-
} // namespace
diff --git a/third_party/aom/test/binary_codes_test.cc b/third_party/aom/test/binary_codes_test.cc
index 385ec7687..41efec781 100644
--- a/third_party/aom/test/binary_codes_test.cc
+++ b/third_party/aom/test/binary_codes_test.cc
@@ -15,6 +15,7 @@
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
+#include "./aom_config.h"
#include "test/acm_random.h"
#include "aom/aom_integer.h"
#include "aom_dsp/bitreader.h"
@@ -22,6 +23,8 @@
#include "aom_dsp/binary_codes_reader.h"
#include "aom_dsp/binary_codes_writer.h"
+#define ACCT_STR __func__
+
using libaom_test::ACMRandom;
namespace {
@@ -68,8 +71,8 @@ TEST(AV1, TestPrimitiveRefbilivel) {
const uint16_t range = enc_values[n][p][r][v][0];
const uint16_t near_range = enc_values[n][p][r][v][1];
const uint16_t ref = enc_values[n][p][r][v][2];
- const uint16_t value =
- aom_read_primitive_refbilevel(&br, range, near_range, ref);
+ const uint16_t value = aom_read_primitive_refbilevel(
+ &br, range, near_range, ref, ACCT_STR);
GTEST_ASSERT_EQ(value, enc_values[n][p][r][v][3]);
}
}
@@ -119,7 +122,7 @@ TEST(AV1, TestPrimitiveRefsubexpfin) {
assert(k == enc_values[n][k][r][v][1]);
const uint16_t ref = enc_values[n][k][r][v][2];
const uint16_t value =
- aom_read_primitive_refsubexpfin(&br, range, k, ref);
+ aom_read_primitive_refsubexpfin(&br, range, k, ref, ACCT_STR);
GTEST_ASSERT_EQ(value, enc_values[n][k][r][v][3]);
}
}
diff --git a/third_party/aom/test/boolcoder_test.cc b/third_party/aom/test/boolcoder_test.cc
index 4d9d7aaf4..7abe1b1b6 100644
--- a/third_party/aom/test/boolcoder_test.cc
+++ b/third_party/aom/test/boolcoder_test.cc
@@ -68,11 +68,6 @@ TEST(AV1, TestBitIO) {
aom_stop_encode(&bw);
-#if !CONFIG_DAALA_EC
- // First bit should be zero
- GTEST_ASSERT_EQ(bw_buffer[0] & 0x80, 0);
-#endif
-
aom_reader br;
aom_reader_init(&br, bw_buffer, bw.pos, NULL, NULL);
bit_rnd.Reset(random_seed);
@@ -91,10 +86,10 @@ TEST(AV1, TestBitIO) {
}
}
-#if CONFIG_DAALA_EC
-#define FRAC_DIFF_TOTAL_ERROR 0.07
+#if CONFIG_EC_SMALLMUL
+#define FRAC_DIFF_TOTAL_ERROR 0.16
#else
-#define FRAC_DIFF_TOTAL_ERROR 0.2
+#define FRAC_DIFF_TOTAL_ERROR 0.07
#endif
TEST(AV1, TestTell) {
diff --git a/third_party/aom/test/borders_test.cc b/third_party/aom/test/borders_test.cc
index 076f91404..d4e8dea23 100644
--- a/third_party/aom/test/borders_test.cc
+++ b/third_party/aom/test/borders_test.cc
@@ -59,7 +59,7 @@ TEST_P(BordersTest, TestEncodeHighBitrate) {
cfg_.rc_max_quantizer = 10;
::libaom_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0,
- 40);
+ 10);
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
@@ -75,7 +75,7 @@ TEST_P(BordersTest, TestLowBitrate) {
cfg_.rc_min_quantizer = 40;
::libaom_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0,
- 40);
+ 10);
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
diff --git a/third_party/aom/test/convolve_test.cc b/third_party/aom/test/convolve_test.cc
index a84ef4ec8..a1fb2087d 100644
--- a/third_party/aom/test/convolve_test.cc
+++ b/third_party/aom/test/convolve_test.cc
@@ -212,7 +212,7 @@ void highbd_filter_block2d_8_c(const uint16_t *src_ptr,
* = 23
* and filter_max_width = 16
*/
- uint16_t intermediate_buffer[(kMaxDimension + 8) * kMaxDimension];
+ uint16_t intermediate_buffer[(kMaxDimension + 8) * kMaxDimension] = { 0 };
const int intermediate_next_stride =
1 - static_cast<int>(intermediate_height * output_width);
@@ -368,10 +368,17 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
#endif
/* Set up guard blocks for an inner block centered in the outer block */
for (int i = 0; i < kOutputBufferSize; ++i) {
- if (IsIndexInBorder(i))
+ if (IsIndexInBorder(i)) {
output_[i] = 255;
- else
+#if CONFIG_HIGHBITDEPTH
+ output16_[i] = mask_;
+#endif
+ } else {
output_[i] = 0;
+#if CONFIG_HIGHBITDEPTH
+ output16_[i] = 0;
+#endif
+ }
}
::libaom_test::ACMRandom prng;
diff --git a/third_party/aom/test/corner_match_test.cc b/third_party/aom/test/corner_match_test.cc
new file mode 100644
index 000000000..2197fffee
--- /dev/null
+++ b/third_party/aom/test/corner_match_test.cc
@@ -0,0 +1,100 @@
+/*
+ * 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 "third_party/googletest/src/googletest/include/gtest/gtest.h"
+#include "test/acm_random.h"
+#include "test/util.h"
+#include "./av1_rtcd.h"
+#include "test/clear_system_state.h"
+#include "test/register_state_check.h"
+
+#include "av1/encoder/corner_match.h"
+
+namespace test_libaom {
+
+namespace AV1CornerMatch {
+
+using libaom_test::ACMRandom;
+
+using std::tr1::tuple;
+using std::tr1::make_tuple;
+typedef tuple<int> CornerMatchParam;
+
+class AV1CornerMatchTest : public ::testing::TestWithParam<CornerMatchParam> {
+ public:
+ virtual ~AV1CornerMatchTest();
+ virtual void SetUp();
+
+ virtual void TearDown();
+
+ protected:
+ void RunCheckOutput();
+
+ libaom_test::ACMRandom rnd_;
+};
+
+AV1CornerMatchTest::~AV1CornerMatchTest() {}
+void AV1CornerMatchTest::SetUp() { rnd_.Reset(ACMRandom::DeterministicSeed()); }
+void AV1CornerMatchTest::TearDown() { libaom_test::ClearSystemState(); }
+
+void AV1CornerMatchTest::RunCheckOutput() {
+ const int w = 128, h = 128;
+ const int num_iters = 10000;
+ int i, j;
+
+ uint8_t *input1 = new uint8_t[w * h];
+ uint8_t *input2 = new uint8_t[w * h];
+
+ // Test the two extreme cases:
+ // i) Random data, should have correlation close to 0
+ // ii) Linearly related data + noise, should have correlation close to 1
+ int mode = GET_PARAM(0);
+ if (mode == 0) {
+ for (i = 0; i < h; ++i)
+ for (j = 0; j < w; ++j) {
+ input1[i * w + j] = rnd_.Rand8();
+ input2[i * w + j] = rnd_.Rand8();
+ }
+ } else if (mode == 1) {
+ for (i = 0; i < h; ++i)
+ for (j = 0; j < w; ++j) {
+ int v = rnd_.Rand8();
+ input1[i * w + j] = v;
+ input2[i * w + j] = (v / 2) + (rnd_.Rand8() & 15);
+ }
+ }
+
+ for (i = 0; i < num_iters; ++i) {
+ int x1 = MATCH_SZ_BY2 + rnd_.PseudoUniform(w - 2 * MATCH_SZ_BY2);
+ int y1 = MATCH_SZ_BY2 + rnd_.PseudoUniform(h - 2 * MATCH_SZ_BY2);
+ int x2 = MATCH_SZ_BY2 + rnd_.PseudoUniform(w - 2 * MATCH_SZ_BY2);
+ int y2 = MATCH_SZ_BY2 + rnd_.PseudoUniform(h - 2 * MATCH_SZ_BY2);
+
+ double res_c =
+ compute_cross_correlation_c(input1, w, x1, y1, input2, w, x2, y2);
+ double res_sse4 =
+ compute_cross_correlation_sse4_1(input1, w, x1, y1, input2, w, x2, y2);
+
+ ASSERT_EQ(res_sse4, res_c);
+ }
+
+ delete[] input1;
+ delete[] input2;
+}
+
+TEST_P(AV1CornerMatchTest, CheckOutput) { RunCheckOutput(); }
+
+INSTANTIATE_TEST_CASE_P(SSE4_1, AV1CornerMatchTest,
+ ::testing::Values(make_tuple(0), make_tuple(1)));
+
+} // namespace AV1CornerMatch
+
+} // namespace test_libaom
diff --git a/third_party/aom/test/cpu_speed_test.cc b/third_party/aom/test/cpu_speed_test.cc
index 9b7966462..ad0f2a874 100644
--- a/third_party/aom/test/cpu_speed_test.cc
+++ b/third_party/aom/test/cpu_speed_test.cc
@@ -94,7 +94,7 @@ void CpuSpeedTest::TestQ0() {
}
void CpuSpeedTest::TestScreencastQ0() {
- ::libaom_test::Y4mVideoSource video("screendata.y4m", 0, 10);
+ ::libaom_test::Y4mVideoSource video("screendata.y4m", 0, 3);
cfg_.g_timebase = video.timebase();
cfg_.rc_2pass_vbr_minsection_pct = 5;
cfg_.rc_2pass_vbr_maxsection_pct = 2000;
@@ -109,7 +109,7 @@ void CpuSpeedTest::TestScreencastQ0() {
}
void CpuSpeedTest::TestTuneScreen() {
- ::libaom_test::Y4mVideoSource video("screendata.y4m", 0, 10);
+ ::libaom_test::Y4mVideoSource video("screendata.y4m", 0, 3);
cfg_.g_timebase = video.timebase();
cfg_.rc_2pass_vbr_minsection_pct = 5;
cfg_.rc_2pass_vbr_minsection_pct = 2000;
diff --git a/third_party/aom/test/datarate_test.cc b/third_party/aom/test/datarate_test.cc
index 48be4a46d..a4a682681 100644
--- a/third_party/aom/test/datarate_test.cc
+++ b/third_party/aom/test/datarate_test.cc
@@ -249,5 +249,5 @@ TEST_P(DatarateTestLarge, ChangingDropFrameThresh) {
AV1_INSTANTIATE_TEST_CASE(DatarateTestLarge,
::testing::Values(::libaom_test::kOnePassGood,
::libaom_test::kRealTime),
- ::testing::Range(2, 9, 2));
+ ::testing::Values(2, 5));
} // namespace
diff --git a/third_party/aom/test/decode_test_driver.cc b/third_party/aom/test/decode_test_driver.cc
index 35c28eafd..5f109e092 100644
--- a/third_party/aom/test/decode_test_driver.cc
+++ b/third_party/aom/test/decode_test_driver.cc
@@ -82,8 +82,6 @@ void DecoderTest::RunLoop(CompressedVideoSource *video,
PreDecodeFrameHook(*video, decoder);
aom_codec_stream_info_t stream_info;
- stream_info.sz = sizeof(stream_info);
-
if (video->cxdata() != NULL) {
const aom_codec_err_t res_peek = decoder->PeekStream(
video->cxdata(), video->frame_size(), &stream_info);
diff --git a/third_party/aom/test/error_resilience_test.cc b/third_party/aom/test/error_resilience_test.cc
index 63f10012f..b1d93a01f 100644
--- a/third_party/aom/test/error_resilience_test.cc
+++ b/third_party/aom/test/error_resilience_test.cc
@@ -150,7 +150,7 @@ TEST_P(ErrorResilienceTestLarge, OnVersusOff) {
init_flags_ = AOM_CODEC_USE_PSNR;
libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- timebase.den, timebase.num, 0, 30);
+ timebase.den, timebase.num, 0, 12);
// Error resilient mode OFF.
cfg_.g_error_resilient = 0;
@@ -187,7 +187,7 @@ TEST_P(ErrorResilienceTestLarge, DropFramesWithoutRecovery) {
init_flags_ = AOM_CODEC_USE_PSNR;
libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- timebase.den, timebase.num, 0, 40);
+ timebase.den, timebase.num, 0, 20);
// Error resilient mode ON.
cfg_.g_error_resilient = 1;
@@ -196,9 +196,8 @@ TEST_P(ErrorResilienceTestLarge, DropFramesWithoutRecovery) {
// Set an arbitrary set of error frames same as droppable frames.
// In addition to isolated loss/drop, add a long consecutive series
// (of size 9) of dropped frames.
- unsigned int num_droppable_frames = 11;
- unsigned int droppable_frame_list[] = { 5, 16, 22, 23, 24, 25,
- 26, 27, 28, 29, 30 };
+ unsigned int num_droppable_frames = 5;
+ unsigned int droppable_frame_list[] = { 5, 10, 13, 16, 19 };
SetDroppableFrames(num_droppable_frames, droppable_frame_list);
SetErrorFrames(num_droppable_frames, droppable_frame_list);
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
diff --git a/third_party/aom/test/frame_size_tests.cc b/third_party/aom/test/frame_size_tests.cc
index 73cc9c075..d2e762ff9 100644
--- a/third_party/aom/test/frame_size_tests.cc
+++ b/third_party/aom/test/frame_size_tests.cc
@@ -46,43 +46,25 @@ class AV1FrameSizeTests : public ::libaom_test::EncoderTest,
int expected_res_;
};
+#if CONFIG_SIZE_LIMIT
TEST_F(AV1FrameSizeTests, TestInvalidSizes) {
::libaom_test::RandomVideoSource video;
-#if CONFIG_SIZE_LIMIT
video.SetSize(DECODE_WIDTH_LIMIT + 16, DECODE_HEIGHT_LIMIT + 16);
video.set_limit(2);
expected_res_ = AOM_CODEC_CORRUPT_FRAME;
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-#endif
}
TEST_F(AV1FrameSizeTests, LargeValidSizes) {
::libaom_test::RandomVideoSource video;
-#if CONFIG_SIZE_LIMIT
video.SetSize(DECODE_WIDTH_LIMIT, DECODE_HEIGHT_LIMIT);
video.set_limit(2);
expected_res_ = AOM_CODEC_OK;
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-#else
- // This test produces a pretty large single frame allocation, (roughly
- // 25 megabits). The encoder allocates a good number of these frames
- // one for each lag in frames (for 2 pass), and then one for each possible
- // reference buffer (8) - we can end up with up to 30 buffers of roughly this
- // size or almost 1 gig of memory.
- // In total the allocations will exceed 2GiB which may cause a failure with
- // non-64 bit platforms, use a smaller size in that case.
- if (sizeof(void *) < 8)
- video.SetSize(2560, 1440);
- else
- video.SetSize(4096, 4096);
-
- video.set_limit(2);
- expected_res_ = AOM_CODEC_OK;
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-#endif
}
+#endif
TEST_F(AV1FrameSizeTests, OneByOneVideo) {
::libaom_test::RandomVideoSource video;
diff --git a/third_party/aom/test/hiprec_convolve_test.cc b/third_party/aom/test/hiprec_convolve_test.cc
new file mode 100644
index 000000000..0b34c99c9
--- /dev/null
+++ b/third_party/aom/test/hiprec_convolve_test.cc
@@ -0,0 +1,42 @@
+/*
+ * 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 "third_party/googletest/src/googletest/include/gtest/gtest.h"
+#include "test/hiprec_convolve_test_util.h"
+
+using std::tr1::tuple;
+using std::tr1::make_tuple;
+using libaom_test::ACMRandom;
+using libaom_test::AV1HiprecConvolve::AV1HiprecConvolveTest;
+#if CONFIG_HIGHBITDEPTH
+using libaom_test::AV1HighbdHiprecConvolve::AV1HighbdHiprecConvolveTest;
+#endif
+
+namespace {
+
+TEST_P(AV1HiprecConvolveTest, CheckOutput) { RunCheckOutput(GET_PARAM(3)); }
+
+INSTANTIATE_TEST_CASE_P(SSE2, AV1HiprecConvolveTest,
+ libaom_test::AV1HiprecConvolve::BuildParams(
+ aom_convolve8_add_src_hip_sse2));
+
+#if CONFIG_HIGHBITDEPTH && HAVE_SSSE3
+TEST_P(AV1HighbdHiprecConvolveTest, CheckOutput) {
+ RunCheckOutput(GET_PARAM(4));
+}
+
+INSTANTIATE_TEST_CASE_P(SSSE3, AV1HighbdHiprecConvolveTest,
+ libaom_test::AV1HighbdHiprecConvolve::BuildParams(
+ aom_highbd_convolve8_add_src_hip_ssse3));
+
+#endif
+
+} // namespace
diff --git a/third_party/aom/test/hiprec_convolve_test_util.cc b/third_party/aom/test/hiprec_convolve_test_util.cc
new file mode 100644
index 000000000..d53384c5b
--- /dev/null
+++ b/third_party/aom/test/hiprec_convolve_test_util.cc
@@ -0,0 +1,188 @@
+/*
+ * 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 "test/hiprec_convolve_test_util.h"
+
+#include "av1/common/restoration.h"
+
+using std::tr1::tuple;
+using std::tr1::make_tuple;
+
+namespace libaom_test {
+
+// Generate a random pair of filter kernels, using the ranges
+// of possible values from the loop-restoration experiment
+static void generate_kernels(ACMRandom *rnd, InterpKernel hkernel,
+ InterpKernel vkernel) {
+ hkernel[0] = hkernel[6] =
+ WIENER_FILT_TAP0_MINV +
+ rnd->PseudoUniform(WIENER_FILT_TAP0_MAXV + 1 - WIENER_FILT_TAP0_MINV);
+ hkernel[1] = hkernel[5] =
+ WIENER_FILT_TAP1_MINV +
+ rnd->PseudoUniform(WIENER_FILT_TAP1_MAXV + 1 - WIENER_FILT_TAP1_MINV);
+ hkernel[2] = hkernel[4] =
+ WIENER_FILT_TAP2_MINV +
+ rnd->PseudoUniform(WIENER_FILT_TAP2_MAXV + 1 - WIENER_FILT_TAP2_MINV);
+ hkernel[3] = -(hkernel[0] + hkernel[1] + hkernel[2]);
+ hkernel[7] = 0;
+
+ vkernel[0] = vkernel[6] =
+ WIENER_FILT_TAP0_MINV +
+ rnd->PseudoUniform(WIENER_FILT_TAP0_MAXV + 1 - WIENER_FILT_TAP0_MINV);
+ vkernel[1] = vkernel[5] =
+ WIENER_FILT_TAP1_MINV +
+ rnd->PseudoUniform(WIENER_FILT_TAP1_MAXV + 1 - WIENER_FILT_TAP1_MINV);
+ vkernel[2] = vkernel[4] =
+ WIENER_FILT_TAP2_MINV +
+ rnd->PseudoUniform(WIENER_FILT_TAP2_MAXV + 1 - WIENER_FILT_TAP2_MINV);
+ vkernel[3] = -(vkernel[0] + vkernel[1] + vkernel[2]);
+ vkernel[7] = 0;
+}
+
+namespace AV1HiprecConvolve {
+
+::testing::internal::ParamGenerator<HiprecConvolveParam> BuildParams(
+ hiprec_convolve_func filter) {
+ const HiprecConvolveParam params[] = {
+ make_tuple(8, 8, 50000, filter), make_tuple(64, 64, 1000, filter),
+ make_tuple(32, 8, 10000, filter),
+ };
+ return ::testing::ValuesIn(params);
+}
+
+AV1HiprecConvolveTest::~AV1HiprecConvolveTest() {}
+void AV1HiprecConvolveTest::SetUp() {
+ rnd_.Reset(ACMRandom::DeterministicSeed());
+}
+
+void AV1HiprecConvolveTest::TearDown() { libaom_test::ClearSystemState(); }
+
+void AV1HiprecConvolveTest::RunCheckOutput(hiprec_convolve_func test_impl) {
+ const int w = 128, h = 128;
+ const int out_w = GET_PARAM(0), out_h = GET_PARAM(1);
+ const int num_iters = GET_PARAM(2);
+ int i, j;
+
+ uint8_t *input_ = new uint8_t[h * w];
+ uint8_t *input = input_;
+
+ // The convolve functions always write rows with widths that are multiples of
+ // 8.
+ // So to avoid a buffer overflow, we may need to pad rows to a multiple of 8.
+ int output_n = ((out_w + 7) & ~7) * out_h;
+ uint8_t *output = new uint8_t[output_n];
+ uint8_t *output2 = new uint8_t[output_n];
+
+ // Generate random filter kernels
+ DECLARE_ALIGNED(16, InterpKernel, hkernel);
+ DECLARE_ALIGNED(16, InterpKernel, vkernel);
+
+ generate_kernels(&rnd_, hkernel, vkernel);
+
+ for (i = 0; i < h; ++i)
+ for (j = 0; j < w; ++j) input[i * w + j] = rnd_.Rand8();
+
+ for (i = 0; i < num_iters; ++i) {
+ // Choose random locations within the source block
+ int offset_r = 3 + rnd_.PseudoUniform(w - out_w - 7);
+ int offset_c = 3 + rnd_.PseudoUniform(h - out_h - 7);
+ aom_convolve8_add_src_hip_c(input + offset_r * w + offset_c, w, output,
+ out_w, hkernel, 16, vkernel, 16, out_w, out_h);
+ test_impl(input + offset_r * w + offset_c, w, output2, out_w, hkernel, 16,
+ vkernel, 16, out_w, out_h);
+
+ for (j = 0; j < out_w * out_h; ++j)
+ ASSERT_EQ(output[j], output2[j]) << "Pixel mismatch at index " << j
+ << " = (" << (j % out_w) << ", "
+ << (j / out_w) << ") on iteration " << i;
+ }
+ delete[] input_;
+ delete[] output;
+ delete[] output2;
+}
+} // namespace AV1HiprecConvolve
+
+#if CONFIG_HIGHBITDEPTH
+namespace AV1HighbdHiprecConvolve {
+
+::testing::internal::ParamGenerator<HighbdHiprecConvolveParam> BuildParams(
+ highbd_hiprec_convolve_func filter) {
+ const HighbdHiprecConvolveParam params[] = {
+ make_tuple(8, 8, 50000, 8, filter), make_tuple(64, 64, 1000, 8, filter),
+ make_tuple(32, 8, 10000, 8, filter), make_tuple(8, 8, 50000, 10, filter),
+ make_tuple(64, 64, 1000, 10, filter), make_tuple(32, 8, 10000, 10, filter),
+ make_tuple(8, 8, 50000, 12, filter), make_tuple(64, 64, 1000, 12, filter),
+ make_tuple(32, 8, 10000, 12, filter),
+ };
+ return ::testing::ValuesIn(params);
+}
+
+AV1HighbdHiprecConvolveTest::~AV1HighbdHiprecConvolveTest() {}
+void AV1HighbdHiprecConvolveTest::SetUp() {
+ rnd_.Reset(ACMRandom::DeterministicSeed());
+}
+
+void AV1HighbdHiprecConvolveTest::TearDown() {
+ libaom_test::ClearSystemState();
+}
+
+void AV1HighbdHiprecConvolveTest::RunCheckOutput(
+ highbd_hiprec_convolve_func test_impl) {
+ const int w = 128, h = 128;
+ const int out_w = GET_PARAM(0), out_h = GET_PARAM(1);
+ const int num_iters = GET_PARAM(2);
+ const int bd = GET_PARAM(3);
+ int i, j;
+
+ uint16_t *input = new uint16_t[h * w];
+
+ // The convolve functions always write rows with widths that are multiples of
+ // 8.
+ // So to avoid a buffer overflow, we may need to pad rows to a multiple of 8.
+ int output_n = ((out_w + 7) & ~7) * out_h;
+ uint16_t *output = new uint16_t[output_n];
+ uint16_t *output2 = new uint16_t[output_n];
+
+ // Generate random filter kernels
+ DECLARE_ALIGNED(16, InterpKernel, hkernel);
+ DECLARE_ALIGNED(16, InterpKernel, vkernel);
+
+ generate_kernels(&rnd_, hkernel, vkernel);
+
+ for (i = 0; i < h; ++i)
+ for (j = 0; j < w; ++j) input[i * w + j] = rnd_.Rand16() & ((1 << bd) - 1);
+
+ uint8_t *input_ptr = CONVERT_TO_BYTEPTR(input);
+ uint8_t *output_ptr = CONVERT_TO_BYTEPTR(output);
+ uint8_t *output2_ptr = CONVERT_TO_BYTEPTR(output2);
+
+ for (i = 0; i < num_iters; ++i) {
+ // Choose random locations within the source block
+ int offset_r = 3 + rnd_.PseudoUniform(w - out_w - 7);
+ int offset_c = 3 + rnd_.PseudoUniform(h - out_h - 7);
+ aom_highbd_convolve8_add_src_hip_c(input_ptr + offset_r * w + offset_c, w,
+ output_ptr, out_w, hkernel, 16, vkernel,
+ 16, out_w, out_h, bd);
+ test_impl(input_ptr + offset_r * w + offset_c, w, output2_ptr, out_w,
+ hkernel, 16, vkernel, 16, out_w, out_h, bd);
+
+ for (j = 0; j < out_w * out_h; ++j)
+ ASSERT_EQ(output[j], output2[j]) << "Pixel mismatch at index " << j
+ << " = (" << (j % out_w) << ", "
+ << (j / out_w) << ") on iteration " << i;
+ }
+ delete[] input;
+ delete[] output;
+ delete[] output2;
+}
+} // namespace AV1HighbdHiprecConvolve
+#endif // CONFIG_HIGHBITDEPTH
+} // namespace libaom_test
diff --git a/third_party/aom/test/hiprec_convolve_test_util.h b/third_party/aom/test/hiprec_convolve_test_util.h
new file mode 100644
index 000000000..fe31570f5
--- /dev/null
+++ b/third_party/aom/test/hiprec_convolve_test_util.h
@@ -0,0 +1,89 @@
+/*
+ * 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 TEST_HIPREC_CONVOLVE_TEST_UTIL_H_
+#define TEST_HIPREC_CONVOLVE_TEST_UTIL_H_
+
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
+#include "test/acm_random.h"
+#include "test/util.h"
+#include "./av1_rtcd.h"
+#include "./aom_dsp_rtcd.h"
+#include "test/clear_system_state.h"
+#include "test/register_state_check.h"
+
+#include "av1/common/mv.h"
+
+namespace libaom_test {
+
+namespace AV1HiprecConvolve {
+
+typedef void (*hiprec_convolve_func)(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);
+
+typedef std::tr1::tuple<int, int, int, hiprec_convolve_func>
+ HiprecConvolveParam;
+
+::testing::internal::ParamGenerator<HiprecConvolveParam> BuildParams(
+ hiprec_convolve_func filter);
+
+class AV1HiprecConvolveTest
+ : public ::testing::TestWithParam<HiprecConvolveParam> {
+ public:
+ virtual ~AV1HiprecConvolveTest();
+ virtual void SetUp();
+
+ virtual void TearDown();
+
+ protected:
+ void RunCheckOutput(hiprec_convolve_func test_impl);
+
+ libaom_test::ACMRandom rnd_;
+};
+
+} // namespace AV1HiprecConvolve
+
+#if CONFIG_HIGHBITDEPTH
+namespace AV1HighbdHiprecConvolve {
+typedef void (*highbd_hiprec_convolve_func)(
+ 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);
+
+typedef std::tr1::tuple<int, int, int, int, highbd_hiprec_convolve_func>
+ HighbdHiprecConvolveParam;
+
+::testing::internal::ParamGenerator<HighbdHiprecConvolveParam> BuildParams(
+ highbd_hiprec_convolve_func filter);
+
+class AV1HighbdHiprecConvolveTest
+ : public ::testing::TestWithParam<HighbdHiprecConvolveParam> {
+ public:
+ virtual ~AV1HighbdHiprecConvolveTest();
+ virtual void SetUp();
+
+ virtual void TearDown();
+
+ protected:
+ void RunCheckOutput(highbd_hiprec_convolve_func test_impl);
+
+ libaom_test::ACMRandom rnd_;
+};
+
+} // namespace AV1HighbdHiprecConvolve
+#endif // CONFIG_HIGHBITDEPTH
+
+} // namespace libaom_test
+
+#endif // TEST_HIPREC_CONVOLVE_TEST_UTIL_H_
diff --git a/third_party/aom/test/intrapred_test.cc b/third_party/aom/test/intrapred_test.cc
index 4efed57b6..5dd8c00be 100644
--- a/third_party/aom/test/intrapred_test.cc
+++ b/third_party/aom/test/intrapred_test.cc
@@ -126,105 +126,111 @@ TEST_P(AV1IntraPredTest, IntraPredTests) {
#if HAVE_SSE2
#if CONFIG_HIGHBITDEPTH
-INSTANTIATE_TEST_CASE_P(
- SSE2_TO_C_8, AV1IntraPredTest,
- ::testing::Values(IntraPredFunc(&aom_highbd_dc_predictor_32x32_sse2,
- &aom_highbd_dc_predictor_32x32_c, 32, 8),
+const IntraPredFunc IntraPredTestVector8[] = {
+ IntraPredFunc(&aom_highbd_dc_predictor_32x32_sse2,
+ &aom_highbd_dc_predictor_32x32_c, 32, 8),
#if !CONFIG_ALT_INTRA
- IntraPredFunc(&aom_highbd_tm_predictor_16x16_sse2,
- &aom_highbd_tm_predictor_16x16_c, 16, 8),
- IntraPredFunc(&aom_highbd_tm_predictor_32x32_sse2,
- &aom_highbd_tm_predictor_32x32_c, 32, 8),
+ IntraPredFunc(&aom_highbd_tm_predictor_16x16_sse2,
+ &aom_highbd_tm_predictor_16x16_c, 16, 8),
+ IntraPredFunc(&aom_highbd_tm_predictor_32x32_sse2,
+ &aom_highbd_tm_predictor_32x32_c, 32, 8),
#endif // !CONFIG_ALT_INTRA
- IntraPredFunc(&aom_highbd_dc_predictor_4x4_sse2,
- &aom_highbd_dc_predictor_4x4_c, 4, 8),
- IntraPredFunc(&aom_highbd_dc_predictor_8x8_sse2,
- &aom_highbd_dc_predictor_8x8_c, 8, 8),
- IntraPredFunc(&aom_highbd_dc_predictor_16x16_sse2,
- &aom_highbd_dc_predictor_16x16_c, 16, 8),
- IntraPredFunc(&aom_highbd_v_predictor_4x4_sse2,
- &aom_highbd_v_predictor_4x4_c, 4, 8),
- IntraPredFunc(&aom_highbd_v_predictor_8x8_sse2,
- &aom_highbd_v_predictor_8x8_c, 8, 8),
- IntraPredFunc(&aom_highbd_v_predictor_16x16_sse2,
- &aom_highbd_v_predictor_16x16_c, 16, 8),
- IntraPredFunc(&aom_highbd_v_predictor_32x32_sse2,
- &aom_highbd_v_predictor_32x32_c, 32, 8)
+ IntraPredFunc(&aom_highbd_dc_predictor_4x4_sse2,
+ &aom_highbd_dc_predictor_4x4_c, 4, 8),
+ IntraPredFunc(&aom_highbd_dc_predictor_8x8_sse2,
+ &aom_highbd_dc_predictor_8x8_c, 8, 8),
+ IntraPredFunc(&aom_highbd_dc_predictor_16x16_sse2,
+ &aom_highbd_dc_predictor_16x16_c, 16, 8),
+ IntraPredFunc(&aom_highbd_v_predictor_4x4_sse2, &aom_highbd_v_predictor_4x4_c,
+ 4, 8),
+ IntraPredFunc(&aom_highbd_v_predictor_8x8_sse2, &aom_highbd_v_predictor_8x8_c,
+ 8, 8),
+ IntraPredFunc(&aom_highbd_v_predictor_16x16_sse2,
+ &aom_highbd_v_predictor_16x16_c, 16, 8),
+ IntraPredFunc(&aom_highbd_v_predictor_32x32_sse2,
+ &aom_highbd_v_predictor_32x32_c, 32, 8)
#if !CONFIG_ALT_INTRA
- ,
- IntraPredFunc(&aom_highbd_tm_predictor_4x4_sse2,
- &aom_highbd_tm_predictor_4x4_c, 4, 8),
- IntraPredFunc(&aom_highbd_tm_predictor_8x8_sse2,
- &aom_highbd_tm_predictor_8x8_c, 8, 8)
+ ,
+ IntraPredFunc(&aom_highbd_tm_predictor_4x4_sse2,
+ &aom_highbd_tm_predictor_4x4_c, 4, 8),
+ IntraPredFunc(&aom_highbd_tm_predictor_8x8_sse2,
+ &aom_highbd_tm_predictor_8x8_c, 8, 8)
#endif // !CONFIG_ALT_INTRA
- ));
+};
+
+INSTANTIATE_TEST_CASE_P(SSE2_TO_C_8, AV1IntraPredTest,
+ ::testing::ValuesIn(IntraPredTestVector8));
-INSTANTIATE_TEST_CASE_P(
- SSE2_TO_C_10, AV1IntraPredTest,
- ::testing::Values(IntraPredFunc(&aom_highbd_dc_predictor_32x32_sse2,
- &aom_highbd_dc_predictor_32x32_c, 32, 10),
+const IntraPredFunc IntraPredTestVector10[] = {
+ IntraPredFunc(&aom_highbd_dc_predictor_32x32_sse2,
+ &aom_highbd_dc_predictor_32x32_c, 32, 10),
#if !CONFIG_ALT_INTRA
- IntraPredFunc(&aom_highbd_tm_predictor_16x16_sse2,
- &aom_highbd_tm_predictor_16x16_c, 16, 10),
- IntraPredFunc(&aom_highbd_tm_predictor_32x32_sse2,
- &aom_highbd_tm_predictor_32x32_c, 32, 10),
+ IntraPredFunc(&aom_highbd_tm_predictor_16x16_sse2,
+ &aom_highbd_tm_predictor_16x16_c, 16, 10),
+ IntraPredFunc(&aom_highbd_tm_predictor_32x32_sse2,
+ &aom_highbd_tm_predictor_32x32_c, 32, 10),
#endif // !CONFIG_ALT_INTRA
- IntraPredFunc(&aom_highbd_dc_predictor_4x4_sse2,
- &aom_highbd_dc_predictor_4x4_c, 4, 10),
- IntraPredFunc(&aom_highbd_dc_predictor_8x8_sse2,
- &aom_highbd_dc_predictor_8x8_c, 8, 10),
- IntraPredFunc(&aom_highbd_dc_predictor_16x16_sse2,
- &aom_highbd_dc_predictor_16x16_c, 16, 10),
- IntraPredFunc(&aom_highbd_v_predictor_4x4_sse2,
- &aom_highbd_v_predictor_4x4_c, 4, 10),
- IntraPredFunc(&aom_highbd_v_predictor_8x8_sse2,
- &aom_highbd_v_predictor_8x8_c, 8, 10),
- IntraPredFunc(&aom_highbd_v_predictor_16x16_sse2,
- &aom_highbd_v_predictor_16x16_c, 16, 10),
- IntraPredFunc(&aom_highbd_v_predictor_32x32_sse2,
- &aom_highbd_v_predictor_32x32_c, 32, 10)
+ IntraPredFunc(&aom_highbd_dc_predictor_4x4_sse2,
+ &aom_highbd_dc_predictor_4x4_c, 4, 10),
+ IntraPredFunc(&aom_highbd_dc_predictor_8x8_sse2,
+ &aom_highbd_dc_predictor_8x8_c, 8, 10),
+ IntraPredFunc(&aom_highbd_dc_predictor_16x16_sse2,
+ &aom_highbd_dc_predictor_16x16_c, 16, 10),
+ IntraPredFunc(&aom_highbd_v_predictor_4x4_sse2, &aom_highbd_v_predictor_4x4_c,
+ 4, 10),
+ IntraPredFunc(&aom_highbd_v_predictor_8x8_sse2, &aom_highbd_v_predictor_8x8_c,
+ 8, 10),
+ IntraPredFunc(&aom_highbd_v_predictor_16x16_sse2,
+ &aom_highbd_v_predictor_16x16_c, 16, 10),
+ IntraPredFunc(&aom_highbd_v_predictor_32x32_sse2,
+ &aom_highbd_v_predictor_32x32_c, 32, 10)
#if !CONFIG_ALT_INTRA
- ,
- IntraPredFunc(&aom_highbd_tm_predictor_4x4_sse2,
- &aom_highbd_tm_predictor_4x4_c, 4, 10),
- IntraPredFunc(&aom_highbd_tm_predictor_8x8_sse2,
- &aom_highbd_tm_predictor_8x8_c, 8, 10)
+ ,
+ IntraPredFunc(&aom_highbd_tm_predictor_4x4_sse2,
+ &aom_highbd_tm_predictor_4x4_c, 4, 10),
+ IntraPredFunc(&aom_highbd_tm_predictor_8x8_sse2,
+ &aom_highbd_tm_predictor_8x8_c, 8, 10)
#endif // !CONFIG_ALT_INTRA
- ));
+};
-INSTANTIATE_TEST_CASE_P(
- SSE2_TO_C_12, AV1IntraPredTest,
- ::testing::Values(IntraPredFunc(&aom_highbd_dc_predictor_32x32_sse2,
- &aom_highbd_dc_predictor_32x32_c, 32, 12),
+INSTANTIATE_TEST_CASE_P(SSE2_TO_C_10, AV1IntraPredTest,
+ ::testing::ValuesIn(IntraPredTestVector10));
+
+const IntraPredFunc IntraPredTestVector12[] = {
+ IntraPredFunc(&aom_highbd_dc_predictor_32x32_sse2,
+ &aom_highbd_dc_predictor_32x32_c, 32, 12),
#if !CONFIG_ALT_INTRA
- IntraPredFunc(&aom_highbd_tm_predictor_16x16_sse2,
- &aom_highbd_tm_predictor_16x16_c, 16, 12),
- IntraPredFunc(&aom_highbd_tm_predictor_32x32_sse2,
- &aom_highbd_tm_predictor_32x32_c, 32, 12),
+ IntraPredFunc(&aom_highbd_tm_predictor_16x16_sse2,
+ &aom_highbd_tm_predictor_16x16_c, 16, 12),
+ IntraPredFunc(&aom_highbd_tm_predictor_32x32_sse2,
+ &aom_highbd_tm_predictor_32x32_c, 32, 12),
#endif // !CONFIG_ALT_INTRA
- IntraPredFunc(&aom_highbd_dc_predictor_4x4_sse2,
- &aom_highbd_dc_predictor_4x4_c, 4, 12),
- IntraPredFunc(&aom_highbd_dc_predictor_8x8_sse2,
- &aom_highbd_dc_predictor_8x8_c, 8, 12),
- IntraPredFunc(&aom_highbd_dc_predictor_16x16_sse2,
- &aom_highbd_dc_predictor_16x16_c, 16, 12),
- IntraPredFunc(&aom_highbd_v_predictor_4x4_sse2,
- &aom_highbd_v_predictor_4x4_c, 4, 12),
- IntraPredFunc(&aom_highbd_v_predictor_8x8_sse2,
- &aom_highbd_v_predictor_8x8_c, 8, 12),
- IntraPredFunc(&aom_highbd_v_predictor_16x16_sse2,
- &aom_highbd_v_predictor_16x16_c, 16, 12),
- IntraPredFunc(&aom_highbd_v_predictor_32x32_sse2,
- &aom_highbd_v_predictor_32x32_c, 32, 12)
+ IntraPredFunc(&aom_highbd_dc_predictor_4x4_sse2,
+ &aom_highbd_dc_predictor_4x4_c, 4, 12),
+ IntraPredFunc(&aom_highbd_dc_predictor_8x8_sse2,
+ &aom_highbd_dc_predictor_8x8_c, 8, 12),
+ IntraPredFunc(&aom_highbd_dc_predictor_16x16_sse2,
+ &aom_highbd_dc_predictor_16x16_c, 16, 12),
+ IntraPredFunc(&aom_highbd_v_predictor_4x4_sse2, &aom_highbd_v_predictor_4x4_c,
+ 4, 12),
+ IntraPredFunc(&aom_highbd_v_predictor_8x8_sse2, &aom_highbd_v_predictor_8x8_c,
+ 8, 12),
+ IntraPredFunc(&aom_highbd_v_predictor_16x16_sse2,
+ &aom_highbd_v_predictor_16x16_c, 16, 12),
+ IntraPredFunc(&aom_highbd_v_predictor_32x32_sse2,
+ &aom_highbd_v_predictor_32x32_c, 32, 12)
#if !CONFIG_ALT_INTRA
- ,
- IntraPredFunc(&aom_highbd_tm_predictor_4x4_sse2,
- &aom_highbd_tm_predictor_4x4_c, 4, 12),
- IntraPredFunc(&aom_highbd_tm_predictor_8x8_sse2,
- &aom_highbd_tm_predictor_8x8_c, 8, 12)
+ ,
+ IntraPredFunc(&aom_highbd_tm_predictor_4x4_sse2,
+ &aom_highbd_tm_predictor_4x4_c, 4, 12),
+ IntraPredFunc(&aom_highbd_tm_predictor_8x8_sse2,
+ &aom_highbd_tm_predictor_8x8_c, 8, 12)
#endif // !CONFIG_ALT_INTRA
- ));
+};
+
+INSTANTIATE_TEST_CASE_P(SSE2_TO_C_12, AV1IntraPredTest,
+ ::testing::ValuesIn(IntraPredTestVector12));
#endif // CONFIG_HIGHBITDEPTH
#endif // HAVE_SSE2
diff --git a/third_party/aom/test/masked_sad_test.cc b/third_party/aom/test/masked_sad_test.cc
index 53f85eef7..2dde3c537 100644
--- a/third_party/aom/test/masked_sad_test.cc
+++ b/third_party/aom/test/masked_sad_test.cc
@@ -25,11 +25,13 @@
using libaom_test::ACMRandom;
namespace {
-const int number_of_iterations = 500;
+const int number_of_iterations = 200;
-typedef unsigned int (*MaskedSADFunc)(const uint8_t *a, int a_stride,
- const uint8_t *b, int b_stride,
- const uint8_t *m, int m_stride);
+typedef unsigned int (*MaskedSADFunc)(const uint8_t *src, int src_stride,
+ const uint8_t *ref, int ref_stride,
+ const uint8_t *second_pred,
+ const uint8_t *msk, int msk_stride,
+ int invert_mask);
typedef std::tr1::tuple<MaskedSADFunc, MaskedSADFunc> MaskedSADParam;
class MaskedSADTest : public ::testing::TestWithParam<MaskedSADParam> {
@@ -52,6 +54,7 @@ TEST_P(MaskedSADTest, OperationCheck) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
DECLARE_ALIGNED(16, uint8_t, src_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
DECLARE_ALIGNED(16, uint8_t, ref_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
+ DECLARE_ALIGNED(16, uint8_t, second_pred_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
DECLARE_ALIGNED(16, uint8_t, msk_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
int err_count = 0;
int first_failure = -1;
@@ -62,18 +65,23 @@ TEST_P(MaskedSADTest, OperationCheck) {
for (int j = 0; j < MAX_SB_SIZE * MAX_SB_SIZE; j++) {
src_ptr[j] = rnd.Rand8();
ref_ptr[j] = rnd.Rand8();
+ second_pred_ptr[j] = rnd.Rand8();
msk_ptr[j] = ((rnd.Rand8() & 0x7f) > 64) ? rnd.Rand8() & 0x3f : 64;
assert(msk_ptr[j] <= 64);
}
- ref_ret = ref_maskedSAD_op_(src_ptr, src_stride, ref_ptr, ref_stride,
- msk_ptr, msk_stride);
- ASM_REGISTER_STATE_CHECK(ret = maskedSAD_op_(src_ptr, src_stride, ref_ptr,
- ref_stride, msk_ptr,
- msk_stride));
- if (ret != ref_ret) {
- err_count++;
- if (first_failure == -1) first_failure = i;
+ for (int invert_mask = 0; invert_mask < 2; ++invert_mask) {
+ ref_ret =
+ ref_maskedSAD_op_(src_ptr, src_stride, ref_ptr, ref_stride,
+ second_pred_ptr, msk_ptr, msk_stride, invert_mask);
+ ASM_REGISTER_STATE_CHECK(ret = maskedSAD_op_(src_ptr, src_stride, ref_ptr,
+ ref_stride, second_pred_ptr,
+ msk_ptr, msk_stride,
+ invert_mask));
+ if (ret != ref_ret) {
+ err_count++;
+ if (first_failure == -1) first_failure = i;
+ }
}
}
EXPECT_EQ(0, err_count)
@@ -82,9 +90,11 @@ TEST_P(MaskedSADTest, OperationCheck) {
}
#if CONFIG_HIGHBITDEPTH
-typedef unsigned int (*HighbdMaskedSADFunc)(const uint8_t *a, int a_stride,
- const uint8_t *b, int b_stride,
- const uint8_t *m, int m_stride);
+typedef unsigned int (*HighbdMaskedSADFunc)(const uint8_t *src, int src_stride,
+ const uint8_t *ref, int ref_stride,
+ const uint8_t *second_pred,
+ const uint8_t *msk, int msk_stride,
+ int invert_mask);
typedef std::tr1::tuple<HighbdMaskedSADFunc, HighbdMaskedSADFunc>
HighbdMaskedSADParam;
@@ -109,9 +119,11 @@ TEST_P(HighbdMaskedSADTest, OperationCheck) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
DECLARE_ALIGNED(16, uint16_t, src_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
DECLARE_ALIGNED(16, uint16_t, ref_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
+ DECLARE_ALIGNED(16, uint16_t, second_pred_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
DECLARE_ALIGNED(16, uint8_t, msk_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
uint8_t *src8_ptr = CONVERT_TO_BYTEPTR(src_ptr);
uint8_t *ref8_ptr = CONVERT_TO_BYTEPTR(ref_ptr);
+ uint8_t *second_pred8_ptr = CONVERT_TO_BYTEPTR(second_pred_ptr);
int err_count = 0;
int first_failure = -1;
int src_stride = MAX_SB_SIZE;
@@ -121,17 +133,22 @@ TEST_P(HighbdMaskedSADTest, OperationCheck) {
for (int j = 0; j < MAX_SB_SIZE * MAX_SB_SIZE; j++) {
src_ptr[j] = rnd.Rand16() & 0xfff;
ref_ptr[j] = rnd.Rand16() & 0xfff;
+ second_pred_ptr[j] = rnd.Rand16() & 0xfff;
msk_ptr[j] = ((rnd.Rand8() & 0x7f) > 64) ? rnd.Rand8() & 0x3f : 64;
}
- ref_ret = ref_maskedSAD_op_(src8_ptr, src_stride, ref8_ptr, ref_stride,
- msk_ptr, msk_stride);
- ASM_REGISTER_STATE_CHECK(ret = maskedSAD_op_(src8_ptr, src_stride, ref8_ptr,
- ref_stride, msk_ptr,
- msk_stride));
- if (ret != ref_ret) {
- err_count++;
- if (first_failure == -1) first_failure = i;
+ for (int invert_mask = 0; invert_mask < 2; ++invert_mask) {
+ ref_ret =
+ ref_maskedSAD_op_(src8_ptr, src_stride, ref8_ptr, ref_stride,
+ second_pred8_ptr, msk_ptr, msk_stride, invert_mask);
+ ASM_REGISTER_STATE_CHECK(ret = maskedSAD_op_(src8_ptr, src_stride,
+ ref8_ptr, ref_stride,
+ second_pred8_ptr, msk_ptr,
+ msk_stride, invert_mask));
+ if (ret != ref_ret) {
+ err_count++;
+ if (first_failure == -1) first_failure = i;
+ }
}
}
EXPECT_EQ(0, err_count)
diff --git a/third_party/aom/test/masked_variance_test.cc b/third_party/aom/test/masked_variance_test.cc
index 65e852aea..bf113c69e 100644
--- a/third_party/aom/test/masked_variance_test.cc
+++ b/third_party/aom/test/masked_variance_test.cc
@@ -29,107 +29,12 @@
using libaom_test::ACMRandom;
namespace {
-const int number_of_iterations = 500;
-
-typedef unsigned int (*MaskedVarianceFunc)(const uint8_t *a, int a_stride,
- const uint8_t *b, int b_stride,
- const uint8_t *m, int m_stride,
- unsigned int *sse);
-
-typedef std::tr1::tuple<MaskedVarianceFunc, MaskedVarianceFunc>
- MaskedVarianceParam;
-
-class MaskedVarianceTest
- : public ::testing::TestWithParam<MaskedVarianceParam> {
- public:
- virtual ~MaskedVarianceTest() {}
- virtual void SetUp() {
- opt_func_ = GET_PARAM(0);
- ref_func_ = GET_PARAM(1);
- }
-
- virtual void TearDown() { libaom_test::ClearSystemState(); }
-
- protected:
- MaskedVarianceFunc opt_func_;
- MaskedVarianceFunc ref_func_;
-};
-
-TEST_P(MaskedVarianceTest, OperationCheck) {
- unsigned int ref_ret, opt_ret;
- unsigned int ref_sse, opt_sse;
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- DECLARE_ALIGNED(16, uint8_t, src_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
- DECLARE_ALIGNED(16, uint8_t, ref_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
- DECLARE_ALIGNED(16, uint8_t, msk_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
- int err_count = 0;
- int first_failure = -1;
- int src_stride = MAX_SB_SIZE;
- int ref_stride = MAX_SB_SIZE;
- int msk_stride = MAX_SB_SIZE;
-
- for (int i = 0; i < number_of_iterations; ++i) {
- for (int j = 0; j < MAX_SB_SIZE * MAX_SB_SIZE; j++) {
- src_ptr[j] = rnd.Rand8();
- ref_ptr[j] = rnd.Rand8();
- msk_ptr[j] = rnd(65);
- }
-
- ref_ret = ref_func_(src_ptr, src_stride, ref_ptr, ref_stride, msk_ptr,
- msk_stride, &ref_sse);
- ASM_REGISTER_STATE_CHECK(opt_ret = opt_func_(src_ptr, src_stride, ref_ptr,
- ref_stride, msk_ptr,
- msk_stride, &opt_sse));
-
- if (opt_ret != ref_ret || opt_sse != ref_sse) {
- err_count++;
- if (first_failure == -1) first_failure = i;
- }
- }
-
- EXPECT_EQ(0, err_count) << "Error: Masked Variance Test OperationCheck,"
- << "C output doesn't match SSSE3 output. "
- << "First failed at test case " << first_failure;
-}
-
-TEST_P(MaskedVarianceTest, ExtremeValues) {
- unsigned int ref_ret, opt_ret;
- unsigned int ref_sse, opt_sse;
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- DECLARE_ALIGNED(16, uint8_t, src_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
- DECLARE_ALIGNED(16, uint8_t, ref_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
- DECLARE_ALIGNED(16, uint8_t, msk_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
- int err_count = 0;
- int first_failure = -1;
- int src_stride = MAX_SB_SIZE;
- int ref_stride = MAX_SB_SIZE;
- int msk_stride = MAX_SB_SIZE;
-
- for (int i = 0; i < 8; ++i) {
- memset(src_ptr, (i & 0x1) ? 255 : 0, MAX_SB_SIZE * MAX_SB_SIZE);
- memset(ref_ptr, (i & 0x2) ? 255 : 0, MAX_SB_SIZE * MAX_SB_SIZE);
- memset(msk_ptr, (i & 0x4) ? 64 : 0, MAX_SB_SIZE * MAX_SB_SIZE);
-
- ref_ret = ref_func_(src_ptr, src_stride, ref_ptr, ref_stride, msk_ptr,
- msk_stride, &ref_sse);
- ASM_REGISTER_STATE_CHECK(opt_ret = opt_func_(src_ptr, src_stride, ref_ptr,
- ref_stride, msk_ptr,
- msk_stride, &opt_sse));
-
- if (opt_ret != ref_ret || opt_sse != ref_sse) {
- err_count++;
- if (first_failure == -1) first_failure = i;
- }
- }
-
- EXPECT_EQ(0, err_count) << "Error: Masked Variance Test ExtremeValues,"
- << "C output doesn't match SSSE3 output. "
- << "First failed at test case " << first_failure;
-}
+const int number_of_iterations = 200;
typedef unsigned int (*MaskedSubPixelVarianceFunc)(
- const uint8_t *a, int a_stride, int xoffset, int yoffset, const uint8_t *b,
- int b_stride, const uint8_t *m, int m_stride, unsigned int *sse);
+ const uint8_t *src, int src_stride, int xoffset, int yoffset,
+ const uint8_t *ref, int ref_stride, const uint8_t *second_pred,
+ const uint8_t *msk, int msk_stride, int invert_mask, unsigned int *sse);
typedef std::tr1::tuple<MaskedSubPixelVarianceFunc, MaskedSubPixelVarianceFunc>
MaskedSubPixelVarianceParam;
@@ -154,9 +59,18 @@ TEST_P(MaskedSubPixelVarianceTest, OperationCheck) {
unsigned int ref_ret, opt_ret;
unsigned int ref_sse, opt_sse;
ACMRandom rnd(ACMRandom::DeterministicSeed());
- DECLARE_ALIGNED(16, uint8_t, src_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1)]);
- DECLARE_ALIGNED(16, uint8_t, ref_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1)]);
- DECLARE_ALIGNED(16, uint8_t, msk_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1)]);
+ // Note: We pad the input arrays out with 15 extra elements, since the SSE
+ // implementations can read up to 15 elements off the end of the main data.
+ // The extra data is never actually used, but it simplifies the code
+ // if we can do this.
+ DECLARE_ALIGNED(16, uint8_t,
+ src_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1) + 15]);
+ DECLARE_ALIGNED(16, uint8_t,
+ ref_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1) + 15]);
+ DECLARE_ALIGNED(16, uint8_t,
+ second_pred_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1) + 15]);
+ DECLARE_ALIGNED(16, uint8_t,
+ msk_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1) + 15]);
int err_count = 0;
int first_failure = -1;
int src_stride = (MAX_SB_SIZE + 1);
@@ -171,23 +85,26 @@ TEST_P(MaskedSubPixelVarianceTest, OperationCheck) {
for (int j = 0; j < (MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1); j++) {
src_ptr[j] = rnd.Rand8();
ref_ptr[j] = rnd.Rand8();
+ second_pred_ptr[j] = rnd.Rand8();
msk_ptr[j] = rnd(65);
}
for (int k = 0; k < 3; k++) {
- xoffset = xoffsets[k];
for (int l = 0; l < 3; l++) {
xoffset = xoffsets[k];
yoffset = yoffsets[l];
-
- ref_ret = ref_func_(src_ptr, src_stride, xoffset, yoffset, ref_ptr,
- ref_stride, msk_ptr, msk_stride, &ref_sse);
- ASM_REGISTER_STATE_CHECK(
- opt_ret = opt_func_(src_ptr, src_stride, xoffset, yoffset, ref_ptr,
- ref_stride, msk_ptr, msk_stride, &opt_sse));
-
- if (opt_ret != ref_ret || opt_sse != ref_sse) {
- err_count++;
- if (first_failure == -1) first_failure = i;
+ for (int invert_mask = 0; invert_mask < 2; ++invert_mask) {
+ ref_ret = ref_func_(src_ptr, src_stride, xoffset, yoffset, ref_ptr,
+ ref_stride, second_pred_ptr, msk_ptr, msk_stride,
+ invert_mask, &ref_sse);
+ ASM_REGISTER_STATE_CHECK(
+ opt_ret = opt_func_(src_ptr, src_stride, xoffset, yoffset,
+ ref_ptr, ref_stride, second_pred_ptr, msk_ptr,
+ msk_stride, invert_mask, &opt_sse));
+
+ if (opt_ret != ref_ret || opt_sse != ref_sse) {
+ err_count++;
+ if (first_failure == -1) first_failure = i;
+ }
}
}
}
@@ -203,9 +120,14 @@ TEST_P(MaskedSubPixelVarianceTest, ExtremeValues) {
unsigned int ref_ret, opt_ret;
unsigned int ref_sse, opt_sse;
ACMRandom rnd(ACMRandom::DeterministicSeed());
- DECLARE_ALIGNED(16, uint8_t, src_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1)]);
- DECLARE_ALIGNED(16, uint8_t, ref_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1)]);
- DECLARE_ALIGNED(16, uint8_t, msk_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1)]);
+ DECLARE_ALIGNED(16, uint8_t,
+ src_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1) + 15]);
+ DECLARE_ALIGNED(16, uint8_t,
+ ref_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1) + 15]);
+ DECLARE_ALIGNED(16, uint8_t,
+ second_pred_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1) + 15]);
+ DECLARE_ALIGNED(16, uint8_t,
+ msk_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1) + 15]);
int first_failure_x = -1;
int first_failure_y = -1;
int err_count = 0;
@@ -216,26 +138,32 @@ TEST_P(MaskedSubPixelVarianceTest, ExtremeValues) {
for (int xoffset = 0; xoffset < BIL_SUBPEL_SHIFTS; xoffset++) {
for (int yoffset = 0; yoffset < BIL_SUBPEL_SHIFTS; yoffset++) {
- for (int i = 0; i < 8; ++i) {
+ for (int i = 0; i < 16; ++i) {
memset(src_ptr, (i & 0x1) ? 255 : 0,
(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1));
memset(ref_ptr, (i & 0x2) ? 255 : 0,
(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1));
- memset(msk_ptr, (i & 0x4) ? 64 : 0,
+ memset(second_pred_ptr, (i & 0x4) ? 255 : 0,
+ (MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1));
+ memset(msk_ptr, (i & 0x8) ? 64 : 0,
(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1));
- ref_ret = ref_func_(src_ptr, src_stride, xoffset, yoffset, ref_ptr,
- ref_stride, msk_ptr, msk_stride, &ref_sse);
- ASM_REGISTER_STATE_CHECK(
- opt_ret = opt_func_(src_ptr, src_stride, xoffset, yoffset, ref_ptr,
- ref_stride, msk_ptr, msk_stride, &opt_sse));
-
- if (opt_ret != ref_ret || opt_sse != ref_sse) {
- err_count++;
- if (first_failure == -1) {
- first_failure = i;
- first_failure_x = xoffset;
- first_failure_y = yoffset;
+ for (int invert_mask = 0; invert_mask < 2; ++invert_mask) {
+ ref_ret = ref_func_(src_ptr, src_stride, xoffset, yoffset, ref_ptr,
+ ref_stride, second_pred_ptr, msk_ptr, msk_stride,
+ invert_mask, &ref_sse);
+ ASM_REGISTER_STATE_CHECK(
+ opt_ret = opt_func_(src_ptr, src_stride, xoffset, yoffset,
+ ref_ptr, ref_stride, second_pred_ptr, msk_ptr,
+ msk_stride, invert_mask, &opt_sse));
+
+ if (opt_ret != ref_ret || opt_sse != ref_sse) {
+ err_count++;
+ if (first_failure == -1) {
+ first_failure = i;
+ first_failure_x = xoffset;
+ first_failure_y = yoffset;
+ }
}
}
}
@@ -250,105 +178,6 @@ TEST_P(MaskedSubPixelVarianceTest, ExtremeValues) {
}
#if CONFIG_HIGHBITDEPTH
-typedef std::tr1::tuple<MaskedVarianceFunc, MaskedVarianceFunc, aom_bit_depth_t>
- HighbdMaskedVarianceParam;
-
-class HighbdMaskedVarianceTest
- : public ::testing::TestWithParam<HighbdMaskedVarianceParam> {
- public:
- virtual ~HighbdMaskedVarianceTest() {}
- virtual void SetUp() {
- opt_func_ = GET_PARAM(0);
- ref_func_ = GET_PARAM(1);
- bit_depth_ = GET_PARAM(2);
- }
-
- virtual void TearDown() { libaom_test::ClearSystemState(); }
-
- protected:
- MaskedVarianceFunc opt_func_;
- MaskedVarianceFunc ref_func_;
- aom_bit_depth_t bit_depth_;
-};
-
-TEST_P(HighbdMaskedVarianceTest, OperationCheck) {
- unsigned int ref_ret, opt_ret;
- unsigned int ref_sse, opt_sse;
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- DECLARE_ALIGNED(16, uint16_t, src_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
- DECLARE_ALIGNED(16, uint16_t, ref_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
- DECLARE_ALIGNED(16, uint8_t, msk_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
- uint8_t *src8_ptr = CONVERT_TO_BYTEPTR(src_ptr);
- uint8_t *ref8_ptr = CONVERT_TO_BYTEPTR(ref_ptr);
- int err_count = 0;
- int first_failure = -1;
- int src_stride = MAX_SB_SIZE;
- int ref_stride = MAX_SB_SIZE;
- int msk_stride = MAX_SB_SIZE;
-
- for (int i = 0; i < number_of_iterations; ++i) {
- for (int j = 0; j < MAX_SB_SIZE * MAX_SB_SIZE; j++) {
- src_ptr[j] = rnd.Rand16() & ((1 << bit_depth_) - 1);
- ref_ptr[j] = rnd.Rand16() & ((1 << bit_depth_) - 1);
- msk_ptr[j] = rnd(65);
- }
-
- ref_ret = ref_func_(src8_ptr, src_stride, ref8_ptr, ref_stride, msk_ptr,
- msk_stride, &ref_sse);
- ASM_REGISTER_STATE_CHECK(opt_ret = opt_func_(src8_ptr, src_stride, ref8_ptr,
- ref_stride, msk_ptr,
- msk_stride, &opt_sse));
-
- if (opt_ret != ref_ret || opt_sse != ref_sse) {
- err_count++;
- if (first_failure == -1) first_failure = i;
- }
- }
-
- EXPECT_EQ(0, err_count) << "Error: Masked Variance Test OperationCheck,"
- << "C output doesn't match SSSE3 output. "
- << "First failed at test case " << first_failure;
-}
-
-TEST_P(HighbdMaskedVarianceTest, ExtremeValues) {
- unsigned int ref_ret, opt_ret;
- unsigned int ref_sse, opt_sse;
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- DECLARE_ALIGNED(16, uint16_t, src_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
- DECLARE_ALIGNED(16, uint16_t, ref_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
- DECLARE_ALIGNED(16, uint8_t, msk_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
- uint8_t *src8_ptr = CONVERT_TO_BYTEPTR(src_ptr);
- uint8_t *ref8_ptr = CONVERT_TO_BYTEPTR(ref_ptr);
- int err_count = 0;
- int first_failure = -1;
- int src_stride = MAX_SB_SIZE;
- int ref_stride = MAX_SB_SIZE;
- int msk_stride = MAX_SB_SIZE;
-
- for (int i = 0; i < 8; ++i) {
- aom_memset16(src_ptr, (i & 0x1) ? ((1 << bit_depth_) - 1) : 0,
- MAX_SB_SIZE * MAX_SB_SIZE);
- aom_memset16(ref_ptr, (i & 0x2) ? ((1 << bit_depth_) - 1) : 0,
- MAX_SB_SIZE * MAX_SB_SIZE);
- memset(msk_ptr, (i & 0x4) ? 64 : 0, MAX_SB_SIZE * MAX_SB_SIZE);
-
- ref_ret = ref_func_(src8_ptr, src_stride, ref8_ptr, ref_stride, msk_ptr,
- msk_stride, &ref_sse);
- ASM_REGISTER_STATE_CHECK(opt_ret = opt_func_(src8_ptr, src_stride, ref8_ptr,
- ref_stride, msk_ptr,
- msk_stride, &opt_sse));
-
- if (opt_ret != ref_ret || opt_sse != ref_sse) {
- err_count++;
- if (first_failure == -1) first_failure = i;
- }
- }
-
- EXPECT_EQ(0, err_count) << "Error: Masked Variance Test ExtremeValues,"
- << "C output doesn't match SSSE3 output. "
- << "First failed at test case " << first_failure;
-}
-
typedef std::tr1::tuple<MaskedSubPixelVarianceFunc, MaskedSubPixelVarianceFunc,
aom_bit_depth_t>
HighbdMaskedSubPixelVarianceParam;
@@ -375,11 +204,21 @@ TEST_P(HighbdMaskedSubPixelVarianceTest, OperationCheck) {
unsigned int ref_ret, opt_ret;
unsigned int ref_sse, opt_sse;
ACMRandom rnd(ACMRandom::DeterministicSeed());
- DECLARE_ALIGNED(16, uint16_t, src_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1)]);
- DECLARE_ALIGNED(16, uint16_t, ref_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1)]);
- DECLARE_ALIGNED(16, uint8_t, msk_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1)]);
+ // Note: We pad the input arrays out with 7 extra elements, since the SSE
+ // implementations can read up to 7 elements off the end of the main data.
+ // The extra data is never actually used, but it simplifies the code
+ // if we can do this.
+ DECLARE_ALIGNED(16, uint16_t,
+ src_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1) + 7]);
+ DECLARE_ALIGNED(16, uint16_t,
+ ref_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1) + 7]);
+ DECLARE_ALIGNED(16, uint16_t,
+ second_pred_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1) + 7]);
+ DECLARE_ALIGNED(16, uint8_t,
+ msk_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1) + 7]);
uint8_t *src8_ptr = CONVERT_TO_BYTEPTR(src_ptr);
uint8_t *ref8_ptr = CONVERT_TO_BYTEPTR(ref_ptr);
+ uint8_t *second_pred8_ptr = CONVERT_TO_BYTEPTR(second_pred_ptr);
int err_count = 0;
int first_failure = -1;
int first_failure_x = -1;
@@ -390,27 +229,30 @@ TEST_P(HighbdMaskedSubPixelVarianceTest, OperationCheck) {
int xoffset, yoffset;
for (int i = 0; i < number_of_iterations; ++i) {
+ for (int j = 0; j < (MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1); j++) {
+ src_ptr[j] = rnd.Rand16() & ((1 << bit_depth_) - 1);
+ ref_ptr[j] = rnd.Rand16() & ((1 << bit_depth_) - 1);
+ second_pred_ptr[j] = rnd.Rand16() & ((1 << bit_depth_) - 1);
+ msk_ptr[j] = rnd(65);
+ }
for (xoffset = 0; xoffset < BIL_SUBPEL_SHIFTS; xoffset++) {
for (yoffset = 0; yoffset < BIL_SUBPEL_SHIFTS; yoffset++) {
- for (int j = 0; j < (MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1); j++) {
- src_ptr[j] = rnd.Rand16() & ((1 << bit_depth_) - 1);
- ref_ptr[j] = rnd.Rand16() & ((1 << bit_depth_) - 1);
- msk_ptr[j] = rnd(65);
- }
-
- ref_ret = ref_func_(src8_ptr, src_stride, xoffset, yoffset, ref8_ptr,
- ref_stride, msk_ptr, msk_stride, &ref_sse);
- ASM_REGISTER_STATE_CHECK(opt_ret =
- opt_func_(src8_ptr, src_stride, xoffset,
- yoffset, ref8_ptr, ref_stride,
- msk_ptr, msk_stride, &opt_sse));
-
- if (opt_ret != ref_ret || opt_sse != ref_sse) {
- err_count++;
- if (first_failure == -1) {
- first_failure = i;
- first_failure_x = xoffset;
- first_failure_y = yoffset;
+ for (int invert_mask = 0; invert_mask < 2; ++invert_mask) {
+ ref_ret = ref_func_(src8_ptr, src_stride, xoffset, yoffset, ref8_ptr,
+ ref_stride, second_pred8_ptr, msk_ptr, msk_stride,
+ invert_mask, &ref_sse);
+ ASM_REGISTER_STATE_CHECK(
+ opt_ret = opt_func_(src8_ptr, src_stride, xoffset, yoffset,
+ ref8_ptr, ref_stride, second_pred8_ptr,
+ msk_ptr, msk_stride, invert_mask, &opt_sse));
+
+ if (opt_ret != ref_ret || opt_sse != ref_sse) {
+ err_count++;
+ if (first_failure == -1) {
+ first_failure = i;
+ first_failure_x = xoffset;
+ first_failure_y = yoffset;
+ }
}
}
}
@@ -428,11 +270,17 @@ TEST_P(HighbdMaskedSubPixelVarianceTest, ExtremeValues) {
unsigned int ref_ret, opt_ret;
unsigned int ref_sse, opt_sse;
ACMRandom rnd(ACMRandom::DeterministicSeed());
- DECLARE_ALIGNED(16, uint16_t, src_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1)]);
- DECLARE_ALIGNED(16, uint16_t, ref_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1)]);
- DECLARE_ALIGNED(16, uint8_t, msk_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1)]);
+ DECLARE_ALIGNED(16, uint16_t,
+ src_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1) + 7]);
+ DECLARE_ALIGNED(16, uint16_t,
+ ref_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1) + 7]);
+ DECLARE_ALIGNED(16, uint8_t,
+ msk_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1) + 7]);
+ DECLARE_ALIGNED(16, uint16_t,
+ second_pred_ptr[(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1) + 7]);
uint8_t *src8_ptr = CONVERT_TO_BYTEPTR(src_ptr);
uint8_t *ref8_ptr = CONVERT_TO_BYTEPTR(ref_ptr);
+ uint8_t *second_pred8_ptr = CONVERT_TO_BYTEPTR(second_pred_ptr);
int first_failure_x = -1;
int first_failure_y = -1;
int err_count = 0;
@@ -443,27 +291,32 @@ TEST_P(HighbdMaskedSubPixelVarianceTest, ExtremeValues) {
for (int xoffset = 0; xoffset < BIL_SUBPEL_SHIFTS; xoffset++) {
for (int yoffset = 0; yoffset < BIL_SUBPEL_SHIFTS; yoffset++) {
- for (int i = 0; i < 8; ++i) {
+ for (int i = 0; i < 16; ++i) {
aom_memset16(src_ptr, (i & 0x1) ? ((1 << bit_depth_) - 1) : 0,
(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1));
aom_memset16(ref_ptr, (i & 0x2) ? ((1 << bit_depth_) - 1) : 0,
(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1));
- memset(msk_ptr, (i & 0x4) ? 64 : 0,
+ aom_memset16(second_pred_ptr, (i & 0x4) ? ((1 << bit_depth_) - 1) : 0,
+ (MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1));
+ memset(msk_ptr, (i & 0x8) ? 64 : 0,
(MAX_SB_SIZE + 1) * (MAX_SB_SIZE + 1));
- ref_ret = ref_func_(src8_ptr, src_stride, xoffset, yoffset, ref8_ptr,
- ref_stride, msk_ptr, msk_stride, &ref_sse);
- ASM_REGISTER_STATE_CHECK(opt_ret =
- opt_func_(src8_ptr, src_stride, xoffset,
- yoffset, ref8_ptr, ref_stride,
- msk_ptr, msk_stride, &opt_sse));
-
- if (opt_ret != ref_ret || opt_sse != ref_sse) {
- err_count++;
- if (first_failure == -1) {
- first_failure = i;
- first_failure_x = xoffset;
- first_failure_y = yoffset;
+ for (int invert_mask = 0; invert_mask < 2; ++invert_mask) {
+ ref_ret = ref_func_(src8_ptr, src_stride, xoffset, yoffset, ref8_ptr,
+ ref_stride, second_pred8_ptr, msk_ptr, msk_stride,
+ invert_mask, &ref_sse);
+ ASM_REGISTER_STATE_CHECK(
+ opt_ret = opt_func_(src8_ptr, src_stride, xoffset, yoffset,
+ ref8_ptr, ref_stride, second_pred8_ptr,
+ msk_ptr, msk_stride, invert_mask, &opt_sse));
+
+ if (opt_ret != ref_ret || opt_sse != ref_sse) {
+ err_count++;
+ if (first_failure == -1) {
+ first_failure = i;
+ first_failure_x = xoffset;
+ first_failure_y = yoffset;
+ }
}
}
}
@@ -482,38 +335,6 @@ using std::tr1::make_tuple;
#if HAVE_SSSE3
INSTANTIATE_TEST_CASE_P(
- SSSE3_C_COMPARE, MaskedVarianceTest,
- ::testing::Values(
-#if CONFIG_EXT_PARTITION
- make_tuple(&aom_masked_variance128x128_ssse3,
- &aom_masked_variance128x128_c),
- make_tuple(&aom_masked_variance128x64_ssse3,
- &aom_masked_variance128x64_c),
- make_tuple(&aom_masked_variance64x128_ssse3,
- &aom_masked_variance64x128_c),
-#endif // CONFIG_EXT_PARTITION
- make_tuple(&aom_masked_variance64x64_ssse3,
- &aom_masked_variance64x64_c),
- make_tuple(&aom_masked_variance64x32_ssse3,
- &aom_masked_variance64x32_c),
- make_tuple(&aom_masked_variance32x64_ssse3,
- &aom_masked_variance32x64_c),
- make_tuple(&aom_masked_variance32x32_ssse3,
- &aom_masked_variance32x32_c),
- make_tuple(&aom_masked_variance32x16_ssse3,
- &aom_masked_variance32x16_c),
- make_tuple(&aom_masked_variance16x32_ssse3,
- &aom_masked_variance16x32_c),
- make_tuple(&aom_masked_variance16x16_ssse3,
- &aom_masked_variance16x16_c),
- make_tuple(&aom_masked_variance16x8_ssse3, &aom_masked_variance16x8_c),
- make_tuple(&aom_masked_variance8x16_ssse3, &aom_masked_variance8x16_c),
- make_tuple(&aom_masked_variance8x8_ssse3, &aom_masked_variance8x8_c),
- make_tuple(&aom_masked_variance8x4_ssse3, &aom_masked_variance8x4_c),
- make_tuple(&aom_masked_variance4x8_ssse3, &aom_masked_variance4x8_c),
- make_tuple(&aom_masked_variance4x4_ssse3, &aom_masked_variance4x4_c)));
-
-INSTANTIATE_TEST_CASE_P(
SSSE3_C_COMPARE, MaskedSubPixelVarianceTest,
::testing::Values(
#if CONFIG_EXT_PARTITION
@@ -553,148 +374,43 @@ INSTANTIATE_TEST_CASE_P(
#if CONFIG_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(
- SSSE3_C_COMPARE, HighbdMaskedVarianceTest,
- ::testing::Values(
-#if CONFIG_EXT_PARTITION
- make_tuple(&aom_highbd_masked_variance128x128_ssse3,
- &aom_highbd_masked_variance128x128_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_variance128x64_ssse3,
- &aom_highbd_masked_variance128x64_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_variance64x128_ssse3,
- &aom_highbd_masked_variance64x128_c, AOM_BITS_8),
-#endif // CONFIG_EXT_PARTITION
- make_tuple(&aom_highbd_masked_variance64x64_ssse3,
- &aom_highbd_masked_variance64x64_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_variance64x32_ssse3,
- &aom_highbd_masked_variance64x32_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_variance32x64_ssse3,
- &aom_highbd_masked_variance32x64_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_variance32x32_ssse3,
- &aom_highbd_masked_variance32x32_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_variance32x16_ssse3,
- &aom_highbd_masked_variance32x16_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_variance16x32_ssse3,
- &aom_highbd_masked_variance16x32_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_variance16x16_ssse3,
- &aom_highbd_masked_variance16x16_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_variance16x8_ssse3,
- &aom_highbd_masked_variance16x8_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_variance8x16_ssse3,
- &aom_highbd_masked_variance8x16_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_variance8x8_ssse3,
- &aom_highbd_masked_variance8x8_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_variance8x4_ssse3,
- &aom_highbd_masked_variance8x4_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_variance4x8_ssse3,
- &aom_highbd_masked_variance4x8_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_variance4x4_ssse3,
- &aom_highbd_masked_variance4x4_c, AOM_BITS_8),
-#if CONFIG_EXT_PARTITION
- make_tuple(&aom_highbd_10_masked_variance128x128_ssse3,
- &aom_highbd_10_masked_variance128x128_c, AOM_BITS_10),
- make_tuple(&aom_highbd_10_masked_variance128x64_ssse3,
- &aom_highbd_10_masked_variance128x64_c, AOM_BITS_10),
- make_tuple(&aom_highbd_10_masked_variance64x128_ssse3,
- &aom_highbd_10_masked_variance64x128_c, AOM_BITS_10),
-#endif // CONFIG_EXT_PARTITION
- make_tuple(&aom_highbd_10_masked_variance64x64_ssse3,
- &aom_highbd_10_masked_variance64x64_c, AOM_BITS_10),
- make_tuple(&aom_highbd_10_masked_variance64x32_ssse3,
- &aom_highbd_10_masked_variance64x32_c, AOM_BITS_10),
- make_tuple(&aom_highbd_10_masked_variance32x64_ssse3,
- &aom_highbd_10_masked_variance32x64_c, AOM_BITS_10),
- make_tuple(&aom_highbd_10_masked_variance32x32_ssse3,
- &aom_highbd_10_masked_variance32x32_c, AOM_BITS_10),
- make_tuple(&aom_highbd_10_masked_variance32x16_ssse3,
- &aom_highbd_10_masked_variance32x16_c, AOM_BITS_10),
- make_tuple(&aom_highbd_10_masked_variance16x32_ssse3,
- &aom_highbd_10_masked_variance16x32_c, AOM_BITS_10),
- make_tuple(&aom_highbd_10_masked_variance16x16_ssse3,
- &aom_highbd_10_masked_variance16x16_c, AOM_BITS_10),
- make_tuple(&aom_highbd_10_masked_variance16x8_ssse3,
- &aom_highbd_10_masked_variance16x8_c, AOM_BITS_10),
- make_tuple(&aom_highbd_10_masked_variance8x16_ssse3,
- &aom_highbd_10_masked_variance8x16_c, AOM_BITS_10),
- make_tuple(&aom_highbd_10_masked_variance8x8_ssse3,
- &aom_highbd_10_masked_variance8x8_c, AOM_BITS_10),
- make_tuple(&aom_highbd_10_masked_variance8x4_ssse3,
- &aom_highbd_10_masked_variance8x4_c, AOM_BITS_10),
- make_tuple(&aom_highbd_10_masked_variance4x8_ssse3,
- &aom_highbd_10_masked_variance4x8_c, AOM_BITS_10),
- make_tuple(&aom_highbd_10_masked_variance4x4_ssse3,
- &aom_highbd_10_masked_variance4x4_c, AOM_BITS_10),
-#if CONFIG_EXT_PARTITION
- make_tuple(&aom_highbd_12_masked_variance128x128_ssse3,
- &aom_highbd_12_masked_variance128x128_c, AOM_BITS_12),
- make_tuple(&aom_highbd_12_masked_variance128x64_ssse3,
- &aom_highbd_12_masked_variance128x64_c, AOM_BITS_12),
- make_tuple(&aom_highbd_12_masked_variance64x128_ssse3,
- &aom_highbd_12_masked_variance64x128_c, AOM_BITS_12),
-#endif // CONFIG_EXT_PARTITION
- make_tuple(&aom_highbd_12_masked_variance64x64_ssse3,
- &aom_highbd_12_masked_variance64x64_c, AOM_BITS_12),
- make_tuple(&aom_highbd_12_masked_variance64x32_ssse3,
- &aom_highbd_12_masked_variance64x32_c, AOM_BITS_12),
- make_tuple(&aom_highbd_12_masked_variance32x64_ssse3,
- &aom_highbd_12_masked_variance32x64_c, AOM_BITS_12),
- make_tuple(&aom_highbd_12_masked_variance32x32_ssse3,
- &aom_highbd_12_masked_variance32x32_c, AOM_BITS_12),
- make_tuple(&aom_highbd_12_masked_variance32x16_ssse3,
- &aom_highbd_12_masked_variance32x16_c, AOM_BITS_12),
- make_tuple(&aom_highbd_12_masked_variance16x32_ssse3,
- &aom_highbd_12_masked_variance16x32_c, AOM_BITS_12),
- make_tuple(&aom_highbd_12_masked_variance16x16_ssse3,
- &aom_highbd_12_masked_variance16x16_c, AOM_BITS_12),
- make_tuple(&aom_highbd_12_masked_variance16x8_ssse3,
- &aom_highbd_12_masked_variance16x8_c, AOM_BITS_12),
- make_tuple(&aom_highbd_12_masked_variance8x16_ssse3,
- &aom_highbd_12_masked_variance8x16_c, AOM_BITS_12),
- make_tuple(&aom_highbd_12_masked_variance8x8_ssse3,
- &aom_highbd_12_masked_variance8x8_c, AOM_BITS_12),
- make_tuple(&aom_highbd_12_masked_variance8x4_ssse3,
- &aom_highbd_12_masked_variance8x4_c, AOM_BITS_12),
- make_tuple(&aom_highbd_12_masked_variance4x8_ssse3,
- &aom_highbd_12_masked_variance4x8_c, AOM_BITS_12),
- make_tuple(&aom_highbd_12_masked_variance4x4_ssse3,
- &aom_highbd_12_masked_variance4x4_c, AOM_BITS_12)));
-
-INSTANTIATE_TEST_CASE_P(
SSSE3_C_COMPARE, HighbdMaskedSubPixelVarianceTest,
::testing::Values(
#if CONFIG_EXT_PARTITION
- make_tuple(&aom_highbd_masked_sub_pixel_variance128x128_ssse3,
- &aom_highbd_masked_sub_pixel_variance128x128_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_sub_pixel_variance128x64_ssse3,
- &aom_highbd_masked_sub_pixel_variance128x64_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_sub_pixel_variance64x128_ssse3,
- &aom_highbd_masked_sub_pixel_variance64x128_c, AOM_BITS_8),
+ make_tuple(&aom_highbd_8_masked_sub_pixel_variance128x128_ssse3,
+ &aom_highbd_8_masked_sub_pixel_variance128x128_c,
+ AOM_BITS_8),
+ make_tuple(&aom_highbd_8_masked_sub_pixel_variance128x64_ssse3,
+ &aom_highbd_8_masked_sub_pixel_variance128x64_c, AOM_BITS_8),
+ make_tuple(&aom_highbd_8_masked_sub_pixel_variance64x128_ssse3,
+ &aom_highbd_8_masked_sub_pixel_variance64x128_c, AOM_BITS_8),
#endif // CONFIG_EXT_PARTITION
- make_tuple(&aom_highbd_masked_sub_pixel_variance64x64_ssse3,
- &aom_highbd_masked_sub_pixel_variance64x64_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_sub_pixel_variance64x32_ssse3,
- &aom_highbd_masked_sub_pixel_variance64x32_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_sub_pixel_variance32x64_ssse3,
- &aom_highbd_masked_sub_pixel_variance32x64_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_sub_pixel_variance32x32_ssse3,
- &aom_highbd_masked_sub_pixel_variance32x32_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_sub_pixel_variance32x16_ssse3,
- &aom_highbd_masked_sub_pixel_variance32x16_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_sub_pixel_variance16x32_ssse3,
- &aom_highbd_masked_sub_pixel_variance16x32_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_sub_pixel_variance16x16_ssse3,
- &aom_highbd_masked_sub_pixel_variance16x16_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_sub_pixel_variance16x8_ssse3,
- &aom_highbd_masked_sub_pixel_variance16x8_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_sub_pixel_variance8x16_ssse3,
- &aom_highbd_masked_sub_pixel_variance8x16_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_sub_pixel_variance8x8_ssse3,
- &aom_highbd_masked_sub_pixel_variance8x8_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_sub_pixel_variance8x4_ssse3,
- &aom_highbd_masked_sub_pixel_variance8x4_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_sub_pixel_variance4x8_ssse3,
- &aom_highbd_masked_sub_pixel_variance4x8_c, AOM_BITS_8),
- make_tuple(&aom_highbd_masked_sub_pixel_variance4x4_ssse3,
- &aom_highbd_masked_sub_pixel_variance4x4_c, AOM_BITS_8),
+ make_tuple(&aom_highbd_8_masked_sub_pixel_variance64x64_ssse3,
+ &aom_highbd_8_masked_sub_pixel_variance64x64_c, AOM_BITS_8),
+ make_tuple(&aom_highbd_8_masked_sub_pixel_variance64x32_ssse3,
+ &aom_highbd_8_masked_sub_pixel_variance64x32_c, AOM_BITS_8),
+ make_tuple(&aom_highbd_8_masked_sub_pixel_variance32x64_ssse3,
+ &aom_highbd_8_masked_sub_pixel_variance32x64_c, AOM_BITS_8),
+ make_tuple(&aom_highbd_8_masked_sub_pixel_variance32x32_ssse3,
+ &aom_highbd_8_masked_sub_pixel_variance32x32_c, AOM_BITS_8),
+ make_tuple(&aom_highbd_8_masked_sub_pixel_variance32x16_ssse3,
+ &aom_highbd_8_masked_sub_pixel_variance32x16_c, AOM_BITS_8),
+ make_tuple(&aom_highbd_8_masked_sub_pixel_variance16x32_ssse3,
+ &aom_highbd_8_masked_sub_pixel_variance16x32_c, AOM_BITS_8),
+ make_tuple(&aom_highbd_8_masked_sub_pixel_variance16x16_ssse3,
+ &aom_highbd_8_masked_sub_pixel_variance16x16_c, AOM_BITS_8),
+ make_tuple(&aom_highbd_8_masked_sub_pixel_variance16x8_ssse3,
+ &aom_highbd_8_masked_sub_pixel_variance16x8_c, AOM_BITS_8),
+ make_tuple(&aom_highbd_8_masked_sub_pixel_variance8x16_ssse3,
+ &aom_highbd_8_masked_sub_pixel_variance8x16_c, AOM_BITS_8),
+ make_tuple(&aom_highbd_8_masked_sub_pixel_variance8x8_ssse3,
+ &aom_highbd_8_masked_sub_pixel_variance8x8_c, AOM_BITS_8),
+ make_tuple(&aom_highbd_8_masked_sub_pixel_variance8x4_ssse3,
+ &aom_highbd_8_masked_sub_pixel_variance8x4_c, AOM_BITS_8),
+ make_tuple(&aom_highbd_8_masked_sub_pixel_variance4x8_ssse3,
+ &aom_highbd_8_masked_sub_pixel_variance4x8_c, AOM_BITS_8),
+ make_tuple(&aom_highbd_8_masked_sub_pixel_variance4x4_ssse3,
+ &aom_highbd_8_masked_sub_pixel_variance4x4_c, AOM_BITS_8),
#if CONFIG_EXT_PARTITION
make_tuple(&aom_highbd_10_masked_sub_pixel_variance128x128_ssse3,
&aom_highbd_10_masked_sub_pixel_variance128x128_c,
diff --git a/third_party/aom/test/motion_vector_test.cc b/third_party/aom/test/motion_vector_test.cc
index 403a8f1a7..fa47494e8 100644
--- a/third_party/aom/test/motion_vector_test.cc
+++ b/third_party/aom/test/motion_vector_test.cc
@@ -17,12 +17,6 @@
#include "test/yuv_video_source.h"
namespace {
-#if defined(__has_feature)
-#if __has_feature(address_sanitizer)
-#define BUILDING_WITH_ASAN
-#endif
-#endif
-
#define MAX_EXTREME_MV 1
#define MIN_EXTREME_MV 2
@@ -32,7 +26,7 @@ const libaom_test::TestMode kEncodingModeVectors[] = {
};
// Encoding speeds
-const int kCpuUsedVectors[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
+const int kCpuUsedVectors[] = { 1, 5 };
// MV test modes: 1 - always use maximum MV; 2 - always use minimum MV.
const int kMVTestModes[] = { MAX_EXTREME_MV, MIN_EXTREME_MV };
@@ -85,16 +79,11 @@ TEST_P(MotionVectorTestLarge, OverallTest) {
int width = 3840;
int height = 2160;
-#ifdef BUILDING_WITH_ASAN
- // On the 32-bit system, if using 4k test clip, an "out of memory" error
- // occurs because of the AddressSanitizer instrumentation memory overhead.
- // Here, reduce the test clip's resolution while testing on 32-bit system
- // and AddressSanitizer is enabled.
+ // Reduce the test clip's resolution while testing on 32-bit system.
if (sizeof(void *) == 4) {
width = 2048;
height = 1080;
}
-#endif
cfg_.rc_target_bitrate = 24000;
cfg_.g_profile = 0;
@@ -102,7 +91,7 @@ TEST_P(MotionVectorTestLarge, OverallTest) {
testing::internal::scoped_ptr<libaom_test::VideoSource> video;
video.reset(new libaom_test::YUVVideoSource(
- "niklas_640_480_30.yuv", AOM_IMG_FMT_I420, width, height, 30, 1, 0, 5));
+ "niklas_640_480_30.yuv", AOM_IMG_FMT_I420, width, height, 30, 1, 0, 3));
ASSERT_TRUE(video.get() != NULL);
ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
diff --git a/third_party/aom/test/partial_idct_test.cc b/third_party/aom/test/partial_idct_test.cc
index 0899b60c3..033f18294 100644
--- a/third_party/aom/test/partial_idct_test.cc
+++ b/third_party/aom/test/partial_idct_test.cc
@@ -52,7 +52,7 @@ typedef std::tr1::tuple<FwdTxfmFunc, InvTxfmWithBdFunc, InvTxfmWithBdFunc,
TX_SIZE, int, int, int>
PartialInvTxfmParam;
const int kMaxNumCoeffs = 1024;
-const int kCountTestBlock = 1000;
+const int kCountTestBlock = 10000;
class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> {
public:
@@ -231,8 +231,8 @@ TEST_P(PartialIDctTest, AddOutputBlock) {
}
TEST_P(PartialIDctTest, SingleExtremeCoeff) {
- const int16_t max_coeff = std::numeric_limits<int16_t>::max();
- const int16_t min_coeff = std::numeric_limits<int16_t>::min();
+ const int16_t max_coeff = INT16_MAX;
+ const int16_t min_coeff = INT16_MIN;
for (int i = 0; i < last_nonzero_; ++i) {
memset(input_block_, 0, sizeof(*input_block_) * input_block_size_);
// Run once for min and once for max.
@@ -418,6 +418,30 @@ INSTANTIATE_TEST_CASE_P(SSSE3, PartialIDctTest,
::testing::ValuesIn(ssse3_partial_idct_tests));
#endif // HAVE_SSSE3
+#if HAVE_AVX2
+const PartialInvTxfmParam avx2_partial_idct_tests[] = {
+ make_tuple(&aom_fdct16x16_c, &wrapper<aom_idct16x16_256_add_c>,
+ &wrapper<aom_idct16x16_256_add_avx2>, TX_16X16, 256, 8, 1),
+ make_tuple(&aom_fdct16x16_c, &wrapper<aom_idct16x16_256_add_c>,
+ &wrapper<aom_idct16x16_38_add_avx2>, TX_16X16, 38, 8, 1),
+ make_tuple(&aom_fdct16x16_c, &wrapper<aom_idct16x16_256_add_c>,
+ &wrapper<aom_idct16x16_10_add_avx2>, TX_16X16, 10, 8, 1),
+ make_tuple(&aom_fdct16x16_c, &wrapper<aom_idct16x16_256_add_c>,
+ &wrapper<aom_idct16x16_1_add_avx2>, TX_16X16, 1, 8, 1),
+ make_tuple(&aom_fdct32x32_c, &wrapper<aom_idct32x32_1024_add_c>,
+ &wrapper<aom_idct32x32_1024_add_avx2>, TX_32X32, 1024, 8, 1),
+ make_tuple(&aom_fdct32x32_c, &wrapper<aom_idct32x32_1024_add_c>,
+ &wrapper<aom_idct32x32_135_add_avx2>, TX_32X32, 135, 8, 1),
+ make_tuple(&aom_fdct32x32_c, &wrapper<aom_idct32x32_1024_add_c>,
+ &wrapper<aom_idct32x32_34_add_avx2>, TX_32X32, 34, 8, 1),
+ make_tuple(&aom_fdct32x32_c, &wrapper<aom_idct32x32_1024_add_c>,
+ &wrapper<aom_idct32x32_1_add_avx2>, TX_32X32, 1, 8, 1),
+};
+
+INSTANTIATE_TEST_CASE_P(AVX2, PartialIDctTest,
+ ::testing::ValuesIn(avx2_partial_idct_tests));
+#endif // HAVE_AVX2
+
#if HAVE_DSPR2 && !CONFIG_HIGHBITDEPTH
const PartialInvTxfmParam dspr2_partial_idct_tests[] = {
make_tuple(&aom_fdct32x32_c, &wrapper<aom_idct32x32_1024_add_c>,
diff --git a/third_party/aom/test/quantize_func_test.cc b/third_party/aom/test/quantize_func_test.cc
new file mode 100644
index 000000000..32b1d5139
--- /dev/null
+++ b/third_party/aom/test/quantize_func_test.cc
@@ -0,0 +1,236 @@
+/*
+ * 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.
+ */
+
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
+
+#include "./aom_config.h"
+#include "./av1_rtcd.h"
+#include "aom/aom_codec.h"
+#include "av1/encoder/encoder.h"
+#include "av1/encoder/av1_quantize.h"
+#include "test/acm_random.h"
+#include "test/clear_system_state.h"
+#include "test/register_state_check.h"
+#include "test/util.h"
+
+namespace {
+using libaom_test::ACMRandom;
+
+#if !CONFIG_AOM_QM
+typedef void (*QuantizeFunc)(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);
+#else
+typedef void (*QuantizeFunc)(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);
+#endif
+
+typedef std::tr1::tuple<QuantizeFunc, QuantizeFunc, TX_SIZE, aom_bit_depth_t>
+ QuantizeParam;
+
+typedef struct {
+ QUANTS quant;
+ Dequants dequant;
+} QuanTable;
+
+const int kTestNum = 1000;
+
+class QuantizeTest : public ::testing::TestWithParam<QuantizeParam> {
+ protected:
+ QuantizeTest()
+ : quant_ref_(GET_PARAM(0)), quant_(GET_PARAM(1)), tx_size_(GET_PARAM(2)),
+ bd_(GET_PARAM(3)) {}
+
+ virtual ~QuantizeTest() {}
+
+ virtual void SetUp() {
+ qtab_ = reinterpret_cast<QuanTable *>(aom_memalign(16, sizeof(*qtab_)));
+ const int n_coeffs = getCoeffNum();
+ coeff_ = reinterpret_cast<tran_low_t *>(
+ aom_memalign(16, 6 * n_coeffs * sizeof(tran_low_t)));
+ InitQuantizer();
+ }
+
+ virtual void TearDown() {
+ aom_free(qtab_);
+ qtab_ = NULL;
+ aom_free(coeff_);
+ coeff_ = NULL;
+ libaom_test::ClearSystemState();
+ }
+
+ void InitQuantizer() {
+ av1_build_quantizer(bd_, 0, 0, 0, &qtab_->quant, &qtab_->dequant);
+ }
+
+ void QuantizeRun(bool isLoop, int q = 0, int testNum = 1) {
+ tran_low_t *coeff_ptr = coeff_;
+ const intptr_t n_coeffs = getCoeffNum();
+ const int skip_block = 0;
+
+ tran_low_t *qcoeff_ref = coeff_ptr + n_coeffs;
+ tran_low_t *dqcoeff_ref = qcoeff_ref + n_coeffs;
+
+ tran_low_t *qcoeff = dqcoeff_ref + n_coeffs;
+ tran_low_t *dqcoeff = qcoeff + n_coeffs;
+ uint16_t *eob = (uint16_t *)(dqcoeff + n_coeffs);
+
+ // Testing uses 2-D DCT scan order table
+ const SCAN_ORDER *const sc = get_default_scan(tx_size_, DCT_DCT, 0);
+
+ // Testing uses luminance quantization table
+ const int16_t *zbin = qtab_->quant.y_zbin[q];
+ const int16_t *round_fp = qtab_->quant.y_round_fp[q];
+ const int16_t *quant_fp = qtab_->quant.y_quant_fp[q];
+ const int16_t *quant_shift = qtab_->quant.y_quant_shift[q];
+ const int16_t *dequant = qtab_->dequant.y_dequant[q];
+ const size_t bufferSize = n_coeffs;
+
+ int i = 0;
+ while (i < testNum) {
+ if (isLoop) FillCoeffRandom();
+
+ memset(qcoeff_ref, 0, 5 * n_coeffs * sizeof(*qcoeff_ref));
+
+ quant_ref_(coeff_ptr, n_coeffs, skip_block, zbin, round_fp, quant_fp,
+ quant_shift, qcoeff_ref, dqcoeff_ref, dequant, &eob[0],
+ sc->scan, sc->iscan);
+
+ ASM_REGISTER_STATE_CHECK(quant_(
+ coeff_ptr, n_coeffs, skip_block, zbin, round_fp, quant_fp,
+ quant_shift, qcoeff, dqcoeff, dequant, &eob[1], sc->scan, sc->iscan));
+
+ CompareResults(qcoeff_ref, qcoeff, bufferSize, "Qcoeff", q, i);
+ CompareResults(dqcoeff_ref, dqcoeff, bufferSize, "Dqcoeff", q, i);
+ ASSERT_EQ(eob[0], eob[1]) << "eobs mismatch on test: " << i;
+
+ i++;
+ }
+ }
+
+ void CompareResults(const tran_low_t *buf_ref, const tran_low_t *buf,
+ int size, const char *text, int q, int number) {
+ int i;
+ for (i = 0; i < size; ++i) {
+ ASSERT_EQ(buf_ref[i], buf[i]) << text << " mismatch on test: " << number
+ << " at position: " << i << " Q: " << q;
+ }
+ }
+
+ int getCoeffNum() { return tx_size_2d[tx_size_]; }
+
+ void FillCoeffGeneric(bool isConstant, tran_low_t c = 0) {
+ const int n_coeffs = getCoeffNum();
+ int i;
+ if (isConstant) {
+ for (i = 0; i < n_coeffs; ++i) {
+ coeff_[i] = c;
+ }
+ } else {
+ FillCoeffZero();
+ int num = rnd_.Rand16() % n_coeffs;
+ for (i = 0; i < num; ++i) {
+ coeff_[i] = GetRandomCoeff();
+ }
+ }
+ }
+
+ void FillCoeffZero() { FillCoeffGeneric(true); }
+
+ void FillCoeffConstant() {
+ tran_low_t c = GetRandomCoeff();
+ FillCoeffGeneric(true, c);
+ }
+
+ void FillDcOnly() {
+ FillCoeffZero();
+ coeff_[0] = GetRandomCoeff();
+ }
+
+ void FillDcLargeNegative() {
+ FillCoeffZero();
+ // Generate a qcoeff which contains 512/-512 (0x0100/0xFE00) to catch issues
+ // like BUG=883 where the constant being compared was incorrectly
+ // initialized.
+ coeff_[0] = -8191;
+ }
+
+ void FillCoeffRandom() { FillCoeffGeneric(false); }
+
+ tran_low_t GetRandomCoeff() {
+ return clamp((int16_t)rnd_.Rand16(), INT16_MIN + 1, INT16_MAX);
+ }
+
+ ACMRandom rnd_;
+ QuanTable *qtab_;
+ tran_low_t *coeff_;
+ QuantizeFunc quant_ref_;
+ QuantizeFunc quant_;
+ TX_SIZE tx_size_;
+ aom_bit_depth_t bd_;
+};
+
+TEST_P(QuantizeTest, ZeroInput) {
+ FillCoeffZero();
+ QuantizeRun(false);
+}
+
+TEST_P(QuantizeTest, LargeNegativeInput) {
+ FillDcLargeNegative();
+ QuantizeRun(false);
+}
+
+TEST_P(QuantizeTest, DcOnlyInput) {
+ FillDcOnly();
+ QuantizeRun(false);
+}
+
+TEST_P(QuantizeTest, RandomInput) { QuantizeRun(true, 0, kTestNum); }
+
+TEST_P(QuantizeTest, MultipleQ) {
+ for (int q = 0; q < QINDEX_RANGE; ++q) {
+ QuantizeRun(true, q, kTestNum);
+ }
+}
+
+using std::tr1::make_tuple;
+
+#if HAVE_SSE2
+const QuantizeParam kQParamArraySSE2[] = { make_tuple(
+ &av1_quantize_fp_c, &av1_quantize_fp_sse2, TX_16X16, AOM_BITS_8) };
+
+INSTANTIATE_TEST_CASE_P(SSE2, QuantizeTest,
+ ::testing::ValuesIn(kQParamArraySSE2));
+#endif
+
+#if !CONFIG_HIGHBITDEPTH && HAVE_SSSE3 && ARCH_X86_64
+const QuantizeParam kQParamArraySSSE3[] = {
+ make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_ssse3, TX_16X16, AOM_BITS_8),
+ // TODO(any):
+ // The following test couldn't pass yet
+ // make_tuple(av1_quantize_fp_c, av1_quantize_fp_32x32_ssse3, TX_32X32,
+ // AOM_BITS_8)
+};
+INSTANTIATE_TEST_CASE_P(SSSE3, QuantizeTest,
+ ::testing::ValuesIn(kQParamArraySSSE3));
+#endif
+
+} // namespace
diff --git a/third_party/aom/test/sad_test.cc b/third_party/aom/test/sad_test.cc
index c3b5dac42..7564a6760 100644
--- a/third_party/aom/test/sad_test.cc
+++ b/third_party/aom/test/sad_test.cc
@@ -740,13 +740,6 @@ INSTANTIATE_TEST_CASE_P(C, SADx4Test, ::testing::ValuesIn(x4d_c_tests));
//------------------------------------------------------------------------------
// ARM functions
-#if HAVE_MEDIA
-const SadMxNParam media_tests[] = {
- make_tuple(16, 16, &aom_sad16x16_media, -1),
-};
-INSTANTIATE_TEST_CASE_P(MEDIA, SADTest, ::testing::ValuesIn(media_tests));
-#endif // HAVE_MEDIA
-
#if HAVE_NEON
const SadMxNParam neon_tests[] = {
make_tuple(64, 64, &aom_sad64x64_neon, -1),
diff --git a/third_party/aom/test/simd_avx2_test.cc b/third_party/aom/test/simd_avx2_test.cc
new file mode 100644
index 000000000..d54d201b9
--- /dev/null
+++ b/third_party/aom/test/simd_avx2_test.cc
@@ -0,0 +1,15 @@
+/*
+ * 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.
+ */
+
+#define ARCH AVX2
+#define ARCH_POSTFIX(name) name##_avx2
+#define SIMD_NAMESPACE simd_test_avx2
+#include "./simd_impl.h"
diff --git a/third_party/aom/test/simd_cmp_avx2.cc b/third_party/aom/test/simd_cmp_avx2.cc
new file mode 100644
index 000000000..47ae11c62
--- /dev/null
+++ b/third_party/aom/test/simd_cmp_avx2.cc
@@ -0,0 +1,15 @@
+/*
+ * 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.
+ */
+
+#define ARCH AVX2
+#define ARCH_POSTFIX(name) name##_avx2
+#define SIMD_NAMESPACE simd_test_avx2
+#include "./simd_cmp_impl.h"
diff --git a/third_party/aom/test/simd_cmp_impl.h b/third_party/aom/test/simd_cmp_impl.h
index 28bd64a5b..4a9c1f7be 100644
--- a/third_party/aom/test/simd_cmp_impl.h
+++ b/third_party/aom/test/simd_cmp_impl.h
@@ -16,7 +16,7 @@
#include "aom_dsp/aom_simd.h"
#undef SIMD_INLINE
#define SIMD_INLINE static // Don't enforce inlining
-#include "aom_dsp/simd/v128_intrinsics_c.h"
+#include "aom_dsp/simd/v256_intrinsics_c.h"
// Machine tuned code goes into this file. This file is included from
// simd_cmp_sse2.cc, simd_cmp_ssse3.cc etc which define the macros
@@ -224,6 +224,104 @@ c_v128 c_imm_v128_align(c_v128 a, c_v128 b) {
return c_v128_align(a, b, shift);
}
+template <int shift>
+v256 imm_v256_shl_n_byte(v256 a) {
+ return v256_shl_n_byte(a, shift);
+}
+template <int shift>
+v256 imm_v256_shr_n_byte(v256 a) {
+ return v256_shr_n_byte(a, shift);
+}
+template <int shift>
+v256 imm_v256_shl_n_8(v256 a) {
+ return v256_shl_n_8(a, shift);
+}
+template <int shift>
+v256 imm_v256_shr_n_u8(v256 a) {
+ return v256_shr_n_u8(a, shift);
+}
+template <int shift>
+v256 imm_v256_shr_n_s8(v256 a) {
+ return v256_shr_n_s8(a, shift);
+}
+template <int shift>
+v256 imm_v256_shl_n_16(v256 a) {
+ return v256_shl_n_16(a, shift);
+}
+template <int shift>
+v256 imm_v256_shr_n_u16(v256 a) {
+ return v256_shr_n_u16(a, shift);
+}
+template <int shift>
+v256 imm_v256_shr_n_s16(v256 a) {
+ return v256_shr_n_s16(a, shift);
+}
+template <int shift>
+v256 imm_v256_shl_n_32(v256 a) {
+ return v256_shl_n_32(a, shift);
+}
+template <int shift>
+v256 imm_v256_shr_n_u32(v256 a) {
+ return v256_shr_n_u32(a, shift);
+}
+template <int shift>
+v256 imm_v256_shr_n_s32(v256 a) {
+ return v256_shr_n_s32(a, shift);
+}
+template <int shift>
+v256 imm_v256_align(v256 a, v256 b) {
+ return v256_align(a, b, shift);
+}
+
+template <int shift>
+c_v256 c_imm_v256_shl_n_byte(c_v256 a) {
+ return c_v256_shl_n_byte(a, shift);
+}
+template <int shift>
+c_v256 c_imm_v256_shr_n_byte(c_v256 a) {
+ return c_v256_shr_n_byte(a, shift);
+}
+template <int shift>
+c_v256 c_imm_v256_shl_n_8(c_v256 a) {
+ return c_v256_shl_n_8(a, shift);
+}
+template <int shift>
+c_v256 c_imm_v256_shr_n_u8(c_v256 a) {
+ return c_v256_shr_n_u8(a, shift);
+}
+template <int shift>
+c_v256 c_imm_v256_shr_n_s8(c_v256 a) {
+ return c_v256_shr_n_s8(a, shift);
+}
+template <int shift>
+c_v256 c_imm_v256_shl_n_16(c_v256 a) {
+ return c_v256_shl_n_16(a, shift);
+}
+template <int shift>
+c_v256 c_imm_v256_shr_n_u16(c_v256 a) {
+ return c_v256_shr_n_u16(a, shift);
+}
+template <int shift>
+c_v256 c_imm_v256_shr_n_s16(c_v256 a) {
+ return c_v256_shr_n_s16(a, shift);
+}
+template <int shift>
+c_v256 c_imm_v256_shl_n_32(c_v256 a) {
+ return c_v256_shl_n_32(a, shift);
+}
+template <int shift>
+c_v256 c_imm_v256_shr_n_u32(c_v256 a) {
+ return c_v256_shr_n_u32(a, shift);
+}
+template <int shift>
+c_v256 c_imm_v256_shr_n_s32(c_v256 a) {
+ return c_v256_shr_n_s32(a, shift);
+}
+template <int shift>
+c_v256 c_imm_v256_align(c_v256 a, c_v256 b) {
+ return c_v256_align(a, b, shift);
+}
+
// Wrappers around the the SAD and SSD functions
uint32_t v64_sad_u8(v64 a, v64 b) {
return v64_sad_u8_sum(::v64_sad_u8(v64_sad_u8_init(), a, b));
@@ -250,6 +348,18 @@ uint32_t c_v128_sad_u8(c_v128 a, c_v128 b) {
uint32_t c_v128_ssd_u8(c_v128 a, c_v128 b) {
return c_v128_ssd_u8_sum(::c_v128_ssd_u8(c_v128_ssd_u8_init(), a, b));
}
+uint32_t v256_sad_u8(v256 a, v256 b) {
+ return v256_sad_u8_sum(::v256_sad_u8(v256_sad_u8_init(), a, b));
+}
+uint32_t v256_ssd_u8(v256 a, v256 b) {
+ return v256_ssd_u8_sum(::v256_ssd_u8(v256_ssd_u8_init(), a, b));
+}
+uint32_t c_v256_sad_u8(c_v256 a, c_v256 b) {
+ return c_v256_sad_u8_sum(::c_v256_sad_u8(c_v256_sad_u8_init(), a, b));
+}
+uint32_t c_v256_ssd_u8(c_v256 a, c_v256 b) {
+ return c_v256_ssd_u8_sum(::c_v256_ssd_u8(c_v256_ssd_u8_init(), a, b));
+}
namespace {
@@ -657,6 +767,265 @@ const mapping m[] = { MAP(v64_sad_u8),
MAP(v64_store_unaligned),
MAP(v128_load_unaligned),
MAP(v128_store_unaligned),
+ MAP(v256_sad_u8),
+ MAP(v256_ssd_u8),
+ MAP(v256_hadd_u8),
+ MAP(v256_dotp_s16),
+ MAP(v256_add_8),
+ MAP(v256_add_16),
+ MAP(v256_sadd_s16),
+ MAP(v256_add_32),
+ MAP(v256_sub_8),
+ MAP(v256_ssub_u8),
+ MAP(v256_ssub_s8),
+ MAP(v256_sub_16),
+ MAP(v256_ssub_u16),
+ MAP(v256_ssub_s16),
+ MAP(v256_sub_32),
+ MAP(v256_ziplo_8),
+ MAP(v256_ziphi_8),
+ MAP(v256_ziplo_16),
+ MAP(v256_ziphi_16),
+ MAP(v256_ziplo_32),
+ MAP(v256_ziphi_32),
+ MAP(v256_ziplo_64),
+ MAP(v256_ziphi_64),
+ MAP(v256_unziphi_8),
+ MAP(v256_unziplo_8),
+ MAP(v256_unziphi_16),
+ MAP(v256_unziplo_16),
+ MAP(v256_unziphi_32),
+ MAP(v256_unziplo_32),
+ MAP(v256_pack_s32_s16),
+ MAP(v256_pack_s16_u8),
+ MAP(v256_pack_s16_s8),
+ MAP(v256_or),
+ MAP(v256_xor),
+ MAP(v256_and),
+ MAP(v256_andn),
+ MAP(v256_mullo_s16),
+ MAP(v256_mulhi_s16),
+ MAP(v256_mullo_s32),
+ MAP(v256_madd_s16),
+ MAP(v256_madd_us8),
+ MAP(v256_avg_u8),
+ MAP(v256_rdavg_u8),
+ MAP(v256_avg_u16),
+ MAP(v256_min_u8),
+ MAP(v256_max_u8),
+ MAP(v256_min_s8),
+ MAP(v256_max_s8),
+ MAP(v256_min_s16),
+ MAP(v256_max_s16),
+ MAP(v256_cmpgt_s8),
+ MAP(v256_cmplt_s8),
+ MAP(v256_cmpeq_8),
+ MAP(v256_cmpgt_s16),
+ MAP(v256_cmplt_s16),
+ MAP(v256_cmpeq_16),
+ MAP(v256_shuffle_8),
+ MAP(v256_pshuffle_8),
+ MAP(imm_v256_align<1>),
+ MAP(imm_v256_align<2>),
+ MAP(imm_v256_align<3>),
+ MAP(imm_v256_align<4>),
+ MAP(imm_v256_align<5>),
+ MAP(imm_v256_align<6>),
+ MAP(imm_v256_align<7>),
+ MAP(imm_v256_align<8>),
+ MAP(imm_v256_align<9>),
+ MAP(imm_v256_align<10>),
+ MAP(imm_v256_align<11>),
+ MAP(imm_v256_align<12>),
+ MAP(imm_v256_align<13>),
+ MAP(imm_v256_align<14>),
+ MAP(imm_v256_align<15>),
+ MAP(imm_v256_align<16>),
+ MAP(imm_v256_align<17>),
+ MAP(imm_v256_align<18>),
+ MAP(imm_v256_align<19>),
+ MAP(imm_v256_align<20>),
+ MAP(imm_v256_align<21>),
+ MAP(imm_v256_align<22>),
+ MAP(imm_v256_align<23>),
+ MAP(imm_v256_align<24>),
+ MAP(imm_v256_align<25>),
+ MAP(imm_v256_align<26>),
+ MAP(imm_v256_align<27>),
+ MAP(imm_v256_align<28>),
+ MAP(imm_v256_align<29>),
+ MAP(imm_v256_align<30>),
+ MAP(imm_v256_align<31>),
+ MAP(v256_from_v128),
+ MAP(v256_zip_8),
+ MAP(v256_zip_16),
+ MAP(v256_zip_32),
+ MAP(v256_mul_s16),
+ MAP(v256_unpack_u8_s16),
+ MAP(v256_unpack_s8_s16),
+ MAP(v256_unpack_u16_s32),
+ MAP(v256_unpack_s16_s32),
+ MAP(v256_shl_8),
+ MAP(v256_shr_u8),
+ MAP(v256_shr_s8),
+ MAP(v256_shl_16),
+ MAP(v256_shr_u16),
+ MAP(v256_shr_s16),
+ MAP(v256_shl_32),
+ MAP(v256_shr_u32),
+ MAP(v256_shr_s32),
+ MAP(v256_abs_s8),
+ MAP(v256_abs_s16),
+ MAP(v256_padd_s16),
+ MAP(v256_unpacklo_u16_s32),
+ MAP(v256_unpacklo_s16_s32),
+ MAP(v256_unpackhi_u16_s32),
+ MAP(v256_unpackhi_s16_s32),
+ MAP(imm_v256_shr_n_byte<1>),
+ MAP(imm_v256_shr_n_byte<2>),
+ MAP(imm_v256_shr_n_byte<3>),
+ MAP(imm_v256_shr_n_byte<4>),
+ MAP(imm_v256_shr_n_byte<5>),
+ MAP(imm_v256_shr_n_byte<6>),
+ MAP(imm_v256_shr_n_byte<7>),
+ MAP(imm_v256_shr_n_byte<8>),
+ MAP(imm_v256_shr_n_byte<9>),
+ MAP(imm_v256_shr_n_byte<10>),
+ MAP(imm_v256_shr_n_byte<11>),
+ MAP(imm_v256_shr_n_byte<12>),
+ MAP(imm_v256_shr_n_byte<13>),
+ MAP(imm_v256_shr_n_byte<14>),
+ MAP(imm_v256_shr_n_byte<15>),
+ MAP(imm_v256_shr_n_byte<16>),
+ MAP(imm_v256_shr_n_byte<17>),
+ MAP(imm_v256_shr_n_byte<18>),
+ MAP(imm_v256_shr_n_byte<19>),
+ MAP(imm_v256_shr_n_byte<20>),
+ MAP(imm_v256_shr_n_byte<21>),
+ MAP(imm_v256_shr_n_byte<22>),
+ MAP(imm_v256_shr_n_byte<23>),
+ MAP(imm_v256_shr_n_byte<24>),
+ MAP(imm_v256_shr_n_byte<25>),
+ MAP(imm_v256_shr_n_byte<26>),
+ MAP(imm_v256_shr_n_byte<27>),
+ MAP(imm_v256_shr_n_byte<28>),
+ MAP(imm_v256_shr_n_byte<29>),
+ MAP(imm_v256_shr_n_byte<30>),
+ MAP(imm_v256_shr_n_byte<31>),
+ MAP(imm_v256_shl_n_byte<1>),
+ MAP(imm_v256_shl_n_byte<2>),
+ MAP(imm_v256_shl_n_byte<3>),
+ MAP(imm_v256_shl_n_byte<4>),
+ MAP(imm_v256_shl_n_byte<5>),
+ MAP(imm_v256_shl_n_byte<6>),
+ MAP(imm_v256_shl_n_byte<7>),
+ MAP(imm_v256_shl_n_byte<8>),
+ MAP(imm_v256_shl_n_byte<9>),
+ MAP(imm_v256_shl_n_byte<10>),
+ MAP(imm_v256_shl_n_byte<11>),
+ MAP(imm_v256_shl_n_byte<12>),
+ MAP(imm_v256_shl_n_byte<13>),
+ MAP(imm_v256_shl_n_byte<14>),
+ MAP(imm_v256_shl_n_byte<15>),
+ MAP(imm_v256_shl_n_byte<16>),
+ MAP(imm_v256_shl_n_byte<17>),
+ MAP(imm_v256_shl_n_byte<18>),
+ MAP(imm_v256_shl_n_byte<19>),
+ MAP(imm_v256_shl_n_byte<20>),
+ MAP(imm_v256_shl_n_byte<21>),
+ MAP(imm_v256_shl_n_byte<22>),
+ MAP(imm_v256_shl_n_byte<23>),
+ MAP(imm_v256_shl_n_byte<24>),
+ MAP(imm_v256_shl_n_byte<25>),
+ MAP(imm_v256_shl_n_byte<26>),
+ MAP(imm_v256_shl_n_byte<27>),
+ MAP(imm_v256_shl_n_byte<28>),
+ MAP(imm_v256_shl_n_byte<29>),
+ MAP(imm_v256_shl_n_byte<30>),
+ MAP(imm_v256_shl_n_byte<31>),
+ MAP(imm_v256_shl_n_8<1>),
+ MAP(imm_v256_shl_n_8<2>),
+ MAP(imm_v256_shl_n_8<3>),
+ MAP(imm_v256_shl_n_8<4>),
+ MAP(imm_v256_shl_n_8<5>),
+ MAP(imm_v256_shl_n_8<6>),
+ MAP(imm_v256_shl_n_8<7>),
+ MAP(imm_v256_shr_n_u8<1>),
+ MAP(imm_v256_shr_n_u8<2>),
+ MAP(imm_v256_shr_n_u8<3>),
+ MAP(imm_v256_shr_n_u8<4>),
+ MAP(imm_v256_shr_n_u8<5>),
+ MAP(imm_v256_shr_n_u8<6>),
+ MAP(imm_v256_shr_n_u8<7>),
+ MAP(imm_v256_shr_n_s8<1>),
+ MAP(imm_v256_shr_n_s8<2>),
+ MAP(imm_v256_shr_n_s8<3>),
+ MAP(imm_v256_shr_n_s8<4>),
+ MAP(imm_v256_shr_n_s8<5>),
+ MAP(imm_v256_shr_n_s8<6>),
+ MAP(imm_v256_shr_n_s8<7>),
+ MAP(imm_v256_shl_n_16<1>),
+ MAP(imm_v256_shl_n_16<2>),
+ MAP(imm_v256_shl_n_16<4>),
+ MAP(imm_v256_shl_n_16<6>),
+ MAP(imm_v256_shl_n_16<8>),
+ MAP(imm_v256_shl_n_16<10>),
+ MAP(imm_v256_shl_n_16<12>),
+ MAP(imm_v256_shl_n_16<14>),
+ MAP(imm_v256_shr_n_u16<1>),
+ MAP(imm_v256_shr_n_u16<2>),
+ MAP(imm_v256_shr_n_u16<4>),
+ MAP(imm_v256_shr_n_u16<6>),
+ MAP(imm_v256_shr_n_u16<8>),
+ MAP(imm_v256_shr_n_u16<10>),
+ MAP(imm_v256_shr_n_u16<12>),
+ MAP(imm_v256_shr_n_u16<14>),
+ MAP(imm_v256_shr_n_s16<1>),
+ MAP(imm_v256_shr_n_s16<2>),
+ MAP(imm_v256_shr_n_s16<4>),
+ MAP(imm_v256_shr_n_s16<6>),
+ MAP(imm_v256_shr_n_s16<8>),
+ MAP(imm_v256_shr_n_s16<10>),
+ MAP(imm_v256_shr_n_s16<12>),
+ MAP(imm_v256_shr_n_s16<14>),
+ MAP(imm_v256_shl_n_32<1>),
+ MAP(imm_v256_shl_n_32<4>),
+ MAP(imm_v256_shl_n_32<8>),
+ MAP(imm_v256_shl_n_32<12>),
+ MAP(imm_v256_shl_n_32<16>),
+ MAP(imm_v256_shl_n_32<20>),
+ MAP(imm_v256_shl_n_32<24>),
+ MAP(imm_v256_shl_n_32<28>),
+ MAP(imm_v256_shr_n_u32<1>),
+ MAP(imm_v256_shr_n_u32<4>),
+ MAP(imm_v256_shr_n_u32<8>),
+ MAP(imm_v256_shr_n_u32<12>),
+ MAP(imm_v256_shr_n_u32<16>),
+ MAP(imm_v256_shr_n_u32<20>),
+ MAP(imm_v256_shr_n_u32<24>),
+ MAP(imm_v256_shr_n_u32<28>),
+ MAP(imm_v256_shr_n_s32<1>),
+ MAP(imm_v256_shr_n_s32<4>),
+ MAP(imm_v256_shr_n_s32<8>),
+ MAP(imm_v256_shr_n_s32<12>),
+ MAP(imm_v256_shr_n_s32<16>),
+ MAP(imm_v256_shr_n_s32<20>),
+ MAP(imm_v256_shr_n_s32<24>),
+ MAP(imm_v256_shr_n_s32<28>),
+ MAP(v256_zero),
+ MAP(v256_dup_8),
+ MAP(v256_dup_16),
+ MAP(v256_dup_32),
+ MAP(v256_low_u32),
+ MAP(v256_low_v64),
+ MAP(v256_from_64),
+ MAP(v256_from_v64),
+ MAP(v256_ziplo_128),
+ MAP(v256_ziphi_128),
+ MAP(v256_unpacklo_u8_s16),
+ MAP(v256_unpackhi_u8_s16),
+ MAP(v256_unpacklo_s8_s16),
+ MAP(v256_unpackhi_s8_s16),
{ NULL, NULL, NULL } };
#undef MAP
@@ -922,6 +1291,14 @@ void TestSimd1Arg(uint32_t iterations, uint32_t mask, uint32_t maskwidth,
reinterpret_cast<fptr>(v128_load_aligned), simd, d,
reinterpret_cast<fptr>(c_u64_store_aligned),
reinterpret_cast<fptr>(c_v128_load_aligned), ref_simd, ref_d, s);
+ } else if (typeid(CRet) == typeid(uint64_t) &&
+ typeid(CArg) == typeid(c_v256)) {
+ // U64_V256
+ error = CompareSimd1Arg<uint64_t, v256, CRet, CArg>(
+ reinterpret_cast<fptr>(u64_store_aligned),
+ reinterpret_cast<fptr>(v256_load_aligned), simd, d,
+ reinterpret_cast<fptr>(c_u64_store_aligned),
+ reinterpret_cast<fptr>(c_v256_load_aligned), ref_simd, ref_d, s);
} else if (typeid(CRet) == typeid(c_v64) &&
typeid(CArg) == typeid(c_v128)) {
// V64_V128
@@ -970,6 +1347,62 @@ void TestSimd1Arg(uint32_t iterations, uint32_t mask, uint32_t maskwidth,
reinterpret_cast<fptr>(u32_load_aligned), simd, d,
reinterpret_cast<fptr>(c_v128_store_aligned),
reinterpret_cast<fptr>(c_u32_load_aligned), ref_simd, ref_d, s);
+ } else if (typeid(CRet) == typeid(c_v256) &&
+ typeid(CArg) == typeid(c_v256)) {
+ // V256_V256
+ error = CompareSimd1Arg<v256, v256, CRet, CArg>(
+ reinterpret_cast<fptr>(v256_store_aligned),
+ reinterpret_cast<fptr>(v256_load_aligned), simd, d,
+ reinterpret_cast<fptr>(c_v256_store_aligned),
+ reinterpret_cast<fptr>(c_v256_load_aligned), ref_simd, ref_d, s);
+ } else if (typeid(CRet) == typeid(c_v256) &&
+ typeid(CArg) == typeid(c_v128)) {
+ // V256_V128
+ error = CompareSimd1Arg<v256, v128, CRet, CArg>(
+ reinterpret_cast<fptr>(v256_store_aligned),
+ reinterpret_cast<fptr>(v128_load_aligned), simd, d,
+ reinterpret_cast<fptr>(c_v256_store_aligned),
+ reinterpret_cast<fptr>(c_v128_load_aligned), ref_simd, ref_d, s);
+ } else if (typeid(CRet) == typeid(c_v256) &&
+ typeid(CArg) == typeid(uint8_t)) {
+ // V256_U8
+ error = CompareSimd1Arg<v256, uint8_t, CRet, CArg>(
+ reinterpret_cast<fptr>(v256_store_aligned),
+ reinterpret_cast<fptr>(u8_load_aligned), simd, d,
+ reinterpret_cast<fptr>(c_v256_store_aligned),
+ reinterpret_cast<fptr>(c_u8_load_aligned), ref_simd, ref_d, s);
+ } else if (typeid(CRet) == typeid(c_v256) &&
+ typeid(CArg) == typeid(uint16_t)) {
+ // V256_U16
+ error = CompareSimd1Arg<v256, uint16_t, CRet, CArg>(
+ reinterpret_cast<fptr>(v256_store_aligned),
+ reinterpret_cast<fptr>(u16_load_aligned), simd, d,
+ reinterpret_cast<fptr>(c_v256_store_aligned),
+ reinterpret_cast<fptr>(c_u16_load_aligned), ref_simd, ref_d, s);
+ } else if (typeid(CRet) == typeid(c_v256) &&
+ typeid(CArg) == typeid(uint32_t)) {
+ // V256_U32
+ error = CompareSimd1Arg<v256, uint32_t, CRet, CArg>(
+ reinterpret_cast<fptr>(v256_store_aligned),
+ reinterpret_cast<fptr>(u32_load_aligned), simd, d,
+ reinterpret_cast<fptr>(c_v256_store_aligned),
+ reinterpret_cast<fptr>(c_u32_load_aligned), ref_simd, ref_d, s);
+ } else if (typeid(CRet) == typeid(uint32_t) &&
+ typeid(CArg) == typeid(c_v256)) {
+ // U32_V256
+ error = CompareSimd1Arg<uint32_t, v256, CRet, CArg>(
+ reinterpret_cast<fptr>(u32_store_aligned),
+ reinterpret_cast<fptr>(v256_load_aligned), simd, d,
+ reinterpret_cast<fptr>(c_u32_store_aligned),
+ reinterpret_cast<fptr>(c_v256_load_aligned), ref_simd, ref_d, s);
+ } else if (typeid(CRet) == typeid(c_v64) &&
+ typeid(CArg) == typeid(c_v256)) {
+ // V64_V256
+ error = CompareSimd1Arg<v64, v256, CRet, CArg>(
+ reinterpret_cast<fptr>(v64_store_aligned),
+ reinterpret_cast<fptr>(v256_load_aligned), simd, d,
+ reinterpret_cast<fptr>(c_v64_store_aligned),
+ reinterpret_cast<fptr>(c_v256_load_aligned), ref_simd, ref_d, s);
} else {
FAIL() << "Internal error: Unknown intrinsic function "
<< typeid(CRet).name() << " " << name << "(" << typeid(CArg).name()
@@ -1140,6 +1573,67 @@ void TestSimd2Args(uint32_t iterations, uint32_t mask, uint32_t maskwidth,
reinterpret_cast<fptr>(c_v128_load_aligned),
reinterpret_cast<fptr>(c_u32_load_aligned),
reinterpret_cast<fptr>(ref_simd), ref_d, s1, s2);
+ } else if (typeid(CRet) == typeid(c_v256) &&
+ typeid(CArg1) == typeid(c_v256) &&
+ typeid(CArg2) == typeid(c_v256)) {
+ // V256_V256V256
+ error = CompareSimd2Args<v256, v256, v256, CRet, CArg1, CArg2>(
+ reinterpret_cast<fptr>(v256_store_aligned),
+ reinterpret_cast<fptr>(v256_load_aligned),
+ reinterpret_cast<fptr>(v256_load_aligned), simd, d,
+ reinterpret_cast<fptr>(c_v256_store_aligned),
+ reinterpret_cast<fptr>(c_v256_load_aligned),
+ reinterpret_cast<fptr>(c_v256_load_aligned),
+ reinterpret_cast<fptr>(ref_simd), ref_d, s1, s2);
+ } else if (typeid(CRet) == typeid(int64_t) &&
+ typeid(CArg1) == typeid(c_v256) &&
+ typeid(CArg2) == typeid(c_v256)) {
+ // S64_V256V256
+ error = CompareSimd2Args<int64_t, v256, v256, CRet, CArg1, CArg2>(
+ reinterpret_cast<fptr>(u64_store_aligned),
+ reinterpret_cast<fptr>(v256_load_aligned),
+ reinterpret_cast<fptr>(v256_load_aligned), simd, d,
+ reinterpret_cast<fptr>(c_u64_store_aligned),
+ reinterpret_cast<fptr>(c_v256_load_aligned),
+ reinterpret_cast<fptr>(c_v256_load_aligned),
+ reinterpret_cast<fptr>(ref_simd), ref_d, s1, s2);
+ } else if (typeid(CRet) == typeid(uint32_t) &&
+ typeid(CArg1) == typeid(c_v256) &&
+ typeid(CArg2) == typeid(c_v256)) {
+ // U32_V256V256
+ error = CompareSimd2Args<uint32_t, v256, v256, CRet, CArg1, CArg2>(
+ reinterpret_cast<fptr>(u32_store_aligned),
+ reinterpret_cast<fptr>(v256_load_aligned),
+ reinterpret_cast<fptr>(v256_load_aligned), simd, d,
+ reinterpret_cast<fptr>(c_u32_store_aligned),
+ reinterpret_cast<fptr>(c_v256_load_aligned),
+ reinterpret_cast<fptr>(c_v256_load_aligned),
+ reinterpret_cast<fptr>(ref_simd), ref_d, s1, s2);
+ } else if (typeid(CRet) == typeid(c_v256) &&
+ typeid(CArg1) == typeid(c_v128) &&
+ typeid(CArg2) == typeid(c_v128)) {
+ // V256_V128V128
+ error = CompareSimd2Args<v256, v128, v128, CRet, CArg1, CArg2>(
+ reinterpret_cast<fptr>(v256_store_aligned),
+ reinterpret_cast<fptr>(v128_load_aligned),
+ reinterpret_cast<fptr>(v128_load_aligned), simd, d,
+ reinterpret_cast<fptr>(c_v256_store_aligned),
+ reinterpret_cast<fptr>(c_v128_load_aligned),
+ reinterpret_cast<fptr>(c_v128_load_aligned),
+ reinterpret_cast<fptr>(ref_simd), ref_d, s1, s2);
+ } else if (typeid(CRet) == typeid(c_v256) &&
+ typeid(CArg1) == typeid(c_v256) &&
+ typeid(CArg2) == typeid(uint32_t)) {
+ // V256_V256U32
+ error = CompareSimd2Args<v256, v256, uint32_t, CRet, CArg1, CArg2>(
+ reinterpret_cast<fptr>(v256_store_aligned),
+ reinterpret_cast<fptr>(v256_load_aligned),
+ reinterpret_cast<fptr>(u32_load_aligned), simd, d,
+ reinterpret_cast<fptr>(c_v256_store_aligned),
+ reinterpret_cast<fptr>(c_v256_load_aligned),
+ reinterpret_cast<fptr>(c_u32_load_aligned),
+ reinterpret_cast<fptr>(ref_simd), ref_d, s1, s2);
+
} else {
FAIL() << "Internal error: Unknown intrinsic function "
<< typeid(CRet).name() << " " << name << "("
@@ -1208,5 +1702,31 @@ template void TestSimd2Args<int64_t, c_v128, c_v128>(uint32_t, uint32_t,
uint32_t, const char *);
template void TestSimd2Args<uint32_t, c_v128, c_v128>(uint32_t, uint32_t,
uint32_t, const char *);
+template void TestSimd1Arg<c_v256, c_v128>(uint32_t, uint32_t, uint32_t,
+ const char *);
+template void TestSimd1Arg<c_v256, c_v256>(uint32_t, uint32_t, uint32_t,
+ const char *);
+template void TestSimd1Arg<uint64_t, c_v256>(uint32_t, uint32_t, uint32_t,
+ const char *);
+template void TestSimd1Arg<c_v256, uint8_t>(uint32_t, uint32_t, uint32_t,
+ const char *);
+template void TestSimd1Arg<c_v256, uint16_t>(uint32_t, uint32_t, uint32_t,
+ const char *);
+template void TestSimd1Arg<c_v256, uint32_t>(uint32_t, uint32_t, uint32_t,
+ const char *);
+template void TestSimd1Arg<uint32_t, c_v256>(uint32_t, uint32_t, uint32_t,
+ const char *);
+template void TestSimd1Arg<c_v64, c_v256>(uint32_t, uint32_t, uint32_t,
+ const char *);
+template void TestSimd2Args<c_v256, c_v128, c_v128>(uint32_t, uint32_t,
+ uint32_t, const char *);
+template void TestSimd2Args<c_v256, c_v256, c_v256>(uint32_t, uint32_t,
+ uint32_t, const char *);
+template void TestSimd2Args<c_v256, c_v256, uint32_t>(uint32_t, uint32_t,
+ uint32_t, const char *);
+template void TestSimd2Args<int64_t, c_v256, c_v256>(uint32_t, uint32_t,
+ uint32_t, const char *);
+template void TestSimd2Args<uint32_t, c_v256, c_v256>(uint32_t, uint32_t,
+ uint32_t, const char *);
} // namespace SIMD_NAMESPACE
diff --git a/third_party/aom/test/simd_impl.h b/third_party/aom/test/simd_impl.h
index 5cfda675d..c3dfbc400 100644
--- a/third_party/aom/test/simd_impl.h
+++ b/third_party/aom/test/simd_impl.h
@@ -14,7 +14,7 @@
#include "test/clear_system_state.h"
#include "test/register_state_check.h"
#include "aom_dsp/aom_simd_inline.h"
-#include "aom_dsp/simd/v128_intrinsics_c.h"
+#include "aom_dsp/simd/v256_intrinsics_c.h"
namespace SIMD_NAMESPACE {
@@ -67,6 +67,19 @@ TYPEDEF_SIMD(V128_V128V128);
TYPEDEF_SIMD(S64_V128V128);
TYPEDEF_SIMD(V128_V128U32);
TYPEDEF_SIMD(U32_V128V128);
+TYPEDEF_SIMD(V256_V128);
+TYPEDEF_SIMD(V256_V256);
+TYPEDEF_SIMD(U64_V256);
+TYPEDEF_SIMD(V256_V128V128);
+TYPEDEF_SIMD(V256_V256V256);
+TYPEDEF_SIMD(S64_V256V256);
+TYPEDEF_SIMD(V256_V256U32);
+TYPEDEF_SIMD(U32_V256V256);
+TYPEDEF_SIMD(V256_U8);
+TYPEDEF_SIMD(V256_U16);
+TYPEDEF_SIMD(V256_U32);
+TYPEDEF_SIMD(U32_V256);
+TYPEDEF_SIMD(V64_V256);
// Google Test allows up to 50 tests per case, so split the largest
typedef ARCH_POSTFIX(V64_V64) ARCH_POSTFIX(V64_V64_Part2);
@@ -74,6 +87,9 @@ typedef ARCH_POSTFIX(V64_V64V64) ARCH_POSTFIX(V64_V64V64_Part2);
typedef ARCH_POSTFIX(V128_V128) ARCH_POSTFIX(V128_V128_Part2);
typedef ARCH_POSTFIX(V128_V128) ARCH_POSTFIX(V128_V128_Part3);
typedef ARCH_POSTFIX(V128_V128V128) ARCH_POSTFIX(V128_V128V128_Part2);
+typedef ARCH_POSTFIX(V256_V256) ARCH_POSTFIX(V256_V256_Part2);
+typedef ARCH_POSTFIX(V256_V256) ARCH_POSTFIX(V256_V256_Part3);
+typedef ARCH_POSTFIX(V256_V256V256) ARCH_POSTFIX(V256_V256V256_Part2);
// These functions are machine tuned located elsewhere
template <typename c_ret, typename c_arg>
@@ -219,6 +235,70 @@ MY_TEST_P(ARCH_POSTFIX(V128_V128_Part3), TestIntrinsics) {
TestSimd1Arg<c_v128, c_v128>(kIterations, mask, maskwidth, name);
}
+MY_TEST_P(ARCH_POSTFIX(U64_V256), TestIntrinsics) {
+ TestSimd1Arg<uint64_t, c_v256>(kIterations, mask, maskwidth, name);
+}
+
+MY_TEST_P(ARCH_POSTFIX(V256_V256), TestIntrinsics) {
+ TestSimd1Arg<c_v256, c_v256>(kIterations, mask, maskwidth, name);
+}
+
+MY_TEST_P(ARCH_POSTFIX(V256_V128), TestIntrinsics) {
+ TestSimd1Arg<c_v256, c_v128>(kIterations, mask, maskwidth, name);
+}
+
+MY_TEST_P(ARCH_POSTFIX(V256_V256V256), TestIntrinsics) {
+ TestSimd2Args<c_v256, c_v256, c_v256>(kIterations, mask, maskwidth, name);
+}
+
+MY_TEST_P(ARCH_POSTFIX(V256_V128V128), TestIntrinsics) {
+ TestSimd2Args<c_v256, c_v128, c_v128>(kIterations, mask, maskwidth, name);
+}
+
+MY_TEST_P(ARCH_POSTFIX(U32_V256V256), TestIntrinsics) {
+ TestSimd2Args<uint32_t, c_v256, c_v256>(kIterations, mask, maskwidth, name);
+}
+
+MY_TEST_P(ARCH_POSTFIX(S64_V256V256), TestIntrinsics) {
+ TestSimd2Args<int64_t, c_v256, c_v256>(kIterations, mask, maskwidth, name);
+}
+
+MY_TEST_P(ARCH_POSTFIX(V256_V256V256_Part2), TestIntrinsics) {
+ TestSimd2Args<c_v256, c_v256, c_v256>(kIterations, mask, maskwidth, name);
+}
+
+MY_TEST_P(ARCH_POSTFIX(V256_V256U32), TestIntrinsics) {
+ TestSimd2Args<c_v256, c_v256, uint32_t>(kIterations, mask, maskwidth, name);
+}
+
+MY_TEST_P(ARCH_POSTFIX(V256_V256_Part2), TestIntrinsics) {
+ TestSimd1Arg<c_v256, c_v256>(kIterations, mask, maskwidth, name);
+}
+
+MY_TEST_P(ARCH_POSTFIX(V256_V256_Part3), TestIntrinsics) {
+ TestSimd1Arg<c_v256, c_v256>(kIterations, mask, maskwidth, name);
+}
+
+MY_TEST_P(ARCH_POSTFIX(V256_U8), TestIntrinsics) {
+ TestSimd1Arg<c_v256, uint8_t>(kIterations, mask, maskwidth, name);
+}
+
+MY_TEST_P(ARCH_POSTFIX(V256_U16), TestIntrinsics) {
+ TestSimd1Arg<c_v256, uint16_t>(kIterations, mask, maskwidth, name);
+}
+
+MY_TEST_P(ARCH_POSTFIX(V256_U32), TestIntrinsics) {
+ TestSimd1Arg<c_v256, uint32_t>(kIterations, mask, maskwidth, name);
+}
+
+MY_TEST_P(ARCH_POSTFIX(U32_V256), TestIntrinsics) {
+ TestSimd1Arg<uint32_t, c_v256>(kIterations, mask, maskwidth, name);
+}
+
+MY_TEST_P(ARCH_POSTFIX(V64_V256), TestIntrinsics) {
+ TestSimd1Arg<c_v64, c_v256>(kIterations, mask, maskwidth, name);
+}
+
// Add a macro layer since INSTANTIATE_TEST_CASE_P will quote the name
// so we need to expand it first with the prefix
#define INSTANTIATE(name, type, ...) \
@@ -591,4 +671,252 @@ INSTANTIATE(ARCH, ARCH_POSTFIX(V128_U32), SIMD_TUPLE(v128_dup_32, 0U, 0U));
INSTANTIATE(ARCH, ARCH_POSTFIX(S64_V128V128),
SIMD_TUPLE(v128_dotp_s16, 0U, 0U));
+INSTANTIATE(ARCH, ARCH_POSTFIX(U32_V256V256), SIMD_TUPLE(v256_sad_u8, 0U, 0U),
+ SIMD_TUPLE(v256_ssd_u8, 0U, 0U));
+
+INSTANTIATE(ARCH, ARCH_POSTFIX(U64_V256), SIMD_TUPLE(v256_hadd_u8, 0U, 0U));
+
+INSTANTIATE(ARCH, ARCH_POSTFIX(S64_V256V256),
+ SIMD_TUPLE(v256_dotp_s16, 0U, 0U));
+
+INSTANTIATE(
+ ARCH, ARCH_POSTFIX(V256_V256V256), SIMD_TUPLE(v256_add_8, 0U, 0U),
+ SIMD_TUPLE(v256_add_16, 0U, 0U), SIMD_TUPLE(v256_sadd_s16, 0U, 0U),
+ SIMD_TUPLE(v256_add_32, 0U, 0U), SIMD_TUPLE(v256_sub_8, 0U, 0U),
+ SIMD_TUPLE(v256_ssub_u8, 0U, 0U), SIMD_TUPLE(v256_ssub_s8, 0U, 0U),
+ SIMD_TUPLE(v256_sub_16, 0U, 0U), SIMD_TUPLE(v256_ssub_s16, 0U, 0U),
+ SIMD_TUPLE(v256_ssub_u16, 0U, 0U), SIMD_TUPLE(v256_sub_32, 0U, 0U),
+ SIMD_TUPLE(v256_ziplo_8, 0U, 0U), SIMD_TUPLE(v256_ziphi_8, 0U, 0U),
+ SIMD_TUPLE(v256_ziplo_16, 0U, 0U), SIMD_TUPLE(v256_ziphi_16, 0U, 0U),
+ SIMD_TUPLE(v256_ziplo_32, 0U, 0U), SIMD_TUPLE(v256_ziphi_32, 0U, 0U),
+ SIMD_TUPLE(v256_ziplo_64, 0U, 0U), SIMD_TUPLE(v256_ziphi_64, 0U, 0U),
+ SIMD_TUPLE(v256_ziplo_128, 0U, 0U), SIMD_TUPLE(v256_ziphi_128, 0U, 0U),
+ SIMD_TUPLE(v256_unziphi_8, 0U, 0U), SIMD_TUPLE(v256_unziplo_8, 0U, 0U),
+ SIMD_TUPLE(v256_unziphi_16, 0U, 0U), SIMD_TUPLE(v256_unziplo_16, 0U, 0U),
+ SIMD_TUPLE(v256_unziphi_32, 0U, 0U), SIMD_TUPLE(v256_unziplo_32, 0U, 0U),
+ SIMD_TUPLE(v256_pack_s32_s16, 0U, 0U), SIMD_TUPLE(v256_pack_s16_u8, 0U, 0U),
+ SIMD_TUPLE(v256_pack_s16_s8, 0U, 0U), SIMD_TUPLE(v256_or, 0U, 0U),
+ SIMD_TUPLE(v256_xor, 0U, 0U), SIMD_TUPLE(v256_and, 0U, 0U),
+ SIMD_TUPLE(v256_andn, 0U, 0U), SIMD_TUPLE(v256_mullo_s16, 0U, 0U),
+ SIMD_TUPLE(v256_mulhi_s16, 0U, 0U), SIMD_TUPLE(v256_mullo_s32, 0U, 0U),
+ SIMD_TUPLE(v256_madd_s16, 0U, 0U), SIMD_TUPLE(v256_madd_us8, 0U, 0U),
+ SIMD_TUPLE(v256_avg_u8, 0U, 0U), SIMD_TUPLE(v256_rdavg_u8, 0U, 0U),
+ SIMD_TUPLE(v256_avg_u16, 0U, 0U), SIMD_TUPLE(v256_min_u8, 0U, 0U),
+ SIMD_TUPLE(v256_max_u8, 0U, 0U), SIMD_TUPLE(v256_min_s8, 0U, 0U),
+ SIMD_TUPLE(v256_max_s8, 0U, 0U), SIMD_TUPLE(v256_min_s16, 0U, 0U),
+ SIMD_TUPLE(v256_max_s16, 0U, 0U), SIMD_TUPLE(v256_cmpgt_s8, 0U, 0U),
+ SIMD_TUPLE(v256_cmplt_s8, 0U, 0U));
+
+INSTANTIATE(
+ ARCH, ARCH_POSTFIX(V256_V256V256_Part2), SIMD_TUPLE(v256_cmpeq_8, 0U, 0U),
+ SIMD_TUPLE(v256_cmpgt_s16, 0U, 0U), SIMD_TUPLE(v256_cmplt_s16, 0U, 0U),
+ SIMD_TUPLE(v256_cmpeq_16, 0U, 0U), SIMD_TUPLE(v256_shuffle_8, 15U, 8U),
+ SIMD_TUPLE(v256_pshuffle_8, 15U, 8U), SIMD_TUPLE(imm_v256_align<1>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<2>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<3>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<4>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<5>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<6>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<7>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<8>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<9>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<10>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<11>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<12>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<13>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<14>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<15>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<16>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<17>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<18>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<19>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<20>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<21>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<22>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<23>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<24>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<25>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<26>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<27>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<28>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<29>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<30>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_align<31>, 0U, 0U));
+
+INSTANTIATE(ARCH, ARCH_POSTFIX(V256_V128V128),
+ SIMD_TUPLE(v256_from_v128, 0U, 0U), SIMD_TUPLE(v256_zip_8, 0U, 0U),
+ SIMD_TUPLE(v256_zip_16, 0U, 0U), SIMD_TUPLE(v256_zip_32, 0U, 0U),
+ SIMD_TUPLE(v256_mul_s16, 0U, 0U));
+
+INSTANTIATE(ARCH, ARCH_POSTFIX(V256_V128),
+ SIMD_TUPLE(v256_unpack_u8_s16, 0U, 0U),
+ SIMD_TUPLE(v256_unpack_s8_s16, 0U, 0U),
+ SIMD_TUPLE(v256_unpack_u16_s32, 0U, 0U),
+ SIMD_TUPLE(v256_unpack_s16_s32, 0U, 0U));
+
+INSTANTIATE(ARCH, ARCH_POSTFIX(V256_V256U32), SIMD_TUPLE(v256_shl_8, 7U, 32U),
+ SIMD_TUPLE(v256_shr_u8, 7U, 32U), SIMD_TUPLE(v256_shr_s8, 7U, 32U),
+ SIMD_TUPLE(v256_shl_16, 15U, 32U),
+ SIMD_TUPLE(v256_shr_u16, 15U, 32U),
+ SIMD_TUPLE(v256_shr_s16, 15U, 32U),
+ SIMD_TUPLE(v256_shl_32, 31U, 32U),
+ SIMD_TUPLE(v256_shr_u32, 31U, 32U),
+ SIMD_TUPLE(v256_shr_s32, 31U, 32U));
+
+INSTANTIATE(ARCH, ARCH_POSTFIX(V256_V256), SIMD_TUPLE(v256_abs_s8, 0U, 0U),
+ SIMD_TUPLE(v256_abs_s16, 0U, 0U), SIMD_TUPLE(v256_padd_s16, 0U, 0U),
+ SIMD_TUPLE(v256_unpacklo_u8_s16, 0U, 0U),
+ SIMD_TUPLE(v256_unpacklo_s8_s16, 0U, 0U),
+ SIMD_TUPLE(v256_unpacklo_u16_s32, 0U, 0U),
+ SIMD_TUPLE(v256_unpacklo_s16_s32, 0U, 0U),
+ SIMD_TUPLE(v256_unpackhi_u8_s16, 0U, 0U),
+ SIMD_TUPLE(v256_unpackhi_s8_s16, 0U, 0U),
+ SIMD_TUPLE(v256_unpackhi_u16_s32, 0U, 0U),
+ SIMD_TUPLE(v256_unpackhi_s16_s32, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<1>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<2>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<3>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<4>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<5>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<6>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<7>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<8>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<9>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<10>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<11>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<12>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<13>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<14>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<15>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<16>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<17>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<18>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<19>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<20>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<21>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<22>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<23>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<24>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<25>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<26>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<27>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<28>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<29>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<30>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_byte<31>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<1>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<2>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<3>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<4>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<5>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<6>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<7>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<8>, 0U, 0U));
+
+INSTANTIATE(ARCH, ARCH_POSTFIX(V256_V256_Part2),
+ SIMD_TUPLE(imm_v256_shl_n_byte<9>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<10>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<11>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<12>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<13>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<14>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<15>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<16>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<17>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<18>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<19>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<20>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<21>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<22>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<23>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<24>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<25>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<26>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<27>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<28>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<29>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<30>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_byte<31>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_8<1>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_8<2>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_8<3>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_8<4>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_8<5>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_8<6>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_8<7>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u8<1>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u8<2>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u8<3>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u8<4>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u8<5>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u8<6>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u8<7>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s8<1>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s8<2>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s8<3>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s8<4>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s8<5>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s8<6>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s8<7>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_16<1>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_16<2>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_16<4>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_16<6>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_16<8>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_16<10>, 0U, 0U));
+
+INSTANTIATE(ARCH, ARCH_POSTFIX(V256_V256_Part3),
+ SIMD_TUPLE(imm_v256_shl_n_16<12>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_16<14>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u16<1>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u16<2>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u16<4>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u16<6>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u16<8>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u16<10>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u16<12>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u16<14>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s16<1>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s16<2>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s16<4>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s16<6>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s16<8>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s16<10>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s16<12>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s16<14>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_32<1>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_32<4>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_32<8>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_32<12>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_32<16>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_32<20>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_32<24>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shl_n_32<28>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u32<1>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u32<4>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u32<8>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u32<12>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u32<16>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u32<20>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u32<24>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_u32<28>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s32<1>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s32<4>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s32<8>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s32<12>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s32<16>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s32<20>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s32<24>, 0U, 0U),
+ SIMD_TUPLE(imm_v256_shr_n_s32<28>, 0U, 0U));
+
+INSTANTIATE(ARCH, ARCH_POSTFIX(V256_U8), SIMD_TUPLE(v256_dup_8, 0U, 0U));
+
+INSTANTIATE(ARCH, ARCH_POSTFIX(V256_U16), SIMD_TUPLE(v256_dup_16, 0U, 0U));
+
+INSTANTIATE(ARCH, ARCH_POSTFIX(V256_U32), SIMD_TUPLE(v256_dup_32, 0U, 0U));
+
+INSTANTIATE(ARCH, ARCH_POSTFIX(U32_V256), SIMD_TUPLE(v256_low_u32, 0U, 0U));
+
+INSTANTIATE(ARCH, ARCH_POSTFIX(V64_V256), SIMD_TUPLE(v256_low_v64, 0U, 0U));
+
} // namespace SIMD_NAMESPACE
diff --git a/third_party/aom/test/superframe_test.cc b/third_party/aom/test/superframe_test.cc
index 0f54baeaf..a28d35d5f 100644
--- a/third_party/aom/test/superframe_test.cc
+++ b/third_party/aom/test/superframe_test.cc
@@ -119,23 +119,12 @@ TEST_P(SuperframeTest, TestSuperframeIndexIsOptional) {
// to the decoder starting at the end of the buffer.
#if CONFIG_EXT_TILE
// Single tile does not work with ANS (see comment above).
-#if CONFIG_ANS || CONFIG_DAALA_EC
const int tile_col_values[] = { 1, 2 };
-#else
-const int tile_col_values[] = { 1, 2, 32 };
-#endif
const int tile_row_values[] = { 1, 2, 32 };
AV1_INSTANTIATE_TEST_CASE(
SuperframeTest,
::testing::Combine(::testing::Values(::libaom_test::kTwoPassGood),
::testing::ValuesIn(tile_col_values),
::testing::ValuesIn(tile_row_values)));
-#else
-#if !CONFIG_ANS && !CONFIG_DAALA_EC
-AV1_INSTANTIATE_TEST_CASE(
- SuperframeTest,
- ::testing::Combine(::testing::Values(::libaom_test::kTwoPassGood),
- ::testing::Values(0), ::testing::Values(0)));
-#endif // !CONFIG_ANS
#endif // CONFIG_EXT_TILE
} // namespace
diff --git a/third_party/aom/test/test-data.mk b/third_party/aom/test/test-data.mk
index 168144a00..083b34953 100644
--- a/third_party/aom/test/test-data.mk
+++ b/third_party/aom/test/test-data.mk
@@ -1,22 +1,22 @@
LIBAOM_TEST_SRCS-yes += test-data.mk
# Encoder test source
-LIBAOM_TEST_DATA-$(CONFIG_ENCODERS) += hantro_collage_w352h288.yuv
-LIBAOM_TEST_DATA-$(CONFIG_ENCODERS) += hantro_odd.yuv
+LIBAOM_TEST_DATA-$(CONFIG_AV1_ENCODER) += hantro_collage_w352h288.yuv
+LIBAOM_TEST_DATA-$(CONFIG_AV1_ENCODER) += hantro_odd.yuv
-LIBAOM_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_10_420.y4m
-LIBAOM_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_10_422.y4m
-LIBAOM_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_10_444.y4m
-LIBAOM_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_10_440.yuv
-LIBAOM_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_12_420.y4m
-LIBAOM_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_12_422.y4m
-LIBAOM_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_12_444.y4m
-LIBAOM_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_12_440.yuv
-LIBAOM_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_8_420_a10-1.y4m
-LIBAOM_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_8_420.y4m
-LIBAOM_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_8_422.y4m
-LIBAOM_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_8_444.y4m
-LIBAOM_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_8_440.yuv
+LIBAOM_TEST_DATA-$(CONFIG_AV1_ENCODER) += park_joy_90p_10_420.y4m
+LIBAOM_TEST_DATA-$(CONFIG_AV1_ENCODER) += park_joy_90p_10_422.y4m
+LIBAOM_TEST_DATA-$(CONFIG_AV1_ENCODER) += park_joy_90p_10_444.y4m
+LIBAOM_TEST_DATA-$(CONFIG_AV1_ENCODER) += park_joy_90p_10_440.yuv
+LIBAOM_TEST_DATA-$(CONFIG_AV1_ENCODER) += park_joy_90p_12_420.y4m
+LIBAOM_TEST_DATA-$(CONFIG_AV1_ENCODER) += park_joy_90p_12_422.y4m
+LIBAOM_TEST_DATA-$(CONFIG_AV1_ENCODER) += park_joy_90p_12_444.y4m
+LIBAOM_TEST_DATA-$(CONFIG_AV1_ENCODER) += park_joy_90p_12_440.yuv
+LIBAOM_TEST_DATA-$(CONFIG_AV1_ENCODER) += park_joy_90p_8_420_a10-1.y4m
+LIBAOM_TEST_DATA-$(CONFIG_AV1_ENCODER) += park_joy_90p_8_420.y4m
+LIBAOM_TEST_DATA-$(CONFIG_AV1_ENCODER) += park_joy_90p_8_422.y4m
+LIBAOM_TEST_DATA-$(CONFIG_AV1_ENCODER) += park_joy_90p_8_444.y4m
+LIBAOM_TEST_DATA-$(CONFIG_AV1_ENCODER) += park_joy_90p_8_440.yuv
LIBAOM_TEST_DATA-$(CONFIG_AV1_ENCODER) += desktop_credits.y4m
LIBAOM_TEST_DATA-$(CONFIG_AV1_ENCODER) += niklas_1280_720_30.y4m
diff --git a/third_party/aom/test/test.cmake b/third_party/aom/test/test.cmake
index 8d3ab7059..d72a784ad 100644
--- a/third_party/aom/test/test.cmake
+++ b/third_party/aom/test/test.cmake
@@ -8,8 +8,15 @@
## Media Patent License 1.0 was not distributed with this source code in the
## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
##
+if (NOT AOM_TEST_TEST_CMAKE_)
+set(AOM_TEST_TEST_CMAKE_ 1)
+
+include(ProcessorCount)
+
include("${AOM_ROOT}/test/test_data_util.cmake")
+set(AOM_UNIT_TEST_DATA_LIST_FILE "${AOM_ROOT}/test/test-data.sha1")
+
set(AOM_UNIT_TEST_WRAPPER_SOURCES
"${AOM_CONFIG_DIR}/usage_exit.c"
"${AOM_ROOT}/test/test_libaom.cc")
@@ -19,6 +26,8 @@ set(AOM_UNIT_TEST_COMMON_SOURCES
"${AOM_ROOT}/test/clear_system_state.h"
"${AOM_ROOT}/test/codec_factory.h"
"${AOM_ROOT}/test/convolve_test.cc"
+ "${AOM_ROOT}/test/decode_test_driver.cc"
+ "${AOM_ROOT}/test/decode_test_driver.h"
"${AOM_ROOT}/test/function_equivalence_test.h"
"${AOM_ROOT}/test/md5_helper.h"
"${AOM_ROOT}/test/register_state_check.h"
@@ -50,8 +59,6 @@ endif ()
set(AOM_UNIT_TEST_DECODER_SOURCES
"${AOM_ROOT}/test/decode_api_test.cc"
- "${AOM_ROOT}/test/decode_test_driver.cc"
- "${AOM_ROOT}/test/decode_test_driver.h"
"${AOM_ROOT}/test/ivf_video_source.h")
set(AOM_UNIT_TEST_ENCODER_SOURCES
@@ -83,10 +90,6 @@ if (CONFIG_AV1)
${AOM_UNIT_TEST_COMMON_SOURCES}
"${AOM_ROOT}/test/av1_convolve_optimz_test.cc"
"${AOM_ROOT}/test/av1_convolve_test.cc"
- "${AOM_ROOT}/test/av1_fwd_txfm1d_test.cc"
- "${AOM_ROOT}/test/av1_fwd_txfm2d_test.cc"
- "${AOM_ROOT}/test/av1_inv_txfm1d_test.cc"
- "${AOM_ROOT}/test/av1_inv_txfm2d_test.cc"
"${AOM_ROOT}/test/av1_txfm_test.cc"
"${AOM_ROOT}/test/av1_txfm_test.h"
"${AOM_ROOT}/test/intrapred_test.cc"
@@ -103,9 +106,7 @@ if (CONFIG_AV1)
if (HAVE_SSE4_1)
set(AOM_UNIT_TEST_COMMON_SOURCES
${AOM_UNIT_TEST_COMMON_SOURCES}
- # TODO: not sure if this intrinsics or a wrapper calling intrin/asm.
- #"${AOM_ROOT}/test/filterintra_predictors_test.cc")
- )
+ "${AOM_ROOT}/test/filterintra_predictors_test.cc")
endif ()
endif ()
@@ -131,8 +132,13 @@ if (CONFIG_AV1_ENCODER)
"${AOM_ROOT}/test/arf_freq_test.cc"
"${AOM_ROOT}/test/av1_dct_test.cc"
"${AOM_ROOT}/test/av1_fht16x16_test.cc"
+ "${AOM_ROOT}/test/av1_fht32x32_test.cc"
"${AOM_ROOT}/test/av1_fht8x8_test.cc"
"${AOM_ROOT}/test/av1_inv_txfm_test.cc"
+ "${AOM_ROOT}/test/av1_fwd_txfm1d_test.cc"
+ "${AOM_ROOT}/test/av1_fwd_txfm2d_test.cc"
+ "${AOM_ROOT}/test/av1_inv_txfm1d_test.cc"
+ "${AOM_ROOT}/test/av1_inv_txfm2d_test.cc"
"${AOM_ROOT}/test/avg_test.cc"
"${AOM_ROOT}/test/blend_a64_mask_1d_test.cc"
"${AOM_ROOT}/test/blend_a64_mask_test.cc"
@@ -167,8 +173,14 @@ if (CONFIG_AV1_ENCODER)
"${AOM_ROOT}/test/av1_fht4x4_test.cc"
"${AOM_ROOT}/test/av1_fht4x8_test.cc"
"${AOM_ROOT}/test/av1_fht8x16_test.cc"
- "${AOM_ROOT}/test/av1_fht8x4_test.cc"
- "${AOM_ROOT}/test/fht32x32_test.cc")
+ "${AOM_ROOT}/test/av1_fht8x4_test.cc")
+
+ endif ()
+
+ if (CONFIG_GLOBAL_MOTION)
+ set(AOM_UNIT_TEST_ENCODER_INTRIN_SSE4_1
+ ${AOM_UNIT_TEST_ENCODER_INTRIN_SSE4_1}
+ "${AOM_ROOT}/test/corner_match_test.cc")
endif ()
if (CONFIG_MOTION_VAR)
@@ -177,6 +189,12 @@ if (CONFIG_AV1_ENCODER)
"${AOM_ROOT}/test/obmc_sad_test.cc"
"${AOM_ROOT}/test/obmc_variance_test.cc")
endif ()
+
+ if (CONFIG_TX64X64)
+ set(AOM_UNIT_TEST_ENCODER_SOURCES
+ ${AOM_UNIT_TEST_ENCODER_SOURCES}
+ "${AOM_ROOT}/test/av1_fht64x64_test.cc")
+ endif ()
endif ()
if (CONFIG_AV1_DECODER AND CONFIG_AV1_ENCODER)
@@ -209,7 +227,7 @@ if (CONFIG_AV1_DECODER AND CONFIG_AV1_ENCODER)
endif ()
if (CONFIG_HIGHBITDEPTH)
- if (CONFIG_AV1)
+ if (CONFIG_AV1_ENCODER)
set(AOM_UNIT_TEST_COMMON_INTRIN_SSE4_1
${AOM_UNIT_TEST_COMMON_INTRIN_SSE4_1}
"${AOM_ROOT}/test/av1_highbd_iht_test.cc"
@@ -245,8 +263,14 @@ endif ()
# exist before this function is called.
function (setup_aom_test_targets)
add_library(test_aom_common OBJECT ${AOM_UNIT_TEST_COMMON_SOURCES})
- add_library(test_aom_decoder OBJECT ${AOM_UNIT_TEST_DECODER_SOURCES})
- add_library(test_aom_encoder OBJECT ${AOM_UNIT_TEST_ENCODER_SOURCES})
+
+ if (CONFIG_AV1_DECODER)
+ add_library(test_aom_decoder OBJECT ${AOM_UNIT_TEST_DECODER_SOURCES})
+ endif ()
+
+ if (CONFIG_AV1_ENCODER)
+ add_library(test_aom_encoder OBJECT ${AOM_UNIT_TEST_ENCODER_SOURCES})
+ endif ()
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} test_aom_common test_aom_decoder
test_aom_encoder PARENT_SCOPE)
@@ -255,7 +279,7 @@ function (setup_aom_test_targets)
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:test_aom_common>)
- if (CONFIG_DECODERS)
+ if (CONFIG_AV1_DECODER)
target_sources(test_libaom PUBLIC
$<TARGET_OBJECTS:aom_decoder_app_util>
$<TARGET_OBJECTS:test_aom_decoder>)
@@ -265,7 +289,7 @@ function (setup_aom_test_targets)
endif ()
endif ()
- if (CONFIG_ENCODERS)
+ if (CONFIG_AV1_ENCODER)
target_sources(test_libaom PUBLIC
$<TARGET_OBJECTS:test_aom_encoder>
$<TARGET_OBJECTS:aom_encoder_app_util>)
@@ -273,14 +297,14 @@ function (setup_aom_test_targets)
if (CONFIG_ENCODE_PERF_TESTS)
target_sources(test_libaom PUBLIC ${AOM_ENCODE_PERF_TEST_SOURCES})
endif ()
- endif ()
- target_link_libraries(test_libaom PUBLIC aom gtest)
+ add_executable(test_intra_pred_speed
+ ${AOM_TEST_INTRA_PRED_SPEED_SOURCES}
+ $<TARGET_OBJECTS:aom_common_app_util>)
+ target_link_libraries(test_intra_pred_speed ${AOM_LIB_LINK_TYPE} aom gtest)
+ endif ()
- add_executable(test_intra_pred_speed
- ${AOM_TEST_INTRA_PRED_SPEED_SOURCES}
- $<TARGET_OBJECTS:aom_common_app_util>)
- target_link_libraries(test_intra_pred_speed PUBLIC aom gtest)
+ target_link_libraries(test_libaom ${AOM_LIB_LINK_TYPE} aom gtest)
if (CONFIG_LIBYUV)
target_sources(test_libaom PUBLIC $<TARGET_OBJECTS:yuv>)
@@ -300,16 +324,73 @@ function (setup_aom_test_targets)
if (HAVE_SSE4_1)
add_intrinsics_source_to_target("-msse4.1" "test_libaom"
"AOM_UNIT_TEST_COMMON_INTRIN_SSE4_1")
+ if (CONFIG_AV1_ENCODER)
+ if (AOM_UNIT_TEST_ENCODER_INTRIN_SSE4_1)
+ add_intrinsics_source_to_target("-msse4.1" "test_libaom"
+ "AOM_UNIT_TEST_ENCODER_INTRIN_SSE4_1")
+ endif ()
+ endif ()
endif ()
if (HAVE_NEON)
add_intrinsics_source_to_target("${AOM_NEON_INTRIN_FLAG}" "test_libaom"
"AOM_UNIT_TEST_COMMON_INTRIN_NEON")
endif ()
- add_custom_target(testdata
- COMMAND ${CMAKE_COMMAND}
- -DAOM_CONFIG_DIR="${AOM_CONFIG_DIR}"
- -DAOM_ROOT="${AOM_ROOT}"
- -P "${AOM_ROOT}/test/test_worker.cmake"
- SOURCES ${AOM_TEST_DATA_LIST})
+ make_test_data_lists("${AOM_UNIT_TEST_DATA_LIST_FILE}"
+ test_files test_file_checksums)
+ list(LENGTH test_files num_test_files)
+ list(LENGTH test_file_checksums num_test_file_checksums)
+
+ math(EXPR max_file_index "${num_test_files} - 1")
+ foreach (test_index RANGE ${max_file_index})
+ list(GET test_files ${test_index} test_file)
+ list(GET test_file_checksums ${test_index} test_file_checksum)
+ add_custom_target(testdata_${test_index}
+ COMMAND ${CMAKE_COMMAND}
+ -DAOM_CONFIG_DIR="${AOM_CONFIG_DIR}"
+ -DAOM_ROOT="${AOM_ROOT}"
+ -DAOM_TEST_FILE="${test_file}"
+ -DAOM_TEST_CHECKSUM=${test_file_checksum}
+ -P "${AOM_ROOT}/test/test_data_download_worker.cmake")
+ set(testdata_targets ${testdata_targets} testdata_${test_index})
+ endforeach ()
+
+ # Create a custom build target for running each test data download target.
+ add_custom_target(testdata)
+ add_dependencies(testdata ${testdata_targets})
+
+ # Pick a reasonable number of targets (this controls parallelization).
+ ProcessorCount(num_test_targets)
+ if (num_test_targets EQUAL 0)
+ # Just default to 10 targets when there's no processor count available.
+ set(num_test_targets 10)
+ endif ()
+
+ # TODO(tomfinegan): This needs some work for MSVC and Xcode. Executable suffix
+ # and config based executable output paths are the obvious issues.
+ math(EXPR max_shard_index "${num_test_targets} - 1")
+ foreach (shard_index RANGE ${max_shard_index})
+ set(test_name "test_${shard_index}")
+ add_custom_target(${test_name}
+ COMMAND ${CMAKE_COMMAND}
+ -DGTEST_SHARD_INDEX=${shard_index}
+ -DGTEST_TOTAL_SHARDS=${num_test_targets}
+ -DTEST_LIBAOM=$<TARGET_FILE:test_libaom>
+ -P "${AOM_ROOT}/test/test_runner.cmake"
+ DEPENDS testdata test_libaom)
+ set(test_targets ${test_targets} ${test_name})
+ endforeach ()
+ add_custom_target(runtests)
+ add_dependencies(runtests ${test_targets})
+
+ if (MSVC)
+ set_target_properties(${testdata_targets} PROPERTIES
+ EXCLUDE_FROM_DEFAULT_BUILD TRUE)
+ set_target_properties(${test_targets} PROPERTIES
+ EXCLUDE_FROM_DEFAULT_BUILD TRUE)
+ set_target_properties(testdata runtests PROPERTIES
+ EXCLUDE_FROM_DEFAULT_BUILD TRUE)
+ endif ()
endfunction ()
+
+endif () # AOM_TEST_TEST_CMAKE_
diff --git a/third_party/aom/test/test.mk b/third_party/aom/test/test.mk
index fb0ab371e..45bb21286 100644
--- a/third_party/aom/test/test.mk
+++ b/third_party/aom/test/test.mk
@@ -20,7 +20,6 @@ LIBAOM_TEST_SRCS-yes += util.h
LIBAOM_TEST_SRCS-yes += video_source.h
LIBAOM_TEST_SRCS-yes += transform_test_base.h
LIBAOM_TEST_SRCS-yes += function_equivalence_test.h
-LIBAOM_TEST_SRCS-yes += warp_filter_test_util.h
##
## BLACK BOX TESTS
@@ -28,18 +27,18 @@ LIBAOM_TEST_SRCS-yes += warp_filter_test_util.h
## Black box tests only use the public API.
##
LIBAOM_TEST_SRCS-yes += ../md5_utils.h ../md5_utils.c
-LIBAOM_TEST_SRCS-$(CONFIG_DECODERS) += ivf_video_source.h
-LIBAOM_TEST_SRCS-$(CONFIG_ENCODERS) += ../y4minput.h ../y4minput.c
-LIBAOM_TEST_SRCS-$(CONFIG_ENCODERS) += altref_test.cc
-LIBAOM_TEST_SRCS-$(CONFIG_ENCODERS) += aq_segment_test.cc
-LIBAOM_TEST_SRCS-$(CONFIG_ENCODERS) += datarate_test.cc
-LIBAOM_TEST_SRCS-$(CONFIG_ENCODERS) += encode_api_test.cc
-LIBAOM_TEST_SRCS-$(CONFIG_ENCODERS) += error_resilience_test.cc
-LIBAOM_TEST_SRCS-$(CONFIG_ENCODERS) += i420_video_source.h
-#LIBAOM_TEST_SRCS-$(CONFIG_ENCODERS) += realtime_test.cc
-#LIBAOM_TEST_SRCS-$(CONFIG_ENCODERS) += resize_test.cc
-LIBAOM_TEST_SRCS-$(CONFIG_ENCODERS) += y4m_video_source.h
-LIBAOM_TEST_SRCS-$(CONFIG_ENCODERS) += yuv_video_source.h
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_DECODER) += ivf_video_source.h
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += ../y4minput.h ../y4minput.c
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += altref_test.cc
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += aq_segment_test.cc
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += datarate_test.cc
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += encode_api_test.cc
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += error_resilience_test.cc
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += i420_video_source.h
+#LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += realtime_test.cc
+#LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += resize_test.cc
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += y4m_video_source.h
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += yuv_video_source.h
#LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += level_test.cc
LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += active_map_refresh_test.cc
@@ -51,14 +50,14 @@ LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += lossless_test.cc
LIBAOM_TEST_SRCS-yes += decode_test_driver.cc
LIBAOM_TEST_SRCS-yes += decode_test_driver.h
-LIBAOM_TEST_SRCS-$(CONFIG_ENCODERS) += encode_test_driver.cc
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += encode_test_driver.cc
LIBAOM_TEST_SRCS-yes += encode_test_driver.h
## IVF writing.
-LIBAOM_TEST_SRCS-$(CONFIG_ENCODERS) += ../ivfenc.c ../ivfenc.h
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += ../ivfenc.c ../ivfenc.h
## Y4m parsing.
-LIBAOM_TEST_SRCS-$(CONFIG_ENCODERS) += y4m_test.cc ../y4menc.c ../y4menc.h
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += y4m_test.cc ../y4menc.c ../y4menc.h
## WebM Parsing
ifeq ($(CONFIG_WEBM_IO), yes)
@@ -66,14 +65,14 @@ LIBWEBM_PARSER_SRCS += ../third_party/libwebm/mkvparser/mkvparser.cc
LIBWEBM_PARSER_SRCS += ../third_party/libwebm/mkvparser/mkvreader.cc
LIBWEBM_PARSER_SRCS += ../third_party/libwebm/mkvparser/mkvparser.h
LIBWEBM_PARSER_SRCS += ../third_party/libwebm/mkvparser/mkvreader.h
-LIBAOM_TEST_SRCS-$(CONFIG_DECODERS) += $(LIBWEBM_PARSER_SRCS)
-LIBAOM_TEST_SRCS-$(CONFIG_DECODERS) += ../tools_common.h
-LIBAOM_TEST_SRCS-$(CONFIG_DECODERS) += ../webmdec.cc
-LIBAOM_TEST_SRCS-$(CONFIG_DECODERS) += ../webmdec.h
-LIBAOM_TEST_SRCS-$(CONFIG_DECODERS) += webm_video_source.h
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_DECODER) += $(LIBWEBM_PARSER_SRCS)
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_DECODER) += ../tools_common.h
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_DECODER) += ../webmdec.cc
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_DECODER) += ../webmdec.h
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_DECODER) += webm_video_source.h
endif
-LIBAOM_TEST_SRCS-$(CONFIG_DECODERS) += decode_api_test.cc
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_DECODER) += decode_api_test.cc
# Currently we only support decoder perf tests for av1. Also they read from WebM
# files, so WebM IO is required.
@@ -82,7 +81,6 @@ ifeq ($(CONFIG_DECODE_PERF_TESTS)$(CONFIG_AV1_DECODER)$(CONFIG_WEBM_IO), \
LIBAOM_TEST_SRCS-yes += decode_perf_test.cc
endif
-# encode perf tests are av1 only
ifeq ($(CONFIG_ENCODE_PERF_TESTS)$(CONFIG_AV1_ENCODER), yesyes)
LIBAOM_TEST_SRCS-yes += encode_perf_test.cc
endif
@@ -142,11 +140,13 @@ LIBAOM_TEST_SRCS-yes += simd_cmp_impl.h
LIBAOM_TEST_SRCS-$(HAVE_SSE2) += simd_cmp_sse2.cc
LIBAOM_TEST_SRCS-$(HAVE_SSSE3) += simd_cmp_ssse3.cc
LIBAOM_TEST_SRCS-$(HAVE_SSE4_1) += simd_cmp_sse4.cc
+LIBAOM_TEST_SRCS-$(HAVE_AVX2) += simd_cmp_avx2.cc
LIBAOM_TEST_SRCS-$(HAVE_NEON) += simd_cmp_neon.cc
LIBAOM_TEST_SRCS-yes += simd_impl.h
LIBAOM_TEST_SRCS-$(HAVE_SSE2) += simd_sse2_test.cc
LIBAOM_TEST_SRCS-$(HAVE_SSSE3) += simd_ssse3_test.cc
LIBAOM_TEST_SRCS-$(HAVE_SSE4_1) += simd_sse4_test.cc
+LIBAOM_TEST_SRCS-$(HAVE_AVX2) += simd_avx2_test.cc
LIBAOM_TEST_SRCS-$(HAVE_NEON) += simd_neon_test.cc
LIBAOM_TEST_SRCS-yes += intrapred_test.cc
LIBAOM_TEST_SRCS-$(CONFIG_INTRABC) += intrabc_test.cc
@@ -162,13 +162,21 @@ LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += error_block_test.cc
#LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += av1_quantize_test.cc
LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += subtract_test.cc
LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += arf_freq_test.cc
-
+ifneq ($(CONFIG_AOM_QM), yes)
+ifneq ($(CONFIG_NEW_QUANT), yes)
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += quantize_func_test.cc
+endif
+endif
LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += av1_inv_txfm_test.cc
LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += av1_dct_test.cc
LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += av1_fht4x4_test.cc
LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += av1_fht8x8_test.cc
LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += av1_fht16x16_test.cc
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += av1_fht32x32_test.cc
+ifeq ($(CONFIG_TX64X64),yes)
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += av1_fht64x64_test.cc
+endif
ifeq ($(CONFIG_EXT_TX),yes)
LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += av1_fht4x8_test.cc
LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += av1_fht8x4_test.cc
@@ -176,7 +184,6 @@ LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += av1_fht8x16_test.cc
LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += av1_fht16x8_test.cc
LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += av1_fht16x32_test.cc
LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += av1_fht32x16_test.cc
-LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += fht32x32_test.cc
endif
LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += sum_squares_test.cc
@@ -185,8 +192,8 @@ LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += blend_a64_mask_test.cc
LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += blend_a64_mask_1d_test.cc
ifeq ($(CONFIG_EXT_INTER),yes)
-LIBAOM_TEST_SRCS-$(HAVE_SSSE3) += masked_variance_test.cc
-LIBAOM_TEST_SRCS-$(HAVE_SSSE3) += masked_sad_test.cc
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += masked_variance_test.cc
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += masked_sad_test.cc
LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += av1_wedge_utils_test.cc
endif
@@ -217,7 +224,7 @@ endif
ifeq ($(CONFIG_INTERNAL_STATS),yes)
LIBAOM_TEST_SRCS-$(CONFIG_HIGHBITDEPTH) += hbd_metrics_test.cc
endif
-LIBAOM_TEST_SRCS-$(CONFIG_ENCODERS) += sad_test.cc
+LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += sad_test.cc
LIBAOM_TEST_SRCS-$(CONFIG_AV1) += av1_txfm_test.h
LIBAOM_TEST_SRCS-$(CONFIG_AV1) += av1_txfm_test.cc
LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += av1_fwd_txfm1d_test.cc
@@ -226,13 +233,21 @@ LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += av1_fwd_txfm2d_test.cc
LIBAOM_TEST_SRCS-$(CONFIG_AV1_ENCODER) += av1_inv_txfm2d_test.cc
LIBAOM_TEST_SRCS-$(CONFIG_AV1) += av1_convolve_test.cc
LIBAOM_TEST_SRCS-$(CONFIG_AV1) += av1_convolve_optimz_test.cc
-ifneq ($(findstring yes,$(CONFIG_GLOBAL_MOTION) $(CONFIG_WARPED_MOTION)),)
+ifneq ($(findstring yes,$(CONFIG_GLOBAL_MOTION)$(CONFIG_WARPED_MOTION)),)
+LIBAOM_TEST_SRCS-$(HAVE_SSE2) += warp_filter_test_util.h
LIBAOM_TEST_SRCS-$(HAVE_SSE2) += warp_filter_test.cc warp_filter_test_util.cc
endif
ifeq ($(CONFIG_LOOP_RESTORATION),yes)
+LIBAOM_TEST_SRCS-$(HAVE_SSE2) += hiprec_convolve_test_util.h
+LIBAOM_TEST_SRCS-$(HAVE_SSE2) += hiprec_convolve_test.cc
+LIBAOM_TEST_SRCS-$(HAVE_SSE2) += hiprec_convolve_test_util.cc
LIBAOM_TEST_SRCS-$(HAVE_SSE4_1) += selfguided_filter_test.cc
endif
+ifeq ($(CONFIG_GLOBAL_MOTION)$(CONFIG_AV1_ENCODER),yesyes)
+LIBAOM_TEST_SRCS-$(HAVE_SSE4_1) += corner_match_test.cc
+endif
+
TEST_INTRA_PRED_SPEED_SRCS-yes := test_intra_pred_speed.cc
TEST_INTRA_PRED_SPEED_SRCS-yes += ../md5_utils.h ../md5_utils.c
diff --git a/third_party/aom/test/test_data_download_worker.cmake b/third_party/aom/test/test_data_download_worker.cmake
new file mode 100644
index 000000000..d7bf99edd
--- /dev/null
+++ b/third_party/aom/test/test_data_download_worker.cmake
@@ -0,0 +1,40 @@
+##
+## 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.
+##
+include("${AOM_ROOT}/test/test_data_util.cmake")
+
+if (NOT AOM_ROOT OR NOT AOM_CONFIG_DIR OR NOT AOM_TEST_FILE
+ OR NOT AOM_TEST_CHECKSUM)
+ message(FATAL_ERROR
+ "AOM_ROOT, AOM_CONFIG_DIR, AOM_TEST_FILE and AOM_TEST_CHECKSUM must be
+ defined.")
+endif ()
+
+set(AOM_TEST_DATA_URL
+ "https://storage.googleapis.com/downloads.webmproject.org/test_data/libvpx")
+set(AOM_TEST_DATA_PATH "$ENV{LIBAOM_TEST_DATA_PATH}")
+
+if ("${AOM_TEST_DATA_PATH}" STREQUAL "")
+ message(WARNING "Writing test data to ${AOM_CONFIG_DIR}, set "
+ "$LIBAOM_TEST_DATA_PATH in your environment to avoid this warning.")
+ set(AOM_TEST_DATA_PATH "${AOM_CONFIG_DIR}")
+endif ()
+
+if (NOT EXISTS "${AOM_TEST_DATA_PATH}")
+ file(MAKE_DIRECTORY "${AOM_TEST_DATA_PATH}")
+endif ()
+
+expand_test_file_paths("AOM_TEST_FILE" "${AOM_TEST_DATA_PATH}" "filepath")
+expand_test_file_paths("AOM_TEST_FILE" "${AOM_TEST_DATA_URL}" "url")
+
+check_file("${filepath}" "${AOM_TEST_CHECKSUM}" "needs_download")
+if (needs_download)
+ download_test_file("${url}" "${AOM_TEST_CHECKSUM}" "${filepath}")
+endif ()
diff --git a/third_party/aom/test/test_data_util.cmake b/third_party/aom/test/test_data_util.cmake
index f096e4e12..e4641049d 100644
--- a/third_party/aom/test/test_data_util.cmake
+++ b/third_party/aom/test/test_data_util.cmake
@@ -11,15 +11,14 @@
# Parses test/test-data.sha1 and writes captured file names and checksums to
# $out_files and $out_checksums as lists.
-function (make_test_data_lists out_files out_checksums)
- if (NOT AOM_TEST_DATA_LIST OR NOT EXISTS "${AOM_TEST_DATA_LIST}")
- message(FATAL_ERROR "AOM_TEST_DATA_LIST (${AOM_TEST_DATA_LIST}) missing or "
- "variable empty.")
+function (make_test_data_lists test_data_file out_files out_checksums)
+ if (NOT test_data_file OR NOT EXISTS "${test_data_file}")
+ message(FATAL_ERROR "Test info file missing or empty (${test_data_file})")
endif ()
- # Read test-data.sha1 into $files_and_checksums. $files_and_checksums becomes
- # a list with an entry for each line from $AOM_TEST_DATA_LIST.
- file(STRINGS "${AOM_TEST_DATA_LIST}" files_and_checksums)
+ # Read $test_data_file into $files_and_checksums. $files_and_checksums becomes
+ # a list with an entry for each line from $test_data_file.
+ file(STRINGS "${test_data_file}" files_and_checksums)
# Iterate over the list of lines and split it into $checksums and $filenames.
foreach (line ${files_and_checksums})
@@ -33,8 +32,10 @@ function (make_test_data_lists out_files out_checksums)
set(filenames ${filenames} ${filename})
endforeach ()
- if (NOT checksums OR NOT filenames)
- message(FATAL_ERROR "Parsing of ${AOM_TEST_DATA_LIST} failed.")
+ list(LENGTH filenames num_files)
+ list(LENGTH checksums num_checksums)
+ if (NOT checksums OR NOT filenames OR NOT num_files EQUAL num_checksums)
+ message(FATAL_ERROR "Parsing of ${test_data_file} failed.")
endif ()
set(${out_checksums} ${checksums} PARENT_SCOPE)
@@ -62,7 +63,9 @@ function (check_file local_path expected_checksum out_needs_update)
unset(${out_needs_update} PARENT_SCOPE)
else ()
set(${out_needs_update} 1 PARENT_SCOPE)
+ return ()
endif ()
+ message("${local_path} up to date.")
endfunction ()
# Downloads data from $file_url, confirms that $file_checksum matches, and
diff --git a/third_party/aom/test/test_intra_pred_speed.cc b/third_party/aom/test/test_intra_pred_speed.cc
index c4253628e..70d82484c 100644
--- a/third_party/aom/test/test_intra_pred_speed.cc
+++ b/third_party/aom/test/test_intra_pred_speed.cc
@@ -31,17 +31,16 @@ namespace {
typedef void (*AvxPredFunc)(uint8_t *dst, ptrdiff_t y_stride,
const uint8_t *above, const uint8_t *left);
-#if CONFIG_ALT_INTRA
-const int kNumAv1IntraFuncs = 14;
-#else
-const int kNumAv1IntraFuncs = 13;
-#endif // CONFIG_ALT_INTRA
+const int kNumAv1IntraFuncs = INTRA_MODES + 3; // 4 DC predictor variants.
const char *kAv1IntraPredNames[kNumAv1IntraFuncs] = {
- "DC_PRED", "DC_LEFT_PRED", "DC_TOP_PRED", "DC_128_PRED", "V_PRED",
- "H_PRED", "D45_PRED", "D135_PRED", "D117_PRED", "D153_PRED",
- "D207_PRED", "D63_PRED", "TM_PRED",
+ "DC_PRED", "DC_LEFT_PRED", "DC_TOP_PRED", "DC_128_PRED", "V_PRED",
+ "H_PRED", "D45_PRED", "D135_PRED", "D117_PRED", "D153_PRED",
+ "D207_PRED", "D63_PRED", "TM_PRED",
#if CONFIG_ALT_INTRA
- "SMOOTH_PRED"
+ "SMOOTH_PRED",
+#if CONFIG_SMOOTH_HV
+ "SMOOTH_V_PRED", "SMOOTH_H_PRED",
+#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
};
@@ -104,7 +103,11 @@ void TestIntraPred4(AvxPredFunc const *pred_funcs) {
"b852f42e6c4991d415400332d567872f",
#if CONFIG_ALT_INTRA
"828c49a4248993cce4876fa26eab697f",
- "718c8cee9011f92ef31f77a9a7560010"
+ "718c8cee9011f92ef31f77a9a7560010",
+#if CONFIG_SMOOTH_HV
+ "b37eeadbbd9e3bdff023a5097b59213a",
+ "d6fb9c659d82c78f0d0c891da6cba87f",
+#endif // CONFIG_SMOOTH_HV
#else
"309a618577b27c648f9c5ee45252bc8f",
#endif // CONFIG_ALT_INTRA
@@ -129,7 +132,11 @@ void TestIntraPred8(AvxPredFunc const *pred_funcs) {
"7a09adb0fa6c2bf889a99dd816622feb",
#if CONFIG_ALT_INTRA
"f6ade499c626d38eb70661184b79bc57",
- "1ad5b106c79b792e514ba25e87139b5e"
+ "1ad5b106c79b792e514ba25e87139b5e",
+#if CONFIG_SMOOTH_HV
+ "fe0d359b91a1d8141483d2e032f1b75f",
+ "0cfd7603ced02829d1ce18b6795d73d0",
+#endif // CONFIG_SMOOTH_HV
#else
"815b75c8e0d91cc1ae766dc5d3e445a3",
#endif // CONFIG_ALT_INTRA
@@ -154,7 +161,11 @@ void TestIntraPred16(AvxPredFunc const *pred_funcs) {
"f7063ccbc29f87303d5c3d0555b08944",
#if CONFIG_ALT_INTRA
"7adcaaa3554eb71a81fc48cb9043984b",
- "c0acea4397c1b4d54a21bbcec5731dff"
+ "c0acea4397c1b4d54a21bbcec5731dff",
+#if CONFIG_SMOOTH_HV
+ "f15b8712f0f064e98a7d804d3074afa7",
+ "01a09cdb8edd06d840c84643032fc02f",
+#endif // CONFIG_SMOOTH_HV
#else
"b8a41aa968ec108af447af4217cba91b",
#endif // CONFIG_ALT_INTRA
@@ -179,7 +190,11 @@ void TestIntraPred32(AvxPredFunc const *pred_funcs) {
"d520125ebd512c63c301bf67fea8e059",
#if CONFIG_ALT_INTRA
"297e8fbb5d33c29b12b228fa9d7c40a4",
- "31b9296d70dd82238c87173e6d5e65fd"
+ "31b9296d70dd82238c87173e6d5e65fd",
+#if CONFIG_SMOOTH_HV
+ "f1041f77a34e86aaf30ea779ba84a2e8",
+ "83e2b744a6a3d82321744442b1db945c",
+#endif // CONFIG_SMOOTH_HV
#else
"9e1370c6d42e08d357d9612c93a71cfc",
#endif // CONFIG_ALT_INTRA
@@ -193,11 +208,12 @@ void TestIntraPred32(AvxPredFunc const *pred_funcs) {
// Defines a test case for |arch| (e.g., C, SSE2, ...) passing the predictors
// to |test_func|. The test name is 'arch.test_func', e.g., C.TestIntraPred4.
#define INTRA_PRED_TEST(arch, test_func, dc, dc_left, dc_top, dc_128, v, h, \
- d45e, d135, d117, d153, d207e, d63e, tm, smooth) \
+ d45e, d135, d117, d153, d207e, d63e, tm, smooth, \
+ smooth_v, smooth_h) \
TEST(arch, test_func) { \
static const AvxPredFunc aom_intra_pred[] = { \
- dc, dc_left, dc_top, dc_128, v, h, d45e, \
- d135, d117, d153, d207e, d63e, tm, smooth \
+ dc, dc_left, dc_top, dc_128, v, h, d45e, d135, \
+ d117, d153, d207e, d63e, tm, smooth, smooth_v, smooth_h \
}; \
test_func(aom_intra_pred); \
}
@@ -208,9 +224,18 @@ void TestIntraPred32(AvxPredFunc const *pred_funcs) {
#if CONFIG_ALT_INTRA
#define tm_pred_func aom_paeth_predictor_4x4_c
#define smooth_pred_func aom_smooth_predictor_4x4_c
+#if CONFIG_SMOOTH_HV
+#define smooth_v_pred_func aom_smooth_v_predictor_4x4_c
+#define smooth_h_pred_func aom_smooth_h_predictor_4x4_c
+#else
+#define smooth_v_pred_func NULL
+#define smooth_h_pred_func NULL
+#endif // CONFIG_SMOOTH_HV
#else
#define tm_pred_func aom_tm_predictor_4x4_c
#define smooth_pred_func NULL
+#define smooth_v_pred_func NULL
+#define smooth_h_pred_func NULL
#endif // CONFIG_ALT_INTRA
INTRA_PRED_TEST(C, TestIntraPred4, aom_dc_predictor_4x4_c,
@@ -219,10 +244,13 @@ INTRA_PRED_TEST(C, TestIntraPred4, aom_dc_predictor_4x4_c,
aom_h_predictor_4x4_c, aom_d45e_predictor_4x4_c,
aom_d135_predictor_4x4_c, aom_d117_predictor_4x4_c,
aom_d153_predictor_4x4_c, aom_d207e_predictor_4x4_c,
- aom_d63e_predictor_4x4_c, tm_pred_func, smooth_pred_func)
+ aom_d63e_predictor_4x4_c, tm_pred_func, smooth_pred_func,
+ smooth_v_pred_func, smooth_h_pred_func)
#undef tm_pred_func
#undef smooth_pred_func
+#undef smooth_v_pred_func
+#undef smooth_h_pred_func
#if HAVE_SSE2
#if CONFIG_ALT_INTRA
@@ -235,7 +263,7 @@ INTRA_PRED_TEST(SSE2, TestIntraPred4, aom_dc_predictor_4x4_sse2,
aom_dc_left_predictor_4x4_sse2, aom_dc_top_predictor_4x4_sse2,
aom_dc_128_predictor_4x4_sse2, aom_v_predictor_4x4_sse2,
aom_h_predictor_4x4_sse2, NULL, NULL, NULL, NULL, NULL, NULL,
- tm_pred_func, NULL)
+ tm_pred_func, NULL, NULL, NULL)
#undef tm_pred_func
#endif // HAVE_SSE2
@@ -243,7 +271,7 @@ INTRA_PRED_TEST(SSE2, TestIntraPred4, aom_dc_predictor_4x4_sse2,
#if HAVE_SSSE3
INTRA_PRED_TEST(SSSE3, TestIntraPred4, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, aom_d153_predictor_4x4_ssse3, NULL,
- aom_d63e_predictor_4x4_ssse3, NULL, NULL)
+ aom_d63e_predictor_4x4_ssse3, NULL, NULL, NULL, NULL)
#endif // HAVE_SSSE3
#if HAVE_DSPR2
@@ -254,7 +282,7 @@ INTRA_PRED_TEST(SSSE3, TestIntraPred4, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
#endif // CONFIG_ALT_INTRA
INTRA_PRED_TEST(DSPR2, TestIntraPred4, aom_dc_predictor_4x4_dspr2, NULL, NULL,
NULL, NULL, aom_h_predictor_4x4_dspr2, NULL, NULL, NULL, NULL,
- NULL, NULL, tm_pred_func, NULL)
+ NULL, NULL, tm_pred_func, NULL, NULL, NULL)
#undef tm_pred_func
#endif // HAVE_DSPR2
@@ -268,7 +296,7 @@ INTRA_PRED_TEST(NEON, TestIntraPred4, aom_dc_predictor_4x4_neon,
aom_dc_left_predictor_4x4_neon, aom_dc_top_predictor_4x4_neon,
aom_dc_128_predictor_4x4_neon, aom_v_predictor_4x4_neon,
aom_h_predictor_4x4_neon, NULL, aom_d135_predictor_4x4_neon,
- NULL, NULL, NULL, NULL, tm_pred_func, NULL)
+ NULL, NULL, NULL, NULL, tm_pred_func, NULL, NULL, NULL)
#undef tm_pred_func
#endif // HAVE_NEON
@@ -282,7 +310,7 @@ INTRA_PRED_TEST(MSA, TestIntraPred4, aom_dc_predictor_4x4_msa,
aom_dc_left_predictor_4x4_msa, aom_dc_top_predictor_4x4_msa,
aom_dc_128_predictor_4x4_msa, aom_v_predictor_4x4_msa,
aom_h_predictor_4x4_msa, NULL, NULL, NULL, NULL, NULL, NULL,
- tm_pred_func, NULL)
+ tm_pred_func, NULL, NULL, NULL)
#undef tm_pred_func
#endif // HAVE_MSA
@@ -292,9 +320,18 @@ INTRA_PRED_TEST(MSA, TestIntraPred4, aom_dc_predictor_4x4_msa,
#if CONFIG_ALT_INTRA
#define tm_pred_func aom_paeth_predictor_8x8_c
#define smooth_pred_func aom_smooth_predictor_8x8_c
+#if CONFIG_SMOOTH_HV
+#define smooth_v_pred_func aom_smooth_v_predictor_8x8_c
+#define smooth_h_pred_func aom_smooth_h_predictor_8x8_c
+#else
+#define smooth_v_pred_func NULL
+#define smooth_h_pred_func NULL
+#endif // CONFIG_SMOOTH_HV
#else
#define tm_pred_func aom_tm_predictor_8x8_c
#define smooth_pred_func NULL
+#define smooth_v_pred_func NULL
+#define smooth_h_pred_func NULL
#endif // CONFIG_ALT_INTRA
INTRA_PRED_TEST(C, TestIntraPred8, aom_dc_predictor_8x8_c,
aom_dc_left_predictor_8x8_c, aom_dc_top_predictor_8x8_c,
@@ -302,9 +339,12 @@ INTRA_PRED_TEST(C, TestIntraPred8, aom_dc_predictor_8x8_c,
aom_h_predictor_8x8_c, aom_d45e_predictor_8x8_c,
aom_d135_predictor_8x8_c, aom_d117_predictor_8x8_c,
aom_d153_predictor_8x8_c, aom_d207e_predictor_8x8_c,
- aom_d63e_predictor_8x8_c, tm_pred_func, smooth_pred_func)
+ aom_d63e_predictor_8x8_c, tm_pred_func, smooth_pred_func,
+ smooth_v_pred_func, smooth_h_pred_func)
#undef tm_pred_func
#undef smooth_pred_func
+#undef smooth_v_pred_func
+#undef smooth_h_pred_func
#if HAVE_SSE2
#if CONFIG_ALT_INTRA
@@ -316,14 +356,14 @@ INTRA_PRED_TEST(SSE2, TestIntraPred8, aom_dc_predictor_8x8_sse2,
aom_dc_left_predictor_8x8_sse2, aom_dc_top_predictor_8x8_sse2,
aom_dc_128_predictor_8x8_sse2, aom_v_predictor_8x8_sse2,
aom_h_predictor_8x8_sse2, NULL, NULL, NULL, NULL, NULL, NULL,
- tm_pred_func, NULL)
+ tm_pred_func, NULL, NULL, NULL)
#undef tm_pred_func
#endif // HAVE_SSE2
#if HAVE_SSSE3
INTRA_PRED_TEST(SSSE3, TestIntraPred8, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, aom_d153_predictor_8x8_ssse3, NULL, NULL, NULL,
- NULL)
+ NULL, NULL, NULL)
#endif // HAVE_SSSE3
#if HAVE_DSPR2
@@ -334,7 +374,7 @@ INTRA_PRED_TEST(SSSE3, TestIntraPred8, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
#endif // CONFIG_ALT_INTRA
INTRA_PRED_TEST(DSPR2, TestIntraPred8, aom_dc_predictor_8x8_dspr2, NULL, NULL,
NULL, NULL, aom_h_predictor_8x8_dspr2, NULL, NULL, NULL, NULL,
- NULL, NULL, tm_pred_func, NULL)
+ NULL, NULL, tm_pred_func, NULL, NULL, NULL)
#undef tm_pred_func
#endif // HAVE_DSPR2
@@ -348,7 +388,7 @@ INTRA_PRED_TEST(NEON, TestIntraPred8, aom_dc_predictor_8x8_neon,
aom_dc_left_predictor_8x8_neon, aom_dc_top_predictor_8x8_neon,
aom_dc_128_predictor_8x8_neon, aom_v_predictor_8x8_neon,
aom_h_predictor_8x8_neon, NULL, NULL, NULL, NULL, NULL, NULL,
- tm_pred_func, NULL)
+ tm_pred_func, NULL, NULL, NULL)
#undef tm_pred_func
#endif // HAVE_NEON
@@ -362,7 +402,7 @@ INTRA_PRED_TEST(MSA, TestIntraPred8, aom_dc_predictor_8x8_msa,
aom_dc_left_predictor_8x8_msa, aom_dc_top_predictor_8x8_msa,
aom_dc_128_predictor_8x8_msa, aom_v_predictor_8x8_msa,
aom_h_predictor_8x8_msa, NULL, NULL, NULL, NULL, NULL, NULL,
- tm_pred_func, NULL)
+ tm_pred_func, NULL, NULL, NULL)
#undef tm_pred_func
#endif // HAVE_MSA
@@ -372,9 +412,18 @@ INTRA_PRED_TEST(MSA, TestIntraPred8, aom_dc_predictor_8x8_msa,
#if CONFIG_ALT_INTRA
#define tm_pred_func aom_paeth_predictor_16x16_c
#define smooth_pred_func aom_smooth_predictor_16x16_c
+#if CONFIG_SMOOTH_HV
+#define smooth_v_pred_func aom_smooth_v_predictor_16x16_c
+#define smooth_h_pred_func aom_smooth_h_predictor_16x16_c
+#else
+#define smooth_v_pred_func NULL
+#define smooth_h_pred_func NULL
+#endif // CONFIG_SMOOTH_HV
#else
#define tm_pred_func aom_tm_predictor_16x16_c
#define smooth_pred_func NULL
+#define smooth_v_pred_func NULL
+#define smooth_h_pred_func NULL
#endif // CONFIG_ALT_INTRA
INTRA_PRED_TEST(C, TestIntraPred16, aom_dc_predictor_16x16_c,
aom_dc_left_predictor_16x16_c, aom_dc_top_predictor_16x16_c,
@@ -382,9 +431,12 @@ INTRA_PRED_TEST(C, TestIntraPred16, aom_dc_predictor_16x16_c,
aom_h_predictor_16x16_c, aom_d45e_predictor_16x16_c,
aom_d135_predictor_16x16_c, aom_d117_predictor_16x16_c,
aom_d153_predictor_16x16_c, aom_d207e_predictor_16x16_c,
- aom_d63e_predictor_16x16_c, tm_pred_func, smooth_pred_func)
+ aom_d63e_predictor_16x16_c, tm_pred_func, smooth_pred_func,
+ smooth_v_pred_func, smooth_h_pred_func)
#undef tm_pred_func
#undef smooth_pred_func
+#undef smooth_v_pred_func
+#undef smooth_h_pred_func
#if HAVE_SSE2
#if CONFIG_ALT_INTRA
@@ -397,20 +449,20 @@ INTRA_PRED_TEST(SSE2, TestIntraPred16, aom_dc_predictor_16x16_sse2,
aom_dc_top_predictor_16x16_sse2,
aom_dc_128_predictor_16x16_sse2, aom_v_predictor_16x16_sse2,
aom_h_predictor_16x16_sse2, NULL, NULL, NULL, NULL, NULL, NULL,
- tm_pred_func, NULL)
+ tm_pred_func, NULL, NULL, NULL)
#undef tm_pred_func
#endif // HAVE_SSE2
#if HAVE_SSSE3
INTRA_PRED_TEST(SSSE3, TestIntraPred16, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, aom_d153_predictor_16x16_ssse3, NULL, NULL,
- NULL, NULL)
+ NULL, NULL, NULL, NULL)
#endif // HAVE_SSSE3
#if HAVE_DSPR2
INTRA_PRED_TEST(DSPR2, TestIntraPred16, aom_dc_predictor_16x16_dspr2, NULL,
NULL, NULL, NULL, aom_h_predictor_16x16_dspr2, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL)
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL)
#endif // HAVE_DSPR2
#if HAVE_NEON
@@ -424,7 +476,7 @@ INTRA_PRED_TEST(NEON, TestIntraPred16, aom_dc_predictor_16x16_neon,
aom_dc_top_predictor_16x16_neon,
aom_dc_128_predictor_16x16_neon, aom_v_predictor_16x16_neon,
aom_h_predictor_16x16_neon, NULL, NULL, NULL, NULL, NULL, NULL,
- tm_pred_func, NULL)
+ tm_pred_func, NULL, NULL, NULL)
#undef tm_pred_func
#endif // HAVE_NEON
@@ -438,7 +490,7 @@ INTRA_PRED_TEST(MSA, TestIntraPred16, aom_dc_predictor_16x16_msa,
aom_dc_left_predictor_16x16_msa, aom_dc_top_predictor_16x16_msa,
aom_dc_128_predictor_16x16_msa, aom_v_predictor_16x16_msa,
aom_h_predictor_16x16_msa, NULL, NULL, NULL, NULL, NULL, NULL,
- tm_pred_func, NULL)
+ tm_pred_func, NULL, NULL, NULL)
#undef tm_pred_func
#endif // HAVE_MSA
@@ -448,9 +500,18 @@ INTRA_PRED_TEST(MSA, TestIntraPred16, aom_dc_predictor_16x16_msa,
#if CONFIG_ALT_INTRA
#define tm_pred_func aom_paeth_predictor_32x32_c
#define smooth_pred_func aom_smooth_predictor_32x32_c
+#if CONFIG_SMOOTH_HV
+#define smooth_v_pred_func aom_smooth_v_predictor_32x32_c
+#define smooth_h_pred_func aom_smooth_h_predictor_32x32_c
+#else
+#define smooth_v_pred_func NULL
+#define smooth_h_pred_func NULL
+#endif // CONFIG_SMOOTH_HV
#else
#define tm_pred_func aom_tm_predictor_32x32_c
#define smooth_pred_func NULL
+#define smooth_v_pred_func NULL
+#define smooth_h_pred_func NULL
#endif // CONFIG_ALT_INTRA
INTRA_PRED_TEST(C, TestIntraPred32, aom_dc_predictor_32x32_c,
aom_dc_left_predictor_32x32_c, aom_dc_top_predictor_32x32_c,
@@ -458,9 +519,12 @@ INTRA_PRED_TEST(C, TestIntraPred32, aom_dc_predictor_32x32_c,
aom_h_predictor_32x32_c, aom_d45e_predictor_32x32_c,
aom_d135_predictor_32x32_c, aom_d117_predictor_32x32_c,
aom_d153_predictor_32x32_c, aom_d207e_predictor_32x32_c,
- aom_d63e_predictor_32x32_c, tm_pred_func, smooth_pred_func)
+ aom_d63e_predictor_32x32_c, tm_pred_func, smooth_pred_func,
+ smooth_v_pred_func, smooth_h_pred_func)
#undef tm_pred_func
#undef smooth_pred_func
+#undef smooth_v_pred_func
+#undef smooth_h_pred_func
#if HAVE_SSE2
#if CONFIG_ALT_INTRA
@@ -473,14 +537,14 @@ INTRA_PRED_TEST(SSE2, TestIntraPred32, aom_dc_predictor_32x32_sse2,
aom_dc_top_predictor_32x32_sse2,
aom_dc_128_predictor_32x32_sse2, aom_v_predictor_32x32_sse2,
aom_h_predictor_32x32_sse2, NULL, NULL, NULL, NULL, NULL, NULL,
- tm_pred_func, NULL)
+ tm_pred_func, NULL, NULL, NULL)
#undef tm_pred_func
#endif // HAVE_SSE2
#if HAVE_SSSE3
INTRA_PRED_TEST(SSSE3, TestIntraPred32, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, aom_d153_predictor_32x32_ssse3, NULL, NULL,
- NULL, NULL)
+ NULL, NULL, NULL, NULL)
#endif // HAVE_SSSE3
#if HAVE_NEON
@@ -494,7 +558,7 @@ INTRA_PRED_TEST(NEON, TestIntraPred32, aom_dc_predictor_32x32_neon,
aom_dc_top_predictor_32x32_neon,
aom_dc_128_predictor_32x32_neon, aom_v_predictor_32x32_neon,
aom_h_predictor_32x32_neon, NULL, NULL, NULL, NULL, NULL, NULL,
- tm_pred_func, NULL)
+ tm_pred_func, NULL, NULL, NULL)
#undef tm_pred_func
#endif // HAVE_NEON
@@ -508,7 +572,7 @@ INTRA_PRED_TEST(MSA, TestIntraPred32, aom_dc_predictor_32x32_msa,
aom_dc_left_predictor_32x32_msa, aom_dc_top_predictor_32x32_msa,
aom_dc_128_predictor_32x32_msa, aom_v_predictor_32x32_msa,
aom_h_predictor_32x32_msa, NULL, NULL, NULL, NULL, NULL, NULL,
- tm_pred_func, NULL)
+ tm_pred_func, NULL, NULL, NULL)
#undef tm_pred_func
#endif // HAVE_MSA
diff --git a/third_party/aom/test/test_runner.cmake b/third_party/aom/test/test_runner.cmake
new file mode 100644
index 000000000..48ebaf570
--- /dev/null
+++ b/third_party/aom/test/test_runner.cmake
@@ -0,0 +1,20 @@
+##
+## 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.
+##
+if (NOT GTEST_TOTAL_SHARDS OR "${GTEST_SHARD_INDEX}" STREQUAL ""
+ OR NOT TEST_LIBAOM)
+ message(FATAL_ERROR
+ "The variables GTEST_SHARD_INDEX, GTEST_TOTAL_SHARDS and TEST_LIBAOM
+ must be defined.")
+endif ()
+
+set($ENV{GTEST_SHARD_INDEX} ${GTEST_SHARD_INDEX})
+set($ENV{GTEST_TOTAL_SHARDS} ${GTEST_TOTAL_SHARDS})
+execute_process(COMMAND ${TEST_LIBAOM})
diff --git a/third_party/aom/test/test_worker.cmake b/third_party/aom/test/test_worker.cmake
deleted file mode 100644
index fa1d58130..000000000
--- a/third_party/aom/test/test_worker.cmake
+++ /dev/null
@@ -1,49 +0,0 @@
-##
-## 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.
-##
-if (NOT AOM_ROOT OR NOT AOM_CONFIG_DIR)
- message(FATAL_ERROR "AOM_ROOT AND AOM_CONFIG_DIR must be defined.")
-endif ()
-
-set(AOM_TEST_DATA_LIST "${AOM_ROOT}/test/test-data.sha1")
-set(AOM_TEST_DATA_URL "http://downloads.webmproject.org/test_data/libvpx")
-set(AOM_TEST_DATA_PATH "$ENV{LIBAOM_TEST_DATA_PATH}")
-
-include("${AOM_ROOT}/test/test_data_util.cmake")
-
-if (${AOM_TEST_DATA_PATH} STREQUAL "")
- message(WARNING "Writing test data to ${AOM_CONFIG_DIR}, set "
- "$LIBAOM_TEST_DATA_PATH in your environment to avoid this warning.")
- set(AOM_TEST_DATA_PATH "${AOM_CONFIG_DIR}")
-endif ()
-
-if (NOT EXISTS "${AOM_TEST_DATA_PATH}")
- file(MAKE_DIRECTORY "${AOM_TEST_DATA_PATH}")
-endif ()
-
-make_test_data_lists("AOM_TEST_DATA_FILES" "AOM_TEST_DATA_CHECKSUMS")
-expand_test_file_paths("AOM_TEST_DATA_FILES" "${AOM_TEST_DATA_PATH}"
- "AOM_TEST_DATA_FILE_PATHS")
-expand_test_file_paths("AOM_TEST_DATA_FILES" "${AOM_TEST_DATA_URL}"
- "AOM_TEST_DATA_URLS")
-list(LENGTH AOM_TEST_DATA_FILES num_files)
-math(EXPR num_files "${num_files} - 1")
-
-foreach (file_num RANGE ${num_files})
- list(GET AOM_TEST_DATA_FILES ${file_num} filename)
- list(GET AOM_TEST_DATA_CHECKSUMS ${file_num} checksum)
- list(GET AOM_TEST_DATA_FILE_PATHS ${file_num} filepath)
- list(GET AOM_TEST_DATA_URLS ${file_num} url)
-
- check_file("${filepath}" "${checksum}" "needs_download")
- if (needs_download)
- download_test_file("${url}" "${checksum}" "${filepath}")
- endif ()
-endforeach ()
diff --git a/third_party/aom/test/variance_test.cc b/third_party/aom/test/variance_test.cc
index 5b1003ca7..c712f96e2 100644
--- a/third_party/aom/test/variance_test.cc
+++ b/third_party/aom/test/variance_test.cc
@@ -565,8 +565,8 @@ class SubpelVarianceTest
aom_memalign(16, block_size_ * sizeof(uint16_t))));
sec_ = CONVERT_TO_BYTEPTR(reinterpret_cast<uint16_t *>(
aom_memalign(16, block_size_ * sizeof(uint16_t))));
- ref_ =
- CONVERT_TO_BYTEPTR(new uint16_t[block_size_ + width_ + height_ + 1]);
+ ref_ = CONVERT_TO_BYTEPTR(aom_memalign(
+ 16, (block_size_ + width_ + height_ + 1) * sizeof(uint16_t)));
#endif // CONFIG_HIGHBITDEPTH
}
ASSERT_TRUE(src_ != NULL);
@@ -582,7 +582,7 @@ class SubpelVarianceTest
#if CONFIG_HIGHBITDEPTH
} else {
aom_free(CONVERT_TO_SHORTPTR(src_));
- delete[] CONVERT_TO_SHORTPTR(ref_);
+ aom_free(CONVERT_TO_SHORTPTR(ref_));
aom_free(CONVERT_TO_SHORTPTR(sec_));
#endif // CONFIG_HIGHBITDEPTH
}
@@ -1277,22 +1277,6 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(5, 5, &aom_sub_pixel_avg_variance32x32_avx2, 0)));
#endif // HAVE_AVX2
-#if HAVE_MEDIA
-INSTANTIATE_TEST_CASE_P(MEDIA, AvxMseTest,
- ::testing::Values(MseParams(4, 4,
- &aom_mse16x16_media)));
-
-INSTANTIATE_TEST_CASE_P(
- MEDIA, AvxVarianceTest,
- ::testing::Values(VarianceParams(4, 4, &aom_variance16x16_media),
- VarianceParams(3, 3, &aom_variance8x8_media)));
-
-INSTANTIATE_TEST_CASE_P(
- MEDIA, AvxSubpelVarianceTest,
- ::testing::Values(make_tuple(4, 4, &aom_sub_pixel_variance16x16_media, 0),
- make_tuple(3, 3, &aom_sub_pixel_variance8x8_media, 0)));
-#endif // HAVE_MEDIA
-
#if HAVE_NEON
INSTANTIATE_TEST_CASE_P(NEON, AvxSseTest,
::testing::Values(SseParams(2, 2,
diff --git a/third_party/aom/test/warp_filter_test.cc b/third_party/aom/test/warp_filter_test.cc
index fd6608bfc..2e4e6c32b 100644
--- a/third_party/aom/test/warp_filter_test.cc
+++ b/third_party/aom/test/warp_filter_test.cc
@@ -22,12 +22,17 @@ using libaom_test::AV1HighbdWarpFilter::AV1HighbdWarpFilterTest;
namespace {
-TEST_P(AV1WarpFilterTest, CheckOutput) { RunCheckOutput(av1_warp_affine_sse2); }
+TEST_P(AV1WarpFilterTest, CheckOutput) { RunCheckOutput(GET_PARAM(3)); }
-INSTANTIATE_TEST_CASE_P(SSE2, AV1WarpFilterTest,
- libaom_test::AV1WarpFilter::GetDefaultParams());
+INSTANTIATE_TEST_CASE_P(
+ SSE2, AV1WarpFilterTest,
+ libaom_test::AV1WarpFilter::BuildParams(av1_warp_affine_sse2));
-#if CONFIG_HIGHBITDEPTH
+INSTANTIATE_TEST_CASE_P(
+ SSSE3, AV1WarpFilterTest,
+ libaom_test::AV1WarpFilter::BuildParams(av1_warp_affine_ssse3));
+
+#if CONFIG_HIGHBITDEPTH && HAVE_SSSE3
TEST_P(AV1HighbdWarpFilterTest, CheckOutput) {
RunCheckOutput(av1_highbd_warp_affine_ssse3);
}
diff --git a/third_party/aom/test/warp_filter_test_util.cc b/third_party/aom/test/warp_filter_test_util.cc
index 1ce265b60..ac7518f47 100644
--- a/third_party/aom/test/warp_filter_test_util.cc
+++ b/third_party/aom/test/warp_filter_test_util.cc
@@ -13,23 +13,19 @@
using std::tr1::tuple;
using std::tr1::make_tuple;
-using std::vector;
-using libaom_test::ACMRandom;
-using libaom_test::AV1WarpFilter::AV1WarpFilterTest;
-using libaom_test::AV1WarpFilter::WarpTestParam;
-#if CONFIG_HIGHBITDEPTH
-using libaom_test::AV1HighbdWarpFilter::AV1HighbdWarpFilterTest;
-using libaom_test::AV1HighbdWarpFilter::HighbdWarpTestParam;
-#endif
-
-::testing::internal::ParamGenerator<WarpTestParam>
-libaom_test::AV1WarpFilter::GetDefaultParams() {
- const WarpTestParam defaultParams[] = {
- make_tuple(4, 4, 50000), make_tuple(8, 8, 50000),
- make_tuple(64, 64, 1000), make_tuple(4, 16, 20000),
- make_tuple(32, 8, 10000),
+
+namespace libaom_test {
+
+namespace AV1WarpFilter {
+
+::testing::internal::ParamGenerator<WarpTestParam> BuildParams(
+ warp_affine_func filter) {
+ const WarpTestParam params[] = {
+ make_tuple(4, 4, 50000, filter), make_tuple(8, 8, 50000, filter),
+ make_tuple(64, 64, 1000, filter), make_tuple(4, 16, 20000, filter),
+ make_tuple(32, 8, 10000, filter),
};
- return ::testing::ValuesIn(defaultParams);
+ return ::testing::ValuesIn(params);
}
AV1WarpFilterTest::~AV1WarpFilterTest() {}
@@ -84,6 +80,15 @@ void AV1WarpFilterTest::generate_model(int32_t *mat, int16_t *alpha,
(4 * abs(*gamma) + 4 * abs(*delta) >= (1 << WARPEDMODEL_PREC_BITS)))
continue;
+ *alpha = ROUND_POWER_OF_TWO_SIGNED(*alpha, WARP_PARAM_REDUCE_BITS) *
+ (1 << WARP_PARAM_REDUCE_BITS);
+ *beta = ROUND_POWER_OF_TWO_SIGNED(*beta, WARP_PARAM_REDUCE_BITS) *
+ (1 << WARP_PARAM_REDUCE_BITS);
+ *gamma = ROUND_POWER_OF_TWO_SIGNED(*gamma, WARP_PARAM_REDUCE_BITS) *
+ (1 << WARP_PARAM_REDUCE_BITS);
+ *delta = ROUND_POWER_OF_TWO_SIGNED(*delta, WARP_PARAM_REDUCE_BITS) *
+ (1 << WARP_PARAM_REDUCE_BITS);
+
// We have a valid model, so finish
return;
}
@@ -136,10 +141,12 @@ void AV1WarpFilterTest::RunCheckOutput(warp_affine_func test_impl) {
delete[] output;
delete[] output2;
}
+} // namespace AV1WarpFilter
#if CONFIG_HIGHBITDEPTH
-::testing::internal::ParamGenerator<HighbdWarpTestParam>
-libaom_test::AV1HighbdWarpFilter::GetDefaultParams() {
+namespace AV1HighbdWarpFilter {
+
+::testing::internal::ParamGenerator<HighbdWarpTestParam> GetDefaultParams() {
const HighbdWarpTestParam defaultParams[] = {
make_tuple(4, 4, 50000, 8), make_tuple(8, 8, 50000, 8),
make_tuple(64, 64, 1000, 8), make_tuple(4, 16, 20000, 8),
@@ -207,6 +214,15 @@ void AV1HighbdWarpFilterTest::generate_model(int32_t *mat, int16_t *alpha,
(4 * abs(*gamma) + 4 * abs(*delta) >= (1 << WARPEDMODEL_PREC_BITS)))
continue;
+ *alpha = ROUND_POWER_OF_TWO_SIGNED(*alpha, WARP_PARAM_REDUCE_BITS) *
+ (1 << WARP_PARAM_REDUCE_BITS);
+ *beta = ROUND_POWER_OF_TWO_SIGNED(*beta, WARP_PARAM_REDUCE_BITS) *
+ (1 << WARP_PARAM_REDUCE_BITS);
+ *gamma = ROUND_POWER_OF_TWO_SIGNED(*gamma, WARP_PARAM_REDUCE_BITS) *
+ (1 << WARP_PARAM_REDUCE_BITS);
+ *delta = ROUND_POWER_OF_TWO_SIGNED(*delta, WARP_PARAM_REDUCE_BITS) *
+ (1 << WARP_PARAM_REDUCE_BITS);
+
// We have a valid model, so finish
return;
}
@@ -265,4 +281,6 @@ void AV1HighbdWarpFilterTest::RunCheckOutput(
delete[] output;
delete[] output2;
}
+} // namespace AV1HighbdWarpFilter
#endif // CONFIG_HIGHBITDEPTH
+} // namespace libaom_test
diff --git a/third_party/aom/test/warp_filter_test_util.h b/third_party/aom/test/warp_filter_test_util.h
index 6a87e46d0..651a9f830 100644
--- a/third_party/aom/test/warp_filter_test_util.h
+++ b/third_party/aom/test/warp_filter_test_util.h
@@ -26,16 +26,18 @@ namespace libaom_test {
namespace AV1WarpFilter {
-typedef void (*warp_affine_func)(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);
+typedef void (*warp_affine_func)(const int32_t *mat, const uint8_t *ref,
+ int width, int height, int stride,
+ uint8_t *pred, int p_col, int p_row,
+ int p_width, int p_height, int p_stride,
+ int subsampling_x, int subsampling_y,
+ int ref_frm, int16_t alpha, int16_t beta,
+ int16_t gamma, int16_t delta);
-typedef std::tr1::tuple<int, int, int> WarpTestParam;
+typedef std::tr1::tuple<int, int, int, warp_affine_func> WarpTestParam;
-::testing::internal::ParamGenerator<WarpTestParam> GetDefaultParams();
+::testing::internal::ParamGenerator<WarpTestParam> BuildParams(
+ warp_affine_func filter);
class AV1WarpFilterTest : public ::testing::TestWithParam<WarpTestParam> {
public:
@@ -59,7 +61,7 @@ class AV1WarpFilterTest : public ::testing::TestWithParam<WarpTestParam> {
#if CONFIG_HIGHBITDEPTH
namespace AV1HighbdWarpFilter {
typedef void (*highbd_warp_affine_func)(
- int32_t *mat, uint16_t *ref, int width, int height, int stride,
+ const int32_t *mat, const uint16_t *ref, int width, int height, int stride,
uint16_t *pred, int p_col, int p_row, int p_width, int p_height,
int p_stride, int subsampling_x, int subsampling_y, int bd, int ref_frm,
int16_t alpha, int16_t beta, int16_t gamma, int16_t delta);
diff --git a/third_party/aom/tools/build_inspector.sh b/third_party/aom/tools/build_inspector.sh
index a67aa15f6..f26ff1f64 100755
--- a/third_party/aom/tools/build_inspector.sh
+++ b/third_party/aom/tools/build_inspector.sh
@@ -6,7 +6,7 @@ fi
echo 'Building JS Inspector'
if [ ! -d ".inspect" ]; then
mkdir .inspect
- cd .inspect && emconfigure ../../configure --disable-multithread --disable-runtime-cpu-detect --target=generic-gnu --enable-accounting --enable-inspection --enable-aom_highbitdepth --extra-cflags="-D_POSIX_SOURCE"
+ cd .inspect && emconfigure ../../configure --disable-multithread --disable-runtime-cpu-detect --target=generic-gnu --enable-accounting --disable-docs --disable-unit-tests --enable-inspection --enable-highbitdepth --extra-cflags="-D_POSIX_SOURCE"
fi
cd .inspect
diff --git a/third_party/aom/tools_common.c b/third_party/aom/tools_common.c
index 353021093..d1115ac27 100644
--- a/third_party/aom/tools_common.c
+++ b/third_party/aom/tools_common.c
@@ -128,12 +128,9 @@ int read_yuv_frame(struct AvxInputContext *input_ctx, aom_image_t *yuv_frame) {
return shortread;
}
-#if CONFIG_ENCODERS
-
-static const AvxInterface aom_encoders[] = {
#if CONFIG_AV1_ENCODER
+static const AvxInterface aom_encoders[] = {
{ "av1", AV1_FOURCC, &aom_codec_av1_cx },
-#endif
};
int get_aom_encoder_count(void) {
@@ -152,15 +149,11 @@ const AvxInterface *get_aom_encoder_by_name(const char *name) {
return NULL;
}
+#endif // CONFIG_AV1_ENCODER
-#endif // CONFIG_ENCODERS
-
-#if CONFIG_DECODERS
-
-static const AvxInterface aom_decoders[] = {
#if CONFIG_AV1_DECODER
+static const AvxInterface aom_decoders[] = {
{ "av1", AV1_FOURCC, &aom_codec_av1_dx },
-#endif
};
int get_aom_decoder_count(void) {
@@ -190,8 +183,7 @@ const AvxInterface *get_aom_decoder_by_fourcc(uint32_t fourcc) {
return NULL;
}
-
-#endif // CONFIG_DECODERS
+#endif // CONFIG_AV1_DECODER
// TODO(dkovalev): move this function to aom_image.{c, h}, so it will be part
// of aom_image_t support
diff --git a/third_party/aom/tools_common.h b/third_party/aom/tools_common.h
index 8acb3709f..4bf7fd0a6 100644
--- a/third_party/aom/tools_common.h
+++ b/third_party/aom/tools_common.h
@@ -19,7 +19,7 @@
#include "aom/aom_integer.h"
#include "aom_ports/msvc.h"
-#if CONFIG_ENCODERS
+#if CONFIG_AV1_ENCODER
#include "./y4minput.h"
#endif
@@ -100,7 +100,7 @@ struct AvxInputContext {
int only_i420;
uint32_t fourcc;
struct AvxRational framerate;
-#if CONFIG_ENCODERS
+#if CONFIG_AV1_ENCODER
y4m_input y4m;
#endif
};